Using Ushahidi and FrontlineSMS With Bad Internet

…or, using Ushahidi and FrontlineSMS in Liberia.

I’ve been working for Ushahidi as their technical consultant in Liberia. It’s been fun and I enjoy the work. One of the many features of Ushahidi is that it’s made to work with FrontlineSMS. FrontlineSMS is a program that allows a computer to receive text messages via a cell phone or GSM modem. Once the computer has received the text message FrontlineSMS allows you to do a number of things with it, one of which is forwarding to a web site.

However, in Liberia the internet isn’t so hot, and often a text message will be received when the internet is not working. The problem is that FrontlineSMS still receives the text, but only tries once to forward it on to Ushahidi, and doesn’t know if the message was received or not.

So to overcome this problem I wrote a little Java program that looks into the FrontlineSMS database, finds new messages and then sends them on to Ushahidi. I then used the Windows Task Scheduler to run this java program every 5 minutes to ensure timely transmission. Some of you may wonder why I’m using Windows when everything else I’m using is open source. The simple answer is that many of the organizations we work with in Liberia only use Windows PCs, and so to ask them to switch to something else would be pretty disruptive.

So here’s a .zip file with the source, required libraries, executable .jar file, and a sample config file.

The frontlinesync.jar, h2-1.2.140.jar, and config.txt files need to be in the same directory for the program to work.

The config file specifies where the Frontline database file is, the URL to the Ushahidi instance, and the FrontlineSMS key to the Ushahidi instance. Also included is flsync.bat. This is a batch file that forces the java file to run minimized. Use this file with the Windows Task Scheduler to make the sync program run in the background at regular intervals. Here’s a tutorial on how to use Task Scheduler.

I’ve only been using this for 2 days, so I’m sure bugs will be discovered as time goes on. If you find any please let me know. If you want to see all of this in action check out Liberia Mapped, and try texting something in to +231-88-066-8932. Liberia Mapped is a simple directory of organizations in Liberia.

—————UPDATE—————-

I’ve had some issues with the executable .jar file not working properly when run from the task scheduler. I’m not really sure what causes it but it seems the class path breaks down some where. So I’ve updated the flsync.bat file to say:

java -cp frontlinesync.jar;h2-1.2.140.jar FrontLineSync

instead of just:

frontlinesync.jar
This entry was posted in ICT, Liberia and tagged , , , , , , . Bookmark the permalink.

Comments are closed.