Android disable all hardware keys for lockscreen app
Asked Answered
T

1

1

I am coding a custom lockscreen app for android.

I have managed to disable the back button. But the home button and the recent apps button on ICS proved not to be as easy.

I searched around and came up with:

@Override
public void onAttachedToWindow() {
    // TODO Auto-generated method stub
    this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);
    super.onAttachedToWindow();
}

However, this throws IllegalArgumentException window type can not be changed after it is added. I then tried to set it in onCreate() but the home key still functions.

I am willing to use root methods to achieve this. Is there any way to get it done?

Any help would be appreciated!

Tomika answered 2/10, 2012 at 1:37 Comment(2)
I'm more than sure you'd need root access and some low-level coding to do that. In other words, the Android SDK doesn't offer any way to do this.Yvette
yeah WidgetLocker does this really well with root helper. But i just cant seem to find howTomika
T
1

For android versions above 2.3, overriding of the Home button is disabled

Tomika answered 17/10, 2012 at 1:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.