Looking around I found many Q&A about how to (try) override the home button click and how to kiosk the user into an app. Many were confusing, many not working and many really long and complex to implement.
That said, what I would like to achieve is to keep current activity on "home button click
".
Setting the app as default launcher
, I succesfully close the user into my app, but the problem is that the user can go to the main activity clicking the home button
, canceling any in-progress workflow.
Example, I have Activity 1
, Activity 2
and Activity 3
.
From Activity 1
user can go to Activity 2
and from Activity 2
he can go to Activity 3
.
Going back from 3 to 2 and from 2 to 1, causes some workflows to run and things to appens.
What I want is that if the user clicks the home button
from Activity 1
, he stays on Activity 1
, if he clicks it from Activity 2
he stays on Activity 2
and if he clicks it on Activity 3
, he stays on Activity 3
.
Is there a way to accomplish this goal? I've been struggling on it really a while.
PS: clicking "home
" from Activity 3
must not destroy Activity 1
and 2 since I need to wait for the ActivityResult
of 3 and 2.