Questions tagged [android-fileprovider]

1

votes
2

answer
194

Views

Sharing image - Failed to find configured root that contains

I can share files those added from other folders except camera. I am getting following exception in Lenova K3 Note. java.lang.IllegalArgumentException: Failed to find configured root that contains /storage/9016-4EF8/DCIM/Camera/IMG_20180317_111252.jpg file_paths.xml
Gunaseelan
1

votes
2

answer
239

Views

Android Intent FileProvider “Permision denied” to open KML file in Google Earth?

Before Android Nougat ( 7.0 ) it was easy to create a KML file in external storage and launch an intent with the file uri and Google Earth mime type for KML. Google Earth app magically opened and flew down to my KML. On Android Nougat ( 7.0 ) you must use a FileProvider with the intent. You must ad...
Ed of the Mountain
1

votes
0

answer
208

Views

FileProvider can't open file

I'm struggling with FileProvider. Even following this Google documentation and this post that is pretty much the same as my problem. So I'm trying to open a pdf file from external storage. The directory is 'Download/nst'. I provided the path in file_paths.xml This is how I get pdf path: private File...
learner
1

votes
0

answer
165

Views

Can not send file using FileProvider.getUriForFile()

I know that i have asked related question many times, but i think i have found a close solution. When I use Uri.fromFile(), it works. But when i do it with FileProvider.getUriForFile(), it opens the selection page(with which i want to send the file,like bluetooth,wifi-direct,etc), but when i destina...
Ragib
1

votes
0

answer
56

Views

Captured image using camera but bitmap gets blank response

I want to fetch Bitmap from mCurrentPath String which has correct path of image store in gallery.Even images are visible in gallery but still bitmap is not getting created btnClick.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent cameraIntent = new Int...
siddhesh
1

votes
2

answer
245

Views

java.lang.IllegalArgumentException: Failed to find configured root that contains /data/data/

I am trying to use ACTION_IMAGE_CAPTURE intent to capture an image and then save it to /data/data/**/app_profile/profile_picture.jpg I call the intent with the following code: val cw = ContextWrapper([email protected]) val dir:File = cw.getDir('profile', Context.MODE_PRIVATE) outp...
Shashwat
1

votes
0

answer
183

Views

java.lang.IllegalArgumentException: Failed to find configured root that contains Nested files in assets folder

