Hello @Axiixa ,
Welcome to our Microsoft Q&A platform!
access my apps' legacy files in Environment.ExternalStorageDirectory in android 11 & 12
The Environment.ExternalStorageDirectory
is deprecated since Android API 29. Apps target Android 10 and higher are given scoped access into external storage. In this case, try using getExternalFilesDir()
method or media store api to store the file.
Or you could include MANAGE_EXTERNAL_STORAGE
permission for your application to access the external storage.
Here is the related doc, you could refer to it.
https://developer.android.com/about/versions/10/privacy/changes#scoped-storage
https://developer.android.com/training/data-storage#permissions
Best Regards,
Jarvan Zhang
If the response is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.