Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: CP-Beispielblock hinzugefügt und comit vor put korrigiert

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.

Code Block
languagejava

/**
 * 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);
    target.put(SpringMobile.VAR_ACTION, SpringMobile.APP_STARTED);
} 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();
}

Code Block
languagejava

/**
 * 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();
}
Code Block
languagejava
/**
 * example CP 
*/
Hashtable target = new Hashtable();
target.put("cp", "CP-value");
try {
// ...
    spring.commit(target);
} catch (ParamNotSupportedException e) {
    e.printStackTrace();
} catch (IOException e) {
    e.printStackTrace();
}

...