Search code examples
androiddialogandroid-launcherkiosk-mode

Start Launcher Selection Programmatically / Android


I'm developing an industrial app that's running effectively in a KIOSK mode - that is users must not be able to exit it.

To achieve this I've simply made the app a launcher/home screen replacement. This works very effectively and so far seems to be working as a method of preventing people getting out.

The only problem I have is that if I'm not careful we're going to end up with bricked devices where we can't get back to a normal launcher application.

What I'm looking for is a method of programmatically presenting the Android Launcher Selection Dialog.

Android seems to do this on it's own when you first launch a launcher, but I can't figure out a way of doing it programmatically.


Solution

  • What I'm looking for is a method of pro grammatically presenting the Android Launcher Selection Dialog.

    Intent.createChooser() returns an Intent that will launch a chooser (which I think is what you mean by "Android Launcher Selection Dialog") for a given Intent. So, create an Intent for ACTION_MAIN and CATEGORY_HOME, wrap that in Intent.createChooser(), and call startActivity() on the resulting Intent.