flutter notification custom sound not ringing is some OPPO and Huawei devices

23 views Asked by At

I am using flutter_local_notifications. for producing custom sound of the notification all was working fine till few days back as all of a sudden custom sound stops working of some OPPO and Huawei devices. It works fine on my pixel and samsung devices.

here is the code how set the custom sound the notification_sound.mp3 is in res/raw folder

 flutterLocalNotificationsPlugin.show(
          notification.hashCode, tittle, body, platformChannelSpecifics,
          payload: jsonEncode(message.data));

    var platformChannelSpecifics = NotificationDetails(
        android: androidPlatformChannelSpecifics,
        iOS: iOSPlatformChannelSpecifics);
var androidPlatformChannelSpecifics = AndroidNotificationDetails(
      channel.id,
      channel.name,
      importance: Importance.max,
      icon: '@drawable/ic_notification',
      sound: const RawResourceAndroidNotificationSound("notification_sound"),
      color: Colors.transparent,
      priority: Priority.max,
      playSound: true,
      autoCancel: true,
      silent: false,
      onlyAlertOnce: false,
      ongoing: true,
      /*additionalFlags:
            initializeNotification ? Int32List.fromList(<int>[4]) : null*/
      additionalFlags: Int32List.fromList(<int>[4]),
    );
0

There are 0 answers