title: Register a Local BroadcastReceiver in AndroidManifest.xml?
body: <p>Is there anyway to register a BroadcastReceiver in AndroidManifest.xml and receives broadcast that is send by a LocalBroadcastManager?</p>
  
  <p>Currently I must call </p>
  
  <pre><code>registerReceiver(BroadcastReceiver receiver, IntentFilter filter) 
  </code></pre>
  
  <p>to register a Receiver, declare in AndroidManifest.xml won't work. But this means I must know exactly the receiver's package name and class name, not just the intent filter. Is it possible to declare the receiver in the manifest file?</p>
  
  <p>following is my current code.</p>
  
  <p>AndroidManifest.xml:</p>
  
  <pre><code>...
  &lt;receiver 
      android:name="com.example.test.MessageReceiver"
      android:enabled="true" &gt;
      &lt;intent-filter&gt;
          &lt;action android:name="com.m2x.test.intent.MESSAGE_RECEIVED" /&gt;
      &lt;/intent-filter&gt;
  &lt;/receiver&gt;
  ...
  </code></pre>
  
  <p>MainActivity.java:</p>
  
  <pre><code>Intent intent = new Intent();
  intent.setAction("com.m2x.test.intent.MESSAGE_RECEIVED");
  
  LocalBroadcastManager manager = LocalBroadcastManager.getInstance(mContext.get());
  manager.sendBroadcast(intent);
  </code></pre>
  
  <p>MessageReceiver.java</p>
  
  <pre><code>public class MessageReceiver extends BroadcastReceiver {
  
      @Override
      public void onReceive(Context context, Intent intent) {
  
          if (intent.getAction().equals("com.m2x.test.intent.MESSAGE_RECEIVED")) {
              Toast.makeText(context, "user message received", Toast.LENGTH_SHORT).show();
          }
  
      }
  }
  </code></pre>