Offline-first approach to Xamarin development, with a real-world use case
Has it ever occurred to you that an app can be made to work in an offline mode? Yea, without an internet connection!
You might have an acquaintance with the concept of PWAs or specifically the progressive web apps. They follow a similar ideology to make their apps work in an offline mode. While they are limited to the web apps, here we talk about a dedicated mobile app with the offline-first approach.
Let’s dive into the core of the concept through a real-world use case reference.
Why our Client needed an offline-first Mobile app?
A leading Telecommunication giant, our client, wanted to simplify the field-testing process. The company has 100+ field technicians who performs field-testing of fiber optic networks at various locations. To simplify the testing process, the company wanted to launch a mobile app that would be integrated with the testing specific hardware device. The field technicians would utilize the app to execute their work orders, fix the issues, share the updates/images, access data, or any other tasks.
Being on the field, network strength is bound to vary and as it so appears, the signal drops. This would lead to loss of connectivity interrupting their interaction with the app. Repeated experiences can affect the overall productivity and would force them to perform manual data entry. So, this triggered our client to think - why not give my mobile workforce the flexibility to use an app even when the network signal isn't strong? This will not only prevent unwanted interruption but also lead to an improved employee productivity & error-free work efficiency.
This initiated the requirement of an offline-first Mobile app; along with the need for scalability, compatibility with modern hardware devices, and cross-platform capabilities. This strategical approach enables users to continue using an app, even if the connection is slow and if there is no internet connectivity.
How to develop a Mobile App with Offline compatibility?
Now that the client’s requirement is clear with a need for an offline-first approach modernized mobile app, let's get into the app development part of the story. Xamarin development framework was chosen as the platform to build app due to its shared code & cross-platform capabilities.
So, to turn the app to work in an offline mode or without internet connectivity, the data needs to be stored locally. To do so, our Xamarin developers have outlined three different ways:
- Caching: A pretty common term, caching works wonders when you have to access data locally. Websites often use the method of caching to promote the direct upload of static content. Now, this is for a page or smaller datasets. When we put an app onto the stands, caching content isn't the best way.
- Manual Replication: Suppose you are using the app in an offline mode and make some changes. With manual replication, you can mark the content to be edited or modified and these are then manually uploaded on to the server as soon as the connection is restored. True that manual replication sounds a better deal, it is vulnerable to crashes and so faces serious criticisms.
- Real-time Synchronization: Real-time Synchronization is partially the same as that of manual replication with the only difference being in the manual changes are uploaded to the server. Meaning that real-time synchronization automates the process accounting for self-restoration of conflicts. This is, in fact, the best way to process an app in offline mode.
To enable this offline functionality and set-up the communication between Xamarin mobile app and cloud, our teams leveraged Google’s Mobile Backend as a Service (mBaaS). Local SQLite database has been utilized as a real-time synchronization set-up to store the field-test results when offline and push the same to cloud upon connectivity. The backend services also included push notifications, running business logic, file sharing and storage, location services, user management, as well as usage analysis tools.
With the offline Mobile app development approach to build Smart Test Services Mobile App, our client was able to build a robust workflow management solution, which can handle 100,000+ Fiber-optic tests conducted by more than 2000 field-technicians. Adopting an offline-first approach is definitely beneficial given the ease with which it leads to seamless app interaction. In order to make the most out of the idea, one must clearly highlight the functions and features as part of the mode.