Segment SDK
ContextEngine
Constructor |
new |
ContextEngine() |
Context engine constructor. This class helps to determine a user's current context. For instance home, work, etc...
Summary
Methods |
getCurrentContext
|
Gets current context that is recognized by N's Context Recognition System
Current context is null before it is successfully retrieved. |
Type definitions |
onsuccess
|
The callback method to be invoked when current context is successfully retrieved. |
onerror
|
The callback method to be invoked when the retrieval fails. |
Methods
getCurrentContext(callbackObject)
Gets current context that is recognized by N's Context Recognition System
Current context is null before it is successfully retrieved.
Parameters
Name |
Type |
Description |
callbackObject |
Object |
Callback object |
|
Properties
|
Type definitions
onsuccess(context)
The callback method to be invoked when current context is successfully retrieved.
Parameters
Name |
Type |
Description |
context |
Object |
|
|
Properties
Name |
Type |
Description |
place |
string |
The current location of the user
Constant values:
|
transportation |
string |
The user's movement state.
Constant values:
- goingToWork
- leavingWork
- otherTransportation
- notMoving
|
activity |
string |
The current user's activity.
Constant values:
- staying
- walking
- running
- ridingBicycle
- gettingOnCar
|
|
onerror(error)
The callback method to be invoked when the retrieval fails.
Parameters
Name |
Type |
Description |
error |
Object |
The error object |
|
Properties
Name |
Type |
Description |
code |
number |
The error code
|
message |
string |
The error message |
|