I would like to use an XOOM tablet as a dedicated application for registering participants at a conference. This means the 开发者_如何学运维application should always be active and not allow the casual user to exit the application or access the underlying OS. Is it possible to do something like this with Android 3.0?
This is not possible without editing the underlying OS. An application cannot prevent the user from hitting the home key to exit the app.
This is probably a pretty hacky thing to do, but you could declare the activity you want to always be shown with the intent filter:
<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>
And then press home once. When Android asks what app to use, select your app and set it as default.
You can also override the default onBackPressed
method in your activity to just do nothing.
More info from this example app. I have no idea if this will actually work in practice, just a thought I had.
精彩评论