@situm/cordova 3.1.1 → 3.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/CHANGELOG_UNRELEASED.md +2 -4
  2. package/README.md +320 -170
  3. package/example/.browserslistrc +16 -0
  4. package/example/.editorconfig +16 -0
  5. package/example/.eslintrc.json +46 -0
  6. package/example/README.md +163 -0
  7. package/example/android/app/build.gradle +54 -0
  8. package/example/android/app/capacitor.build.gradle +27 -0
  9. package/example/android/app/proguard-rules.pro +21 -0
  10. package/example/android/app/src/androidTest/java/com/getcapacitor/myapp/ExampleInstrumentedTest.java +26 -0
  11. package/example/android/app/src/main/AndroidManifest.xml +42 -0
  12. package/example/android/app/src/main/java/com/situm/capacitor_example/MainActivity.java +5 -0
  13. package/example/android/app/src/main/res/drawable/ic_launcher_background.xml +170 -0
  14. package/example/android/app/src/main/res/drawable/splash.png +0 -0
  15. package/example/android/app/src/main/res/drawable-land-hdpi/splash.png +0 -0
  16. package/example/android/app/src/main/res/drawable-land-mdpi/splash.png +0 -0
  17. package/example/android/app/src/main/res/drawable-land-xhdpi/splash.png +0 -0
  18. package/example/android/app/src/main/res/drawable-land-xxhdpi/splash.png +0 -0
  19. package/example/android/app/src/main/res/drawable-land-xxxhdpi/splash.png +0 -0
  20. package/example/android/app/src/main/res/drawable-port-hdpi/splash.png +0 -0
  21. package/example/android/app/src/main/res/drawable-port-mdpi/splash.png +0 -0
  22. package/example/android/app/src/main/res/drawable-port-xhdpi/splash.png +0 -0
  23. package/example/android/app/src/main/res/drawable-port-xxhdpi/splash.png +0 -0
  24. package/example/android/app/src/main/res/drawable-port-xxxhdpi/splash.png +0 -0
  25. package/example/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +34 -0
  26. package/example/android/app/src/main/res/layout/activity_main.xml +12 -0
  27. package/example/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +5 -0
  28. package/example/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +5 -0
  29. package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  30. package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png +0 -0
  31. package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  32. package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  33. package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png +0 -0
  34. package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  35. package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  36. package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png +0 -0
  37. package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  38. package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  39. package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png +0 -0
  40. package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  41. package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  42. package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png +0 -0
  43. package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  44. package/example/android/app/src/main/res/values/ic_launcher_background.xml +4 -0
  45. package/example/android/app/src/main/res/values/strings.xml +7 -0
  46. package/example/android/app/src/main/res/values/styles.xml +22 -0
  47. package/example/android/app/src/main/res/xml/file_paths.xml +5 -0
  48. package/example/android/app/src/test/java/com/getcapacitor/myapp/ExampleUnitTest.java +18 -0
  49. package/example/android/build.gradle +29 -0
  50. package/example/android/capacitor.settings.gradle +27 -0
  51. package/example/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  52. package/example/android/gradle/wrapper/gradle-wrapper.properties +6 -0
  53. package/example/android/gradle.properties +22 -0
  54. package/example/android/gradlew +244 -0
  55. package/example/android/gradlew.bat +92 -0
  56. package/example/android/settings.gradle +5 -0
  57. package/example/android/variables.gradle +16 -0
  58. package/example/angular.json +145 -0
  59. package/example/capacitor.config.json +1 -0
  60. package/example/capacitor.config.ts +12 -0
  61. package/example/docs/assets/sdk_preview.png +0 -0
  62. package/example/docs/assets/wyf_preview.png +0 -0
  63. package/example/ionic.config.json +7 -0
  64. package/example/ios/App/App/AppDelegate.swift +49 -0
  65. package/example/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png +0 -0
  66. package/example/ios/App/App/Assets.xcassets/AppIcon.appiconset/Contents.json +14 -0
  67. package/example/ios/App/App/Assets.xcassets/Contents.json +6 -0
  68. package/example/ios/App/App/Assets.xcassets/Splash.imageset/Contents.json +23 -0
  69. package/example/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-1.png +0 -0
  70. package/example/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-2.png +0 -0
  71. package/example/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732.png +0 -0
  72. package/example/ios/App/App/Base.lproj/LaunchScreen.storyboard +32 -0
  73. package/example/ios/App/App/Base.lproj/Main.storyboard +19 -0
  74. package/example/ios/App/App/Info.plist +55 -0
  75. package/example/ios/App/App.xcodeproj/project.pbxproj +408 -0
  76. package/example/ios/App/App.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  77. package/example/ios/App/App.xcworkspace/contents.xcworkspacedata +10 -0
  78. package/example/ios/App/App.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  79. package/example/ios/App/Podfile +32 -0
  80. package/example/karma.conf.js +44 -0
  81. package/example/package-lock.json +17234 -0
  82. package/example/package.json +73 -0
  83. package/example/src/app/app.component.html +3 -0
  84. package/example/src/app/app.component.scss +0 -0
  85. package/example/src/app/app.component.spec.ts +16 -0
  86. package/example/src/app/app.component.ts +12 -0
  87. package/example/src/app/app.routes.ts +8 -0
  88. package/example/src/app/sdk/sdk.page.html +109 -0
  89. package/example/src/app/sdk/sdk.page.scss +24 -0
  90. package/example/src/app/sdk/sdk.page.spec.ts +18 -0
  91. package/example/src/app/sdk/sdk.page.ts +440 -0
  92. package/example/src/app/tabs/tabs.page.html +13 -0
  93. package/example/src/app/tabs/tabs.page.scss +1 -0
  94. package/example/src/app/tabs/tabs.page.spec.ts +27 -0
  95. package/example/src/app/tabs/tabs.page.ts +19 -0
  96. package/example/src/app/tabs/tabs.routes.ts +31 -0
  97. package/example/src/app/utils/request.permissions.ts +68 -0
  98. package/example/src/app/wyf/wyf.page.html +22 -0
  99. package/example/src/app/wyf/wyf.page.scss +8 -0
  100. package/example/src/app/wyf/wyf.page.spec.ts +18 -0
  101. package/example/src/app/wyf/wyf.page.ts +47 -0
  102. package/example/src/assets/icon/favicon.png +0 -0
  103. package/example/src/assets/icon/situm-logo-whitebg.svg +67 -0
  104. package/example/src/assets/shapes.svg +1 -0
  105. package/example/src/constants.ts.example +6 -0
  106. package/example/src/environments/environment.prod.ts +3 -0
  107. package/example/src/environments/environment.ts +16 -0
  108. package/example/src/global.scss +26 -0
  109. package/example/src/index.html +26 -0
  110. package/example/src/main.ts +20 -0
  111. package/example/src/polyfills.ts +55 -0
  112. package/example/src/test.ts +14 -0
  113. package/example/src/theme/variables.scss +244 -0
  114. package/example/src/zone-flags.ts +6 -0
  115. package/example/tsconfig.app.json +15 -0
  116. package/example/tsconfig.json +30 -0
  117. package/example/tsconfig.spec.json +18 -0
  118. package/package.json +1 -1
  119. package/plugin.xml +1 -1
  120. package/src/android/app/build.gradle +1 -1
  121. package/src/android/situm.gradle +1 -1
  122. package/www/map-view-controller.js +1 -1
  123. package/www/map-view.js +3 -3
