Android disable notification sounds

前端 未结 3 613
猫巷女王i
猫巷女王i 2021-01-20 00:47

I want to create a notification without any sounds. How can I do this? I tried the code below but it\'s not working for me:

notification = mBuilder
        .         


        
3条回答
  •  北恋
    北恋 (楼主)
    2021-01-20 01:18

    After your notification builder, add

    notification.defaults = 0;
    

    to tell the notification manager not to make any default values when not specified (eg. you set to null so it takes the default value, adding this will remove this behavior and so disable sounds completely).

提交回复
热议问题