Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best Practice to report user location continuously

I'm designing an application where application in server side need to be continuously aware of user location. I'm thinking to create an Android service that run in the background and continuously query user location and send the result to an application in the backend server. However, I wonder if this is the best approach in terms of battery saving. For example, in iOS, there is something called "Significant-Change" to serve such purpose, does Android have similar thing.

like image 926
user836026 Avatar asked Nov 30 '11 20:11

user836026


1 Answers

I suggest to create a background Service which just uses the NETWORK_PROVIDER and the PASSIVE_PROVIDER. You can use the minTime and the minDistance parameter to avoid draining the battery. Documentation

And Reto wrote a great post about obtaining users location http://android-developers.blogspot.com/2011/06/deep-dive-into-location.html

Regarding your comment you have to start your service sticky: Documentation

like image 105
Dominic Avatar answered Oct 09 '22 15:10

Dominic