3 ways to implement efficient location tracking in Android applications

43 %
57 %
Information about 3 ways to implement efficient location tracking in Android applications
Technology

Published on March 5, 2014

Author: sunshail

Source: slideshare.net

Description

When you think of building or developing location based Android app, does it make you think about how to do efficient location tracking in the app which does not hamper battery of device no matter who you are, app developer or Entrepreneur who is building a concept?

www.mobisoftinfotech.com 1-855-572-APPS (2777) business@mobisoftinfotech.com 3 ways to implement efficient location tracking in Android applications When you think of building or developing location based Android app, does it make you think about how to do efficient location tracking in the app which does not hamper battery of device no matter who you are, app developer or Entrepreneur who is building a concept? Android battery optimization is a major problem in building location based apps. However this could be resolved and battery optimization can be done at some extend extent by implementing some smart logic depending on the requirement of location tracking in the application. Location tracking in your app can be implemented in following ways depending on the app’s requirement. 1. Request one shot location of device wherever needed 2. Timer/service based approach for continuous location tracking 3. Geo fence based approach for continuous location tracking Request one shot location of device wherever needed – If app demands requesting device’s current location on screen say some API needs lat-long as input or need to use lat-long natively to display some info about current location of screen, map screen etc., app can request location manager to get current location of device in the same activity class. As long as location is used on that particular screen and app does not demand continuous location tracking in background or foreground, this approach could best suit to the requirement. App could just decide some param which is needed to be set to request location using location manager class like accuracy, interval rate at which location client tries to obtain location updates, fastest time interval, priority of location request etc. Advantages –

1. Not using continuous tracking saves battery used by app. 2. Best suited when location is needed on a particular or few screens Disadvantages – 1. May give less accurate location as it takes one shot location wherever needed. Though accuracy can be increased by keep requesting location updates till it reaches desired accuracy. Timer/service based approach for continuous location tracking – If app demands continuous location tracking in foreground as well as background, you can write your own service to track location on timely interval. In such a implementation, service starts listening to location updates for sometime interval and turns off all the updates for sometime. Turning off updates here means removing all callbacks to location manager. After the timer, when location updates are off, has elapsed, it will again start requesting location updates. Time interval for both the timers can be decided depending on desired accuracy of location app demands, also how frequently app is using current location etc. Advantages – 1. Use of own service for location tracking gives ability to track location in background as well. 2. Desired accuracy can be met if timer interval is decided accordingly. 3. Location is the most recent and is updated when it is actually being used any time anywhere in app. 4. Battery optimization can be achieved at some extent if timer intervals are decided wisely. Disadvantages – 1. App needs keep running location tracking service all the time. 2. Less efficient compared to geo fence based approach for continuous location tracking. 3. If service stops due to some reason and no code is written to start service if its stopped, app won't receive location updates. 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. Same geo fence concept can not only be used for monitoring enter-exit events of created geo fence but also it can be used for efficient location tracking. When app demands continuous location tracking both in background and foreground instead of writing own service to monitor location updates, you can create small geo fence of some radius say 250 meters, again this radius depends on your app’s requirement. If your app needs to track user’s location for very small area this geofence radius can be small otherwise greater radius will also work. When first time user gets device’s location (this location could be of desired accuracy), it will create geofence at that point with the pre-decided radius and turn off location updates. Exit event of such geofence is breached which means if user exits the geofence, the application will destroy the same geofence and will start location updates. The Application will create a new geo fence for the new geopoint. This way app does not need to keep tracking device’s location all the time using a background service. Instead once geofence is created Google Play service will take care of location tracking until and unless the user does not exit geofence. Advantages – 1. No need of writing own service for continuous location tracking. 2. Better battery optimization as compared to timer/service based approach. Disadvantages – 1. This approach is not suitable when the app demands location tracking for minute location updates. For example, when the app tracks food places and specially when the area is highly dense with food places. In this way, depending on your app’s requirement above mentioned techniques can help you to develop efficient location tracking in your app. Please Contact us at: www.mobisoftinfotech.com 1-855-572-APPS (2777) business@mobisoftinfotech.com

Add a comment

Related presentations

Related pages

Ways To Implement Location Tracking in Android | Mobisoft

Learn more on how to implement efficient location tracking within Android ... 3 ways to implement efficient location ... application. Location tracking ...
Read more

Location Strategies | Android Developers

Location Strategies. ... Getting user location in Android works by means ... There are three different ways to send your application mock location data: ...
Read more

Understanding the LocationListener in Android

private final class MyLocationListener implements LocationListener ... users location in an efficient way without ... Android Application ...
Read more

Android GPS, Location Manager Tutorial

Android GPS, Location Manager Tutorial. ... minSdkVersion="8" /> Read more

Android Location API - Tutorial - vogella

Android Location API This tutorial describes the usage of the Android Location API. It is based on Eclipse 3.7, Java 1.6 and Android 4 ... application in ...
Read more

Motion Tracking | Project Tango | Google Developers

... of Motion Tracking and suggests several ways to ... application using the Android Game ... implements Motion Tracking using ...
Read more

android.location | Android Developers

android.location; android.media; ... android.location. ... A class indicating the application criteria for selecting a location provider.
Read more

GPSLocator - App to Find Current (Nearest) Location using ...

Android application to show current location in Google Maps using GPS; Author: The Manoj Kumar; Updated: 27 Sep 2010; Section: Android; Chapter: Mobile ...
Read more

TaintDroid: Realtime Privacy Monitoring on Smartphones

Smartphones offer a convenient way to ... (3) Added a footnote to the "Applications ... we studied 30 popular Android applications that use location, ...
Read more

#1 Android Spy App • mSpy Tracking & Monitoring Software

... SMS, call logs, location tracking & 25 more features; Compatible also with iOS, ... It can be used to monitor efficiency, ... Android Tracking.
Read more