Android Question SDK update + Firebase UI Auth

yiankos1

Well-Known Member
Licensed User
Longtime User
Hello my friends,
I use @DonManfred library to authenticate users. Everything was working perfect till today, when i updated recommended sdk updates. Now it throws this error:
B4X:
User exists=1
Error occurred on line: 431 (Main)
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.google.firebase.iid.FirebaseInstanceId.getToken()' on a null object reference
    at anywheresoftware.b4a.objects.FirebaseNotificationsService$FirebaseMessageWrapper.getToken(FirebaseNotificationsService.java:122)
    at com.dreamon.seeida.main._userexists_result(main.java:3755)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:710)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139)
    at anywheresoftware.b4a.BA$2.run(BA.java:360)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:145)
    at android.app.ActivityThread.main(ActivityThread.java:5942)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1388)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183)

Code that throws this error:
B4X:
    Private fm As FirebaseMessaging
    fm.Initialize("fm")

    Starter.token=fm.Token

If i put a breakpoint at this line of code "Starter.token=fm.Token" it says this: "Error: Cannot run method from watch expression." But even if i put this code to Activity_Start throws again same error. I think that by sdk update something changed and this lib corrupted.
Thank you for your time.
 

yiankos1

Well-Known Member
Licensed User
Longtime User
You had problem with it in 2016.
But you are using the old Firebaseauthex library. NOT the firebase UI AUth Library
So, Don did you managed to reproduce this kind of error?
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
So, Don did you managed to reproduce this kind of error?
Yes, but i can not do anything abouit it. I lost the source of the old firebaseauthex library with a hdd crash last year.

That´s the reason i wrote a wrapper for the Firebase UI Auth.
 
Upvote 0

yiankos1

Well-Known Member
Licensed User
Longtime User
Yes, but i can not do anything abouit it. I lost the source of the old firebaseauthex library with a hdd crash last year.

That´s the reason i wrote a wrapper for the Firebase UI Auth.
Neither do i use old firebaseauthex! I use the new one, as i described, everything was working like a charm till today that i updated all recommended SDKs
 
Upvote 0

yiankos1

Well-Known Member
Licensed User
Longtime User
i´ll check it this evening with my SDK (will update it first).... I updated the SDK last week. But will do a new Update today
Don one more question, is there any possibility to add fbauth.isInitialised method? Because anytime we use fbauth.initialise it is trying to login automatically... and if i click back button and i re-enter at my app and i try to hit signout button for example, onAuthStateChanged() event is raised plus one time for every button click i did. What i mean, here is the log file after certain clicks:
B4X:
Clicked:13 Iden:10
onAuthStateChanged()
onAuthStateChanged()
onAuthStateChanged()
onAuthStateChanged()
onAuthStateChanged()
onAuthStateChanged()
onAuthStateChanged()
onAuthStateChanged()
onAuthStateChanged()
onAuthStateChanged()
onAuthStateChanged()
onAuthStateChanged()
onAuthStateChanged()
onAuthStateChanged()
onAuthStateChanged()
** Activity (main) Pause, UserClosed = true **
Memory -----------
Hit=0
Miss=4
Evicted=0
Used=0 bytes
Disk -------------
Used=0 bytes
** Activity (main) Create, isFirst = false **
 
Last edited:
Upvote 0

yiankos1

Well-Known Member
Licensed User
Longtime User
i´ll check it this evening with my SDK (will update it first).... I updated the SDK last week. But will do a new Update today
By the way, what i wrote at post #15 about simultaneously event raises, you can reproduce it at your example but clicking back button(quit app) the renter app and click sign out button. If you do this procedure several times you will see a log file like this.
B4X:
onAuthStateChanged()
You are logged offf
** Activity (main) Pause, UserClosed = true **
** Activity (main) Create, isFirst = false **
** Activity (main) Resume **
onAuthStateChanged()
onAuthStateChanged()
onAuthStateChanged()
onAuthStateChanged()
onAuthStateChanged()
onAuthStateChanged()
You are logged offf
** Activity (main) Pause, UserClosed = true **
** Activity (main) Create, isFirst = false **
** Activity (main) Resume **
onAuthStateChanged()
onAuthStateChanged()
onAuthStateChanged()
onAuthStateChanged()
onAuthStateChanged()
onAuthStateChanged()
onAuthStateChanged()
You are logged offf
** Activity (main) Pause, UserClosed = true **
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
I checked firebasenotification with my testapp (lunch break)

After i added some Artifacts manually it does work.

I did not notized the mising ones.

I think they are 3 or 4 missing. Search for
firebase
iid
auth
in the SDK MAnager and make sure you added all available artifacts.

Maybe my SDK log helps to find the missing ones...


firebase-iid-interop-15.0.0
firebase-measurement-connector-15.0.0
firebase-auth-interop-15.0.2

@Erel: If you read this. May i add a request to add the missing Artifacts to the recommended list?
 
Last edited:
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
By the way, what i wrote at post #15 about simultaneously event raises, you can reproduce it at your example but clicking back button(quit app) the renter app anc click sign out button several times. you will see a log file like this.
You should ALWAYS create a NEW thread for any new Problem.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…