Modern Android App Architecture with Dropbox Store and JetPack
A few days ago, Dropbox acquired an open-source Store library. The aim behind taking the ownership was to modify it to make it more suitable to the prevailing Android developer ecosystem.
Now, Store also includes Google JetPack collection of libraries which poses as a solution for creating current-day Android apps.
Google JetPack makes it possible to create high-quality Android apps while accelerating the development process.
There are two objectives that this library fulfills – It leverages advanced Kotlin features in order to reduce the boilerplate code and offers high-level abstractions besides those found in the Android SDK, i.e., Fragments and [Activities]. These allow the developers to present complex tasks in an easier and simpler way.
Like in case of the traditional mobile app architecture, there are numerous components in Jetpack that developers can use independently and cover four areas – Architecture, Foundation, User Interface, and Behavior.
In fact, Google uploaded its own recommended Android app architecture along with JetPack defining the set of modules that make up an Android app and how they interact. As shown in the image, a well-architecture Android app is fundamentally based on the tenets – model-driven UI, separation of concerns, and one-directional dependencies across several modules.
However, though Jetpack offers most of the components for the creation of an Android app based on the architecture suggested by Google, there is an exception – the Repository layer.
On this matter, Mike Nakhimovich, the creator of Store states-
“Repository currently only has a few code samples and no reusable abstractions that work across different implementations. That’s one of the big reasons why Dropbox is investing in Store–to solve this gap in the architecture model above.”
Store, while relying on a reactive design, aims to support Android app development where data flows in and out of the UI in a seamless manner without forcing the users to navigate back and forth. Mike goes on to say on this matter –
“Reactive front ends led me to think of how we can have declarative data stores with simple APIs that abstract complex features like multi-request throttling and disk caching that are needed in modern mobile applications.”
To explain this in brief – Dropbox Store helps in connecting the app model with an external data source by using a declarative interface centralizing all data-related activities.
Store aims at optimizing network usage in order to keep it at a minimum. This library was rewritten Kotlin backed by Coroutines and Flow, followed by another major change of discarding RxJava for structured concurrency paradigm which is implemented in Kotlin reactive streams.
This switch poses a big impact on ensuring all resources employed in concurrent tasks are freed whenever the task completes, says Mike.
“The big problem with RxJava’s approach to scoping background operations is that it’s too easy for engineers to forget to call dispose. Failing to dispose of active subscriptions directly leads to memory leaks.”
In addition, the Store also supports disk caching, memory caching with TTL and size policies, explicitly skipping the cache to fetch new data from the data source, multi-casting of responses, among many others.
Now, that Dropbox is implementing many changes in the Store for improvement, it has been set on a path of becoming a great source of resources for all Android app development developers.
strategies your digital product..