Android Oreo notification keep making Sound even if I do not set sound. On Older version, works perfectly

后端 未结 4 505
天涯浪人
天涯浪人 2020-12-15 04:41

So I am making my app compatible with Oreo and facing issue with notification.

I added notification channel according to documentation and everything is working smoo

4条回答
  •  囚心锁ツ
    2020-12-15 05:20

    Take a look at the notification channel settings (swipe your notification and press the settings icon under it and then select your channel). Those settings are set the first time you create the channel and then not modified unless you do it manually in the device (at least that is my experience from uninstalling and reinstalling my app to see what settings I get by default).

    Basically, channel.setSound(null, null) will only have effect when you create the channel on a fresh installation. That might be what they try to explain in the official guide:

    Attempting to create an existing notification channel with its original values performs no operation

    If you tried to follow that guide and set NotificationManager.IMPORTANCE_HIGH and didn't use channel.setSound(null, null), the channel would get importance level Urgent Make sound and pop on screen with the default sound.

提交回复
热议问题