I am looking for a bit of app design advice.
I have an app that connects to the Google Location Services and tracks location coordinates it receives. These are displayed as a path on the UI.
When the screen times out and goes blank then this
In order to tie up loose ends, I'll add my own answer to this now I have implemented something.
My solution in the end was not an
IntentService. This was because I thought that the
IntentService would consider its work to be the actual setting up of the
LocationService and once that work had been completed then it would shut itself down rather than hang about waiting for
Therefore, I implemented a normal
Service, but I bound it to the calling
Activity. I also set up a callback to the
Activity. This way when a 'ping' was received I could process it and pass back the data directly to the
Activity. Also, the
Service would remain alive as long as the binding was in place. I clear the binder when the
Activity is destroyed.
This worked perfectly....HOWEVER
I then discovered that the reason that the
LocationService 'pings' were not being handled in the
Activity was bacause I was disconnecting the
GoogleAPIClient when the
onStop was called. Having removed this, the
Activity processed the 'pings'even in its stopped state, so no
Service was required anyway.
Therefore the correct answer to this question is...
Activity should continue processing in the background (unless it's destroyed for memory management purposes), so check you're not stopping stuff in your 'shutdown' handlers
onStop etc. Then you won't waste time writing services like I did!