$cordovaPush custom sound when in background


Hi all, i would to know how to make iOS and Android playing a custom sound when receiving a push notification in background with the $cordovaPush plugin.

For now, my push notifications (with pushsharp) are working good, but all with default system sound.

Should i fill the “Sound” attribute of the message payload? And my custom mp3 sound in which folder of the app should be put?



I’am currently trying to do the same and I read somewhere that IOS not accepting MP3 type of files so you should do a .WAV file. But I haven’t succeed yet to set a custom sound as a notification sound.
If somebody have any update regarding this topic it should be great, thanks.


Ok so as far as I go, I manage to set a custom sound on IOS both foreground and background but I haven’t succed to do as well on Android (I only succed to play the song foreground).

So with the $cordovaPush plugin you’ll need to add your song on both www/ root directory and on the Resources directory on your Xcode project tree in order to play the song both foreground and background. You’ll also need to send in your push notification the name of the sound that you wanna play.

See the exemple of a push notification:

{ "aps":{"alert":"Testing.. (1)","badge":1,"sound":"custom_sound.wav"}

Remember that if you don’t send this in you notification the sound played will be the default one.

I also found a other plugin that can manage push notifications phonegap-push-notification.
But I never succed to make it work fine …
Tell me if you can do that :wink: