Sharing video + text with FileProvider causes Permission Denial exception
<p>i have Permission Denial while sharing a video <strong>.mp4</strong> file with file provider and Intent.EXTRA_TEXT .</p>

<p>if i remove the line:</p>

<pre><code>shareIntent.putExtra(Intent.EXTRA_TEXT, "#myappHashtag");
</code></pre>

<p>everything works. But i need both video file + extra text.</p>

<p>i think the problem is: caption=%23myappHashtag in the share uri but how can i fix it?</p>

<p>Thank you so much.</p>

<pre><code>private void ShareItem(File fileToShare) {

    String package_name = "com.lucagrillo.myapp";
    Uri uri = FileProvider.getUriForFile(this, package_name + ".fileprovider", fileToShare);
    Intent shareIntent = new Intent();
    shareIntent.setAction(Intent.ACTION_SEND);
    shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
    shareIntent.putExtra(Intent.EXTRA_TEXT, "#myappHashtag");
    shareIntent.setType(intentFormatType);

    startActivity(Intent.createChooser(shareIntent, getResources().getText(R.string.share_with)));

}
</code></pre>

<p>Exception:</p>

<pre><code>Writing exception to parcel
    java.lang.SecurityException: Permission Denial: reading android.support.v4.content.FileProvider uri content://com.lucagrillo.myapp.fileprovider/images/shareFile.mp4?caption=%23myappHashtag from pid=9630, uid=10093 requires the provider be exported, or grantUriPermission()
    at android.content.ContentProvider.enforceReadPermissionInner(ContentProvider.java:608)
    at android.content.ContentProvider$Transport.enforceReadPermission(ContentProvider.java:483)
    at android.content.ContentProvider$Transport.enforceFilePermission(ContentProvider.java:474)
    at android.content.ContentProvider$Transport.openTypedAssetFile(ContentProvider.java:419)
    at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:313)
    at android.os.Binder.execTransact(Binder.java:565)
</code></pre>

<p>Manifest file provider:</p>

<pre><code>&lt;provider
    android:name="android.support.v4.content.FileProvider"
    android:authorities="com.lucagrillo.myapp.fileprovider"
    android:grantUriPermissions="true"
    android:exported="false"&gt;
    &lt;meta-data
        android:name="android.support.FILE_PROVIDER_PATHS"
        android:resource="@xml/filepaths" /&gt;
&lt;/provider&gt;
</code></pre>