My users require an alert in order to avoid leaving accidentally my app when clicking on Home button (otherwise, they loose their -long- work and have to restart it... Indeed, my AR app cannot recover its state at restart).
So, I want to display an alert asking if they really want to leave if they click on the home button.
I saw some posts explaining how to override the Home button in order to catch the click event.
Namely this one: Detect home button press in android (use of 'HomeWatcher' or of 'onUserLeaveHint()')
Ok great, I catch the click event but as far as I can see, the app is left anyway and the user is sent to the home screen (springboard).
Is there any way to to what I want:
- catch the click event on Home button
- display an alert
- go home only if the users confirms that he wants to leave