Bug? FirebaseNotifications after SDK update

woniol

Active Member
Licensed User
Longtime User
Hi,
After updating Android SDK i have problems with my app using firebaseNotifications.
The same is when statrting app from the example: https://www.b4x.com/android/forum/t...-messages-firebase-cloud-messaging-fcm.67716/

The error log:
B4X:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
*** Service (firebasemessaging) Create ***
** Service (firebasemessaging) Start **
firebasemessaging_subscribetotopics (java line: 176)
java.lang.NullPointerException: Attempt to invoke virtual method 'void com.google.firebase.iid.FirebaseInstanceId.zza(java.lang.String)' on a null object reference
    at com.google.firebase.messaging.FirebaseMessaging.subscribeToTopic(Unknown Source)
    at anywheresoftware.b4a.objects.FirebaseNotificationsService$FirebaseMessageWrapper.SubscribeToTopic(FirebaseNotificationsService.java:130)
    at com.woniol.domeq2.firebasemessaging._subscribetotopics(firebasemessaging.java:176)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:186)
    at anywheresoftware.b4a.keywords.Common$11.run(Common.java:1154)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:158)
    at android.app.ActivityThread.main(ActivityThread.java:7224)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
My firebase-iid version is 15.1.0.

Please help
 

Alex Guerrero

Member
Licensed User
Longtime User
Thanks @Erel for your answer, in my case while @woniol performs a test, the solution I found was to delete the updated folders and modify the versions in "installed-components.txt", I'm waiting for someone to try the @Erel solution.
 

DonManfred

Expert
Licensed User
Longtime User
Does it work if you add Sleep(10000) before calling SubscribeToTopic ?
Not for me
 

Star-Dust

Expert
Licensed User
Longtime User
I'm currently out of the office. I will check it on Sunday.

Does it work if you add Sleep(10000) before calling SubscribeToTopic ?
Do you have to buy a netbook for rehearsals even outside the office. Nor are there many interested models that are similar to tablets because they do not have a physical keyboard.
Or maybe you develop a version of B4A that works on your smartphone, someone started. A similar project in this forum
 

woniol

Active Member
Licensed User
Longtime User
I'm currently out of the office. I will check it on Sunday.

Does it work if you add Sleep(10000) before calling SubscribeToTopic ?
Adding sleep(10000) before SubscribeToTopic
doesn't help in my case.
 

DonManfred

Expert
Licensed User
Longtime User
Does this fix token problem too?
At least the UI Lib gets an Event
FBAuth_TokenAvailable(true,xxx)
where xxx is a Token. Don´t know what token it is though

I then logged the Token in Firebasemessaging
B4X:
    Do While fm.Token = Null
        Log("FBToken is null. Sleep for a while... (250ms)")
        Sleep(250)
    Loop
    Log("FBToken = "&fm.Token)

The Token i got here is the same token as the one i got from the Firebase UI Auth Library.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…