SPICE Product Docs
SPICE 2.0 Docs
SPICE 2.0 Docs
  • Overview
    • 📒What is SPICE?
    • ✨SPICE App Workflows
      • Household Registration
      • Assessment
      • Follow-up
      • My Patients
      • Medical Review
      • Pharmacy
    • 👩‍⚕️SPICE Users
    • 🏢Admin Workflows
      • Admin Portal
    • 🔏Data Privacy & Security
      • Privacy Policy
      • Terms & Conditions of Use
    • ❓Frequently Asked Questions (FAQs)
  • Engineering
    • 🖥️Architecture
      • C4 Diagrams
      • Architecture Diagram
    • 🔧Technology Stack
    • 👨‍💻API Documentation
      • Common Services
        • Login
        • Reset Password
        • Logout
        • Verify Set Password
        • User Profile Update
        • Set Password for new User
        • Validate Phone Number
        • Get User Details
        • Change Password for Users
        • Forgot Password
        • Validate User Email
        • Get User Profile
      • Admin Services
        • Lab Test Customization
          • Lab Test Update
          • Lab Test List
          • Lab Test by Name
          • Lab Test Delete
          • Lab Test Create
          • Lab Test Validate
        • Medication
          • Medication List
          • Medication Create
          • Medication Update
          • Medication Remove
          • Medication Validate
        • User
          • User Validate
          • User List
          • User Remove
          • User Create and Update
        • Get Menu
        • Country List
        • Health Facility
          • Health Facility Update
          • Health Facility List
          • Health Facility Create
          • Health Facility Details
        • Region
          • Get Region Detail
          • Region Upload
          • Region Download
      • SPICE Service
        • Patient Search
        • Household Create
        • Patient List
        • Member Create
        • Offline Sync
          • Offline Household Create
          • Offline Member Create
        • Medical Review
          • ANC Pregnancy Create
          • ANC Pregnancy Detail
          • ICCM Under two months Create
          • ICCM Under five years Create
          • ICCM Under two months Details
          • Labour Mother Neonate Create
          • ICCM Under five years Details
          • Labour Mother Neonate Details
          • PNC Create
          • PNC Details
        • Assessment
          • Childhood Visit
          • ICCM
          • ANC
          • PNC
          • Other Symptoms
        • Investigation
          • Create Investigation
          • Investigation Remove
          • Investigation History List
        • Prescription
          • Prescription Remove
          • Prescribed Details
          • Prescription Create
        • App Version
        • Calculate WGS
        • Create Diagnosis
        • Diagnosis Details
        • Get Chiefdoms
        • Get Districts
        • Get Patient Status
        • Get Patient Details
        • Household Update
        • Member Update
  • Deploy
    • 🚀Deployment Guide
      • 📱Android
      • 🖥️Admin Portal
      • 🗄️HAPI FHIR Server
      • 🗄️Server
    • 🌎Customization Guide
      • Multi-Language Translation
        • Support for multiple languages
      • Clinical Workflow Customization
      • WHO Hearts Algorithm
      • Country Level Administrative Divisions
  • PRODUCT
    • 🥘Releases
    • 🛣️Roadmap
  • COMMUNITY
    • 🧑‍💻Engage
    • 📞Support
    • 📃Policies
  • LINKS
    • Source Code (GitHub)
    • Medtronic LABS
    • Developer Support
  • versions
    • SPICE 1.0
      • OVERVIEW
        • 📒What is SPICE?
        • ✨SPICE App Workflows
          • Screening
          • Enrollment
          • Assessment
          • Medical Review
            • Treatment Plan
            • Prescribe
            • Lab Test
          • My Patients
          • Pharmacy
          • Admin Portal
        • 👩‍⚕️SPICE Users
        • 🔏Data Privacy & Security
          • Privacy Policy
          • Terms & Conditions of Use
        • ❓Frequently Asked Questions (FAQs)
      • ENGINEERING
        • 🖥️Architecture
          • C4 Diagrams
          • FHIR & Standards
        • 🔧Technology Stack
        • 👨‍💻API Documentation
          • Common Services
            • Account Create
            • Change Password for Site Users
            • Country Create
            • Forgot Password
            • Get User Details
            • Get User Profile
            • Locked Users List
            • Login
            • Logout
            • Operating Unit Create
            • Reset Password
            • Set Password for New User
            • Site Create
            • Unlock User
            • User Profile Update
            • Validate User Email
            • Verify Set Password
            • Super Admin
              • Superadmin Details
              • Superadmin List
              • Superadmin Create
              • Superadmin Delete
              • Superadmin Update
          • Admin Services
            • Account
              • Account - Activate
              • Account - Deactivate
              • Account - Deactivated list
              • Account - Details
              • Account - Update
              • Account Admin - Create
              • Account Admin - Delete
              • Account Admin - Update
              • Account Dashboard - Region Admin
              • Account List - Admin
            • Clinical Workflow
              • Create
              • Delete
              • List
              • Update
              • Account Customization - Create
              • Account Customization - Details
              • Account Customization - Update
            • Country Dashboard - Superadmin
            • Lab Test
              • Create
              • Delete
              • Details
              • List
              • Update
              • Lab Test Range - Create
              • Lab Test Range - Delete
              • Lab Test Range - Details
              • Lab Test Range - Update
            • Medication
              • Create
              • Delete
              • Medication Validation
              • List
              • Update
            • Operating Unit
              • Operating Unit - Details
              • Operating Unit - Update
              • Operating Unit Admin - Create
              • Operating Unit Admin - Remove
              • Operating Unit Admin - Update
              • Operating Unit Dashboard - Account Admin
              • Operating Unit List - Admin
            • Program
              • Create
              • List
              • Delete
              • Details
              • Update
            • Region Admin
              • Region Admin - Create
              • Region admin - Delete
              • Region Admin - Details
              • Region admin - Update
            • Site
              • Site - Details
              • Site - Update
              • Site Dashboard - Operating Unit Admin
              • Site List - Admin
              • Site User - Create
              • Site User - Remove
              • Site User - Update
            • Site List - Region Admin
          • SPICE Services
            • Advance-search
            • Advanced search - Site
            • App Version
            • Assessment
            • Assessment Bplog Create
            • Assessment Glucose log Create
            • BPLog List
            • BPLog Create
            • Confirm Diagnosis
            • Device Details
            • Fill Prescription - Update
            • GlucoseLog Create
            • GlucoseLog List
            • Investigation Create
              • Fill Prescription List
            • Investigation List
            • Investigation Search
            • Labtest Result Create
            • Labtest Result Details
            • Labtest Result List
            • Lifestyle Create
            • Lifestyle List
            • Lifestyle remove
            • Lifestyle Update
            • Lifestyle Update view Status
            • Lifestyle view history
            • Medical Review Create - Continuous Medical Review
            • Medical Review Create - Initial Medical Review
            • Medical Review Static Data
            • Medical Review Count
            • Medical review list
            • Medical Review Summary
            • Mental Health Create
            • Mental Health Details
            • Mobile - Forgot Password
            • Mobile - Login
            • Mobile - Logout
            • Nutritionist Lifestyle Create
            • Patient Basic Details
            • Patient Details
            • Patient enrollment
            • Patient-labtest-list
            • Patient Labtest - Remove
            • Patient Labtest - Review
            • Patient-lifestyle-details
            • Patient list
            • Patient Pregnancy Details
            • Patient Pregnancy Details Create
            • Patient Remove
            • Patient Transfer - Create
            • Patient Transfer Count
            • Patient Transfer - Country Site List
            • Patient Transfer - Role user list
            • Patient Transfer List
            • Patient Transfer - Update
            • Patient Transfer - Validate
            • Patient update
            • Patient Visit
            • PatientVisit
            • Pregnancy Create
            • Pregnancy Details
            • Prescription History List
            • Prescription List
            • Prescription Remove
            • Prescription search
            • Pregnancy Update
            • Prescription-history list
            • Prescription Update
            • Refill Prescription History
            • Screening
            • Screening log details
            • Search
            • Transfer Notification Count
            • Treatment Plan Details
            • Treatment Plan Update
            • User Validate API
          • FHIR-Adapter Services
            • Add User
            • Get User By Id
            • Get User By Username
            • Get User List
            • Get User Profile
            • Update User
            • Reset User Password
            • Delete User by ID
            • Forgot Password Validation
            • Options
            • Receive Message
            • Login
            • Site Migration
            • User Migration
            • APIKey Manager API
              • Retrieve API Keys
              • Generate API Keys
              • Delete API Keys
              • Validate API Key
      • DEPLOY
        • 🚀Deployment Guide
          • 🗄️Server
          • 📱Android
          • 🖥️Admin Portal
          • 🗄️FHIR Adapter
        • 🌎Customization Guide
          • Multi-Language Translation
            • Support for multiple languages
          • Clinical Workflow Customization
          • WHO Hearts Algorithm
          • Country Level Administrative Divisions
      • PRODUCT
        • 🥘Releases
        • 🛣️Roadmap
      • LINKS
        • Source Code (GitHub)
        • Medtronic LABS
        • Developer Support