I need to share pdf files from my assets folder. The pdf file changes based on language. Assets structure is like - assets folder countryA languageA pdfA languageB pdfB countryB languageA pdfA languageC pdfC My Android manifest file - When the following code runs FileProvider.getUriForFile(getActiv...
D-D
1

votes
0

answer
36

Views

sharing database file

I am trying to share database file located in /data/data/appid/databases/data.db by fileProvider But I get following error java.lang.IllegalArgumentException: Failed to find configured root that contains /data/data/ my file_provider_paths.xml is as follow:
Mani devs
1

votes
1

answer
273

Views

Writing to the external storage is not working anymore on Nougat

I wrote a little app to learn how to write and read files. It worked, but now I can't write files any more.. 1.I added to Manifest: 2.In MainActivity // permissions array: final String[] permissions = new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.WRITE_EXTERNAL_STORAGE,...
Marco
1

votes
0

answer
42

Views

While selecting Recent files getting null value content provider

Code is working fine when selecting file / image from Gallary, file manager, download folder. i m able to get file path from URI using content provider. but while selecting recent files in naugat Android API version 7.0 and above content provider return null. I already spend two days on this and Now...
Ashu Kumar
1

votes
0

answer
79

Views

How does FileProvider choose/differentiate provider paths in provider_path.xml?

I got to use FileProvider in order to install an apk. Everything works well now but I don't really understand the behaviour FileProvider follows in order to choose the correct path defined inside the provider_paths.xml. Here's my code: Manifest.xml main_activity.java if (Build.VERSION.SDK_INT < Buil...
mantc_sdr
1

votes
0

answer
74

Views

Can't get file path by uri?

My app is A, a player app, now i want to get a video path by uri which is provided by another app B,below is the provider of app B: My app A can get the uri provided by app B, but i can't get the real path from the uri using code below: Cursor cursor = context.getContentResolver() .query(uri, new St...
xiangxu chen
1

votes
0

answer
20

Views

Is it possible to provide a zipped file in FileProvider, of a file that doesn't really exist?

Background I wish to be able to share some files (via a send intent) as a single compressed file, via FileProvider. For the intent, all you do is add the ArrayList as a parameter, as such: ArrayList uris = MyFileProvider.prepareFileProviderFiles(...) sharingIntent.putParcelableArrayListExtra(Intent...
android developer
1

votes
1

answer
28

Views

Create a File Provider to the standard Download Directory on phone to send a PDF file via an Intent

When I pass it to a PDF viewer - it errors out and states it cannot open the file. GoogleViewer prints the following in the log 2019-01-24 15:36:55.390 23756-23833/? V/LoadDocumentTask: Finish task: LoadDocumentTask(Display Data [PDF : mypdf.pdf] +ContentOpenable, uri: content://com.example.gregm.pd...
morty346
1

votes
0

answer
37

Views

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 Contacts. But the permission to the result Uri expires when...
Oscar Méndez
1

votes
0

answer
83

Views

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 file to Receiver, but Receiver don't need an UI, i...
Cmd
1

votes
0

answer
77

Views

FileProvider throws exception for some Android 8 users

I've looked at several examples like File provider throws exception but I can't seem to get my file provider to work for everyone. I've tested it myself on Android 8 and it works fine, but for some users it throws IllegalArgumentException. It looks like: Manifest Paths file Sharing: File path = cont...
Mackan
1

votes
2

answer
287

Views

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 android.os.Parcel.readException(Parcel.java:1686) at android.o...
Maulik Santoki
1

votes
1

answer
54

Views

What is the best practice for getting a content-uri for a file in Xamarin.Android?

I have already registered a FileProvider in my manifest via: Now, I want to get an URI for that file to pass to another app to open the file. I tried: Intent viewIntent = new Intent(Intent.ActionView); Java.IO.File document = new Java.IO.File(filePath); Android.Net.Uri contentUri = FileProvider.GetU...
Christian
1

votes
1

answer
21

Views

Sharing intent file path to file manager to open that path

I was trying to open file manager by passing the path of the folder that i specifically want to open. But the app keeps crashing. below i hava attached the code, manifest file and the crash log. If you are able to solve the problem do comment your suggestions. CODE: Intent intent = new Intent(Intent...
Karthick Kumar
0

votes
0

answer
6

Views

How to get URI from file with FileProvider

How can I get URI from a file with a dynamic folder in the path? java.lang.IllegalArgumentException: Failed to find configured root that contains /storage/emulated/0/AppName/155522864927/media/1555228649276.mp4 It works fine only if I set hardcoded path
Dreamfire
1

votes
0

answer
15

Views

Getting FileNotFoundException When Trying to Share MP3 Through Implicit Intent Using Using FileProvider

I'm trying to share an MP3 file from my android's internal files (the root of which is getFilesDir()) to another application using an ACTION_VIEW implicit intent. The MP3 file was originally stored in my app's /raw folder, but I copied it over to my app's internal files. I have verified that the fi...
Rvby1
1

votes
1

answer
2.8k

Views

Android and FileProvider and getting patth from URI

I have some problems which are puzzling to me. I seem unable to get the correct real path for a file based Uri. This is the code with end result variable values shown below it: String shareFile_Path = ''; String contentURI_Path_Real = ''; String contentURI_Path_Simple = ''; Uri m...
Tom
1

votes
1

answer
119

Views

StreamProvider - getExternalFilesDir - is there a syntax for multiple externals? MicroSD card on Android 4.4

I have a modern Android 4.4 device - LG L34C that comes with KitKat 4.4 Relative to the https://github.com/commonsguy/cwac-provider library - I see that there is mention of getExternalFilesDir - but not the plural version. My testing of getExternalFilesDirs() shows that the returned array index has...
1

votes
1

answer
1.6k

Views

Trying to open pdf file Android

I'm facing this error: E/AndroidRuntime: java.lang.IllegalArgumentException: Failed to find configured root that contains /data/data/com.mobgen.androidinterviewtest/files/LaFerrari.pdf E/AndroidRuntime: at android.support.v4.content.FileProvider$SimplePathStrategy.getUriForFile(FileProvider.java...
superkytoz
1

votes
1

answer
444

Views

Stray file path added to email on intent using FileProvider attachment

I've got an intent that uses FileProvider to read from internal file storage for my app to send a file via email (or similar apps). The code works great everywhere apparently except for Gmail, which strangely adds a version of the provider path itself to the list of addressees of the email. This is...
k3davis
1

votes
1

answer
475

Views

In Jellybean, camera intent returns RESULT.CANCELLED when using FileProvider

I followed the official docs to execute camera intent in my app. It works in 5.0+ devices but not in Jellybean. In 4.1(JB) to 4.4 (KK), native camera app shows 'Unfortunately, camera has stopped error' after capturing image. In my app's onActivityResult, the result returned is RESULT.CANCELLED alwa...
Timmy Simons
1

votes
1

answer
1.1k

Views

Android FileProvider Causing Camera/Gallery to Crash at Random

GoodDay. Using help gotten from the developers guide, I was able to get my app's photo capture working. The activity usually involves capturing one or more images(something like in photogrid camera collage app). It works most of the time, and on most devices, except on my own device(Android 5.0.1)....
Mofe-hendy Ejegi
1

votes
3

answer
1.6k

Views

Android getUriForFile IllegalArgumentException

My code for sending a file with an Intent doesn't work with all file sources and I could not find the solution yet: My app is registered for opening files, so when I select a file in ES File Explorer the intent looks like this: intent->mData->uriString=/storage/emulated/0/backups/apps/NextGenEndPoin...
David
1

votes
1

answer
2k

Views

FileProvider Xamarin not displaying file

I’m trying to display a PDF file using a file provider. However when the PDF reader opens it does not contain the content of the file. The file is stored in the internal storage of the application within the files folder. Manifest: File_paths: pdfViewRenderer.cs: string libraryPath = Environmen...
Simon
1

votes
1

answer
3.3k

Views

Android: URI for file on external storage using FileProvider

I've ported my application to android API 24. My application downloads file to a folder called test in external storage, and after download it will open the download file. As an example consider file with address /storage/emulated/0/test/video.mp4. Its address is created usign this syntax: File fil...
VSB
1

votes
1

answer
358

Views

Error extending FileProvider

I need to use 2 file providers for my app. I have tried the quick fix suggested in this answer: https://stackoverflow.com/a/42989182/7952427 But the app crashes. I know that the second provider is causing this exception/crash because when i remove it, the app doesn't crash anymore. In Manifest: Th...
S. Lopes
1

votes
1

answer
411

Views

Can't send file correct URI using FileProvider

I'm creating a file with this path File file = new File(getExternalFilesDir(null) + '/package.apk'); then I'm trying to send it using this code Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(FileProvider.getUriForFile(UpdateActivity.this, getPackageName() + '.provider', file),...
Amir_P
1

votes
1

answer
163

Views

How to make a FileProvider serve drawables?

The FileProvider documentation lists these locations as places where it can serve files from: the files/ subdirectory of an app's internal storage area the cache subdirectory of an app's internal storage area the root of the external storage area the root of an app's external storage area the root...
albert c braun
1

votes
1

answer
412

Views

app crashes on trying to open a pdf file from assets

i'm trying to view a pdf file that exists in the assets folder using FileProvider and when the app runs it crashes, the error displayed is java.lang.IllegalArgumentException: Failed to find configured root that contains /file:/android_asset/sample_books/a_walk_among_trees.pdf my code for opening the...
Mohamed Akl
1

votes
2

answer
456

Views

Not able to Open PDF file by using Adobe in Nougat

I have research a lot but still I am not getting proper solution to open downloaded pdf in Adobe reader. By using below code pdf gets opened using google doc app but not by adobe. To download pdf from Url URL url = new URL(f_url[0]); try { HttpURLConnection urlConnection = (HttpURLConnection) url.op...
priyanka kamthe
1

votes
2

answer
517

Views

java.lang.IllegalArgumentException: Failed to find configured root that contains “insert app directory path here”

I am opening the camera to capture a image and i followed this tutorial. Error stated in the title comes when i tried to create different flavor builds configuration for my app. This is my meta data xml resource file named file_paths for File Provider path configuration - I am setting it in manifes...
Devansh Kumar
1

votes
1

answer
162

Views

Capture image with Scoped Directory Access on Nougat

I am trying to take image from camera with Scoped Directory Access, but it gives me following exception as follows, java.io.IOException: Permission denied 09-22 22:43:40.556 23767-23767/mp.wall.client W/System.err: at java.io.UnixFileSystem.createFileExclusively0(Native Method) 09-22 22:43:40.55...
Vikram Singh
1

votes
1

answer
1.4k

Views

Sharing documents via intent/Fileprovider

Problem 1: I have a pdf stored in Environment.getExternalStorageDirectory() --> /storage/emulated/0/appname/downloads/sample.pdf I'm sending it using normal way as shown: File iconsStoragePath = Environment.getExternalStorageDirectory(); final String selpath = iconsStoragePath.getAbsolutePath() + '...
Kitty
1

votes
1

answer
280

Views

Is there an alternative to using FileProvider to get a uri for installing Android apk?

So I've run into an issue with uri exposure when trying to install an apk. I have written a library that auto-updates android applications and then installs the new apk with the following code. Uri uri = VersionManagerUtil.getFileDestinationUri(apkDir, mParameters.getPackageName()); Intent intent =...
David Carek

View additional questions