Search code examples
androidandroid-activityandroid-3.0-honeycomblifecycle

It is possible to make a HoneyComb activity unclosable?


I'm developing a presentation style application for HoneyComb Tablets. At one stage the tablet may be passed around a room for people to interact with. If possible I would like to prevent malicious users from navigating away from the current activity.

So far I have overwritten the onBackPressed() to prevent finishing the activity but users can still press the other buttons on the status bar and also leave the app via notifications that pop up.

Any suggestions or possible solutions?

Thanks


Solution

  • 1. Make your activity full screen.

    2 Use an alarmManager to trigger your activity from a service on a regular interval say 2or3 second (only if your activity is not foreground). For this use a boolean variable and store it using sharedPreference. this value will be true in onReume and false in onPause or in onStop or in onDestroy. And then only start your activity from your service if the boolean variable is false. Now if your user will press the Home button then AlaramManager kick start your activiy again.

    3 Make a special button for finishing your service and activity and for cancel the alarmManager.