Realm Blog

Realm Java 0.85 — with new encryption implementation!

We just released a new version of Realm Java to this website and to Maven. This release replaced the signal handler–based encryption implementation with a more generic solution which works on all devices. Also a new API, Realm.isEmpty(), was added.

New Encryption Implementation

As we mentioned in our previous post, “A Look Into Realm’s Core DB Engine”, we used to rely on the POSIX signal handler to implement Realm’s encryption. It’s a really simple and elegant solution, from a software point of view. But when it comes into the real Android world, the signal handler becomes the root cause of a few weird crashes.

  • Starting with 5.0 Lollipop, Android began shipping a Chromium WebView that can be installed and updated through the Play Store. Unfortunately there was a bug in the WebView v40 that could cause encrypted Realms to crash if used together. More information can be found here.
  • A few older devices (HTC One X for example) do not work correctly with the signal handler. The same problem on the HTC One X happened to Firefox for Android as well. See this Bugzilla page for more details.

Although we tried to use workarounds to enable the encryption on as many devices as we could, using the signal handler on a device like the HTC One X is an impossible mission, because the relevant API on the device is broken. That’s why we decided to rewrite our whole encryption implementation. From this version (v0.85.0) on, Realm’s encryption will work on all Android devices!

So now you can remove the catch block of RealmEncryptionNotSupportedException and let Realm encrypt the data on any Android devices.

New API - Realm.isEmpty()

Now you can check if a Realm contains any data by calling Realm.isEmpty().

Breaking Changes

RealmEncryptionNotSupportedException is removed since it is not needed anymore. 🎉

Realm.executeTransaction() now directly throws any RuntimeException instead of wrapping it in a RealmException. If there is something wrong in the transaction block while calling Realm.executeTransaction(), the original exception will be thrown to make it easier to debug. When exceptions occur, the transaction will be rolled back, just like before.

RealmQuery.isNull() and RealmQuery.isNotNull() now throw IllegalArgumentException instead of RealmError if the field name is a linked field and the last element is a link.

Realm Team

At Realm, our mission is to help developers build better apps faster. We provide a unique set of tools and platform technologies designed to make it easy for developers to build apps with sophisticated, powerful features — things like realtime collaboration, augmented reality, live data synchronization, offline experiences, messaging, and more.

Everything we build is developed with an eye toward enabling developers for what we believe the mobile internet evolves into — an open network of billions of users and trillions of devices, and realtime interactivity across them all.

Get more development news like this