Search code examples
androidflutterflutter-local-notification

Flutter Local Notification Sound not working


The notification sound using Flutter Local Notification for Android not working at all here is the code

const NotificationDetails(
          android: AndroidNotificationDetails(
            'daily notification channel id',
            'daily notification channel name',
            'daily notification description',
            playSound: true,
            sound: RawResourceAndroidNotificationSound('pop'),
            importance: Importance.max,
            priority: Priority.high,
          ),
        ),

And I have pop.mp3 in this path: \android\app\src\main\res\raw\pop.mp3

How can I play the sound?


Solution

  • My problem was that I was testing the app on Xiaomi and I realized that Xiaomi has some problems and it by default doesn't allow notification sound. Somehow it didn't work on the emulator too, but by testing it on other physical devices it worked.