15

I am using SQLite to store some data. Recently I had a complaint by an user telling me that everytime I update the app, the database is wiped.

I want to fix this, but first I need to simulate an application update without uploading it to google play and waiting.

matthias krull
  • 4,389
  • 3
  • 34
  • 54
124697
  • 22,097
  • 68
  • 188
  • 315
  • Where is the database stored (path)? – Robert Mar 27 '14 at 15:37
  • If you stored your SQLite database under **/data/data/** directory, then this directory is wiped when a new version is installed, whether locally via development, or via Google Play. It's best to store the data under the internal USB storage, or an external USB storage if it's present in the device. – ChuongPham Mar 27 '14 at 15:39

3 Answers3

24

You dont need to upload the apk to google, You can install it directly in your device with adb.

adb install -r yourApp.apk 
sgc_code
  • 485
  • 2
  • 7
  • Nice! I have been running on 15 minute cycle times waiting for Google to publish my update. This makes me very happy. – Shadoninja Apr 10 '17 at 05:27
0

In your SQLHelper class you got onUpdate method. I guess that you put drop database there. You can simulate update by increasing the database version number in helper.

Gaskoin
  • 2,469
  • 13
  • 22
0
  1. Install the apk of the old version.
  2. Use the app to fill the databse.
  3. Launch the new version.

Don't use the signed apk that is created when you export the app for Google Play but the one that is stored in the bin folder of your project when you launch it from the IDE. Otherwise it does a fresh install instead of an upgrade.

Steven Meliopoulos
  • 4,450
  • 4
  • 34
  • 36