How do I check for Do Not Disturb mode and disable it?

Post your questions and help other users.

Moderator: Martin

Post Reply
teiji
Posts: 14
Joined: 25 Nov 2018 19:37

How do I check for Do Not Disturb mode and disable it?

Post by teiji » 01 Dec 2018 23:00

Hello, I'm trying to write a flow that will check for a certain notification + if Do Not Disturb (DND) mode is on, then it will disable it. Which trigger do I use for DND check and which action to disable it? I search for it in the list but nothing comes close (unless I miss it). I see "Interruptions Mode" but not sure if this is DND mode or not. Please help.

anuraag
Posts: 371
Joined: 24 Jan 2015 02:06

Re: How do I check for Do Not Disturb mode and disable it?

Post by anuraag » 02 Dec 2018 03:32

Yes Interruptions Mode is for setting DND.
Use "Notification on Statusbar Displayed" as trigger and then "Interruptions Mode" as condition.

Flow will be like this

Trigger =>Notification on Statusbar Displayed
Condition =>Interruptions Mode

If true
Action => Set Interruptions Mode

But you want notification sound for that notification as your phone was on DND mode when that notification arrived, so you need another action

Action => Sound

teiji
Posts: 14
Joined: 25 Nov 2018 19:37

Re: How do I check for Do Not Disturb mode and disable it?

Post by teiji » 02 Dec 2018 05:17

anuraag wrote:Yes Interruptions Mode is for setting DND.
Use "Notification on Statusbar Displayed" as trigger and then "Interruptions Mode" as condition.

Flow will be like this

Trigger =>Notification on Statusbar Displayed
Condition =>Interruptions Mode

If true
Action => Set Interruptions Mode

But you want notification sound for that notification as your phone was on DND mode when that notification arrived, so you need another action

Action => Sound
Thanks. So I'm guessing "None / Don't interrupt" is DND mode ON and "All / Always interrupt" is DND mode OFF?

anuraag
Posts: 371
Joined: 24 Jan 2015 02:06

Re: How do I check for Do Not Disturb mode and disable it?

Post by anuraag » 02 Dec 2018 05:35

Yes. You are correct.

teiji
Posts: 14
Joined: 25 Nov 2018 19:37

Re: How do I check for Do Not Disturb mode and disable it?

Post by teiji » 02 Dec 2018 15:18

anuraag wrote:Yes. You are correct.
Thanks again. It works! You are awesome. :)

drenze
Posts: 5
Joined: 12 Feb 2019 16:01

Re: How do I check for Do Not Disturb mode and disable it?

Post by drenze » 18 Feb 2019 17:28

anuraag wrote:Yes Interruptions Mode is for setting DND.
Use "Notification on Statusbar Displayed" as trigger and then "Interruptions Mode" as condition.

Flow will be like this

Trigger =>Notification on Statusbar Displayed
Condition =>Interruptions Mode

If true
Action => Set Interruptions Mode

But you want notification sound for that notification as your phone was on DND mode when that notification arrived, so you need another action

Action => Sound
My search for an answer to a similar question brought me here, and this ALMOST answers my question. However, I'm trying to use whether DND status is on as a CONDITION, so that if a different trigger occurs while DND is active, Y will happen. I suppose I could toggle a global variable each time DND is toggled, but that just seems so inelegant somehow.

I see that there is also a "Notification on Statusbar Displayed" condition, but I have to select a package name. I assume that the package to be selected is "settings," but from there...what?

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: How do I check for Do Not Disturb mode and disable it?

Post by Desmanto » 18 Feb 2019 17:55

Interruptions Mode or DND comes in 2 flavors, trigger and condition. The one stated above is the condition version, which check for state, to be used with other triggers. If you need to trigger when the Interruption mode changes, use the trigger version instead.

But from what I understand from your comment, it seems you should use the condition version. But you want to use another trigger in another flow; probably you need to disable/enable flow based on the interruption mode.

Notification on Statusbar Displayed when used with package name, will only filter that package name. What kind of notification do you want to check? Not all notification comes only from settings. Maybe you are using notif from gmail, whatsapp or alarm clock. You should select the proper one, or you will missed out the notif. You can use my variable logger flow to log the possible notification you are looking for.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

drenze
Posts: 5
Joined: 12 Feb 2019 16:01

Re: How do I check for Do Not Disturb mode and disable it?

Post by drenze » 18 Feb 2019 23:11

You are correct, I want the condition version. It looked to me like you were using the trigger version, as I was able to follow your instructions using trigger. I was NOT, however, able to follow them using a condition, hence the confusion.

Post Reply