This smartphone application was developed in BlackBerry® WebWorks™ and implements various aspects of Push technology to receive Emergency Contact List data via JSON. Data is stored persistently on the device through HTML5 Database implementation.
The sample is designed to work out-of-the-box with a 5.0+ device/MDS-CS simulator pair running on the same PC as the server-side component but is configurable to push data to live devices as well.
The server-side component comes with a pre-compiled, executable JAR file as well as complete source. This leaves the user with a few options for launching the application.
Before you can launch the provided JAR file, you will need an instance of Oracle's JDK installed on your PC. The recommended version at this time is JDK6; it is necessary to use the 32-bit version of the JDK regardless of your operating system. Only one JDK/JRE pair should be installed on a PC at a time.
Additionally, you will need to ensure that your Path environment variable has been configured to point at the bin folder of your JDK.
If your Java runtime is configured as the default JAR handler on your PC, you can simply double-click the provided JAR file to launch the server-side component.
If your PC has a custom default handler for JAR files, you can open a command prompt window, navigate to the folder housing the JAR file, and execute the following command to launch the server-side component:
java -jar ECLwwServer2.jar
The full source for the server-component has also been provided in Mainframe.java. A Java application can be created in Eclipse (or your preferred Java IDE) and the provided source imported. From there, you can launch the application within Eclipse with the added benefit of being able to make modifications and debug the code.
The default values provided in the server-side component are designed to allow a push to be sent to a device/MDS-CS simulator pair running on the same PC as the server-side component.
To get the MDS Address and MDS Port values for a live device, the best approach is to confirm these with your BES Administrator. Please note that the MDS Port value refers to the incoming push port assigned to your BES.
To get the Device PIN of a device/simulator, you can look this value up within your Device Options or by connecting your live device to, and launching, BlackBerry Desktop Manager.
Alternatively, for a device simulator, you can check within the [model].bat file used to launch the simulator for the Device PIN that has been assigned.
@echo off fledge.exe /app=Jvm.dll /handheld=9810 /session=9810 /app-param=JvmAlxConfigFile:9810.xml /data-port=0x4d44 /data-port=0x4d4e /pin=0x2100000A /app-param=DisableRegistration /app-param=NoTutorial
The Device Port should be set to match the listening port defined within the client-side component. By default, this value is set to 233.
Before any data can be received by the target device/simulator, the client-side componenet must be installed and running on your target.
The Push Content section allows you to edit various data fields which will be combined into a JSON String that is ultimately pushed to the target. For convenience, a Randomize button has been included to populate the fields for testing purposes. Add Contact will append the existing information to the current JSON String.
The JSON String is an editable field for customization. This also allows the user to save a copy of the String for future use, as well as paste an existing String into the field if they already have existing data to push. The JSON String can be Reset to a blank value.
Once you are ready, Send Push will initiate the data push to the target.
The Push Status section will provide information regarding your push.
Generally, additional messages are only returned by the MDS-CS if an error occurs and will provide a more descriptive response to accompany the HTTP Response. Exceptions are documented for trouble-shooting purposes.
ECL Webworks Homescreen
Detailed Profile Information
The sample source provided can be packaged into a BlackBerry application using the latest WebWorks Packager. For a detailed guide on packaging a WebWorks application, please refer to the WebWorks Documentation.
Once complete, you should have the necessary distributables (COD, ALX, JAD, etc.) files generated for deployment to a device simulator or live device.
To install your application on a live device, there are a number of options available including:
For additional approaches and specific details, please refer to the application deployment guide.
If you are distributing to a device simulator, you can also launch the simulator first, and then load the COD file directly through the simulator menu.
The client-side component is designed to auto-start and run in the background while the device is turned on. Therefore, as long as the application is installed and your device is turned on, you should be able to receive incoming data pushes. By default, incoming data is expected on port 233.
If a data push is received while the client-side component is in the foreground, the contact list will automatically re-populate with the new data.
When the application closes, it is currently designed to request the background instead of fully exiting. If the application is in the background when a data push is received, the application icon will update with a red splat to notify the user.
The Activity Log is intended for debugging/informational purposes with most recent items being listed at the top of the log.
Throughout actions.js, each function wraps its content within a try/catch block; any Exceptions that are encountered will also be documented within the Activity Log.