Implementation Blackberry

The following example shows the basic installation for the Blackberry platform. When generating the class SpringMobile a site identifier (<site>) has to be indicated, which is shipped together with this documentation and the libraries.

/**
 * Importing SpringMobile
 */
import de.spring.mobile.SpringMobile;

/**
 * Generating SpringMobile entity with site id and 
 * application name
 */
SpringMobile spring = new SpringMobile("<site>", "myApplication1");

/**
 * Sending the start of the application to the measurement system
 */
Hashtable target = new Hashtable();
target.put(SpringMobile.VAR_ACTION, SpringMobile.APP_STARTED);
try {
// ...
    spring.commit(target);
} catch (ParamNotSupportedException e) {
    e.printStackTrace();
} catch (IOException e) {
    e.printStackTrace();
}

/**
 * Sending the action spring.BACKGROUND
 */
Hashtable target = new Hashtable();
target.put(SpringMobile.VAR_ACTION, SpringMobile.APP_BACKGROUND);
try {
    spring.commit(target);
} catch (ParamNotSupportedException e) {
    e.printStackTrace();
} catch (IOException e) {
    e.printStackTrace();
}

/**
 * Alternative method
 * Sending the action spring.BACKGROUND with own 
 * connection parameters
 */
Hashtable target = new Hashtable();
target.put(SpringMobile.VAR_ACTION, SpringMobile.APP_BACKGROUND);
Hashtable bbprops = new Hashtable();
bbprops.put("deviceside", "true");
try {
    spring.commit(bbprops,target);
} catch (ParamNotSupportedException e) {
    e.printStackTrace();
} catch (IOException e) {
    e.printStackTrace();
}

example CP

/**
 * example CP 
*/
Hashtable target = new Hashtable();
target.put("cp", "Mainpage");
try {
// ...
    spring.commit(target);
} catch (ParamNotSupportedException e) {
    e.printStackTrace();
} catch (IOException e) {
    e.printStackTrace();
}

Although the library provides the possiblity of using connection parameters, it is highly recommended to use "spring.commit(Hashtable target)".
While setting the connection parameters (alternative method) changes on high sensitive parts of the library are done. Therefore it is explicitly indicated, that the respective developers are responsible for the correct usage of the library and the correct settings of the connection parameters.

While using connection parameters that are not supported a respective exception is thrown.
As soon the first parameter is indicated within the Blackberry-Connection-Properties- Hashtable (Hashtable bbprops), the automatic search for a functioning connection is stopped.
If using the alternative method "spring.commit(Hashtable bbprops, Hashtable target)" it is assumed, that this was tested for all possible devices and connections.