为了实时获取通知栏状态的消息状态和内容进行获取,能够判断当前消息移除或者推送
- 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 {@link android.Manifest.permission#BIND_NOTIFICATION_LISTENER_SERVICE} permission
- and include an intent filter with the {@link #SERVICE_INTERFACE} action. For example:
监听注册通知监听服务
<service
android:name=".permission.service.GuardNotificationListenerService"
android:label="@string/app_name"
android:enabled="true"
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
<intent-filter>
<action android:name="android.service.notification.NotificationListenerService" /