I want clear all notifications of notification bar and had made a separated class that extends NotificationListenerService
package com.testando.teste;
import android.service.notification.NotificationListenerService;
import android.service.notification.StatusBarNotification;
public class NotificationListener extends NotificationListenerService {
@Override
public void onNotificationPosted(StatusBarNotification sbn) {
cancelNotification(sbn.getKey());
}
}
and my manifest file is like this:
<application>
<service android:name=".NotificationListener"
android:enabled="true"
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
<intent-filter>
<action android:name="android.service.notification.NotificationListenerService" />
</intent-filter>
</service>
</application>
Then i want know why every time that a notification arrives, this not is removed?
Or then some one know some way of remove these notification without use of NotificationListenerService
class, similar to "Clear All" button?