Realm Blog

Cartasite Delivers Industrial IoT with Realm Mobile Platform

by /

Offline-first app for heavy industries seamlessly syncs field data with backend systems

 

Two months is a lightning-fast timeframe to develop a mobile IoT system that includes data sync and offline-first capabilities at it’s core. Yet the CTO and engineering team at Cartasite took on the bold challenge of doing just that. Using Realm Mobile Platform, they not only met the deadline, but surpassed their original expectations. The team delivered a stable, field-ready system with a user experience that was so fast and fluid, it blew even their CEO’s mind.

It all started when one of Cartasite’s clients needed to build a new field management tool for their water hauling business. Using a sensor installed on water trucks, Cartasite designed an IoT solution that would automatically track a wide variety of measurements during transport, from point of collection to disposal. Their fieldFLOW system would make it easier and safer for drivers to report on their loads through a simple mobile application.

Fast development, fast UX on Realm

From the beginning, the Cartasite team wanted to replace their existing underlying database architecture to create a faster, smoother, offline-first user experience. They knew that Realm could help them quickly test ideas, so they decided to try a proof-of-concept using Realm Mobile Platform. The team and their CEO were so impressed with the speed and “magic” of Realm that they proceeded to build out their new product on the platform.

“The very first time we connected to the Realm Object Server, it just worked. Everything else from that point on was pretty much just rock solid.” Chris Chares, Senior Mobile Engineer, Cartasite

An easier way to ensure network resiliency

Offline functionality is critical for field operations, and Cartasite needed the fieldFLOW system to function seamlessly in unpredictable network conditions. Realm’s offline-first architecture enabled the team to meet their client’s needs without having to deal with massive amounts of networking code. Realm’s client-side database makes current app data always available to the end user, providing a great offline experience with data input and access, as well as UI features, such as autocomplete search.

“If Realm was just an offline database, then I’d be happy to never use Core Data again. But the syncing functionality of the Realm Object Server is really quite incredible.” Chris Chares, Senior Mobile Engineer, Cartasite

Automatic data synchronization across platforms

When network connectivity is restored, the Realm Mobile Platform instantly syncs data updates in the background without disrupting the user’s flow. The platform’s data synchronization capabilities enabled the Cartasite team to bypass the time-consuming tasks of building, testing, and debugging complex networking code. With Realm, testing was easy. The team was able to put a lot of their business logic into the model layer and quickly spin up in-memory Realms to test against.

“Synchronization code is a minefield of potential bugs, and I don’t think we’d have anywhere near the level of stability we have right now if we couldn’t lean on Realm to handle that for us.” Chris Chares, Senior Mobile Engineer, Cartasite

Realm’s cross-platform architecture saved Cartasite even more time by providing them with one set of schemas for iOS, Android, and JavaScript that really simplified the business logic, as well as only one central server to manage. This enabled the team to significantly streamline their code and further reduce development complexity.

“By adopting the Realm Mobile Platform, we were able to reduce our mobile application code by 40%.” Laura Thompson, Senior Software Engineer & Architect, Cartasite

On-time delivery, in partnership with Realm

During development, Cartasite was able to partner with Ream’s technical support engineers to troubleshoot issues quickly, helping them meet their ambitious delivery timeline. By the end of the project, Cartasite had discovered a kinship in Realm’s approach to customer collaboration, which mirrored their own organization-wide focus on customer success.

“We feel that our experience with Realm is the kind of experience that we try to share with our customers. So that’s been the most positive thing.” Bill Sinclair, CTO, Cartasite

Ultimately, the time saved by building with Realm was put to good use. The Cartasite team had the freedom to focus on designing and developing the best possible product for their client within an accelerated timeline. And a great product means time saved on the road with more efficient, safer hauling operations.

Read more

Introducing .NET Core Support for Realm

by /

Today we’re pleased to introduce .NET Core support on Realm. Developers can now build apps with Realm Mobile Platform using C# on both the client and server side for a complete end-to-end C# developer experience with Realm.

What is .NET Core?

.NET Core is the next evolution of the .NET platform, ideally suited to modern server-side development practices. With .NET Core, .NET developers can now build server-side apps that embrace the following requirements:

  • Cross platform (Linux, MacOS, Windows)
  • Docker container support (as a result of .NET Core running on Linux)
  • Microservice architectures
  • High performance and scalable systems
  • Running apps side-by-side on the same server using different .NET versions
  • .NET Core uses many of the same .NET platform components as the .NET Framework so you can share code across the two.

.NET Core support for Realm

With Realm .NET Core support, you can now integrate Realm on the server backend using C#. (as an alternative to using our Node.js binding). Realm customers who specialize in .NET have expressed great interest in the addition of .NET Core support; these customers can now use a familiar framework while building the server-side components of their mobile apps. For instance, customers can now deploy scalable, Docker container-based microservices, all while using .NET and Realm. We’re excited to support this new framework because it represents a dramatic expansion in capabilities for our .NET community of developers who are interested in adopting the latest development practices.

By adding .NET Core support to the existing capabilities of the Realm Platform, it is also possible for an organization that prefers C# to use C# throughout their entire application supporting both client-side and server-side development. You can build cross-platform apps for iOS and Android using Xamarin while also using .NET Core on the server to integrate existing backend systems with Realm. The Realm Platform seamlessly two-way syncs data between the client devices—regardless of platform—and servers in realtime, allowing you to create a common data layer for your app. Our realtime two-way synchronization platform makes it easy to build modern reactive apps so that you can focus on creating a differentiated UX for your users.

“We love the simplicity of Realm and the speed of .NET Core; we’re excited that with Realm .NET Core support we can leverage both to bring the highest levels of performance to our backend microservices.” - Laura Thompson, Senior Software Engineer, Cartasite LLC

We want to make it easy for developers to work with the programming languages they are most comfortable with and the introduction of .NET Core support allows us to provide a complete end-to-end C# experience for our developer base.

