Nativescript-plugin-firebase: FCM Problem: Error while parsing timestamp in GCM event

Created on 3 Jul 2018  ·  32Comments  ·  Source: EddyVerbruggen/nativescript-plugin-firebase

I receive notifications, but when you touch on them nothing happens. In Logcat I see this error:

07-03 19:06:53.851 25622-25622/earth.greenbase W/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.zzb(Unknown Source)
        at com.google.firebase.messaging.zzb.zzd(Unknown Source)
        at com.google.firebase.messaging.FirebaseMessagingService.zzc(Unknown Source)
        at com.google.firebase.iid.zzb.onStartCommand(Unknown Source)
        at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4064)
        at android.app.ActivityThread.access$2400(ActivityThread.java:222)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1899)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:158)
        at android.app.ActivityThread.main(ActivityThread.java:7230)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

Found something about it here, but do not understand why a notification that is sent like specified would not work: https://stackoverflow.com/questions/50795697/android-firebase-error-while-parsing-timestamp-in-gcm-event-null-timestamp

Most helpful comment

+1 and “me too” don’t help. Please use the thumb up emoji reaction for those. I would be interested in a repo that reproduces it, along with the command to trigger a notification. Thanks.

All 32 comments

Same here, in fact tried this on native android and it gives an issue, seems like this might be an fcm issue rather than your code.

same here :P anyone?

My problem was that i sent click_action with the notification, after i removed that for android it worked, but this error still appears. It does not seem to cause any problem, its just annoying :)

Any improvements/ fixes? I want to know

I have the same problem

So, anyone managed to figure it out yet?

Same error here

+1

{"data":{"action":"zzz"},"android":{"notification":{"icon":"ic_launcher","color":"#1b77d2","title":"n.title","body":"n.body","clickAction":".ac"}},"token":"zzz"}

I dont use flutter but some error

i have also same problem .. any solution?

I also got the same error any solution for this. I tried but no success.

+1 and “me too” don’t help. Please use the thumb up emoji reaction for those. I would be interested in a repo that reproduces it, along with the command to trigger a notification. Thanks.

@EddyVerbruggen I am sending below payload and getting same error message

{
"to" : "",
"notification" : {
"body" : "great match!",
"title" : "Portugal vs. Denmark",
"content_available" : true,
"priority" : "high"
},
"data" : {
"foo": "bar",
"body" : "great match!",
"title" : "Portugal vs. Denmark",
"content_available" : true,
"priority" : "high"
}
}

Same error here

@phatakrajan I tried with your payload but the error doesn't show on my testdevices so a bit hard for me to fix.

Is this just a warning, or does it break anything?

@EddyVerbruggen I think it does not break anything but you see this exception in logs. I am still struggling to redirect a user when a notification is received while app is suspended and then when i click on notification, i try to read data in resumeEvent event. However i am struggling to do that part unfortunately. So not sure if this previous exception is the cause or its just that i am unable to write correct logic.

I solved downgrading the google-services, firebase-core and firebase-messaging versions

@EddyVerbruggen Its failing when i try to open the notification and hence i am unable to get the data sent.
@alacret What version of google-services and firebase-messaging are you using now?

@EddyVerbruggen

The error that appears in the Android Logcat is this:

08-25 14:12:00.160  4319  4916 W FirebaseMessaging: Error while parsing timestamp in GCM event
08-25 14:12:00.160  4319  4916 W FirebaseMessaging: java.lang.NumberFormatException: null
08-25 14:12:00.160  4319  4916 W FirebaseMessaging:     at java.lang.Integer.parseInt(Integer.java:483)
08-25 14:12:00.160  4319  4916 W FirebaseMessaging:     at java.lang.Integer.parseInt(Integer.java:556)
08-25 14:12:00.160  4319  4916 W FirebaseMessaging:     at com.google.firebase.messaging.zzb.zzb(Unknown Source)
08-25 14:12:00.160  4319  4916 W FirebaseMessaging:     at com.google.firebase.messaging.zzb.zzc(Unknown Source)
08-25 14:12:00.160  4319  4916 W FirebaseMessaging:     at com.google.firebase.messaging.FirebaseMessagingService.zzd(Unknown Source)
08-25 14:12:00.160  4319  4916 W FirebaseMessaging:     at com.google.firebase.iid.zzc.run(Unknown Source)
08-25 14:12:00.160  4319  4916 W FirebaseMessaging:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
08-25 14:12:00.160  4319  4916 W FirebaseMessaging:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
08-25 14:12:00.160  4319  4916 W FirebaseMessaging:     at com.google.android.gms.common.util.concurrent.zza.run(Unknown Source)
08-25 14:12:00.160  4319  4916 W FirebaseMessaging:     at java.lang.Thread.run(Thread.java:761)
08-25 14:12:00.162  4319  4916 W FirebaseMessaging: Error while parsing timestamp in GCM event
08-25 14:12:00.162  4319  4916 W FirebaseMessaging: java.lang.NumberFormatException: null
08-25 14:12:00.162  4319  4916 W FirebaseMessaging:     at java.lang.Integer.parseInt(Integer.java:483)
08-25 14:12:00.162  4319  4916 W FirebaseMessaging:     at java.lang.Integer.parseInt(Integer.java:556)
08-25 14:12:00.162  4319  4916 W FirebaseMessaging:     at com.google.firebase.messaging.zzb.zzb(Unknown Source)
08-25 14:12:00.162  4319  4916 W FirebaseMessaging:     at com.google.firebase.messaging.zzb.zzf(Unknown Source)
08-25 14:12:00.162  4319  4916 W FirebaseMessaging:     at com.google.firebase.messaging.FirebaseMessagingService.zzd(Unknown Source)
08-25 14:12:00.162  4319  4916 W FirebaseMessaging:     at com.google.firebase.iid.zzc.run(Unknown Source)
08-25 14:12:00.162  4319  4916 W FirebaseMessaging:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
08-25 14:12:00.162  4319  4916 W FirebaseMessaging:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
08-25 14:12:00.162  4319  4916 W FirebaseMessaging:     at com.google.android.gms.common.util.concurrent.zza.run(Unknown Source)
08-25 14:12:00.162  4319  4916 W FirebaseMessaging:     at java.lang.Thread.run(Thread.java:761)
08-25 14:12:00.162  4319  4916 D RNFMessagingService: onMessageReceived event received
08-25 14:12:00.306  4319  4319 D RNFirebaseNotifications: Received new remote notification

