This post announced the launch of Realm for Android in Sept. 2014 – Since then we’ve made many updates and released new features. Check out the latest here in Realm Java.
Download Realm for Android
You can also read the docs or check out the source on GitHub.
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…)
@realm btw thanks! you've saved @clothapp months of work and thousands of lines of painful code.
— Bradford Stephens (@LusciousPear) September 24, 2014
Switching from CoreData to @realm in one gif https://t.co/nWNOxUSF8i
— Hosam Hassan (@Objective_Neo) September 21, 2014
Just got an overview/demo of the @realm mobile database from @simjp = mind blown.
— 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
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 to ask questions on StackOverflow or open an issue on Github.
We can’t wait to see what you will build with Realm!
Download Realm for Android
You can also read the docs or check out the source on GitHub.
Receive news and updates from Realm straight to your inbox