I\'m currently creating a foreground service with a notification that appears in the notification bar when the service starts. If the service stops, the notification dismiss
My question is, is there a way to stop the service when "clear all notifications" or a dismiss of the notification (swipe) occurs?
Assuming that your Notification
is set up to allow it to be cleared, the deleteIntent should be invoked when it is cleared. You could set this to a getBroadcast()
PendingIntent
, pointing to a manifest-registered BroadcastReceiver
that calls stopService()
.