Cordova
Cordova plugin for bringing Situm Indoor Positioning and wayfinding technology to hybrid apps
Install / Use
/learn @situmtech/CordovaREADME
Situm Wayfinding for Capacitor and Cordova. Integrate plug&play navigation experience with floorplans, POIs, routes and turn-by-turn directions in no time. With the power of Situm.
This plugin has two parts:
-
The base SDK, the building blocks that allow you to:
- obtain information related to buildings where Situm's positioning system is already configured: floorplans, points of interest, geotriggered events, etc.
- retrieve the location of the smartphone inside these buildings (position, orientation, and floor where the smartphone is).
- compute a route from a point A (e.g. where the smartphone is) to a point B (e.g. any point of interest within the building).
- trigger notifications when the user enters a certain area.
-
A full featured and easy to integrate UI component (
<map-view>) that allows you to:- show your cartography on a map
- show the user location on the map
- calculate point-to-point wayfinging routes
- explore points of interest on your buildings on the map
Table of contents
- Getting started
- Versioning
- Submitting contributions
- License
- Documentation
- Development
- More information
- Support information
Getting started
- Set up your Situm account following these steps.
- Configure this plugin in your project.
- API Reference will help you use a particular class or method.
Versioning
Please refer to CHANGELOG.md for a list of notables changes for each version of the plugin.
You can also see the tags on this repository.
Submitting contributions
You will need to sign a Contributor License Agreement (CLA) before making a submission. Learn more here.
License
Situm Cordova Plugin is licensed under MIT License. See LICENSE.txt file for further details.
Documentation
- General documentation. You can find in our documentation site all the information you need to configure this plugin in your project and get it up and running in no time.
- API reference. Check out the plugin reference and learn how to use a particular class or method.
- Examples. In example/ you can find a sample app implementing this plugin. Take a look at how the examples are implemented, so you can figure out how to adapt it to your project.
- Cordova Wayfinding plugin. If you are looking for a wayfinding solution using Cordova, check out this repo.
Methods
[!NOTE] This plugin is currently under development. There may be methods not implemented yet. Also there may be some API changes as development progresses.
Situm class
- setApiKey
Log in into your Situm Account. This key is generated in Situm Dashboard. Return true if apiKey was set successfully, otherwise false
cordova.plugins.Situm.setApiKey('SITUM_EMAIL', 'SITUM_API_KEY');
- setUserPass
Provides user's email and password. Return true if apiKey was set successfully, otherwise false
cordova.plugins.Situm.setUserPass('SITUM_EMAIL', 'SITUM_USER_PASS');
- setRemoteConfig
Set the remote configuration state which allows to use the configuration (location request) stored on the web to find the location of the user.
cordova.plugins.Situm.setUseRemoteConfig(true);
- setCacheMaxAge
Sets the maximum age of a cached response in seconds.
cordova.plugins.Situm.setCacheMaxAge(1 * 60 * 60); // 1 hour
- startPositioning
[!WARNING] This method is deprecated, instead use requestLocationUpdates.
Starts the positioning system. In the success callback it can return:
locationOptions = {
buildingIdentifier = "BUILDING_ID"
};
cordova.plugins.Situm.startPositioning(locationOptions, (res: any) => {
if (res && res.statusName) {
// Returns location status
}
if (res && res.position) {
// Return location object
}
}, (err: any) => {
//Return error as an string.If this happens the positioning is stopped
});
- requestLocationUpdates
Starts the positioning system. You can customize the positioning system by specifying a LocationRequest in the method parameters.
Use onLocationUpdate() to receive updates of the user's location, onLocationStatus() to receive updates of the positioning status and onLocationError() to receive the possible errors that take place when positioning.
cordova.plugins.Situm.requestLocationUpdates(
{
buildingIdentifier = "YOUR_BUILDING_IDENTIFIER"
});
- removeUpdates
Stop the positioning system. This method returns a promise, so use the .then() and .catch() methods to know the result.
cordova.plugins.Situm.removeUpdates()
.then(() => {
// Positioning system has stopped successfully.
})
.catch((err: any) => {
// Error while stopping the positioning system.
});
- onLocationUpdate
Use this callback to stay aware about the user's Location.
cordova.plugins.Situm.onLocationUpdate((location: any) => {
console.log('The user has moved to: ' + location.position);
});
- onLocationStatus
Use this callback to stay aware about the LocationStatus of the positioning system.
cordova.plugins.Situm.onLocationStatus((status: string) => {
console.log('New positioning status: ' + status);
});
- onLocationError
Use this callback to stay aware about the errors the user might face when the positioning system starts. See onLocationError().
cordova.plugins.Situm.onLocationError((err: any) => {
console.log('Error received when positioning: ' + err);
});
- stopPositioning
[!WARNING] This method is deprecated, instead use removeUpdates.
Stop the positioning system on current active listener.
cordova.plugins.Situm.stopPositioning();
- fetchBuildings
Download all the buildings for the current user.Returns an array of buildings
cordova.plugins.Situm.fetchBuildings(
(res: any) => {
// Return an array of buildings
},
(err: any) => {
// returns error string
}
);
- fetchBuildingInfo
Download the information (floors, pois, ...) of a building
cordova.plugins.Situm.fetchBuildingInfo(
building,
(res: any) => {
// Return the buildingInfo
},
(err: any) => {
// returns error string
}
);
- fetchFloorsFromBuilding
Download all the floors of a building.
cordova.plugins.Situm.fetchFloorsFromBuilding(
building,
(res: any) => {
// Return an array of floors
},
(err: any) => {
// returns error string
}
);
- fetchIndoorPOIsFromBuilding
Download the indoor POIs of a building.
cordova.plugins.Situm.fetchIndoorPOIsFromBuilding(
building,
(res: any) => {
// Return an array of indoor POIs
},
(err: any) => {
// returns error string
}
);
- fetchOutdoorPOIsFromBuilding
Download the outdoor POIs of a building.
cordova.plugins.Situm.fetchOutdoorPOIsFromBuilding(
building,
(res: any) => {
// Return an array of outdoor POIs
},
(err: any) => {
// returns error string
}
);
- fetchEventsFromBuilding
Download the events of a building.
cordova.plugins.Situm.fetchEventsFromBuilding(
building,
(res: any) => {
// Return an array of events
},
(err: any) => {
// returns error string
}
);
- fetchPoiCategories
Get all [POI Categories](https