If sync isn’t your fancy, Realm Database with .NET Core is also powerful tool. Now .NET developers have access to a performant and lightweight object database that works cross platform with .NET Core. You can easily deploy Realm as the standalone datastore for your apps built with .NET Core running on Windows, Linux, or MacOS.

It’s easy to get started, it’s just like building for your Xamarin apps when you’re working with .NET Core. See Realm Xamarin documentation for more details.

We’re proud of what we’re shipping today, however, we have much more in store. In coming releases, we plan to launch the Global Notifier and the Data Adapter for .NET Core that will allow you to integrate event handling into your app and fault-tolerant data transfer with legacy database systems. Realm Mobile Platform Support for two-way data sync on Windows is also on the way. These additional features will be available in late 2017.

Read more

Realm Helps Integral Studio Bring their Creativity to Life

by /
Fast deployment, realtime experiences, creative flexibility

At the intersection of analog and digital lies a golden opportunity for musicians and their fans. Integral Studio is dedicated to bringing artists and audiences closer together and building one-on-one relationships through digital media. Based in Los Angeles, the digital management company is on the forefront of developing innovative mobile fan apps for the music world.

 

With a team of creative technologists, Integral Studio aims to build rich, reactive mobile user experiences that best represent each artist’s brand. In addition, the agency strives to deliver the hottest new content to fans as quickly as possible. Fundamental to making these possible is a smooth, fast flow of data between an ever-growing install base of apps and robust data storage on the backend.

Realm enables continuous creativity

Integral Studio’s founders needed technology solutions that gave them creative flexibility and helped them focus their lean team on innovation. When it came to data management, they wanted to avoid the headaches of setting up and maintaining their own database using a typical SQLite, ORM, or JSON solution. They found these to be slow and costly, requiring them to pour time, energy, and manpower into developing and maintaining a database that may not meet their performance requirements.

From the beginning, the company chose Realm Platform as their core data solution. Realm was robust enough to support their most creative ideas and power the snappy, fluid UX needed in their reactive apps. In addition, Realm Mobile Database was easy to integrate into app code and the Realm Object Server offered a centralized place to manage their client app portfolio.

“We use Realm Mobile Platform for all our data handling and management. It’s the core component that ties everything together. Realm is well-designed and easy to use—I couldn’t imagine having to build all the different pieces from scratch.”
Spencer Schoeben, CTO & Co-Founder, Integral Studio

Realm’s responsive, object-oriented database enables the team to realize their vision of providing a personalized experience for music fans. They can easily segment app users and push different content to individuals—a complex feature that would have otherwise been too difficult to accomplish. For example, artists are able to target those fans who attended a certain concert and provide exclusive or early access to such things as limited edition products and videos.

“Having objects represent data makes it super easy for me understand because I’m working with objects all the time. I can build out all of the logic for a local Realm, then add in the syncing… and it all just works as expected.
Megh Vakharia, CPO & Co-Founder, Integral Studio

Integral Studio can also quickly respond to client change requests, thanks to Realm’s flexibility and ease of use. This is especially important, as both artists and users want their app experience to be as current and dynamic as possible. Therefore, artists often provide spontaneous or changing directions to evolve their app’s features and content. In addition, Realm’s realtime functionality and scalability easily supports use cases that are impacted by heavy demand. For example, sometimes apps will offer popular new products that can sell out within seconds.

“Because we launched with Realm, I knew realtime would be easy going forward. So we’re able to bring new realtime features to products much sooner than I would have otherwise imagined.”
Spencer Schoeben, CTO & Co-Founder, Integral Studio

Ready to imagine the future with Realm

For Integral Studio’s creative team, Realm helps them stay innovative with every new project and push mobile experiences to the limits of their imagination. New ideas, such as single sign-on across artist apps or UI customization options, seem entirely possible for the maverick young startup. Integral Studio is confident that Realm’s flexibility will support any data-driven experience they can build, and that Realm Platform will seamlessly scale alongside the growth of their creative portfolio.

“I don’t have to worry about how things are going to be architected or built, I can just think without boundaries. With Realm at the center of our realtime data flow, we can plan ahead for things that we haven’t even thought about yet.”
Megh Vakharia, CPO & Co-Founder, Integral Studio

Read more

Keeping your edge as a mobile developer: Announcing Realm Academy

by /

At Realm, we consistently hear that one of the biggest challenges facing today’s developers is around keeping their edge. With the constant emergence and evolution of new languages and frameworks, best practices, technologies, and architectures, how can a busy professional dev keep up? The traditional methods for professional learning and inspiration—conferences, local meetups, and finding content across the web and social media—are great, but just aren’t enough. Despite requiring a big investment in time, money, and legwork, they still fall short at providing the depth and breadth of content pro devs really need.

Today, to help solve this problem, we’re launching Realm Academy, a new resource that brings together more than 850 pieces of unique developer content from the very best experts in mobile. These are highly practical videos, articles, and tutorials from top conferences, top authors, and community leaders who want to share what they know. We create and capture these at the highest quality levels, enhance them with transcripts and other features, and most importantly curate, organize, and publish them to make them easy to find, easy to use, and easy to share. The collection grows with new content published several times every week, and the features we are launching with today are just the beginning.

So, need to get up to speed on the hottest thing in Android dev, Kotlin? Take a look at the new Kotlin Learning Path, a set of eight pieces of content from experts like Donn Felker, Jake Wharton, and Hadi Hariri. Or maybe you want to get deeper on iOS programming paradigms? We’ve got a Learning Path that includes Natasha the Robot’s session on Practical Protocol-Oriented-Programming and Rob Napier on Functional Programming. And if you just want to browse the new sessions from AltConf 2017 or learn everything you need to know about MVVM, that’s easy too.

Getting the Most from Realm Academy

