How to populate cache with external SD Card in Android
Please be aware the following changes for API 33 and Android 13:
For Android 13, we can not directly access the path we have to go through the defined path of Android using Environment.getExternalStorage() and for removable memory card we will need to make use of StorageManager to get UUID to refer in the Storage tree..
The sample attached will have the cache path in /Download for both SD card and internal.. If SD card is present it will take SD card /Download … If it's not present it will save at /internalStorage/Download …
https://developer.android.com/about/versions/13/behavior-changes-13#granular-media-permissions As per documentation starting API 33 and Android 13 we can't create files in external storage other than Media, with the above sample you can overcome this limitation with the best practice.