Android-SmartWebView
Android-SmartWebView copied to clipboard
Android: custom sound not playing in FCM push notifications
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.
noted, will look into it
Any progress on this issue.