How to show a notification without a sound java

后端 未结 11 1706
鱼传尺愫
鱼传尺愫 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:45

    To disable the sound in OREO 8.1, change the priority of the notification as LOW and it will disable the sound of notification:

    NotificationManager.IMPORTANCE_LOW
    

    The code is like:

    NotificationChannel chan1 = new NotificationChannel("default", "default", NotificationManager.IMPORTANCE_LOW);
    

提交回复
热议问题