I'm building a child play application for Android. I need to disable all keys when it is in use.
I have set the Application as the Home App and disabled the back key (that takes care of the Home and Back button).
In order to clear the recent tasks list I've created a list of Dummy Activites which start and then finish when the application starts. The Dummy Activites look like:
public class Dummy1 extends Activity
{
public void onCreate(Bundle paramBundle)
{
super.onCreate(paramBundle);
finish();
}
}
And then in my onCreate of the application I perform:
this.pm.setComponentEnabledSetting(new ComponentName(this, Dummy1.class), PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
Intent localIntent1 = new Intent(this, Dummy1.class);
localIntent1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(localIntent1);
This takes care of when someone tries to hold the Home key to display the recent tasks as I create 8 of these and they're all empty so the user can't click to change apps.
Now the only button I can't seem to disable is the "Recent Tasks/Apps" button (available mainlyon HTC devices, i.e. One X, One S, etc.). This button seems to still bring up all the recent tasks (even though my dummy tasks were created) and I can't seem to find a "hook" for the event that is fired when this button is pressed?
Note: I know it's do-able since apps like ToddlerLock have done it....I just can't seem to figure it out.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…