Reputation: 8717
I have a service which is started on application start or phone boot.
Within the onCreate I define the parameters of requesting location updates:
lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 300000, 8046, this);
My understanding is that it will only provide an update now if either 5 minutes has passed or the user has moved more than 5 miles. What I'm actually getting is an update every minute or less. The 300000 number being 5 minutes in miliseconds, and the 8046 being 5 miles in meters. I know the service isn't getting called that often by any sort of mistake as it creates a toast when the service first starts and that's not displaying all the time.
Can anyone helps with this one?
Upvotes: 0
Views: 70
Reputation: 18151
From the document for requestLocationUpdates (long minTime, float minDistance, Criteria criteria, PendingIntent intent)
at http://developer.android.com/reference/android/location/LocationManager.html#requestLocationUpdates(long, float, android.location.Criteria, android.app.PendingIntent)
Prior to Jellybean, the minTime parameter was only a hint, and some location provider implementations ignored it. From Jellybean and onwards it is mandatory for Android compatible devices to observe both the minTime and minDistance parameters.
Probably, the provider also ignores the distance limit.
Upvotes: 1