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

Android "storing" and "reusing" obtained URIs

My app collects media through an ACTION_PICK Intent to get android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI type of content. When I retrieve the URI of the content I want, It works great and I can view it with: val intent =…
sgtpotatoe
  • 340
  • 6
  • 17
4
votes
0 answers

How to share video from a url on my app to whatsapp?

I have a video that plays on my application from a server. I want to make it possible to share the video to WhatsApp when the shared button is clicked. I understand that I have to download load the video to the device storage before sharing through…
4
votes
3 answers

How to convert a string to a URI without throwing exceptions

I had to convert a Uri to a string so that I could serialize that Uri. Intent openFileIntent = new…
4
votes
3 answers

Get PDF from MediaStore after receiving "content://" Uri in onActivityResult?

I start an ACTION_GET_CONTENT intent in order to pick a PDF: override fun routeToFilePicker() { val intent = Intent() intent.type = MediaType.PDF.toString() intent.action = Intent.ACTION_GET_CONTENT activity.startActivityForResult( …
Joel Broström
  • 3,530
  • 1
  • 34
  • 61
4
votes
2 answers

How to convert a view or layout to image and share using intent?

I am trying to convert a card view into image and share it through whats app. I am using file provider as the test device's version is higher. So when I am trying to create a file it is giving me an exception e = {IllegalArgumentException@7727}…
Sid
  • 2,792
  • 9
  • 55
  • 111
4
votes
1 answer

java.lang.SecurityException: Permission Denial: opening provider com.estrongs.android.pop.app.FileContentProvider

Caused by java.lang.SecurityException: Permission Denial: opening provider com.estrongs.android.pop.app.FileContentProvider from ProcessRecord{341eeb8 5431:xx.xxxx.xxxx/u0a289} (pid=5431, uid=10289) that is not exported from uid 10188 at…
4
votes
0 answers

How to grant persistable uri permission to a Uri received from Intent.ACTION_GET_CONTENT?

On my app I have a function to attach files and contacts and other things. I use an Intent to pick multiple files from a picker. When I use Intent.ACTION_GET_CONTENT... I can pick files from many places like Google Photos, or Music Apps, or…
4
votes
2 answers

Flutter share image intent

I am trying to share an image via classic Intent. I have added the following items: file_paths.xml: Manifest:
Robert J.
  • 2,631
  • 8
  • 32
  • 59
4
votes
0 answers

How to get File from FileProvider URI?

I want to record a video, store it in internal storage and access the file. FileProvider creates an URI for the camera intent to record a video: File path = new File(this.getFilesDir(), "shared"); File file = new File(path,…
Manuel
  • 14,274
  • 6
  • 57
  • 130
4
votes
2 answers

Opening PDF file using Android intent

So here's the Scenario: I am downloading a PDF from network and saving it in /0/Download/NSIT - Notices/"fileName".pdf Now sending Intent like this: private void openPDF(String fileName) { Log.d(TAG, "openPDF: called"); Intent intent = new…
4
votes
0 answers

Cannot open word file in edit mode in android using intent

Here is the intent I use to open a word file: Intent intent = new Intent(); intent.setAction(Intent.ACTION_EDIT); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setDataAndType(fileUri,…
Misagh Emamverdi
  • 3,654
  • 5
  • 33
  • 57
4
votes
1 answer

Error:No resource found that matches the given name (at 'resource' with value '@xml/provider_paths')

I was developing an app for google service text detection, and encounter a problem for sharing files using File_PROVIDER. AndroidManifest.xml:
Gene Xu
  • 609
  • 1
  • 8
  • 18
4
votes
3 answers

android.os.FileUriExposedException being caused in Oreo (only!)

From the Google Play Console, I can see that this exception is only happening on devices with Android 8.0+. android.os.FileUriExposedException: at android.os.StrictMode.onFileUriExposed (StrictMode.java:1975) at android.net.Uri.checkFileUriExposed…
Armai
  • 162
  • 1
  • 1
  • 10
4
votes
0 answers

How to open a directory(folder) in Android using file provider?

I want to open the downloads folder of external files directory by most of the file manager applications. For this I tried this: Intent intent = new Intent(Intent.ACTION_GET_CONTENT); Uri uri = FileProvider.getUriForFile(this,…
4
votes
0 answers

Unable to share image to Messaging app with FileProvider

Sharing an image to Gmail works fine. When trying to share to default "Messages" app on Nexus S, the "You can't add this picture to your message" toast is displayed and image is not attached to a message. Android version 4.1.2. Here is my…
AndrewS
  • 2,679
  • 2
  • 14
  • 23