Powered by GitBook

@2024 Medtronic LABS

On this page
  • Prerequisite
  • Tools used
  • Tech stack used
  • GitHub
  • Installation Steps
  • Download Source code
  • Configuration
  • Configure Server URL
  • Configure Salt key
  • Signing APK/Bundle
  • Complete build.gradle look like this:
  • Localization
  • Optional
  • Future Enhancement
  1. versions
  2. SPICE 1.0
  3. DEPLOY
  4. Deployment Guide

Android

PreviousServerNextAdmin Portal

Last updated 3 months ago

Prerequisite

  • To bring up the Spice backend server, there are a few prerequisites that need to be completed. Please follow the instructions provided in this . Once you have completed the steps, you will get a SERVER URL to use in our Application.

Tools used

Android Studio IDE

Tech stack used

Kotlin-1.9.0
Java-18
Android MVVM Design Pattern
Gradle-7.3.1

GitHub

The code for the Android project can be found here:

Installation Steps

Download and Install Android Studio

  • Next, check your Java version by running the command java -version in your terminal.

    java -version 

    If Java 18 is not installed, you can follow these steps:

    • Install Java 18 according to the provided instructions.\

  • To change the Java version in Android Studio,

    • Open your Android Studio project.

    • Click on "File" in the top menu.

    • Select "Project Structure" from the dropdown menu.

    • In the left panel, select "SDK Location".

    • Under the "JDK Location" section, click on the dropdown menu next to "JDK location" and select the path to the desired Java version.

    • Click "Apply" and then "OK" to save the changes.

    • You may need to re-build your project by selecting "Build" -> "Rebuild Project".

