Doppie
Doppie

Reputation: 95

Multiple Realm instances in Android lib + Application

I am building an Android library that is supposed to contain a Realm database. This library will be implemented in an Android Application that on its turn contains another Realm database, there is no connection or relation between the two realm instances.

So the question raised: is it a good idea to have 2 different Realm implementations running in one Application? Or might this bring issues to run it simultaneously?

Upvotes: 2

Views: 378

Answers (1)

Christian Melchior
Christian Melchior

Reputation: 20126

It should be entirely safe to have an Android Library use Realm while the app itself uses it. You run into the normal versioning issues, so the app will have to use the same Realm version as the library, but otherwise it will work fine.

Keep in mind that Android libraries must explicitly define their schema to avoid conflicts with the app. It is described in detail here: https://realm.io/docs/java/latest/#sharing-schemas

Upvotes: 3

Related Questions