title: FileProvider.getUriForFile doesn't save image to gallery and can't access file OnActivityResult
body: <p>In my app, trying to capture images using the camera app. 
  I am updating my app to use FileProvider.getUriForFile when specifying the file path to save images to, as Uri.fromFile is deprecated.</p>
  
  <p>It was working fine beforehand using Uri.fromFile. But I can't get it to work using FileProvider.getUriForFile.</p>
  
  <p>I am creating the image file as follows:</p>
  
  <pre><code>String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
              String imageFileName = "JPEG_" + timeStamp + "_";
              File storageDir =  Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
              File image = File.createTempFile(
                  imageFileName,  /* prefix */
                  ".jpg",         /* suffix */
                  storageDir      /* directory */
              );
  
              mCurrentPhotoPath = "file:" + image.getAbsolutePath();
              return image;
  </code></pre>
  
  <p>Then, depending on the target sdk, I get the image URI:</p>
  
  <pre><code>if (Build.VERSION.SDK_INT &lt; Build.VERSION_CODES.LOLLIPOP) {
                              jobImageURI = Uri.fromFile(photoFile);
                          } else {
                              jobImageURI = FileProvider.getUriForFile(OrderDetails.this, BuildConfig.APPLICATION_ID + ".provider",photoFile);
                          }
  </code></pre>
  
  <p>I have updated the app manifest xml to include the provider, as per the android developer documentation.
  I have a provider_paths.xml file which holds the path:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;paths xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;external-path name="external_files" path="."/&gt;
  &lt;/paths&gt;
  </code></pre>
  
  <p>Then I launch the camera:</p>
  
  <pre><code>takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, jobImageURI);
  startActivityForResult(takePictureIntent, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE);
  </code></pre>
  
  <p>However, after the photo is taken and it comes back to the onActivityResult function, I read back in the image file.
  The image isn't saved to the Gallery, as I am reading back in the last file from the Gallery but it isn't there.
  I can't access the file using the path from the jobImageURI above either.</p>
  
  <p>Is the path I've provided the provider_paths.xml file incorrect, or why can't I access the images?</p>