This documentation describes the old IndoorAtlas Cordova plugin version 2.x. The documentation of the versions 1.x of the plugin can be found here. Migrating to the new 3.0 version documented here is recommended.
Initializes IndoorAtlas' IALocationManager object with provided API key and secret. This method must be called before you start a positioning session.
IndoorAtlas.initialize(initializationSuccess,
initializationError,
{key: APIKEY, secret: APISECRET});
Parameters
Example
// onSuccess Callback
var onSuccess = function() {
alert('IndoorAtlas was successfully initialized');
};
// onError Callback receives a PositionError object
function onError(error) {
alert('Code: '+ error.code + '\n' +
'Message: ' + error.message);
};
IndoorAtlas.initialize(onSuccess,
onError,
{key: 'API KEY', secret: 'API SECRET'});
Returns the device’s current position to the geolocationSuccess
callback with a Position object as the parameter. If there is an
error, the geolocationError callback is passed a
PositionError object.
IndoorAtlas.getCurrentPosition(geolocationSuccess,
geolocationError,
[geolocationOptions]);
Parameters
Example
// onSuccess Callback
// This method accepts a Position object, which contains the
// current GPS coordinates
var onSuccess = function(position) {
alert('Latitude: ' + position.coords.latitude + '\n' +
'Longitude: ' + position.coords.longitude + '\n' +
'Altitude: ' + position.coords.altitude + '\n' +
'Accuracy: ' + position.coords.accuracy + '\n' +
'Heading: ' + position.coords.heading + '\n' +
'Floor: ' + position.coords.floor + '\n' +
'Timestamp: ' + position.timestamp);
};
// onError Callback receives a PositionError object
function onError(error) {
alert('Code: ' + error.code + '\n' +
'Message: ' + error.message);
}
IndoorAtlas.getCurrentPosition(onSuccess, onError);
Returns the device’s current position when a change in position is detected.
When the device retrieves a new location, the geolocationSuccess
callback executes with a Position object as the parameter. If
there is an error, the geolocationError callback executes with a
PositionError object as the parameter.
var watchId = IndoorAtlas.watchPosition(geolocationSuccess,
geolocationError,
{timeout: TIMEOUT});
Parameters
Returns
IndoorAtlas.clearWatch to stop watching for changes in position.Example
// onSuccess Callback
// This method accepts a `Position` object, which contains
// the current GPS coordinates
function onSuccess(position) {
alert('Latitude: ' + position.coords.latitude + '\n' +
'Longitude: ' + position.coords.longitude);
};
// onError Callback receives a PositionError object
function onError(error) {
alert('Code: ' + error.code + '\n' +
'Message: ' + error.message);
};
// Options: throw an error if no update is received every 30 seconds.
var watchID = IndoorAtlas.watchPosition(onSuccess, onError, {timeout: 30000});
geolocationOptions
Optional parameters to set the timeout of the operation.
Options
IndoorAtlas.getCurrentPosition or IndoorAtlas.watchPosition until the corresponding geolocationSuccess callback executes. If the geolocationSuccess callback is not invoked within this time, the geolocationError callback is passed a PositionError.TIMEOUT error code. (Number)Indicate current location to positioning service. This method can be used to pass a hint to the system e.g. when location is already known. This is completely optional and should only be used to shorten time it takes for the first fix. It is not recommended that this method is called with approximate locations with low or medium accuracy.
IndoorAtlas.setPosition(geolocationSuccess,
geolocationError, {
coordinates: [LATITUDE, LONGITUDE]
});
Parameters
Example
// onSuccess Callback
function onSuccess() {
alert('Position was set successfully');
};
// onError Callback receives a PositionError object
function onError(error) {
alert('Code: ' + error.code + '\n' +
'Message: ' + error.message);
};
// Options: pass venue ID or floor plan ID. Location can also be given.
// Position can be set with multiple ways, such as:
IndoorAtlas.setPosition(onSuccess,
onError, {
coordinates: [37.784013, -122.406872]
});
IndoorAtlas.setPosition(onSuccess,
onError, {
floorPlanId: 'FLOOR_PLAN_ID_HERE'
});
IndoorAtlas.setPosition(onSuccess,
onError, {
venueId: 'VENUE_ID_HERE'
});
IndoorAtlas.setPosition(onSuccess,
onError, {
venueId: 'VENUE_ID_HERE',
coordinates: [37.784013, -122.406872]
});
geolocationOptions
geolocationOptions can consist any one or both of the following
Stop watching for changes to the device’s location referenced by the
watchID parameter.
IndoorAtlas.clearWatch(watchID);
Parameters
watchPosition interval to clear. (String)Example
// Options: watch for changes in position, and use the most
// accurate position acquisition method available.
var watchID = IndoorAtlas.watchPosition(onSuccess, onError);
// ...later on...
IndoorAtlas.clearWatch(watchID);
Returns when a change in region is detected.
When the device enters a region, the onEnterRegion
callback executes with a Region object as the parameter.
When the device exits a region, the onExitRegion
callback executes with a Region object as the parameter. If
there is an error, the geolocationError callback executes with a
PositionError object as the parameter.
var watchId = IndoorAtlas.watchRegion(onEnterRegion,
onExitRegion,
geolocationError);
Parameters
Returns
IndoorAtlas.clearRegionWatch to stop watching for changes in region.Example
// onEnterRegion Callback
// This method accepts a `Region` object, which contains
// IARegion information
function onEnterRegion(region) {
alert('Entered region: ' + region.regionId);
};
// onExitRegion Callback
// This method accepts a `Region` object, which contains
// IARegion information
function onExitRegion(region) {
alert('Exited region: ' + region.regionId);
};
// onError Callback receives a PositionError object
function onError(error) {
alert('Code: ' + error.code + '\n' +
'Message: ' + error.message);
};
// Options: throw an error if no update is received every 30 seconds.
var watchID = IndoorAtlas.watchRegion(onEnterRegion, onExitRegion, onError);
Stop watching for changes to the device’s region referenced by the
watchID parameter.
IndoorAtlas.clearRegionWatch(watchID);
Parameters
watchRegion interval to clear. (String)Example
// Options: watch for changes in position, and use the most
// accurate position acquisition method available.
var watchID = IndoorAtlas.watchRegion(onEnterRegion, onExitRegion, onError);
// ...later on...
IndoorAtlas.clearRegionWatch(watchID);
Sets the distance for the distance filter feature. The minimum distance measured in meters that the device must move horizontally before an update event is generated.
IndoorAtlas.setDistanceFilter(successCallback,
errorCallback,
{distance: DISTANCE});
Parameters
Example
// onSuccess Callback
function onSuccess() {
alert('Distance filter was set');
};
// onError Callback receives an error object
function onError(error) {
alert('Message: ' + error.message);
};
IndoorAtlas.setDistanceFilter(onSuccess, onError, {distance: 10});
Returns the floor certainty of the current floor plan. Value for floor certainty is between 0 and 1.0, where 1.0 is the highest certainty that the current floor plan is the correct one.
IndoorAtlas.getFloorCertainty(successCallback, errorCallback);
Parameters
Example
// onSuccess Callback
function onSuccess(data) {
alert('Floor certainty is: '+ data.floorCertainty);
};
// onError Callback receives an error object
function onError(error) {
alert('Code: ' + error.code + '\n' +
'Message: ' + error.message);
};
IndoorAtlas.getFloorCertainty(onSuccess, onError);
Returns the traceId.
IndoorAtlas.getTraceId(successCallback, errorCallback);
Parameters
Example
// onSuccess Callback
function onSuccess(data) {
alert('TraceId is: '+ data.traceId);
};
// onError Callback receives an error object
function onError(error) {
alert('Code: ' + error.code + '\n' +
'Message: ' + error.message);
};
IndoorAtlas.getTraceId(onSuccess, onError);
Add callback for getting attitude updates.
IndoorAtlas.didUpdateAttitude(onAttitudeUpdate, errorCallback);
Parameters
Example
var onAttitudeUpdate = function(attitude) {
alert('X: ' + attitude.x + '\n' +
'Y: ' + attitude.y + '\n' +
'Z: ' + attitude.z + '\n' +
'W: ' + attitude.w + '\n' +
'Timestamp: ' + attitude.timestamp);
};
var onError = function(error) {
alert('Code: ' + error.code + '\n' +
'Message: ' + error.message);
};
IndoorAtlas.didUpdateAttitude(onAttitudeUpdate, onError);
Stop receiving callbacks for attitude updates.
IndoorAtlas.removeAttitudeCallback();
Add callback for getting heading updates.
IndoorAtlas.didUpdateHeading(onHeadingUpdate, errorCallback);
Parameters
Example
var onHeadingUpdate = function(heading) {
alert('True Heading: ' + heading.trueHeading + '\n' +
'Timestamp: ' + heading.timestamp);
};
var onError = function(error) {
alert('Code: ' + error.code + '\n' +
'Message: ' + error.message);
};
IndoorAtlas.didUpdateHeading(onHeadingUpdate, onError);
Stop receiving callbacks for heading updates.
IndoorAtlas.removeHeadingCallback();
Add callback for getting status updates.
IndoorAtlas.onStatusChanged(onStatusChange, errorCallback);
Parameters
Example
var onStatusUpdate = function(status) {
alert('Message: ' + status.message + '\n' +
'Type: ' + status.type);
};
var onError = function(error) {
alert('Code: ' + error.code + '\n' +
'Message: ' + error.message);
};
IndoorAtlas.onStatusChanged(onStatusChange, onError);
Set sensitivities for orientation and heading updates.
IndoorAtlas.setSensitivities(onSuccess,
onError,
{orientationSensitivity: ORIENTATIONSENSITIVITY, headingSensitivity: HEADINGSENSITIVITY});
Parameters
Example
function onSuccess() {
alert('Sensitivities were set');
};
function onError(error) {
alert(error);
};
IndoorAtlas.setSensitivities(onSuccess, onError, {orientationSensitivity: 10, headingSensitivity: 5});
(New in version 2.9) Disable automatic floor detection and lock the floor level to a given number
IndoorAtlas.lockFloor(floorNumber)
Parameters
(New in version 2.9) Re-enable automatic floor detection after locking the floor with lockFloor
IndoorAtlas.unlockFloor()
(New in version 2.9) Disable or re-enable indoor-outdoor detection
// keep positioning indoors, disable automatic indoor-outdoor detection
IndoorAtlas.lockIndoors(true)
// re-enable automatic indoor-outdoor detection
IndoorAtlas.lockIndoors(false)
(New in version 2.9) Request wayfinding from the current location of the user to the given coordinates
IndoorAtlas.requestWayfindingUpdates(destination, onWayfindingUpdate)
Parameters
(route) => { ... }, where the
attribute route.legs is an array of IARoutingLeg objects. Properties of these
can be seen below. The callback is invoked each time a new location is produced
by the IndoorAtlas SDK. The updates can be stopped by calling removeWayfindingUpdatesProperties
Properties
RoutingPoint. (Int)(New in version 2.9) Stops wayfinding
IndoorAtlas.removeWayfindingUpdates()
var destination = { latitude: 60.16, longitude: 24.95, floor: 2 };
IndoorAtlas.requestWayfindingUpdates(destination, function(route) {
// Use route.legs to draw the route etc.
});
Contains IndoorAtlas.Position coordinates, region and timestamp, created by the IndoorAtlas API.
Properties
coords. (DOMTimeStamp)A IndoorAtlas.Coordinates object is attached to a Position object that is
available to callback functions in requests for the current position.
It contains a set of properties that describe the geographic coordinates of a position.
Properties
A data object describing a typed region in IndoorAtlas namespace.
A IndoorAtlas.Region object is attached to a Position object that is
available to callback functions in requests for the current position.
IndoorAtlas.Region object is also returned by IndoorAtlas.watchRegion callbacks.
It represents IARegion object.
Properties
Region.TYPE_FLOORPLAN, Region.TYPE_VENUE Region.TYPE_UNKNOWN. (Number)Region.TRANSITION_TYPE_ENTER,Region.TRANSITION_TYPE_EXIT and Region.TRANSITION_TYPE_UNKNOWN. (Number)Region.TYPE_FLOORPLAN. (FloorPlan)Region.TYPE_VENUE. (Venue)The IndoorAtlas.PositionError object is passed to the geolocationError
callback function when an error occurs with LocationServices.
Properties
A data object describing a floor plan in IndoorAtlas namespace. It represents IAFloorPlan object.
Properties
Methods
var floorPlan; // FloorPlan object from IARegion
// Example of how to convert coordinate to point and print the output to console.
var point = floorPlan.coordinateToPoint(60.17, 24.94);
console.log("x is " + point.x + " and y " + point.y);
// Example of how to convert point to coordinate and print the output to console.
var coordinate = floorPlan.pointToCoordinate(100, 200);
console.log("latitude is " + coordinate.latitude + " and longitude " + coordinate.longitude);
A data object describing a venue (a set of floor plans) It represents an IAVenue object.
Properties
PositionError
PositionError.PERMISSION_DENIED
PositionError.POSITION_UNAVAILABLE
PositionError.TIMEOUT
timeout included in geolocationOptions. When used with IndoorAtlas.watchPosition, this error could be repeatedly passed to the geolocationError callback every timeout milliseconds.PositionError.INVALID_ACCESS_TOKEN
PositionError.INITIALIZATION_ERROR
IndoorAtlas.initialize.PositionError.FLOOR_PLAN_UNAVAILABLE
IndoorAtlas.fetchFloorPlanWithId is private and belongs to another account.PositionError.UNSPECIFIED_ERROR
CurrentStatus
CurrentStatus.STATUS_OUT_OF_SERVICE
CurrentStatus.STATUS_TEMPORARILY_UNAVAILABLE
CurrentStatus.STATUS_AVAILABLE
CurrentStatus.STATUS_LIMITED
Region
Region.TRANSITION_TYPE_ENTER
Region.TRANSITION_TYPE_EXIT
Region.TRANSITION_TYPE_UNKNOWN
Region.TYPE_FLOORPLAN
Region.TYPE_VENUE
Region.TYPE_UNKNOWN