Flutter: How to enable Notification Sound

Viewed 350

I am developing flutter application, I want to enable notification sound. I have integrate FCM & used flutterLocalNotificationsPlugin. This notification sound setting is disabled by default in app setting. I have to enable this setting

var androidPlatformChannelSpecifics = new AndroidNotificationDetails(
    'com.testApp', 'fcm', 'android',
    icon: 'notif_icon',
    color: Color(0xFFFFC33E),
    importance: Importance.max,
    priority: Priority.max,
    playSound: true,
    sound: RawResourceAndroidNotificationSound('slow_spring_board'),
    groupKey: 'com.testApp');
var iOSPlatformChannelSpecifics =
    new IOSNotificationDetails(threadIdentifier: 'com.testApp');
var platformChannelSpecifics = new NotificationDetails(
    android: androidPlatformChannelSpecifics,
    iOS: iOSPlatformChannelSpecifics);
await flutterLocalNotificationsPlugin.show(
  0,
  notification.title,
  notification.body,
  platformChannelSpecifics,
  payload: json.encode(message.data),
);
0 Answers
Related