I use IntentService to listen for GPS location updates, so it starts when the user leaves this activity. IS sends the location in the message to the activity handler.
The problem is that when the user clicks the โstop trackingโ button, a notification of the status line with the inscription โtracking ...โ still exists because it is created in the IntentService. So I redefined onDestory (), so I can call:
mNotificationManager.cancel(TRACKING);
But the problem is that when I implement onDestroy (), it is called right after onHandleIntent. If I delete my redefinition code onDestroy (), it does not immediately get called and works fine, sending addresses back to the activity displayed on the screen.
Any ideas why onDestroy () is called immediately if I implement it, but not if I don't?
I'm pretty confused here.
Thanks everyone
Infinitifizz
source share