我正在实施Firebase推送通知。它具有2个动作按钮“接受”和“拒绝”,并且它是一个来自数据有效载荷的数组。
按下触发时,仅显示“拒绝”按钮。没有同时显示两个按钮。
下面是我的代码
NotificationCompat.Builder(this, channelId)
.setSmallIcon(R.drawable.push_small_icon)
.setStyle(NotificationCompat.BigPictureStyle().bigPicture(bitmap))
.setContentTitle(remoteMessage.data[Const.TITLE])
.setContentText(remoteMessage.data[Const.MESSAGE])
.setPriority(Notification.PRIORITY_MAX)
.addAction(action) // Action buttons
.setAutoCancel(true)`enter code here`
.setSound(defaultSoundUri)
.setContentIntent(pendingIntent)
请帮助我解决这个问题。
谢谢
答案 0 :(得分:0)
尝试一下,显示更多Notification with multiple buttons
notificationBuilder.addAction(R.drawable.delete, "Delete", PendingIntent.getActivity(this, CANCELNOTIFICATIONID, deleteIntent, 0));
notificationBuilder.addAction(R.drawable.archive, "Archive", PendingIntent.getActivity(this, CANCELNOTIFICATIONID, archiveIntent, 0));