Realm for Android

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.getInstance(this);

// 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();

Download Realm for Android — you can also read the docs or check out the source on GitHub.




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…)



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

So today, we’re very excited to launch Realm for Android. We tried to maintain the same very simple API, modern design and added a few more really cool things like encryption.

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.

UPDATE 11/06/2015: we have significantly updated Realm and the way we do benchmarks on Android and encourage people to refer to these updated results instead (source).

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.

You can get in touch with us on our Java Google Group or privately on info@realm.io.

We can’t wait to see what you will build with Realm!