scoped-storage

How to handle SAF when I can only handle File or file-path?

落花浮王杯 提交于 2021-02-19 02:43:06
问题 Background Up until Android Q, if we wanted to get information about an APK file, we could use WRITE_EXTERNAL_STORAGE and READ_EXTERNAL_STORAGE to get access to the storage, and then use PackageManager.getPackageArchiveInfo function on the file-path. Similar cases exist, such as using ZipFile class on a compressed file, and probably countless framework APIs and third party libraries. The problem Google announced a huge amount of restrictions recently on Android Q. One of them is called Scoped

Android - accessing files in native C/C++ code with Google Scoped Storage API

拟墨画扇 提交于 2021-02-18 22:26:33
问题 I need to open files by file name in Android apps within native C/C++ code. The native code are 3rd party libraries that I would prefer not to modify, but they often require file name as an argument to read/write files. With the Google's "scoped storage" API and disabling native access to files in Android 10 or later, it's a real problem. One well known solution is to get a file descriptor and use "proc/self/fd/FD_NUMER" trick, like: ParcelFileDescriptor mParcelFileDescriptor = null; String

DownloadManager not working for Android 10 (Q)

喜夏-厌秋 提交于 2021-02-18 06:34:07
问题 I've been beating my head against this issue for quite awhile... I am updating an app that uses DownloadManger to do a simple task like downloading a file to the external storage public directory i.e: Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) Everything works fine here from Android api 19-28. Its when testing on API 29 (Q/10) is where issues occur. Android implemented scoped storage and so deprecated the getExternalStoragePublicDirectory... As a result I

FFmpeg: seeking not possible with file descriptor on Android Q

↘锁芯ラ 提交于 2021-02-06 10:44:13
问题 Given the fact that public file paths will generally not be available in Android Q with scoped storage, I am attempting to figure out how to make my FFmpeg audio decoder work with file descriptors, without copying the file to my app's private directories. We can easily get a file descriptor using the methods described in Android Q privacy changes, and it is possible to open the file descriptor using the pipe protocol as described in Passing a native fd int to FFMPEG from openable URI. However

Write permissions not working - scoped storage Android SDK 30 (aka Android 11)

北战南征 提交于 2021-01-27 20:32:12
问题 Anyone else finding scoped-storage near-impossible to get working? lol. I've been trying to understand how to allow the user to give my app write permissions to a text file outside of the app's folder. (Let's say allow a user to edit the text of a file in their Documents folder). I have the MANAGE_EXTERNAL_STORAGE permission all set up and can confirm that the app has the permission. But still every time I try val fileDescriptor = context.contentResolver.openFileDescriptor(uri, "rwt")?

How to save pdf in scoped storage?

孤街醉人 提交于 2020-07-31 04:36:48
问题 Before the introduction of scoped storage i was using Download Manager to download pdf in my app and get the pdf from getExternalStorageDirectory , but due to scoped storage i can no longer use getExternalStorageDirectory as it is deprecated. I decided to move away from Download Manager as well as it downloads files in public directory and instead use retrofit to download pdf file. I know i can use the requiredLegacyStorage tag in Android Manifest but it wont be applicable to Android 11 so i