簡體   English   中英

NotificationCompat.Action 僅顯示一個操作按鈕 FCM 推送通知

[英]NotificationCompat.Action shows only one action button FCM Push Notification

我正在實施 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)

請幫我解決這個問題。

謝謝

試試這個, 用多個按鈕顯示更多通知

notificationBuilder.addAction(R.drawable.delete, "Delete", PendingIntent.getActivity(this, CANCELNOTIFICATIONID, deleteIntent, 0));
notificationBuilder.addAction(R.drawable.archive, "Archive", PendingIntent.getActivity(this, CANCELNOTIFICATIONID, archiveIntent, 0));

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM