科尔多瓦本地通知声音在iOS和Android中不起作用 [英] cordova local notification sound not working in ios and Android
问题描述
我正在使用 cordova-plugin-local-notifications
插入.现在,我无法在Android和iOS上获取声音文件.
I am using cordova-plugin-local-notifications
plugin. Now I have issue to get my sound file in both Android and 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方式在本机端更改我的应用程序.
What I need to do I need to change in native side my app in sencha touch.
推荐答案
我认为该插件已更新,现在已弃用"window.plugin.notification.local.add"
方法,现在是"window.plugin.notification.local.schedule"
,日期"现在是"at",并且消息"现在是文本".
I think the plugin is updated and the "window.plugin.notification.local.add"
method is deprecated now, now it is "window.plugin.notification.local.schedule"
, the "date" is now "at" and "message" is now "text".
要安装插件,请使用以下命令:
To install plugin use below command:
cordova plugin add de.appplant.cordova.plugin.local-notification && cordova prepare
我安装了一个插件版本:0.8.1,但最终版本是0.7.4.
I have a plugin version installed: 0.8.1, before it is 0.7.4 at my end.
按如下所示设置声音":
Set "sound" as like below:
sound: "file://resources/audio/beep.mp3"
所以您的新方法将如下所示:
so your new method will be like below:
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设备上,它对我来说工作正常. 希望对您有所帮助:)
It is working fine for me on iOS and Android devices. Hope it will be helpful to you :)
这篇关于科尔多瓦本地通知声音在iOS和Android中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!