microsoft / appcenter-sdk-dotnet

Development repository for the App Center SDK for .NET platforms, including Xamarin
Other
311 stars 141 forks source link

Error while parsing timestamp in GCM event #1146

Closed albertodenatale closed 5 years ago

albertodenatale commented 5 years ago

Description

Hello When I add push notification it seems the Firebase Cloud Messaging libraries used locally on the emulator by the SDK cannot parse the notification and throws a null reference exception.

Repro Steps

Please list the steps used to reproduce your issue.

  1. Run the emulator
  2. Send a notification from the portal
  3. See the message in the logs

Details

  1. What is your app platform (Xamarin.Android or Xamarin.iOS or UWP)? Xamarin.Android

  2. If using Xamarin.Forms or if using portable/shared code to call our SDK APIs, are you using shared project, PCL code or .NET standard code for the application? Which .NET standard version or which PCL profile? .NET standard 2.0.

  3. Which SDK version are you using? 2.1.1

  4. Which OS version did you experience the issue on? Android 9

  5. What device version did you see this error on? Were you using an emulator or a physical device? Pixel 2 Emulator

  6. What third-party libraries are you using?

Microsoft.AppCenter.Analytics - 2.1.1 Microsoft.AppCenter.Crashes - 2.1.1 Microsoft.AppCenter.Push - 2.1.1 Xamarin.Android.Support.Design - 2.8.0.0.1 Xamarin.Android.Support.Core.Utils - 28.0.0.1 Xamarin.Android.Support.CustomTabs - 28.0.0.1 Xamarin.Android.Support.v4 - 28.0.0.1 Xamarin.Android.Support.v7.AppCompat - 28.0.0.1 Xamarin.Android.Support.v7.MediaRouter - 28.0.0.1 Xamarin.Essentials - 1.2.0

  1. Please enable verbose logging for your app using AppCenter.LogLevel = LogLevel.Verbose before your call to AppCenter.Start(...) and include the logs here:

10-06 22:50:43.774 D/AppCenterPush( 7240): Received push intent=Intent { act=com.google.android.c2dm.intent.RECEIVE flg=0x11000010 pkg=it.albertodenatale.pushnotifications cmp=it.albertodenatale.pushnotifications/md50d7658ca0fc01b95086956189e698682.PushReceiver (has extras) } background=false 10-06 22:50:43.774 D/AppCenterPush( 7240): google.delivered_priority=high 10-06 22:50:43.774 D/AppCenterPush( 7240): google.sent_time=1570395044141 10-06 22:50:43.774 D/AppCenterPush( 7240): google.ttl=2419200 10-06 22:50:43.774 D/AppCenterPush( 7240): google.original_priority=high 10-06 22:50:43.774 D/AppCenterPush( 7240): gcm.notification.e=1 10-06 22:50:43.774 D/AppCenterPush( 7240): gcm.notification.title=141414 10-06 22:50:43.774 D/AppCenterPush( 7240): from=226661047026 10-06 22:50:43.774 D/AppCenterPush( 7240): google.message_id=0:1570395044148064%06ca70f606ca70f6 10-06 22:50:43.774 D/AppCenterPush( 7240): gcm.notification.body=141414 10-06 22:50:43.774 D/AppCenterPush( 7240): google.c.a.e=1 10-06 22:50:43.774 D/AppCenterPush( 7240): collapse_key=it.albertodenatale.pushnotifications 10-06 22:50:43.774 D/AppCenterPush( 7240): Push standard data: {collapse_key=it.albertodenatale.pushnotifications, google.original_priority=high, google.sent_time=1570395044141, google.delivered_priority=high, gcm.notification.e=1, gcm.notification.title=141414, google.c.a.e=1, google.ttl=2419200, from=226661047026, google.message_id=0:1570395044148064%06ca70f606ca70f6, gcm.notification.body=141414} 10-06 22:50:43.774 D/AppCenterPush( 7240): Push custom data: {} 10-06 22:50:43.796 W/FirebaseMessaging( 7240): Error while parsing timestamp in GCM event 10-06 22:50:43.796 W/FirebaseMessaging( 7240): java.lang.NumberFormatException: s == null 10-06 22:50:43.796 W/FirebaseMessaging( 7240): at java.lang.Integer.parseInt(Integer.java:577) 10-06 22:50:43.796 W/FirebaseMessaging( 7240): at java.lang.Integer.valueOf(Integer.java:801) 10-06 22:50:43.796 W/FirebaseMessaging( 7240): at com.google.firebase.messaging.zzd.zzb(Unknown Source:60) 10-06 22:50:43.796 W/FirebaseMessaging( 7240): at com.google.firebase.messaging.zzd.zzg(Unknown Source:26) 10-06 22:50:43.796 W/FirebaseMessaging( 7240): at com.google.firebase.messaging.FirebaseMessagingService.handleIntent(Unknown Source:160) 10-06 22:50:43.796 W/FirebaseMessaging( 7240): at com.google.firebase.iid.zzg.run(Unknown Source:26) 10-06 22:50:43.796 W/FirebaseMessaging( 7240): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 10-06 22:50:43.796 W/FirebaseMessaging( 7240): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 10-06 22:50:43.796 W/FirebaseMessaging( 7240): at java.lang.Thread.run(Thread.java:764) 10-06 22:50:43.796 W/FirebaseMessaging( 7240): Unable to log event: analytics library is missing 10-06 22:50:43.798 W/FirebaseMessaging( 7240): Error while parsing timestamp in GCM event 10-06 22:50:43.798 W/FirebaseMessaging( 7240): java.lang.NumberFormatException: s == null 10-06 22:50:43.798 W/FirebaseMessaging( 7240): at java.lang.Integer.parseInt(Integer.java:577) 10-06 22:50:43.798 W/FirebaseMessaging( 7240): at java.lang.Integer.valueOf(Integer.java:801) 10-06 22:50:43.798 W/FirebaseMessaging( 7240): at com.google.firebase.messaging.zzd.zzb(Unknown Source:60) 10-06 22:50:43.798 W/FirebaseMessaging( 7240): at com.google.firebase.messaging.zzd.zzj(Unknown Source:2) 10-06 22:50:43.798 W/FirebaseMessaging( 7240): at com.google.firebase.messaging.FirebaseMessagingService.handleIntent(Unknown Source:201) 10-06 22:50:43.798 W/FirebaseMessaging( 7240): at com.google.firebase.iid.zzg.run(Unknown Source:26) 10-06 22:50:43.798 W/FirebaseMessaging( 7240): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 10-06 22:50:43.798 W/FirebaseMessaging( 7240): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 10-06 22:50:43.798 W/FirebaseMessaging( 7240): at java.lang.Thread.run(Thread.java:764)

