I am using an IntentService to listen for GPS location updates so it'll run when the user leaves the activity. The IS sends the Location in a message to the activity's handler.
The problem is, when the user hits the "stop tracking" button, the status bar notification saying "tracking..." is still there because it is created in the IntentService. Therefore I overrided onDestory() so I can call:
mNotificationManager.cancel(TRACKING);
But the problem is that when I implement onDestroy(), it is called immediately after onHandleIntent. If I delete my override onDestroy() code then it isn't called immediately and runs fine, sending locations back to the activity to be displayed on-screen.
Any ideas why onDestroy() is getting called immediately if I implement it but not if I dont?
I'm pretty confused here.
Thanks all,
Infinitifizz
Okay I've sorted it out now, I shouldn't have been using an IntentService, used a Service instead and put all the functionality into onStartCommand() and now everything works.
Sorry everyone for wasting your time :-/
Infinitifizz
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With