开发者

How often does android requests location updates?

How often does android requests location updates? For example if you add a proximity alert to a location manager how often will it update the location?

In the documentation it says: "In case the screen goes to sleep开发者_高级运维, checks for proximity alerts happen only once every 4 minutes. This conserves battery life by ensuring that the device isn't perpetually awake"

But what if the screen doesn't go to sleep?

Thanks in advance

Mike


In the LocationManager class, there is a method called requestLocationUpdates that can be called with different set of parameters. It "Registers the current activity to be notified periodically based on the specified criteria." Two of the parameters are:

minTime: the minimum time interval for notifications, in milliseconds. 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. minDistance: the minimum distance interval for notifications, in meters

see the documentation for [LocationManager][1]

And whenever you use it, don't forget to remove the updates whenever you don't need it anymor i.e. in onPause()

I hope that helps

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