gpt4 book ai didi

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

转载 作者:太空狗 更新时间:2023-10-29 14:38:49 25 4
gpt4 key购买 nike

获取 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)

所以现在我遵循这个 SO 问题 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

最佳答案

确保您使用的是最新的 firebase 依赖插件,因为 Android 'O' 至少有 com.google.firebase:firebase-messaging:11.2.0 版本。之后请执行基本步骤作为this_link并如图所示设置 channel ID here

关于android - 解析 GCM 事件中的时间戳时出错 - Null Android(未调用 onMessageReceived),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51649290/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com