Download and Install Git.

To check the Git version, you can run the following command in your terminal:

git --version

If Git is not installed, you can follow the instructions below based on your operating system:

Ubuntu:

sudo apt install git

Windows:

Download Source code

Once you have Git installed, you can clone the Spice open source repository by running the following command in your terminal:

git clone https://github.com/Medtronic-LABS/spice-android.git

After cloning the repository, you can open the folder in Android Studio.

Configuration

To execute the application, you must access the build.gradle file located in the app-level directory of your project.

build.gradle[App-level]

This file allows you to define your desired values for specific properties.

Configure Server URL

    server = [debug: "http://localhost:8762/", release: "http://localhost:8762/"]

Substitute http://localhost:8762/ with the server URL obtained.

Configure Salt key

To enhance security, you may need to provide the salt key used in the backend for user authentication. The salt key is a randomly generated string that adds an extra layer of security when hashing passwords.

    salt = [debug: "spice_opensource", release: "spice_opensource"]

By default, the Salt key is set as spice_opensource, but you can modify it if necessary.

Note: The Salt key must match the key used in the backend.

Signing APK/Bundle

SigningConfigs configuration in the app's build.gradle file is used to specify the signing information for your Android application. It allows you to configure the necessary details for signing your app with a digital certificate, such as the keystore file, key alias, and key passwords.

    signingConfigs {
        development {
            keyAlias '<Specify the alias used during the generation of the signed APK/Bundle>'
            keyPassword '<Specify the key password used during the generation of the signed APK/Bundle>'
            storeFile file('<Specify the key store path used during the generation of the signed APK/Bundle'>)
            storePassword '<Specify the store password used during the generation of the signed APK/Bundle>'
        }
    }

