Using the android back button to return to home screen without closing the app

Hi Folks. I’d delighted that I’ve now managed to get my image-capture AR app working, but I want to be able to have the user click the android phone’s back button and simply return to the phone’s home screen while leaving the app open. Most apps seem to do this (e.g. music and photos), but I can’t find any scripts that meets my needs. I don’t have and don’t want any menus in the app. It simply opens, searches for my target images, then responds with the reveal image. On ImageLost, it just goes back into scanning mode. All of this works well.

Here’s the closest script I’ve found, but I know full well it’s not complete, and as mentioned above, I don’t want it to return to ‘Main Menu’ as it says in the script, but the home screen.

I’m new to Unity and C#, so still very much in the ‘I have no idea what I’m doing’ phase of our relationship!

Using Unity with EasyAR. I’ve created an empty GameObject and named it BackButton, then created a script and dropped that onto the BackButton GameObject.

5089412--501395--upload_2019-10-21_11-41-58.png

All help gratefully received.

Best wishes
Tony

Hello !
I’m a more seasoned user of Unity, but I don’t know either how to solve this !

What I do is that I simply present a choice to the user to close the app or stay, and if the response is “close” then I call
Application.Quit();

But I would like to know too how to “suspend” the app without actually killing it.

1 Like