Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No sound playing on Android 12 #2278

Open
GabLedesma opened this issue Mar 21, 2024 · 3 comments
Open

No sound playing on Android 12 #2278

GabLedesma opened this issue Mar 21, 2024 · 3 comments

Comments

@GabLedesma
Copy link

Describe the bug
The notification with custom sound is working fine on my Android 14 but when I use Android 12, the notification is showing but there is no sound. I'm using FCM.

Android channel setup:
Screenshot 2024-03-21 at 9 56 19 AM

Screenshot 2024-03-21 at 9 56 45 AM

How I trigger notification:
Screenshot 2024-03-21 at 9 59 28 AM

@ditheshthegreat
Copy link
Contributor

@GabLedesma
test( 'show with default Android-specific details and custom sound from raw ' 'resource', () async { const AndroidInitializationSettings androidInitializationSettings = AndroidInitializationSettings('app_icon'); const InitializationSettings initializationSettings = InitializationSettings(android: androidInitializationSettings); await flutterLocalNotificationsPlugin.initialize(initializationSettings); const AndroidNotificationDetails androidNotificationDetails = AndroidNotificationDetails( 'channelId', 'channelName', channelDescription: 'channelDescription', sound: RawResourceAndroidNotificationSound('sound.mp3'), );

Based on test case, you need to specify the file type in 'RawResourceAndroidNotificationSound'

@InShad7
Copy link

InShad7 commented Mar 31, 2024

by providing the extension to the RawResourceAndroidNotificationSound('sound.mp3'),

Error scheduling notification: PlatformException(invalid_sound, The resource asound.mp3 could not be found. Please make sure it has been added as a raw resource to your Android head project., null, null)

@MaikuB
Copy link
Owner

MaikuB commented May 17, 2024

I've had a Pixel 6 that's had Android 12 on it before with the plugin and not had these issues. I don't recall others saying they had such issues either. From what I know with how the APIs work, there's no OS-specific issues when it comes to notification sounds unless there is something that the manufacturer has done with their version of Android. With that in mind, this isn't something I can help with and you'd need to investigate further. One thing I'll also mention is to check in both cases that you're actually triggering the local notification via this plugin to avoid confusion between a local notification and push notification from FCM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants