2

I would like to raise my target and compile version to 28 from 26. This is because a user emailed me and said that the app doesn't work properly on his phone which runs andoird 9.

Once I upped the target and compile versions, I tested out the app with various devices and it seems like everything is running just fine with different devices and emulators.

However I'm concerned that with the new SDK target and compile versions, that users might lose their data when they update. My DatabaseHelper class extends SQLiteOpenHelper.

Do I have to do anything to make sure their database tables are preserved when I update with the higher target and compile version?

NOTE: My database schema is staying the exact same with the update.

Miles Adamson
  • 357
  • 1
  • 3
  • 9

3 Answers3

1

Changing the target SDK version will not lost the data of existing users if they update the app over existing(with lower sdk).

What you can do to verify this is instal the previous build(with lower sdk) from play store and upload your new build in alpha release(with the updated target sdk) and add yourself as a tester. When alpha release gets live it will give you an option to update the app on previous app(with low target sdk).

when you hit the update button you will get your results.

This way you can make verify this.

Nouman Ch
  • 4,023
  • 4
  • 29
  • 42
0

If you’re using Room to handle your database operations, migrations are very easy

Follow this office android developer guide

if you are not using Room its not easy to migrate(if you update db to much) for this please read this medium blog

Edited : As you mention you are not doing any change in DB

you will not lose data for 100% verfication you can test by following steps

1)Download your app from playstore.

2)do changes in code and update your app version in gradle.

3)Make a signed build(with same keystore which used in playstore apk) so you have a updated version build.

4)Put this updated version apk in phone and install/update( make sure old version of app is there , which you download from playstore).

5)Now your app is updated , you can check/test whatever you want.

Mayank Sharma
  • 2,735
  • 21
  • 26
  • Hi there. My database schema will be the exact same after the update, only the target version and compile versions will be different (26->28) Does this effect what I need to do for my update? – Miles Adamson Jan 15 '19 at 05:49
0

If you wish your app data to be saved even if the app is deleted and than installed again, you can use the backup feature available since android 6.0

Add these lines to your manifest inside the <application> tag:

android:allowBackup="true"
android:fullBackupContent="true"

The end result should look like this:

<application
        android:name="your.app.bundle"
        android:allowBackup="true"
        android:fullBackupContent="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme">
        <activity  />
        <activity  />
    </application>
Mark Kazakov
  • 946
  • 12
  • 17