Json 应用程序死机期间未接收推送通知中的数据

Json 应用程序死机期间未接收推送通知中的数据,json,android-studio,push-notification,firebase-cloud-messaging,google-play-services,Json,Android Studio,Push Notification,Firebase Cloud Messaging,Google Play Services,我用firebase的云消息编写了一些代码。代码工作正常(我在前台和后台都收到了通知),但我想解决的问题是,每当应用程序死机/死机时,当我从后台通知打开活动时,通知中的内容不会被检索。我研究了很多,尝试了不同的方法,从文章和代码。但这个问题仍然存在。我该怎么解决这个问题?提前谢谢 public void onMessageReceived(@NonNull RemoteMessage remoteMessage) { super.onMessageReceived(remoteMessa

我用firebase的云消息编写了一些代码。代码工作正常(我在前台和后台都收到了通知),但我想解决的问题是,每当应用程序死机/死机时,当我从后台通知打开活动时,通知中的内容不会被检索。我研究了很多,尝试了不同的方法,从文章和代码。但这个问题仍然存在。我该怎么解决这个问题?提前谢谢

public void onMessageReceived(@NonNull RemoteMessage remoteMessage) {
    super.onMessageReceived(remoteMessage);

    notiicationTitle = Objects.requireNonNull(remoteMessage.getNotification()).getBody();
    notiicationBody = remoteMessage.getNotification().getTitle();

    showNotification(AppConstants.NOTIFICATION_CHANNEL, notiicationBody, notiicationTitle);
}


private void showNotification(String channel, String name, String description) {
    mChannel = new NotificationChannel(channel, name, AppConstants.FCS_NOTI_IMPO);
    mChannel.setDescription(description);
    mChannel.setShowBadge(true);

    notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

    assert notificationManager != null;
    notificationManager.createNotificationChannel(mChannel);

    mapActivity = new Intent(this, ActivityMaps.class);
    mapActivity.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);
    mapActivity.putExtra(AppConstants.NOTIFICATION_TITLE, notiicationTitle);
    mapActivity.putExtra(AppConstants.NOTIFICATION_BODY, notiicationBody);

    broadcaster.sendBroadcast(mapActivity);

    contentIntent = PendingIntent.getActivity(this, 0, mapActivity, PendingIntent.FLAG_CANCEL_CURRENT);
    notification = new Notification.Builder(getApplicationContext())
      .setContentTitle(name)
      .setContentText(description)
      .setSmallIcon(R.drawable.logistics)
      .setChannelId(channel)
      .setOngoing(true)
      .setContentIntent(contentIntent)
      .build();

    notificationManager.notify(AppConstants.NOTIFICATION_ID, notification);
}

这个问题解决了