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

Android: custom sound not playing in FCM push notifications #246

Open
husaindevelop opened this issue Feb 9, 2022 · 2 comments
Open

Android: custom sound not playing in FCM push notifications #246

husaindevelop opened this issue Feb 9, 2022 · 2 comments

Comments

@husaindevelop
Copy link

We have used your webview project to create our app. Its working great until we hit the roadbloack now we were trying to send a push notification with a custom sound to user's android devices. While sending push notifications using FCM from our app, the message does arrive in user's device but the custom sound set in the payload does not play. The notification arrives,but the custom sound does not play and nor does the default notification sound play. Here is the payload we are using

$notification = [
            'title' =>"Hello",
            'body' =>"Hello",
            'image'=>''
            'sound'=>'https://mbracecloud.com/sound.mp3'
            ];

Firebase.java:NotificationCompat.Builder

Uri soundUri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
        NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, MainActivity.asw_fcm_channel)
                .setSmallIcon(R.mipmap.ic_launcher)
                .setContentTitle(title)
                .setContentText(message)
                .setAutoCancel(true)
                .setSound(soundUri)
                .setContentIntent(pendingIntent);
        Notification noti = notificationBuilder.build();
        noti.flags = Notification.DEFAULT_LIGHTS | Notification.FLAG_AUTO_CANCEL;

        NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

        notificationManager.notify(notification_id, notificationBuilder.build());

Do help us out on this issue.

@mgks
Copy link
Owner

mgks commented Feb 25, 2022

noted, will look into it

@husaindevelop
Copy link
Author

Any progress on this issue.

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

2 participants