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

Permission Denial: Security Exception while sharing file with FileProvider Android 11 phone

I am getting below exception on the Android 11 device but able to share those files in the email without any issue. Java:Lang:SecurityException: Permission Denial:Reading androidx.core.content.FileProvider.uri…
3
votes
2 answers

Android Intent to Gmail not attaching file by FileProvider "Unable to attach file"

When attaching file to Gmail I briefly see the file in attachments and then get Toast saying "Unable to attach file" and then it's gone. It works fine with Drive, Discord and other apps.. Also the file stays in attachments on emulator but when I…
3
votes
1 answer

Permission Denial: Couln't attach file, File requires the provider be exported, or grantUriPermission(), API 29

I have been trying to share one image from external storage and it is not working in API 29. the error message is: Permission denial, the file requires the provider be exported, or grantUriPermission(). when I google it it seems to be a problem to…
3
votes
1 answer

Get filenames for results returned from ActivityResultContracts.OpenMultipleDocuments() contract

In my Android app, I launch a document chooser so the user can import some documents into my app: this.intentlauncherchoosedoc = this.registerForActivityResult( new ActivityResultContracts.OpenMultipleDocuments(), new…
Kenny Wyland
  • 20,844
  • 26
  • 117
  • 229
3
votes
0 answers

Edit pdf with external application does not overwrite existing file

I have a problem related to this. I want to use "Adobe Acrobat" or "Samsung Write on PDF" to edit an existing pdf file from my app. When opened from "Archive" application, files are overwritten but when I use my app they save on a different folder.…
backspace83
  • 342
  • 4
  • 10
3
votes
1 answer

Why FileProvider not working with Broadcast?

I using FileProvider to generate an uri, then I want to pass it to BroadcastReceiver in another App, but I only get Exception of "Permission Denial: opening provider", how can I fix it? There's two app: Sender & Receiver, then Sender want to share a…
3
votes
0 answers

Error in Firemonkey standard TakePhotoFromCamera action on Android API 24+

I'm working on an Android application in Delphi 10.1 Berlin Update 2, which uses the standard TTakePhotoFromCameraAction. If I set the Target SDK to 24 or higher, this action stops working and shows an error…
3
votes
2 answers

FileProvider: Installing APK. There was an error parsing the package.

I have an APK-File in /storage/emulated/0/Download/app-debug.apk. I want to install this file by FileProvider because I am using Android N. When I try to launch the intent logcat doesn't show any error but I receive following message on my phone:…
MSeiz5
  • 182
  • 1
  • 9
  • 28
3
votes
1 answer

Android 8 - FileProvider Uri opens a blank screen

I have the following code and it's only working on Android 7 and below. Android 8 only shows a blank file, I opened the pdf manually and works fine. I have the following code and this is the repo: private static final String…
Ricardo
  • 7,921
  • 14
  • 64
  • 111
3
votes
2 answers

I can't save file to gallery after taking photo by camera by using the FileProvider for Android 7.1.1

I build my app with FileProvider and I want to save the image after I take it. But I can't find the image in the gallery. I found these source codes from the Android Studio tutorial. I don't know what is the problem. I tried use debugger and I…
3
votes
1 answer

Opening local files in edit mode with Microsoft Office mobile app using Android

I am developing an Android app from which I want to launch MS office apps to view and edit office files. For example, open a docx stored locally in the device for editing in MS-Word mobile app. Previously we were opening such file with a file URI…
Jorge
  • 141
  • 1
  • 9
3
votes
0 answers

Can't get content URI for file in external-files-path on some devices

My application uses FileProvider to get a content URI for a file created in a subdirectory on the external storage and grant permissions to the selected camera application so it can save a photo to that file. It works like a charm on every device…
Andrzej Zabost
  • 1,387
  • 11
  • 26
3
votes
3 answers

Can't open external storage file in Android N using FileProvider

I am having trouble opening file inside external storage with Android N. File path file:///storage/emulated/0/Download/SamplePDFFile_5mb.pdf Initial implementation Perfectly work on Android version lower than 7 File file = new File…
3
votes
0 answers

Open downloaded apk file programatically in Android Version 24, Nougat

Need to install the apk which is downloaded by download manager. Installation means, showing up the installation page. This I want to achieve in Android 24 API, Nougat. I created the provider_path named file in xml folder of res. And added the…
3
votes
2 answers

How to share current app's APK (or of other installed apps) using the new FileProvider?

Background In the past, it was easy to share an APK file with any app you wanted, using a simple command: startActivity(new Intent(Intent.ACTION_SEND,Uri.fromFile(filePath)).setType("*/*")); The problem If your app targets Android API 24 (Android…
android developer
  • 114,585
  • 152
  • 739
  • 1,270