如何为较低的API(<26)创建NotificationChannel?

Bin*_*aby 0 notifications android android-appcompat android-notifications notification-channel

如何为较低的API(<26)创建NotificationChannel?有没有办法用AppCompat做到这一点?

Fra*_*ank 5

不可能.Android操作系统不支持它.您可以将channelId添加到通知中NotificationCompat.Builder(Context context, String channelId),但操作系统会在Oreo之前忽略它.

我的同事在API 15,22,23和26上测试了它:https://stackoverflow.com/a/45979726/1310343