title: Sending data from A application to B application in android
body: <p>I have two separate applications.</p>
  
  <p>How can I establish communication between these two applications like application A communicates with the other application B:</p>
  
  <p>//Application  A MainActivity</p>
  
  <pre><code>String hai ="Hello";
  Intent i = new Intent("com.gpstrackdefault");
  i.putExtra("Act_Main", Killme);
  //i.setAction(Intent.ACTION_ALL_APPS);
  //i.setType("text/plain");
  startActivity(i);
  </code></pre>
  
  <p>//Application B Mainactivity</p>
  
  <pre><code>Intent intent =getIntent();
  String action =intent.getAction();
  String sharedText = intent.getStringExtra("Act_Default");
  Toast.makeText(getApplicationContext(),sharedText, Toast.LENGTH_LONG).show();
  Log.i("Extact text",sharedText);
  </code></pre>
  
  <p>//  B manifest file </p>
  
  <pre><code>&lt;activity
      android:name="com.gpstrackdefault.MainActivity"
      android:label="@string/app_name"  
      android:enabled="true"
      android:exported="true"&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;intent-filter &gt;
          &lt;category android:name="android.intent.category.DEFAULT"/&gt;
          &lt;action android:name="android.intent.action.SEND"/&gt;
      &lt;/intent-filter&gt;
  &lt;/activity&gt; 
  </code></pre>