I need to “lock” a user into an application. The device’s sole purpose is to use this application, and so it is not feasible to allow the user to navigate the device for any other reason. What is the best way to make sure that the applications Activitys are always in the foreground, and if not, launch the main Activity?
Now I know this goes against everything about the typical Android application development, but these devices are going to be specifically used for this one application.
What is the best way to determine if any of the applications Activitys are in the foreground, and launch one if not?
You don’t.
Make your activity be the home screen, and they can’t go anywhere. And roll your own firmware, so that the user can’t safe-boot the device and remove your home screen.