1
firebaseを使用してアプリケーションに3プッシュデータ通知を送信すると、最初にクリックしたものが開き、すべてのデータが表示されます。以下は、データメッセージを受け取るための私の与えられたコードです。見てください。Firebase複数プッシュ通知が機能しない
private void sendNotification(String message, Bitmap image, String objIdOS, String objIdVenInv, String typeVenInv, String cls, String checkTest, String colName, String title, String position) {
Intent intent = new Intent(this, UserLogin.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra("objIdOS",objIdOS);
intent.putExtra("objIdVenInv",objIdVenInv);
intent.putExtra("typeVenInv",typeVenInv);
intent.putExtra("cls",cls);
intent.putExtra("checkTest",checkTest);
intent.putExtra("colName",colName);
intent.putExtra("pos",position);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent,
PendingIntent.FLAG_ONE_SHOT);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
.setContentTitle(title)
.setContentText(message)
.setStyle(new NotificationCompat.BigTextStyle().bigText(message))
.setAutoCancel(true)
.setSound(Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.clean))
.setOnlyAlertOnce(true)
.setPriority(Notification.PRIORITY_MAX)
.setContentIntent(pendingIntent)
.setColor(Color.parseColor("#1ABC9C"))
.setSmallIcon(R.drawable.small_icon);
if (image!=null){
notificationBuilder.setStyle(new NotificationCompat.BigPictureStyle().bigPicture(image).setSummaryText(message)); /*Notification with Image*/
}
/*if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
notificationBuilder.setLargeIcon(BitmapFactory.decodeResource(getResources(),R.drawable.splash_icon3));
} else {
notificationBuilder.setLargeIcon(BitmapFactory.decodeResource(getResources(),R.drawable.splash_icon3));
}*/
NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(notificationId, notificationBuilder.build());
}
を追加し、これは役立ちますか? –
はい、保留中の同じインテントIDのため、データが上書きされます。 これで、表示する通知ごとに新しいIDを作成できます。 –
いいえ私は毎回ARCから通知IDを変更しています。通知はありますが、最初の通知を開いた後に開いたときには何もしません。 –