RxGalleryFinal icon indicating copy to clipboard operation
RxGalleryFinal copied to clipboard

FileUriExposedException When Select to Camera

Open Cyux07 opened this issue 6 years ago • 2 comments

android.os.FileUriExposedException: file:///storage/emulated/0/DCIM/RxGalleryFinal/IMG_20170920094400.jpg exposed beyond app through ClipData.Item.getUri()

while I want to select to open camera in cn.finalteam.rxgalleryfinal.ui.activity.MediaActivity

Cyux07 avatar Sep 20 '17 02:09 Cyux07

This problem seem like only occure in Android N.

I try to add a file /res/xml/file_paths.xml as follow:

<?xml version="1.0" encoding="utf-8"?>
<paths>
    <external-path path="Android/data/_Your OWN Package Name_/" name="files_root" />
    <external-path path="." name="external_storage_root" />
</paths>

and add it to AndroidManifest.xml (in application tag):

<provider
            android:name="android.support.v4.content.FileProvider"
            android:authorities="_Your OWN Package Name_.fileprovider"
            android:grantUriPermissions="true"
            android:exported="false">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/file_paths" />
        </provider>

and FINALLY , how i can get the intent during the MediaActivity startup?

Cyux07 avatar Sep 20 '17 02:09 Cyux07

??

sheep0704 avatar Sep 25 '17 06:09 sheep0704