Edit Do Not Disturb settings

365 views Asked by At

Is it possible to modify the Android Do Not Disturb Exceptions settings by code?

I have a profile app that activates different Sound profiles depending on user choices. When using silent profiles, the values can be different depending if you are in a Meeting profile or a Night profile. For example:

⭐ During a Meeting profile I just want my boss to be able to call me.

⭐ In a Night profile I want any contact to be able to call me, but I don't want to be disturbed by any notification.

⭐ In a total Silent profile I don't want anything to disturb me.

I know how to enable or disable Do Not Disturb (DND) with a Total Silent mode, Allow Only Alarms, or Allow Only Priorities.

But I would like to modify (by code) the options shown in the screenshots. Specially the Exceptions. That would make the app much more efficient.

enter image description here

1

There are 1 answers

0
Ton On BEST ANSWER

Yes, using Notification Manager Policy. All is available there: https://developer.android.com/reference/android/app/NotificationManager.Policy