title: How to register dynamic BroadcastReceiver with permissions?
body: <p>I am trying to setup a dynamic broadcast receiver inside my service to receive broadcasts from another application. The twist is I want to require broadcaster to have specific permissions.</p>
  
  <p>In AndroidManifest file of service application I created permission using normal protection leve. Application that will be broadcasting is using above mentioned permission. Broadcast is sent as following:</p>
  
  <pre><code>Intent intent = new Intent();
  intent.setAction(Utils.ACTION_SEND_BUS_MESSAGE);
  intent.putExtra(BusMessage.class.getSimpleName(), msg);
  sendBroadcast(intent, Utils.PERMISSION_SEND_MESSAGE);
  </code></pre>
  
  <p>And in service receiver is register as:</p>
  
  <pre><code>registerReceiver(receiver, receiver.getIntentFilter(), Utils.PERMISSION_SEND_MESSAGE, null);
  </code></pre>
  
  <p>Unfortunately broadcasts to do not arrive to receiver. Removing permission from sendBroadcast and registerReceiver does allow broadcasts to be received.</p>
  
  <p>I have also tested broadcaster to make sure that required permission is granted, which it is.</p>