Nick Nick - 4 months ago 14x
Android Question

Check for access to notifications using NotificationListenerService

I'm using the >=4.3

to access notifications. On the first start, my app takes the user to the "Access Notifications" system panel, but I'd like to take the user there whenever the checkbox for my app in "Access Notifications" is disabled. I haven't found a
-method anywhere, but I definitely know that it's possible because apps like Krome do this, too.


Im developer of Krome. What have I done to check if service is enabled is add public static variable that changes to true in onBind method and to false in unbind. That is how this service work.


public static boolean isNotificationAccessEnabled = false;

public IBinder onBind(Intent mIntent) {
    IBinder mIBinder = super.onBind(mIntent);
    isNotificationAccessEnabled = true;
    return mIBinder;

public boolean onUnbind(Intent mIntent) {
    boolean mOnUnbind = super.onUnbind(mIntent);
    isNotificationAccessEnabled = false;
    return mOnUnbind;