Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Determine if notifications are turned off by the user [duplicate]

I'm using Notifications (NotificationManager.notify()) in my Countdown Timer app to sound an alarm in case the user is involved in a different app at the time it goes off.

It works really well, unless the user turns off notification (from the quick settings in JellyBeans+).

I want to check in code if the notification option is turned off, so I can choose a different alarm method.

Surprisingly, I found no information on the subject, and diving into Android code I see no such option in NotificationManager, and it fails silently.

Is there a way to do it?

like image 347
Amir Uval Avatar asked Jan 08 '13 22:01

Amir Uval


1 Answers

My post is old, but at last! In the support library for API 19+ there is an API for that now

NotificationManagerCompat.areNotificationsEnabled()

like image 150
Amir Uval Avatar answered Nov 17 '22 22:11

Amir Uval