The home page is the launching off point to everything Realm Academy, and the place to check in on what’s new. At the top of the page, you’ll see links taking you off to major Academy sections organized around key categories, including platforms Android, Apple, JavaScript, and Xamarin, plus Realm of course; and focus areas like Architecture and Scaling. As you scroll the page, you’ll see content curated into both Topics and Learning Paths. Topics are collections of all related content, designed for browsing and serendipity—you can find an in-depth answer to a question, but you are as likely to be surprised and inspired by a best practice you didn’t know about before. Learning Paths are smaller and much more focussed—serial collections of content curated to take you point-by-point to a specific topical destination. You’ll also see content organized by event, so, for example, you can see in one place all the content from DroidCon Boston, TrySwift Tokyo, or other conferences.

We’ve got dozens of pieces of new content in process, and much more planned in terms of new Realm Academy features and enhancements, so we recommend checking back often. Or even better, sign up for the Realm Newsletter, which will bring you updates on Realm Academy, new content, and new mobile tech. You‘ll find a field for subscribing on every page.

Join the Realm Community

Realm Academy content comes out of our partnerships with some of the best developers and best developer conferences of the world, contributions from top members of the Realm community, and our own experts here at Realm. We’d love to feature your content too! Send your content contribution proposals—and any other thoughts—to the Realm Academy Team.

Read more

Realm ObjC & Swift 2.9: Set Permissions Based On Usernames, User Info Lookup & Bug Fixes!

by /

We’re releasing version 2.9 of Realm Objective‑C and Realm Swift today. In this release, we’re introducing a way to set permissions based on usernames, a way for administrators to retrieve user information from a Realm Object Server, various improvements, and applying a few bug fixes to keep your apps running strong.

Set Permissions Via Username

It’s now possible to set user permissions based on a user’s username, if they were registered using the Realm Object Server’s built-in username authentication system.

let permission = SyncPermissionValue(realmPath: realmPath,
                                     username: "alice@realm.example.org",
                                     accessLevel: .write)
user.applyPermission(permission) { error in
  // ...
}

Retrieving User Info

Administrator users can now look up the information of users on the Realm Object Server. If an administrator knows a user’s username, they can look up their Realm Object Server identity, which can be used to perform further administrative tasks.

let targetUserIdentity = "bob@realm.example.org"
adminUser.retrieveInfo(forUser: targetUserIdentity, identityProvider: .usernamePassword) { (userInfo, error) in
  guard let userInfo = userInfo else {
    return
  }
  print("The user's ROS identity is \(userInfo.identity)")
}

Sync User Improvements

It is now possible to create and log in multiple Realm Object Server users with the same identity if they originate from different servers. Note that if the URLs are different aliases for the same server each user will still be treated as separate (for example, they will each have their own copy of any synchronized Realm).

If you are creating users using the administrator token, we strongly recommend you specify an authentication server URL when calling the logIn() method. This server URL will become mandatory in a future release for all user types.

Other Enhancements

  • Performance for instantiating Swift objects containing at least one List property has been improved.

Bug Fixes

  • List.description now reports the correct types for nested lists.
  • Unmanaged object initialization when a nested property type returns false from Object.shouldIncludeInDefaultSchema() now works properly.
  • RLMArrays are no longer cleared on self-assignment.

Thanks for reading. Now go forth and build amazing apps with Realm! As always, we’re around on the Realm Forums, Stack Overflow, GitHub, or Twitter.

Read more

RealmContent: Add Real-time Updates to your iOS App in 5 Min

by /

 

Introduction

RealmContent coupled with the Realm Mobile Platform quickly gives the developers the ability to add new content into an iOS App by adding data directly into the Realm Browser app.

RealmContent automatically adds the Realm objects it needs into the app’s own schema and allows the developer to use a number of pre-configured View Controllers to list the available content and to render each of the content “pages”.

The component works mostly automatically while it allows for a lot of customization. It saves developers time and drudgery of implementing the underlying plumbing themselves or even having to roll out a completely new version of the app to change in-app content.

The library is the easiest and fastest way to push content in real-time to your complete user base.

How does it work? The technical crash-course

There are five easy steps to add a dynamic content management system to an iOS app.

1) Import RealmContent

Add RealmContent via CocoaPods or include the source files directly into your project. Then import both RealmSwift and RealmContent in a view controller:

import RealmSwift
import RealmContent

Your app would normally have a list of objects it syncs from the Realm Object Server. Once you import RealmContent it will expose two new models which Realm will add to your default schema: ContentPage and ContentElement.

If you’re using multiple Realm files, add ContentPage and ContentElement to the desired object schema.

2) Create a content list data source

To display a list of the available content in your app you can use the ContentListDataSource class that RealmContent provides you with:

let items = ContentListDataSource(style: .sectionsByTag)

Use .plain for a plain list or .sectionsByTag for a list with sections having the pages split by their tag property.

3) Initialize the data source

Call loadContent(from:) to set which realm file to use as the content source:

items.loadContent(from: try! Realm())

You can also have the data source automatically tell your table or collection view to reload the data whenever changes come in from the Realm Object Server (best option):

items.updating(view: tableView)

4) Implement your table view or collection view data source methods like usual, but fetch data from the content data source. The class offers few methods to do that like: numberOfSections, numberOfItemsIn(section:), titleForSection(section:), and itemAt(indexPath:).

This way you can implement your own table view or collection view data source methods and do any UI setup or other logic that you need. (For more detailed code sample check out the demo app in the RealmContent repo.)

5) Presenting a content “page”

Present a ContentViewController instance to display content. You can do this from a table/collection view tap delegate method, prepareForSegue(_:) method, or from an arbitrary piece of code.

Here’s an example of how would it work after a tap on a table cell:

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
  tableView.deselectRow(at: indexPath, animated: true)

  let item = items.itemAt(indexPath: indexPath)
  let vc = ContentViewController(page: item)

  navigationController!.pushViewController(vc, animated: true)
}

