title: Sharing a file between two specific android apps
body: <p>I am writing apps A and B.  I want A to be able to send B a file URI of any given mime type.  I found an <a href="https://developer.android.com/training/secure-file-sharing/share-file.html" rel="nofollow noreferrer">explanation of how to handle someone making a request for a file</a>, so more like a pull, where as I want to push a URI from A to B, without B requesting.  I have also seen <a href="http://developer.android.com/training/sharing/receive.html" rel="nofollow noreferrer">a more generic description of how to share data between apps</a>, but that uses ACTION_SEND and, in that case, the user will be presented with a list of apps to choose from.  I only want app B specifically to receive the file URI.  In addition, I don't want app B to show up as a choice when someone is doing an ACTION_SEND for a different purpose.  So, how do I send a file URI from one specific app to another specific app?  </p>
  
  <p>Edit 1:  Adding some code snippets to the example.</p>
  
  <p>In app A, I am doing the following:</p>
  
  <pre><code>Intent testIntent = new Intent("com.example.appB.TEST");
  testIntent.addCategory(Intent.CATEGORY_DEFAULT);
  testIntent.setData(Uri.parse("file:///mnt/sdcard/test.txt"));
  startActivityForResult(testIntent, TEST);
  </code></pre>
  
  <p>In app B, I have the following in the manifest:</p>
  
  <pre><code>&lt;activity
      android:name="com.example.appB.mainActivity"
      android:label="@string/app_name" 
      android:launchMode="singleTask" &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;action android:name="com.example.appB.TEST" /&gt;
              &lt;category android:name="android.intent.category.DEFAULT"/&gt;
              &lt;data android:scheme="file"/&gt;
              &lt;data android:mimeType="*/*"/&gt;
      &lt;/intent-filter&gt;
  &lt;/activity&gt;
  </code></pre>
  
  <p>The error I get is ActivityNotFoundException.  If I get rid of the setData line, the activity is launched, but obviously I don't have the URI.</p>
  
  <p>You can read about more issues I hit <a href="https://stackoverflow.com/questions/25416035/getting-permission-denied-when-using-a-uri-despite-flag-grant-read-uri-permissio">here</a>.</p>