Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »

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

Example:

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

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

/**
 * Sending the start of the application to the measurement system
 */
Map<String, Object> map = new HashMap<String, Object>();
map.put(SpringMobile.VAR_ACTION, SpringMobile.APP_STARTED);
spring.commit(map);

/*
 * Sending the action spring.BACKGROUND
 */
Map<String, Object> map = new HashMap<String, Object>();
map.put(SpringMobile.VAR_ACTION, SpringMobile.APP_BACKGROUND);
spring.commit(map);

Example CP:

/**
 * Example CP
 */
import de.spring.mobile.SpringMobile;

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

/**
 * Sending CP to the measurement system
 */
Map<String, Object> map = new HashMap<String, Object>();
map.put("cp", "Mainpage");
spring.commit(map);

 

The following settings need to be conducted in the file AndroidManifest.xml AndroidManifest.xml:

<uses-permission android:name="android.permission.READ_PHONE_STATE">
</uses-permission>
<uses-permission android:name="android.permission.INTERNET">
</uses-permission>

The setting of the permission through the user is not mandatory, but highly recommended.

If the permission READ_PHONE_STATE is set, the device ID and the Android ID are used.
If the permission is not set, only the Android ID is used.

Two aspects are crucial:
The Android ID is only recognized if the user disposes of a Google account. (This should be the case for all users of the apps, because it is not possible to access the Android Market without a Google account.)

There is a bug in the Android version 2.2, which only occurs in connection with certain providers, where for all affected devices the same Android ID will be delivered. For the study, this would mean that the user identification would become much more difficult.

Timeout

With this value, a timeout (in seconds) for each HTTP request can be configured within the library.

SpringMobile spring = new ("app","TestApp",getApplicationContext());
spring.setTimeout(30); // in seconds
  • No labels