问题描述
Android教程说使用NotificationManagerCompat
类显示通知,但是由于此类没有createNotificationChannels
方法,因此处理两个不同的NotificationManager
有点尴尬.
The Android tutorials say to use NotificationManagerCompat
class to show notifications, but since this class has no createNotificationChannels
method, it's a bit awkward to handle 2 different NotificationManager
s.
从我的在线搜索看来,NotificationManagerCompat
的所有内部功能都是特定于Android Wear的,并且对手机/平板电脑没有影响.那个观察正确吗?
From my search online it seems that all internal features of NotificationManagerCompat
are specific to Android Wear and have no effect on phone/tablet. Is that observation correct?
推荐答案
如上所述,NotificationManagerCompat是"NotificationManager的兼容性库,具有针对较旧平台的后备功能."
As stated the NotificationManagerCompat is a "Compatibility library for NotificationManager with fallbacks for older platforms."
它和IMPL类包含在其中,根据所安装的平台其行为有所不同.您可以看一下: NotificationManagerCompat.java
It holds in it and IMPL class that behaves differently according to the platform it is installed upon.you can have a look at:NotificationManagerCompat.java
我不确定它的行为方式有何不同,但实际上它会覆盖某些处理发布,取消和检查通知是否启用的方法.
I'm not sure how differently it behaves but what it actually does is overrides certain methods that deal with posting, canceling and checking if notifications are enabled.
这篇关于NotificationManagerCompat是否仅具有与NotificationManager相关的磨损特定功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!