Strategies To Develop Location Aware Hyperlocal Android Apps

Strategies To Develop Location Aware Hyperlocal Android Apps

Have you ever wondered if it was just simple to implement GPS tracking functionality in your Android Application? Ever wondered how to use the offline GPS functionality in your location aware android applications? Facing challenges of balancing between

  • Accuracy?
  • Scalability?
  • Power consumption?
  • Acquisition speed when acquiring a location?

Checkout: Location Aware iOS Apps : A Closer View and Geo-Fencing In Hyperlocal Android Apps – Whats, Whys and Hows
Obtaining an accurate user location on a mobile device can be difficult. If we speak broadly, there are three concerns that will challenge you the most:

  • 1. Multiple location sources: There is more than one provider from which location is acquired (GPS, WI-FI and Cell-ID) and they all vary very much on grounds of accuracy, power consumption and speed.
  • 2. User movement: The movement of user influences the location hence location data must be refreshed at a reasonable time interval.
  • 3. Varying accuracy: Different providers offer different location estimates and definitely there will loss in accuracy. It also validates that the location fetched from the newest provider might be significantly less accurate than the estimation from an older provider.

Optimizing your choice could make a huge difference in good or poor user experience. Let’s have a view of user permissions.

A – User Permissions:

You must be aware that a location can have two sources Network Provider or GPS Provider.
For your location aware android apps to access location services, you must train it to request permissions that user has to confirm upon application installation.
There are only two permissions:

  • 1. ACCESS_COARSE_LOCATION – includes permission only for NETWORK_PROVIDER.
  • 2. ACCESS_FINE_LOCATION – includes permission both for NETWORK_PROVIDER and GPS_PROVIDER.

Note: If you are using both NETWORK_PROVIDER and GPS_PROVIDER, then you need to request only the ACCESS_FINE_LOCATION permission, because it includes permission for both providers. (Permission for ACCESS_COARSE_LOCATION includes permission only for NETWORK_PROVIDER.)

Let’s strategize the roadmap for developing location aware Android applications:

B- Location Strategies

While formulating location strategies for developing location-aware Android apps your focus points must be:

  • Accuracy as per your application requirement.
  • Strategizing your location aware apps fall in the category of low battery power consumption apps.
  • Making your location aware android application work with Offline GPS functionality.
  • Taking into consideration ideal GPS pole positions.
  • Choosing among provider (Network or GPS) and how long do you intend to keep using any of these providers?
  • Achieving best use experience.
  • Reduction in the size of window which would result in less interaction with GPS and network location services thus preserving battery life.

It is advisable that for best user experience and lowest power consumption good location strategy should be devised. Let’s have a close look over it!
B (1)- Typical Approach for Accuracy, Good Performance and Low Battery Consumptions:

  • Looking for Fastest Provider: When acquiring initial location fix, use the fastest location provider. Network (or may be passive) provider can give a fastest location fix. Use these providers to give initial hint to user about their location. Later improve accuracy as more accurate providers initialize. Get this script to fix it fast and easily:
    String provider = LocationManager.NETWORK_PROVIDER;// Returns last known location, this is the fastest way to get a location fix.
    Location fastLocation = locationManager.getLastKnownLocation(provider);
  • Accurate Location Fixing: While you are waiting for one or more accurate GPS providers to initialize, handle location fixes from other providers. You must filter them by dismissing the less accurate and older ones. Wait and hold for the most accurate location. Don’t just get it wasted like that.
  • Stop Listening: Once you are ready with handling a location fix with more suitable accuracy. Get it displayed to user and now ignore the location updates. This helps in conserving power.
    LocationManager locationManager = (LocationManager) this
    .getSystemService(Context.LOCATION_SERVICE);// Stop listening to location updates, also stops providers.

B- (2) Offline GPS Functionality – A Deep Dive Into Location
Concern : GPS’s location is more accurate than a Wi-Fi’s or Network Provider’s location, but GPS might not be always available.
Solution: Suppose there is no network and still you want to know user’s location and/or user would want to use location-enabled applications. There could be few ways of doing that

  • 1. Consider the last saved location of user in your application. Use the cached location data or
  • 2. Get the Last Known Location from user.
  • 3. Get the last location from Network Provider. In that case, the Network Provider may provide you with COARSE location of user.

Following the last strategy, using the fused location provider to retrieve the device’s last known location could be of great use. The fused location provider is one of the location APIs in Google Play Services. They provide simple API so that you can specify requirements at a high level with high accuracy and low power. This also optimizes the device’s use of battery power.
To request the last known location, call the getLastLocation() method, passing it your instance of the GoogleApiClient object. Do this in the onConnected() callback provided by Google API Client, which is called when the client is ready. Below mentioned code illustrates the request and hence a simple handling of the response:

public class MainActivity extends ActionBarActivity implements
ConnectionCallbacks, OnConnectionFailedListener {
public void onConnected(Bundle connectionHint) {
mLastLocation = LocationServices.FusedLocationApi.getLastLocation(
if (mLastLocation != null) {

The getLastLocation() method returns a Location object from which you can retrieve the latitude and longitude coordinates of a geographic location. The location object returned may be null in rare cases when the location is not available.


Some unique and most amazing location aware using Offline GPS functionality are creating good buzz in the Mobile Application Market. Here are some cool Offline GPS Android Applications like OsmAnd Maps, MapFactor, Navfree, GoogleMaps, HERE Maps, CoPilot GPS – Plan & many more in queue.

We discussed about various users permissions and how by calling various call of actions we can achieve developing a more accurate location aware Android apps that too with low battery consumption. We also discussed how to retrieve a user’s last known location in Offline GPS mode.

You may be looking out for more precision and accuracy in the user’s location. You would want to find a user who is sitting in the city’s famous street food corner, for that Geo-fencers, beacons, NFC, RFIDs comes into picture. Geo-fencing allows you to combine user location with nearby features. You can even have multiple active Geo-fences at one time. To know more about Geo-fencers and such virtual barriers keep reading my blog!!
Go Offline and Get Busy With Developing 🙂

The following two tabs change content below.
Rachit Agarwal

Rachit Agarwal

Director and Co-Founder at Algoworks Technologies
Rachit is leading the mobility business development function, mobility strategy and consulting practice at Algoworks. He is an expert of all mobile technologies and has experience in managing teams involved in the development of custom iPhone/iPad/Android apps.
Rachit Agarwal

Latest posts by Rachit Agarwal (see all)

Rachit AgarwalStrategies To Develop Location Aware Hyperlocal Android Apps