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

Adding multiple file providers in Android application

guys, I am working on an android application for which I need external application dependency(.aar file) library application has its own file provider and my application have its own. library work well when I run it as a separate app but when I…
dev_swat
  • 1,264
  • 1
  • 12
  • 26
8
votes
1 answer

Gmail error "Unable to attach file"

I am trying to email PDF file using Gmail. However, Gmail app is showing toast: Unable to attach file PDF file is not-corrupt and is generated successfully in application's cache directory. Code: (Please comment below if you need code in Java.): …
8
votes
2 answers

FileProvider.getUriForFile returns NullPointerException

I'm trying to write my first android app, which will involve taking a picture and doing stuff with it. I've put together some code after looking at several tutorials online but am getting the following NullPointerException whenever the button is…
A.A.
  • 402
  • 1
  • 4
  • 19
8
votes
5 answers

FileProvider and secondary external storage

How can I serve files from the SECONDARY external storage using the FileProvider? The current implementation of the FileProvider handles only the first directory returned by ContextCompat.getExternalFilesDirs ... } else if…
artkoenig
  • 7,117
  • 2
  • 40
  • 61
8
votes
2 answers

Getting the Absolute File Path from Content URI for searched images

I am trying to share images from other applications to my application using implicit intent ACTION_SEND. While sharing search images from chrome browser, app receives intent with a Content URI like…
Priya Mall
  • 581
  • 1
  • 10
  • 22
8
votes
5 answers

Android FileProvider for ext sdcard

I'm using FileProvider for my internal files to be exposed to the Gallery for example. To make it more uniform, I also put my my external files into the provider (via external-path) but for the files in removable sd card it doesn't work. Saying…
stdout
  • 2,471
  • 2
  • 31
  • 40
7
votes
2 answers

Permission Denial: reading androidx.core.content.FileProvider trying to share a video file

There have been several posts about this that I have reviewed and I've tried a half a dozen of the proposed solutions. I have something almost identical to this working without throwing an exception in another app I wrote but I'm just not able to…
user443654
  • 821
  • 1
  • 7
  • 21
7
votes
2 answers

How to get uri of captured photo?

What do I want to achieve? I want to get URI of the captured image and save it on Firebase. What did I try? First of all I needed to open the camera. Below how I did it: Intent cameraIntent = new…
neo
  • 1,314
  • 2
  • 14
  • 34
7
votes
2 answers

FileProvider authority in android library project

In a library project I'm using a FileProvider with my libraries applicationId as its authority. Now when somebody uses this library e.g. in two flavors of his app, the second one will not install because of conflicting FileProviders. Goal Being able…
Jonas
  • 1,432
  • 3
  • 20
  • 27
7
votes
2 answers

FileProvider from getFilesDir()

What is the corresponding XML for Context.getFilesDir()? My current XML: File creation: File video = new File(getFilesDir(),…
jelic98
  • 723
  • 1
  • 12
  • 28
7
votes
2 answers

FileProvider path creation and BitmapFactory.decodefile problems in Android

I am trying to use BitmapFactory.decodefile() in order to create a scaled down version of a camera photo and set it to an imageview in my framelayout. Am following the following instructions from Android…
i_o
  • 777
  • 9
  • 25
7
votes
1 answer

How to especific path external-path for apps with dynamic applicationId

I'm using FileProvider in my app, when I take a picture from the app is stored there. also my app have a different application id for debug and release builds com.rkmax.myapp com.rkmax.myapp.debug I have defined my file provider like…
rkmax
  • 17,633
  • 23
  • 91
  • 176
7
votes
2 answers

Sharing images from internal storage using FileProvider

I have some files stored in my application's internal storage that I would like to open in an external application (sending an image to the Gallery for viewing, for example.) I've set up a FileProvider to do so. From…
sigmabeta
  • 1,174
  • 1
  • 12
  • 28
6
votes
0 answers

What is the right way to install APK for each Android version?

I'm making an APK Install app and I've been through a lot. Especially, versioning. to do that, i looked up some posting and StackOverFlow. but All the postings make me more confused now. So, What is the right way? first of all, please check my code…
6
votes
1 answer

Chromebook : can't attach file to e-mail

I have a (big) problem on chromebook with a functionnality working fine on "classic" android devices (phones, tablets). I try to send an e-mail with an attached file. Here's a portion of code (api>=23). Intent email = new…
kodaski
  • 136
  • 4