Uri to default sound notification?
I use the Notification.Builder to build a notification. Now I want to use the default sound notification with:
builder.setSound(Uri sound)
But where is the Uri to the default notification?
Solution 1:
try using RingtoneManager to get Default Notification Uri as:
Uri uri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
builder.setSound(uri);
Solution 2:
builder.setSound(Settings.System.DEFAULT_NOTIFICATION_URI)
works as well
Solution 3:
The two options to use the Default Notification Sound
are:
mBuilder.setDefaults(Notification.DEFAULT_SOUND);
or using RingtoneManager Class:
mBuilder.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION));
Solution 4:
all of these methods work
mBuilder.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION));
mBuilder.setSound(Settings.System.DEFAULT_NOTIFICATION_URI);
mBuilder.setDefaults(Notification.DEFAULT_SOUND);
Google Documentation