Thursday, July 21, 2011

[android-developers] Re: LocationManager - called very often when moving

I dont think there is any other programs requesting GPS, I have
navigation app, but not running when I tested my app.

I only request the update one place and before that I remove any
registered listeners.

LocationManager mlocManager =
(LocationManager)getSystemService(Context.LOCATION_SERVICE);
mlocManager.removeUpdates(this);
mlocManager.requestLocationUpdates( LocationManager.GPS_PROVIDER,
delay * 60 * 1000, 25000, this);

I have also tried Float.MAX_VALUE and 0 for the distance, with same
result.
Maybe the GPS system needs to be awake often when moving, to estimate
the speed more precisely, and the underlaying software handles that.

I handle the extra calls in software, and only send if 60seconds have
passed, but I guess it could have an effect on battery, if the phone
moves alot.

On 21 Jul., 14:02, lbendlin <l...@bendlin.us> wrote:
> Is your app the only one consuming the GPS? Did you maybe register another
> listener?

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment