...
Supported Platforms
Implementation iOS
Include Page |
---|
Implementation iOS | Implementation iOS The following example shows the basic installation for the iOS platform. When generating the class SpringMobile
a site identifier (<site>) has to be indicated, which is shipped together with this documentation and the libraries.
Info |
---|
|
At the application start the Spring object has to be instanced one-time and to be used for the whole life cycle of the application |
Code Block |
---|
|
/*
* Importing SpringMobile
*/
#import "Spring.h"
/*
* Providing entity
*/
Spring *spring;
/*
* Generating SpringMobile entity with site id and
* application name
*/
spring = [[Spring alloc] initWithSiteAndApplication:@"<site>" application:@"myApplication1"];
/*
* Sending the start of the application to the measurement system */
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObjectsAndKeys:APP_STARTED,VAR_ACTION,nil];
[spring commit:dict];
...
// OR
/*
* Sending the action spring.BACKGROUND
*/
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObjectsAndKeys:APP_BACKGROUND,VAR_ACTION,nil];
[spring commit:dict];
|
Example: Implementation of an app page request via the action variable (ac)
Code Block |
---|
|
/*
* Importing SpringMobile
*/
#import "Spring.h"
/*
* Providing entity
*/
Spring *spring;
/*
* Generating SpringMobile entity with site id and application name
*/
spring = [[Spring alloc] initWithSiteAndApplication:@"<site>" application:@"myApplication1"];
/*
* Sending AC to the measurement system */
NSMutableDictionary *dict = [NSMutableDictionary
dictionaryWithObjectsAndKeys:@"Mainpage",@"ac",nil];
[spring commit:dict];
...
|
Timeout (default: 30 seconds)
With this value, a timeout (in seconds) for each HTTP request can be configured within the library.
Example:
Code Block |
---|
|
spring = [[Spring alloc] initWithSiteAndApplication:@"app" application:@"Test App"];
spring.timeout = 30.0; // in seconds
|
Debug
If this value is set on YES
, the library provides debug outputs over the class NSLog
.
Code Block |
---|
|
spring = [[Spring alloc] initWithSiteAndApplication:@"app" application:@"Test App"];
spring.debug = YES;
|
Output example:
No Format |
---|
2011-11-25 13:42:52.878 TestApp3[73923:ff07] spring (1.0.3.1)> http://test.2cnt.net/j0=,,,;+,app=Test%20App+did=7ca359bc4c3c6a19;;;?lt=gvf6lykt
2011-11-25 13:42:52.927 TestApp3[73923:ff07] spring (1.0.3.1)> http status code: 200 - no error
2011-11-25 13:42:56.521 TestApp3[73923:1020b] spring (1.0.3.1)> http://test.2cnt.net/j0=,,,;+,app=Test%20App+did=7ca359bc4c3c6a19+ac=spring.BACKGROUND;;;?lt=gvf6m1e1
2011-11-25 13:42:56.559 TestApp3[73923:1020b] spring (1.0.3.1)> http status code: 200 - no error
2011-11-25 13:42:59.388 TestApp3[73923:10013] spring (1.0.3.1)> http://test.2cnt.net/j0=,,,;+,app=Test%20App+did=7ca359bc4c3c6a19+ac=spring.FOREGROUND;;;?lt=gvf6m3lo
2011-11-25 13:42:59.427 TestApp3[73923:10013] spring (1.0.3.1)> http status code: 200 - no error
2011-11-25 13:43:04.554 TestApp3[73923:11f0b] spring (1.0.3.1)> http://test.2cnt.net/j0=,,,;+,app=Test%20App+did=7ca359bc4c3c6a19+ac=spring.BACKGROUND;;;?lt=gvf6m7l5
|
Release Notes
Include Page |
---|
| Release Notes iOS |
---|
| Release Notes iOS |
---|
|
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 |
---|
|
/**
* 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: Implementation of an app page request via the action variable (ac)
Code Block |
---|
|
/**
* Example AC
*/
import de.spring.mobile.SpringMobile;
/**
* Generating SpringMobile entity with site id and application name
*/
SpringMobile spring = new SpringMobile("<site>", "Application Name", getApplicationContext());
/**
* Sending AC to the measurement system
*/
Map<String, Object> map = new HashMap<String, Object>();
map.put("ac", "Mainpage");
spring.commit(map);
|
The following settings need to be conducted in the file AndroidManifest.xml AndroidManifest.xml
:
Code Block |
---|
|
<uses-permission android:name="android.permission.READ_PHONE_STATE">
</uses-permission>
<uses-permission android:name="android.permission.INTERNET">
</uses-permission>
|
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. 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 |
---|
|
SpringMobile spring = new ("app","TestApp",getApplicationContext());
spring.setTimeout(30); // in seconds
|
Release Notes
Include Page |
---|
| Release Notes Android |
---|
| Release Notes Android |
---|
|
Implementation Blackberry
...
Implementation Windows Phone 7
Include Page |
---|
Implementation Windows Phone 7 | Implementation Windows Phone 7The 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 |
---|
|
/**
* 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 |
---|
|
/**
* 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 |
---|
|
/**
* 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 7
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 |
---|
|
/*
* 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 |
---|
|
/*
* 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 |
---|
| ...
<Capabilities>
...
<Capability Name="ID_CAP_IDENTITY_DEVICE"/> ...
</Capabilities>
...
|
|
Implementation Titanium
Include Page |
---|
| Implementation Titanium |
---|
| Implementation Titanium |
---|
|