Hi guys I'm updating my app in playstore, I want to enter the FirebaseAuth service to access a database in the Firbase console. I performed all the steps necessary to associate my app to firebaseDatabase, I created a database for testing set the rules with Google access, I included in my app the FireBaseAuth libraries, for authentication, JdbcSQL to read and write in the FireBase database, and JavaObject. but I'm stuck at authentication. I have taken as an example projects present here in the community https://www.b4x.com/android/forum/threads/firebaseauth-authenticate-your-users.67875/#content
I generated the .Json file from the Firebase console and integrated it into this test project by renaming the Package with the name of the package of my app but I always get the same error :
java.lang.NullPointerException: Attempt to invoke virtual method 'void com.google.firebase.auth.FirebaseAuth.addAuthStateListener(com.google.firebase.auth.FirebaseAuth$AuthStateListener)' on a null object reference
what is it due? I read that maybe it's a bug how can I fix it?
I generated the .Json file from the Firebase console and integrated it into this test project by renaming the Package with the name of the package of my app but I always get the same error :
java.lang.NullPointerException: Attempt to invoke virtual method 'void com.google.firebase.auth.FirebaseAuth.addAuthStateListener(com.google.firebase.auth.FirebaseAuth$AuthStateListener)' on a null object reference
what is it due? I read that maybe it's a bug how can I fix it?
B4X:
Sub Process_Globals
Private auth As FirebaseAuth
End Sub
Sub Globals
Private lblName As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
auth.Initialize("auth")
End If
Activity.LoadLayout("1")
If auth.CurrentUser.IsInitialized Then Auth_SignedIn(auth.CurrentUser)
End Sub
Sub btnSignIn_Click
auth.SignInWithGoogle
End Sub
Sub btnSignOut_Click
auth.SignOutFromGoogle
lblName.Text = "Goodbye!"
End Sub
Sub Auth_SignedIn (User As FirebaseUser)
Log("SignedIn: " & User.DisplayName)
lblName.Text = "Hello: " & User.DisplayName
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Last edited: