设备无法通过FCM接收多个通知



我已经通过了firebase文档的每个步骤,但是问题是

发送多个通知和最终用户的Android设备在Internet上关闭了Internet连接时,该设备仅收到一个通知,仅收到最新通知。

这使此功能很少或没有用。有人也经历过吗?如何处理?

public static int NOTIFICATION_ID = 1;
private PendingIntent pendingIntent
 pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_ONE_SHOT);
 NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
                    .setSmallIcon(R.mipmap.xchat_icon_push)
                    .setContentTitle(title)
                    .setContentText(messageBody)
                    .setDefaults(Notification.DEFAULT_ALL)
                    .setAutoCancel(true)
                    .setStyle(new NotificationCompat.BigTextStyle().bigText(messageBody))
                    .setPriority(NotificationCompat.PRIORITY_HIGH)
                    .setSound(defaultSoundUri)
                    .setContentIntent(pendingIntent);
 NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
  if (NOTIFICATION_ID > 1073741824) {
    NOTIFICATION_ID = 0;
  }
  notifManager.notify(NOTIFICATION_ID++, notificationBuilder.build());

相关内容

  • 没有找到相关文章

最新更新