A sample Capacitor application to start learning the power of @situm/cordova.
This folder contains the source code of a Capacitor + Ionic example application using the Situm Cordova Plugin. You can also integrate this plugin on a Cordova project! Learn how to do it in this section.
- The first step is to download this repo:
git clone https://github.com/situmtech/cordova.git
- Then install the plugin dependencies alongside the
example
app as follows:
cd cordova/example
npm install
Tip
You might want to try out this configuration if you are facing some issues to build our sample app:
- node >= 18.13.X
- @ionic/cli 7.1.5
- gradle 8.4
- java 17.0.6
Note
Make sure you are using @ionic/cli
and not the deprecated ionic
npm package. Otherwise you won't be able to build the app and you will receive the following error:
- [ERROR] Invalid project type: angular-standalone (project config: ./ionic.config.json).
This example provides you with a template on src/constants.ts.example
to set all your credentials used on the sdk tab just in one file. So rename this file to constants.ts
and set up your credentials before running the app:
export const API_USER = 'YOUR_SITUM_API_USER';
export const API_KEY = 'YOUR_SITUM_API_KEY';
export const BUILDING_IDENTIFIER = 'YOUR_BUILDING_IDENTIFIER';
export const VIEWER_DOMAIN = 'https://map-viewer.situm.com';
Note
The credentials will also be set in the src/app/wyf/wyf.page.html
automatically in this example app. Make sure you set your credentials inside this file in your integration.
From the example/
folder, execute the following command to run the app on your device:
# For Android devices
ionic cap run android
# For iOS devices
ionic cap run ios
Note
iOS only
You might need to update the pods of this app by executing inside example/ios/App
:
$ pod install --repo-update
Also check out the project code signing before you run the example.
You can also run the app from your IDE:
- On Android: open
example/android/
with Android Studio. - On iOS: open
example/ios/App/App.xcworkspace
with XCode.
To integrate our plugin in a Cordova project, follow this 3 steps:
- Configure your Content-Security-Policy <meta> tag in your
www/index.html
to be able to display our MapView on Android:
<meta
http-equiv="Content-Security-Policy"
content="default-src 'self' data: https://ssl.gstatic.com https://map-viewer.situm.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *; img-src 'self' data: content:;"
/>
- Configure your
config.xml
file to be able to display our MapView on iOS by adding the following <allow-navigation> tag:
<widget>
...
<allow-navigation href="https://map-viewer.situm.com/*" />
</widget>
- All ready to use our plugin in a Cordova app!
cordova plugin add @situm/cordova
# For Android
cordova run android
# For iOS
cordova run iOS
Tip
You might want to learn how to create a basic Cordova app using our @situm/cordova plugin.
More information on how to use the official @situm/cordova plugin and the set of APIs, the functions, parameters and results each function accepts and provides can be found in our SDK API Reference and Wayfinding API Reference.
In case you want to learn how to use our plugin, you may want to take a look at our code samples of the basics functionalities:
- Basic SDK and Wayfinding functionality: showcases how to initialize the Situm SDK (refer to the cordova sdk quickstart guide for more information) and how to use some basic features like positioning and obtaining the information of a given building.
We use SemVer for versioning.
Please refer to CHANGELOG.md for a list of notables changes for each version of the library.
You can also see the tags on this repository.
You will need to sign a Contributor License Agreement (CLA) before making a submission. Learn more here.
This project is licensed under the MIT - see the LICENSE file for details.
More info is available at our Developers Page.
For any question or bug report, please send an email to [email protected]