在Android的Ionic 2中将自定义声音文件放在哪里以进行推送通知 [英] Where to put custom sound file for push notifications in Ionic 2 for Android
本文介绍了在Android的Ionic 2中将自定义声音文件放在哪里以进行推送通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Ionic 2应用程序中使用了推插件.现在,我想使用自定义的声音文件.
I am using the push plugin in my Ionic 2 app. Now I want to use a custom sound file.
我在有效负载中发送文件名:
I am sending the file name in my payload:
options = {data: {title: "Title", body: 'Body.', soundname: 'soundfile'}}
但是现在我不知道将声音文件放在Ionic项目中的什么位置.
But now I don't know where to put the sound file in my Ionic project.
我应该把它放到res/raw中.但这是在我的平台文件夹中吗?有人可以告诉我从根目录开始的正确路径吗?
I am supposed to put it into res/raw. But is this inside my platform folder? Can someone tell me the correct path starting from the root directory?
推荐答案
我找到了答案:
您必须将其放入:
platforms/android/res/raw/filename.mp3
对于iOS,我将其放在此处:
For iOS I put it here:
platforms/ios/res/raw/filename.mp3
在您的选项中,重要的是通知文件名而没有文件类型:
In your options it's important that you inform the filename WITHOUT the filetype:
options = {data: {title: "Title", body: 'Body.', soundname: 'filename'}}
这篇关于在Android的Ionic 2中将自定义声音文件放在哪里以进行推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文