Cordova local notification sound not working in ios and andorid
I am using a cordova-plugin-local-notifications
plugin. Now I have a problem to get my sound file in Android and iOS.
If you have a solution please let me know.
window.plugin.notification.local.add({
id: '0001',
date: new Date,
message: 'hello',
title: 'title',
badge: 1,
sound: 'www/resources/audio/beep.mp3',
autoCancel: true,
ongoing: true
});
What I need to do is I need to change in my side the app in sencha touch app.
source to share
I think the plugin has been updated and the method is "window.plugin.notification.local.add"
now deprecated, now it is "window.plugin.notification.local.schedule"
, now "date" is "in" and "message" is now "text".
To install the plugin use the command below:
cordova plugin add de.appplant.cordova.plugin.local-notification && cordova prepare
I have plugin version installed: 0.8.1, up to 0.7.4 on my end.
Set the "sound" as shown below:
sound: "file://resources/audio/beep.mp3"
so your new method will look like this:
window.plugin.notification.local.add({
id: '0001',
at: new Date,
text: 'hello',
title: 'title,
badge: 1,
sound: 'file://resources/audio/beep.mp3',
autoCancel: true,
ongoing: true
});
It works great for me on both iOS and Android devices. Hope you find it helpful :)
source to share