The presented view controller uses a table view to dynamically show the content from the given ContentPage element. In case you change the content remotely, the changes will be reflected in real-time on screen.

Dynamically add, edit, or remove content

The best aspect of using RealmContent is that you can modify the displayed content at any time - all changes will be synchronized in real-time to all connected users. (And upon connecting for all users who aren’t connected in this very moment of course.)

You can easily use the Realm Browser app to add or remove new pages, add, re-arrange, and otherwise modify blocks of content, and more. You can even change the accent color of your headings and links.

Editing contentn via Realm Browser

Try RealmContent now

The component is open source and you can find the source code and a demo app here: https://github.com/realm-demos/RealmContent.

The quickest way to try RealmContent in your app is via CocoaPods; add pod 'RealmContent' to your Podfile.

If you have an idea for a feature, want to report a bug, or would like to help us with feedback reach us on Twitter or create an issue on GitHub.

We’re excited to see how far are you going to push this component and the awesome dynamic apps you’re going to create with it!

Read more

Easy End-to-End Encryption: Introducing ZeroKit for Realm

by /

Realm is dedicated to helping you build great apps, and one of the ways we do that is by making it easier to work with the data that powers your apps. Instead of having to write (and maintain) fragile networking and serialization code, the Realm Mobile Platform handles that work automatically, making realtime data sync, sharing, and building server-side data features easy. And of course, we do it securely, offering HTTPS/TLS, AES-256 encryption at rest, and flexible access control features. You are freed to focus on the work that will matter to your users.

But for some apps and some use cases, you need a higher level of data security. That’s why we’re happy to announce end-to-end encryption, with Tresorit’s new ZeroKit SDK integration with the Realm Platform. Now you can easily build realtime, reactive apps that meet the standards required for handling healthcare, government, financial, and other highly sensitive data.

Understanding End-to-End Encryption

End-to-end encryption is the method of choice to protect data transmitted between devices. By encrypting data on the source device before transmission, man-in-the-middle attackers cannot decode the data if they capture it, even if the transmission route itself isn’t encrypted. Only the clients who share the crypto keys can access the information; no other sources potentially snooping traffic, including internet service providers, can see what information is contained within that data. Today, this is standard practice for encrypted chat apps like Signal, Threema, iMessage, and FaceTime.

The challenge is that end-to-end encryption requires a very extensive set of processes to implement, and that can eat up a ton of development time. And if they are not implemented and tested properly, it’s possible to leave flaws that attackers could exploit. End-to-end encryption isn’t impossible or broken—it’s just hard, and it’s important to do it right.

Tresorit + Realm Make It Easy

With the ZeroKit SDK integration for the Realm Mobile Platform, Tresorit built an exceptionally simple, secure, and scalable integration with Realm. Building on their depth of knowledge in building cloud security services, the ZeroKit SDK makes end-to-end encryption accessible to all development teams.

At the core of ZeroKit is an SDK that provides a secure user auth service with end-to-end encryption functionality. This enables the sharing of encrypted data between devices using a single user account and also any number of other accounts which have been granted access.

ZeroKit works on the principle of using the user account system to share encryption keys between client devices. When a new user is invited to view encrypted data from another user, an encryption key is shared in order to decrypt the data. If desired, the key can also be revoked, rendering the data once more inaccessible.

Instead of completely rewriting your backend, you can integrate ZeroKit into Realm without any trouble. Combining the best of both worlds, Tresorit has set up a way to use ZeroKit to perform end-to-end encryption in conjunction with the synchronization capabilities of the Realm Mobile Platform so that your data is end-to-end encrypted while synchronizing seamlessly, in realtime.

How It Works

How it works is actually quite simple. ZeroKit integrates itself with Realm via the Realm Mobile Platform’s ability to allow third-party services to authenticate synchronization sessions. When a user logs into Realm, they use their ZeroKit credentials, which identifies them as a unique user to the Realm Mobile Platform. Once logged in, the encryption keys for that account are made available on that device throughout the user’s login session.

Tresorit diagram

After login, each time a set of data is to be saved, the developer calls a ZeroKit API to encrypt the data on the device. Behind the scenes, ZeroKit stores and uses the keys generated for the current Realm, so that developers don’t have to deal with the complexity of crypto. The encrypted data is then saved to Realm where the information cannot be read successfully by any attacker or even the server itself. To decrypt the data, the same process is repeated in reverse. If the logged-in user has access to the keychain (“tresor”) associated with the Realm, data will be seamlessly decrypted.

To share data with other user accounts, you can combine Realm’s and ZeroKit’s share permissions features. This requires Realm to share the required data and Tresorit to share the appropriate key to decrypt it. The guest user can now read the data with both components. You can also revoke the encryption key, meaning that even if the Realm data file lingers on the guest user’s disk, the information is rendered inaccessible.

In this way, Realm is able to synchronize data out in the open and absolutely nothing in Realm’s stack, or the infrastructure it is run on, is in charge of the encryption. What’s even more exciting is that ZeroKit was built in a way that even Tresorit doesn’t have access to the keys because they are stored encrypted with a secret derived from the ZeroKit user’s password. And Tresorit doesn’t have access to the password either: this is what they call “zero knowledge” service. ZeroKit uses Augmented Password-authenticated Key Agreement (APAKE) protocols to achieve this.

Although end-to-end encryption is all about client-side data access with servers that can’t decrypt data, you don’t have to encrypt everything this way. You can decide to only encrypt sensitive data end-to-end; the rest, you can access on your Realm Object Server. However, if you still need to access encrypted data on the server, you can use ZeroKit’s Node SDK, which enables you to log in a ZeroKit user on the server. Storing the password of this special server user is a task you need to plan carefully though, or ask the Tresorit team’s advice on best practices using Hardware Security Modules and other tricks to keep your product secure.

