Hi Anke,
Thanks a lot for your solution.
I just want to let the user leave my application when they press the back button, not Home button, that the reason of my posts. I am an amateur hobbyist engineer with an idea about app and and my focus is always to develop thing which will benefit the users. there is no any relation with virus or hacker or any other bad action which could go wrong direction or cause issues for the users.
If allow, I would prefer not share yet my app idea, until it is finalized and published if you kind allow me. Is that ok?
In my app I want user only leave if he press the back button and will exit only if he answers a questions, e.g. he will leave the app if a certain condition is met, e.g. a sensor is read and a given condition is match. That's it. so, if user press the Home button he will leav my app without answering the questions which will cause issue for my app. I just want to avoid it.
You solution is great, however, still user can by pass my app because it takes few seconds for my APP comes back in foreground. I found very poor solution for it using notifier where a Notifier message from the size of the screen will be shown and will deny access to the other app icons because Notifier message is in foreground blocking user to click in Whatsapp app or Facebook for instance, then my app screen will come back after few seconds. I am sure you will have more elegant solution. Can you please tell me if there is better elegant solution for that?
Thanks in advance.
Neylton