Source

wqreporter /

Filename Size Date modified Message
resources
src/org/javarosa/demo
test/org/javarosa
1.5 KB
229 B
114 B
519 B
775 B
11.1 KB
303 B
5.7 KB
3.4 KB
15.2 KB
811 B
36.3 KB
54 B
The Water Quality Reporter (WQR) tool is a J2ME application that allows users to collect and submit data using 
their cellphone. WQR uses the JavaRosa platform (https://bitbucket.org/javarosa/javarosa/wiki/Home) and is a 
modified version of the JavaRosa demo application. Data can be submitted to any server that can process HTTP POST 
requests; but we currently use the Water Quality Manager (WQM) available at https://github.com/icomms/wqmanager

ENVIRONMENT SETUP
-----------------
1. Install Sun JDK 6.0 (http://java.sun.com/javase/downloads/index.jsp)
2. Install Sun Java Wireless Toolkit 2.5.2_01 for CLDC (http://java.sun.com/products/sjwtoolkit/download.html)

3. Install J2MEPolish 2.1.0 (http://download.berlios.de/polish/j2mepolish-2.1.0.jar)
3.1. Additional Windows Vista/7 instructions: https://bitbucket.org/javarosa/javarosa/wiki/VistaPolishInstall

4. Install Eclipse IDE for Java EE Developers (http://www.eclipse.org/downloads/)
5. Install EclipseME 1.7.9 (http://eclipseme.org/docs/installEclipseME.html)
6. Download ant-contrib-1.0b2-bin and extract ant-contrib.jar from it (http://ant-contrib.sourceforge.net/)

ENVIRONMENT CONFIGURATION
-------------------------
1. Start Eclipse, and create new workspace: File > Switch Workspace > Other

2. Go to Windows > Preferences > J2ME > Device Management > Import:
2.1. Select your Wireless Toolkit install directory from earlier
2.2. Click Refresh and then Finish
2.3. Double click each device listing and edit the group to read "Sun Java(TM) Wireless Toolkit 2.5.2 for CLDC"
2.4. Select DefaultColorPhone as your default

3. Go to Windows > Preferences > Java > Build Path > Classpath Variables:
3.1. Create new variable by clicking New
3.2. Name the variable J2ME_POLISH_HOME and set its value to the installation directory of J2MEPolish from earlier

4. Go to Windows > Preferences > Java > Installed JREs:
4.1. Click Add > Standard VM and choose folder where you installed the JDK
4.2. Enter "-Xmx128M" into the Default VM Arguments field
4.3. Click Finish and then set this JDK as default in the list

5. Go to Window > Preferences > Ant > Runtime:
5.1. On the Classpath tab choose Global Entries and then click Add External JARs
5.2. Choose location of ant-contrib.jar file from earlier and click OK

6. Close preferences and restart Eclipse

GETTING THE SOURCE CODE
-----------------------
1. Clone the following repositories with your Mercurial client (TortoiseHg for Windows, hg for Linux, etc.):

http://bitbucket.org/icomms/wqreporter (this repository)
http://bitbucket.org/icomms/javarosa
http://bitbucket.org/icomms/wqreporter-samplepoint

Make sure each project is in its own directory in your workspace.

2. Open Eclipse

3. File > Import > General > Existing Projects into Workspace:
3.1. Select all projects in the javarosa folder and click Finish

4. File > Import > General > Existing Projects into Workspace:
4.1. Select the wqreporter-samplepoint project folder and click Finish

5. File > Import > General > Existing Projects into Workspace:
5.1. Select the wqreporter project folder and click Finish

6. Open http://bitbucket.org/javarosa/javarosa/downloads in your browser
6.1. Download most recent javarosa-dependencies-rNNNN.zip file (2474 was used for this install)
6.2. Extract the zip into your javarosa project folder (should place jars inside the lib directory)

7. In Eclipse highlight all projects, right-click and choose Refresh  

CONFIGURE WATER QUALITY REPORTER
--------------------------------
1. In the wqreporter project folder copy build.properties.sample to build.properties and open it
1.1. Set the server URLs under "RELEASE CONFIG" (see http://github.com/icomms/wqmanager)
1.2. Set forms and languages to include in your build using the appropriate properties listed
1.3. Set the polish.home, wtk.home and j2mewtk.home properties (near the bottom of the file)
1.4. Set the dir.wqreportersamplepoint property to the wqreporter-samplepoint project folder

2. In the wqreporter project folder copy key.properties.sample to key.properties and open it
2.1. Set key location, username and password (your signing certificate)
2.2. Set app.signmidlet to false in build.properties if you are just using the emulator

Note: If you purchased your code-signing certificate from Verisign you might need to edit the application 
JAD file and delete the last certificate entry in the file, "MIDlet-Certificate-1-4", in order to get 
around a bug on some Nokia S40 phones.

RUNNING WATER QUALITY REPORTER
------------------------------
1. Open build.xml in the wqreporter project folder
1.1. Right-click LaunchEmulator in the Outline bar (Window > Show View > Outline) and choose Run As > Ant Build

2. If you are using the WTK emulator you might get a lot of NoClassDefFoundErrors when the application tries to
use Nokia-specific UI code - you can get rid of these errors by removing "nokia-ui" from the "javapackage" variable
in custom-devices.xml (for the specific device you are building for).

INSTALLING ON DEVICE
--------------------
1. Open build.xml in the wqreporter project folder
1.1. Right-click BuildPolish in the Outline bar (Window > Show View > Outline) and choose Run As > Ant Build
1.2. If the build fails, run the Clean task in build.xml before trying again
1.3. Transfer WQR.jad and WQR.jar from the dist directory to your mobile device using Bluetooth or upload to a web server
and download using the phone's browser software

SAMPLE FORMS AND SUBMISSION XML
-------------------------------
In the resources/ directory in the project folder you can find sample XForms in H2STest.xhtml and PhysicoChemTests.xhtml.
A sample completed XForm that would be submitted to the server can be seen in H2STest-sample-submission.xml

NOTE
----
Double-check https://bitbucket.org/javarosa/javarosa/wiki/GettingStarted for solutions to problems you might
encounter.