【问题标题】:Where to put custom sound file on Ionic 4 for OneSignal Push Notification?将自定义声音文件放在 Ionic 4 上的 OneSignal 推送通知的什么位置?
【发布时间】:2020-03-31 01:59:19
【问题描述】:

我看到了一些其他问题,上面写着platforms/ios/res/raw/

但在我的 Ionic 4 应用程序中,我没有文件夹 res/raw/

【问题讨论】:

    标签: android ios ionic-framework ionic4


    【解决方案1】:

    platforms/ios/res/raw/ 不在您的 ionic 应用程序中,它在构建后位于 ios 目录中,因此在您的 config.xml 中:

    <platform name="ios"> 
        <resource-file src="resources/music/mp3 file name.mp3" target="res/raw/mp3 file name.mp3" /> 
    </platform>
    

    这里请注意,在资源文件夹中,您创建一个名为 music 的文件夹,并在其中添加 mp3 通知声音,并将包含在我提到的资源文件中。

    对于 android 也是如此,您将在 android 中广告资源文件,但您将指定通知将在 android 中放置通知的位置。

    【讨论】:

    • 谢谢...我补充说...当我部署它时,它会在目标位置创建文件夹和文件,但不幸的是,当我从 OneSignal 发送带有文件名的测试推送通知时声音不播放
    • android_sound:'itake 需要 .wav.mp3.ogg' 和 ios_sound:'它需要 .wav.aiff.caf' 对于 android,它适用于小于 28 的版本
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-16
    • 2020-05-26
    • 1970-01-01
    相关资源
    最近更新 更多