Hackernoon logoDisable Android home, back and active apps buttons by@pradyumnadoddala

Disable Android home, back and active apps buttons

Before you get totally into this post, I would like to warn you regarding the use of these functionalities, because they aren't user-friendly and Android Play Store wouldn’t approve of these unless you have a very strong reason.

Photo by Suika Ibuki on Unsplash

Active Apps/ Reorder Apps button

Add the following permission to AndroidManifest.xml

<uses-permission android:name="android.permission.REORDER_TASKS" />

The following to the Activity

@Override
protected void onPause() {
super.onPause();

ActivityManager activityManager = (ActivityManager) getApplicationContext()
.getSystemService(Context.ACTIVITY_SERVICE);

activityManager.moveTaskToFront(getTaskId(), 0);
}

Home Button

<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />

Back Button

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
// Do nothing or catch the keys you want to block
}

References

If you’ve reached this, you’ve made it!! Have a great day!

Clap away if this helped you out. It encourages me to write more posts. And thanks for the support.

Prady | @pradyumna_d | “File Your Cryptocurrency Taxes Using BearTax!”

Tags

Join Hacker Noon

Create your free account to unlock your custom reading experience.