OpenMRS Android SDK v1.1.1

The OpenMRS-Android-Client can be used implemented either by forking the whole openmrs-android-client project and using the custom base url as asked while starting the app, or if the UI already present in the openmrs-android-client is not suitable for the implementation then we can use openmrs-android-sdk to get the core functionalities and build a custom UI on top of it.

The Openmrs-Android-sdk can be used as a library to build custom-UI on top of existing work done already on the android platform in Openmrs without forking the openmrs-android client . This is a short document on how to get started with the openmrs-android-sdk with an application from scratch.

Prerequisites

  1. Basic familiarity with Android-development knowing how to use basic functionalities of the Android-Studio.

  2. Android Studio installed and setup preferrably with jdk-11.

Detailed Steps

  • Get started with a new application in Android-Studio, and select empty activity while choosing templates for a new application.  

                                  

  • These are the sample Gradle files and dependencies we need for this project.

  1.  

    1. The top-level Gradle file can be kept intact except if already not there we should add the "https://jitpack.io" under the repository section

                  

          

 

                   b. The app level gradle file needs to add a few dependencies for some android architecture lifecycle components as well as openmrs-android-sdk. This test application has been tested for API level 29 as captured in the Gradle file.

       

                         

          

          c. Before calling any repository methods to interact with the OpenMRS Rest APIs through the openmrs-android-sdk. we must initialize the sdk with the 4 entities, the application context, the base URL, or the server we are going to interact with and correspondingly username and password to work it out. Usually, the applications built around this will have a proper login flow and will get the username and password from that flow before initializing the sdk as in actual openmrs-android client but for demo purposes to make things simple I have simply initialized the sdk with the required details by hard -coding them in the test - application.