Please also see Edit 2 (below)
I have extended NotificationListenerService
and implemented several of its methods including the onDestroy()
Create a new service that does all of the work for you, instead of doing the work in this service that extends NotificationListenerService
. All you do then is use the startService()
method once you want to do some work and presumably you will send some extras
with that intent
containing the posted notification.
It is then very easy to stop that service (that does the work for you and doesn't extend NotificationListenerService
) using the stopSelf()
method.
Stopping the NotificationListenerService
itself using the stopSelf()
method doesn't work.