How to know if Show Notification is disabled for my app? [duplicate]
Asked Answered
P

2

7

Is there any way to track whether the user has "Show notifications" disabled/unchecked in the Settings/App Info page of my app?

Potboiler answered 9/5, 2014 at 20:22 Comment(1)
AFAIK, there's no way to detect this at runtime via any documented and supported means.Embargo
E
3

Simple: You cant. In Google I/O 2012 answered: https://www.youtube.com/watch?v=Yc8YrVc47TI&feature=player_detailpage#t=1682s

update:

you can check if the user can see the notification in the status bar i.e. able TO CHECK (in the code) IF THE NOTIFICATION IS VISIBLE TO THE USER where android version >= 4.3.

http://developer.android.com/reference/android/service/notification/NotificationListenerService.html#getActiveNotifications%28%29

Ephesian answered 9/5, 2014 at 20:29 Comment(2)
Is the status still the same ? we cannot read or alter the Show Notifications?Gauge
A method has been added in upcoming API 24, as stated in this answer. This is available via support library v4 as well (call NotificationManagerCompat.areNotificationsEnabled() on API 19+ to check if user has blocked your app notifications).Victualer
T
0

you can't. There is no any functions which to be used to get the state of "Show notifications". In Google I/O 2012 answered: https://www.youtube.com/watchv=Yc8YrVc47TI&feature=player_detailpage#t=1682s, in 48:05,the leader answered the question use a simple word:NO.

Trainbearer answered 24/12, 2014 at 8:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.