Итак, в основном я пытался реализовать Push-уведомления с помощью модуля облачных сообщений Firebase. Изначально я не мог получать уведомления, но после повторного исследования различий в коде для версий Oroo androi Уведомления работают нормально, когда приложение находится на переднем плане, но выдает следующую ошибку, когда приложение закрыто или находится в фоновом режиме:

Поэтому, когда я тщательно следил за журналом cat, вот что он показывает:
Ошибка при разборе метки времени в Java-событии GCM. lang.NumberFormatException: недопустимое значение int: "null" в java.lang.Integer.invalidInt (Integer.java:138) ...
Мой код класса FirebaseMessageService выглядит следующим образом:
public class FirebaseMessagingService extends com.google.firebase.messaging.FirebaseMessagingService {
private String CHANNEL_ID = "personal_notifications";
NotificationChannel mChannel = new NotificationChannel(CHANNEL_ID,"personal_notifications",NotificationManager.IMPORTANCE_DEFAULT);
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
super.onMessageReceived(remoteMessage);
String notification_title = remoteMessage.getNotification().getTitle();
String notification_message = remoteMessage.getNotification().getBody();
String click_action = remoteMessage.getNotification().getClickAction();
String from_user_id = remoteMessage.getData().get("from_user_id");
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this, CHANNEL_ID)
.setSmallIcon(R.drawable.chitchat_icon)
.setContentTitle(notification_title)
.setAutoCancel(true)
.setContentText(notification_message);
Intent resultIntent = new Intent(click_action);
resultIntent.putExtra("user_id", from_user_id);
PendingIntent resultPendingIntent =
PendingIntent.getActivity(
this,
0,
resultIntent,
PendingIntent.FLAG_UPDATE_CURRENT
);
mBuilder.setContentIntent(resultPendingIntent);
int mNotificationId = (int) System.currentTimeMillis();
NotificationManager mNotificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
mNotificationManager.createNotificationChannel(mChannel);
}
mNotificationManager.notify(mNotificationId,mBuilder.build());
}
}
Я не знаю, почему мой канал имеет нулевое значение, только когда я пытаюсь отправить уведомление в фоновом режиме.
Редактировать: Когда я строю проект на push-уведомлениях Linuxпоявляются на переднем плане и дают вышеуказанную ошибку в фоновом режиме, но при сборке из окон я не получаю никаких уведомлений ни в фоновом, ни на переднем плане.