How to save general preference data after clearing app cache from settings

I noticed that when I click on clear cache in settings> apps> specific app, the general setting data is cleared.

how to keep general preference data even if i uncheck clear cache ? Is it possible? if possible means to give an idea of ​​it

+3


source to share


2 answers


It's worth noting that there are three types of data cleansing in Android, of which your application has no control:

  • Clear data
  • Clear cache
  • Clear defaults

The only way to have persistent data is to use an SD card, but again, users will not like having data on their card after uninstalling the app, or users can remove the SD card.



Or, you might consider:

  • Storing data on a remote server with some kind of authentication to get it
  • Using Data Backup Service
+3


source


General preferences are commonly used to store temporary information on a user's device. Thus, in general, it contains temporary information / data.

To store the data to be aged in the Clear Cache action, you can store the information in a sqlite database.



To do this, you need to implement a content provider that will encapsulate sqllite database access, this will help you store and retrieve data that will not be deleted when clearing the cache. find more information on how to create a content provider here: http://developer.android.com/training/basics/data-storage/databases.html

+1


source







All Articles