Methods

isStarted

Callback arguments: (bool isStarted)

Indicates whether the SDK is started. The SDK started automatically if you setted up config.xml.

R1SDK.isStarted(function (isStarted) {
    //...
});

setApplicationUserId

Set optional current user identifier.

R1SDK.setApplicationUserId("Your application user id");

getApplicationUserId

Callback arguments: (string applicationUserId)

Get last setted application user identifier.

R1SDK.getApplicationUserId(function (applicationUserId) {
    //...
});

setGeofencingEnabled

Enable or disable the Geofencing service in the SDK.

R1SDK.setGeofencingEnabled(true);

isGeofencingEnabled

Callback arguments: (bool isGeofencingEnabled)

Indicates whether Geofencing service is enabled.

R1SDK.isGeofencingEnabled(function (isGeofencingEnabled) {
    //...
});

setEngageEnabled

Enable or disable the Engage in the SDK.

R1SDK.setEngageEnabled(true);

isEngageEnabled

Callback arguments: (bool isEngageEnabled)

Indicates whether Engage is enabled.

R1SDK.isEngageEnabled(function (isEngageEnabled) {
    //...
});

R1LocationService

setEnabled

Enable or disable the location service for giving location in the SDK.

R1LocationService.setEnabled(true);

isEnabled

Callback arguments: (bool isEnabled)

Indicates whether R1LocationService is enabled.

R1LocationService.isEnabled(function (isEnabled) {
    //...
});

setAutoupdateTimeout

When location service is enabled location information will be sent automatically. However, locationService doesn’t fetch the location constantly. For instance, when the location is received the SDK will turn off the location in CLLocationManager and wait 10 minutes (by default) before attempting to retrieve it again. You can change this value.

R1LocationService.setAutoupdateTimeout(1200); // 20 minutes

getAutoupdateTimeout

Callback arguments: (float autoupdateTimeout)

Get currently used autoupdate timeout.

R1LocationService.getAutoupdateTimeout(function (autoupdateTimeout) {
    //...
});

getState

Callback arguments: (string state)

Get current state of R1LocationService.

R1LocationService.getState(function (state) {
    //...
});

Possible state values:

  • "Disabled"
  • "Off"
  • "Searching"
  • "Has Location"
  • "Wait Next Update"

getCoordinate

Callback arguments: (object coordinate)

Get currently used user coordinate.

R1LocationService.getCoordinate(function (coordinate) {
    if (coordinate == null)
    {
        // Location not received yet
    }else
    {
        // coordinate.latitude
        // coordinate.longitude
    }       
    //...
});

updateNow

If R1LocationService is in "Wait Next Update" state, you can update the location manually.

R1LocationService.updateNow();

Events

R1LocationService.state

Notify the location service state has changed

document.addEventListener("R1LocationService.state", function(event) {
    // event.state 
}, false);
R1LocationService.coordinate

Notify the location service coordinate has changed

document.addEventListener("R1LocationService.coordinate", function(event) {
    // event.latitude, event.longitude
}, false);

R1Emitter

isStarted

Callback arguments: (bool isStarted)

Indicates whether the Emitter has started. The Emitter starts automatically if you set the upcom.radiumone.r1connect.applicationId key in config.xml.

R1Emitter.isStarted(function (isStarted) {
    //...
});

setAppName

The application name associated with this emitter. By default, this property is populated with the CFBundleName string from the application bundle. If you wish to override this property, you must do so before making any tracking calls.

R1Emitter.setAppName("Custom application name");

getAppName

Callback arguments: (string appName)

Get last setted application name or CFBundleName by default.

R1Emitter.getAppName(function (appName) {
    //...
});

setAppId

The application identifier associated with this emitter. If you wish to set this property, you must do so before making any tracking calls. Note: that this is not your app's bundle id, like e.g. com.example.appname.

R1Emitter.setAppId("12345678");

getAppId

Callback arguments: (string appId)

Get last setted app id.

R1Emitter.getAppId(function (appId) {
    //...
});

setAppVersion

The application version associated with this emitter. By default, this property is populated with theCFBundleShortVersionString string from the application bundle. If you wish to override this property, you must do so before making any tracking calls.

R1Emitter.setAppId("12345678");

getAppVersion

Callback arguments: (string appVersion)

Get last setted app version or CFBundleShortVersionString string from the application bundle.

R1Emitter.getAppVersion(function (appVersion) {
    //...
});

setSessionTimeout

Indicates how long, in seconds, the application must transition to the inactive or background state for before the tracker will automatically indicate the start of a new session when the app becomes active again by setting sessionStart to true. For example, if this is set to 30 seconds, and the user receives a phone call that lasts for 45 seconds while using the app, upon returning to the app, the sessionStart parameter will be set to true. If the phone call instead lasted 10 seconds, sessionStart will not be modified.

By default, this is 30 seconds.

R1Emitter.setSessionTimeout(15); // 15 seconds

getSessionTimeout

Callback arguments: (float sessionTimeout)

Get last setted session timeout or default value

R1Emitter.getSessionTimeout(function (sessionTimeout) {
    //...
});
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk