If for example comes 3 push, then by clicking on any info opens with the last push. Its parameters in the intent go away.
How to make the data open from each push?
public class MessagingService extends FirebaseMessagingService { private int obj_type = 0; private long id = 0; private String title = "title"; private String text = ""; private static int count = 0; @Override public void onMessageReceived(RemoteMessage remoteMessage) { Log.e("PUSH", remoteMessage.getData().toString()); //SharedPreferences sharedPreferences = getSharedPreferences("push", MODE_PRIVATE); //SharedPreferences.Editor editor = sharedPreferences.edit(); if (remoteMessage.getData() != null) { try { obj_type = Integer.parseInt(remoteMessage.getData().get("obj_type")); //editor.putInt("obj_type", obj_type); } catch (Exception e) { } try { id = Long.parseLong(remoteMessage.getData().get("id")); //editor.putLong("id", id); } catch (Exception e) { } try { text = remoteMessage.getData().get("text"); } catch (Exception e) { } try { title = remoteMessage.getData().get("title"); } catch (Exception e) { } //editor.apply(); sendNotificationPushNewMessages(); } } private void sendNotificationPushNewMessages() { Intent intent; if (MainActivity.OPEN_APP) { intent = new Intent(this, MainActivity.class); } else { intent = new Intent(this, LoadingActivity.class); } intent.putExtra("id_push", id); intent.putExtra("obj_type_push", obj_type); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); NotificationCompat.Builder b = new NotificationCompat.Builder(this); b.setAutoCancel(true) .setDefaults(Notification.DEFAULT_ALL) .setWhen(System.currentTimeMillis()) .setSmallIcon(R.mipmap.ic_launcher) .setLargeIcon(BitmapFactory.decodeResource(this.getResources(), R.mipmap.ic_launcher)) .setContentTitle(title) .setContentText(text) .setStyle(new NotificationCompat.BigTextStyle().bigText(text)) .setAutoCancel(true) .setContentIntent(contentIntent) .setContentInfo("some_info"); NotificationManager notificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.notify(count++, b.build()); } }