What is the easiest way to delete Android app data after update / update?

So, I found an error in a specific sdk that causes it to fail on some Android phones after reinstalling a new version of the application that uses sdk (via adb install -r, and presumably when the user receives an update that has been ported to the Android market ) Is there a way to get the application data to be automatically cleared when the application is updated? I understand that there are different ways of storing data, but I just need to simulate the call to the "Clear data" button that you will find when viewing the application in the "Application Management" section in the settings (i.e. I just want all the data to disappear )

I am an Android noob and I am doing minimal Java coding in this project, so I am basically looking for the simplest solution here. I suppose I could agree to save "currentVersion" to disk and then check it at startup each time to see if the current version matches the current version written to disk the last time I started it. Is this the only real way to do this? If so, what is the easiest way to do this?

Thank!

+5
source share
1 answer

Is there a way to force delete application data after updating the application?

No, at least for my definition of "automatic."

, "currentVersion" , , , , . ?

lastKnownVersion, , , .

, ?

... , . Java I/O ( - getFilesDir()) SharedPreferences.

, , , . , ( " sdk, Android , sdk" ).

+2

All Articles