【问题标题】:Does NotificationManagerCompat only have wear-specific features in relation to NotificationManager?NotificationManagerCompat 是否仅具有与 NotificationManager 相关的穿戴特定功能?
【发布时间】:2018-05-05 18:24:48
【问题描述】:
Android 教程中说要使用NotificationManagerCompat 类来显示通知,但由于该类没有createNotificationChannels 方法,处理2 个不同的NotificationManagers 有点尴尬。
从我的在线搜索来看,NotificationManagerCompat 的所有内部功能似乎都是 Android Wear 特有的,对手机/平板电脑没有影响。这个观察正确吗?
【问题讨论】:
标签:
android
push-notification
notifications
android-notifications
【解决方案1】:
如前所述,NotificationManagerCompat 是“NotificationManager 的兼容性库,具有旧平台的回退功能。”
它包含在它和 IMPL 类中,根据它所安装的平台,其行为不同。
你可以看看:
NotificationManagerCompat.java
我不确定它的行为有何不同,但它实际上是覆盖了某些处理发布、取消和检查通知是否启用的方法。