location tracking

Hot, Warm, Cold

location data TYPEs

  • Cached
  • Real-time
  • Passive

Cached GPS

  • timestamp
  • latitude
  • longitude
  • accuracy

 // new api  LocationClient.getLastLocation()
 // old api locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);

Cached Network

  • timestamp
  • latitude
  • longitude
  • accuracy

 // new api LocationClient.getLastLocation()
 // old api locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);

Real-time GPS

  • timestamp
  • latitude
  • longitude
  • accuracy
  • altitude
  • bearing
  • speed
  • distance
 // new api LocationClient.requestLocationUpdates(request, listener);
 // old api locationManager.requestLocationUpdates
	(LocationManager.GPS_PROVIDER, time, distance, listener);

Real-time Network

  • timestamp
  • latitude
  • longitude
  • accuracy
  • altitude
  • distance 

 // new api LocationClient.requestLocationUpdates(request, listener);
 // old api locationManager.requestLocationUpdates
	(LocationManager.NETWORK_PROVIDER, time, distance, listener);

Passive

  • timestamp
  • latitude
  • longitude
  • altitude
  • accuracy

 // new api LocationRequest.PRIORITY_NO_POWER
 // old api <receiver android:name=".PassiveLocationChangedReceiver" 
	android:enabled="true"/>

Cached locations

  • When device is restared, location cache is cleared
  • Cached locations aren't always best 1st choice
  • Check timestamp and accuracy

SAve the battery

  • Use new API - Google Play Services
  • Use cached locations when possible
  • Listener does not have to stay static
  • Monitor user behavior
  • Monitor battery state 
  • Track when app is in background
  • Save data when necessary

application structure


task

  • Show location on multiple screens
  • Save statistic (all locations)
  • Track location when application is in background


who can deal with this?

service

When to save 

data?

location tracking android

By Dmytro Danylyk

location tracking android

  • 3,078
Loading comments...

More from Dmytro Danylyk