views:

1337

answers:

5

I have an application, when it launches I have to disable all the buttons, I successeded in disabling end call and other i need to disable home buttom if I click it, It should not produce any action.

Any suggestions highly appreciated

Cheers Vinayak

+10  A: 

Fortunately, it is not possible to disable the HOME button, to help users maintain control of their devices infected by malware.

CommonsWare
Look at "Todler Lock" on the market. They've figured out how to disable the home button and almost all of the other buttons. It must be possible. It's very handy when when letting my two year old play with my phone, so she doesn't accidently call 911.
Jay Askren
A: 

You can't, the Home button key press event is handled by the WindowManager.

Al
You could replace the WindowManager, could you not?
vy32
Only by replacing the firmware.
CommonsWare
Yea it is possible to replace the window manager, But there is way to generate the key event no to disable.
Vinayak.B
+3  A: 

I always get dumbfounded by know-it-alls whose lack of imagination makes them say things like "there is no good reason to do blah blah blah". Just because you don't have a reason to do so doesn't mean other don't either. There's PLENTY of good reason to have a kiosk-mode on a phone.

Bruce
+4  A: 

I'm pretty sure Toddler Lock just uses a BroadcastReciever and listens for Intent.ACTION_MAIN and the category Intent.CATEGORY_HOME - that's why when you first launch it, it tells you to check the "use this application as default" box, and makes you select toddler lock.

So, it's not really blocking the Home button at all, it's just setting itself up as the default broadcast receiver for:

Intent i = new Intent(Intent.ACTION_MAIN);
i.addCategory(Intent.CATEGORY_MAIN);

When you launch Toddler Lock, it probably sets an internal flag, and if you press the home button, it just brings the window to the front. If the flag is not set, it probably launches Launcher explicitly.

I hope that makes sense. It's just a theory, but I'm almost 100% sure that's how it's done.

synic
A: 

did you find a solution?

mishkin