Is it possible to block Shared Preferences to avoid being deleted?

后端 未结 2 1326
情歌与酒
情歌与酒 2021-01-16 17:46

By default Shared Preferences on Android are being able to be deleted by phone setup. Is it possible to block this ?. Basically i would like to store a Shared Preference as

2条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-16 18:17

    What you're suggesting of doing sounds dangerous to me.

    Bear in mind that when you're programming, you're programming within a certain environment. The operating system will restrict aspects of what you can and can't do, to keep consistency across applications, provide security etc.

    If you're wanting to use shared preferences as a means of providing trials for applications, or some other registration-related issue, I don't know what the framework is on Android, but I believe there's more secure ways of doing it.

提交回复
热议问题