Before i started to try to upgrade the libraries the error was also there, but it didn't close the App (on Android), so i started going back on my .gradle files so i downgrade the versions of this libraries:

implementation "com.google.android.gms:play-services-base:15.0.0"
implementation "com.google.firebase:firebase-core:15.0.2"
implementation "com.google.firebase:firebase-messaging:15.0.2"

NOTE: The error stills shows in the console, but the App doesn't crash

Sound like an issue with Firebase/Google play services actually. Not sure how I can help.

@EddyVerbruggen well, maybe the weird thing is that the output on the console it's the same. The difference it's that the App closes

@4geeks Could be that @alacret has "discardUncaughtJsExceptions": true set in app/package.json, which prevents crashing in case of this type of JS exceptions.

But unfortunately I don't see that error at all 😞

@EddyVerbruggen no, i check that. i'll try today to provide an example, if you want i can even create the branches and give you access to the repos.

I don't think that it's urgent anyways, there are however a lot of questions and a bounty for this error, but there are recent. With downgrading the version it gets solved

Downgrading is not something I can advocate. Would be great if this can be solved by us somehow.

@EddyVerbruggen sure, i'll try to open a branch with the error, and the steps

I'm also getting the same error!

I've updated com.google.firebase:firebase-messaging to 17.3.4 and issue disappeared. I'm not using nativescript-plugin-firebase but FCM for notifications.

getting same error!

Receiving same error here folks, logs show:

10-29 15:28:12.258   881 13850 W FirebaseMessaging: java.lang.NumberFormatException: null
10-29 15:28:12.258   881 13850 W FirebaseMessaging:     at java.lang.Integer.parseInt(Integer.java:483)
10-29 15:28:12.258   881 13850 W FirebaseMessaging:     at java.lang.Integer.parseInt(Integer.java:556)
10-29 15:28:12.258   881 13850 W FirebaseMessaging:     at com.google.firebase.messaging.zzd.zzb(Unknown Source)
10-29 15:28:12.258   881 13850 W FirebaseMessaging:     at com.google.firebase.messaging.zzd.zzc(Unknown Source)
10-29 15:28:12.258   881 13850 W FirebaseMessaging:     at com.google.firebase.messaging.FirebaseMessagingService.zzh(Unknown Source)
10-29 15:28:12.258   881 13850 W FirebaseMessaging:     at com.google.firebase.iid.zzc.run(Unknown Source)
10-29 15:28:12.258   881 13850 W FirebaseMessaging:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
10-29 15:28:12.258   881 13850 W FirebaseMessaging:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
10-29 15:28:12.258   881 13850 W FirebaseMessaging:     at com.google.android.gms.common.util.concurrent.zza.run(Unknown Source)
10-29 15:28:12.258   881 13850 W FirebaseMessaging:     at java.lang.Thread.run(Thread.java:762)

This is with payload (following the HTTP v1 API format:

{
    "message": {
        "notification": {
            "title": "Fruit",
            "body": "Please order more fruit"
        },
        "data": {
            "sender": "sendersFcmTokenHere"
        },
        "android": {
            "priority": "high",
            "notification": {
                "title": "overridden title for android devices",
                "body": "overridden body for android devices",
                "sound": "default"
            },
            "ttl": "0s"
        },
        "token": "eqmvVB140lc:APA91bFB8fqMxojLpbX2DFjn6rtV-FdamOiF_BtADZW1P9nuH66jUFr_oDQVxc3rVmR-_QF4LpEsvVQ3U4eQTL4Tu7mDZGAZD7RhjrnS9plASSL3KvEtmut_MIvQYprMRU_905A4c0bD"
    }
}

Same problem here. The message works, just Firebase is logging an error for some reason

Any update on this. I'm getting Notification but the onNotification() is not getting called.

same herror here, the event onMessageReceived not called when the app is not running

Was this page helpful?
0 / 5 - 0 ratings