title: Remove floating button from WindowManager when power key pressed
body: <p>My app has a service that add a floating button to WindowManager.</p>
  
  <p>I want to remove my floating button from WindowManager When user press the power key and turn screen off. So when user turn screen on my floating button does not conceal (mask) android pattern screen lock.</p>
  
  <p>I add following code to my Service but it doesn't work !</p>
  
  <p>Should I add any permission or my service must run in background?!</p>
  
  <pre><code>public class Receiver extends BroadcastReceiver {
      @Override
      public void onReceive(Context context, Intent intent) {
          if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) 
          {
              try{
                  // Remove Floating Button from Window Manager
                  MyWindowManager.removeView(floating_btn);
                  // Stop Service
                  stopSelf();
              }
              catch (Exception e)
              {
                  //Log Error
              }   
          } 
      }
  
  }
  </code></pre>