简体   繁体   中英

How To Access External and internal storage?

I actually want to access the files on android system. I manage to read the files and directories in the external storage of android. My questions are :

  1. How can I access the directories and files of the internal storage(Specially videos, pics all of the applications which runs in android).
  2. Where are stored the data of each application which installed in internal storage?
  3. Is it possible to transfer data which exists in the internal storage (from internal memory to external storage?
  4. I read that external storage is world-readable? what does that mean?(if a create an application then this application can access all the files that installed in external storage?)

By default, an app cannot access data stored by another app. Permissions are applied to internal storage that make data written by an application not accessible outside of that application (your app cannot read anything written by another app). This can be changed, where an application can specify different permissions for ITS OWN data; basically, an app can allow others to read its data. However, if an app does not specifically set its permissions to allow this, other apps cannot access its data. This is a fundamental principle of the Android security/isolation model and is done at the Linux/kernel level, as each app runs under its own Linux UID and permissions are set within the filesystem only allowing that UID access to the app's directory structure (group and world permissions are set to 0 by default).

This all goes out the window if you have access to root on the device (rooted phone and your app runs with root permissions), but we should consider that out-of-scope for your question.

External (SD card) storage is different in that it is considered free-for-all and permissions are not applied there (this is originally due to the filesystem typically used in SD not supporting permissions). Any app can usually read anything written to the SD card by any other app, unless the original app does something to protect it (encrypt, etc).

This is all explained in great detail in Application Security for the Android Platform , just published by O'Reilly.

您必须编写FileProvider以使用其他应用程序访问特定于应用程序的文件。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM