Save the date! Android Dev Summit is coming to Mountain View, CA on November 7-8, 2018.
added in version 1.0.0
belongs to Maven artifact androidx.core:core:1.1.0-alpha01

EnvironmentCompat

public final class EnvironmentCompat
extends Object

java.lang.Object
   ↳ androidx.core.os.EnvironmentCompat


Helper for accessing features in Environment.

Summary

Constants

String MEDIA_UNKNOWN

Unknown storage state, such as when a path isn't backed by known storage media.

Public methods

static String getStorageState(File path)

Returns the current state of the storage device that provides the given path.

Inherited methods

Constants

MEDIA_UNKNOWN

added in version 1.0.0
public static final String MEDIA_UNKNOWN

Unknown storage state, such as when a path isn't backed by known storage media.

Constant Value: "unknown"

Public methods

getStorageState

added in version 1.0.0
public static String getStorageState (File path)

Returns the current state of the storage device that provides the given path.

Parameters
path File

Returns
String one of MEDIA_UNKNOWN, Environment.MEDIA_REMOVED, Environment.MEDIA_UNMOUNTED, Environment.MEDIA_CHECKING, Environment.MEDIA_NOFS, Environment.MEDIA_MOUNTED, Environment.MEDIA_MOUNTED_READ_ONLY, Environment.MEDIA_SHARED, Environment.MEDIA_BAD_REMOVAL, or Environment.MEDIA_UNMOUNTABLE.