Notifications fail to display in Android Oreo (API 26)

前端 未结 4 830
[愿得一人]
[愿得一人] 2020-11-30 05:32

I get this message when trying to display a notification on Android O.

Use of stream types is deprecated for operations other than volume control

4条回答
  •  攒了一身酷
    2020-11-30 06:00

    Per the comments on this Google+ post:

    those [warnings] are currently expected when using NotificationCompat on Android O devices (NotificationCompat always calls setSound() even if you never pass in custom sound).

    until the Support Library changes their code to use the AudioAttributes version of setSound, you'll always get that warning.

    Therefore there's nothing that you can do about this warning. As per the notification channels guide, Android O deprecates setting a sound on an individual notification at all, instead having you set the sound on a notification channel used by all notifications of a particular type.

提交回复
热议问题