android passive location provide

空扰寡人 提交于 2019-12-06 07:08:21

The passive location provider will provide you with location data when other apps that have requested location updates get their data. So if no other app on the phone is getting location updates, you won't get them either.

If you want to see the last value that each provider has obtained in the past then you must use getLastKnownLocation with the network or gps provider.
http://developer.android.com/reference/android/location/LocationManager.html#getLastKnownLocation(java.lang.String)

For comprehensive details on getting location updates see this:
http://android-developers.blogspot.com/2011/06/deep-dive-into-location.html

In that article, look at the section called "Freshness means always being up to date. What if we could reduce startup latency to zero?". See the linked code for Froyo+ passive location updates.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!