解析GCM事件中的时间戳时出错 - Null Android(未调用onMessageReceived)

问题描述 投票:3回答:1

获取firebase通知时会出现奇怪的问题。因此,每当我的应用程序在后台和任何firebase通知出现时,我的onMessageReceived方法都没有被调用。 Logcat显示以下错误: -

FirebaseMessaging: Error while parsing timestamp in GCM event
   java.lang.NumberFormatException: s == null
       at java.lang.Integer.parseInt(Integer.java:570)
       at java.lang.Integer.parseInt(Integer.java:643)
       at com.google.firebase.messaging.zzb.zzc(Unknown Source:81)
       at com.google.firebase.messaging.zzb.zze(Unknown Source:2)
       at com.google.firebase.messaging.FirebaseMessagingService.zzd(Unknown Source:280)
       at com.google.firebase.iid.zzg.run(Unknown Source:26)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
       at com.google.android.gms.common.util.concurrent.zza.run(Unknown Source:7)
       at java.lang.Thread.run(Thread.java:764)

要么

FirebaseMessaging: Error while parsing timestamp in GCM event
    java.lang.NumberFormatException: Invalid int: "null"
        at java.lang.Integer.invalidInt(Integer.java:138)
        at java.lang.Integer.parseInt(Integer.java:358)
        at java.lang.Integer.parseInt(Integer.java:334)
        at com.google.firebase.messaging.zzb.zzc(Unknown Source)
        at com.google.firebase.messaging.zzb.zze(Unknown Source)
        at com.google.firebase.messaging.FirebaseMessagingService.zzd(Unknown Source)
        at com.google.firebase.iid.zzc.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
        at com.google.android.gms.common.util.concurrent.zza.run(Unknown Source)

所以现在我按照这个问题Android/Firebase - Error while parsing timestamp in GCM event - Null timestamp并改变我的服务器端。

现在服务器将timestamp发送到如下数据对象: -

{
  "data": {
    "deeplink": "xyz",
    "timestamp": "2018-08-01 20:49:07"
  },
  "notification": {
    "title": "Some random title",
    "body": "this is a random body"
  }
}

仍然我的onMessageReceived方法没有调用。我尝试了很多链接,但无法解决我的问题。一世

https://github.com/flutter/flutter/issues/19004

https://groups.google.com/forum/?hl=es-NI#!topic/firebase-talk/iiDlHDhDpQ8

https://github.com/EddyVerbruggen/nativescript-plugin-firebase/issues/784

android firebase push-notification firebase-cloud-messaging
1个回答
0
投票

确保你使用的是最新的firebase依赖插件,因为Android'O'atlease将包含com.google.firebase:firebase-messaging:11.2.0版本..之后按照基本步骤为this_link并设置频道ID如图所示here

© www.soinside.com 2019 - 2024. All rights reserved.