12

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?

Amir Uval
  • 14,425
  • 4
  • 50
  • 74
  • 2
    FYI, that setting turns off Toasts as well. [Rant](http://www.techrepublic.com/blog/app-builder/android-jelly-bean-ate-my-toast/2349) – Erik B Jul 12 '13 at 18:12
  • @ErikB Ouch, another feature we can't trust. Well, at least for toast there's an alternative - you can display a home made view instead. Good opportunity for a small open source project to create an alternative. – Amir Uval Jul 12 '13 at 22:25
  • @Sam asking this 4 years ago I've searched everywhere before posting a question. I guess that the other question was not popular yet. Thanks for the pointer - I'm glad to learn that there's a new solution for this. – Amir Uval Jan 09 '17 at 21:26

1 Answers1

4

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

NotificationManagerCompat.areNotificationsEnabled()

cking24343
  • 3,173
  • 1
  • 21
  • 23
Amir Uval
  • 14,425
  • 4
  • 50
  • 74