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
2
votes
1 answer

Can MediaStore.EXTRA_OUTPUT be used with Intent.ACTION_GET_CONTENT

public void startAudioIntent(){ Intent audioIntent = new Intent(); audioIntent.setAction(Intent.ACTION_GET_CONTENT); audioIntent.setType("audio/*"); mAudioFile = new File(getActivity().getFilesDir(),"xyz"); Log.d(TAG,…
Robert Page
  • 366
  • 4
  • 10
2
votes
3 answers

How to get path /storage/emulated/0/Download/file_name.mime_type for Android 10 and above

I am saving a file inside the Downloads directory of the device (Android 11) to be viewed later by my app. I'm allowing multiple file types like pdf, word etc. I was able to save the file like this: (I got this code sample from…
mehul bisht
  • 682
  • 5
  • 15
2
votes
1 answer

Android 11 URI usage (file:// content://)

We have some old issues with similar words, but most of them are about converting one or the other. What I'm looking here is the "Right" behaviour of URI usage with the new changes. Let me give some context: Before when we get an image URI this…
Canato
  • 3,598
  • 5
  • 33
  • 57
2
votes
1 answer

PDF viewer permission issue in android 11

I am opening pdf file using an external pdf viewer application. But in android 11 shows eacces permission denied issue. All permissions already declared in my manifest file.
2
votes
1 answer

provider does not have permission to content when open intent camera

I have a basic :app module. and there is the :camera module. In the camera module, I open the native camera using intent. MediaStore.ACTION_IMAGE_CAPTURE but the camera doesn't work, as I get an error UID 10388 does not have permission to…
RusyaMed
  • 151
  • 2
  • 11
2
votes
4 answers

Attaching cache file to GMail through FileProvider and Intent not working

So I've been banging my head against the wall for the past day trying to figure out why a file won't attach to an email. Every time the app runs, I get a little toast message that pops up saying "Couldn't Attach File". The To and Subject fields fill…
James Furrer
  • 73
  • 1
  • 7
2
votes
0 answers

Video not shown in android Gallery

I generate a video in my app and I want it to be discoverable by the Photo/Gallery app. When the file is created I call addVideoToGallery, which uses FileProvider and then call ACTION_MEDIA_SCANNER_SCAN_FILE intent. Please find all required code…
Patola
  • 515
  • 8
  • 30
2
votes
1 answer

Android - Save a file from raw assets to external storage for others apps to access gives failed to find content root exception

I have a file in my raw assets directory which I am trying to save to shared phone storage that will allow other apps to open and view this video. I am able to save the file to my local app storage or to external private app storage using the…
CybeX
  • 2,060
  • 3
  • 48
  • 115
2
votes
1 answer

Sharing a cache file using FileProvider not attaching the file

I have a file in cache that I have verified does exist (I can read it and print it out). In this particular instance it is a .csv file. I get the chooser UI to show up, but the file never gets attached to email for example. Can anyone spot what I am…
user443654
  • 821
  • 1
  • 7
  • 21
2
votes
0 answers

Couldn't find meta-data for provider with authority com.example.android.provider

My application keeps crashing and I get this error: java.lang.IllegalArgumentException: Couldn't find meta-data for provider with authority com.example.android.provider This is the code that's causing the error. Specifically, the photoURI…
Bert Hanz
  • 417
  • 1
  • 7
  • 16
2
votes
1 answer

Unable to share Image using FIle Provider java.lang.SecurityException: Permission Denial: reading androidx.core.content.FileProvider uri

java.lang.SecurityException: Permission Denial: reading androidx.core.content.FileProvider uri content://com.jjdj.jdjjd.jdjjdj/sdcard1/storage/emulated/0/Pictures/Paintings/Painting_440.png from pid=27901, uid=1000 requires the provider be…
Chetan Joshi
  • 5,582
  • 4
  • 30
  • 43
2
votes
0 answers

Opening APK File From Within App For Automatic App Update - FileProvider Android - Firebase Storage

I am attempting to check a FirebaseStorage bucket for a new APK file, if there is a new version, download it, and then open the file to automatically start the installation. Downloading the file is easy, but I cannot seem to get FileProvider to work…
2
votes
0 answers

Getting "Failed to find configured root that contains /data/data/" exception Android

I am trying to share a screenshot of my activity. I am creating a bitmap like this fun createImageToShare(): Bitmap { val b = Bitmap.createBitmap( recyclerViewGroups.getWidth(), …
2
votes
1 answer

File Provider Exception : Failed to find configured root that contains

I am trying to capture Image using camera Intent and send it to server. I have followed the official doc https://developer.android.com/training/camera/photobasics But getting exception while using FileProvider to get the Uri from the filepath. I am…
Saket Mayank
  • 55
  • 1
  • 16
2
votes
2 answers

Couldn't find meta-data for provider with authority com.scanlibrary.provider

I have imported the scanlibrary module in my app. This module has its own Manifest file with FileProvider. This is the directory structure: Below is my code to open the camera, and the Manifest files. scanlibrary code to open camera and capture…