realm / realm-java

Realm is a mobile database: a replacement for SQLite & ORMs
http://realm.io
Apache License 2.0
11.45k stars 1.75k forks source link

Can I use realm-java to generate `.realm` files only on the Java backend? #7836

Closed AAChartModel closed 11 months ago

AAChartModel commented 11 months ago

Problem

Is it possible to achieve this without relying on Android?

Because I want to generate a .realm file through the Java server and allow the mobile end to download the .realm file directly.

Solution

No response

Alternatives

No response

How important is this improvement for you?

Feature would mainly be used with

rorbech commented 11 months ago

Hi @AAChartModel. It is not possible to run Realm Java outside an Android environment. But realm files are the same across all SDKs so you could use any other SDK to generate the file. However, care should be taken to define the models completely identical if you use different SDKs on the server and mobile.

Realm Kotlin (https://github.com/realm/realm-kotlin) has multi-platform support and runs in JVM desktop environments (along with Android and Darwin), so you could use that across your mobile and server implementation, to utilize the same code across environments. Or just from you server if you can't migrate the mobile SDK at the moment.