Android Question FirebaseMessaging Initialize

yaniv hanya

Active Member
Licensed User
While working with the example from here
https://www.b4x.com/android/forum/t...-messages-firebase-cloud-messaging-fcm.67716/
the app crashes in line
13" fm.Initialize("fm")
And I get the next log
Error occurred on line: 13 (FirebaseMessaging)
java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process b4a.example. Make sure to call FirebaseApp.initializeApp(Context) first.
at com.google.firebase.FirebaseApp.getInstance(com.google.firebase:firebase-common@@16.0.4:240)
at com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source)
at com.google.firebase.messaging.FirebaseMessaging.getInstance(Unknown Source)
at anywheresoftware.b4a.objects.FirebaseNotificationsService$FirebaseMessageWrapper.Initialize(FirebaseNotificationsService.java:97)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:777)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:354)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:176)
at b4a.example.firebasemessaging.onCreate(firebasemessaging.java:56)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3253)
at android.app.ActivityThread.-wrap5(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1617)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:203)
at android.app.ActivityThread.main(ActivityThread.java:6251)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)
the same app worked before
what went wrong?
 

DonManfred

Expert
Licensed User
Longtime User
java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process b4a.example.

You have a google-services.json file for the package b4x.example? REALLY???

the same app worked before

When did it worked? yesterday? Last year?

firebase-common@@16.0.4:240
Does NOT look like an up-to-date artifactversion!
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Does NOT look like an up-to-date artifactversion!
V16.0.4 was released 2018. You SDK is so outdated, it already stinks/starts smelling ;-)

1. Update your complete SDK. Download all recommended packages.
2. Update your firebaseintegration. Go again over the tutorial and CAREFULLY implement.
 
Upvote 0

yaniv hanya

Active Member
Licensed User
First I started with B4X only in June 2019 and then I installed the SDK
But I'll look for another update.
Second thing I currently have another such app (the other end of the problematic app) which is also working fine at the moment. But no matter what you tried to do, I couldn't figure out what was going wrong suddenly that this app stopped working
 
Upvote 0

yaniv hanya

Active Member
Licensed User
B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="26"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
CreateResourceFromFile(Macro, Themes.DarkTheme)
'End of default text.
 
Upvote 0
Top