Share this article:

Each application will need to store data in one way or another. Such data can be user settings, application settings, user data, images, or a cached data

Shared Preferences

Shared preferences is used to save primitive data in key-value pairs. Android platform stores Shared Preferences in an xml file in a private directory. An app can have multiple Shared Preferences files. Ideally, you want to store application preferences in Shared Preferences.

Internal (Private) Storage

Internal Storage is used to store persisted data to the device filesystem, but you do not want any other app or user to read this data. The data stored using the Internal Storage method is completed private to your application and are deleted from the device when your app is uninstalled.

External Storage

The user can view the file and data saved with this method.

For write permission, you must request WRITE_EXTERNAL_STORAGE permission.

For read permission, you must request READ_EXTERNAL_STORAGE permission

Beginning with Android 4.4, you can actually write to a “private” external storage folder without requesting WRITE_EXTERNAL_STORAGE. The “private” folder can be read by other applications and by the user, however, data stored in these folders are not scanned by the media scanner. This app_private folder is located in the Android/data directory, and is also deleted when your app is uninstalled.

Beginning with Android 7.0, you can request access to a particular directory (such as picture directory or documents directory) instead of entire external storage. This is referring to as scoped directory access.

SQLite database

SQLite database are app specific. It is available to the app, but not to outside application.

Share this article: