Offline Mobile App Architectures for iOS and Android Apps
Offline Mobile App Architectures for iOS and Android Apps
No matter how good a developer you are, you would require something to support your app offline. On this page, you will get to know about the offline mobile application architectures for iOS and Android Apps with which you can develop robust apps that can tackle offline capabilities in the best way.
Have you ever thought about why you have to design an app for the offline experience? Offline mobile app architecture is the most important thing that every developer should consider. Sometimes networks die and the networks are low and there are even more factors that will often need offline support. If your apps have users operating from different parts of the world then you need to account for the offline support or experience even more. Even if you are a good developer, in most cases you will require something to support your app offline. Everything depends upon what your app does; it might be simple or complicated sometimes.
What Is Offline Mobile App Architecture?
- Data is stored offline where there is no editing functionality. For this, you can consider the example of GPS data where the data is being stored offline temporarily
- The users can edit their data offline and once they are back online they can sync their details. For this, a note-taking app will be a great example
- The users can edit other data offline. For this, you can imagine edits to an offline Google doc type application
Trello’s offline architecture story

Trello did not support the offline capabilities in 2016 and its users were complaining a lot about this issue. The users wanted to use this app when they were traveling in subways to their work and organizing things before reaching their destination. In the initial architecture that Trello was looking into, it always assumed that the app would have a network attached to it. Their users were suffering from network disruption and this app was helpless for the app users. So in such a situation, Trello decided to move to offline-first architecture.
In the newer app architecture for iOS and Android apps, a local database plays a central role. After this up-gradation, the entire Trello app was able to run offline and it was very useful for many of its users. Trello went leaps beyond to make sure whether the app architecture can work smoothly both offline and online.
Application architecture without offline considerations

In this, you can see about the retrofit because a lot of developers use it as their data model. In architecture for iOS and Android apps, the view model relies on the network or the server to work. If there is no network then nothing can happen on the mobile and for the end-user, it might seem like the app is stuck in between.
If there is no network in the place then the application’s user interface would suffer from the pending request and would behave in absence of internet connectivity.
To improve this condition it is highly advisable to place a model within the app. Most of the clients will come with apps that have no model in place. But it should not be the case when you create an app.
Improving the architecture a bit
Here is a minimal improvement that can be done to improve the quality of the app. First, it is important to introduce a model. For example, you can consider the newsfeed app in which your user reads something interesting and wants to add a comment. You have to place a model with your app and see how you feel. Till the comment gets synchronized it will appear in a light color and when it gets fully synchronized it will turn into a dark color.
Evolution 2 and 3 Offline mobile app architecture
At some point in time, the developers noticed the shortcomings and started to introduce the local cache to their app. This was actually to work in the offline scenarios.
Here you can consider the same news feed app but also with a context to android. Usually, the developers handle the cache and this is done via the shared preferences or the SQLite database.
Dedicated cache service

Cache applied to the presenter
In the modification, the cache is applied to the presenter.
With both of these, it seemed to work for the low complexity cases. If you are building an app that has a substantial user base then it may not be able to work properly. Also, you can frequently see some implementation errors.
Evolution 4 and 5 Offline mobile app architecture
App architecture with retrofit
In the modification, the cache is applied to the presenter.
With both of these, it seemed to work for the low complexity cases. If you are building an app that has a substantial user base then it may not be able to work properly. Also, you can frequently see some implementation errors.
The persistent offline architecture
How do you fix this?
You have to change it to a persistent model. First start by persisting data on disk, by doing this the application can have the data if the user leaves the application. Also, use something called application logic with this you can make the network calls and keep the persistent model up to date.
Whenever the application logic does that it notifies and can be built on top of RX or on whatever you prefer. As soon as it fetches the information it shares it with the persistent model. This information can be then used by the entire application. Whatever component needs the information, the component can directly request the information from the persistent model.
Space for further optimizations
What offline mobile app architecture to use?
Offline – online sync: architectural considerations
- How and where you are going to cache your data?
- To what extent is caching reliable?
- How is the architecture going to handle concurrency?
- Is there any safeguard in your architecture to handle the data conflicts?
- How can this architecture handle the connectivity changes?
Author
Kush P
Kush Patel is the Chief Technical Officer and Managing Director of Echo Innovate IT – a software development company. He is responsible for the overall operations of the company and has played a major role in making Echo innovate IT the top-notch IT services provider and transforming it into a globally trusted web and app development company.