Constitutes the activity object that enables access to combined data from several native sensors to return the estimated type of user activity (walking, running, standing still, etc.) along with confidence percentage.
Once data gathering is started using the start
method, the API
starts sending data
objects at set intervals.
You can establish the object by using the following reference:
launchbox.Motion.Activity (interval, dataCallback, errorCallback)
Name | Description | Type | Use |
---|---|---|---|
interval | Defined to set an expected interval (in miliseconds) at which data is collected from the sensors. | integer |
required |
dataCallback | Defined to receive the |
function |
required |
errorCallback | Defined to receive the |
function |
required |
The data
JSON object contains the following values:
{ "timestamp" = 1455810375223, // time of the event in [ms], counted from the 1 January 1970 (long) "unknown" = 0, // (int) "running" = 12, // (int) "walking" = 78, // (int) "automotive" = 0, // (int) "still" = 0, // (int) "cycling" = 10 // (int) }
Integer values returned in this object represent the percentage of probability that the device user's activity is one of the ones listed in the object.
The error
JSON object contains one attribute that passes an error message
delivered by the device:
{ "message" = "Sensor 'ACTIVITY' is not available on this device." }
Name | Return type | Description |
---|---|---|
start | undefined |
Initiates gathering of data from various hardware sensors, to enable recognition of the user's activity. |
stop | undefined |
Stops gathering of data from various hardware sensors used to estimate the user's activity. |