Custom sound in local Notification IONIC 3(本地通知 IONIC 3 中的自定义声音)
问题描述
我想更改安卓本地通知的默认声音,但它不起作用
I want to change the default sound for local notification on android but it doesn't work
我试图将声音文件放入项目中,但是当我运行我的应用程序时,它会播放默认声音
i tried to put the sound file into the project but when i run my app it play the default sound
我也尝试在声场上放一个远程声音文件,但同样的问题
also i tried to put on sound field a remote sound file but the same issue
this.localNotifications.schedule({
text: 'Delayed ILocalNotification',
at: new Date(new Date().getTime() + 3600),
led: 'FF0000',
sound: 'https://notificationsounds.com/soundfiles/15de21c670ae7c3f6f3f1f37029303c9/file-sounds-1085-definite.mp3',
});
推荐答案
你放置的声音文件是正确的.
The sounds file where you placed is correct.
但是当你构建 Android 应用时,它的位置是不同的.
But when you build the Android app, it's location is different.
android_asset/www/assets/sounds/name.mp3
那是你需要指定的位置
当然这是在你使用media插件的时候,收到通知后使用的.
Of course this is used when you are using the media plugin, after the notification is received.
编辑这不再是一个可行的解决方案.请参阅 ionic 文档,因为在 android 和 iOS 中都有突破性的变化
EDIT This is no longer a viable solution. Refer docs for ionic, since there are ground breaking changes both in android and iOS
这篇关于本地通知 IONIC 3 中的自定义声音的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:本地通知 IONIC 3 中的自定义声音
基础教程推荐
- jQuery File Upload - 如何识别所有文件何时上传 2022-01-01
- 如何在特定日期之前获取消息? 2022-01-01
- 如何使用sencha Touch2在单页中显示列表和其他标签 2022-01-01
- Node.js 有没有好的索引/搜索引擎? 2022-01-01
- WatchKit 支持 html 吗?有没有像 UIWebview 这样的控制器? 2022-01-01
- 为什么我在 Vue.js 中得到 ERR_CONNECTION_TIMED_OUT? 2022-01-01
- 每次设置弹出窗口的焦点 2022-01-01
- Javascript 在多个元素上单击事件侦听器并获取目标 2022-01-01
- 如何使用 CSS 显示和隐藏 div? 2022-01-01
- 什么是不使用 jQuery 的经验技术原因? 2022-01-01
