开发者

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

开发者 https://www.devze.com 2023-03-05 16:00 出处:网络
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-in

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 app开发者_StackOverflowlication context, so that is not a reason.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消