title: How to check whether the Home button is pressed in iPhone and act accordingly?
body: <p>I want to show an alert when a user taps the Home button. I tried with:</p>
  
  <ul>
  <li><code>applicationWillResignActive</code></li>
  <li><code>applicationDidEnterBackground</code></li>
  <li><code>applicationWillEnterForeground</code></li>
  <li><code>applicationWillTerminate</code></li>
  </ul>
  
  <p>... but nothing worked. For the first three, the alert comes when the application comes back to foreground from background. I want to show the alert immediately after Home button is pressed. Is there any way to do this? </p>
  
  <p>Also: I want to run the app in foreground itself, or send to background as per user input.</p>