NotificationCompat v7 和 Android O
NotificationCompat v7 and Android O
我在使用 NotificationCompat v7 和 Android O 时遇到问题。
由于 NotificationCompatV7 的实现仅实现了 v4 版本的弃用构造函数 (was deprecated in support library 26.0.0-beta1),因此我无法让通知正常工作。
此处提出了 NotificationCompat v4 的解决方案:
但是由于 v7 版本 (https://issuetracker.google.com/issues/62475846) 的执行不力存在这个问题,我无法在 Android 上 post 通知 O
有人对此有解决方案吗?还是我遗漏了什么?
NotificationCompat v7 现已弃用,您应该使用 NotificationCompat v4(根据对 NotificationCompat v7 class 的评论)。
/**
* @deprecated Use the static classes in {@link android.support.v4.app.NotificationCompat}.
*/
然后您可以构建您的通知 (Kotlin):
val notificationBuilder = NotificationCompat.Builder(context, "your_notification_channel_name")
.setContentTitle("title")
[...]
注:最新支持版本为"com.android.support:appcompat-v7:26.0.0"
我在使用 NotificationCompat v7 和 Android O 时遇到问题。 由于 NotificationCompatV7 的实现仅实现了 v4 版本的弃用构造函数 (was deprecated in support library 26.0.0-beta1),因此我无法让通知正常工作。
此处提出了 NotificationCompat v4 的解决方案:
但是由于 v7 版本 (https://issuetracker.google.com/issues/62475846) 的执行不力存在这个问题,我无法在 Android 上 post 通知 O
有人对此有解决方案吗?还是我遗漏了什么?
NotificationCompat v7 现已弃用,您应该使用 NotificationCompat v4(根据对 NotificationCompat v7 class 的评论)。
/**
* @deprecated Use the static classes in {@link android.support.v4.app.NotificationCompat}.
*/
然后您可以构建您的通知 (Kotlin):
val notificationBuilder = NotificationCompat.Builder(context, "your_notification_channel_name")
.setContentTitle("title")
[...]
注:最新支持版本为"com.android.support:appcompat-v7:26.0.0"