Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android passive location provide

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">
like image 395
Sameer Z. Avatar asked Oct 12 '25 04:10

Sameer Z.


1 Answers

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.

like image 128
Theo Avatar answered Oct 15 '25 18:10

Theo