Skip to content

fix(critical): ask for Do Not Disturb access so critical alerts can ring in DND on every Android phone - #147

Merged
ChiragAgg5k merged 1 commit into
mainfrom
fix/android-critical-dnd-access
Dec 3, 2026
Merged

ChiragAgg5k merged 1 commit into
mainfrom
fix/android-critical-dnd-access

Conversation

@ChiragAgg5k

@ChiragAgg5k ChiragAgg5k commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

Problem

A user's recording (Samsung One UI) showed Android critical-alerts setup looping. Override Do Not Disturb opened the critical channel's settings, but One UI leaves the per-channel "Override Do Not Disturb" switch out of that page. There was nothing to turn on, bypassDnd stayed false, and going back showed the same button again. The only way out was Not now, which left critical alerts silent in Do Not Disturb.

Why it happens

The app creates the critical channel with bypassDnd: true, but Android drops that unless the app has Do Not Disturb (notification policy) access. On the emulator the channel stores mBypassDnd=false right after creation. Setup only moves on once the person turns the per-channel switch on, and some OEM builds don't show that switch.

Fix

  • Declare ACCESS_NOTIFICATION_POLICY and have the button open Android's Do Not Disturb access list (NOTIFICATION_POLICY_ACCESS_SETTINGS). This standard settings page exists on every OEM, and the new permission is what makes Beep appear in it.
  • getCritical() calls createChannels() again before it reads the channel. Once access is granted, Android applies bypassDnd: true to the existing channel, so setup moves on without the per-channel switch.
  • The person keeps control: after they turn the channel's switch off themselves, calling createChannels() again leaves it off (mUserLockedFields=1, checked on the emulator).
  • Updated the setup and settings copy and the README.

Verified on an Android 16 emulator (demo build)

  • Reproduced the loop: tap the button, change nothing, go back, and the same button returns with mBypassDnd=false, every time.
  • With the fix: the button opens Modes access (Android 16's name for Do Not Disturb access) with Beep listed. After allowing it and going back, mBypassDnd=true and setup shows Continue.
  • Not verified on a Samsung device yet.

format:check, lint and typecheck pass.

Before

Setup Channel page the button opened

After

Light Dark
Do Not Disturb access
Back in setup

Part of appwrite-labs/cloud#7206

…t the channel switch can ring in DND

Samsung's One UI leaves the per-channel "Override Do Not Disturb" switch out of the channel's settings page, so critical setup sent people to a page with nothing to turn on and looped back to the same button. With Do Not Disturb access, Android honours the channel's bypassDnd when the app creates it, and still keeps a switch the person changed themselves.
@appwrite

appwrite Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Code review

Commit Status Tier Verdict Details
84ab2f7 Reviewed Reviewed 🟢 S · Ready to merge ✅ Approved View review

The permission declaration, settings intent, and post-grant channel refresh are consistent with the existing setup lifecycle.

Adds Android notification-policy access to the app and opens the system Do Not Disturb access page from critical-alert setup. Channel checks now recreate notification channels so Android can apply the critical channel's DND override after access is granted, and setup copy and README guidance are updated.

Walkthrough (5)
File Change
README.md Explains Android Do Not Disturb access for the critical notification channel.
app.json Adds the Android notification-policy access permission.
src/app/(app)/settings/critical.tsx Updates critical-alert instructions to refer to Do Not Disturb access.
src/app/(app)/setup/critical.tsx Updates Android critical-alert setup copy for the access settings flow.
src/critical/permission.android.ts Opens the Do Not Disturb access page and reapplies channel configuration when checking critical-alert status.

Reviewed 84ab2f7

Tip

Comment @appwrite review to re-run, or mention @appwrite with a question.

@appwrite appwrite Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Tier S · Looks good to merge. Summary

@ChiragAgg5k
ChiragAgg5k merged commit d8500d0 into main Dec 3, 2026
7 checks passed
@ChiragAgg5k
ChiragAgg5k deleted the fix/android-critical-dnd-access branch December 3, 2026 17:44
@ChiragAgg5k ChiragAgg5k self-assigned this Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant