in a 2nd page, i try manage the exit whit this logic:
Public Sub B4XPage_CloseRequest As ResumableSub
Dim sf As Object = xui.Msgbox2Async("Sicuro di voler chiudere l'applicazione?", "Attenzione", "Si", "", "No", Null)
Wait For (sf) Msgbox_Result (Result As Int)
If Result = xui.DialogResponse_Positive Then
Return True
End If
Return False
End Sub
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
vLogin.Initialize
B4XPages.AddPage("viewLogin", vLogin)
Sleep(2000)
B4XPages.ShowPageAndRemovePreviousPages("viewLogin")
End Sub
Note that your app crashes on my device as it needs the WRITE_SETTING permission. I'm not sure what you are trying to do with the screen time, but it is probably better not to.
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
vLogin.Initialize
B4XPages.AddPage("viewLogin", vLogin)
Sleep(2000)
B4XPages.ShowPageAndRemovePreviousPages("viewLogin")
End Sub
Note that your app crashes on my device as it needs the WRITE_SETTING permission. I'm not sure what you are trying to do with the screen time, but it is probably better not to.