package/README.md CHANGED
@@ -1,32 +1,34 @@
1
- <div style="text-align:center">
1
+ <p align="center"> <img width="233" src="https://situm.com/wp-content/themes/situm/img/logo-situm.svg" style="margin-bottom:1rem" />
2
+ <h1 align="center">Situm Cordova Plugin</h1>
3
+ </p>
4
+
5
+ <div align="center" style="text-align:center">
6
+ Situm Cordova Plugin is a set of utilities that allow any developer to build Cordova location based apps using Situm's indoor positioning system. Among many other capabilities, apps developed with Situm Cordova Plugin will be able to:
7
+ </div>
8
+
9
+ - Obtain information related to buildings where Situm's positioning system is already configured: floorplans, points of interest, geotriggered events, etc.
10
+ - Retrieve the location of the smartphone inside these buildings (position, orientation, and floor where the smartphone is).
11
+ - 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).
12
+ - Trigger notifications when the user enters a certain area.
13
+
14
+ <div align="center" style="text-align:center">
2
15
 
3
- # Situm Cordova Plugin
4
16
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
5
17
  [![npm](https://img.shields.io/npm/v/@situm/cordova.svg)](https://www.npmjs.com/package/@situm/cordova)
6
18
  [![npm](https://img.shields.io/npm/dm/@situm/cordova.svg)](https://www.npmjs.com/package/@situm/cordova)
7
- </div>
8
- <div style="float:right; margin-left: 1rem;">
9
19
 
10
- [![](https://situm.com/wp-content/themes/situm/img/logo-situm.svg)](https://www.situm.es)
11
20
  </div>
12
21
 
13
- Situm Cordova Plugin is a set of utilities that allow any developer to build Cordova location based apps using Situm's indoor positioning system. Among many other capabilities, apps developed with Situm Cordova Plugin will be able to:
14
- * Obtain information related to buildings where Situm's positioning system is already configured: floorplans, points of interest, geotriggered events, etc.
15
- * Retrieve the location of the smartphone inside these buildings (position, orientation, and floor where the smartphone is).
16
- * 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).
17
- * Trigger notifications when the user enters a certain area.
18
-
19
-
20
22
  ## Table of contents
21
23
 
22
- * [Getting started](#getting-started)
23
- * [Versioning](#versioning)
24
- * [Submitting contributions](#submitting-contributions)
25
- * [License](#license)
26
- * [Documentation](#documentation)
27
- * [Development](#development)
28
- * [More information](#more-information)
29
- * [Support information](#support-information)
24
+ - [Getting started](#getting-started)
25
+ - [Versioning](#versioning)
26
+ - [Submitting contributions](#submitting-contributions)
27
+ - [License](#license)
28
+ - [Documentation](#documentation)
29
+ - [Development](#development)
30
+ - [More information](#more-information)
31
+ - [Support information](#support-information)
30
32
 
31
33
  ---
32
34
 
@@ -40,21 +42,21 @@ Situm Cordova Plugin is a set of utilities that allow any developer to build Cor
40
42
 
41
43
  ## Versioning
42
44
 
43
- Please refer to [CHANGELOG.md](https://github.com/situmtech/situm-cordova-plugin/blob/master/CHANGELOG.md) for a list of notables changes for each version of the plugin.
45
+ Please refer to [CHANGELOG.md](https://github.com/situmtech/cordova/blob/master/CHANGELOG.md) for a list of notables changes for each version of the plugin.
44
46
 
45
- You can also see the [tags on this repository](https://github.com/situmtech/situm-cordova-plugin/tags).
47
+ You can also see the [tags on this repository](https://github.com/situmtech/cordova/tags).
46
48
 
47
49
  ---
48
50
 
49
51
  ## Submitting contributions
50
52
 
51
- You will need to sign a Contributor License Agreement (CLA) before making a submission. [Learn more here](https://situm.com/contributions/).
53
+ You will need to sign a Contributor License Agreement (CLA) before making a submission. [Learn more here](https://situm.com/contributions/).
52
54
 
53
55
  ---
54
56
 
55
57
  ## License
56
58
 
57
- Situm-Cordova-Plugin is licensed under [MIT License](https://opensource.org/licenses/MIT). See [LICENSE.txt](https://github.com/situmtech/situm-cordova-plugin/blob/master/LICENSE) file for further details.
59
+ Situm Cordova Plugin is licensed under [MIT License](https://opensource.org/licenses/MIT). See [LICENSE.txt](https://github.com/situmtech/cordova/blob/master/LICENSE) file for further details.
58
60
 
59
61
  ---
60
62
 
@@ -62,12 +64,15 @@ Situm-Cordova-Plugin is licensed under [MIT License](https://opensource.org/lice
62
64
 
63
65
  - **General documentation**. You can find in our [documentation site](https://situm.com/docs/a-basic-cordova-app/) all the information you need to configure this plugin in your project and get it up and running in no time.
64
66
  - **API reference**. Check out the [plugin reference](https://developers.situm.com/sdk_documentation/cordova/jsdoc/latest/situm) and learn how to use a particular class or method.
65
- - **Examples**. In [this repo](https://github.com/situmtech/situm-cordova-getting-started) 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.
66
- - **Cordova Wayfinding plugin**. If you are looking for a wayfinding solution using Cordova, check out [this repo](https://github.com/situmtech/situm-cordova-plugin-wayfinding).
67
+ - **Examples**. In [example/](./example/README.md) 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.
68
+ - **Cordova Wayfinding plugin**. If you are looking for a wayfinding solution using Cordova, check out [this repo](https://github.com/situmtech/cordova).
67
69
 
68
- ### Methods
70
+ ### Methods
69
71
 
70
- NOTE: This plugin is currently under development. There may be method not implemented yet. Also there may be some API changes as development progresses.
72
+ > [!NOTE]
73
+ > This plugin is currently under development. There may be method not implemented yet. Also there may be some API changes as development progresses.
74
+
75
+ ### Situm class
71
76
 
72
77
  #### - setApiKey
73
78
 
@@ -80,6 +85,7 @@ cordova.plugins.Situm.setApiKey("SITUM_EMAIL", "SITUM_API_KEY");
80
85
  #### - setUserPass
81
86
 
82
87
  Provides user's email and password. Return true if apiKey was set successfully, otherwise false
88
+
83
89
  ```js
84
90
  cordova.plugins.Situm.setUserPass("SITUM_EMAIL", "SITUM_USER_PASS");
85
91
  ```
@@ -87,6 +93,7 @@ cordova.plugins.Situm.setUserPass("SITUM_EMAIL", "SITUM_USER_PASS");
87
93
  #### - setRemoteConfig
88
94
 
89
95
  Set the remote configuration state which allows to use the configuration (location request) stored on the web to find the location of the user.
96
+
90
97
  ```js
91
98
  cordova.plugins.Situm.setUseRemoteConfig(true);
92
99
  ```
@@ -94,15 +101,18 @@ cordova.plugins.Situm.setUseRemoteConfig(true);
94
101
  #### - setCacheMaxAge
95
102
 
96
103
  Sets the maximum age of a cached response in seconds.
104
+
97
105
  ```js
98
- cordova.plugins.Situm.setCacheMaxAge(1*60*60) // 1 hour
106
+ cordova.plugins.Situm.setCacheMaxAge(1 * 60 * 60); // 1 hour
99
107
  ```
100
108
 
101
109
  #### - startPositioning
102
110
 
103
111
  Starts the positioning system. In the success callback it can return:
104
- * [Location](https://developers.situm.com/sdk_documentation/cordova/jsdoc/latest/global.html#Location)
105
- * [LocationStatus](https://developers.situm.com/sdk_documentation/cordova/jsdoc/latest/global.html#LocationStatus)
112
+
113
+ - [Location](https://developers.situm.com/sdk_documentation/cordova/jsdoc/latest/global.html#Location)
114
+ - [LocationStatus](https://developers.situm.com/sdk_documentation/cordova/jsdoc/latest/global.html#LocationStatus)
115
+
106
116
  ```js
107
117
  locationOptions = {
108
118
  buildingIdentifier = "BUILDING_ID"
@@ -123,8 +133,9 @@ cordova.plugins.Situm.startPositioning(locationOptions, (res: any) => {
123
133
  #### - stopPositioning
124
134
 
125
135
  Stop the positioning system on current active listener.
136
+
126
137
  ```js
127
- cordova.plugins.Situm.stopPositioning()
138
+ cordova.plugins.Situm.stopPositioning();
128
139
  ```
129
140
 
130
141
  #### - fetchBuildings
@@ -132,23 +143,30 @@ cordova.plugins.Situm.stopPositioning()
132
143
  Download all the buildings for the current user.Returns an array of [buildings](https://developers.situm.com/sdk_documentation/cordova/jsdoc/latest/global.html#Building)
133
144
 
134
145
  ```js
135
- cordova.plugins.Situm.fetchBuildings((res: any) => {
136
- // Return an array of buildings
137
- }, (err: any) => {
138
- // returns error string
139
- });
146
+ cordova.plugins.Situm.fetchBuildings(
147
+ (res: any) => {
148
+ // Return an array of buildings
149
+ },
150
+ (err: any) => {
151
+ // returns error string
152
+ }
153
+ );
140
154
  ```
141
155
 
142
- ### - fetchBuildingInfo
156
+ #### - fetchBuildingInfo
143
157
 
144
158
  Download the information (floors, pois, ...) [of a building](https://developers.situm.com/sdk_documentation/cordova/jsdoc/latest/global.html#BuildingInfo)
145
159
 
146
160
  ```js
147
- cordova.plugins.Situm.fetchBuildingInfo(building,(res: any) => {
148
- // Return the buildingInfo
149
- }, (err: any) => {
150
- // returns error string
151
- });
161
+ cordova.plugins.Situm.fetchBuildingInfo(
162
+ building,
163
+ (res: any) => {
164
+ // Return the buildingInfo
165
+ },
166
+ (err: any) => {
167
+ // returns error string
168
+ }
169
+ );
152
170
  ```
153
171
 
154
172
  #### - fetchFloorsFromBuilding
@@ -156,11 +174,15 @@ cordova.plugins.Situm.fetchBuildingInfo(building,(res: any) => {
156
174
  Download all the [floors](https://developers.situm.com/sdk_documentation/cordova/jsdoc/latest/global.html#Floor) of a building.
157
175
 
158
176
  ```js
159
- cordova.plugins.Situm.fetchFloorsFromBuilding(building,(res: any) => {
160
- // Return an array of floors
161
- }, (err: any) => {
162
- // returns error string
163
- });
177
+ cordova.plugins.Situm.fetchFloorsFromBuilding(
178
+ building,
179
+ (res: any) => {
180
+ // Return an array of floors
181
+ },
182
+ (err: any) => {
183
+ // returns error string
184
+ }
185
+ );
164
186
  ```
165
187
 
166
188
  #### - fetchIndoorPOIsFromBuilding
@@ -168,11 +190,15 @@ cordova.plugins.Situm.fetchFloorsFromBuilding(building,(res: any) => {
168
190
  Download the indoor [POIs](https://developers.situm.com/sdk_documentation/cordova/jsdoc/latest/global.html#POI) of a building.
169
191
 
170
192
  ```js
171
- cordova.plugins.Situm.fetchIndoorPOIsFromBuilding(building,(res: any) => {
172
- // Return an array of indoor POIs
173
- }, (err: any) => {
174
- // returns error string
175
- });
193
+ cordova.plugins.Situm.fetchIndoorPOIsFromBuilding(
194
+ building,
195
+ (res: any) => {
196
+ // Return an array of indoor POIs
197
+ },
198
+ (err: any) => {
199
+ // returns error string
200
+ }
201
+ );
176
202
  ```
177
203
 
178
204
  #### - fetchOutdoorPOIsFromBuilding
@@ -180,11 +206,15 @@ cordova.plugins.Situm.fetchIndoorPOIsFromBuilding(building,(res: any) => {
180
206
  Download the outdoor [POIs](https://developers.situm.com/sdk_documentation/cordova/jsdoc/latest/global.html#POI) of a building.
181
207
 
182
208
  ```js
183
- cordova.plugins.Situm.fetchOutdoorPOIsFromBuilding(building,(res: any) => {
184
- // Return an array of outdoor POIs
185
- }, (err: any) => {
186
- // returns error string
187
- });
209
+ cordova.plugins.Situm.fetchOutdoorPOIsFromBuilding(
210
+ building,
211
+ (res: any) => {
212
+ // Return an array of outdoor POIs
213
+ },
214
+ (err: any) => {
215
+ // returns error string
216
+ }
217
+ );
188
218
  ```
189
219
 
190
220
  #### - fetchEventsFromBuilding
@@ -192,22 +222,30 @@ cordova.plugins.Situm.fetchOutdoorPOIsFromBuilding(building,(res: any) => {
192
222
  Download the [events](https://developers.situm.com/sdk_documentation/cordova/jsdoc/latest/global.html#SitumEvent) of a building.
193
223
 
194
224
  ```js
195
- cordova.plugins.Situm.fetchEventsFromBuilding(building,(res: any) => {
196
- // Return an array of events
197
- }, (err: any) => {
198
- // returns error string
199
- });
225
+ cordova.plugins.Situm.fetchEventsFromBuilding(
226
+ building,
227
+ (res: any) => {
228
+ // Return an array of events
229
+ },
230
+ (err: any) => {
231
+ // returns error string
232
+ }
233
+ );
200
234
  ```
235
+
201
236
  #### - fetchPoiCategories
202
237
 
203
238
  Get all [POI Categories](https://developers.situm.com/sdk_documentation/cordova/jsdoc/latest/global.html#PoiCategory), download and cache their icons asynchronously.
204
239
 
205
240
  ```js
206
- cordova.plugins.Situm.fetchPoiCategories((res: any) => {
207
- // Return an array of POI categories
208
- }, (err: any) => {
209
- // returns error string
210
- });
241
+ cordova.plugins.Situm.fetchPoiCategories(
242
+ (res: any) => {
243
+ // Return an array of POI categories
244
+ },
245
+ (err: any) => {
246
+ // returns error string
247
+ }
248
+ );
211
249
  ```
212
250
 
213
251
  #### - fetchMapFromFloor
@@ -215,11 +253,15 @@ cordova.plugins.Situm.fetchPoiCategories((res: any) => {
215
253
  Download the map image of a floor.
216
254
 
217
255
  ```js
218
- cordova.plugins.Situm.fetchMapFromFloor(floor, (res: any) => {
219
- // Return an image as an string encoded in Base64
220
- }, (err: any) => {
221
- // returns error string
222
- });
256
+ cordova.plugins.Situm.fetchMapFromFloor(
257
+ floor,
258
+ (res: any) => {
259
+ // Return an image as an string encoded in Base64
260
+ },
261
+ (err: any) => {
262
+ // returns error string
263
+ }
264
+ );
223
265
  ```
224
266
 
225
267
  #### - fetchPoiCategoryIconNormal
@@ -227,38 +269,49 @@ cordova.plugins.Situm.fetchMapFromFloor(floor, (res: any) => {
227
269
  Get the normal category icon for a POICategory.
228
270
 
229
271
  ```js
230
- cordova.plugins.Situm.fetchPoiCategoryIconNormal(category, (res: any) => {
231
- // Return an image as an string encoded in Base64
232
- }, (err: any) => {
233
- // returns error string
234
- });
235
- ```
272
+ cordova.plugins.Situm.fetchPoiCategoryIconNormal(
273
+ category,
274
+ (res: any) => {
275
+ // Return an image as an string encoded in Base64
276
+ },
277
+ (err: any) => {
278
+ // returns error string
279
+ }
280
+ );
281
+ ```
236
282
 
237
283
  #### - fetchPoiCategoryIconSelected
238
284
 
239
285
  Get the selected category icon for a POICategory.
240
286
 
241
287
  ```js
242
- cordova.plugins.Situm.fetchPoiCategoryIconSelected(category, (res: any) => {
243
- // Return an image as an string encoded in Base64
244
- }, (err: any) => {
245
- // returns error string
246
- });
247
- ```
288
+ cordova.plugins.Situm.fetchPoiCategoryIconSelected(
289
+ category,
290
+ (res: any) => {
291
+ // Return an image as an string encoded in Base64
292
+ },
293
+ (err: any) => {
294
+ // returns error string
295
+ }
296
+ );
297
+ ```
248
298
 
249
- #### - fetchGeofencesFromBuilding
299
+ #### - fetchGeofencesFromBuilding
250
300
 
251
301
  Get all [geofences](https://developers.situm.com/sdk_documentation/cordova/jsdoc/latest/global.html#Geofence) from the building.
252
302
 
253
303
  ```js
254
- cordova.plugins.Situm.fetchGeofencesFromBuilding(building, (res: any) => {
255
- // Return an array of geofences
256
- }, (err: any) => {
257
- // returns error string
258
- });
304
+ cordova.plugins.Situm.fetchGeofencesFromBuilding(
305
+ building,
306
+ (res: any) => {
307
+ // Return an array of geofences
308
+ },
309
+ (err: any) => {
310
+ // returns error string
311
+ }
312
+ );
259
313
  ```
260
314
 
261
-
262
315
  #### - invalidateCache
263
316
 
264
317
  Invalidate all the resources in the cache.
@@ -272,21 +325,24 @@ cordova.plugins.Situm.invalidateCache();
272
325
  Calculates a route between two points. This route is the one that will be used when you call requestNavigationUpdates. If this method is called multiple times the last Route will be used.
273
326
  You can change the options to generate the Route with [DirectionOptions](https://developers.situm.com/sdk_documentation/cordova/jsdoc/latest/global.html#DirectionsOptions)
274
327
  Returns a [Route](https://developers.situm.com/sdk_documentation/cordova/jsdoc/latest/global.html#Route)
328
+
275
329
  ```js
276
330
  directionRequest = [
277
331
  building, // Building in which you're positioning
278
332
  from, // Point where you want to start the route. You can pass a Point or a Location
279
333
  to, // Point where you want to finish the route
280
- {} // Options to generate the route
281
- ]
282
-
334
+ {}, // Options to generate the route
335
+ ];
283
336
 
284
337
  cordova.plugins.Situm.requestDirections(
285
- directionsRequest, (route: any) => {
286
- //Return a Route
287
- }, (err: any) => {
288
- // returns error string
289
- });
338
+ directionsRequest,
339
+ (route: any) => {
340
+ //Return a Route
341
+ },
342
+ (err: any) => {
343
+ // returns error string
344
+ }
345
+ );
290
346
  ```
291
347
 
292
348
  #### - requestNavigationUpdates
@@ -297,31 +353,32 @@ When you start feeding locations you can receive [NavigationProgress](https://de
297
353
  ```js
298
354
  // Navigation request with example values
299
355
  navigationRequest = [
300
- distanceToGoalThreshold = 10,
301
- distanceToFloorChangeThreshold = 5
302
- ]
356
+ (distanceToGoalThreshold = 10),
357
+ (distanceToFloorChangeThreshold = 5),
358
+ ];
303
359
  cordova.plugins.Situm.requestNavigationUpdates(
304
360
  navigationRequest,
305
- (navigation: any) => {
306
- /**
307
- * This callback can return four different things:
308
- * 1. A message notifying about the success starting the navigation
309
- * 2. A json with the NavigationProgress. The Json will also have a field "type" with the value "progress" so you can know when this happens.
310
- * 3. A json with the field "type" and the value "destinationReached". This happens when the navigation finish because you reached the end.
311
- * 4. A json with the field "type" and the value "userOutsideRoute". This happens when the user deviate from the route. You can notify them so they return to the correct path.
312
- */
313
- },
314
- (error: any) => {
315
- //returns error string
316
- });
361
+ (navigation: any) => {
362
+ /**
363
+ * This callback can return four different things:
364
+ * 1. A message notifying about the success starting the navigation
365
+ * 2. A json with the NavigationProgress. The Json will also have a field "type" with the value "progress" so you can know when this happens.
366
+ * 3. A json with the field "type" and the value "destinationReached". This happens when the navigation finish because you reached the end.
367
+ * 4. A json with the field "type" and the value "userOutsideRoute". This happens when the user deviate from the route. You can notify them so they return to the correct path.
368
+ */
369
+ },
370
+ (error: any) => {
371
+ //returns error string
372
+ }
373
+ );
317
374
  ```
318
375
 
319
376
  #### - updateNavigationWithLocation
320
-
377
+
321
378
  Usually, position variable should be one of the locations provided by the system on the [startPositioning](#--startpositioning) function.
322
379
 
323
380
  ```js
324
- cordova.plugins.Situm.updateNavigationWithLocation(currentLocation)
381
+ cordova.plugins.Situm.updateNavigationWithLocation(currentLocation);
325
382
  ```
326
383
 
327
384
  #### - removeNavigationUpdates
@@ -334,22 +391,22 @@ cordova.plugins.Situm.removeNavigationUpdates();
334
391
 
335
392
  #### - requestRealTimeUpdates
336
393
 
337
- Emits the [real time](https://developers.situm.com/sdk_documentation/cordova/jsdoc/latest/global.html#RealTimeData) location of devices
394
+ Emits the [real time](https://developers.situm.com/sdk_documentation/cordova/jsdoc/latest/global.html#RealTimeData) location of devices
338
395
 
339
396
  ```js
340
397
  const request = {
341
- building: building, //Building in which you want to be notified
342
- pollTime: 3000, // time in milliseconds
343
- }
398
+ building: building, //Building in which you want to be notified
399
+ pollTime: 3000, // time in milliseconds
400
+ };
344
401
  cordova.plugins.Situm.SitumPlugin.requestRealTimeUpdates(
345
402
  request,
346
- (locations: any) => {
347
- // returns the locations of the other devices in real time
348
- },
349
- (error: any) => {
350
- // returns error string
351
- }
352
- );
403
+ (locations: any) => {
404
+ // returns the locations of the other devices in real time
405
+ },
406
+ (error: any) => {
407
+ // returns error string
408
+ }
409
+ );
353
410
  ```
354
411
 
355
412
  #### - removeRealTimeUpdates
@@ -379,6 +436,7 @@ cordova.plugins.Situm.onEnterGeofences((geofences: any) => {
379
436
  #### - onExitGeofences
380
437
 
381
438
  Get notified about exiting geofences. Take into account the considerations described at [onEnterGeofences](#--onEnterGeofences).
439
+
382
440
  - This callback will return an array of [geofences](https://developers.situm.com/sdk_documentation/cordova/jsdoc/latest/global.html#Geofence)
383
441
 
384
442
  ```js
@@ -388,6 +446,96 @@ cordova.plugins.Situm.onExitGeofences((geofences: any) => {
388
446
  });
389
447
  ```
390
448
 
449
+ ### MapView class
450
+
451
+ #### - onLoad
452
+
453
+ Get notified about the \<map-view\> HTMLElement component being loaded.
454
+
455
+ - This callback will return the controller of MapView, [MapViewController](https://developers.situm.com/sdk_documentation/cordova/jsdoc/latest/mapviewcontrollerimpl), to start managing the map-view as you may want.
456
+
457
+ ```js
458
+ cordova.plugins.MapView.onLoad((controller: any) => {
459
+ // Once the MapView was loaded you can start managing our map by:
460
+
461
+ // 1. Sending actions like selecting or navigating to a poi in a building:
462
+ // controller.selectPoi('YOUR_POI_IDENTIFIER');
463
+ // controller.navigateToPoi('YOUR_POI_IDENTIFIER');
464
+
465
+ // 2. Listen to events that take place inside our map like a poi being selected or deselected:
466
+ controller.onPoiSelected((poiSelectedResult: any) => {
467
+ console.log("EXAMPLE> onPoiSelected -> ", poiSelectedResult);
468
+ });
469
+
470
+ controller.onPoiDeselected((poiDeselectedResult: any) => {
471
+ console.log("EXAMPLE> onPoiDeselected -> ", poiDeselectedResult);
472
+ });
473
+ });
474
+ ```
475
+
476
+ ### MapViewController class
477
+
478
+ #### - selectPoi
479
+
480
+ Select a POI in the map.
481
+
482
+ - You can find out what identifier has a certain POI of your building by previously retrieving them with [**cordova.plugins.Situm.fetchIndoorPOIsFromBuilding()**](#--fetchIndoorPOIsFromBuilding)
483
+
484
+ ```js
485
+ cordova.plugins.MapView.onLoad((controller: any) => {
486
+ // Once the MapView was loaded you can select a POI in our map by calling:
487
+ controller.selectPoi("YOUR_POI_IDENTIFIER");
488
+ });
489
+ ```
490
+
491
+ #### - navigateToPoi
492
+
493
+ Navigate to a POI in the map when positioning indoors inside a building.
494
+
495
+ - You can also specify the route you want to calculate by specifying the accessibilityMode parameter. See the different [accessibility modes](https://developers.situm.com/sdk_documentation/cordova/jsdoc/latest/mapviewcontrollerimpl#navigateToPoi) you can choose.
496
+
497
+ ```js
498
+ cordova.plugins.MapView.onLoad((controller: any) => {
499
+ // Once the MapView was loaded you can navigate to a POI in our map.
500
+ // Make sure to call this method once the user is positioning indoors in your building,
501
+ // otherwise this method will have no effect.
502
+ controller.navigateToPoi("YOUR_POI_IDENTIFIER");
503
+
504
+ // controller.navigateToPoi("YOUR_POI_IDENTIFIER", "CHOOSE_SHORTEST");
505
+ });
506
+ ```
507
+
508
+ #### - onPoiSelected
509
+
510
+ Listen to the selection event of a POI.
511
+
512
+ - This method will be called when some POI is selected, either by the user clicking a POI inside the MapView or by calling [controller.selectPoi()](#--selectPoi).
513
+ - This callbacks returns a [PoiSelectedResult](https://developers.situm.com/sdk_documentation/cordova/jsdoc/latest/global#PoiSelectedResult).
514
+
515
+ ```js
516
+ cordova.plugins.MapView.onLoad((controller: any) => {
517
+ // Once the MapView was loaded you can listen to a POI being selected.
518
+ controller.onPoiSelected((poiSelectedResult: any) => {
519
+ console.log("EXAMPLE> onPoiSelected -> ", poiSelectedResult);
520
+ });
521
+ });
522
+ ```
523
+
524
+ #### - onPoiSelected
525
+
526
+ Listen to listen to a POI being deselected.
527
+
528
+ - This callbacks returns a [PoiDeselectedResult](https://developers.situm.com/sdk_documentation/cordova/jsdoc/latest/global#PoiDeselectedResult).
529
+
530
+ ```js
531
+ cordova.plugins.MapView.onLoad((controller: any) => {
532
+ // Once the MapView was loaded you can listen to a POI being deselected.
533
+ controller.onPoiDeselected((poiDeselectedResult: any) => {
534
+ console.log("EXAMPLE> onPoiDeselected -> ", poiDeselectedResult);
535
+ });
536
+ });
537
+ ```
538
+
391
539
  ---
392
540
 
393
541
  ## Development
@@ -395,56 +543,59 @@ cordova.plugins.Situm.onExitGeofences((geofences: any) => {
395
543
  ### Run javascript tests
396
544
 
397
545
  1. Install mocha and expect.js:
398
-
546
+
399
547
  ```javascript
400
548
  npm install mocha --save
401
549
  npm install expect.js --save
402
550
  ```
403
-
404
- 2. In js tests folder run:
405
-
406
- ```javascript
407
- mocha test
408
- ```
409
551
 
410
- #### Dependencies
552
+ 2. In js tests folder run:
411
553
 
412
- - [mocha](https://www.npmjs.com/package/mocha), needed to run tests.
413
- - [expect.js](https://www.npmjs.com/package/expect.js), needed to do assertions.
554
+ ```javascript
555
+ mocha test
556
+ ```
414
557
 
558
+ #### Dependencies
415
559
 
560
+ - [mocha](https://www.npmjs.com/package/mocha), needed to run tests.
561
+ - [expect.js](https://www.npmjs.com/package/expect.js), needed to do assertions.
416
562
 
417
563
  ### Note for Android platform
418
564
 
419
565
  Situm SDK for Android now compiles and targets sdkVersion 31 (Android 12). To work properly on Android 12 devices and above, the host app must:
420
- * Target android api 31 or above. In your project `config.xml` file, add `<preference name="android-targetSdkVersion" value="31" />` to the Android platform configuration.
421
- * Request the runtime permissions `ACCESS_COARSE_LOCATION`, `BLUETOOTH_SCAN` and `BLUETOOTH_CONNECT` (plus `ACCESS_FINE_LOCATION` if you are using [Global Mode](https://situm.com/docs/how-does-situm-work/#5-toc-title)). Remember to also add them to the Android platform section of your `config.xml` file:
422
- ```xml
423
- <config-file parent="/manifest" target="AndroidManifest.xml">
424
- <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
425
- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <!-- In Global mode -->
426
- <uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
427
- <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
428
- </config-file>
429
- ```
430
- * Add `android:exported="true"` to all the intent-filtered components of your `AndroidManifest.xml` file. You can add the following configuration to your `config.xml` to automate this process:
431
- ```xml
432
- <edit-config
433
- file="app/src/main/AndroidManifest.xml"
434
- target="/manifest/application/activity[@android:name='MainActivity']"
435
- mode="merge">
436
- <activity android:exported="true"/>
437
- </edit-config>
438
- ```
439
- * Make sure the `widget` root element of your `config.xml` file declares the Android namespace:
440
- ```xml
441
- <widget id="..." version="..."
442
- ...
443
- xmlns:android="http://schemas.android.com/apk/res/android">
444
- ```
445
- * If you find problems, also make sure the Gradle JDK points to version 11 in your project configuration (recommended Android Studio embedded JDK).
446
566
 
567
+ - Target android api 31 or above. In your project `config.xml` file, add `<preference name="android-targetSdkVersion" value="31" />` to the Android platform configuration.
568
+ - Request the runtime permissions `ACCESS_COARSE_LOCATION`, `BLUETOOTH_SCAN` and `BLUETOOTH_CONNECT` (plus `ACCESS_FINE_LOCATION` if you are using [Global Mode](https://situm.com/docs/how-does-situm-work/#5-toc-title)). Remember to also add them to the Android platform section of your `config.xml` file:
569
+
570
+ ```xml
571
+ <config-file parent="/manifest" target="AndroidManifest.xml">
572
+ <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
573
+ <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
574
+ <uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
575
+ <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
576
+ </config-file>
577
+ ```
578
+
579
+ - Add `android:exported="true"` to all the intent-filtered components of your `AndroidManifest.xml` file. You can add the following configuration to your `config.xml` to automate this process:
580
+
581
+ ```xml
582
+ <edit-config
583
+ file="app/src/main/AndroidManifest.xml"
584
+ target="/manifest/application/activity[@android:name='MainActivity']"
585
+ mode="merge">
586
+ <activity android:exported="true"/>
587
+ </edit-config>
588
+ ```
447
589
 
590
+ - Make sure the `widget` root element of your `config.xml` file declares the Android namespace:
591
+
592
+ ```xml
593
+ <widget id="..." version="..."
594
+ ...
595
+ xmlns:android="http://schemas.android.com/apk/res/android">
596
+ ```
597
+
598
+ - If you find problems, also make sure the Gradle JDK points to version 11 in your project configuration (recommended Android Studio embedded JDK).
448
599
 
449
600
  ### Capacitor compatibility
450
601
 
@@ -453,20 +604,19 @@ This plugin is compatible with Capacitor 3.0.
453
604
  **Issue**: In iOS, there is a known issue with capacitor-cli 3.2.5 and static cordova plugins https://github.com/ionic-team/capacitor/issues/5142. To solve it use a different version of capacitor cli.
454
605
 
455
606
  If the problem persists, add this plugin to the `staticPlugins` section of your `capacitor.config.json` file:
607
+
456
608
  ```json
457
609
  {
458
- "cordova": {
459
- "staticPlugins": [
460
- "@situm/cordova"
461
- ]
462
- }
610
+ "cordova": {
611
+ "staticPlugins": ["@situm/cordova"]
612
+ }
463
613
  }
464
614
  ```
465
615
 
466
-
467
616
  ## More information
468
617
 
469
618
  More info is available at our [Developers Page](https://situm.com/docs/01-introduction/).
470
619
 
471
620
  ## Support information
621
+
472
622
  For any question or bug report, please send an email to [support@situm.es](mailto:support@situm.es)