Suchi
Suchi

Reputation: 10039

Why is a special file used in Android to store installation id instead of SharedPreferences?

I am trying to figure out the best way to store my application key and other application specific data. Android uses a file to do it - http://android-developers.blogspot.com/2011/03/identifying-app-installations.html

I found that using SharedPreferences is faster and more efficient. Why does Android use a dedicated file just to store the installation ID instead of using preferences? Both require the application context, so that is not a reason.

Upvotes: 1

Views: 544

Answers (1)

Joseph Earl
Joseph Earl

Reputation: 23442

I guess so that the UUID is persisted across installations if the phone is not factory-reset.

An applications SharedPreferences are removed when that application is uninstalled. So if a user uninstalled/re-installed and the ID was stored in SharedPreferences then the ID would be different after the re-installation.

Upvotes: 1

Related Questions