Domanda

I am working on some application, where I am storing some of my application data in SQLite DB. If any user clears the data, my data gets cleared. Through How to disable the Clear Data button in Application info of Manage appliaction and http://groups.google.com/group/android-developers/browse_thread/thread/b1091f190f7356b7 these links, I found that we cannot disable clear data button, But my question is Is there any way to catch this action(clear data) in the application? Is there any intent in android to notify this action ?

Thanks in advance

Pushpa

È stato utile?

Soluzione

A possible workaround is to program your application to use a SQLite database on external storage. SD card etc. just create a folder on your SD or whatever storage you want, place the .db file in that folder and use that instead of the default storage location. By default, SQLite databases are stored in the data folder(device not rooted so dont know where in the data folder), which is not accesible unless you rooted your device.

There are tutorials out there that use this technique. Note that, its likely that when you delete your app, the data will persist. Don't know if that is desirable.

Altri suggerimenti

You can do one thing You can create a test table in your DB and insert some data in it. Every time you run the application you check the value of the table exist or not. If data exist that means DB value is not reset and if Table is empty you get to know that DB data is cleared and insert the data again for the next time check.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top