我实现了颤振本地通知,它成功发送了通知但没有声音。我让 playSound: true ,它应该播放默认声音,但它不起作用。我卸载并重新安装该应用程序,但仍然无法正常工作。请给我一个解决方案。
代码:
_testNotification() async {
const AndroidNotificationDetails androidPlatformChannelSpecifics =
AndroidNotificationDetails(
'your channel id', 'your channel name', 'your channel description',
importance: Importance.max,
priority: Priority.high,
playSound: true,
showWhen: false);
const NotificationDetails platformChannelSpecifics =
NotificationDetails(android: androidPlatformChannelSpecifics);
await flutterLocalNotificationsPlugin.show(
0, 'plain title', 'plain body', platformChannelSpecifics,
payload: 'item x');
}