Combining Realm and Tresorit’s solutions is exceptionally advantageous for use cases requiring enhanced security. In order to compromise data in this architecture, an attacker must both compromise your data and separately steal the keys from every single user, one by one, on their client devices to decrypt it. It’s really fantastic for Tresorit to show us how easy it was to integrate their services into our own, and together, they provide a level of security that is absolutely unparalleled.

The solution is ready for you to experiment with today, just remember you’ll need to do a few more steps before taking the end product into live production to ensure your users’ privacy: for example writing code to validate your users’ email/phone number after registration and arranging certs on your servers. Details are covered in ZeroKit’s documentation.

If you’re building an app dealing with highly sensitive data, we definitely recommend you check out ZeroKit and give it a try!

Read more

Realm Java 3.4 - Reverse Relationship Queries and Sync Progress Listeners

by /

We’re releasing version 3.4 of Realm Java today, and with it introducing reverse relationship queries and sync progress listeners. Read on for all the details.

Reverse Relationship Queries

In Realm Java 3.1 we added beta support for reverse relationships using the @LinkingObjects annotation. In 3.4 we are making it possible to query those relationships as you would with a normal RealmList or RealmObject reference:

public class Person extends RealmObject {
   public String name;
   public Dog dog;
}
 
public class Dog extends RealmObject {
   public String name;
   @LinkingObjects
   public final RealmResults<Person> owners = null;
}
 
// Query for owner as you would a RealmList
Person owner = realm.where(Dog.class).equalTo("owners.name", "Jane").findFirst();

Queries on @LinkingObjects work the same way as Link Queries on RealmLists and with this change we are considering @LinkingObjects stable, and are moving them out of beta.

Sync Progress Listeners

Realm Mobile Platform offers a true offline-first experience, where changes can be applied immediately to the local Realm irrelevant of the network conditions. In the background, synchronization happens automatically, and when the network is available, changes quickly propagate across devices and the server. This enables the realtime, collaborative experiences unique to Realm.

There are times, however, when it’s useful to know how much data is left to transfer. Perhaps on the first launch of your app, you’d like to make sure a sizable amount of the data is available before presenting your user interface. At other times, your app will simply benefit from showing when data is synchronizing, by presenting a progress bar or activity indicator.

This is why we’ve added APIs to monitor sync progress by registering ProgressListeners on the SyncSession.

Realm realm = Realm.getInstance(config)
writeData(realm);
SyncSession session = SyncManager.getSession(config);
 
// Show progress bar while waiting for an image you just wrote to the Realm
// to be uploaded
showProgressBar();
session.addUploadProgressListener(ProgressMode.CURRENT_CHANGES, new ProgressListener() {
   @Override
   public void onChange(Progress progress) {
       if (progress.isTransferComplete()) {
           hideProgressBar();
           session.removeProgressListener(this);
       } else {
           updateProgressBar(progress.getFractionTransferred());
       }
   }
});
 
// Show a UI hint as long as you are downloading data from the remote server
session.addDownloadProgressListener(ProgressMode.INDEFINITELY, new ProgressListener() {
   @Override
   public void onChange(Progress progress) {
       showDownloadingChanges(!progress.isTransferComplete());
   }
});

Note, that currently progress listeners can only be registered if a Realm instance is open.

See the CHANGELOG for the full list of changes.


Thanks for reading. Now go forth and build amazing apps with Realm! As always, we’re around on Stack Overflow, GitHub, or Twitter.

Read more

Bringing Education into the Digital Age with Realm

by /
Thread Learning: Coordinated Autism Education Powered by Realtime Data Sync and Offline-first Capabilities

Each day, special education teachers manually track thousands of data points related to student progress. At the end of the day, they graph that data with a ruler and analyze the results. The process is incredibly cumbersome and time consuming, and paper-based data has significant limitations.

 

Thread Learning is advancing the way that teachers, parents, and therapists educate children with special needs and autism. Thread Learning’s behavioral data collection platform allows caregivers to record student data using an iPad. The platform then automatically graphs and analyzes the data, provides quality control, and shares the results with all members of a child’s care team, including parents.

Armed with electronic data, a caregiver team can more efficiently coordinate the work of all members to better serve the needs of the student. For example, a child may be working on speech skills with three classroom teachers, as well as a speech therapist and behavioral analyst after school. Thread Learning syncs data in realtime across all team member devices. More informed caregivers means better quality instruction and improved student outcomes.

Building a Coordinated Care Platform

To deliver on their vision of coordinated care, Thread Learning needed a data handling solution that could allow caregiver teams to collaborate in realtime. One of the co-founders was exposed to Realm in a graduate school computer science class. He recognized its potential to enable advanced features that would otherwise be impossible to implement as a nascent startup.

“Realm really helped accelerate our development timeline. We were up and running in weeks instead of months.”
- Sam Raudabaugh, Co-Founder & CTO, Thread Learning

The Thread Learning team initially developed their app using the Realm Mobile Database. This allowed them to bypass the typical headaches of MySQL and an ORM, as well as the technical and resource debt that comes with non-object oriented data solutions.

After the Realm Mobile Platform was released, the Thread Learning team found it a natural progression to explore its more robust data handling and realtime synchronization capabilities. They had been using a REST API to handle data flows, but Realm’s data sync capabilities offered a much better solution. Two-way data synchronization enables a team of caregivers to work simultaneously on the same set of data in realtime.

“We tested Realm against our REST API and the results were impressive.”
- Sam Raudabaugh, Co-Founder & CTO, Thread Learning

Offline-First, Simplified

As school WiFi networks are often unreliable, Thread Learning also needed robust offline capabilities, so that caregivers could still input and access data regardless of connectivity. One of the founders’ early mentors had advised them to avoid offline functionality entirely because it’s “too hard and complicated.” However, the Realm Mobile Platform enables Thread Learning to easily handle networking complexities, such as data updates and conflict resolution, without the issues that typically arise with REST APIs.

