Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Max/High priority notifications should be able to override DND #91

Closed
binwiederhier opened this issue Jan 12, 2022 · 6 comments
Closed
Labels
android-app ntfy Android app enhancement New feature or request in-progress 🏃 I'm working on this right now

Comments

@binwiederhier
Copy link
Owner

https://stackoverflow.com/questions/31862753/android-how-to-turn-on-do-not-disturb-dnd-programmatically

@binwiederhier binwiederhier added enhancement New feature or request android-app ntfy Android app labels Jan 12, 2022
@12nick12
Copy link
Sponsor

I second this. This would be awesome.

@binwiederhier
Copy link
Owner Author

I am dabbling with this now. I'm able to turn DND off/on globally, but I don't really want to do that. I just want to decide which notification make a sound, and which ones don't.

@binwiederhier
Copy link
Owner Author

binwiederhier commented Apr 14, 2022

This is quite fascinating but also interesting.

For each of the 5 priorities, I create an Android NotificationChannel, for which I can set setBypassDnd flag. However, I can only set that if I have a certain permission, for which the user has to manually toggle a setting in the Android UI. That wouldn't be a problem, except that a NotificationChannel, once created, cannot be updated ...............

Rubber ducking apparently works, even when typing it out 🦆 🦆 🦆

Looks like channels can be updated and when the permission to edit DND has been granted, setting setBypassDnd after the fact on an existing channel works.

I think I can work with this 🥳

@binwiederhier
Copy link
Owner Author

So I dabbled (binwiederhier/ntfy-android#25), but we decided via Discord that we'll not programmatically change the DND override for individual channels in the app. Instead, I'll just make a menu item to "Override DND, sound and vibration" which will open the Android "Notification Settings" dialog. I'll also write some docs.

Screenshot_20220414-085007

@binwiederhier
Copy link
Owner Author

220414 13-01-08 Selection 001

Fixed with this^^, but I'll add some documentation too, so I'll leave it open until then.

@binwiederhier
Copy link
Owner Author

Added docs for this: 06fd732

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android-app ntfy Android app enhancement New feature or request in-progress 🏃 I'm working on this right now
Projects
None yet
Development

No branches or pull requests

2 participants