Well, this is not the best solution, but you can always simply βreassignβ the notification to the rejected notification identifier. For example, let's say you run Process 1 (foreground) and then Process 2 (using NotificationManager). When process 1 ends, release the notification for process 2 and update the foreground notification for process 1 to actually show progress for process 2.
Thus, you do not need to call stopForeground()
and startForeground()
, which may allow you to kill the service between them (although this has not actually been verified).
source share