public class

Environment

extends Object
java.lang.Object
   ↳ android.os.Environment

Class Overview

Provides access to environment variables.

Summary

Constants
String MEDIA_BAD_REMOVAL getExternalStorageState() returns MEDIA_BAD_REMOVAL if the media was removed before it was unmounted.
String MEDIA_CHECKING getExternalStorageState() returns MEDIA_CHECKING if the media is present and being disk-checked
String MEDIA_MOUNTED getExternalStorageState() returns MEDIA_MOUNTED if the media is present and mounted at its mount point with read/write access.
String MEDIA_MOUNTED_READ_ONLY getExternalStorageState() returns MEDIA_MOUNTED_READ_ONLY if the media is present and mounted at its mount point with read only access.
String MEDIA_NOFS getExternalStorageState() returns MEDIA_NOFS if the media is present but is blank or is using an unsupported filesystem
String MEDIA_REMOVED getExternalStorageState() returns MEDIA_REMOVED if the media is not present.
String MEDIA_SHARED getExternalStorageState() returns MEDIA_SHARED if the media is present not mounted, and shared via USB mass storage.
String MEDIA_UNMOUNTABLE getExternalStorageState() returns MEDIA_UNMOUNTABLE if the media is present but cannot be mounted.
String MEDIA_UNMOUNTED getExternalStorageState() returns MEDIA_UNMOUNTED if the media is present but not mounted.
Public Constructors
Environment()
Public Methods
static File getDataDirectory()
Gets the Android data directory.
static File getDownloadCacheDirectory()
Gets the Android Download/Cache content directory.
static File getExternalStorageDirectory()
Gets the Android external storage directory.
static String getExternalStorageState()
Gets the current state of the external storage device.
static File getRootDirectory()
Gets the Android root directory.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String MEDIA_BAD_REMOVAL

Since: API Level 1

getExternalStorageState() returns MEDIA_BAD_REMOVAL if the media was removed before it was unmounted.

Constant Value: "bad_removal"

public static final String MEDIA_CHECKING

Since: API Level 3

getExternalStorageState() returns MEDIA_CHECKING if the media is present and being disk-checked

Constant Value: "checking"

public static final String MEDIA_MOUNTED

Since: API Level 1

getExternalStorageState() returns MEDIA_MOUNTED if the media is present and mounted at its mount point with read/write access.

Constant Value: "mounted"

public static final String MEDIA_MOUNTED_READ_ONLY

Since: API Level 1

getExternalStorageState() returns MEDIA_MOUNTED_READ_ONLY if the media is present and mounted at its mount point with read only access.

Constant Value: "mounted_ro"

public static final String MEDIA_NOFS

Since: API Level 3

getExternalStorageState() returns MEDIA_NOFS if the media is present but is blank or is using an unsupported filesystem

Constant Value: "nofs"

public static final String MEDIA_REMOVED

Since: API Level 1

getExternalStorageState() returns MEDIA_REMOVED if the media is not present.

Constant Value: "removed"

public static final String MEDIA_SHARED

Since: API Level 1

getExternalStorageState() returns MEDIA_SHARED if the media is present not mounted, and shared via USB mass storage.

Constant Value: "shared"

public static final String MEDIA_UNMOUNTABLE

Since: API Level 1

getExternalStorageState() returns MEDIA_UNMOUNTABLE if the media is present but cannot be mounted. Typically this happens if the file system on the media is corrupted.

Constant Value: "unmountable"

public static final String MEDIA_UNMOUNTED

Since: API Level 1

getExternalStorageState() returns MEDIA_UNMOUNTED if the media is present but not mounted.

Constant Value: "unmounted"

Public Constructors

public Environment ()

Since: API Level 1

Public Methods

public static File getDataDirectory ()

Since: API Level 1

Gets the Android data directory.

public static File getDownloadCacheDirectory ()

Since: API Level 1

Gets the Android Download/Cache content directory.

public static File getExternalStorageDirectory ()

Since: API Level 1

Gets the Android external storage directory.

public static String getExternalStorageState ()

Since: API Level 1

Gets the current state of the external storage device.

public static File getRootDirectory ()

Since: API Level 1

Gets the Android root directory.