Realm for Android launched in Sept. 2014 – Since then we’ve reached Realm Java 2.0 with full support for the Realm Mobile Platform. Realm Java enables you to efficiently write your app’s model layer in a safe, persisted and fast way. Below is our original Realm for Android launch post. Please keep in mind that some pieces may be out of date, so check out the latest in Realm Java here.
tl;dr: after attracting over 20,000 developers on iOS in 8 weeks, we’re launching Realm for Android today! It looks like this:
Realm realm = Realm.getDefaultInstance(); // All writes are wrapped in a transaction // to facilitate safe multi threading realm.beginTransaction(); // Add a person Person person = realm.createObject(Person.class); person.setName("Young Person"); person.setAge(14); realm.commitTransaction(); RealmResults<User> result = realm.where(User.class) .greaterThan("age", 10) // implicit AND .beginGroup() .equalTo("name", "Peter") .or() .contains("name", "Jo") .endGroup() .findAll();
It’s hard to believe Realm for iOS was first released less than 3 months ago — we’ve certainly been busy since that fateful Tuesday morning! We stayed on the front page of HN for a full 24 hours, saw the blogposts pile in, the scores of apps on GitHub, spontaneous meetups about us, invites to speak at conferences and of course a deluge of feature ideas and bug reports — all of them awesome, all of them needed, and all of them reminding us of how much work was left ahead!
Our launch also gave way to tweets like this (and many more…)
— Bradford Stephens (@LusciousPear) September 24, 2014
— Hosam Hassan (@Objective_Neo) September 21, 2014
— Bryan Irace (@irace) August 28, 2014
So this @realm thing looks totally incredible.
— Jerome (@jmig) July 17, 2014
Played a few hours with https://t.co/Uo6Xr9RkZh this weekend and I'm really impressed. Apple should seriously reconsider Core Data.
— Reda Lemeden (@kaishin) September 15, 2014
We estimate that over 20,000 developers (!!!) were already using Realm just 8 weeks after launch, and that there are ~1,000 Realm apps either already on the App Store or close to being released on the App Store. This includes New York Times-featured social apps like Cloth, venture-backed professional apps such as Breeze, and of course Zynga, who has been using Realm in production since 2012.
Realm for Android
Realm files are also compatible across iOS & Android! You can share them across platforms! Since Realm data uses very little disk space and require no serialization & deserialization, you’ll get much better performance passing realm files around than shipping SQLite databases or chunks of JSON.
How about performance? Well, we’re glad you asked :) For all the API goodness & development productivity we give you, we’re still up to 100x faster that some SQLite ORMs and on average ~10x faster than raw SQLite and common ORMs for typical operations:
Tests run on an Galaxy S3, using the latest available version of each library as of Sept 28, 2014.
We consciously tried to release Android in an earlier state than what we shipped for iOS, so that we could benefit from wider community feedback (and answer the needs of the many users who needed to go in production with Android this year). Expect the API to be improved quite a bit, especially as we polish advanced features like Encryption and Migrations.
We can’t wait to see what you will build with Realm!
New Features in Realm Java
We recently released version 3.0 of Realm Java! In this release we have enabled sorting across relationships and we’re giving our live collections RealmResults and RealmList a whole lot more life by adding fine-grained collection notifications, so that your app can respond to elements being added, deleted and modified.