I'm using MixPanel to send push notification and on the custom payload I add the following code: {"sound":"default"} the problem Is that no sound gets played when I receive the notification. Does anyone have a solution for this?
Choose the appropriate category and select Alert. On the Notification category page, scroll down to the Sound section. It shows the default tone enabled for the app. Tap Sound and select your desired notification tone from the list to change the presets.
On Android devices, it is possible to choose individual push notification sounds.
mBuilder.setSound(Settings.System.DEFAULT_NOTIFICATION_URI);
Maybe this helps found here code will look like this.
Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
Ringtone r = RingtoneManager.getRingtone(getApplicationContext(), notification);
r.play();
In order to send notification + sound using mixpanel, you need to do the following:
add the following code to the onCreate:
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this);
mBuilder.setSound(Settings.System.DEFAULT_NOTIFICATION_URI);
Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
Ringtone r = RingtoneManager.getRingtone(getApplicationContext(), notification);
r.play();
Send notification from mixpanel and see it received. This will send notification on create with default sound configured on the user's device.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With