attach icon indicating copy to clipboard operation
attach copied to clipboard

Push Notification fails on Android when app closed

Open jperedadnr opened this issue 3 years ago • 3 comments

This only happens when sending a push notification via Firebase Console, not using Firebase API (like CloudLink does).

When the app is running, push notifications are delivered just fine. However, if the app is closed the notification doesn't show up at the device, and this exception can be found:

E AndroidRuntime: FATAL EXCEPTION: Firebase-Messaging-Intent-Handle
E AndroidRuntime: Process: XXXXXX, PID: 27220
E AndroidRuntime: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process XXXXXX. Make sure to call FirebaseApp.initializeApp(Context) first.
E AndroidRuntime: 	at com.google.firebase.FirebaseApp.getInstance(com.google.firebase:firebase-common@@19.3.0:184)
E AndroidRuntime: 	at com.google.firebase.messaging.MessagingAnalytics.logToScion(com.google.firebase:firebase-messaging@@20.3.0:99)
E AndroidRuntime: 	at com.google.firebase.messaging.MessagingAnalytics.logNotificationReceived(com.google.firebase:firebase-messaging@@20.3.0:2)

jperedadnr avatar Sep 30 '21 08:09 jperedadnr

I have a similar problem with notifications on Android version 12 devices, in the app log I have this anomaly: FirebaseApp: Default FirebaseApp failed to initialize because no default options were found. This usually means that com.google.gms:google-services was not applied to your gradle project. I hope it will be useful to solve the problem.

websystemtechnology avatar Nov 14 '22 15:11 websystemtechnology

I have the same issue and I am using Firebase admin API


`
[INFO] [SUB] W/ActivityManager( 4426): setHasOverlayUi called on unknown pid: 8943
[INFO] [SUB] D/GluonAttach(10864): [Custome Debug Message]: PushNotificationJobService : onStartJob()
[INFO] [SUB] I/GluonAttach(10864):  [Custome Debug Message]: From inside Attach: Gluon Attach PushNotification job has been triggered to start.
[INFO] [SUB] V/GluonAttach(10864): Gluon Attach PushNotification job has been triggered to start.
[INFO] [SUB] --------- beginning of crash
[INFO] [SUB] E/AndroidRuntime(10864): FATAL EXCEPTION: Firebase-Messaging-Intent-Handle
[INFO] [SUB] E/AndroidRuntime(10864): Process: xx.xxxx.xxxxx, PID: 10864
[INFO] [SUB] E/AndroidRuntime(10864): java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process  xx.xxxx.xxxxx. Make sure to call FirebaseApp.initializeApp(Context) first.
[INFO] [SUB] E/AndroidRuntime(10864): 	at com.google.firebase.FirebaseApp.getInstance(com.google.firebase:firebase-common@@19.3.0:184)
[INFO] [SUB] E/AndroidRuntime(10864): 	at com.google.firebase.messaging.MessagingAnalytics.logToScion(com.google.firebase:firebase-messaging@@20.3.0:99)
[INFO] [SUB] E/AndroidRuntime(10864): 	at com.google.firebase.messaging.MessagingAnalytics.logNotificationReceived(com.google.firebase:firebase-messaging@@20.3.0:2)
[INFO] [SUB] E/AndroidRuntime(10864): 	at com.google.firebase.messaging.FirebaseMessagingService.passMessageIntentToSdk(com.google.firebase:firebase-messaging@@20.3.0:34)
[INFO] [SUB] E/AndroidRuntime(10864): 	at com.google.firebase.messaging.FirebaseMessagingService.handleMessageIntent(com.google.firebase:firebase-messaging@@20.3.0:27)
[INFO] [SUB] E/AndroidRuntime(10864): 	at com.google.firebase.messaging.FirebaseMessagingService.handleIntent(com.google.firebase:firebase-messaging@@20.3.0:17)
[INFO] [SUB] E/AndroidRuntime(10864): 	at com.google.firebase.messaging.EnhancedIntentService.lambda$processIntent$0$EnhancedIntentService(com.google.firebase:firebase-messaging@@20.3.0:43)
[INFO] [SUB] E/AndroidRuntime(10864): 	at com.google.firebase.messaging.EnhancedIntentService$$Lambda$0.run(Unknown Source:6)
[INFO] [SUB] E/AndroidRuntime(10864): 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
[INFO] [SUB] E/AndroidRuntime(10864): 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
[INFO] [SUB] E/AndroidRuntime(10864): 	at com.google.android.gms.common.util.concurrent.zza.run(Unknown Source:6)
[INFO] [SUB] E/AndroidRuntime(10864): 	at java.lang.Thread.run(Thread.java:764)

`

SamyNassiem avatar Mar 04 '24 15:03 SamyNassiem

Update

I upgraded the Firebase libs, and it is working (until now :) )


    implementation 'com.google.gms:google-services:4.4.1'
    implementation 'com.google.firebase:firebase-messaging:23.4.1'

SamyNassiem avatar Mar 04 '24 15:03 SamyNassiem

Fixed with #400

jperedadnr avatar Oct 09 '24 10:10 jperedadnr