/meso-enrollment

Meso Android app for enrollment

Primary LanguageKotlinApache License 2.0Apache-2.0

Meso Enrollment Android App CircleCI

Architecture

This app is structured using the clean architecture design principles and is separated into three modules with cascading dependencies:

  • domain is a pure Java library that contains entities, repositories and use-cases. It represents the core business logic.
  • device is an Android library that contains components used by the application but are not tied to any specific UI implementations. These components can depend on the Android SDK and domain module and include implementation-specific code (e.g. implementing repositories). Components in this module could be shared amongst multiple Android applications.
  • app is an Android application and contains all UI code as well as any classes that apply specifically to the enrollment application. Classes in the app module can depend on both device and domain classes.

We use the following libraries as part of the application architecture:

  • Android ViewModel and LiveData for our MVVM UI Architecture
  • Android Room for persisting data on the device
  • Dagger for dependency injection
  • Retrofit for API calls
  • RxJava for reactive style programming
  • ThreetenABP for date/time (see here for a detailed writeup of how we made this decision)
  • Android JobScheduler for scheduling jobs (see here for a detailed writeup of how we made this decision)

Build Types and Flavors

Build types and flavors are the Android way of defining different build variants.

We use build types to correspond to the type of environment the application is targeting such as development, staging or production. By default Android provides debug and release build types, so we have co-opted them as our development and production environments respectively to avoid creating unnecessary build types. We additionally created a sandbox build type that targets our sandbox environment, and staging build that targets staging environment.

For generating a signed APK, please see Running or Building Release types

Styleguide

The codebase follows the Android Kotlin Styleguide - please add any deviations or additional style rules to this section

Dev environment

We use Android Studio as our IDE which leverages Gradle as the build tool.

In order to run the application, you also need a variables.gradle file in your root directory which stores environment variables. Create a file called variables.gradle and copy the file contents variables.gradle.tmpl.

Connecting to your device

To access localhost from your device, we use the command-line tool that comes pre-installed with Android called adb (Android Debug Bridge).

After connecting your device via USB, check that your device is connected:

$ adb devices

And forward all HTTP requests to your local machine with:

$ adb reverse tcp:5000 tcp:5000

Note that you'll need to rerun this command every time you disconnect and reconnect the USB.

Testing

Due to a bug with Android Studio on Mac OSX, we need to update the working directory that Android Studio uses when running JUnit tests - use the following instructions to update the setting