user3094685
user3094685

Reputation: 31

record user's location / movement throughout the day

I am developing an app which can record user's location througout the day so app can find out the approx lifestyle of user. app has to collect data in the background at some interval so i need a best strategy to invoke a location update request to LocationManager of android. But it must be optimized in terms of battery and balanced in terms of accuracy.

Right now the flow in my mind is,

iterate through the location providers, give higher priority to NETWORK (as it consumes less power), o this for each,
  get the last known location
  get the current loction
  chek if current is better than last
       if yes make this the best estimate, otherwise get location from other provider

i know two parameters which can decide when to invoke location update request,

minimum interval
minimum distance

first i would give them some default value but these must be updated later by using the location history of user and considering other factors in mind like

  reduce the frequency of update request if battery is < 75% and further reduce it when   
  battery is  < 50%
  increase frequency of update request when user is moving fast (Activity Recognition Class   
  from google location services can help here)
  if we predict the time windows in which user does not move (from history), decrease the  
  frquency of location updates
  use GPS minimal time because it consumes more battery

So these are the pieces that came to my mind but it looks like a mess right now because it is not well structured. So if somebody can help me to add something more in this or can suggest some better strategy (battery must be optimized) i would be very thankful and it was long so please control your emotions if you think i have wasted your time. Thanks

Upvotes: 0

Views: 815

Answers (1)

tanou
tanou

Reputation: 1093

In order to get a good accuracy, Google provides an algorithm that provides, in my opinion, good results. You can find it there : reference

GPS take so time to have a fix, I would say about a minutes (depends on the device).

I would suggest you to look at the Passive Mode, which allows you to receive position without making a fix by using other applications requests.

passive: A special location provider for receiving locations without actually initiating a location fix. This provider can be used to passively receive location updates when other applications or services request them without actually requesting the locations yourself. This provider will return locations generated by other providers. Requires the permission android.permission.ACCESS_FINE_LOCATION, although if the GPS is not enabled this provider might only return coarse fixes.

gps tutorial

Hope it helps !

Upvotes: 2

Related Questions