android-fileprovider

Retrieving Content Uri using File Provider fails

牧云@^-^@ 提交于 2021-01-28 14:13:27
问题 I have spent days reading the docs and following various tutorials for this but I am getting errors whatever I do. I am trying to save an image in Internal Storage and then convert it to a content Uri so that I can use the system crop and resize function. If anyone could spot where my code is wrong I would be very grateful: Main Activity: new Thread(() -> { try { String temp = "temp"; //Convert bitmap to byte array ByteArrayOutputStream bos = new ByteArrayOutputStream(); bitmap.compress

File from FileProvider can't be viewed

冷暖自知 提交于 2021-01-28 09:40:39
问题 I'm struggling with FileProvider. I want to open a video in another app, but no matter what I try every single app says that the video can't be loaded. private void passVideo2(String videoname) { File videoPath = new File(Environment.getExternalStorageDirectory(), "video_folder"); File videoInternalPath = new File(this.getFilesDir(), videoname); File newFile = new File(videoPath, videoname); Uri uri = FileProvider.getUriForFile(this, "com.example.provider", newFile); Intent viewIntent = new

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

北城以北 提交于 2020-06-28 03:55:16
问题 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 old versions. I don't know why i’m having this problem with 29 API. I have used all the solutions related to grantUriPermission(), as you can see in my method: private fun shareInEmail() { val filename = "Avoir+$timeStamp.jpg" val filelocation =

android.support.v4.content.FileProvider not found

时间秒杀一切 提交于 2020-06-24 08:08:21
问题 I am trying to upgrade a working old app to support Android API 26, and one of the thing I need to use is android.support.v4.content.FileProvider - but it was not found. <provider android:name="android.support.v4.content.FileProvider" android:authorities="${applicationId}.fileprovider" android:exported="false" android:grantUriPermissions="true"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" /> </provider> Due to the early Android build, the

Permission Denial while sharing file with FileProvider

元气小坏坏 提交于 2020-06-11 04:04:26
问题 I am trying to share file with FileProvider. I checked that file is shared properly with apps like gmail, google drive etc. Even though following exception is thrown: 2019-08-28 11:43:03.169 12573-12595/com.example.name E/DatabaseUtils: Writing exception to parcel java.lang.SecurityException: Permission Denial: reading androidx.core.content.FileProvider uri content://com.example.name.provider/external_files/Android/data/com.example.name/files/allergy_report.pdf from pid=6005, uid=1000

Access and share file under Picture folder in Internal/External Storage Android Q

时间秒杀一切 提交于 2020-04-17 22:18:09
问题 Many breaking changes happen in Android Q when it comes to storage management and one of my feature in the app is to allow user to take a shot in a View like CardView item, create a Bitmap of it and save that to mass storage of the device. Once saving is done it will then trigger an Intent.ACTION_SEND so user can share the recently save image with some description to social apps and compose a email with GMail. This code snippet works fine. try { //Get primary storage status String state =

Work with encrypted file and provide them with FileProvider

拟墨画扇 提交于 2020-03-05 03:32:26
问题 In my Android app, I need to expose some file from a FileProvider. Without encryption, it's quite easy: I simply add the FileProvider to manifest.xml . <provider android:name="androidx.core.content.FileProvider" android:authorities="${applicationId}.provider" android:exported="false" android:grantUriPermissions="true"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/provider_paths" /> </provider> I need to receive some files, encrypt them (storing its