0

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 :)

Snowy Owl
  • 151
  • 1
  • 8
  • 1
    Does this answer your question? [Android 11 Scoped storage permissions](https://stackoverflow.com/questions/62782648/android-11-scoped-storage-permissions) – DrHowdyDoo Dec 25 '21 at 12:24
  • 1
    You can safely use getExternalStorageDirectory() as it is undeprecated again. – blackapps Dec 25 '21 at 15:52
  • @blackapps but [google documentation](https://developer.android.com/reference/android/os/Environment#getExternalStorageDirectory()) says this method is deprecated since API 29 – Snowy Owl Dec 25 '21 at 19:26
  • @DrHowdyDoo I have met this question. They are discussing the issue of obtaining permissions. There is no problem with that, I got everything. But there are no examples of accessing the external memory root using the new API. And so that later it could somehow be used from the NDK. There is an example of using `getExternalStorageDirectory()`, but it is deprecated in the documentation. If there is no method besides it, then I have to use it. So far, it works. – Snowy Owl Dec 25 '21 at 19:38

0 Answers0