I have observed that when i click on clear cache in settings>apps>particular app, Shared preference data get deleted.
how to keep shared preference data even if i clear the clear the cache? is it possible? if possible means give idea about that
I have observed that when i click on clear cache in settings>apps>particular app, Shared preference data get deleted.
how to keep shared preference data even if i clear the clear the cache? is it possible? if possible means give idea about that
Shared preferences is generally used to store temporary information on a user's device. So generally it holds temporary information/data.
To store data that will survive the 'Clear Cache' action, you can store information in an sqllite database.
To do this, you need to implement a content provider that will encapsulate access to the sqllite database, it will help you store and retrieve data that will not be deleted when the cache is cleared. find more information on how to create a content provider here : http://developer.android.com/training/basics/data-storage/databases.html
It is worth noting that there are three types of data clearing in Android, of which your application has no control over:
The only way to have persistent data is to use the SD card, but again, users won't like to have the data on their card after the app is uninstalled or users can un-mount the SD card.
Or you can consider: