android-fileprovider

Permission Denial with File Provider through intent

泪湿孤枕 提交于 2020-02-24 07:49:37
问题 I am attempting send a bitmap from the cache directory of my app to the text messaging app. I am using file provider to grant temporary permission to the application that handles the intent. When I try to send the intent and I select the default android text messaging app from the intent chooser my message app crashes and I get this error. I tried selecting other applications from the intent chooser such as email and other messaging apps and it seemed to work fine, only crashes with the

Content uri crashes camera on Android KitKat

喜夏-厌秋 提交于 2020-01-29 05:39:04
问题 I run into problem while using content uri and FileProvider on Android API 19 (Kitkat). Here's code that I use to open camera on device and record a video: File file = new File(pathname); Uri fileUri = FileProvider.getUriForFile(this, AUTHORITY_STRING, file); Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); startActivityForResult(intent, requestCode); I've tested this code on API's 23-24 and it works just fine, but on API 19

Android Java : How to open a downloaded file using FileProvider in another App

限于喜欢 提交于 2020-01-17 04:36:06
问题 I have the following setup, but when opening the file in third party app, the file is not being found. After downloading a file(In bytes), I store it. public File storeFile(byte[] b, String ref) throws IOException { String path = String.valueOf(ref).replaceAll("/+", "_"); final File f = new File(A.getDir(path, Context.MODE_PRIVATE), "downloads"); FileOutputStream out = new FileOutputStream(f); out.write(b); out.flush(); out.close(); return f; } Then try to read it and open it. try { Uri uri =

Video capturing crash on Samsung android 5 with FileProvider

给你一囗甜甜゛ 提交于 2020-01-14 05:45:08
问题 Model: Samsung SM-G900F (Android 5.0) Code to launch camera: File file = new File(getExternalFilesDir(null),"video.mp4"); Uri uri = FileProvider.getUriForFile(this, "example.com.myapplication.fileprovider", file); final Intent takePictureIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, uri); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { takePictureIntent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION| Intent.FLAG_GRANT

Picking an image file from Gallery using FileProvider

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-13 07:42:10
问题 Compiling for Android N I've faced an issue of FileProvider . I need to let user to pick image from gallery/take picture with camera then crop it to square. I've managed to implement a FileProvider for taking image with camera, but I have serious problem with picking image from gallery. The problem is that in the gallery there are lot of files from different places and I've got the Exception for example: java.lang.IllegalArgumentException: Failed to find configured root that contains /storage

Getting IllegalArgumentException while capturing photo from Camera

让人想犯罪 __ 提交于 2020-01-06 06:56:34
问题 In my project I am using FileProvider.getUriForFile with given provider_paths.xml file: <?xml version="1.0" encoding="utf-8"?> <paths> <external-files-path name="StrengGeheim" path="/" /> </paths> This I added in my AndroidManifest.xml inside tag: <provider android:name="android.support.v4.content.FileProvider" android:authorities="${applicationId}.provider" android:exported="false" android:grantUriPermissions="true"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android

Android Share Multiple Images with Other Apps

落爺英雄遲暮 提交于 2020-01-06 05:30:10
问题 I'm attempting to use the native Android share functionality to share a set of images I retrieved using Glide. So any app that is compatible with the images will show up in Android's share menu. I created a method that gets invoked when share is clicked. private void onShareClicked() { GlideUrl glideUrl = new GlideUrl(url1, new LazyHeaders.Builder().addHeader("x-auth-token", mToken).build()); FutureTarget<File> image1 = mGlide.load(glideUrl).downloadOnly(SIZE_ORIGINAL, SIZE_ORIGINAL);

Content URI passed in EXTRA_STREAM appears to “To:” email field

牧云@^-^@ 提交于 2020-01-01 04:36:45
问题 I am creating a file in the cache directory that I'd like to share with others (via Gmail / WhatsApp etc). I am able to do this using FileProvider, and it works OK for WhatsApp. When choosing to share on Gmail the photo is correctly attached, but the Uri that I pass via Intent.EXTRA_STREAM also ends up being parsed by Gmail as an address in the "To:" field of the newly composed email, along with the address(es) that I pass via Intent.EXTRA_EMAIL. So the user is required to delete the bogus

Android Fileprovider: IllegalArgumentException: Failed to find configured root that contains

依然范特西╮ 提交于 2020-01-01 04:12:05
问题 I have a question about the android FileProvider. I want to save a pdf document and open it with a default program. I don´t want to save it in external Storage. After I´ve successfully saved the pdf to the FilesDirectory/export/temp.pdf, I´ve tried to generate an URI by using FileProvider.getUriForFile(). File path = new File(getFilesDir(), "export"); File pdf = new File(path + File.separator + "temp.pdf"); pdf.getParentFile().mkdirs(); if (!pdf.exists()) pdf.createNewFile(); Uri uri =

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

♀尐吖头ヾ 提交于 2019-12-29 08:07:51
问题 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 Nougat) or above, the above code will cause a crash, caused by FileUriExposedException (written about it here, and an example solution for opening an APK file can be found here) . This actually worked for me fine, using below code: File apkFile = new