Reputation: 6161
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.
Upvotes: 1
Views: 5464
Reputation: 1595
If I understand this question right you don't want to get the user out of your app if he don't want it?
I would do it like this:
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
return true;
}
Now button clicks will be ignored for the activity. Now you only have to make a menu point for the exit.
Upvotes: -1
Reputation: 1007584
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
.
Upvotes: 4