I’ve created an Android application which has a certain package name that I’ve been using personally for months now. I’m about to release it on the market, and I have to change the package name. This cannot be avoided.
My issue is that the application has an SQLite database attached to it that I want to keep, but I know if I change the package name, it’ll install as a separate application and I’ll have to restart my database, which would take a very long time.
Is there a good way to change a package name while maintaining the SQLite database? Or at least moving the database easily? This will just be for my own phone since it hasn’t been released to the public yet.
Step #1: Add a backup/restore function to your app, that copies the database to/from the SD card. Be sure your
SQLiteDatabaseandSQLiteOpenHelperobjects are closed first.Step #2: Install a copy of this app, built with the old package, to your phone, and use it to back up your database.
Step #3: Install the production copy of this app to your phone and use it to restore your database.