Closed enkaradag closed 3 years ago
Ok, at last i heard my custom sound, after putting wav files into Resources/raw and changed build action to AndroidResource
but now i see a strange behavior.
I created two notifications channels for android. one (CHANNEL1) is playing sound1.wav, the second one (CHANNEL2) is playing sound2.wav. when i send for CHANNEL1 with "existing_android_channel_id":"CHANNEL1" i hear sound1.wav. when i send for CHANNEL2 with "existing_android_channel_id":"CHANNEL2" i hear sound2.wav. everything is fine up to now
but, when i send 5 push notifications, android groups the new notifications and always plays only one of those sound1.wav and sound2.wav for all new notifications.
when i remove the stacked notifications by swiping left, again i can hear seperate sounds for 4 more notifications. after those four, starts playing constant sound again for all new ones
what happens on that 5th notification while previous 4 works as expected? what am i missing here?
what i want to reach here is; my users want to set up sounds for each type of notifications in app (such as longalarm.wav when door1 opened, shortalarm.wav when door2 opened)
Still need help.
Regards
Ender
Howdy, Apologies for the delay. Every operating system has a default behavior for grouping notifications together.
It's unclear whether Android allows overriding the sound once the notifications do get grouped, but if so, it sounds like you might have to write some native code which may get a bit tricky if you're not comfortable doing so. Take a look at our service extension documentation for more info.
Hi and thanks for your reply,
I have solved my situation. If GROUPKEY is not set, android 9+ does that unexpected behavior i mention above (tough i set up the notification channel properly). so i tried giving the same group key for all my notifications (for instance, i gave the short name of my app) the problem solved. Group key data is not viewed on client side.
i think this is a bug for sdk. If GROUPKEY is not defined, onesignal shall set a default one, otherwise custom sound set up becomes useless. Or that strange behavior may be declared at the "custom sound" subject of the documentation.
Thanks again for that great product;)
Regards Ender
Thanks for the details. Enjoy!
Ok, at last i heard my custom sound, after putting wav files into Resources/raw and changed build action to AndroidResource
You know what, this instruction was missing all over Internet ! Thanks a lot !
Description:
Xamarin.Android is not documented here for notifications with custom sounds https://documentation.onesignal.com/docs/customize-notification-sounds
Tried to put wav files in assets folder, resources folder, Assets/Plugins/Android/OneSignalConfig/res/raw folder (as described for unity) but not way, still hearing the default sound. Need Help.
Environment Visual Studio 2017, Com.OneSignal 3.8.2, Nuget