0

I am implementing Firebase push notification. It has 2 action buttons Accept and Decline, And it is an array coming from data payload.

When push triggers, It is displaying only Decline button. Not showing both the buttons.

Below is my code

  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)

Please help me with this issue.

Thanks

4

1 回答 1

0

试试这个,用多个按钮显示更多通知

notificationBuilder.addAction(R.drawable.delete, "Delete", PendingIntent.getActivity(this, CANCELNOTIFICATIONID, deleteIntent, 0));
notificationBuilder.addAction(R.drawable.archive, "Archive", PendingIntent.getActivity(this, CANCELNOTIFICATIONID, archiveIntent, 0));
于 2020-03-19T10:34:31.340 回答