Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. you can edit it in any editor, if you do so, please insert the following code:

    Code Block
    	<key>CFBundleURLTypes</key>
    	<array>
    		<dict>
    			<key>CFBundleURLName</key>
    			<string>***</string>      //please change *** to your URL name, not so important
    			<key>CFBundleURLSchemes</key>
    			<array>
    				<string>***</string>  //very important, please replace 
    			</array>
    		</dict>
    	</array>


  2. Or you can edit this in xcode, add an item into Info.plist, named "URL types", expand "Item 0" under "URL types", and add two items: "URL identifier", "URL Schemes".

    For "URL identifier", assign your identifier, and for "URL Schemes", add a new item within it named "Item0", REGISTER A UNIQUE URL SCHEME FOR YOUR APP, VERY IMPORTANT!

    It should be like the following:

     

Implementation Android

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

...

languagejava

...


How to use the different Files in the Library Package

FileDescription
spring-appsensor-device.aThis is the version that has been compiled with ARM support and which is intended for execution on iOS devices
spring-appsensor-simulator.aThis is the version that has been compiled with x86 support and which is intended for execution on iOS simulator
spring-appsensor-fat.aThis is a combined version of the two libraries above, which can be executed on both, iOS devices and iOS simulator
because it contains code for ARM and x86 execution.
This file is called "fat" as it is roughly double the size (because it combines both versions).


Note

If size does not matter for the app, the "fat" version is the carefree option to be used for execution on simulator and real devices.

Include Page
Tutorial on how to import KMA measurement Objective-C library into Swift project
Tutorial on how to import KMA measurement Objective-C library into Swift project

Implementation Android

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

Code Block
languagejava
/**
 * 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);

...

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

<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
Info

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.

The last one item above is for the registration of google-play-services, which is precondition for retrieving Google Advertising ID.

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.

Code Block
languagejava
SpringMobile spring = new ("app","TestApp",getApplicationContext());
spring.setTimeout(30); // in seconds

Advise for Implementation when using Android 3.0 and higher Versions

Note

Note: (warning) Starting from Android 3.0

Since Android 3.0 network accesses are not allowed from the main thread anymore. Thus, the Spring.commit () method is achieved in a background thread.

For this reason, please keep the initialization and usage of Spring lib in your main UI thread, Spring lib will not block your GUI display. Otherwise background thread conflicts might pop up.

...

="com.google.android.gms.version" android:value="@integer/google_play_services_version" />


Info

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.

The last one item above is for the registration of google-play-services, which is precondition for retrieving Google Advertising ID.

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.

Code Block
languagejava
SpringMobile spring = new ("app","TestApp",getApplicationContext());
spring.setTimeout(30); // in seconds

Advise for Implementation when using Android 3.0 and higher Versions

Note

Note: (Warnung) Starting from Android 3.0

Since Android 3.0 network accesses are not allowed from the main thread anymore. Thus, the Spring.commit () method is achieved in a background thread.

For this reason, please keep the initialization and usage of Spring lib in your main UI thread, Spring lib will not block your GUI display. Otherwise background thread conflicts might pop up.

 

ProGuard


Please Note: If you are using ProGuard, our library could be compromised.
Therefore it is necessary to add the following lines into the ProGuard configuration file:

# Keep spring files
-keep class de.spring.** { *; }


If using version spring-appsensor-android-1.7.6 (and lower), it is necessary to add the following lines into the ProGuard configuration file:

# Keep spring files
-keep class de.spring.** { *; }

-keep class org.apache.** { *; }

If you want to suppress the warnings regarding library-program-class-dependencies , please add to the configuration file

-dontwarn android.webkit.WebView
-dontwarn android.webkit.WebViewClient


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.

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);
} 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();
}

Example: Implementation of an app page request via the action variable (ac)

Code Block
languagejava
/**
 * example AC 
*/
Hashtable target = new Hashtable();
target.put("ac", "Mainpage");
try {
// ...
    spring.commit(target);
} catch (ParamNotSupportedException e) {
    e.printStackTrace();
} catch (IOException e) {
    e.printStackTrace();
}


Info

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.

 

 

Implementation Windows Phone

The following example shows the basic installation for the Windows Phone 7 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
languagecsharp
/*
 * Importing SpringMobile
 */
using spring_mobile_wp7;

/*
 * 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
 */
Dictionary<String, String> target = new Dictionary<string, string>();
target.Add(SpringMobile.VAR_ACTION, SpringMobile.APP_STARTED);
spring.commit(target);
...
/*
 * Sending the action spring.BACKGROUND 
 */
Dictionary<String, String> target = new Dictionary<string, string>();
target.Add(SpringMobile.VAR_ACTION, SpringMobile.APP_BACKGROUND);
spring.commit(target);

Example: Implementation of an app page request via the action variable (ac)

Code Block
languagecsharp
/*
 * Example AC
 */
using spring_mobile_wp7;

/*
 * Generating SpringMobile entity with site id and application name
 */
SpringMobile spring = new SpringMobile("<site>", "myApplication1");
/*
 * Sending AC to the measurement system
 */
Dictionary<String, String> target = new Dictionary<string, string>();
target.Add("ac", "Mainpage");
spring.commit(target);
...
/*


Info

For the measurement we need the device ID. Please set the right for reading the device ID into a config file (WMAppManifest.xml).

Code Block
langugagexml
...
<Capabilities>
...
<Capability Name="ID_CAP_IDENTITY_DEVICE"/> ...
</Capabilities>
...


 

 

Implementation Titanium (not supported at the moment)

Include Page
Implementation Titanium
Implementation Titanium