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
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);
}
<category android:name="android.intent.category.LAUNCHER" /><category android:name="android.intent.category.HOME" /><category android:name="android.intent.category.DEFAULT" />
@Overridepublic boolean onKeyDown(int keyCode, KeyEvent event) {// Do nothing or catch the keys you want to block}
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!”