cordova 本地通知声音在 ios 和 Android 中不起作用

cordova local notification sound not working in ios and Android

我正在使用 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 
});

我需要做什么 我需要在本机端更改我在 sencha touch 中的应用程序。

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

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

cordova plugin add de.appplant.cordova.plugin.local-notification && cordova prepare

我安装了一个插件版本:0.8.1,之前我这边是0.7.4。

设置"sound"如下:

sound: "file://resources/audio/beep.mp3"

因此您的新方法将如下所示:

window.plugin.notification.local.schedule({
    id:         '0001',
    at:         new Date,
    text:       'hello',
    title:      'title',
    badge:      1,
    sound:      'file://resources/audio/beep.mp3',
    autoCancel: true,
    ongoing:    true
});

我在 iOS 和 Android 设备上工作正常。 希望对您有所帮助:)