How to resolve "minTime in Android 2.3.4 not working" error
Comic... I've tested in an android 1.6
and 2.3.3
a very simple gps locat开发者_开发百科ion... with basically this:
LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
Location myLocation = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);
lm.requestLocationUpdates( LocationManager.GPS_PROVIDER, 10000, 0, listener);
I've tested in both [1.6 and 2.3.3] with the 10 seconds waiting for the notifiers [showing a toast at onLocationChanged
...], But strangely in an 2.3.4
version of android
it simply ignores the minTime
[does not matter if it is 10000 or 120000] it keep looking for changes all the time...
Anyone with this problem? Maybe it is not in the 2.3.4 the problem but anyone else had this problem too?
This is working as documented. minTime
is a suggestion, not a rule. Quoting the documentation:
This field is only used as a hint to conserve power, and actual time between location updates may be greater or lesser than this value.
精彩评论