title: Power key event in android?
body: <p>I want to listen to power key event.
  How can I do that?</p>
  
  <p>Currently the code I am using is this:</p>
  
  <pre><code>    @Override
  public boolean onKeyDown(int keyCode, KeyEvent event) {
      if(KeyEvent.KEYCODE_POWER == event.getKeyCode()){
          Log.e("POWER", "pow");
           return true;//If event is handled, falseif 
           }
      return super.onKeyDown(keyCode, event);
  }
  </code></pre>
  
  <p>And the user permissions</p>
  
  <pre><code>    &lt;uses-permission android:name="android.permission.PREVENT_POWER_KEY" /&gt;
  </code></pre>
  
  <p>I do not get any result.</p>
  
  <p>I want a add a functionality when user presses power button or long presses he can have an emergency call/ Speed dial.</p>
  
  <p>Looking for a solution.</p>