Android: How to get a content:// URI for a file in the external storage PUBLIC directory : <p>I've followed <a href="https://developer.android.com/training/camera/photobasics.html">this Google tutorial</a> to start an intent to capture an image with <code>new Intent(MediaStore.ACTION_IMAGE_CAPTURE)</code>. The tutorial recommends using the public directory with <code>getExternalStoragePublicDirectory</code> which would work great for my app. But then their example instead uses <code>getExternalFilesDir</code>. Then to pass the URI of the file to the intent with <code>MediaStore.EXTRA_OUTPUT</code> I <a href="https://commonsware.com/blog/2016/03/14/psa-file-scheme-ban-n-developer-preview.html">have to get a content URI</a> because I'd like to target Android N. Before targeting N I would just pass a file:// URI and everyone but Google was happy. Now on N I started getting the <code>FileUriExposedException</code> that seems to be <a href="https://code.google.com/p/android/issues/detail?id=203555#c10">not very favorable</a>.</p>

<p>So given that I have a File like this...</p>

<pre><code>private File createImageFile() throws IOException {
    String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
    File storageDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "MyAppFolder");
    if (!storageDir.exists() &amp;&amp; !storageDir.mkdir())
        Log.w(TAG, "Couldn't create photo folder: " + storageDir.getAbsolutePath());
    File image = new File(storageDir, timeStamp + ".jpg");
    mCurrentPhotoPath = image.getAbsolutePath();
    return image;
}
</code></pre>

<p>...can I use a built-in provider for the public pictures directory to get a content URI? If so how? </p>

<p>I've tried something like</p>

<pre><code>takePictureIntent.putExtra(
    MediaStore.EXTRA_OUTPUT, 
    FileProvider.getUriForFile(this, MediaStore.AUTHORITY, createImageFile()));
</code></pre>

<p>but it just throws </p>

<blockquote>
  <p>IllegalArgumentException: Missing android.support.FILE_PROVIDER_PATHS meta-data</p>
</blockquote>

<p>Is that Authority correct? If I must use my own provider to share the public file then what path can I specify in my FILE_PROVIDER_PATHS meta-data? All of the <a href="https://developer.android.com/reference/android/support/v4/content/FileProvider.html#SpecifyFiles">options I can find</a> are for private directories.</p>
