keep realm db after android app update
Hi everyone =) I have the problem with app updating. When users update my app from Market, they lose authorization data, which are recorded in db. I found post on stackoverflow, but there is no answer.. (https://stackoverflow.com/questions/42527530/keep-realm-db-after-android-app-update) What can i do for keep session data?
Realm init:
RealmConfiguration config = new RealmConfiguration.Builder(this)
.name("myapp.realm")
.schemaVersion(mRealmSchemaVersion)
.deleteRealmIfMigrationNeeded()
.build();
Realm.setDefaultConfiguration(config);
(schemaVersion is not change)
Realm version: 1.0.1 Android Studio version: 2.3.2 Which Android version and device: this is mass problem
Thanks for answers or advice =)
The Realm file on disk doesn't get deleted when people upgrade your app, but you have set deleteRealmIfMigrationNeeded(). This will delete the file if you changed the Realm schema somehow. You need to set a schema version and migration instead. See https://realm.io/docs/java/latest/#migrations
yes, i know it, but Realm schema does not change))) ok, thanks, i will try set migration
yep, seems all work fine with migration =) thanks a lot! =)
How to make it . Please explain me.
@kzdeveloper12345 here is an example: migration-example
But you can reference the code in this to know how to handle complex cases like changing primary key, or adding primitive lists