开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