Take the 2-minute tour ×

Possible Duplicate:
Disabling home button on iPhone/iPad

hi developers

i am trying to disable the home button. the reason being my app is designed to be like a convenience store register , the person using the app would be entering the opening and closing balance while loggin in and loggin out of his shift. so when the home button is pressed(accidentally) there is no way of entering the closing balance.i did try some stuff in applicationWillTerminate method in the app delegate , but it did not work. i have put a check mark against "application will not run in background" in the info.plist so that the user has to login again with the password(that takes care of security issue). now , what i was thinking was instead of trying to code in applicationWillTerminate is there anyway i can disable the home button so that the only option left out for the user to logout is the proper logout button.

and last of all , this app will not be in the Appstore , its for a client. i dont have to bother apple rejecting my App for sure.

share|improve this question

marked as duplicate by Graham Lee, taskinoor, JeremyP, BoltClock, Jasarien Dec 24 '10 at 12:00


As an iPhone owner, I certainly hope there's no way for an application to lock itself on my screen and disable the home button. –  David Dec 24 '10 at 11:16
Please search Stack Overflow before asking a question. You'll probably find it's already been asked. –  Jasarien Dec 24 '10 at 12:00
add comment

4 Answers

The only way would be to get a case that covers the home button

share|improve this answer
add comment

IMPOSSIBLE!!! not even an API for a jailbroken phone will have this feature.

try some alternatives:

  • do allow the app to run in the background,

  • but log the user out after 2mins of backgrounding [takare of your security], by saving the current time in applicationWillResignActive and checking it against timeIntervalSinceDate in applicationDidBecomeActive

  • save the closing balance as a variable in NSUserdefaults against that user when logging out due to timeout/terminating and maybe ask him if he wants to enter it in if he logs in again.

share|improve this answer
add comment

Short answer: no. You can't do that.

share|improve this answer
Thanks Graham for that speedy answer. –  Rajashekar Dec 24 '10 at 11:20
add comment

I'd be very surprised if this was possible, even using private APIs.

In essence, the operation of the home button is controlled by the underlying OS (the "springboard" app launcher in this case), so it's unlikely to be possible for an application to override or somehow block the "button pressed" message.

That said, some alternatives have been discussed within the existing Disabling home button on iPhone/iPad question.

share|improve this answer
add comment
