New article: Build Offline-First Mobile Apps by Caching API Results in Realm

When building a mobile app, there’s a good chance that you want it to pull in data from a cloud service—whether from your own or from a third party. While other technologies are growing (e.g., GraphQL and MongoDB Realm Sync), REST APIs are still prevalent.

It’s easy to make a call to a REST API endpoint from your mobile app, but what happens when you lose network connectivity? What if you want to slice and dice that data after you’ve received it? How many times will your app have to fetch the same data (consuming data bandwidth and battery capacity each time)? How will your users react to a sluggish app that’s forever fetching data over the internet?

By caching the data from API calls in Realm, the data is always available to your app. This leads to higher availability, faster response times, and reduced network and battery consumption.

I’ve just published a new article (Build Offline-First Mobile Apps by Caching API Results in Realm) that steps through how the RCurrency mobile app fetches exchange rate data from a public API, and then caches it in Realm for always-on, local access.

1 Like

The exchangerate.host API is no longer freely available without registration, and limited to a point that the rcurrency app is not functional these days because of this. It does not allow secure https connections among other changes. I’d love to see this project working with an API again! It’s similar to what I’m looking to learn.