• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps areNotificationsEnabled not working

Hi,
i try to find out if on android chrome browser notifications are enabled.
My code here:

public boolean isPush() {
try {
boolean OK;
OK = false;
Context context = getApplicationContext();
OK = NotificationManagerCompat.from(context).areNotificationsEnabled();
return OK;​
}
catch (Exception e) {
// This will catch any exception, because they are all descended from Exception
System.out.println("Error " + e.getMessage());
msg = e.getMessage();
return false;​
}​
}

This works fine, the only problem is that areNotificationsEnabled() returns always true even when in the settings notifications are disabled.

What i'm doing wrong?
Thanks
 
I'm still pretty noob, but as far as I know, the context variable is returning your applications notifications, not Google Chrome's.
 
Back
Top Bottom