Android Question Splash Screen & Browser response back to our app

josejad

Expert
Licensed User
Longtime User
Hi all:

Using the Microsoft OAuth2 class in a new app with a Splash Screen, I'm having a bad behaviour. After I log in Microsoft with the browser, and the browser gets back to my app, instead of continue in the place I left, the app restart to the splash screen and go to login again.
When the browser ends the authentication the browser asks: "Open in another app: Do you want to exit from browser to see this content?", you ask "yes" and the app restart from the beginning.

Tht login sub is:

B4X:
Private Sub btnLogin_Click
    Log("BtnLogin_click")
    MSGraph.GetAccessToken
    Wait For MSGraph_AccessTokenAvailable (Success As Boolean, Token As String)
    Log("Waiting: " & Success & " Token: " & Token)
    If Success = False Then
        xui.Msgbox2Async("Error accessing account.", "Error", "Aceptar", "", "", Null)
        Return
    Else
        B4XPages.ShowPageAndRemovePreviousPages("PageDashBoard")
    End If
End Sub

Private Sub B4XPage_Foreground
    Log("B4XPage_Foreground")
    #if B4A
    MSGraph.CallFromResume(B4XPages.GetNativeParent(Me).GetStartingIntent)
    #End If
End Sub

But the line #5 : "Log("Waiting: " & Success & " Token: " & Token)" is no fired (it's in a test app without splash screen)

Logger connected to: samsung SM-A137F
** Activity (main) Resume **
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = true **
** Activity (activity2) Create (first time) **
*** mainpage: B4XPage_Appear
** Activity (activity2) Resume **
B4XPage_Foreground
BtnLogin_Click
** Activity (activity2) Pause event (activity is not paused). **
*** mainpage: B4XPage_Disappear [mainpage]
** Activity (main) Create **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = true **
** Activity (activity2) Resume **
*** mainpage: B4XPage_Foreground [mainpage]
*** mainpage: B4XPage_Appear [mainpage]
B4XPage_Foreground

I would like to upload the source code, but it's not possible because of the credentials needed. I'm going to try to test with the Erel's Oauth2 Class, but any project I upload should be modified with your own credentials to work. Or do you know any other way I could make a test to upload?

See attached a small video

Thanks in advance
 

Attachments

  • app.zip
    236.2 KB · Views: 8
Last edited:

josejad

Expert
Licensed User
Longtime User
Thanks Erel:

I've changed in the manifest:

AddActivityText(Main,....

for

AddActivityText(Activity2, ....
 
Upvote 0
Top