Android Question Firebase Auth if Success

paddy12309

Member
Licensed User
Hi Everyone,

Newbie question here, I've set up an app, when booting i open main activity, then if firsttime i use Auth.Signinwithgoogle.. However when the popup comes up if i just click off it it goes away and you can still use the app...

B4X:
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("main")
   
    If FirstTime Then
        Auth.Initialize("auth")
        Auth.SignInWithGoogle
        If Auth.CurrentUser.IsInitialized Then Auth_SignedIn(Auth.CurrentUser)
           ' continue to the app start
        end if
End Sub


The aim is to have the app so you have to log in before you can use it. currently if i click of the popup the app dies, is there a way to get it to just return to the login?
 

DonManfred

Expert
Licensed User
Longtime User
Check the sub
Auth_SignedIn

If it is raised when you log in.
Remember a value or whatever to know it in future
 
Upvote 0

paddy12309

Member
Licensed User
so i put this in the activity start
B4X:
If FirstTime Then
        Auth.Initialize("auth")
        Auth.SignInWithGoogle
        If Auth.CurrentUser.IsInitialized Then
            Auth_SignedIn(Auth.CurrentUser)
        '    Loggedin = 1
        If Loggedin = 1 Then
        'and so on
then i put this for Auth_singedIn

B4X:
Sub Auth_SignedIn (User As FirebaseUser)
Log("Signedin: " & User.DisplayName)
Log(Loggedin)
Loggedin = 1
Log(Loggedin)

End Sub

So in theory if someone is signed in the app proceeds and if not it doesnt
 
Upvote 0
Top