我在用cordova-plugin-local-notifications https://github.com/katzer/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"
,“日期”现在是“at”,“消息”现在是“文本”。
要安装插件,请使用以下命令:
cordova plugin add de.appplant.cordova.plugin.local-notification && cordova prepare
我安装了一个插件版本:0.8.1,之前是0.7.4。
设置“声音”如下:
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 设备上对我来说运行良好。
希望对您有帮助:)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)