Complete build.gradle look like this:

plugins {
    id 'com.android.application'
    id 'kotlin-android'
    id 'kotlin-kapt'
    id 'dagger.hilt.android.plugin'
    id 'kotlin-parcelize'
    id "org.sonarqube" version "3.4.0.2513"
    id 'org.jetbrains.kotlin.android'
}

android {
    compileSdk 33

    defaultConfig {
        applicationId "com.medtroniclabs.opensource"
        minSdk 23
        targetSdk 33
        versionCode 1
        versionName "1.0.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    signingConfigs {
        development {
            keyAlias '<Specify the alias used during the generation of the signed APK/Bundle>'
            keyPassword '<Specify the key password used during the generation of the signed APK/Bundle>'
            storeFile file('<Specify the key store path used during the generation of the signed APK/Bundle'>)
            storePassword '<Specify the store password used during the generation of the signed APK/Bundle>'
        }
        release {
            keyAlias '<Specify the alias used during the generation of the signed APK/Bundle>'
            keyPassword '<Specify the key password used during the generation of the signed APK/Bundle>'
            storeFile file('<Specify the key store path used during the generation of the signed APK/Bundle'>)
            storePassword '<Specify the store password used during the generation of the signed APK/Bundle>'
        }
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }

    buildFeatures {
        viewBinding true
    }

    lintOptions {
        checkReleaseBuilds false
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
    }

    flavorDimensions "version"

    productFlavors {

        development {
            dimension "version"
            applicationIdSuffix ".dev"
            ext {
                server = [debug: "http://localhost:8762/", release: "http://localhost:8762/"]
                admin = [debug: "{ADMIN.URL}",release: "{ADMIN.URL}"]
                salt = [debug: "spice_opensource", release: "spice_opensource"]
            }
            signingConfig signingConfigs.development
        }
        production {
            dimension "version"
            ext {
                server = [debug: "http://localhost:8762/", release: "http://localhost:8762/"]
                admin = [debug: "{ADMIN.URL}",release: "{ADMIN.URL}"]
                salt = [debug: "spice_opensource", release: "spice_opensource"]
    
            signingConfig signingConfigs.release
        }
    }

    applicationVariants.all { variant ->
        def flavor = variant.productFlavors[0]
        println "Setting up server URL ${flavor.ext.server[variant.buildType.name]} for variant [${variant.name}]"
        variant.buildConfigField "String", "SERVER_URL", "\"${flavor.ext.server[variant.buildType.name]}\""
        variant.buildConfigField "String", "ADMIN_URL", "\"${flavor.ext.admin[variant.buildType.name]}\""
        variant.buildConfigField "String", "SALT", "\"${flavor.ext.salt[variant.buildType.name]}\""
        variant.outputs.each {
            output ->
                def formattedDate = new Date().format('yyyy-MM-dd-HH-mm')
                def name = "SPICE_${flavor.name}_${variant.buildType.name}_${formattedDate}.apk"
                output.outputFileName = name
        }
    }
    bundle{
        language{
            enableSplit = false
        }
    }
}

dependencies {

    implementation 'androidx.core:core-ktx:1.9.0'
    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'com.google.android.material:material:1.8.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'

    // Retrofit
    implementation 'com.squareup.retrofit2:retrofit:2.9.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:4.10.0'

    implementation 'com.jakewharton.timber:timber:4.7.1'

    implementation "com.google.dagger:hilt-android:$hilt_version"
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.preference:preference-ktx:1.2.0'
    implementation 'androidx.core:core-ktx:1.9.0'
    kapt "com.google.dagger:hilt-compiler:$hilt_version"

    def room_version = '2.5.0'

    implementation "androidx.room:room-runtime:$room_version"
    annotationProcessor "androidx.room:room-compiler:$room_version"
    // To use Kotlin annotation processing tool (kapt)
    kapt "androidx.room:room-compiler:$room_version"
    implementation "androidx.room:room-ktx:$room_version"

    // Kotlin coroutine dependencies
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4'
    implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.0'
    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.0'

    implementation 'androidx.activity:activity-ktx:1.6.1'
    implementation 'androidx.fragment:fragment-ktx:1.5.5'

    //Glide
    implementation 'com.github.bumptech.glide:glide:4.12.0'

    implementation 'androidx.security:security-crypto:1.1.0-alpha05'

    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'

    // loading progress
    implementation 'com.github.ybq:Android-SpinKit:1.4.0'

    implementation 'com.robertlevonyan.view:MaterialChipView:2.2.6'

    implementation 'com.google.android.gms:play-services-location:21.0.1'

    implementation 'androidx.security:security-crypto:1.0.0'

    def lottieVersion = '4.2.2'
    implementation "com.airbnb.android:lottie:$lottieVersion"


    implementation 'net.zetetic:android-database-sqlcipher:4.5.2'
    implementation 'androidx.sqlite:sqlite-ktx:2.3.0'
    implementation 'com.github.jeffreyliu8:FlexBoxRadioGroup:0.0.8'
    implementation 'androidx.paging:paging-runtime-ktx:3.1.1'
    implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
    implementation 'com.google.android.play:integrity:1.1.0'
    implementation 'com.google.apis:google-api-services-playintegrity:v1-rev20220928-2.0.0'
    implementation 'org.bitbucket.b_c:jose4j:0.9.1'

    //in-app update
    implementation 'com.google.android.play:app-update:2.0.1'
    implementation 'com.google.android.play:app-update-ktx:2.0.1'
}

Synchronize the Grade files by selecting File > Sync Project. After that , you can click on the "Run" button.

Localization

Currently, our application supports English and Bangla languages for most user roles. However, the following user roles are not included in this language support

  • PROVIDER

  • PHYSICIAN_PRESCRIBER

  • LAB_TECHNICIAN

  • PHARMACIST

  • NUTRITIONIST

To modify the language settings, you can easily do so by accessing the side menu on the home page and selecting the option labeled Language Preference. This action will trigger a dialog box to appear, allowing you to select either English or Bangla as your preferred language. Once you have made your selection, simply log in again to observe the changes.

Note: The default language is English.

Optional

To install an app on an Android emulator in Android Studio you can follow these steps

  • Open the Android Studio and launch the emulator that you want to use.

  • Click on the "Run" button or press the "Shift" + "F10" keys to open the Run Configuration dialog.

  • Select the app module that you want to run from the "Module" drop-down list.

  • Select the emulator that you want to use from the "Device" drop-down list.

  • Click on the "OK" button to run the app on the selected emulator.

  • Wait for the app to be installed and launched on the emulator.

Note: Before running the app on the emulator, make sure that the emulator is properly configured and running. if not, follow the below instructions.

You can install an Android emulator in Android Studio by following these steps:

  • Open Android Studio and click on the "AVD Manager" button in the toolbar or navigate to "Tools" -> "AVD Manager".

  • Click on the "Create Virtual Device" button.

  • Select a device definition from the list, or click on "New Hardware Profile" to create a custom device definition.

  • Choose a system image to run on the emulator, and click "Download" if the image has not been previously downloaded.

  • Click "Next", then customize any additional settings you wish to modify, such as the device name or the amount of RAM allocated to the emulator.

  • Click "Finish" to create the virtual device.

  • Once the virtual device is created, you can start it by selecting it from the AVD Manager and clicking the "Play" button.

Future Enhancement

  • Provide Multi-Language support for all user roles.

You can download Android Studio from .

Visit the JDK downloads page using this .

To install Git on Ubuntu, run the following command in your terminal or click on .

For Windows, you can visit the and download the Git installer.

Use the server URL obtained from the prerequisites mentioned above. Or, you may also follow the steps as mentioned in the .

After starting the emulator, you can install your app on it by running your project in Android Studio and selecting the emulator as the deployment target. If you want to run apps on a hardware device,

🚀
📱
link
Spice-Android
here
link
Git Official site
Git Official site
link
Emulator Set up
follow the instructions.