1

I have a problem related to the app that I developed which runs on honeycomb. When I reinstall the apk its database gets deleted. There did not used to be this almost 1 week ago. Why this is happening now? What can cause db to be deleted and how to prevent it?

Mustafa Güven
  • 15,526
  • 11
  • 63
  • 83

2 Answers2

4

I think, If your database stored in application's internal storage /data/data/<package_name>/databases/ then when your application un-installed from device, all directories with your application package are removed from the device this cause your database removed.

To prevent put your database copy in application's /asset directory so whenever your application first time runt it copy the database from asset to internal storage path. And you can access it whenever application re-installed, also you can put your database in /sdcard but user can also delete it..

EDIT: Using your own SQLite database in Android applications and How to ship an Android application with a database?

Thanks...

Community
  • 1
  • 1
user370305
  • 108,599
  • 23
  • 164
  • 151
0

i guess it about checking existing database in your code. but i'm not sure exactly, it can occur from many causes. Just give an idea.

April Smith
  • 1,810
  • 2
  • 28
  • 52