Is there a way to perform an action when a notification is canceled by the system (by shutting down or restarting) or any other stuff but the user ?
If so, how ? Or how can I implement onNotificationRemoved ?
Is there a way to perform an action when a notification is canceled by the system (by shutting down or restarting) or any other stuff but the user ?
If so, how ? Or how can I implement onNotificationRemoved ?
Have you tried NotificationListenerService?
This is a service that receives calls from the system when new notifications are posted or removed, or their ranking changed.
To extend this class, you must declare the service in your manifest file with the BIND_NOTIFICATION_LISTENER_SERVICE permission and include an intent filter with the SERVICE_INTERFACE action.
<service android:name=".NotificationListener"
android:label="@string/service_name"
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
<intent-filter>
<action android:name="android.service.notification.NotificationListenerService" />
</intent-filter>
</service>
Now, in your Notification Listner class, implement onNotificationRemoved