Notice that my notification icon is not always removed when my Service finish.
Thinking about possible reason for this.My service start some nested threads and the deepest one puts a notification with icon in the title bar of the phone.
I can see that onDestroy() in my Service is executed on stop Service. I run the mNotificationManager.cancel(setServiceRunNotifNumber);
I cant see that i miss running the cancel to remove the notification. This only happens sometime开发者_StackOverflow中文版s that the notification remains after onDestroy().
Are there something else I forgot? In what situation would the notification remain after Service killed?
That use to happen to me on 2.1 and lower. I noticed that if I killed my service, then waited 10 seconds and opened another app, my notification disappeared. I also noticed that if I killed my service and then restarted it right away, the icon wouldn't appear. This behaviour disappeared when my OS upgraded past 2.1.
精彩评论