在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'}}