简体   繁体   English

更改 iOS Flutter 中的通知声音

[英]Change notification sound in iOS Flutter

I want to use my own sound in push notification in iOS platform of Flutter.我想在 Flutter 的 iOS 平台的推送通知中使用自己的声音。 Since I have no experience in iOS development, I am struggling with it.由于我在 iOS 开发方面没有经验,所以我很挣扎。

In my app settings there are 3 notification sound options, so that user can choose notification sound.在我的应用设置中有 3 个通知声音选项,以便用户可以选择通知声音。 I have already implemented local_notifications package and although I am getting notifications in my app, I couldn't find how to use custom sound in push notification for iOS platform.我已经实现了 local_notifications package 并且虽然我在我的应用程序中收到通知,但我找不到如何在 iOS 平台的推送通知中使用自定义声音。

You should replace this default given sound name to your sound name.您应该将此默认给定声音名称替换为您的声音名称。

var iOSPlatformChannelSpecifics = IOSNotificationDetails(sound: 'slow_spring_board.aiff'); //put your own sound text here 

(Before this, your sounds should be added to your project using Xcode) Here is the link how to add custom sound to your project for iOS devices using Xcode: https://medium.com/@dmennis/the-3-ps-to-custom-alert-sounds-in-ios-push-notifications-9ea2a2956c11 (在此之前,您的声音应该使用 Xcode 添加到您的项目中)这里是如何使用 Xcode 为 iOS 设备的项目添加自定义声音的链接: Z5E056C500A1C4B6A7110-B50D807BADE-Z://med.com//the-Z://3 to-custom-alert-sounds-in-ios-push-notifications-9ea2a2956c11

Note: Sound duration should be less than 30 seconds otherwise it will not work注意:声音持续时间应小于 30 秒,否则将不起作用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM