Version 3.4.1 of Android Studio IDE was used for developing the Mobility Dynamics App
- Gradle Version: 5.1.1
- Gradle Build Tool Version: 3.4.1
- Koltin Version: 1.3.31
- Build Tool Version: 28.0.3
- Minimum SDK Version: API 21
This application is build using MVVM architecture having Repository Design Pattern for data source. Following are key highlights of the project.
- MVVM Architectural pattern
- Offline Support using Realm
- Dependency Injection using Dagger 2 with Dagger-android
- Android Jetpack libraries
- Paging Library
- LiveData
- Data Binding Library
- Retrofit 2 for network layer
- Glide for Image loading
- Timber for Logging
- Realm Monarchy A wrapper over Realm, that exposes RealmResults as various forms of LiveData.
- Fabric.io Crashlytics for crash reporting tool.
The application has been built with offline support. It has been designed using Android Architecture components with Realm for offline data caching. The application is built in such a way that whenvever there is a service call, the result will be stored in local database. If internet is not available application will display data from offline storage.
The main advantage of using MVVM, there is no two-way dependency between ViewModel and Model, unlike MVP. Here the viewer can observe the data changes in the ViewModel as we are using LiveData which is lifecycle aware. The ViewModel to view communication is achieved through observer pattern basically observing the state changes of the data in the ViewModel.
The View layer is much more flexibile as an indefinite number of Views can bind to a ViewModel. Also, MVVM enforces a clear separation between Views and their master - ViewModel, as the latter holds no reference to Views. The model layer is completely isolated and centralized through the repository pattern.
The model layer is structured on repository pattern so that the ViewModel has no clue on the origins of the data.
The repository handles data interactions and transactions from two main data sources - local and remote which is being handled by NetworkBoundResource
and NetworkPaginatedBoundResource
for pagination payload data.
There are two main use-cases, online and offline. In both use cases, NetworkBoundResource
or NetworkPaginatedBoundResource
will always send a call to the server for fetching latest data and cache it in local database and data is displayed to the user. In case of no internet connection, data is always queried from local storage.
Dagger2 is used to externalize the creation of dependencies from the classes that use them. Android specific helpers are provided by Dagger-Android
and the most significant advantage is that they generate a subcomponent for each Activity
through a new code generator.
- Decoupling level is high.
- Data Flow is centralized through Observable.
- Possess high flexibility to create variants for automated and manual testing.
- Possess lightweight structure due to MVVM presentation pattern.
- Is scalable and easy to expand.
- Possess high code base - simpler approaches will certainly lower code size
There are four build variant configured for the App, As in real application we have many environments due to this I create following build variant to support various environments as a base.
-
Prod Build Variant:
- This build variant contains both (Debug and Release mode)
- It contains a separate code base for web service URL.
-
UAT Build Variant:
- This build variant contains both (Debug and Release mode)
- It contains a separate code base for web service URL
-
QA Build Variant:
- This build variant contains both (Debug and Release mode)
- It contains a separate code base for web service URL.
-
Dev Build Variant:
- This build variant contains both (Debug and Release mode)
- It contains a separate code base for web service URL.
As we have four build variant, for generating debug/release build command varies according to product flavors. Open terminal and type the below command to generate debug or release build respectively
-
Prod Build Variant:
gradlew assembleProdDebug
or./gradlew assembleProdDebug
gradlew assembleProdRelease
or./gradlew assembleProdRelease
-
UAT Build Variant:
gradlew assembleUatDebug
or./gradlew assembleUatDebug
gradlew assembleUatRelease
or./gradlew assembleUatRelease
-
QA Build Variant:
gradlew assembleQaDebug
or./gradlew assembleQaDebug
gradlew assembleQaRelease
or./gradlew assembleQaRelease
-
Dev Build Variant:
gradlew assembleDevDebug
or./gradlew assembleDevDebug
gradlew assembleDevRelease
or./gradlew assembleDevRelease
- Move to Navigation component Library after this issues is fixed
- Improved error screen, currently I am just showing text.
- Pull to Refresh for Display Items. We can do this once we add Pagination API.
- Include Proguard rules for code obfuscation.
- Include Centralize D365 Login