Thank you for your help

Jamminroot commented 5 years ago

Hey, @albertodenatale, thanks for getting in touch. There might be several different reasons for this message to be shown. Is it possible to check whether updating to App Center SDK 2.4.0 fixes the problem? Also, are notifications shown - despite the exception in logs? Or does the app crash? And just to be sure - by portal you mean appcenter.ms portal, not firebase console?

albertodenatale commented 5 years ago

Hi @Jamminroot thank your response and your great work.

I moved to 2.4.0-preview and it fixed the issue:

image

10-09 07:14:17.432 D/AppCenterPush( 5166): Received push intent=Intent { act=com.google.android.c2dm.intent.RECEIVE flg=0x11000010 pkg=it.albertodenatale.pushnotifications cmp=it.albertodenatale.pushnotifications/md50d7658ca0fc01b95086956189e698682.PushReceiver (has extras) } background=false 10-09 07:14:17.432 D/AppCenterPush( 5166): google.delivered_priority=high 10-09 07:14:17.432 D/AppCenterPush( 5166): google.sent_time=1570598057253 10-09 07:14:17.432 D/AppCenterPush( 5166): google.ttl=2419200 10-09 07:14:17.432 D/AppCenterPush( 5166): google.original_priority=high 10-09 07:14:17.432 D/AppCenterPush( 5166): gcm.notification.e=1 10-09 07:14:17.432 D/AppCenterPush( 5166): gcm.notification.title=161616 10-09 07:14:17.432 D/AppCenterPush( 5166): from=226661047026 10-09 07:14:17.432 D/AppCenterPush( 5166): google.message_id=0:1570598057259199%06ca70f606ca70f6 10-09 07:14:17.432 D/AppCenterPush( 5166): gcm.notification.body=616161 10-09 07:14:17.432 D/AppCenterPush( 5166): google.c.a.e=1 10-09 07:14:17.432 D/AppCenterPush( 5166): collapse_key=it.albertodenatale.pushnotifications 10-09 07:14:17.433 D/AppCenterPush( 5166): Push standard data: {collapse_key=it.albertodenatale.pushnotifications, google.original_priority=high, google.sent_time=1570598057253, google.delivered_priority=high, gcm.notification.e=1, gcm.notification.title=161616, google.c.a.e=1, google.ttl=2419200, from=226661047026, google.message_id=0:1570598057259199%06ca70f606ca70f6, gcm.notification.body=616161} 10-09 07:14:17.433 D/AppCenterPush( 5166): Push custom data: {}

Thank you,

Alberto