Because data loss has historically been a big issue with paper-based processes, Thread Learning especially appreciated Realm’s built-in support for offline-first use cases. With Realm’s client-side database, all app data is stored locally and remains fully accessible when offline, providing a continuous, responsive offline user experience. When connectivity is restored, updates are automatically synced with the Realm Object Server and across all care team devices. Realm’s conflict resolution capabilities ensure that data is always up to date.

“With Realm, we don’t have to worry about what happens when devices go offline and data conflicts happen.”
- Gregory Brill, Co-Founder & CEO, Thread Learning

As the Thread Learning team works on evolving their platform, Realm’s transparency around new feature development helps them plan their own feature roadmap. This helps them better manage their growth and support their mission to serve 1m+ autistic children in the U.S. within the next five years.

“Realm allows us to leapfrog the competition.”
- Gregory Brill, Co-Founder & CEO, Thread Learning

Read more

Realm Events at WWDC 2017

by /

WWDC Week is coming and Realm is planning another week filled with WWDC Events!

Join Realm in San Jose and San Francisco for a variety of events. If you are in town we hope you will join us, and if you are not, tune in on facebook and twitter for our second year of “Realm Live from WWDC”. Whether you have tickets to the conference or are in town for other events, we have something planned for you.

  • Keynote Viewing Party: Come see the keynote live streamed at Realm HQ in San Francisco.
  • WWDC Bingo: Play an epic game of WWDC Bingo, powered by Realm, at the Realm viewing party, live at the keynote, or from the comfort of your own home. (Details and app coming soon)
  • Swift Panel: We’re hosting a panel discussion on the second night of the conference in San Jose (Details and registration below - location: Westin San Jose - Across from WWDC and Altconf).
  • WWDC Live @ Altconf: See interviews with WWDC & Altconf attendees, as well as live streams of a variety of AltConf Sessions. Check back for a full schedule.
  • Realm World Tour - San Jose: Join us as we continue the Realm World Tour in San Jose and announce new locations for the Summer!

Keynote Viewing Party

Just because you don’t have tickets to the conference, doesn’t mean you have to watch the Keynote alone. Come by Realm Headquarters in San Francisco for a viewing party, and join other developers as well as the Realm Team to watch the Keynote together. We’ll have brunchy bites and drinks.

When: Monday June 5th, 2017 @ 10am

Where: Realm Headquarters: 148 Townsend St, San Francisco, CA 94107

  • 9am: Doors open! Mix & mingle and grab some breakfast and drinks.
  • 10am: Keynote + WWDC Bingo.
  • Afterwards: Mix and mingle some more and grab a Realm t-shirt on your way out.

RSVP: Reserve your spot!

Swift Panel

Join Chris Lattner, Jesse Squires, Kamilah Taylor and Kevin Ballard as Realm’s JP Simard moderates this panel-style discussion on everything Swift.

When: Tuesday June 6th, 2017 @ 6pm

Where: Westin San Jose 302 S Market St San Jose, CA 95113

  • 6pm: Doors open! Mix & mingle among your fellow Swifters. Drinks and light snacks provided.
  • 7pm: Panel + Q&A.
  • Afterwards: Stay and chat with our panelists, mix and mingle some more.

*IMPORTANT: Capacity for this event is limited. RSVPs are required to attend and will be FIRST COME FIRST SERVED for the first 100 people at the door by 6pm.

RSVP: Reserve your spot!

Realm World Tour - San Jose

We just closed out the first leg of our Realm World Tour (See the highlights), and it was awesome! But we didn’t make it to San Jose, so we are kicking off the second leg of our Realm World Tour during WWDC week. You’ll be able to connect with Realm users who are in town from all over the world, see live Realm demo’s, & learn more about our newly launched Realm Mobile Platform.

When: Wednesday, June 7, 2017

Where: Westin San Jose 302 S Market St San Jose, CA 95113

RSVP: https://realmworldtoursanjose.eventbrite.com

Read more

Announcing Realm World Tour - The Encore!

by /

Whew! After traveling across 23 cities in less than 2 months in February and March we had to take a little breather.

But now we are back in action and sending more of our top product engineers out across the globe to bring the Realm Platform to you live!

We’ve reached out to leaders of the developer communities in each city, and with their help as local hosts, have planned a great evening for attendees. Each event includes an introduction to the free Developer Edition plus discussion of some of the advanced features, followed by sample code, practical demos, and extensive technical Q&A session — all led by a Realm product engineer. There will also be plenty of time to talk one-to-one, to share best practices, and to learn from each other. And, we’ll have some special attendees-only limited edition Realm swag to give out!

realm-world-tour-facebook We are starting off this leg of the tour in San Jose followed by another stop in Seoul, then onto Toronto, Denver and Atlanta, and adding MORE cities as we go. You can see other stops on the tour here.

Want us to come to you? If you want us to stop in YOUR city, tweet @Realm with hashtag #Realmworldtour and #cityname. We will be tallying votes throughout the tour, so get your friends to vote too! **Bonus points if you hook us up with a local meetup group or host location! ;)

We hope to see you!

The Realm World Tour events are free, but space is limited — check out the official web page for the latest info and chance to register.

Read more

Serverless Logic with Realm: Introducing Realm Functions

by /

Today we’re announcing Realm Functions, a new part of Realm that makes building server-side functionality a lot easier for mobile developers. Now, you can make server-side features without enlisting backend developers, plus you get all the benefits of building on top of the Realm Mobile Platform: you don’t need to add another endpoint to a server, and then write the serialization and networking code that would let you connect with it. You just connect your app to Realm, write a Realm Function in your web dashboard, and watch your code execute reactively as data streams in. Today’s release is a beta, and it’s available today to everyone, whether you’re building an app in an enterprise-scale team or for a small side project.

