This post should be turned into a KB article.
Environment:
Volt Iris 9.2.56
Windows 10
Galaxy Z Flip 4
Android 13 (error also occurs for Android 12)
I found that when trying to send a push notification via the Engagement Services console to my phone, the device would receive the push but would not display it in the notification area and the push would cause the targeted Android app to crash with the following error call stack:
12-23 15:48:02.786 14647 14780 W FirebaseMessaging: Error while parsing timestamp in GCM event
12-23 15:48:02.786 14647 14780 W FirebaseMessaging: java.lang.NumberFormatException: s == null
12-23 15:48:02.786 14647 14780 W FirebaseMessaging: at java.lang.Integer.parseInt(Integer.java:709)
12-23 15:48:02.786 14647 14780 W FirebaseMessaging: at java.lang.Integer.valueOf(Integer.java:1078)
12-23 15:48:02.786 14647 14780 W FirebaseMessaging: at com.google.firebase.messaging.zzd.zzb(Unknown Source:64)
12-23 15:48:02.786 14647 14780 W FirebaseMessaging: at com.google.firebase.messaging.zzd.zze(Unknown Source:26)
12-23 15:48:02.786 14647 14780 W FirebaseMessaging: at com.google.firebase.messaging.FirebaseMessagingService.handleIntent(Unknown Source:318)
12-23 15:48:02.786 14647 14780 W FirebaseMessaging: at com.google.firebase.iid.zzg.run(Unknown Source:24)
12-23 15:48:02.786 14647 14780 W FirebaseMessaging: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
12-23 15:48:02.786 14647 14780 W FirebaseMessaging: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
12-23 15:48:02.786 14647 14780 W FirebaseMessaging: at java.lang.Thread.run(Thread.java:1012)
--------- beginning of crash
12-23 15:48:02.790 14647 14780 E AndroidRuntime: FATAL EXCEPTION: pool-4-thread-1
12-23 15:48:02.790 14647 14780 E AndroidRuntime: Process: com.hcltechsw.demo.ucx.assetmgmt, PID: 14647
12-23 15:48:02.790 14647 14780 E AndroidRuntime: java.lang.IllegalArgumentException: com.hcltechsw.demo.ucx.assetmgmt: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
12-23 15:48:02.790 14647 14780 E AndroidRuntime: Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
12-23 15:48:02.790 14647 14780 E AndroidRuntime: at android.app.PendingIntent.checkFlags(PendingIntent.java:408)
12-23 15:48:02.790 14647 14780 E AndroidRuntime: at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:688)
12-23 15:48:02.790 14647 14780 E AndroidRuntime: at android.app.PendingIntent.getBroadcast(PendingIntent.java:675)
12-23 15:48:02.790 14647 14780 E AndroidRuntime: at com.google.android.gms.internal.zzcki.zzyu(Unknown Source:25)
12-23 15:48:02.790 14647 14780 E AndroidRuntime: at com.google.android.gms.internal.zzcki.zzaxo(Unknown Source:2)
12-23 15:48:02.790 14647 14780 E AndroidRuntime: at com.google.android.gms.internal.zzcii.initialize(Unknown Source:4)
12-23 15:48:02.790 14647 14780 E AndroidRuntime: at com.google.android.gms.internal.zzchj.<init>(Unknown Source:178)
12-23 15:48:02.790 14647 14780 E AndroidRuntime: at com.google.android.gms.internal.zzchj.zzdu(Unknown Source:28)
12-23 15:48:02.790 14647 14780 E AndroidRuntime: at com.google.android.gms.measurement.AppMeasurement.getInstance(Unknown Source:0)
12-23 15:48:02.790 14647 14780 E AndroidRuntime: at com.google.firebase.messaging.zzd.zzcz(Unknown Source:0)
12-23 15:48:02.790 14647 14780 E AndroidRuntime: at com.google.firebase.messaging.zzd.zzb(Unknown Source:174)
12-23 15:48:02.790 14647 14780 E AndroidRuntime: at com.google.firebase.messaging.zzd.zze(Unknown Source:26)
12-23 15:48:02.790 14647 14780 E AndroidRuntime: at com.google.firebase.messaging.FirebaseMessagingService.handleIntent(Unknown Source:318)
12-23 15:48:02.790 14647 14780 E AndroidRuntime: at com.google.firebase.iid.zzg.run(Unknown Source:24)
12-23 15:48:02.790 14647 14780 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
12-23 15:48:02.790 14647 14780 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
12-23 15:48:02.790 14647 14780 E AndroidRuntime: at java.lang.Thread.run(Thread.java:1012)
Doing some investigating, I found a StackOverflow article with a similar error:
https://stackoverflow.com/questions/50795697/android-firebase-error-while-parsing-timestamp-in-gcm-event-null-timestamp
In the comments of the StackOverflow thread one person mentions they fixed it by updating the version of the com.google.firebase:firebase-messaging dependency in the build.gradle file.
I found that our default settings in the generated build.gradle file reference old versions that need to be updated. These default values are stored in the buildparams.properties file in the Android plugin. This file is embedded in the plugin and cannot be directly edited. The default values in the file are:
dependencies_google_fcm_messaging =implementation 'com.google.firebase:firebase-messaging:11.6.0'
classpath_google_services =classpath 'com.google.gms:google-services:3.1.0'
These values should be updated by specifying the correct values in the androidbuild.properties file in the project root folder. If this file does not exist, it needs to be created and have the following information added to it:
classpath_google_services=classpath 'com.google.gms:google-services:4.3.14'
dependencies_google_fcm_messaging=implementation 'com.google.firebase:firebase-messaging:23.1.1'
Once these are saved to the file, perform a clean rebuild of the application. The push will now be displayed in the notification area if the app is not in the foreground. If the app is in the foreground the push will be processed according to the online callback function in the app code.


