How to get full access to files in external storage Android 11?

  android, android-ndk, android-storage, c++, kotlin

In Android 11, the getExternalStorageDirectory method that returns the path to external memory is deprecated. Instead, new APIs appeared for working with specific public folders or application folder.
But for a work task, I need to work with folders and files located at the root of external memory. I haven’t found an example of a new API that allows this. In the Google documentation, in fact, only how to get permission (via ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION) is not a problem. In addition to working with files from Kotlin, I also need to interact with files from C++. There are no problems with the deprecated API, there you can get full paths to files and do whatever you want with them. But what about the new APIs? Or just use the old API, hoping that it won’t be released in the next versions?

PS The application will not go to the market, so I can get any permissions and do whatever I want 🙂

Source: Windows Questions C++

LEAVE A COMMENT