Creating a folder in Android External Storage

259 Views Asked by At

I would like to create a directory in /storage/emulated/0/ and a save a file there.Since the "getExternalStorageDir()" & "getExternalPublicStorageDir()" are Depreciated I don't know how to implement it. I have gone through most of the questions and answers but they are all either outdated/open. All I want is a way to access the "storage/emulated/0/" path.

val extStorageDirectory = requireContext().getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS)
val folder = File(extStorageDirectory, "Work Logs")
folder.mkdir()

The above code creates a folder in "/storage/emulated/0/Android/data/com.xxx.xxx/files"

0

There are 0 best solutions below