title: Send broadcast from App A and receiving it in app B
body: <p>I am trying to send a intent String   <code>/Download/income_tax_return.pdf</code> as Broadcast from App A to App B. In the App A I have the following MainActivity.</p>
  
  <pre><code>package com.mysender;
  
  
  import android.content.ComponentName;
  import android.content.Intent;
  import android.os.Bundle;
  import android.support.v7.app.AppCompatActivity;
  
  public class MainActivity extends AppCompatActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          final Intent intent=new Intent();
          intent.setAction("com.mysender.Data");
          intent.putExtra("path", "/Download/income_tax_return.pdf");
          intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
          intent.setComponent(new ComponentName("com.example.app","com.example.app.MainActivity"));
          sendBroadcast(intent);
  
      }
  }
  </code></pre>
  
  <p>After initializing the intent, I am setting the action of the intent as the following: <code>com.mysender.Data</code> and sending the intent as  broadcast to the app B <code>com.example.app</code> but when starting the App A and then App B I am not
  getting the Toast message from the MyReceiver. How can I send the intent from App A to App B? I am not getting any errors.</p>
  
  <p>and the follwoing AndroidManifest.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.mysender"&gt;
      &lt;application
          android:allowBackup="true"
          android:icon="@mipmap/ic_launcher"
          android:label="@string/app_name"
          android:roundIcon="@mipmap/ic_launcher_round"
          android:supportsRtl="true"
          android:theme="@style/AppTheme"&gt;
          &lt;activity android:name=".MainActivity"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>In the App B I am doing the following in the MainActivity:</p>
  
  <p>p</p>
  
  <pre><code>ackage com.example.app;
  
  import android.app.Activity;
  import android.content.Context;
  import android.content.Intent;
  import android.content.IntentFilter;
  import android.os.Bundle;
  import android.widget.Toast;
  
  public class MainActivity extends Activity {
  
      private WebView mWebView;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          // Receive broad Cast fromn External App
          IntentFilter filter = new IntentFilter("com.mysender.Data");
          registerReceiver(myReceiver, filter);
  
      }
      private MyReceiver myReceiver =new MyReceiver(){
          @Override
          public void onReceive(Context context, Intent intent) {
              String path = intent.getStringExtra("path");
              Toast.makeText(context,"Data Received from External App: " + path, Toast.LENGTH_SHORT).show();
  
          }
      };
  
      @Override
      protected void onDestroy() {
          super.onDestroy();
          unregisterReceiver(myReceiver);
  
      }
  }
  </code></pre>
  
  <p>AndroidManifest.xml App B:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.app" &gt;
      &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
      &lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /&gt;
      &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
      &lt;application
          android:allowBackup="true"
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@android:style/Theme.NoTitleBar.Fullscreen" &gt;
          &lt;activity
              android:name="com.example.app.MainActivity"
              android:label="@string/app_name" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  &lt;/manifest&gt;
  </code></pre>
  
  <p><strong>Edit</strong></p>
  
  <p>So I have registered the MyReceiver in the Manifest of the second app but I still not getting the path String:</p>
  
  <pre><code>&lt;receiver android:name=".MyReceiver"
      android:enabled="true"
      android:exported="true"&gt;
      &lt;intent-filter&gt;
          &lt;action android:name="com.mysender.Data" /&gt;
      &lt;/intent-filter&gt;
  &lt;/receiver&gt;
  </code></pre>