来自 BroadcastReceiver 的通知 PendingIntent

Notification PendingIntent from BroadcastReceiver

伙计们。

我已经调试了好几天了,但找不到答案。

正如标题所说,我正在使用 BroadcastReceiver 进行通知。

一切都很好,直到我添加 .addAction

默认需要PendingIntent,我做了一个PendingIntent

但问题是这样的;当我添加 .addAction 时,它显示为

Incompatiable types.

Required : android.app.Notification

Found : android.app.Notification.Builder

代码在没有 .addActionPendingIntent 的情况下工作得很好。

可能是什么问题?

这是我的代码,

使用 NotificationCompat 设置 .addAction(...)

勾选official docs

action buttons won't appear on platforms prior to Android 4.1. Action buttons depend on expanded notifications, which are only available in Android 4.1 and later.