Really appreciate your help with this, its working perfectly.
Just another quick related question, is it possible to trigger this in the background so that when the application is exited by the user the Home Screen is displayed at that time.
The code as is, pauses the application and goes directly to the home screen.
Why not let your application close and return to the previous activity / home screen? This is the default behavior.
You can catch the Back key and show the home screen instead of closing the activity.
Actually I was just working on something and did not want the activity to close, but it appears that even with Keycode capture enabled the activity still pauses.
I am using the following code for capturing:
B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean
If KeyCode = KeyCodes.KEYCODE_BACK Then
Return True
End If
End Sub