I need to Play a Sound on a Mobile App when it receives a Onesignal Notification, I tried to use the onesignal audio property but I'm not able to make it work.
So I'm trying to place somewhere in the app a Javascript to play sound but I don't know where the App runs when it's closed, seems that onesignal remains like a service to listen to the notification when received.
Any suggestion?
Gonçalo Martins wrote:
ccaceres wrote:
Hi. Were you able to solve this requirement you described? Feel free to share it with the community or on the other hand, tell us if you have some further questions.
Cheers,
GM
Yes, I was able to solve it, what I did was to use the receive notification handler event of the OneSignal plugin, to be able to do this I made the following steps:
Now I’m working on applying the Background Mode to avoid on closing the app.
I hope this can be helpful.
Hi.
You can use something like this.
Great explanation.
Also, I'm glad to see that my post about playing sound was useful since you're using it ;)
Cheers and thank you for sharing this with the community.
That's right it was very helpful.
Thanks..!!!
Hi,I have tried the above but I am not receiving any sound effect. Any other way to play sound when the notification received.
Thanks,
Jeyasri
Hi,
We too want to play a sound on a mobile phone when a OneSignal notification is received. I mean, literally, at the moment the notification is received. I have tried the above, but that only has the sound played when the app is already active, which is not a complete solution for what we want.
When I look at the structure of the Notification that is received, under Payload there is a Sound attribute, but how this is to be used is not clear. Also unclear is how to set this attribute from a web application. In the OneSignalAPI there is a SendPushNotificationToDevice action, but no way to set a Sound attribute as far as I can tell.
Anyone have any tips on how to set these attributes and have a sound played on notification received, even when the app is not active?
Thanks!
Hi is this resolve already if yes can I ask the approach you did for this one ? Thank you !
Dear Community, are you guys able to solve this? If you can share the resolution that would be great help. Thank you.