Android Question Firebase Exception: Object should first be initialized (Intent).

AscySoft

Active Member
Licensed User
Hello.
I received a new error about Firebase (copy from the console)

Exception java.lang.RuntimeException: Object should first be initialized (Intent).
anywheresoftware.b4a.AbsObjectWrapper.getObject (AbsObjectWrapper.java:50)
ascysoft.ascy.firebasemessaging._service_start (firebasemessaging.java:179)
java.lang.reflect.Method.invoke (Method.java)
java.lang.reflect.Method.invoke (Method.java:372)
anywheresoftware.b4a.BA.raiseEvent2 (BA.java:169)
anywheresoftware.b4a.BA.raiseEvent (BA.java:153)
ascysoft.ascy.firebasemessaging.handleStart (firebasemessaging.java:95)
ascysoft.ascy.firebasemessaging.access$000 (firebasemessaging.java:8)
ascysoft.ascy.firebasemessaging$1.run (firebasemessaging.java:76)
android.os.Handler.handleCallback (Handler.java:739)
android.os.Handler.dispatchMessage (Handler.java:95)
android.os.Looper.loop (Looper.java:135)
android.app.ActivityThread.main (ActivityThread.java:5910)
java.lang.reflect.Method.invoke (Method.java)
java.lang.reflect.Method.invoke (Method.java:372)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1405)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1200)

My app package name is "ascysoft.ascy"
My code from FirebaseMassaging service is a standard one, ie
B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Private fm As FirebaseMessaging
End Sub

Sub Service_Create
        fm.Initialize("fm")
End Sub


Sub Service_Start (StartingIntent As Intent)
    If fm.HandleIntent(StartingIntent) Then Return
End Sub
My version of the library was the initial release (today I saw a new one and I will update)
Does anybody see this before?
 

DonManfred

Expert
Licensed User
Go again over the example project and copy the code EXACTLY!!

It must be

B4X:
Sub Service_Start (StartingIntent As Intent)
   If StartingIntent.IsInitialized And fm.HandleIntent(StartingIntent) Then Return
End Sub
 
Upvote 0

AscySoft

Active Member
Licensed User
So "Exception java.lang.RuntimeException: Object should first be initialized (Intent)" is basically saying that because of some sort of error, intent was not initialized, then my former code allowed this to pass (but not any more) and BAM! App crash.
I am a thinker: what kind of error will prevent intent not to be initialized correctly?
 
Upvote 0
Top