Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android 4.1: How to check notifications are disabled for the application?

Android 4.1 offers the user a check box to disable notifications for a specific application.

However, as a developer we have no way to know whether a call to notify was effective or not.

I really need to check if the notifications are disabled for the current application but I can't find any setting for that in the API.

Is there ever a way to check this setting in the code?

like image 221
Guillaume Perrot Avatar asked Jul 25 '12 11:07

Guillaume Perrot


People also ask

How do I know if an app is disabled Android?

Find and tap Settings > Apps. Tap All apps > Disabled.

How do you turn on disabled notifications?

Tap on the Apps & Notifications from the Settings. Select the Browser App (Say Chrome app) from the list of apps. Within Chrome App Info, tap on the Notifications tab. Here you will be able to see all the notifications currently enabled or disabled.

How do I get notifications when an app is closed Android?

Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main. xml.


1 Answers

You can't 100% can't.

It is asked in this Google I/O 2012 video and the Project lead for the new notifications declares that you can't.


Edit

2016 update: Now you can check it, as said in this Google I/O 2016 video.

Use NotificationManagerCompat.areNotificationsEnabled(), from support library, to check if notifications are blocked on API 19+. The versions below API 19 will return true (notifications are enabled).

enter image description here

like image 135
Blundell Avatar answered Sep 18 '22 08:09

Blundell