Working with a restaurant in an android tablet based menu app. If possible I would like to restrict access to just the menu app and browser. How would a I go about turning a normal dashboard app into a launch开发者_开发问答er replacement???
Add this to your <activity>
:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
When the user presses HOME again, they will get a chooser -- check the "make this the default" checkbox, then tap the entry for your app, and you're now the home screen.
Bear in mind, though, that:
- If you let users get to a browser, they will be able to download and run apps distributed publicly, plus click links that might lead to other apps on the device (e.g., YouTube, a PDF reader)
- If the user knows how to boot your device in safe mode, the firmware home screen will return; the only solution to this is to have your home screen be installed on the firmware of the device
There is a Home sample project in your SDK that demonstrates more of this.
You can write a simple app that allows the user to start 2 different apps (the menu and the browser) using intents while never ending your main app. In that app/launcher app you can override the home/back button in such a way that it will not allow the user to quit that app/launcher. This means that once the app is started there is no way to stop it, except by turning the tablet off.
精彩评论