public abstract class BaseStatusBar {
private final NotificationListenerService mNotificationListener = new NotificationListenerService() {
@Override
public void onListenerConnected() {}
@Override
public void onNotificationPosted(...) {}
@Override
public void onNotificationRemoved(...) {}
......
}
mNotificationListener.registerAsSystemService(...);
mNotificationListener.unregisterAsSystemService();
}