0

i have tried different approaches to disable hardware home button through key-guard and key-down. it didn't work, i want functionality like Go-locker app. when i press on home button activity didn't close. please give me any idea about it. Thanks in advance.

Nazima Kauser MMF
  • 1,635
  • 3
  • 14
  • 11

2 Answers2

1

Write this Intent filter in manifest in tag of your activity

         <intent-filter >
            <action android:name="android.intent.action.MAIN" />

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

        </intent-filter>
Stopfan
  • 1,649
  • 15
  • 22
  • Add following code to your activity: @override public void onAttachedToWindow() { this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD); super.onAttachedToWindow(); } – Stopfan Apr 22 '15 at 11:29
  • sir its didn't work. please give me any other solution if u did it, can you share code with me because all the option is not working. – Nazima Kauser MMF Apr 22 '15 at 12:30
1

Because the security reason, if any app can disable Home button, and also disables back button (onbackpress()), power button (by on/off receiver), so the app will never be killed, and your phone just shows the app. I think Go-locker has customed their laucher, you can do it, but i think it is not easy.

Regards !

NamNH
  • 1,752
  • 1
  • 15
  • 37