NotificationManagerCompat是否仅具有与NotificationManager相关的磨损特定功能? [英] Does NotificationManagerCompat only have wear-specific features in relation to NotificationManager?

查看:262
本文介绍了NotificationManagerCompat是否仅具有与NotificationManager相关的磨损特定功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

从我的在线搜索看来,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类包含在其中,根据所安装的平台其行为有所不同. 您可以看一下:

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相关的磨损特定功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