Questions tagged [android-fileprovider]

FileProvider is an extension of Android's ContentProvder class, which supports easy sharing of private files between apps.

FileProvider supports easy sharing of private files between Android apps. When paired with features like grantUriPermission(String, Uri, int) or FLAG_GRANT_READ_URI_PERMISSION, this provider ensures that receiving apps can always open the underlying file.

Apps should generally avoid sending raw filesystem paths across process boundaries, since the receiving app may not have the same access as the sender. Instead, apps should send Uri backed by a provider like FileProvider.

Resources:

679 questions
21
votes
2 answers

Unresolved class 'FileProvider'

I am trying to take a picture on an android device and following this tutorial. The below code gives me an error on android.support.v4.content.FileProvider. Android studio says Unresolved class 'FileProvider'. I have the following…
Devin Norman
  • 315
  • 1
  • 2
  • 7
19
votes
10 answers

Xamarin Forms File Provider not set

I am currently going through the process of Learning Xamarin.Forms. I am currently attempting to implement Camera functions using the Plugin.Media.CrossMedia library. Implemented below: public async Task StartCamera() { await…
Duncan Palmer
  • 2,865
  • 11
  • 63
  • 91
19
votes
2 answers

Picking an image file from Gallery using FileProvider

Compiling for Android N I've faced an issue of FileProvider. I need to let user to pick image from gallery/take picture with camera then crop it to square. I've managed to implement a FileProvider for taking image with camera, but I have serious…
Evgeniy Mishustin
  • 3,343
  • 3
  • 42
  • 81
18
votes
1 answer

FileProvider - Open File from Download Directory

I can't open any file from Download Folder. I can download a file and save in Download Folder with this: DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url)); request.setDescription(descricao); …
18
votes
2 answers

SecurityException with grantUriPermission when sharing a file with FileProvider

I have two applications. I'm trying to share a file from application A to application B using a FileProvider. Application A calls the insert method on a ContentProvider in Application B to insert a record. The data inserted includes the Uri to the…
17
votes
4 answers

Opening a PDF file using FileProvider uri opens a blank screen

I'm creating a PDF file on my app and writing it to the external storage, "Download" directory. Now, when I open it through my app with an intent action.VIEW using FileProvider uri, Google PDF Viewer displays a blank screen, Adobe Acrobat cannot…
17
votes
2 answers

Image share intent works for Gmail but crashes FB and twitter

I am trying to allow the user to share an image to other apps on the device. The image is inside the files/ subdirectory of my app's internal storage area. It works just fine with Gmail, but Facebook and Twitter both crash when responding to my…
iforce2d
  • 8,194
  • 3
  • 29
  • 40
16
votes
4 answers

Didn't find class "androidx.core.content.FileProvider"

I migrated my app to AndroidX and it's crashing on launch on API level 21. My application throws this exception: 10-08 09:42:50.930 11346-11346/com.example.test E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.test, PID:…
16
votes
11 answers

Missing android.support.FILE_PROVIDER_PATHS meta-data

I am trying to open the pdf file which I downloaded & saved in external storage. But When I open my app its gets crashed and showing following error; 08-31 00:58:31.304 1807-1807/? E/AndroidRuntime: FATAL EXCEPTION: main Process:…
priyanka kamthe
  • 519
  • 2
  • 5
  • 19
16
votes
4 answers

read failed: EBADF (Bad file descriptor) while reading from InputStream Nougat

With the recent changes in android N, I had to upgrade my code to use FileProvider to fetch images/files using camera/file manager. The code is working fine in emulator(genymotion) but throwing IO exception in Moto G4 plus. if(Build.VERSION.SDK_INT…
Debanjan
  • 2,817
  • 2
  • 24
  • 43
16
votes
4 answers

IllegalArgumentException: Failed to find configuration root that contains xxx on FileProvider.getUriForFile

I have been trying to follow the Android tutorial on sharing files. I set up the FileProvider like this: On the main manifest xml:
15
votes
1 answer

FileProvider not working with Failed to find configured root that contains

I am trying to imlement downloading and sharing PDF file for read by another PDF reader apps (DropBox, Drive PDF Reader or Adobe Reader) on Android using FileProvider way. However, I keep getting the following exception: Failed to find configured…
malhobayyeb
  • 2,725
  • 11
  • 57
  • 91
15
votes
6 answers

BitmapFactory can't decode a Bitmap from Uri after photos taken on Android Nougat

I tried to take a photo and then to use the photo. Here is what I did. My device was Nexus 6P (Android 7.1.1). First, I created a Uri: Uri mPicPath = UriUtil.fromFile(this, UriUtil.createTmpFileForPic()); //Uri mPicPath = UriUtil.fromFile(this,…
15
votes
2 answers

Android Fileprovider: IllegalArgumentException: Failed to find configured root that contains

I have a question about the android FileProvider. I want to save a pdf document and open it with a default program. I don´t want to save it in external Storage. After I´ve successfully saved the pdf to the FilesDirectory/export/temp.pdf, I´ve tried…
user2212120
  • 287
  • 1
  • 2
  • 9
14
votes
4 answers

Permission Denial with File Provider through intent

I am attempting send a bitmap from the cache directory of my app to the text messaging app. I am using file provider to grant temporary permission to the application that handles the intent. When I try to send the intent and I select the default…
1
2
3
45 46