My app starts as a service using Start on Boot.
The user may open an interface by clicking on the app icon.
When he/she has finished, I want the interface to close but leave the service running. Currently, the service is destroyed when the interface is closed using the back key.
How do I close the interface but leave the service running?
Useless code. Activity_Pause is callback function. Does nothing. Return False in Activity_KeyPress means default reaction. There is no need to describe.
If you press "Back" button, your app will go to background anyway.
moveTaskToBack is useful, when the app sends itself to background (for example, in Button_Click subroutine).
Useless code. Activity_Pause is callback function. Does nothing. Return False in Activity_KeyPress means default reaction. There is no need to describe.
If you press "Back" button, your app will go to background anyway.
Without code in Activity_Keypress the service shuts down. Seems I just need
B4X:
' Close the activity. Services will still run when required.
Sub Activity_KeyPress (KeyCode As Int) As Boolean
If KeyCode= KeyCodes.KEYCODE_BACK Then
Return False
End If
Return True
End Sub