Performant data storage and realtime data synchronization are important parts of building a great app, but there’s an endless world of possibilities when you can add custom logic to your server. You can write functionality that needs to be protected from tampering, call and coordinate countless other APIs, or use your app’s aggregated data to power machine learning systems. Unfortunately, sophisticated server-side features are hard to build, and hard to integrate with your mobile apps. Even a basic streaming API requires lots of work from the backend developers who will build out the server-side code, and a lot of attention and maintenance so that your apps and server can communicate the data your users need.

Write code that does work, not code that makes work

Realm is deeply committed to getting rid of the roadblocks between you and great apps — and up until now, the bulk of our work has revolved around data. The data you work with in your apps should be easy to save, easy to sync, and easy to respond to as it changes — wherever it changes, and whoever changes it. With Realm Functions, we aim to make it just as easy to create the logic that your app is built on so that you can focus on delivering hard, important features.

In our web environment, you simply write JavaScript to perform the tasks you need, and you’ll instantly see the results as data pours in and your code runs reactively in response. You can breathe a sigh of relief, as adding more features doesn’t also mean adding more fragility and maintenance to your app: you don’t have to add any new serialization or networking code to make a Realm Function work, as the Realm Mobile Platform takes care of getting data to connected clients.

Try out Realm Functions

To show how easy it is, we added a cool new feature to our Realm Tasks app. When you create a task that has a time or date in the title, we’ll use a natural language processing API to turn that into a due date on your task. We did it with just a few lines of code in the app to display the reminder, and a few more lines of JavaScript to call the NLP API and update the Task object. Check out the video, and continue below to get started yourself.

 

To try it out yourself, just head over to our Realm Tasks repository and follow the instructions there to get started with the Realm Mobile Platform and Realm Functions. Or if you’d like, you can jump right to the Realm Functions documentation.

Realm Functions is a powerful way to add server-side logic to your app through a simple web interface. All Realm Mobile Platform users get access to the Realm Functions beta, and you can start using it today. Today’s beta release lets Developer Edition users try Realm Functions for free with up to three concurrent running Functions; Pro and Enterprise Edition customers have an unlimited number of Functions they can implement. We’re excited to see what you can build using Realm Functions!

Read more

Announcing Realm for Universal Windows Platform

by /

Today, we’re pleased to announce delivery of the most requested feature of our .NET community: Realm Mobile Database for Universal Windows Platform (UWP). UWP support is a major piece in the Microsoft puzzle for Realm—we’ve long had full support for Xamarin, a few months ago we added Win32 support, and a few weeks ago we joined the Azure Marketplace, enabling anyone to get started with the Realm Platform with just a few clicks. All of this has helped make .NET the fastest growing community of Realm developers over the last two quarters.

Realm for UWP means you can use Realm’s world-class object database to build apps for the 400 million mobile, PC, and Xbox devices powered by Windows 10—so you can now use Realm on virtually any modern Windows platform, including the Surface family of devices. For Xamarin developers, UWP support means that Realm now supports all platforms using Xamarin.Forms (Android, iOS, and now, UWP). With Realm and Xamarin.Forms, you can use a single codebase to build apps for all major mobile platforms.

With the addition of UWP, Realm now supports .NET developers across all popular mobile platforms—iOS, Android, and Windows 10—allowing people to use a single persistence and ViewModel layer across all of them. The strength of the Realm .NET community combined with the mobile innovation we see coming out of Microsoft encourages us to continue investing in growing our .NET offerings. We’re excited to share new and exciting tools for the .NET community of developers and we can’t wait to see what you’ll build. It’s as easy as jumping into the documentation.

Read more

Realm Java 3.2: Open Realms Asynchronously, Download Realm, Read-only Flag

by /

We’re releasing version 3.2 of Realm Java today, and with it introducing asynchronously opening a Realm, making read-only Realms as well as more improvements to our synchronized Realm APIs. Read on for all the details on this and more.

Asynchronously opening a Realm

The general recommendation for opening a Realm has always been using Realm realm = Realm.getInstance(configuration). Normally this is extremely fast as we internally cache Realm instances. However, if you have migrations or need to copy an initial file from assets, opening the Realm file for the first time might be a bit slower than you would like.

With 3.2 we now introduce Realm.getInstanceAsync(configuration, callback). This method allows you to open a Realm instance on a background thread and only return once all expensive operations have completed.

One way of using this method can be seen below:

// Let all your activities implement this class
public abstract class BaseActivity extends Activity {
   private Realm realm = null;
   private RealmAsyncTask realmAsyncTask;

   @Override
   protected void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       realmAsyncTask = Realm.getDefaultInstanceAsync(new Callback() {
           @Override
           public void onSuccess(Realm realm) {
               if (isDestroyed()) {
                   // If the activity is destroyed, the Realm instance should be closed
                   // immediately to avoid leaks. Or you can call realmAsyncTask.cancel()
                   // in onDestroy() to stop callback delivery.
                   realm.close();
               } else {
                   BaseActivity.this.realm = realm;
                   onRealmReady(realm);
                   // Remove the spinner and start the real UI.
               }
           }
       });
       // Show a spinner before Realm instance returned by the callback.
   }

   @Override
   protected void onDestroy() {
       super.onDestroy();
       if (realm != null) {
           realm.close();
           realm = null;
       } else {
           // Calling cancel() on the thread where getInstanceAsync was called on to
           // stop the callback delivery. Otherwise you need to check if the activity
           // is destroyed to close in the onSuccess() properly.
           realmAsyncTask.cancel();
       }
   }

   // This can be overridden by activities so they can start displaying data once Realm
   // is ready.
   abstract void onRealmReady(Realm realm);
}

Download Realm

Alongside Realm.getInstanceAsync() we also added a new option for synchronized Realms: SyncConfiguration.Builder.waitForInitialRemoteData().

