-
-
Notifications
You must be signed in to change notification settings - Fork 155
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
Support different sounds and priority #18
Comments
Hey @jvandenbroek I'm with you there, the priority isn't used anywhere and is currently only saved on server side.
Each priority 0 - 10 (and 10+) could be a Notification Channel, with Android 8+ a custom sound can be added to each channel. I don't really use sound on my phone as its mostly on vibrate only, so let's wait for more feedback about the custom sound thingy. |
I really like the idea of mapping Gotify message priorities to Android notification channels. So much so that I made a pull request #22 which makes the required changes. Please let me know if I should make any further changes. I have a question though @jmattheis. Why did you decide to have such a high granularity of message priorities in Gotify? |
@schwma I've added priority really early on, back then all was kinda work in progress, I knew that something like priority should exist but badly I haven't really thought about it, so I just made it integer. |
@schwma Great work, thanks! However unfortunately I'm only using Android 6, so I think notification channel sound won't work? For now it would be nice if just priority 0 disables sound and vibration, that would be very usable for me. |
@jvandenbroek Hmmm, thats strange. The way I understood it, notification channel importances should be backwards compatible. I just tried it on an Android 6 device and all notification channels play sounds and vibrate, so they don't seem to be. I'll try to figure out whats happening when I find the time. |
@schwma ah no I misunderstood, because @jmattheis said above for Android 8+, I didn't check this out myself. I (unfortunately) don't have an Android dev environment to build it myself, so haven't tested your PR.. Guess it should work for me as well then, great! 👍 Edit: Ah should read better, he's talking about custom sounds, not channel notification in general, silly me :P |
@jvandenbroek Honestly, I'm not sure it will work. I tried it with an Android 6 device that I have here and it didn't work. I'm not entirely sure why though. |
@schwma @jvandenbroek NotificationCompact has this method
Currently DEFAULT_SOUND and DEFAULT_LIGHTS are set on the message notification, (DEFAULT_VIBRATE comes with DEFAULT_SOUND I guess). Without Notification channels there are no restrictions so it just uses these defaults. |
@jmattheis But then how do you set no flags at all (or a flag for no sound/vibration/light)? I tried to remove the setDefault() calls entirely, but that didn't seem to change anything. |
@schwma Hmm maybe it has some defaults (:, You can try |
I would very much like custom sounds myself. It'd be even nicer if I could specify a default sound for an application in the server and have clients automatically download the sound. |
I was also thinking about defining per-token sound defined in Gotify app. But evaryont has a good point, having a sounds uploaded on server would be great. The ideal way would be:
|
@evaryont @sik0vny Tho' it is not customizable for each application and must be customized on each device. |
Im currently using pushover, and like their server side sound support. Would be cool to see this on gotify, as in the prosess over moving over. |
I recently moved to a pretty rural area where satellite was the only option, I have several notifications that I have come to rely on around my house that I also use pushover for because of the custom sounds. Unfortunately, if its raining then my connection sucks, and I don't get the notifications... This is what ultimately lead me to this project, so a +1 for custom sounds. |
I have tried to implement this feature. But it seems this will not be an easy task, since the setLight() method which is used to set it to Color.CYAN is only obeyed once, and after that it is set as long as its corresponding NotificationChannel exists. I have not tried to find out if this holds true for sounds aswell. See: This means to support this, gotify needs to remove the priority based message channels and create app-based message channels (and recreate them when the user changes light (and possibly sounds)). This comes with its obvious downsides. @jmattheis Is this something which should be done? |
I think removing the channels for priorities will be a no-go. Priorities should still be supported. Maybe we could use the RingtoneManager to play the custom sound: https://stackoverflow.com/a/9622040/4244993 |
Closing in favor of #75 |
First of all, I'm really thankful someone finally created this self hosted solution :) Works great and seems pretty battery friendly, so I'm really happy with it as alternative for GCM.
Maybe you could extend it functionality a bit with being able to set different sounds per priority? I'd say priority 0 (or -1, don't know what the lowest is actually?) should never play any sound, that one shouldn't be to hard to implement I think? Next step (or maybe the same ;)) would be able to setup different sounds and colors per priority level.
And finally it would be really great if a sound field could be implemented on the server, which the client interprets. Just like pushover allows you to send different sounds, but I could imagine something simpler like settings sound1, sound2, sound3 etc in the client and just use that as value for the sound field.
The text was updated successfully, but these errors were encountered: