I'm using the PushPlugin for cordova, and in android, I can't make the push notification play a sound while the app is not running or in background (the banner in status bar is presented ok). Here's the function that gets called on android push notifications-
function onNotification(e) {
.
.
.
case 'message':
{
var myMedia = new Media("/android_asset/www/res/raw/tritone.mp3");
myMedia.play({ numberOfLoops: 2 })
the sound plays fine while app is running in foreground.
This is the 'e' param value of the function "onNotification(e)" after a push is received while I'm in foreground (which does play the sound fine)-
{
"message":"body text...",
"payload":{
"message":"body text...",
"soundname":"/android_asset/www/res/raw/tritone.mp3",
"title":"sometitle"
},
"collapse_key":"do_not_collapse",
"from":"969601086761",
"soundname":"/android_asset/www/res/raw/tritone.mp3",
"foreground":true,
"event":"message"
}
I have a feeling that the "function onNotification(e)" block is not called at all while the app is not running or in background.
In the end, what I want is very simple- to play a custom sound file on push notification while app is not running, or app is in background.
Thanks in advance.