I am developing an app that will be used on conferences for email signup. The app will run on a tablet that will just sit on a table. My goal is to create an app that can not be closed. Is it possible to use the onDestroy() callback and just start the activity if someone closes the app? Or is there some better solution to my problem. (Suggestions for att rooted device can be accepted).
Asked
Active
Viewed 535 times
-1
-
Thanks! But if I make it the default Home app, how can I add a "secret option" to close it? Is it possible to send an intent to launch the home app picker? – AlexanderNajafi Jun 05 '14 at 08:35
1 Answers
1
What you are looking for is a "kiosk" app. Full details on how to build one are beyond the scope here, but once you know what to search on, you will find lots of info (google or stackoverflow).
Unfortunately overriding onDestroy()
like that will not work. Nor will onPause()
.
Basic ideas:
- make it full screen
- override
onBackPressed()
to prevent it from closing - or make a HOME screen app
A couple of resources that will help:
As for a "secret option" to close it?
- as per Mark Murphy on that blog post, you "can always revert to the stock home screen via a safe-mode reboot."
- or do it in your app with code similar to this:
(this only works for your application)
/**
* Clears the default intent handler stored by the system for your
* intents. This allows the user to choose a new default app next time.
*/
public void clearDefaultProvider()
{
getPackageManager().clearPackagePreferredActivities(getPackageName());
}

Community
- 1
- 1

Richard Le Mesurier
- 29,432
- 22
- 140
- 255