IT. Expert System.

Android Reference

Environment


android.os

Class Environment



  • public class Environment
    extends Object
    Provides access to environment variables.
    • Field Detail

      • DIRECTORY_ANDROID

        public static String DIRECTORY_ANDROID
      • DIRECTORY_PODCASTS

        public static String DIRECTORY_PODCASTS
        Standard directory in which to place any audio files that should be in the list of podcasts that the user can select (not as regular music). This may be combined with DIRECTORY_MUSIC, DIRECTORY_NOTIFICATIONS, DIRECTORY_ALARMS, and DIRECTORY_RINGTONES as a series of directories to categories a particular audio file as more than one type.
      • DIRECTORY_RINGTONES

        public static String DIRECTORY_RINGTONES
        Standard directory in which to place any audio files that should be in the list of ringtones that the user can select (not as regular music). This may be combined with DIRECTORY_MUSIC, DIRECTORY_PODCASTS, DIRECTORY_NOTIFICATIONS, and DIRECTORY_ALARMS as a series of directories to categories a particular audio file as more than one type.
      • DIRECTORY_NOTIFICATIONS

        public static String DIRECTORY_NOTIFICATIONS
        Standard directory in which to place any audio files that should be in the list of notifications that the user can select (not as regular music). This may be combined with DIRECTORY_MUSIC, DIRECTORY_PODCASTS, DIRECTORY_ALARMS, and DIRECTORY_RINGTONES as a series of directories to categories a particular audio file as more than one type.
      • DIRECTORY_PICTURES

        public static String DIRECTORY_PICTURES
        Standard directory in which to place pictures that are available to the user. Note that this is primarily a convention for the top-level public directory, as the media scanner will find and collect pictures in any directory.
      • DIRECTORY_MOVIES

        public static String DIRECTORY_MOVIES
        Standard directory in which to place movies that are available to the user. Note that this is primarily a convention for the top-level public directory, as the media scanner will find and collect movies in any directory.
      • DIRECTORY_DOWNLOADS

        public static String DIRECTORY_DOWNLOADS
        Standard directory in which to place files that have been downloaded by the user. Note that this is primarily a convention for the top-level public directory, you are free to download files anywhere in your own private directories. Also note that though the constant here is named DIRECTORY_DOWNLOADS (plural), the actual file name is non-plural for backwards compatibility reasons.
      • DIRECTORY_DCIM

        public static String DIRECTORY_DCIM
        The traditional location for pictures and videos when mounting the device as a camera. Note that this is primarily a convention for the top-level public directory, as this convention makes no sense elsewhere.
      • MEDIA_UNMOUNTABLE

        public static final String MEDIA_UNMOUNTABLE
        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.
        See Also:
        Constant Field Values
    • Constructor Detail

      • Environment

        public Environment()
    • Method Detail

      • initForCurrentUser

        public static void initForCurrentUser()
      • getRootDirectory

        public static File getRootDirectory()
        Gets the Android root directory.
      • getSystemSecureDirectory

        public static File getSystemSecureDirectory()
        Gets the system directory available for secure storage. If Encrypted File system is enabled, it returns an encrypted directory (/data/secure/system). Otherwise, it returns the unencrypted /data/system directory.
        Returns:
        File object representing the secure storage system directory.
      • getSecureDataDirectory

        public static File getSecureDataDirectory()
        Gets the data directory for secure storage. If Encrypted File system is enabled, it returns an encrypted directory (/data/secure). Otherwise, it returns the unencrypted /data directory.
        Returns:
        File object representing the data directory for secure storage.
      • getMediaStorageDirectory

        public static File getMediaStorageDirectory()
        Return directory used for internal media storage, which is protected by android.Manifest.permission#WRITE_MEDIA_STORAGE.
      • getUserSystemDirectory

        public static File getUserSystemDirectory(int userId)
        Return the system directory for a user. This is for use by system services to store files relating to the user. This directory will be automatically deleted when the user is removed.
      • isEncryptedFilesystemEnabled

        public static boolean isEncryptedFilesystemEnabled()
        Returns whether the Encrypted File System feature is enabled on the device or not.
        Returns:
        true if Encrypted File System feature is enabled, false if disabled.
      • getDataDirectory

        public static File getDataDirectory()
        Gets the Android data directory.
      • getExternalStorageDirectory

        public static File getExternalStorageDirectory()
        Gets the Android external storage directory. This directory may not currently be accessible if it has been mounted by the user on their computer, has been removed from the device, or some other problem has happened. You can determine its current state with getExternalStorageState().

        Note: don't be confused by the word "external" here. This directory can better be thought as media/shared storage. It is a filesystem that can hold a relatively large amount of data and that is shared across all applications (does not enforce permissions). Traditionally this is an SD card, but it may also be implemented as built-in storage in a device that is distinct from the protected internal storage and can be mounted as a filesystem on a computer.

        On devices with multiple users (as described by UserManager), each user has their own isolated external storage. Applications only have access to the external storage for the user they're running as.

        In devices with multiple "external" storage directories (such as both secure app storage and mountable shared storage), this directory represents the "primary" external storage that the user will interact with.

        Applications should not directly use this top-level directory, in order to avoid polluting the user's root namespace. Any files that are private to the application should be placed in a directory returned by Context.getExternalFilesDir, which the system will take care of deleting if the application is uninstalled. Other shared files should be placed in one of the directories returned by getExternalStoragePublicDirectory(java.lang.String).

        Writing to this path requires the android.Manifest.permission#WRITE_EXTERNAL_STORAGE permission. In a future platform release, access to this path will require the android.Manifest.permission#READ_EXTERNAL_STORAGE permission, which is automatically granted if you hold the write permission.

        This path may change between platform versions, so applications should only persist relative paths.

        Here is an example of typical code to monitor the state of external storage:

        See Also:
        getExternalStorageState(), isExternalStorageRemovable()
      • getLegacyExternalStorageDirectory

        public static File getLegacyExternalStorageDirectory()
      • getLegacyExternalStorageObbDirectory

        public static File getLegacyExternalStorageObbDirectory()
      • getEmulatedStorageSource

        public static File getEmulatedStorageSource(int userId)
      • getEmulatedStorageObbSource

        public static File getEmulatedStorageObbSource()
      • getExternalStoragePublicDirectory

        public static File getExternalStoragePublicDirectory(String type)
        Get a top-level public external storage directory for placing files of a particular type. This is where the user will typically place and manage their own files, so you should be careful about what you put here to ensure you don't erase their files or get in the way of their own organization.

        On devices with multiple users (as described by UserManager), each user has their own isolated external storage. Applications only have access to the external storage for the user they're running as.

        Here is an example of typical code to manipulate a picture on the public external storage:

        Parameters:
        type - The type of storage directory to return. Should be one of DIRECTORY_MUSIC, DIRECTORY_PODCASTS, DIRECTORY_RINGTONES, DIRECTORY_ALARMS, DIRECTORY_NOTIFICATIONS, DIRECTORY_PICTURES, DIRECTORY_MOVIES, DIRECTORY_DOWNLOADS, or DIRECTORY_DCIM. May not be null.
        Returns:
        Returns the File path for the directory. Note that this directory may not yet exist, so you must make sure it exists before using it such as with File.mkdirs().
      • getExternalStorageAndroidDataDir

        public static File getExternalStorageAndroidDataDir()
        Returns the path for android-specific data on the SD card.
      • getExternalStorageAppDataDirectory

        public static File getExternalStorageAppDataDirectory(String packageName)
        Generates the raw path to an application's data
      • getExternalStorageAppMediaDirectory

        public static File getExternalStorageAppMediaDirectory(String packageName)
        Generates the raw path to an application's media
      • getExternalStorageAppObbDirectory

        public static File getExternalStorageAppObbDirectory(String packageName)
        Generates the raw path to an application's OBB files
      • getExternalStorageAppFilesDirectory

        public static File getExternalStorageAppFilesDirectory(String packageName)
        Generates the path to an application's files.
      • getExternalStorageAppCacheDirectory

        public static File getExternalStorageAppCacheDirectory(String packageName)
        Generates the path to an application's cache.
      • getDownloadCacheDirectory

        public static File getDownloadCacheDirectory()
        Gets the Android download/cache content directory.
      • getExternalStorageState

        public static String getExternalStorageState()
        Gets the current state of the primary "external" storage device.
        See Also:
        getExternalStorageDirectory()
      • isExternalStorageRemovable

        public static boolean isExternalStorageRemovable()
        Returns whether the primary "external" storage device is removable. If true is returned, this device is for example an SD card that the user can remove. If false is returned, the storage is built into the device and can not be physically removed.

        See getExternalStorageDirectory() for more information.

      • isExternalStorageEmulated

        public static boolean isExternalStorageEmulated()
        Returns whether the device has an external storage device which is emulated. If true, the device does not have real external storage, and the directory returned by getExternalStorageDirectory() will be allocated using a portion of the internal storage system.

        Certain system services, such as the package manager, use this to determine where to install an application.

        Emulated external storage may also be encrypted - see DevicePolicyManager.setStorageEncryption( android.content.ComponentName, boolean) for additional details.



Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 1708 / . Delta: 0.02862 с