The camera intent android nougat support tutorial describes the changes required for how to support file Uri’s to android nougat and later.

For android nougat (SDK 24) and later a file Uri can no longer be passed to another android application via the android intent. Instead a Content:Uris with storage permissions applied must be passed instead.

This android development tutorial will describe the steps required for creating files and folders with the correct permissions which can then be passed to another application via the android intent.


Get Code

The code is now on github you can get it from here Tag camera-intent-nougat

or else run this command

git clone –branch camera-intent-nougat

This video describes how to import the code from github using android studio and also how to use git tags


Setting up the FileProvider

Add the provider to the manifest file

Make sure to include it inside the application tag

          <meta-data android:name=""
              android:resource="@xml/filepaths" />


 Create an resource xml folder and then add a filepaths.xml file to that file

    <external-path path="." name="mediaimages" />


 Use the FileProvider to get the Uri from the file

      String authorities = getApplicationContext().getPackageName() + ".fileprovider";
        Uri imageUri = FileProvider.getUriForFile(this, authorities, photoFile);
        callCameraApplicationIntent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
//        callCameraApplicationIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile));

Camera intent android nougat support summary

In this android developers tutorial we learned to steps involved with sharing files to other applications. This is now required for Android versions of 7.0 (nougat) or later.

The FileProvider needs to be added to the android manifest file. An xml file is required for specifying the locations of the files to be shared.

The FileProvider must then be used to get the Uri from the file which can then be shared with another application.






camera intent android nougat support

About The Author

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>