How to show a notification without a sound java

后端 未结 11 1703
鱼传尺愫
鱼传尺愫 2020-12-11 15:09

How can I make a notification that doesn\'t make a sound when I build it? I am building a notification, and my users don\'t like the fact that it makes a sound.

11条回答
  •  眼角桃花
    2020-12-11 15:39

    I might be late but still wants to add this . You can disable sound using .setSound(null) on NotificationCompat.Builder builder for all OS below O.

    For O version n above add channel.setSound(null,null) after creating NotificationChannel channel

    All the solutions above mine is either outdated or covers some OS versions only

提交回复
热议问题