Android的无源定位提供无源、Android

2023-09-07 10:57:38 作者:会魔法的小仙女

在我的应用我不想实时定位只想所以我需要使用被动位置提供商(从其他应用程序的位置)。我有试code比较某些值链接从博客的 http://android-developers.blogspot.in/2011/06/deep-dive-into-location.html 但我可以广播的是,任何人都可以请告诉我如何实现它?在清单中,我有给你许可和广播接收器。

 <接收机器人:名字=机器人PassiveLocationChangedReceiver:启用=真正的> 

解决方案 android资讯

被动的位置提供商将为您提供位置数据时已请求位置更新其他应用获取数据。因此,如果手机上没有任何其他应用程序越来越位置更新,你不会得到他们要么。

如果你想看到每个供应商在过去,那么你必须使用getLastKnownLocation与网络或GPS提供商获得了最后一个值。结果http://developer.android.com/reference/android/location/LocationManager.html#getLastKnownLocation(java.lang.String)

有关获得COM prehensive细节位置更新看到这一点:结果http://android-developers.blogspot.com/2011/06/deep-dive-into-location.html

在这篇文章中,看一节新鲜度是指总是被最新的。如果我们能减少启动延迟到零?。查看链接code为Froyo的无源+位置更新。

In my application i did not want to real time location just want to compare some values so i need to use the passive location providers(get location from other app).i have try code link read from the blog http://android-developers.blogspot.in/2011/06/deep-dive-into-location.html but i can get the broadcast yet,can anyone please tell me how to implement it? In manifest i have give the permission and broadcast receiver.

<receiver android:name=".PassiveLocationChangedReceiver" android:enabled="true">

解决方案

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.