0

My friend wants to buy an Android phone for his girlfriend and wants to propose (i know, weird proposal) so he asked me to make an app which when the phone starts will not allow any commands (Home, Back buttons should't work) to be available unless she presses either the "Yes" or "No" button which appears on the display (with a marry me message. o.O ).

I'm guessing I haven't got enough access to the OS to block the inputs from the Home, Back, etc buttons, but is there another way of accomplishing this? I might be wrong but I can't catch the Home button press event in order to cancel it out, or can I?

Or ... is it possible to do this on a rooted phone, maybe "hack" the OS a little?

Any suggestions are appreciated ...

AndreiBogdan
  • 10,858
  • 13
  • 58
  • 106
  • No , You Can't do this with Home Button – Arash GM Aug 12 '13 at 06:56
  • NO, the answer is NO, you can't block HOME button, the best thing you can do is to develop a launcher app, then when the user presses the HOME button then nothing happens. – user2652394 Aug 12 '13 at 06:56
  • @user2652394 "then when the user presses the HOME button then nothin happens" <--- any suggestions on how to do that? – AndreiBogdan Aug 12 '13 at 06:57
  • I think you can achieve that by making your own lock screen – user2172816 Aug 12 '13 at 06:58
  • @user2172816 yeaaaaah ! How the hell didn't I think about that. Lock screens have the excat functionality that I need :D Please, someone write this as an answer so I can accept it. Eureka ! – AndreiBogdan Aug 12 '13 at 07:00

1 Answers1

2

For disabling HomeButton try :

@Override
public void onAttachedToWindow() {
this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);
super.onAttachedToWindow();
}

And Link for developing Custom lock screen : Android Lock Screen Widget

Community
  • 1
  • 1
Arash GM
  • 10,316
  • 6
  • 58
  • 76