Utilizing Realm in my react-native application via the JavaScript API has been great for persisting user data. However, I now find myself needing to access this Realm instance from a native module (specifically the react-native bridge in Android) in order to retrieve this persisted data. Can someone provide guidance on how to accomplish this task? I've already taken the necessary steps to install Realm in my gradle settings and set up a default configuration in MainApplication.java. Unfortunately, I am encountering the following error:
io.realm.exceptions.RealmFileException: Directory at path 'data/data/com.moodar/file/default.realm' does not exist
In the JavaScript environment, I have created a default instance, so I assumed I could access this default instance through the Java interface as well.
Below is a snippet of my overridden onCreate method in MainApplication.java:
super.onCreate();
final int SCHEMA_VERSION = 14;
Realm.init(this);
RealmConfiguration config = new RealmConfiguration
.Builder()
.deleteRealmIfMigrationNeeded()
.schemaVersion(SCHEMA_VERSION)
.build();
Realm.setDefaultConfiguration(config);
...