On April 16 and 17, Mendix World 2019, the world’s largest low-code development event, took place in Rotterdam Ahoy. The session ‘The future of mobile apps is offline-first’ had a fully packed room. Although the motto mobile-first is common sense when you build an app, there is a growing demand for offline-first apps. Hence, Danny Roest, Mendix product manager for mobile, and Marcel Groeneweg, certified Mendix expert at ITvisors, inspired the audience to start building offline-first apps.
Why do we need offline-first apps? “In city centers, you expect reliable public internet connections, says Danny. In the summer, I like to listen to music via the internet when I cycle to work. However, I discovered that there is no reliable connection near the famous Erasmus bridge in Rotterdam where our Mendix office is. Suppose I travel to work by car and get an accident. I open the online insurance app to record my claim. Unfortunately, the app needs a connection, so I get an error message due to the lack of network coverage. That is frustrating. Therefore, at Mendix, we make it possible to build apps that work regardless of the network connectivity status.”
An offline-first app works because it interacts with a local database on your device. Mendix handles the eventual data synchronization with the server. To start building an offline-first app, you have to create an offline navigation profile. Based on this profile, Mendix performs consistency checks to ensure that your app will work. Besides, Mendix also supplies the mechanisms to run on your device the wire logic, interaction logic, business rules, and so forth.
The main three benefits of offline-first apps are an increase in user experience (UX), reliability, and battery performance:
When you open an online app, and the internet connection is weak, your app doesn’t work well as it frequently tries to connect. As a result, your UX reduces even if the app has a fancy user interface. Offline-first apps are the solution because you don’t need a connection. That improves your UX.
Field service engineers, for example, use apps when they visit remote locations (e.g., factories, basements). These locations often have bad or no connectivity at all. Offline-first apps are a reliable resolution because these apps enable field service engineers to synchronize their data before, and after, visiting a remote location.
- Battery performance
Online apps rely on an internet connection and drain the battery capacity of your mobile device. Offline-first apps enable you to work without an internet connection and save your device’s battery life.
“At Mendix, we make it possible to build apps that work regardless of the network connectivity status.”
Mendix 8 offers lots of capabilities that empower you to build better offline-first apps faster. The five capabilities worth mentioning are:
Capability 1: Automatic sync improves your data synchronization. It determines all the entities synchronized to your device, and it also applies security constraints.
Capability 2: Configurable sync gives you control over the data you want to synchronize. You get an additional syntax dialogue in your profile that shows which entities you can synchronize. Also, you can add your entities, determine which entities you want to control, and create sync activities yourself.
Capability 3: Full control is still in the planning phase. It allows you to call a microflow from an offline app. For example, fetching data from an SAP system.
Capability 5: XPath support in offline apps helps you to query data for your offline database.
It is crucial to handle all Mendix 8 capabilities gracefully. Danny: “Like in Spiderman, with great power comes great responsibility. When calling a microflow from an offline app, you have to handle the instances of poor or no connection. For example, be aware to catch exceptions and ensure that pluggable nanoflow actions do not make your app less robust.”
Do’s and don’ts
Marcel has extensive hands-on experience with building offline-first apps. He shared a couple of do’s and don’ts during his presentation with Danny.
Offline-first apps do’s:
- Do double check your business processes. “If your online and offline app users insert the same type of data, you get conflicts,” says Marcel. “Although Danny mentioned a module and patterns for conflict resolution, this error might be hard to solve. It’s better to check your business process for handling data upfront and to align it with the requirements for offline-first apps.”
- Do double check your entity access. Generally, users have more rights than you realize. It is essential to review these rights to understand and solve the problems.
Offline-first apps don’ts:
- Don’t rename a module or entity offline. An offline-first app in production breaks when the offline user renames a module or entity and the only recovery option is to undo the renaming and have all users synchronize again.
- Don’t just delete data. If an online user deletes data on the server and an offline user changes the same data, you get a synchronization error. Marcel: “Solving this error requires that users do not physically delete data but put a status on it. That assures that the data still exists, although it is not visible anymore for the user.”
Do you want to know how offline-first apps can help you to build and deliver apps faster, and ultimately grow business? Contact: Danny Roest, Mendix product manager for mobile.