How to disable the android home button

1

I need to disable the use of the physical button on the Android device (preferably versions greater than 4.0). With surveys I found some solutions like for example removing the actionbar, leaving the application in fullscreen. I need to use the actionbar. I found a not very good solution, which uses the following tags in the manifest:

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

With this popup asks what action I want to use, Initial Screen of the device or call my application. When selecting my application, a new instance of the application is created ...

In short, I need to block the activation / use of the physical home button of the device within the application. I can not remove the actionbar, I can not start new instance of the application, and I can not block the back button (physical back button).

    
asked by anonymous 29.05.2014 / 23:03

2 answers

1

The Android Home button for security reasons has been made so it can not be blocked by apps.

Any way you find out about doing this is basically a hack that there is no guarantee that it will work or that it will behave the same way on all versions of Android or even on different devices or that use a custom UI only with the Android SDK will not have anything that will allow you to do that.

The only way to do this without using any tricks is if your App is Home Screen, Home Screen will be the only app that will be able to handle the Home key.

    
29.07.2014 / 23:25
0

Try to import this solution link

Allows you to lock both the PHYSICAL HOME, BACK or MENU key in 4.0+ versions

In your code just use:

HomeKeyLocker homeKeyLoader = new HomeKeyLocker();
homeKeyLocker.lock(this);
     // home key locked 
homeKeyLocker.unlock();
     // home key unlocked 
    
30.05.2014 / 12:48