cordova本地通知声音在ios和Android中无效

Rav*_*dar 3 android ios sencha-touch localnotification cordova

我正在使用cordova-plugin-local-notifications 插件.现在我有问题在Android和iOS上获取我的声音文件.

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 
});
Run Code Online (Sandbox Code Playgroud)

我需要做什么我需要在原生方面改变我的应用程序在sencha touch.

小智 5

我认为插件已更新并且该"window.plugin.notification.local.add"方法现在已弃用,现在它是"window.plugin.notification.local.schedule","日期"现在是"at"而"message"现在是"text".

要安装插件,请使用以下命令:

cordova plugin add de.appplant.cordova.plugin.local-notification && cordova prepare
Run Code Online (Sandbox Code Playgroud)

我安装了插件版本:0.8.1,之前是0.7.4.

设置"声音"如下所示:

sound: "file://resources/audio/beep.mp3"
Run Code Online (Sandbox Code Playgroud)

所以你的新方法如下:

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 
});
Run Code Online (Sandbox Code Playgroud)

它适用于iOS和Android设备.希望它对你有所帮助:)