getExternalDirectory

open fun getExternalDirectory(context: Context, folderType: String, name: String): File

Gets the path to a directory on the primary shared/external storage device where the application can place persistent files it owns. These files are internal to the applications, and not typically visible to the user as media.

Please note that this method will neither check if selected directory exists nor whether it is readable or writable.

The operation will be performed on an io thread to adhere to the strict mode policy. The calling thread will be blocked until the operation is complete.

Return

the path to the selected directory.

Parameters

context

the context

folderType

the type of files directory to return. May be null for the root of the files directory or one of the following constants for a subdirectory: DIRECTORY_MUSIC, DIRECTORY_PODCASTS, DIRECTORY_RINGTONES, DIRECTORY_ALARMS, DIRECTORY_NOTIFICATIONS, DIRECTORY_PICTURES, or DIRECTORY_MOVIES.

name

an optional subfolder name within the selected folder type.

See also