Wednesday, November 12, 2014

Android Efficient Location Tracking

Android battery optimisation is a major problem when doing location monitoring in Android. 

There are 3 approaches to go with

1. Request one shot location when needed
 If requesting one shot, app won’t be able to get the most accurate location in one shot. 
2. Timer / services based approach for continuous location tracking 
This is done by providing a background service that implements a timer and does the continuous polling in those itnervals. Location will be most accurate in this. less battery efficient compared to the geo fence approach. 
3. Geo fence based approach for continuous location tracking 

Google play services has made it easy to monitor geo location area of certain radius which is called Geo Fence. App can create a geo fence at a point where a location is obtained with greater accuracy. Android will monitor this geo fence and when user exit or enter this region, app will be intimated. The advantage is that Applications don’t need to write own service way of handling the location changes. 

References:
http://developer.android.com/training/location/geofencing.html

No comments:

Post a Comment