[GH-ISSUE #6] Android app: per-subscription / per-priority notification sound #5

Closed
opened 2026-05-07 00:18:14 +02:00 by BreizhHardware · 16 comments

Originally created by @binwiederhier on GitHub (Nov 19, 2021).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/6

Originally created by @binwiederhier on GitHub (Nov 19, 2021). Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/6
Author
Owner

@Mikaela commented on GitHub (Jun 1, 2022):

This would also be nice on iOS as I tend to default to silent so most applications won't bother me unnecessarily

<!-- gh-comment-id:1143152993 --> @Mikaela commented on GitHub (Jun 1, 2022): This would also be nice on iOS as I tend to default to silent so most applications won't bother me unnecessarily
Author
Owner

@inconis commented on GitHub (Jun 29, 2022):

On Android devices will be helpful the option to override system settings regarding noise.
In this way is possible to create an SOS channel to receive alarms in every condition.
A big thank to the developers of this project that I found so useful.

<!-- gh-comment-id:1170255642 --> @inconis commented on GitHub (Jun 29, 2022): On Android devices will be helpful the option to override system settings regarding noise. In this way is possible to create an SOS channel to receive alarms in every condition. A big thank to the developers of this project that I found so useful.
Author
Owner

@binwiederhier commented on GitHub (Jun 29, 2022):

On Android devices will be helpful the option to override system settings regarding noise. In this way is possible to create an SOS channel to receive alarms in every condition. A big thank to the developers of this project that I found so useful.

You can do the overriding in the main settings. Go to Settings -> Channel settings". There you can override DND for the different priorities.

<!-- gh-comment-id:1170270713 --> @binwiederhier commented on GitHub (Jun 29, 2022): > On Android devices will be helpful the option to override system settings regarding noise. In this way is possible to create an SOS channel to receive alarms in every condition. A big thank to the developers of this project that I found so useful. You can do the overriding in the main settings. Go to Settings -> Channel settings". There you can override DND for the different priorities.
Author
Owner

@inconis commented on GitHub (Jun 30, 2022):

Hi, thanks for your answer. Probably I explained in a bad way what I meant. With the app, "WirePusher" is possible to redirect the stream to "alarm stream" in this way if I put my phone in silent mode I can still receive the sound of the notification.
This function can be really useful for example to receive some "urgent" notifications.

<!-- gh-comment-id:1170881756 --> @inconis commented on GitHub (Jun 30, 2022): Hi, thanks for your answer. Probably I explained in a bad way what I meant. With the app, "WirePusher" is possible to redirect the stream to "alarm stream" in this way if I put my phone in silent mode I can still receive the sound of the notification. This function can be really useful for example to receive some "urgent" notifications.
Author
Owner

@binwiederhier commented on GitHub (Nov 19, 2022):

See also #404

<!-- gh-comment-id:1320965461 --> @binwiederhier commented on GitHub (Nov 19, 2022): See also #404
Author
Owner

@doits commented on GitHub (Nov 30, 2022):

Maybe this could be implemented by creating custom notification channels when enabled for a subscription, like toggling a setting "Custom notification channels for this subscription".

Currently there are 5 default notification channels (min to max). If the setting was toggled for a specific subscription, it could add 5 more notification channels for the specific channel. Then you could set the notification sound etc. within the android app settings, even override DND, like it is now possible for the 5 default notification channels.

Another way (or in addition) maybe you could create custom notification channels globally in the ntfy app settings and then assign a subscription to that notification channel. E.g. in settings you create a channel called "X" and ntfy would create 5 notification channels for "X", one for each priority (min to max). This way you could put multiple subscriptions into the same custom notification channel (not sure if this is needed).

<!-- gh-comment-id:1332280747 --> @doits commented on GitHub (Nov 30, 2022): Maybe this could be implemented by creating custom notification channels when enabled for a subscription, like toggling a setting "Custom notification channels for this subscription". Currently there are 5 default notification channels (min to max). If the setting was toggled for a specific subscription, it could add 5 more notification channels for the specific channel. Then you could set the notification sound etc. within the android app settings, even override DND, like it is now possible for the 5 default notification channels. Another way (or in addition) maybe you could create custom notification channels globally in the ntfy app settings and then assign a subscription to that notification channel. E.g. in settings you create a channel called "X" and ntfy would create 5 notification channels for "X", one for each priority (min to max). This way you could put multiple subscriptions into the same custom notification channel (not sure if this is needed).
Author
Owner

@binwiederhier commented on GitHub (Dec 4, 2022):

@doits This is an incredibly smart idea. And I love that you even provided an implementation for it. I would even go so far as to just create a notification channel for every subscription by default. I'm gonna have a look at the code today if I can.

<!-- gh-comment-id:1336412031 --> @binwiederhier commented on GitHub (Dec 4, 2022): @doits This is an incredibly smart idea. And I love that you even provided an implementation for it. I would even go so far as to just create a notification channel for every subscription by default. I'm gonna have a look at the code today if I can.
Author
Owner

@binwiederhier commented on GitHub (Dec 4, 2022):

Okay, upon thinking about it, having a custom channel for each subscription by default is not going to work, because then the priority-channels would be irrelevant. It's kind of a tricky one. I think if we were to make this a thing, it'd have to be opt-in like you suggested:

With these channels:

- Subscription service
- Min priority
- Low priority
- Default priority
- High priority
- Max priority
- ntfy.sh/mytopic (if opted in)
- ntfy.sh/othertopic (if opted in)

I think adding multiple "per-priority channels" for each topic (like you implemented) is overkill.

<!-- gh-comment-id:1336413344 --> @binwiederhier commented on GitHub (Dec 4, 2022): Okay, upon thinking about it, having a custom channel for each subscription by default is not going to work, because then the priority-channels would be irrelevant. It's kind of a tricky one. I think _if_ we were to make this a thing, it'd have to be opt-in like you suggested: With these channels: ``` - Subscription service - Min priority - Low priority - Default priority - High priority - Max priority - ntfy.sh/mytopic (if opted in) - ntfy.sh/othertopic (if opted in) ``` I think adding multiple "per-priority channels" for each topic (like you implemented) is overkill.
Author
Owner

@binwiederhier commented on GitHub (Dec 4, 2022):

Alright ... So I should have thought about the whole thing and maybe even tried it before commenting. I do think that maybe your approach is actually the correct one. Otherwise you'd essentially take away the ability to have low/high-priority messages when this is enabled.

So what you implemented is this:

Background service
- Subscription service

Priority channels
- Min priority
- Low priority
- Default priority
- High priority
- Max priority

ntfy.sh/mytopic
- Min priority
- Low priority
- Default priority
- High priority
- Max priority

While this seems like the only approach that achieves "infinite flexibility", it also seems like absolute configuration overkill. Say I have 5 subscriptions, that means I now have 25 channels if I enable the feature on a subscription. Doing a simple thing, like changing the notification sound, now becomes an awful chore.

<!-- gh-comment-id:1336416133 --> @binwiederhier commented on GitHub (Dec 4, 2022): Alright ... So I should have thought about the whole thing and maybe even tried it before commenting. I do think that maybe your approach is actually the correct one. Otherwise you'd essentially take away the ability to have low/high-priority messages when this is enabled. So what you implemented is this: ``` Background service - Subscription service Priority channels - Min priority - Low priority - Default priority - High priority - Max priority ntfy.sh/mytopic - Min priority - Low priority - Default priority - High priority - Max priority ``` While this seems like the only approach that achieves "infinite flexibility", it also seems like absolute configuration overkill. Say I have 5 subscriptions, that means I now have 25 channels if I enable the feature on a subscription. Doing a simple thing, like changing the notification sound, now becomes an awful chore.
Author
Owner

@doits commented on GitHub (Dec 4, 2022):

Thanks for your review and your feedback. Your last comment is correct about I implemented it.

I also thought about only adding one channel per subscription (ignoring priority), but I felt this was an important feature of ntfy which should always be present.

While writing a response I thought about different variations and finally asked myself the question: What use case is solved by this? I think most of users want to change the notification sound for a subscription, not having to change the sound of 5 priorities (like you said). Changing the notification for each priority also has it's use case, but probably to fewer users.

So maybe this way is cleaner:

You have the setting ...

Custom notifications for this subscription

... and when you enable it, it creates one extra notification channel:

ntfy.sh/mytopic
- All priorities

So by default, all priorities of this subscription go into this one channel.

In addition, it reveals 5 more settings (maybe they must be expanded first to be visible, or they are on a second "subscription notification page" etc.):

Custom notifications for a specific priority:
- Min priority
- Low priority
- Default priority
- High priority
- Max priority

All are OFF by default. Each toggle creates an extra notification channel just for this subscription and priority, so for example:

Custom notifications for a specific priority:
- Min priority:      OFF
- Low priority:      OFF
- Default priority:  OFF
- High priority:     ON
- Max priority:      ON

... results in ...

ntfy.sh/mytopic
- High priority
- Max priority
- Other priorities

So you can add specific notification channels per priority. If not, they go into the "Other priorities" channel of the subscription.

Finally, if you create a channel for each priority:

Custom notifications for a specific priority:
- Min priority:      ON
- Low priority:      ON
- Default priority:  ON
- High priority:     ON
- Max priority:      ON

... it would result in channels like the current implementation ...

ntfy.sh/mytopic
- Min priority
- Low priority
- Default priority
- High priority
- Max priority

(no need for the "Other priorities" notification channel).

What do you think? Still too complicated?

<!-- gh-comment-id:1336428384 --> @doits commented on GitHub (Dec 4, 2022): Thanks for your review and your feedback. Your last comment is correct about I implemented it. I also thought about only adding one channel per subscription (ignoring priority), but I felt this was an important feature of ntfy which should always be present. While writing a response I thought about different variations and finally asked myself the question: What use case is solved by this? I think most of users want to change the notification sound for a subscription, not having to change the sound of 5 priorities (like you said). Changing the notification for each priority also has it's use case, but probably to fewer users. So maybe this way is cleaner: You have the setting ... ``` Custom notifications for this subscription ``` ... and when you enable it, it creates one extra notification channel: ``` ntfy.sh/mytopic - All priorities ``` So by default, all priorities of this subscription go into this one channel. In addition, it reveals 5 more settings (maybe they must be expanded first to be visible, or they are on a second "subscription notification page" etc.): ``` Custom notifications for a specific priority: - Min priority - Low priority - Default priority - High priority - Max priority ``` All are `OFF` by default. Each toggle creates an extra notification channel just for this subscription and priority, so for example: ``` Custom notifications for a specific priority: - Min priority: OFF - Low priority: OFF - Default priority: OFF - High priority: ON - Max priority: ON ``` ... results in ... ``` ntfy.sh/mytopic - High priority - Max priority - Other priorities ``` So you can add specific notification channels per priority. If not, they go into the "Other priorities" channel of the subscription. Finally, if you create a channel for each priority: ``` Custom notifications for a specific priority: - Min priority: ON - Low priority: ON - Default priority: ON - High priority: ON - Max priority: ON ``` ... it would result in channels like the current implementation ... ``` ntfy.sh/mytopic - Min priority - Low priority - Default priority - High priority - Max priority ``` (no need for the "Other priorities" notification channel). What do you think? Still too complicated?
Author
Owner

@doits commented on GitHub (Dec 4, 2022):

A simplification could be to have the user only choose between three states:

Custom notifications for this subscription:
- A: Off (No custom notifications, default)
- B: On (All notifications have the same custom notification channel, priority not configurable --> one channel)
- C: Per priority (One notification channel for each priority --> 5 channels)

So in essence you could only choose to have all 5 priority channels (C) or one for all priorities (B), which would make the settings dialog simpler (only one list setting) and sacrifice only a little bit flexibility.

<!-- gh-comment-id:1336431612 --> @doits commented on GitHub (Dec 4, 2022): A simplification could be to have the user only choose between three states: ``` Custom notifications for this subscription: - A: Off (No custom notifications, default) - B: On (All notifications have the same custom notification channel, priority not configurable --> one channel) - C: Per priority (One notification channel for each priority --> 5 channels) ``` So in essence you could only choose to have all 5 priority channels (`C`) or one for all priorities (`B`), which would make the settings dialog simpler (only one list setting) and sacrifice only a little bit flexibility.
Author
Owner

@binwiederhier commented on GitHub (Dec 4, 2022):

Your suggestion in the last comment sounds fantastic and tackles all the issues I was worried about. However, option B is so incredibly counter-intiutive ("why does my min priority message still ring?", "why does my max priority message not vibrate like a maniac?") that it doesn't seem like it should exist.

So after all this discussion, I feel like what you have seems to be the right approach. Let's go with that! I still have not reviewed the code, but I will probably tonight.

<!-- gh-comment-id:1336493093 --> @binwiederhier commented on GitHub (Dec 4, 2022): Your suggestion in the last comment sounds fantastic and tackles all the issues I was worried about. However, option B is so incredibly counter-intiutive ("why does my min priority message still ring?", "why does my max priority message not vibrate like a maniac?") that it doesn't seem like it should exist. So after all this discussion, **I feel like what you have seems to be the right approach. Let's go with that!** I still have not reviewed the code, but I will probably tonight.
Author
Owner

@binwiederhier commented on GitHub (Dec 6, 2022):

FYI I still haven't reviewed it, and I'm too tired to do it tonight. I got held up by all that "Google rejecting the app" business (see #531 ...).

<!-- gh-comment-id:1338617284 --> @binwiederhier commented on GitHub (Dec 6, 2022): FYI I still haven't reviewed it, and I'm too tired to do it tonight. I got held up by all that "Google rejecting the app" business (see #531 ...).
Author
Owner

@doits commented on GitHub (Dec 6, 2022):

No problem, take the time you need. There's no push from my side.

<!-- gh-comment-id:1339398072 --> @doits commented on GitHub (Dec 6, 2022): No problem, take the time you need. There's no push from my side.
Author
Owner

@binwiederhier commented on GitHub (Dec 10, 2022):

I merged https://github.com/binwiederhier/ntfy-android/pull/49 and it'll be in the next release. Thank you @doits for all your work.

<!-- gh-comment-id:1344985509 --> @binwiederhier commented on GitHub (Dec 10, 2022): I merged https://github.com/binwiederhier/ntfy-android/pull/49 and it'll be in the next release. Thank you @doits for all your work.
Author
Owner

@doits commented on GitHub (Dec 10, 2022):

Glad it got merged and thanks for your review and your finishing up! Unfortunately I couldn't review your changes (couldn't find the time), but I'm sure it works out like it should :-)

<!-- gh-comment-id:1345234173 --> @doits commented on GitHub (Dec 10, 2022): Glad it got merged and thanks for your review and your finishing up! Unfortunately I couldn't review your changes (couldn't find the time), but I'm sure it works out like it should :-)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ntfy#5
No description provided.