Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete the data while re-install the app

Tags:

android

Thanks for previous replies,

is it possible to delete the stored content from sqlite once re-install the application. I am storing data in database, once i re-install the same app again, the previous data still stores in sqlite. i want to delete the stored content while re install the app. i am not sure about this.

like image 952
RAAAAM Avatar asked Dec 05 '25 13:12

RAAAAM


1 Answers

This seems like a hack and maybe not the actual answer, but can you -- with each new version of your app -- increment an identifier (from 10 to 11) in the code and then check against a stored preferences containing that identifier. If you have a constant in your code that is higher than the identifier stored on the previous device, then you can clear the database to whatever you think its state should be. Then with each new released version of the app you increment this number..

Edit: In API level 9 and higher, you can -- whenever your app starts up -- write the date in which the app was installed (see here for an explanation on how to find the install date). If you check that it was installed after the date which is written, kill the data!

like image 187
Kristopher Micinski Avatar answered Dec 07 '25 15:12

Kristopher Micinski



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!