I would like to develop an application - a service - that updates the user location to server, say, every 1 hour.
I understand from the Android docs that I have to use "Android Services" and I have to do the work on the onStartCommand()
But since I need to keep sending these location updates every 1 hour, then I need to run infinite loop inside onStartCommand()
... right?
Now, my questions are:
What will happen if system kill the service, I know my service will get started, but would it call
onStartCommand()
also?Is there a better way to implement location update, for example, is it possible that the system call the
onStartCommand()
method periodically every 1 hour?