NotificationListenerService and a Whatsapp extension for Dashclock
Android 4.3 (API 18) introduced NotificationListenerService . In this post I'll talk how to use this API, and I'll show how an app can observe the stream of notifications with the user's permission. It is very easy to use a NotificationListenerService. First of all you have to extend NotificationListenerService and implement onNotificationPosted() and onNotificationRemoved() methods public class WhtsNotificationListener extends NotificationListenerService { @Override public void onNotificationPosted(StatusBarNotification sbn) { //.............. } @Override public void onNotificationRemoved(StatusBarNotification sbn) { //.............. } } Then 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 Finally user must enable your service. Without t...