更改 iOS Flutter 中的通知声音

问题描述 投票:0回答:1

我想在 Flutter iOS 平台的推送通知中使用自己的声音。由于我没有iOS开发经验,所以我很挣扎。

在我的应用程序设置中有3个通知声音选项,以便用户可以选择通知声音。我已经实现了 local_notifications 包,虽然我在应用程序中收到通知,但我找不到如何在 iOS 平台的推送通知中使用自定义声音。

ios flutter dart push-notification flutter-dependencies
1个回答
11
投票

您应该将此默认给定声音名称替换为您的声音名称。

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

(在此之前,您的声音应该使用 Xcode 添加到您的项目中) 以下是如何使用 Xcode 将自定义声音添加到 iOS 设备项目的链接:https://medium.com/@dmennis/the-3-ps-to-custom-alert-sounds-in-ios-push -通知-9ea2a2956c11

注意:声音持续时间应小于30秒,文件名不能包含大写字母,否则将无法工作

© www.soinside.com 2019 - 2024. All rights reserved.