So I have a application that is comprised of 3 APK/Apps. How do I share the database between apps? I am assuming the reason it is currently not visible between the apps is because they are passing in different contexts.
Thanks
Christian from Realm here. Currently what you are asking is really not feasible. As others have pointed out there is really only two approaches.
1) Expose a ContentProvider. However that require you to map RealmResults to a Cursor which is not a trivial effort. We are planning on exposing a RealmCursor down the line, but other things have had priority so we havn't looked at the details yet.
2) Put the Realm database in a shared location and let the apps read from there. This sounds like an easy approach, but unfortunately Realm doesn't support multiple processes yet (which would be required for multiple apps to have the same Realm file open at the same time). So right now you would have to implement a locking scheme in your apps so they can decide who can open the file.
So right now, the the answer is: You sorta can, but it require a lot of hacks, so is not really recommended. On the positive side, we are aware of this and at least multiprocess support are actively being worked on atm.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With