Android System file directory path description

Source: Internet
Author: User

The system data storage path is as follows: where the application package name is: COM.SPT

The Contextwrapper class contains the following methods:

1. Getfilesdir ()--Internal storage

    @Override public    File Getfilesdir () {        return mbase.getfilesdir ();    }

Data storage path on K86M_QC machine:/data/data/com.spt/files

Data storage path on Huawei Mobile:/data/data/com.spt/files

2. The Getexternalfilesdir (String type) parameter is specified as: environment.directory_pictures external storage

    @Override public    File getexternalfilesdir (String type) {        return Mbase.getexternalfilesdir (type);    }

Data storage path on K86M_QC machine:/storage/sdcard0/android/data/com.spt/files/pictures

Data storage path on Huawei Mobile:/storage/emulated/0/android/data/com.spt/files/pictures

3. Getcachedir ()--Internal storage

    @Override public    File Getcachedir () {        return mbase.getcachedir ();    }

Data storage path on K86M_QC machine:/data/data/com.spt/cache

Data storage path on Huawei Mobile:/data/data/com.spt/cache

4. Getexternalcachedir ()--External storage

    @Override public    File Getexternalcachedir () {        return mbase.getexternalcachedir ();    }

Data storage path on K86M_QC machine:/storage/sdcard0/android/data/com.spt/cache

Data storage path on Huawei Mobile:/storage/emulated/0/android/data/com.spt/cache

The Environment class contains the following methods:

1. Getdatadirctory ()

    /**     * Return the user data directory.     *    /public static File Getdatadirectory () {        return data_directory;    }

Data storage path on K86M_QC machine:/data

Data storage path on Huawei Mobile:/data

2. Getdownloadcachedirectory ()

    /**     * Return the Download/cache content directory.     *    /public static File Getdownloadcachedirectory () {        return download_cache_directory;    }

Data storage path on K86M_QC machine:/cache

Data storage path on Huawei Mobile:/cache

3. getExternalStorageDirectory ()

    /** * Return The primary external storage directory. This directory is not * currently is accessible if it has been mounted by the user on their * computer, have been Removed from the device, or some other problem have * happened.     You can determine it current state with * {@link #getExternalStorageState ()}. * <p> * <em>note:don ' is confused by the word "external" here. This directory * can better is thought as media/shared storage. It's a filesystem that * can hold a relatively large amount of data and that's shared across all * applications (does not enforce permissions). Traditionally this was an SD * card, but it could also be implemented as built-in storage in a device that * is DiSTI      NCT from the protected internal storage and can being mounted as a * filesystem on a computer.</em> * <p> * On devices with multiple users (as described by {@link Usermanager}), * each user has their own isolatedExternal storage.     Applications only has * access to the external storage for the user they ' re running as. * <p> * in devices with multiple "external" storage directories, this directory * represents the "primary" E Xternal storage that the user would interact * with.  Access to secondary storage are available through * <p> * applications should not directly use this top-level directory, in order * To avoid polluting the user ' s root namespace. Any files that is private * to the application should is placed in a directory returned by * {@link Android.conte Nt. Context#getexternalfilesdir * Context.getexternalfilesdir}, which the system would take care of deleting * if the A Pplication is uninstalled. Other shared files should is placed in * One of the directories returned by * {@link #getExternalStoragePublicDire     Ctory}. * <p> * Writing to this path requires the * {@link Android. Manifest.permission#write_exterNal_storage} permission, * and starting in read access requires the * {@link Android. Manifest.permission#read_external_storage} permission, * which is automatically granted if your hold the write Permissi     On.  * <p> * Starting in {@link Android.os.build.version_codes#kitkat}, if your * application only needs to store Internal data, consider using * {@link context#getexternalfilesdir (String)} or * {@link context#getexternalcached     IR ()}, which require no permissions to * Read or write. * <p> * This path is between platform versions, so applications should * only persist relative paths     .  * <p> * Here's a example of typical code to monitor the state of external * Storage: * <p> * {@sample * Development/samples/apidemos/src/com/example/android/apis/content/externalstorage.java * Monitor_stora  GE} * * @see #getExternalStorageState () * @see #isExternalStorageRemovable () */  public static File getExternalStorageDirectory () {throwifuserrequired ();    return Scurrentuser.getexternaldirsforapp () [0]; }

Data storage path on K86M_QC machine:/storage/sdcard0

Data storage path on Huawei Mobile:/storage/emulated/0

4. Getrootdirectory ()

    /**     * Return root of the "system" partition holding the core Android OS.     * Always present and mounted read-only.     *    /public static File Getrootdirectory () {        return dir_android_root;    }

Data storage path on K86M_QC machine:/system

Data storage path on Huawei Mobile:/system

5. Getexternalstoragepublicdirectory (String type)

    /** * Get A top-level public external storage directory for placing files of * a particular type. This is where the user would typically place and * manage their own files, so you should being careful about what to put     Here * to ensure you don't erase their files or get in the the of their own * organization. * * <p>on devices with multiple users (as described by {@link Usermanager}), * each user has their own isol ated external storage. Applications only * has access to the external storage for the user they ' re running as.</p> * * &LT;P&G T Example of typical code to manipulate a picture on * The public external storage:</p> * * {@      Sample Development/samples/apidemos/src/com/example/android/apis/content/externalstorage.java * Public_picture} *  * @param type the type of storage directory to return. should be one of * {@link #DIRECTORY_MUSIC}, {@link #DIRECTORY_PODCASTS}, * {@linK #DIRECTORY_RINGTONES}, {@link #DIRECTORY_ALARMS}, * {@link #DIRECTORY_NOTIFICATIONS}, {@link #DIRECTORY_PICTURES},  * {@link #DIRECTORY_MOVIES}, {@link #DIRECTORY_DOWNLOADS}, or * {@link #DIRECTORY_DCIM}.     May isn't null.  * * @return Returns the File path for the directory. Note that this * directory may not be yet exist, so your must make sure it exists before * using it such as with {@lin     K File#mkdirs file.mkdirs ()}.        */public static File getexternalstoragepublicdirectory (String type) {throwifuserrequired ();    return Scurrentuser.buildexternalstoragepublicdirs (type) [0]; }

Data storage path on K86M_QC machine:/storage/sdcard0/pictures

Data storage path on Huawei Mobile:/storage/emulated/0/pictures

The difference between Internal storage and external storage:

Getfilesdir ()--Internal storage/data/data/com.spt/files

Getcachedir ()--Internal storage/data/data/com.spt/cache

The internal storage, which corresponds to a specific application, is referred to as the package name: COM.SPT application

Getexternalfilesdir (String type)--External storage/storage/sdcard0/android/data/com.spt/files/pictures

Getexternalcachedir ()--External storage/storage/sdcard0/android/data/com.spt/cache

Getexternalstoragepublicdirectory (String type)--External storage/storage/sdcard0/pictures

getExternalStorageDirectory ()--External storage/storage/sdcard0

1. External storage, corresponding to the/storage/sdcard0/directory;

2. Private files: If you need to remove all external storage of the application (at the same time, this data is private to the application) when uninstalling the application, you can use: Getexternalfilesdir (String type) directory with the application package name;

3. Public files can be stored in: getexternalstoragepublicdirectory (String type)

P.S.

For a specific smart mirror device: Flash-to-/mnt/sdcard HDD size external storage path:/STORAGE/SDCARD1 "Peripheral storage device

Android System file directory path description

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.