ContextEngine | Context engine constructor. This class helps to determine a user's current context. For instance home, work, etc... |
Geolocation | GeoLocation constructor. This class handles determining a users current location |
SpeechSynthesis | SpeechSynthesis constructor. This class is used to execute TTS engine to speak out texts. It should be called after a segment is started, however the speech is muted by the system when the segment is paused or in an onpaused state. |
SpeechToText | SpeechToText constructor. This class helps to start voice recoginition to return text data. |
Storage | Storage constructor. Use this API to access local storage on Nigel. Note: Do not use general JavaScript Window.localStorage and Window.sessionStorage APIs to access Nigel local storage. |
Methods | |
---|---|
addTimeline | When called from a segment's segment.onpreprocess or segment.onstart process, adds an entry to the time-line database |
cancelSegment | When called from a segment's segment.onpreprocess process, causes the Personalized Radio function to cancel the pre-launch, without starting the segment. |
getApiLevel | Gets the current API level |
getBatteryLevel | Gets the battery level of the user's neckband unit. |
getOAuthAccessToken | Obtains an OAuth access token from the segment's OAuth procedure and then stores it on the server. |
getSegmentConfig | Gets segment configuration options from the server. |
getString | Retrieves a resource string from the segment's string.json file. |
getXhr | Gets an XHR (XML HTTP Request) object to access an external service. |
registerBookmark | When called from a segment's segment.onpreprocess or segment.onstart process, adds an entry to the bookmark and time-line database |
requestStartSegment | This method is called from a worker to request start a segment notification. |
setSegmentConfig | Updates segment configuration options on the server. |
startSegment | When called from a segment's segment.onpreprocess process, causes the Personalized Radio function to complete the pre-launch and start the segment. |
stopSegment | When called from a segment's segment.onstart process, causes the Personalized Radio function to end the segment notification. |
stopWorker | When called from a worker's segment.onstart process, causes the Personalized Radio function to cancel this iteration of the worker, without triggering the segment. |
Type definitions | |
---|---|
onerror | Callback function when an error occurs. |
When called from a segment's segment.onpreprocess or segment.onstart process, adds an entry to the time-line database. This API is not available to a worker process.
Name | Type | Description | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
entry | object | The object to add to the time-line database in the server. | |||||||||||||||||||||||||||
Properties
|
Type | Description |
---|---|
Object |
Error Null if the entry was added successfully; or an error object that describes why the operation failed. |
number |
Error.code : The error code:
|
string | Error.message : A message that describes the error. |
When called from a segment's segment.onpreprocess process, causes the Personalized Radio function to cancel the pre-launch, without starting the segment.
Gets the current API level. This function only exists after the first release so be sure to check to see if this function exists before using it.
Type | Description |
---|---|
number | API Level |
Gets the battery level of the user's neckband unit.
Type | Description |
---|---|
number | A number between 0.0 (empty) and 1.0 (full). |
Obtains an OAuth access token from the segment's OAuth procedure and then stores it on the server.
The access token is obtained by the OAuth procedure on mobile host application and is stored on the server.
The configuration settings for the OAuth procedure are stored in the segment's oauth.json file.
Name | Type | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
segmentOAuthId | string | The segment OAuth ID for the OAuth access token to obtain. | ||||||||||||||||||
callbackObject | Object | |||||||||||||||||||
Properties
|
||||||||||||||||||||
noCache | boolean | True keep the server from caching the token; otherwise, false. |
------ Parsed jsonObject of Twitter ------ { "extra": { "access_token": { "consumer": { "key": "****", "secret": "****" }, "secret": "****", "token": "****" } } } ------ Parsed jsonObject of Google ------ { "access_token": "****" }
Gets segment configuration options from the server.
The default configuration options are generated from the settings in the segment's res/settings/defaultValues.json file. Use the da.setSegmentConfig method to update the segment's configuration options.
Name | Type | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
callbackObject | Object | |||||||||||||||||||
Properties
|
Retrieves a resource string from the segment's string.json file.
The meta expressions (${meta-name}) in the retrieved string are replaced with the value of the corresponding field in the objectString parameter.
Name | Type | Description |
---|---|---|
key | String | The key of the string to retrieve from the file. |
objectString | Object | An object that contains the values for the meta expressions (${meta-name}) in the retrieved resource string. |
================================ [string.json] { "rt": [ "RT @${name}\:*" ] } ================================ [How to use] var text = da.getString("rt", { name: 'RENA' }); -> "RT @${name}\:*" is retrieved from string.json. Then ${name} is replaced with 'RENA', "RT @RENA\:*" is returned. ================================
Gets an XHR (XML HTTP Request) object to access an external service.
Type | Description |
---|---|
XMLHttpRequest | XHR object |
When called from a segment's segment.onpreprocess or segment.onstart process, adds an entry to the bookmark and time-line database. Once segment calls registerBookmark API, the item is added not only to the bookmark database, but also to the time-line database. This API is not available to a worker process.
Name | Type | Description | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
entry | object | The object to add to the bookmark database in the server. | |||||||||||||||||||||||||||
Properties
|
Type | Description |
---|---|
Object |
Error Null if the entry was added successfully; or an error object that describes why the operation failed. |
number |
Error.code : The error code:
|
string | Error.message : A message that describes the error. |
This method is called from a worker to request start a segment notification.
When called from a worker's segment.onstart process, causes the Personalized Radio function to complete this iteration of the worker and trigger the segment. The Personalized Radio function triggers the segment by calling its segment.onpreprocess method. In that call, the trigger parameter is "Worker", and the Personalized Radio function uses the arguments provided here as default values when the segment calls the da.startSegment method.
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
launchType | string | The default launch type for the segment to trigger: [simple, full]. | ||||||||||||
argumentObject | Object | |||||||||||||
Properties
|
Updates segment configuration options on the server.
The data format for settings object is described in res/settings/schema.json to server.
Name | Type | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
callbackObject | Object | |||||||||||||||||||
Properties
|
||||||||||||||||||||
jsonObject | Object | A JSON object that contains the configuration options to set on the server. |
When called from a segment's segment.onpreprocess process, causes the Personalized Radio function to complete the pre-launch and start the segment.
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
launchType | string | The launch type for the segment to start: [simple, full]; or null to use the default value. Available if the segment trigger was launchRule or worker. | ||||||||||||
argumentObject | object | The cue voice and launch arguments for the segment, or null to use the default values. | ||||||||||||
Properties
|
When called from a segment's segment.onstart process, causes the Personalized Radio function to end the segment notification.
When called from a worker's segment.onstart process, causes the Personalized Radio function to cancel this iteration of the worker, without triggering the segment.
Type |
---|
function |
Callback function when an error occurs.
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
error | Object | Error object | |||||||||
Properties
|