Custom built apps

Setting up a mobile solution with a custom built application is composed of 3 main parts:

  1. Creating the mobile client application and installing on mobile phone
  2. Receiving Data as SMS and importing it into DHIS2
  3. Sending messages as acknowledgements or plaintext messages to a single number

Mobile Client Application

The Mobile Client Application is Java MIDP 2.0 application which sends data in the form of a coded SMS to a phone number which is hosted by the SMS gateway connected to the DHIS2 server.

The Mobile Application is custom built through JavaME (J2ME) programming, using the MIDP 2.0 profile and basic APIs. These include WMA 1.1 (JSR 120), CLDC 1.1 (JSR 139) and MIDP 2.0 (JSR 118). Some other UI tools like Netbeans UI Component for Splash Screens is also used. Custom applications are built easily through the Netbeans
Mobility Toolkit which provides a Visual Designer for JavaME Form, Alerts and other Visual MIDlets. These are generally built through ANT using the same libraries in
WTK 2.5.2

Read more about howto build a mobile client.

Setting up MIDP Environment

  1. Install Maven 2 (http://maven.apache.org/)
  2. Install Wireless Toolkit 2.5.2 or later (or install jsr226, jsr184, jsr75 and mmapi)
  3. The Micro emulator provides APIs for midp 2.0 and cldc 1.1 (http://www.microemu.org/)
  4. Install lwuit (https://lwuit.dev.java.net/) into the repository manually.

Receiving & Importing

Receiving and importing SMS messages is implemented inside DHIS2. It uses smslib (http://smslib.org) for communicating with the GSM modem
and sending and receiving SMS.

The smslib can either use RXTX or JavaComm for communication over COM ports with modem hardware. These should be installed as given in the smslib installation documentation.

The configurations for creating a gateway is done through the SMSServer.conf and uses the format similar to this sample conf file. Instead of other interfaces, the DHIS2 module only receives the SMS and creates an XML file in the DHIS2_HOME/mi/pending folder and imports it. On successful import the file is placed inside DHIS2_HOME/mi/completed folder. If it fails, it is moved to bounced folder.

Sending

The SMSServer.conf needs to have the outbound = yes, for being able to send SMS. This can be individual messages to a number or can be acknowledgement that the message has been recevied by the DHIS2 gateway.