title: how to call Intent.ACTION_CLOSE_SYSTEM_DIALOGS on application level
body: <p>I'm trying to show my menu when the user clicks on the power button. I'm using this code which disables system power button spinner menu but I dont want to write this code on each activity. How do I call this service which disables system dialog on application level ?</p>
  
  <pre><code>@Override
  public void onWindowFocusChanged(boolean hasFocus) {
      super.onWindowFocusChanged(hasFocus);
  
      Log.d("Focus debug", "Focus changed !");
  
      if (!hasFocus) {
          Log.d("Focus debug", "Lost focus !");
  
          Intent closeDialog = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
          sendBroadcast(closeDialog);
      }
  }
  
  /* I don't want to write above code on each activity */
  
  import android.widget.Toast;
  
  public class CloseSystemDialogsIntentReceiver extends BroadcastReceiver {
  
      public void onReceive(final Context context, final Intent intent) {
          // Log.i("HERE", "------------------------------------HERE");
          // Toast.makeText(context, "OFFFFFFFFFFFFFFFF",Toast.LENGTH_LONG).show();
      }
  }
  
  &lt;receiver 
      android:name="com.eurosoft.cabtreasure.receiver.CloseSystemDialogsIntentReceiver"&gt;
      &lt;intent-filter&gt;
          &lt;action android:name="android.intent.action.CLOSE_SYSTEM_DIALOGS" /&gt;
          &lt;category android:name="android.intent.category.DEFAULT" /&gt;
      &lt;/intent-filter&gt;
  &lt;/receiver&gt;
  </code></pre>