Sub Activity_KeyPress (key As Int) As Boolean
Dim rs As Int
If key=KeyCodes.KEYCODE_BACK Then
rs= Msgbox2("Close app " ,"Going Back","Yes","Cancel","No",Null)
If rs=DialogResponse.POSITIVE Then
StopService(Starter)
Activity.Finish
ExitApplication
Else
Return True
End If
End If
' Returning False signals the system to handle the key
Return False
End Sub
in starter module
B4X:
Sub JobDone(Job As HttpJob)
If Job.Success = False Then
Log("Error: " & Job.ErrorMessage)
'Msgbox("No net connection","Error")
ToastMessageShow("No net connection",True)
StopService(Me)
Job.Release
ExitApplication
Else
If Job.JobName = "DBRequest" Then
when back key is pressed the app is asking for the msg prompt but does not close
In starter service, if there is no net connection, i want to exit the app. however it keeps on running
Sub Activity_KeyPress (key As Int) As Boolean
Dim rs As Int
If key=KeyCodes.KEYCODE_BACK Then
rs= Msgbox2("Close app " ,"Going Back","Yes","Cancel","No",Null)
If rs=DialogResponse.POSITIVE Then
StopService(Starter)
Activity.Finish
ExitApplication
Return True ' RETURN TRUE to consume the Event---
Else
End If
End If
' Returning False signals the system to handle the key
Return False
End Sub