开发者

MapView refresh event fires on regular interval i dont want that to happpen

locationManager.requestLocationUpdates(
  LocationManager.GPS_PROVIDER,30000,100, new GeoUpdateHandler() 
);

The map refreshes after a regular interval of 30 secs.

开发者_StackOverflow社区

Suppose I'm at the same position for more than 2 minutes then the map will be refreshed more than 4 times; I don't want it to happen.

Can anyone suggest me that i provide time as null?


The SDK documentation on LocationManager.requestLocationUpdates() has your answer on how to utilize the minTime and minDistance parameters to adjust the update frequency for your location:

LocationManager SDK Documentation

The frequency of notification may be controlled using the minTime and minDistance parameters. If minTime is greater than 0, the LocationManager could potentially rest for minTime milliseconds between location updates to conserve power. If minDistance is greater than 0, a location will only be broadcasted if the device moves by minDistance meters. To obtain notifications as frequently as possible, set both parameters to 0.

Basically, you are getting 30 second updates because you have set minTime to 30000. You may consider setting this value to 0 and increasing the value of minDistance larger than 100 to get location updates that are more akin to when the user physically moves a significant distance.

Hope that Helps.


The minimum time and minimum distance values are there to prevent that.

In the case of your sample code, that event should not get fired unless the user has moved more than 100 meters from the previous update. Thats what the minDistance property is about.

http://developer.android.com/reference/android/location/LocationManager.html

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