从Android API级别18(Android 4.3)开始,提供了一个类 NotificationListenerService
。您必须设置许可 权BIND_NOTIFICATION_LISTENER_SERVICE, 并将Intent过滤器与
NotificationListenerService一起使用 。
<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>
来源:http
:
//developer.android.com/reference/android/service/notification/NotificationListenerService.html#getActiveNotifications()



