【发布时间】:2020-05-04 03:18:38
【问题描述】:
我想在 Android 端为我的本地通知设置自定义声音。 我在 Android 项目的 res 文件夹中创建了一个 raw 文件夹。 这是我将 alarm.mp3 文件路径放在通知中的代码的一部分。
var androidPlatformChannelSpecifics =
new AndroidNotificationDetails(
"$id",
not.columnValue + not.deveui,
not.columnValue + not.deveui,
sound: "@raw/alarm",
importance: Importance.Max,
priority: Priority.High);
实际上它仍然使用默认系统声音。
如果我输入@raw/alarm.mp3,则会出现以下异常:Unhandled Exception: PlatformException(INVALID_SOUND, The resource %s could not be found. Please make sure it has been added as a raw resource to your Android head project., null)
注意:声音:RawResourceAndroidNotificationSound('alarm'),已解决
【问题讨论】:
标签: flutter notifications