Custom Sound in Cordova Local Notification

2

I'm trying to customize the sound for a notification using Cordova . I'm using the Cordova Local Notification plugin, but the sound does not play when I display the notification.

Tests performed:

  • I tried to use custom sound in SDCard : worked!
  • I tried to use the sound for a URL: did not work but it's not what I need
  • I tried to use a sound that is in the folder www called beep.mp3 : did not work, and that's what I need
  

Testing on Android , more precise that works on iOS as well.

Here is the code I'm trying to implement:

window.plugin.notification.local.add({
            id: id,
            title: titulo,
            message: msg,
            sound: (config.platform_compilation != 'IOS') ? 'file:///android_assets/www/beep.mp3' : 'www/audio/beep.mp3',
            date: DateOBJ
});

My check of config.platform_compilation is correct, the problem is when I try to play the sound that is in www , if I put this file in SDCard and change the path at compile time, it works, but I need this sound within the APK / APP to make it available.

    
asked by anonymous 06.03.2015 / 00:15

1 answer

1

With the plugin update the sound came back up, I just needed to remove it and put it back.

Here is an example of usage:

window.plugin.notification.local.add({
        id: id,
        title: titulo,
        message: msg,
        sound: (config.platform_compilation != 'IOS') ? 'file:///beep.mp3' : 'www/beep.mp3',
        date: DateOBJ
});
  

The file is in / android_asset / www.

    
06.03.2015 / 18:39