Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - Life time of different storage options

Android provides following options for data storage:

Shared Preferences - Store private primitive data in key-value pairs.

Internal Storage - Store private data on the device memory.

External Storage - Store public data on the shared external storage.

SQLite Databases - Store structured data in a private database.

Cache - Cache data during application is running.(May be clear on shortage of space)

What I was wondering is the life time of these storage.

  1. Which storage(s) clears on application close (Obviously cache)
  2. Which storage(s) clears on application re-install
  3. Which storage(s) clears on application update
  4. Which storage(s) clears on application un-install
  5. Which storage(s) clears on application clear data
  6. Which storage(s) clears on mobile factory reset
  7. Which storage(s) clears on Rom upgrade/change

An extension to this question is, using which storage my data is more secure in terms of loss and in terms of access by unauthorized resources (users, applications in case of root).

like image 929
Adnan Avatar asked Mar 03 '14 14:03

Adnan


1 Answers

Which storage(s) clears on application close (Obviously cache)

Cache

Which storage(s) clears on application re-install

Cache

Which storage(s) clears on application update

Cache

Which storage(s) clears on application un-install

Cache, SQLite, Shared Preferences

Which storage(s) clears on application clear data

Cache, SQLite, Shared Preferences

Which storage(s) clears on mobile factory reset

It clears all, but not External Storage data

An extension to this question is, using which storage my data is more secure in terms of loss and in terms of access by unauthorized resources (users, applications in case of root).

It is best to store the data in the SQLite in the encrypted form. If your device is rooted then it means you can access even the SQLite.

like image 149
Ajay S Avatar answered Oct 08 '22 05:10

Ajay S