-
Notifications
You must be signed in to change notification settings - Fork 274
Location Data Schema
Chris Scott edited this page Apr 18, 2016
·
8 revisions
The schema of the Location-object sent to your successFn
takes the same form as the standard Cordova plugin cordova-plugin-geolocation.
The plugin attaches motion activity meta-data in the activity
key. This describes the nature of the last reported activity, including a probability of that activity between 0-100%.
bgGeo.configure(function(location, taskId) {
console.log(location); // <-- See detailed Schema below
bgGeo.finish(taskId);
}, errorCallback, config);
{
"timestamp": [Date], // <-- Javascript Date instance
"is_moving": [Boolean], // <-- The motion-state when location was recorded.
"uuid": [String], // <-- Universally unique identifier
"coords": {
"latitude": [Float],
"longitude": [Float],
"accuracy": [Float],
"speed": [Float],
"heading": [Float],
"altitude": [Float]
},
"activity": {
"type": [still|on_foot|walking|running|in_vehicle|on_bicycle],
"confidence": [0-100%]
},
"battery": {
"level": [Float],
"is_charging": [Boolean]
}
}
The location-data schema POSTed to your server takes the following form:
{
"location": {
"coords": {
"latitude": [Float],
"longitude": [Float]
"accuracy": [Float]
"speed": [Float],
"heading": [Float],
"altitude": [Float]
},
"extras": { // <-- optional extras. @see #getCurrentPosition for details
"foo": "bar"
},
"activity": {
"type": [still|on_foot|walking|running|in_vehicle|on_bicycle],
"confidence": [0-100%]
},
"geofence": { // <-- Present only if a geofence was triggered at this location
"identifier": [String],
"action": [String ENTER|EXIT]
},
"battery": {
"level": [Float],
"is_charging": [Boolean]
},
"timestamp": [ISO-8601 UTC], // eg: "2015-05-05T04:31:54.123Z"
"uuid": [String] // <-- Universally unique identifier
"is_moving": [Boolean] // <-- The motion-state when location was recorded.
}
}
Note: location
is an array for batched requests