Reputation: 36656
I saw the documentation:
public Uri sound
Added in API level 1
The sound to play.
To play the default notification sound, see defaults.
but how do I disable sound playing? sending Uri == null
?
Upvotes: 0
Views: 1580
Reputation: 8134
If you don't call setSound(uri) with NotificationBuilder, the sound won't play. Eg. The following would play the default sound for notification:
Uri alarmSound = RingtoneManager
.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(
this).setSmallIcon(R.drawable.ic_launcher)
.setContentTitle("title")
.setSound(alarmSound);
Just remove ".setSound(alarmSound)" and it won't play the sound, like:
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(
this).setSmallIcon(R.drawable.ic_launcher)
.setContentTitle("title");
Hope i got the question right(?)
Upvotes: 2