Android的无源定位提供 [英] android passive location provide

查看:124
本文介绍了Android的无源定位提供的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用我不想实时定位只想所以我需要使用被动位置提供商(从其他应用程序的位置)。我有试code比较某些值
<一href=\"https://$c$c.google.com/p/android-protips-location/source/browse/trunk/src/com/radioactiveyak/location_best_practices/receivers/PassiveLocationChangedReceiver.java\"相对=nofollow>链接从博客的 http://android-developers.blogspot.in/2011/06/deep-dive-into-location.html 但我可以广播的是,任何人都可以请告诉我如何实现它?
在清单中,我有给你许可和广播接收器。

 &lt;接收机器人:名字=机器人PassiveLocationChangedReceiver:启用=真正的&GT;


解决方案

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

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

有关获得COM prehensive细节位置更新看到这一点:结果
<一href=\"http://android-developers.blogspot.com/2011/06/deep-dive-into-location.html\">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.

这篇关于Android的无源定位提供的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