title: How to handle Android power button events?
body: <p>I want to create an Android application that is opened in background when the power button is pressed twice. </p>
  
  <p>I want to know how can I handle power button and choose what happens when user press power button?</p>
  
  <p>Just as we have in Safety Apps which sends SOS messages on certain number of power key presses.</p>