The documentation of requestLocationUpdates states that it can take longer than your minimum update interval time to receive an update. However, it also states that the location update time will never be less than your minimum update time. Your observed 75 seconds seems to contradict the documentation. It may be a bug in Android.
If you need to have your app "alive" every 90 seconds in order to phone home or something like that you probably need to make use of the AlarmManager component on top of these location updates. Be aware that stuff like that can be a burden on the battery life and users won't appreciate that.
Read the following for more information:
- http://developer.android.com/guide/topics/location/strategies.html
- Excellent PDF about location update strategies: http://www.deutsche-telekom-laboratories.com/~kyuhan/papers/MobiSys10Kim.pdf
On Wednesday, January 9, 2013 6:29:40 AM UTC-6, Narendra Singh Rathore wrote:
--Hello all,
my requirement is to get location updates every 90 seconds. I am using network provider for this.
I am doing this as given below:
locationManager.requestLocatio
nUpdates ( LocationManager.NETWORK_PROVIDER , MINIMUM_TIME_BETWEEN_UPDATES, MINIMUM_DISTANCE_CHANGE_FOR_UPDATES , new MyLocationListener() );Here, in this method, I am passing 90000 as MINIMUM_TIME_BETWEEN_UPDATES, and 0 as MINIMUM_DISTANCE_CHANGE_FOR_
UPDATES, so the expected result should be: The method onLocationChanged should be called every 90 seconds.
But, the outcome is: the onLocationChanged method is being called first in 75 seconds, then in 105 seconds, then 75, 105.....and so on..
But my requirement is to get the location updates in 90 seconds instead of different durations/periods.
In case, if location returns null, I want to get the last known location.
Please, suggest me the way to resolve this problem.
Thanks & Regards,
NSR
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