New fused location provider


I haven’t read chapter 33 yet but from what I understand the new fused location provider is supposed to simplify the process of tracking the device location.
Would you still suggest reading through the chapter or should I try to learn this from google’s developer website?


Yes! The new fused location provider looks totally, absolutely sweet. I was giddy when I saw them presenting it.

The old location management was very far from ideal. I don’t see any reason to stick with it unless you’ve got a lot of existing code based on it. Even then, unless you’re doing something really smart, I’d seriously consider the fused provider.


First of all I think that this book is excellent. Great job done guys.
I would recommend for the second edition of this book that you use fused location provider, mixed with some LocationManager code (for GPS handling, checking providers, setting for accuracy… which fused location doesnt do good job here).
I’m writing android application with Google maps v2 and fused location provider (geofences, activity recognition, real time tracking in the background with PendingIntent an Intentservice) for my diploma in college.
Is there any good tutorial or sample with LocationClient updates in the background. On Google site for location updates … dates.html is sample only for working in the foreground.
Can I use something similiar that ActivityRecognition sample describe: … ition.html
Is it a good choice to use IntentService (Google uses it in sample for Activity recognition and Geofences)???
What structure, flow, classes should I use:

-foreground for showing map and route path:
-Activity->SupportMapFragment(implements callbacks for locationClient- for obtaining current location) ->RouteManager (like RunManager) ->Loaders(getting route tracking for map)-> Cursor wraper->database
-background for tracking location, location updates, geofences (add, remove), getting current path and Geofences from database with Loader:
-Activity->SupportMapFragment (for start, stop route - IntentService) ->RouteManager-> IntenService (working in background) ->Loaders->Cursor wraper->database
Now I am in the phase of adding, removing, dragging markers with geofences, loaders in the background…
Once again, very good book…


Thank you so much for the kind words. We’re waiting on some things to settle out in Android land, so it will be a while before we can get a second edition out. We’ll keep you informed when that happens.

As far as working in the background goes, for location services we recommend a combination of IntentServices and manifest-registered BroadcastReceivers. Receivers registered in the manifest will get triggered even when you’re not alive; inside those receivers, you can then choose to start up an IntentService if it’s necessary (that is, if you need to do more work).


Thank you very much for advice.
I wrote two classes GeofenceManager and LocationManager with PendingIntent to start/stop and two IntentServices and Fragments with maps v2. As Google tutorial Activity recognition and Location updates. But little diffrent and it works very good. Thanks once again.
Why everybody use Activities in tutorial including Google for maps v2 and Locations.


Do you know of any example code to illustrate the new approach you recommend?