paint-brush
Disable Android home, back and active apps buttonsby@pradyumnadoddala
38,949 reads
38,949 reads

Disable Android home, back and active apps buttons

by PradyMay 10th, 2016
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

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 <strong>Android Play Store wouldn’t approve</strong> of these<strong><em> unless you have a very strong reason</em></strong>.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - Disable Android home, back and active apps buttons
Prady HackerNoon profile picture

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



@Overrideprotected 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




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

References


Home button disable_I do know that it is ill advice to take control of the HOME button for users. But I'm developing a android lockdown…_stackoverflow.com

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!”