Does NotificationManagerCompat only have wear-specific features in relation to NotificationManager?

大城市里の小女人 提交于 2019-12-11 04:12:03

问题


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 NotificationManagers.

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?


回答1:


As stated the NotificationManagerCompat is a "Compatibility library for NotificationManager with fallbacks for older platforms."

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.



来源:https://stackoverflow.com/questions/50192724/does-notificationmanagercompat-only-have-wear-specific-features-in-relation-to-n

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!