You can enable this option to force Realm to download an initial dataset from the server before reporting the Realm as ready to be opened. This can be beneficial if it doesn’t make sense for your app to display anything until it has a full dataset available. “Full” is determined by the point in time the client contacts the server, so if more data is written by other devices in the meantime, they are not taken into consideration. These changes will of course continue to synchronize in the background after the Realm has been opened.

SyncConfiguration config = new SyncConfiguration.Builder(getUser(), getUrl())
    .waitForInitialRemoteData()
    .build();

// This will not be called until the remote Realm has been fully downloaded.
Realm.getInstanceAsync(new Realm.Callback() {
   @Override
   public void onSuccess(Realm realm) {
       // Use Realm
   }
});

This dataset will only be downloaded the first time the Realm is opened i.e., no local Realm file exists. After that, the Realm will be opened immediately.

Read-only Realms

With 3.2 we also enabled the option to create read-only Realms. These can be useful if you do not want to accidentally write changes to a Realm file.

RealmConfiguration config = new RealmConfiguration.Builder()
       .assetFile("my.realm")
       .modules(new MyModule())
       .readOnly()
       .build();

SyncConfiguration syncConfig = new SyncConfiguration.Builder(getUser(), getUri())
       .waitForInitialRemoteData()
       .modules(new MyModule())
       .readOnly()
       .build();

Marking a Realm as read-only will cause all transactions against that Realm to throw an IllegalStateException.

Note this also prevents writing any schema information to the file, so marking a Realm as read-only only makes sense if you at the same time either set RealmConfiguration.Builder.assetFile() or SyncConfiguration.Builder.waitForInitialRemoteData().

Since the Realm schema is automatically created from all known Realm model classes, there can be an advantage to explicitly enumerate all classes in the provided file. This is done using modules.

Refreshing a Realm

Calling Realm.refresh() will force all asynchronous queries to be synchronous in order to provide a consistent view of the underlying data. You should only use refresh() if you are not using any asynchronous queries.

With the changes introduced to iterators in 3.0, it has now been possible to add Realm.refresh() back after popular demand.

Calling Realm.refresh() will force any Realm instance to the latest version of the database as well as trigger any registered notifications. This has especially been useful if you are using some other notification system than Realm notifications, e.g. event busses.

Other improvements

  • It is now possible for SyncUsers to change their password using the new SyncUser.changePassword(password, callback) API.
  • It is now possible to ask if a given SyncUser is an administrator on the Realm Object Server by calling SyncUser.isAdmin(). Admin users have special capabilities like changing permissions for other users.
  • Transient fields in Realm Model classes will now be treated as implicitly having the @Ignore annotation.
  • DynamicRealmObjects now support reverse relationships as well using DynamicRealmObject.linkingObjects(String parentClass, String parentField).

See the CHANGELOG for the full list of changes.


Thanks for reading. Now go forth and build amazing apps with Realm! As always, we’re around on Stack Overflow, GitHub, or Twitter.

Read more

Realm Events at Google I/O 2017

by /

Are you headed to Google I/O? Join Realm in Mountain View and San Francisco for some I/O fun! Whether you have tickets to the conference or are just in town for the other events, we have something planned for you.

  • Women in Android Panel: Realm and San Francisco Android Developers are hosting a Panel discussion on the second night of the conference at Realm Headquarters (Details and registration below).

  • Google I/O Scavenger Hunt and Realm Swag: Can’t make it to San Francisco but still want in on the fun? Don’t worry, look for us at Shoreline on Wednesday before the Keynote. We will be handing out details about our Google I/O Scavenger Hunt and some fun Realm swag.

Google i/o Scavenger hunt

Women in Android Panel

Realm and the SF Android Developers Meetup invite you to our Google I/O Women in Android Panel.

Join Stacy Devino, Caren Chang, Angella Derington, and Nicolette Yadegar, with Britt Barak from Women Techmakers Tel Aviv as she moderates this panel-style discussion on everything Android.

When: Thursday May 18th, 2017

  • 6pm: Doors open! Mix & mingle among your fellow Android Devs. Drinks and snacks provided.
  • 7pm: Panel + Q&A
  • Afterwards: Stay and chat with our panelists, mix and mingle some more.

*IMPORTANT: Capacity for this event is limited. RSVPs are required to attend and will be FIRST COME FIRST SERVED for the first 150 people at the door by 6pm. RSVP ON EVENTBRITE

Panelists

Stacy Devino is the head of Mobile Apps for one of the fastest growing FinTech companies in the US. Prior to that she was the technical lead for Android Apps at Home Depot. Stacy has been doing this since Android 1.6 and has worked in embedded Android operating-system-level as well as hybrid and consumer applications.

Caren Chang studied Computer Science at UC Berkeley and has been around the Bay Area ever since. Previously she worked at companies such as Dreamworks and VSCO, and is currently helping build smart ovens at June. Her favorite part of Android development is working with custom views and animation.

Angella Derington is a seasoned Android developer with a passion for creating experiences that delight the user in their simplicity and polish. In the last few years, she has been busy working on the Android apps for major retailers. When not building apps, Angella keeps herself busy with her two kids, dog, and two cats!

Nicolette Yadegar is currently the Technical Lead for Support Engineering on Microsoft’s Yammer Android team. As Team Lead, she focuses on Performance and QA, while working on internal projects including upgrading/adding new libraries, adding fun features like GIF support, and refactoring efforts. Before that she worked at Microsoft on their IoT Innovation team and their Frameworks & Services team.

Britt Barak (Moderator) is co-leading Android Academy TLV which is one of the largest and most active Android communities out there. Britt is also leading the Women Techmakers Israel community. She is on a mission of sharing knowledge and inspiring others. You can find her public speaking, mentoring and blogging on Android development at .

This panel is presented by Realm, a platform to build reactive apps, realtime collaborative features, and offline-first experiences.

Read more