Android - best practices for updating internal data in a local Realm DB?

My app ships with a default local Realm file, which upon install is copied from the assets directory to an app specific directory. This file has default values for certain objects (Playlists, Media Items) used for onboarding. Occasionally these get updated as the app versions change. For example, I may add or remove Playlists, or the media associated with them.

When this happens, for existing users I now have this situation:

  1. The user will have had the default Realm file copied to the internal location, and they will have added to it.
  2. The default Realm file in assets has been updated.
  3. I need to replace these “internal onboarding” objects in the Realm file in the assets directory into the user’s live Realm file.

Is it possible to have two Realm files open simultaneously? That would solve my problem I think, I could just open both, and delete/replace the objects used for onboarding in the user’s Realm with the updated values in the Realm located in the assets directory.

I just found some explanation and examples of using RealmModule which answered my question!

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.