@woosmap/react-native-plugin-geofencing 0.1.12 → 0.1.15
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.
- package/CHANGELOG.md +8 -0
- package/README.md +7 -531
- package/android/build/.transforms/{c65e342499bb803c6988b2f7d806c473 → aa385bad2a83168414a07acde96b788d}/results.bin +0 -0
- package/android/build/.transforms/{c65e342499bb803c6988b2f7d806c473 → aa385bad2a83168414a07acde96b788d}/transformed/classes/classes.dex +0 -0
- package/android/build/intermediates/compile_library_classes_jar/debug/classes.jar +0 -0
- package/android/build/intermediates/incremental/packageDebugResources/compile-file-map.properties +1 -1
- package/android/build/intermediates/javac/debug/classes/com/reactnativeplugingeofencing/WoosmapUtil.class +0 -0
- package/android/build/intermediates/runtime_library_classes_jar/debug/classes.jar +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/android/src/main/java/com/reactnativeplugingeofencing/WoosmapUtil.java +1 -0
- package/ios/PluginGeofencing.swift +1 -0
- package/lib/commonjs/internal/Region.js +7 -3
- package/lib/commonjs/internal/Region.js.map +1 -1
- package/lib/module/internal/Region.js +7 -3
- package/lib/module/internal/Region.js.map +1 -1
- package/lib/typescript/internal/Region.d.ts +4 -2
- package/src/internal/Region.tsx +8 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
### Latest
|
|
2
|
+
* Added a new field named `eventName` in the region callback
|
|
3
|
+
|
|
4
|
+
### 0.1.9
|
|
5
|
+
* #56 region create event triggers other than region log event removed in android. by @dippatra in https://github.com/Woosmap/geofencing-react-native-plugin/pull/58
|
|
6
|
+
|
|
7
|
+
### 0.1.8
|
|
8
|
+
* #53 POI identifier (idStore) is not returned in the Region object issue by @dippatra in https://github.com/Woosmap/geofencing-react-native-plugin/pull/54
|
package/README.md
CHANGED
|
@@ -1,539 +1,15 @@
|
|
|
1
1
|

|
|
2
2
|
|
|
3
|
-
#
|
|
3
|
+
# Woosmap Geofencing React Native Plugin
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
### SDKs to help developers collecting users’ locations in the right way.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
The Woosmap Geofencing SDK is a mobile cross-platform software development kit focused on gathering efficiently the users’ location, triggering events based on region monitoring, and providing categorized users’ zone of interest from geographical and temporal clusters.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
npm install @woosmap/react-native-plugin-geofencing
|
|
11
|
-
```
|
|
9
|
+
The SDK simplifies the integration of the location context in your mobile application by taking care of lower-level functionalities such as data collection or battery management.
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
### Documentation
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
All feature descriptions and guides to implement the Woosmap Geofencing Android & iOS SDK are available on the [Woosmap developers documentation](https://developers.woosmap.com/products/geofencing-sdk/get-started/).
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
- NSLocationAlwaysAndWhenInUseUsageDescription
|
|
19
|
-
- NSLocationAlwaysUsageDescription
|
|
20
|
-
- NSLocationWhenInUseUsageDescription
|
|
21
|
-
- UIBackgroundModes
|
|
22
|
-
|
|
23
|
-
```
|
|
24
|
-
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
|
|
25
|
-
<string>Used to test the library</string>
|
|
26
|
-
<key>NSLocationAlwaysUsageDescription</key>
|
|
27
|
-
<string>Used to test the library</string>
|
|
28
|
-
<key>NSLocationWhenInUseUsageDescription</key>
|
|
29
|
-
<string>Used to test the library</string>
|
|
30
|
-
<key>UIBackgroundModes</key>
|
|
31
|
-
<array>
|
|
32
|
-
<string>location</string>
|
|
33
|
-
</array>
|
|
34
|
-
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
- **Podfile**: configure to use ```use_frameworks!``` and ```platform :ios, '12.0'```
|
|
38
|
-
if you are using **M1 Mac** Update pod post installation like
|
|
39
|
-
|
|
40
|
-
```
|
|
41
|
-
post_install do |installer|
|
|
42
|
-
installer.pods_project.targets.each do |target|
|
|
43
|
-
target.build_configurations.each do |config|
|
|
44
|
-
config.build_settings["ONLY_ACTIVE_ARCH"] = "NO"
|
|
45
|
-
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
### Supported Platforms ###
|
|
52
|
-
|
|
53
|
-
---
|
|
54
|
-
|
|
55
|
-
- iOS
|
|
56
|
-
- Android
|
|
57
|
-
|
|
58
|
-
### Modules
|
|
59
|
-
|
|
60
|
-
---
|
|
61
|
-
- **WoosmapGeofencing**: Woosmap contains methods to monitor location, regions.
|
|
62
|
-
|
|
63
|
-
### Objects(Read Only)
|
|
64
|
-
|
|
65
|
-
---
|
|
66
|
-
- **Location**: Represents the location object
|
|
67
|
-
- **POI**: Represents Point of Interest
|
|
68
|
-
- **Region**: Represents a geographical region/geofence
|
|
69
|
-
- **Visit**: Represents a visit to a location/POI
|
|
70
|
-
- **ZOI**: Represents Zone of Interest
|
|
71
|
-
- **Airship**: Contains custom data related to Airship implementation
|
|
72
|
-
- **MarketingCloud**: Contains custom data related to third party marketing cloud implementation
|
|
73
|
-
|
|
74
|
-
## Usage
|
|
75
|
-
|
|
76
|
-
``` javascript
|
|
77
|
-
import WoosmapGeofencing from 'react-native-plugin-geofencing';
|
|
78
|
-
|
|
79
|
-
// ...
|
|
80
|
-
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
### Check and request permissions
|
|
84
|
-
|
|
85
|
-
---
|
|
86
|
-
Before initializing the SDK it is required that you request for required location permissions.
|
|
87
|
-
|
|
88
|
-
To check if the location permissions are granted by the user call `getPermissionsStatus` method.
|
|
89
|
-
|
|
90
|
-
``` javascript
|
|
91
|
-
WoosmapGeofencing.getPermissionsStatus()
|
|
92
|
-
.then((status: string) => {
|
|
93
|
-
console.log(status);
|
|
94
|
-
})
|
|
95
|
-
.catch((error: any) => {
|
|
96
|
-
alert('message: ' + error.message);
|
|
97
|
-
});
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
Parameter status will be a string, one of:
|
|
101
|
-
- `GRANTED_BACKGROUND` : User has granted location access even when app is not running in the foreground.
|
|
102
|
-
- `GRANTED_FOREGROUND` : Location access is granted only while user is using the app.
|
|
103
|
-
- `DENIED`: Location access is denied.
|
|
104
|
-
- `UNKNOWN`: Without providing or denying any permission then it will return unknown.
|
|
105
|
-
|
|
106
|
-
**_Please note_**: Plugin will not work as expected if location access is denied.
|
|
107
|
-
|
|
108
|
-
**Requesting location access**
|
|
109
|
-
To request location access call `requestPermissions` method of the plugin. This will result in displaying location access permission dialog. This method accepts a boolean parameter `isBackground`. If this parameter is set to true, then plugin will ask for background location access. Code snippet below asks for background location access.
|
|
110
|
-
|
|
111
|
-
``` javascript
|
|
112
|
-
WoosmapGeofencing.requestPermissions(props.background)
|
|
113
|
-
.then((status: string) => {
|
|
114
|
-
console.log(status);
|
|
115
|
-
})
|
|
116
|
-
.catch((error: any) => {
|
|
117
|
-
alert('message: ' + error.message);
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
### Initializing the plugin
|
|
123
|
-
|
|
124
|
-
---
|
|
125
|
-
|
|
126
|
-
Plugin can be initialized by simply calling `initialize` method.
|
|
127
|
-
|
|
128
|
-
``` javascript
|
|
129
|
-
var woosmapSettings = {
|
|
130
|
-
privateKeyWoosmapAPI: "<<WOOSMAP_KEY>>",
|
|
131
|
-
trackingProfile: "liveTracking"
|
|
132
|
-
};
|
|
133
|
-
WoosmapGeofencing.initialize(woosmapSettings)
|
|
134
|
-
.then((value: string) => {
|
|
135
|
-
console.log(value);
|
|
136
|
-
})
|
|
137
|
-
.catch((error: any) => {
|
|
138
|
-
alert('message: ' + error.message);
|
|
139
|
-
});
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
Both configuration options `privateKeyWoosmapAPI` and `trackingProfile` are optional. You can also initialize the plugin by passing null configuration.
|
|
143
|
-
|
|
144
|
-
```
|
|
145
|
-
await WoosmapGeofencing.initialize();
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
You can also set the Woosmap API key later by calling `setWoosmapApiKey` method.
|
|
149
|
-
|
|
150
|
-
``` javascript
|
|
151
|
-
WoosmapGeofencing.setWoosmapApiKey(<privateKeyWoosmapAPI>)
|
|
152
|
-
.then((value: string) => {
|
|
153
|
-
console.log(value);
|
|
154
|
-
})
|
|
155
|
-
.catch((error: any) => {
|
|
156
|
-
alert('message: ' + error.message);
|
|
157
|
-
});
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
### Tracking
|
|
161
|
-
|
|
162
|
-
---
|
|
163
|
-
|
|
164
|
-
Once you have initialized the plugin and the user has authorized location permissions, you can start tracking the user’s location.
|
|
165
|
-
|
|
166
|
-
To start tracking, call:
|
|
167
|
-
|
|
168
|
-
``` javascript
|
|
169
|
-
WoosmapGeofencing.startTracking('liveTracking')
|
|
170
|
-
.then((result: string) => {
|
|
171
|
-
console.log(value);
|
|
172
|
-
})
|
|
173
|
-
.catch((error: any) => {
|
|
174
|
-
alert('message: ' + error.message);
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
To stop tracking, call:
|
|
180
|
-
|
|
181
|
-
``` javascript
|
|
182
|
-
WoosmapGeofencing.stopTracking()
|
|
183
|
-
.then((value: any) => {
|
|
184
|
-
console.log(value);
|
|
185
|
-
})
|
|
186
|
-
.catch((error: any) => {
|
|
187
|
-
alert('message: ' + error.message);
|
|
188
|
-
});
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
Method `startTracking` accepts only following tracking profiles
|
|
192
|
-
|
|
193
|
-
- **liveTracking**
|
|
194
|
-
- **passiveTracking**
|
|
195
|
-
- **visitsTracking**
|
|
196
|
-
|
|
197
|
-
### Tracking profile properties
|
|
198
|
-
|
|
199
|
-
---
|
|
200
|
-
|
|
201
|
-
| Property | liveTracking | passiveTracking | visitsTracking
|
|
202
|
-
| ----------- | ----------- | ----------- | ----------- |
|
|
203
|
-
| trackingEnable | true | true | true
|
|
204
|
-
| foregroundLocationServiceEnable | true | false | false
|
|
205
|
-
| modeHighFrequencyLocation | true | false | false
|
|
206
|
-
| visitEnable | false | false | true
|
|
207
|
-
| classificationEnable | false | false | true
|
|
208
|
-
| minDurationVisitDisplay | null | null | 300
|
|
209
|
-
| radiusDetectionClassifiedZOI | null | null | 50
|
|
210
|
-
| distanceDetectionThresholdVisits | null | null | 25
|
|
211
|
-
| currentLocationTimeFilter | 0 | 0 | 0
|
|
212
|
-
| currentLocationDistanceFilter | 0 | 0 | 0
|
|
213
|
-
| accuracyFilter | 100 | 100 | 100
|
|
214
|
-
| searchAPIEnable | false | true | false
|
|
215
|
-
| searchAPICreationRegionEnable | false | true | false
|
|
216
|
-
| searchAPITimeFilter | 0 | 0 | 0
|
|
217
|
-
| searchAPIDistanceFilter | 0 | 0 | 0
|
|
218
|
-
| distanceAPIEnable | false | false | false
|
|
219
|
-
| modeDistance | null | null | null
|
|
220
|
-
| outOfTimeDelay | 300 | 300 | 300
|
|
221
|
-
| DOUBLEOfDayDataDuration | 30 | 30 | 30
|
|
222
|
-
|
|
223
|
-
### Listening to events
|
|
224
|
-
|
|
225
|
-
---
|
|
226
|
-
|
|
227
|
-
**Location**
|
|
228
|
-
|
|
229
|
-
To listen to location, call `watchLocation` method. Method will invoke callback and pass a location object as a parameter. Method will return a watchId . This id can be used to remove a callback.
|
|
230
|
-
|
|
231
|
-
``` javascript
|
|
232
|
-
const callback = (value: Location) => {
|
|
233
|
-
alert('message: ' + JSON.stringify(value));
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
WoosmapGeofencing.watchLocation(callback)
|
|
237
|
-
.then((watchRef: string) => {
|
|
238
|
-
//Keep watchRef, it requires when you wish to remove location watch.
|
|
239
|
-
console.log('Watch added');
|
|
240
|
-
})
|
|
241
|
-
.catch((error: any) => {
|
|
242
|
-
alert('message: ' + error.message);
|
|
243
|
-
});
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
To stop getting location updates:
|
|
247
|
-
|
|
248
|
-
``` javascript
|
|
249
|
-
WoosmapGeofencing.clearLocationWatch(watchID)
|
|
250
|
-
.then((watchRef: string) => {
|
|
251
|
-
console.log(watchRef);
|
|
252
|
-
})
|
|
253
|
-
.catch((error: any) => {
|
|
254
|
-
alert('message: ' + error.message);
|
|
255
|
-
});
|
|
256
|
-
```
|
|
257
|
-
|
|
258
|
-
**Define the radius value**
|
|
259
|
-
|
|
260
|
-
When you create a Geofence around a POI (previously imported from Woosmap), manually define the radius value:
|
|
261
|
-
|
|
262
|
-
```javascript
|
|
263
|
-
WoosmapGeofencing.setPoiRadius("100")
|
|
264
|
-
.then((value: string) => {
|
|
265
|
-
console.log(value);
|
|
266
|
-
})
|
|
267
|
-
.catch((error: any) => {
|
|
268
|
-
alert('message: ' + error.message);
|
|
269
|
-
});
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
or choose the user_properties subfield that corresponds to radius value of the Geofence:
|
|
273
|
-
|
|
274
|
-
```javascript
|
|
275
|
-
WoosmapGeofencing.setPoiRadius("radiusPOI")
|
|
276
|
-
.then((value: string) => {
|
|
277
|
-
console.log(value);
|
|
278
|
-
})
|
|
279
|
-
.catch((error: any) => {
|
|
280
|
-
alert('message: ' + error.message);
|
|
281
|
-
});
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
**Regions**
|
|
285
|
-
|
|
286
|
-
Call `watchRegions` method to track Regions. Method will invoke a callback with Region object. Method will return a watch id which can be used later to remove the callback.
|
|
287
|
-
|
|
288
|
-
``` javascript
|
|
289
|
-
WoosmapGeofencing.watchRegions(callback)
|
|
290
|
-
.then((watchRef: string) => {
|
|
291
|
-
//Keep watchRef, it requires when you wish to remove region watch.
|
|
292
|
-
console.log('Watch added');
|
|
293
|
-
})
|
|
294
|
-
.catch((error: any) => {
|
|
295
|
-
alert('message: ' + error.message);
|
|
296
|
-
});
|
|
297
|
-
```
|
|
298
|
-
|
|
299
|
-
To remove watch:
|
|
300
|
-
|
|
301
|
-
``` javascript
|
|
302
|
-
WoosmapGeofencing.clearRegionsWatch(watchID)
|
|
303
|
-
.then((watchRef: string) => {
|
|
304
|
-
console.log(watchRef);
|
|
305
|
-
})
|
|
306
|
-
.catch((error: any) => {
|
|
307
|
-
alert('message: ' + error.message);
|
|
308
|
-
});
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
### Initialize Salesforce MarketingCloud Connector
|
|
312
|
-
|
|
313
|
-
---
|
|
314
|
-
|
|
315
|
-
The SDK needs some input like credentials and object key to perform the API call to Salesforce Marketing Cloud API.
|
|
316
|
-
|
|
317
|
-
**Input to initialize the SFMC connector**<br/>
|
|
318
|
-
|
|
319
|
-
| Parameters | Description | Required |
|
|
320
|
-
| -------------------------------------- | --------------------------------------------------------------------------------------------------------- | -------- |
|
|
321
|
-
| authenticationBaseURI | Authentication Base URI | Required |
|
|
322
|
-
| restBaseURI | REST Base URI | Required |
|
|
323
|
-
| client\_id | client\_id (journey\_read and list\_and\_subscribers\_read rights are required) | Required |
|
|
324
|
-
| client\_secret | client\_secret (journey\_read and list\_and\_subscribers\_read rights are required) | Required |
|
|
325
|
-
| contactKey | The ID that uniquely identifies a subscriber/contact | Required |
|
|
326
|
-
| regionEnteredEventDefinitionKey | Set the EventDefinitionKey that you want to use for the Woosmap event `woos_geofence_entered_event` | |
|
|
327
|
-
| regionExitedEventDefinitionKey | Set the EventDefinitionKey that you want to use for the Woosmap event `woos_geofence_exited_event` | |
|
|
328
|
-
| poiEventDefinitionKey | Set the EventDefinitionKey that you want to use for the Woosmap event `woos_POI_event` | |
|
|
329
|
-
| zoiClassifiedEnteredEventDefinitionKey | Set the EventDefinitionKey that you want to use for the Woosmap event `woos_zoi_classified_entered_event` | |
|
|
330
|
-
| zoiClassifiedExitedEventDefinitionKey | Set the EventDefinitionKey that you want to use for the Woosmap event `woos_zoi_classified_exited_event` | |
|
|
331
|
-
| visitEventDefinitionKey | Set the EventDefinitionKey that you want to use for the Woosmap event `woos_Visit_event` |
|
|
332
|
-
|
|
333
|
-
### Adding and removing regions
|
|
334
|
-
|
|
335
|
-
---
|
|
336
|
-
|
|
337
|
-
Call `addRegion` method to add a region that you want to monitor.
|
|
338
|
-
Region type can be 'circle' or 'isochrone' only.
|
|
339
|
-
Method will accept an object with the following attributes:
|
|
340
|
-
|
|
341
|
-
- **regionId** - Id of the region
|
|
342
|
-
- **lat** - Latitude
|
|
343
|
-
- **lng** - Longitude
|
|
344
|
-
- **radius** - Radius in meters
|
|
345
|
-
- **type** - type of region
|
|
346
|
-
|
|
347
|
-
##### Create a custom circle region
|
|
348
|
-
|
|
349
|
-
``` javascript
|
|
350
|
-
var regionData = {
|
|
351
|
-
lat: 51.50998,
|
|
352
|
-
lng: -0.1337,
|
|
353
|
-
regionId: '7F91369E-467C-4CBD-8D41-6509815C4780',
|
|
354
|
-
radius: 100,
|
|
355
|
-
type: 'circle',
|
|
356
|
-
};
|
|
357
|
-
WoosmapGeofencing.addRegion(regionData)
|
|
358
|
-
.then((value: string) => {
|
|
359
|
-
console.log(value);
|
|
360
|
-
})
|
|
361
|
-
.catch((error: any) => {
|
|
362
|
-
console.error(error);
|
|
363
|
-
});
|
|
364
|
-
};
|
|
365
|
-
```
|
|
366
|
-
|
|
367
|
-
##### Create a custom isochrone region
|
|
368
|
-
|
|
369
|
-
``` javascript
|
|
370
|
-
var regionData = {
|
|
371
|
-
lat: 51.50998,
|
|
372
|
-
lng: -0.1337,
|
|
373
|
-
regionId: '7F91369E-467C-4CBD-8D41-6509815C4780',
|
|
374
|
-
radius: 180,
|
|
375
|
-
type: 'isochrone',
|
|
376
|
-
};
|
|
377
|
-
WoosmapGeofencing.addRegion(regionData)
|
|
378
|
-
.then((value: string) => {
|
|
379
|
-
console.log(value);
|
|
380
|
-
})
|
|
381
|
-
.catch((error: any) => {
|
|
382
|
-
console.error(error);
|
|
383
|
-
});
|
|
384
|
-
};
|
|
385
|
-
```
|
|
386
|
-
|
|
387
|
-
Call ```removeRegions``` method to remove a region that you are monitoring. Method will accept the following parameter, and passing a null value will remove all the regions.
|
|
388
|
-
|
|
389
|
-
``` javascript
|
|
390
|
-
const request = "7F91369E-467C-4CBD-8D41-6509815C4780";
|
|
391
|
-
WoosmapGeofencing.removeRegions(request)
|
|
392
|
-
.then((value: string) => {
|
|
393
|
-
console.log(value);
|
|
394
|
-
})
|
|
395
|
-
.catch((error: any) => {
|
|
396
|
-
console.error(error);
|
|
397
|
-
});
|
|
398
|
-
```
|
|
399
|
-
|
|
400
|
-
Or To Delete all Regions
|
|
401
|
-
|
|
402
|
-
``` javascript
|
|
403
|
-
WoosmapGeofencing.removeRegions()
|
|
404
|
-
.then((value: string) => {
|
|
405
|
-
console.log(value);
|
|
406
|
-
})
|
|
407
|
-
.catch((error: any) => {
|
|
408
|
-
console.error(error);
|
|
409
|
-
});
|
|
410
|
-
```
|
|
411
|
-
|
|
412
|
-
### Local database operations
|
|
413
|
-
|
|
414
|
-
---
|
|
415
|
-
|
|
416
|
-
- **Get POIs**: Call `getPois` method to get an array of POIs from the local db
|
|
417
|
-
|
|
418
|
-
``` javascript
|
|
419
|
-
|
|
420
|
-
WoosmapGeofencing.getPois(optional locationid)
|
|
421
|
-
.then((value: Location[]) => {
|
|
422
|
-
console.log(String(value.length));
|
|
423
|
-
})
|
|
424
|
-
.catch((error: any) => {
|
|
425
|
-
console.error(error);
|
|
426
|
-
});
|
|
427
|
-
```
|
|
428
|
-
|
|
429
|
-
- **Delete POIs**: Call `removePois` method to clear all POIs from the local db.
|
|
430
|
-
|
|
431
|
-
``` javascript
|
|
432
|
-
WoosmapGeofencing.removePois()
|
|
433
|
-
.then((value: string) => {
|
|
434
|
-
console.log(value);
|
|
435
|
-
})
|
|
436
|
-
.catch((error: any) => {
|
|
437
|
-
console.error(error);
|
|
438
|
-
});
|
|
439
|
-
```
|
|
440
|
-
|
|
441
|
-
- **Get Locations**: Call `getLocations` method to get an array of Locations from the local db.
|
|
442
|
-
|
|
443
|
-
``` javascript
|
|
444
|
-
|
|
445
|
-
WoosmapGeofencing.getLocations(optional locationid)
|
|
446
|
-
.then((value: Location[]) => {
|
|
447
|
-
console.log(String(value.length));
|
|
448
|
-
})
|
|
449
|
-
.catch((error: any) => {
|
|
450
|
-
console.error(error);
|
|
451
|
-
});
|
|
452
|
-
```
|
|
453
|
-
|
|
454
|
-
- **Delete Locations**: Call `removeLocations` method to clear all Locations info from the local db.
|
|
455
|
-
|
|
456
|
-
``` javascript
|
|
457
|
-
WoosmapGeofencing.removeLocations()
|
|
458
|
-
.then((value: string) => {
|
|
459
|
-
console.log(value);
|
|
460
|
-
})
|
|
461
|
-
.catch((error: any) => {
|
|
462
|
-
console.error(error);
|
|
463
|
-
});
|
|
464
|
-
```
|
|
465
|
-
|
|
466
|
-
- **Get Regions**: Call `getRegions` method to get an array of Regions from the local db. specify region id to retrieve specific region info
|
|
467
|
-
|
|
468
|
-
``` javascript
|
|
469
|
-
WoosmapGeofencing.getRegions(optional regionid).
|
|
470
|
-
.then((value: Region[]) => {
|
|
471
|
-
Toast.show(String(value.length));
|
|
472
|
-
})
|
|
473
|
-
.catch((error: any) => {
|
|
474
|
-
console.error(error);
|
|
475
|
-
});
|
|
476
|
-
```
|
|
477
|
-
|
|
478
|
-
### Initialize the connector implementation
|
|
479
|
-
|
|
480
|
-
---
|
|
481
|
-
|
|
482
|
-
``` javascript
|
|
483
|
-
var sfmcCredentials = {
|
|
484
|
-
authenticationBaseURI: "https://xxxxxxxxxx.auth.marketingcloudapis.com",
|
|
485
|
-
restBaseURI: "https://xxxxxxxxxx.rest.marketingcloudapis.com",
|
|
486
|
-
client_id: "xxxxxxxxxxxxxxx",
|
|
487
|
-
client_secret: "xxxxxxxxxxxxxxx",
|
|
488
|
-
contactKey: "ID001",
|
|
489
|
-
regionEnteredEventDefinitionKey: "APIEvent-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
|
|
490
|
-
regionExitedEventDefinitionKey: "APIEvent-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
|
491
|
-
};
|
|
492
|
-
WoosmapGeofencing.setSFMCCredentials(sfmcCredentials)
|
|
493
|
-
.then((value: any) => {
|
|
494
|
-
console.log(value);
|
|
495
|
-
})
|
|
496
|
-
.catch((error: any) => {
|
|
497
|
-
alert('message: ' + error.message);
|
|
498
|
-
});
|
|
499
|
-
```
|
|
500
|
-
|
|
501
|
-
### Custom tracking profile
|
|
502
|
-
|
|
503
|
-
---
|
|
504
|
-
|
|
505
|
-
If preset tracking profiles don’t fit with your use cases, you can build your own profile and uses the startCustomTracking() method. There are two way to host the json file:
|
|
506
|
-
|
|
507
|
-
- Include json file in the client application (local) for ios.
|
|
508
|
-
- For local mode put json file in assets folder in android.
|
|
509
|
-
- Host externally in a file folder in your information system (external)
|
|
510
|
-
|
|
511
|
-
``` javascript
|
|
512
|
-
WoosmapGeofencing.startCustomTracking('local', 'localProfile.json')
|
|
513
|
-
.then((value: any) => {
|
|
514
|
-
console.log(value);
|
|
515
|
-
})
|
|
516
|
-
.catch((error: any) => {
|
|
517
|
-
alert('message: ' + error.message);
|
|
518
|
-
});
|
|
519
|
-
```
|
|
520
|
-
|
|
521
|
-
or
|
|
522
|
-
|
|
523
|
-
``` javascript
|
|
524
|
-
WoosmapGeofencing.startCustomTracking('external', 'https://raw.githubusercontent.com/lpernelle-wgs/files/master/customProfileLeo.json')
|
|
525
|
-
.then((value: any) => {
|
|
526
|
-
console.log(value);
|
|
527
|
-
})
|
|
528
|
-
.catch((error: any) => {
|
|
529
|
-
alert('message: ' + error.message);
|
|
530
|
-
});
|
|
531
|
-
```
|
|
532
|
-
|
|
533
|
-
#### Build a custom tracking profile
|
|
534
|
-
|
|
535
|
-
Define tracking properties in a Json file that respect the Json Schema in the [Tracking properties page](https://developers.woosmap.com/products/geofencing-sdk/tracking-profiles/tracking-properties/).
|
|
536
|
-
|
|
537
|
-
## License
|
|
538
|
-
|
|
539
|
-
MIT
|
|
15
|
+
If you are looking for the Woosmap Geofencing React Native plugin documentation, [we have a dedicated section for it](https://developers.woosmap.com/products/geofencing-sdk/react-native-plugin/guides/setup/).
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
package/android/build/intermediates/incremental/packageDebugResources/compile-file-map.properties
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
#
|
|
1
|
+
#Thu Aug 11 08:03:38 UTC 2022
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -962,6 +962,7 @@ class PluginGeofencing: RCTEventEmitter {
|
|
|
962
962
|
result["longitude"] = woosdata.longitude
|
|
963
963
|
result["radius"] = woosdata.radius
|
|
964
964
|
result["frompositiondetection"] = woosdata.fromPositionDetection
|
|
965
|
+
result["eventname"] = woosdata.eventName
|
|
965
966
|
return result
|
|
966
967
|
}
|
|
967
968
|
|
|
@@ -17,10 +17,11 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
17
17
|
* @param {number} latitude The latitude of the region.
|
|
18
18
|
* @param {number} longitude The longitude of the region.
|
|
19
19
|
* @param {number} radius The radius of the region in meters.
|
|
20
|
-
* @param {boolean} frompositiondetection Determines whether the user's
|
|
20
|
+
* @param {boolean} frompositiondetection Determines whether the user's current position is inside the region.
|
|
21
|
+
* @param {string} eventName Describe cause of region event, Entry or Exit.
|
|
21
22
|
*/
|
|
22
23
|
class Region {
|
|
23
|
-
constructor(date, didenter, identifier, latitude, longitude, radius, frompositiondetection) {
|
|
24
|
+
constructor(date, didenter, identifier, latitude, longitude, radius, frompositiondetection, eventname) {
|
|
24
25
|
_defineProperty(this, "Date", void 0);
|
|
25
26
|
|
|
26
27
|
_defineProperty(this, "Didenter", void 0);
|
|
@@ -35,6 +36,8 @@ class Region {
|
|
|
35
36
|
|
|
36
37
|
_defineProperty(this, "Frompositiondetection", void 0);
|
|
37
38
|
|
|
39
|
+
_defineProperty(this, "Eventname", void 0);
|
|
40
|
+
|
|
38
41
|
this.Date = date;
|
|
39
42
|
this.Didenter = didenter;
|
|
40
43
|
this.Identifier = identifier;
|
|
@@ -42,6 +45,7 @@ class Region {
|
|
|
42
45
|
this.Longitude = longitude;
|
|
43
46
|
this.Radius = radius;
|
|
44
47
|
this.Frompositiondetection = frompositiondetection;
|
|
48
|
+
this.Eventname = eventname;
|
|
45
49
|
}
|
|
46
50
|
/**
|
|
47
51
|
* Converts json object to an object of type Region.
|
|
@@ -52,7 +56,7 @@ class Region {
|
|
|
52
56
|
|
|
53
57
|
|
|
54
58
|
static jsonToObj(json) {
|
|
55
|
-
return new Region(json.date, json.didenter, json.identifier, json.latitude, json.longitude, json.radius, json.frompositiondetection);
|
|
59
|
+
return new Region(json.date, json.didenter, json.identifier, json.latitude, json.longitude, json.radius, json.frompositiondetection, json.eventname);
|
|
56
60
|
}
|
|
57
61
|
|
|
58
62
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Region","constructor","date","didenter","identifier","latitude","longitude","radius","frompositiondetection","Date","Didenter","Identifier","Latitude","Longitude","Radius","Frompositiondetection","jsonToObj","json"],"sources":["Region.tsx"],"sourcesContent":["/**\n * A class that represents the Region object.\n * @classdesc A class that represents the Region object.\n * @constructs Region\n * @param {number} date The datetime stamp.\n * @param {boolean} didEnter A boolean value indicating whether the region was entered.\n * @param {string} identifier An alphanumeric unique identifier for the region.\n * @param {number} latitude The latitude of the region.\n * @param {number} longitude The longitude of the region.\n * @param {number} radius The radius of the region in meters.\n * @param {boolean} frompositiondetection Determines whether the user's
|
|
1
|
+
{"version":3,"names":["Region","constructor","date","didenter","identifier","latitude","longitude","radius","frompositiondetection","eventname","Date","Didenter","Identifier","Latitude","Longitude","Radius","Frompositiondetection","Eventname","jsonToObj","json"],"sources":["Region.tsx"],"sourcesContent":["/**\n * A class that represents the Region object.\n * @classdesc A class that represents the Region object.\n * @constructs Region\n * @param {number} date The datetime stamp.\n * @param {boolean} didEnter A boolean value indicating whether the region was entered.\n * @param {string} identifier An alphanumeric unique identifier for the region.\n * @param {number} latitude The latitude of the region.\n * @param {number} longitude The longitude of the region.\n * @param {number} radius The radius of the region in meters.\n * @param {boolean} frompositiondetection Determines whether the user's current position is inside the region.\n * @param {string} eventName Describe cause of region event, Entry or Exit.\n */\nclass Region {\n Date: number;\n Didenter: boolean;\n Identifier: string;\n Latitude: number;\n Longitude: number;\n Radius: number;\n Frompositiondetection: boolean;\n Eventname: string;\n constructor(\n date: number,\n didenter: boolean,\n identifier: string,\n latitude: number,\n longitude: number,\n radius: number,\n frompositiondetection: boolean,\n eventname: string\n ) {\n this.Date = date;\n this.Didenter = didenter;\n this.Identifier = identifier;\n this.Latitude = latitude;\n this.Longitude = longitude;\n this.Radius = radius;\n this.Frompositiondetection = frompositiondetection;\n this.Eventname = eventname;\n }\n /**\n * Converts json object to an object of type Region.\n * @param {Object} json The json representation of the region.\n * @returns Object\n * @memberof Region\n */\n static jsonToObj(json: any) {\n return new Region(\n json.date,\n json.didenter,\n json.identifier,\n json.latitude,\n json.longitude,\n json.radius,\n json.frompositiondetection,\n json.eventname\n );\n }\n}\nexport default Region;\n"],"mappings":";;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,MAAN,CAAa;EASXC,WAAW,CACTC,IADS,EAETC,QAFS,EAGTC,UAHS,EAITC,QAJS,EAKTC,SALS,EAMTC,MANS,EAOTC,qBAPS,EAQTC,SARS,EAST;IAAA;;IAAA;;IAAA;;IAAA;;IAAA;;IAAA;;IAAA;;IAAA;;IACA,KAAKC,IAAL,GAAYR,IAAZ;IACA,KAAKS,QAAL,GAAgBR,QAAhB;IACA,KAAKS,UAAL,GAAkBR,UAAlB;IACA,KAAKS,QAAL,GAAgBR,QAAhB;IACA,KAAKS,SAAL,GAAiBR,SAAjB;IACA,KAAKS,MAAL,GAAcR,MAAd;IACA,KAAKS,qBAAL,GAA6BR,qBAA7B;IACA,KAAKS,SAAL,GAAiBR,SAAjB;EACD;EACD;AACF;AACA;AACA;AACA;AACA;;;EACkB,OAATS,SAAS,CAACC,IAAD,EAAY;IAC1B,OAAO,IAAInB,MAAJ,CACLmB,IAAI,CAACjB,IADA,EAELiB,IAAI,CAAChB,QAFA,EAGLgB,IAAI,CAACf,UAHA,EAILe,IAAI,CAACd,QAJA,EAKLc,IAAI,CAACb,SALA,EAMLa,IAAI,CAACZ,MANA,EAOLY,IAAI,CAACX,qBAPA,EAQLW,IAAI,CAACV,SARA,CAAP;EAUD;;AA7CU;;eA+CET,M"}
|
|
@@ -10,10 +10,11 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
10
10
|
* @param {number} latitude The latitude of the region.
|
|
11
11
|
* @param {number} longitude The longitude of the region.
|
|
12
12
|
* @param {number} radius The radius of the region in meters.
|
|
13
|
-
* @param {boolean} frompositiondetection Determines whether the user's
|
|
13
|
+
* @param {boolean} frompositiondetection Determines whether the user's current position is inside the region.
|
|
14
|
+
* @param {string} eventName Describe cause of region event, Entry or Exit.
|
|
14
15
|
*/
|
|
15
16
|
class Region {
|
|
16
|
-
constructor(date, didenter, identifier, latitude, longitude, radius, frompositiondetection) {
|
|
17
|
+
constructor(date, didenter, identifier, latitude, longitude, radius, frompositiondetection, eventname) {
|
|
17
18
|
_defineProperty(this, "Date", void 0);
|
|
18
19
|
|
|
19
20
|
_defineProperty(this, "Didenter", void 0);
|
|
@@ -28,6 +29,8 @@ class Region {
|
|
|
28
29
|
|
|
29
30
|
_defineProperty(this, "Frompositiondetection", void 0);
|
|
30
31
|
|
|
32
|
+
_defineProperty(this, "Eventname", void 0);
|
|
33
|
+
|
|
31
34
|
this.Date = date;
|
|
32
35
|
this.Didenter = didenter;
|
|
33
36
|
this.Identifier = identifier;
|
|
@@ -35,6 +38,7 @@ class Region {
|
|
|
35
38
|
this.Longitude = longitude;
|
|
36
39
|
this.Radius = radius;
|
|
37
40
|
this.Frompositiondetection = frompositiondetection;
|
|
41
|
+
this.Eventname = eventname;
|
|
38
42
|
}
|
|
39
43
|
/**
|
|
40
44
|
* Converts json object to an object of type Region.
|
|
@@ -45,7 +49,7 @@ class Region {
|
|
|
45
49
|
|
|
46
50
|
|
|
47
51
|
static jsonToObj(json) {
|
|
48
|
-
return new Region(json.date, json.didenter, json.identifier, json.latitude, json.longitude, json.radius, json.frompositiondetection);
|
|
52
|
+
return new Region(json.date, json.didenter, json.identifier, json.latitude, json.longitude, json.radius, json.frompositiondetection, json.eventname);
|
|
49
53
|
}
|
|
50
54
|
|
|
51
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Region","constructor","date","didenter","identifier","latitude","longitude","radius","frompositiondetection","Date","Didenter","Identifier","Latitude","Longitude","Radius","Frompositiondetection","jsonToObj","json"],"sources":["Region.tsx"],"sourcesContent":["/**\n * A class that represents the Region object.\n * @classdesc A class that represents the Region object.\n * @constructs Region\n * @param {number} date The datetime stamp.\n * @param {boolean} didEnter A boolean value indicating whether the region was entered.\n * @param {string} identifier An alphanumeric unique identifier for the region.\n * @param {number} latitude The latitude of the region.\n * @param {number} longitude The longitude of the region.\n * @param {number} radius The radius of the region in meters.\n * @param {boolean} frompositiondetection Determines whether the user's
|
|
1
|
+
{"version":3,"names":["Region","constructor","date","didenter","identifier","latitude","longitude","radius","frompositiondetection","eventname","Date","Didenter","Identifier","Latitude","Longitude","Radius","Frompositiondetection","Eventname","jsonToObj","json"],"sources":["Region.tsx"],"sourcesContent":["/**\n * A class that represents the Region object.\n * @classdesc A class that represents the Region object.\n * @constructs Region\n * @param {number} date The datetime stamp.\n * @param {boolean} didEnter A boolean value indicating whether the region was entered.\n * @param {string} identifier An alphanumeric unique identifier for the region.\n * @param {number} latitude The latitude of the region.\n * @param {number} longitude The longitude of the region.\n * @param {number} radius The radius of the region in meters.\n * @param {boolean} frompositiondetection Determines whether the user's current position is inside the region.\n * @param {string} eventName Describe cause of region event, Entry or Exit.\n */\nclass Region {\n Date: number;\n Didenter: boolean;\n Identifier: string;\n Latitude: number;\n Longitude: number;\n Radius: number;\n Frompositiondetection: boolean;\n Eventname: string;\n constructor(\n date: number,\n didenter: boolean,\n identifier: string,\n latitude: number,\n longitude: number,\n radius: number,\n frompositiondetection: boolean,\n eventname: string\n ) {\n this.Date = date;\n this.Didenter = didenter;\n this.Identifier = identifier;\n this.Latitude = latitude;\n this.Longitude = longitude;\n this.Radius = radius;\n this.Frompositiondetection = frompositiondetection;\n this.Eventname = eventname;\n }\n /**\n * Converts json object to an object of type Region.\n * @param {Object} json The json representation of the region.\n * @returns Object\n * @memberof Region\n */\n static jsonToObj(json: any) {\n return new Region(\n json.date,\n json.didenter,\n json.identifier,\n json.latitude,\n json.longitude,\n json.radius,\n json.frompositiondetection,\n json.eventname\n );\n }\n}\nexport default Region;\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,MAAN,CAAa;EASXC,WAAW,CACTC,IADS,EAETC,QAFS,EAGTC,UAHS,EAITC,QAJS,EAKTC,SALS,EAMTC,MANS,EAOTC,qBAPS,EAQTC,SARS,EAST;IAAA;;IAAA;;IAAA;;IAAA;;IAAA;;IAAA;;IAAA;;IAAA;;IACA,KAAKC,IAAL,GAAYR,IAAZ;IACA,KAAKS,QAAL,GAAgBR,QAAhB;IACA,KAAKS,UAAL,GAAkBR,UAAlB;IACA,KAAKS,QAAL,GAAgBR,QAAhB;IACA,KAAKS,SAAL,GAAiBR,SAAjB;IACA,KAAKS,MAAL,GAAcR,MAAd;IACA,KAAKS,qBAAL,GAA6BR,qBAA7B;IACA,KAAKS,SAAL,GAAiBR,SAAjB;EACD;EACD;AACF;AACA;AACA;AACA;AACA;;;EACkB,OAATS,SAAS,CAACC,IAAD,EAAY;IAC1B,OAAO,IAAInB,MAAJ,CACLmB,IAAI,CAACjB,IADA,EAELiB,IAAI,CAAChB,QAFA,EAGLgB,IAAI,CAACf,UAHA,EAILe,IAAI,CAACd,QAJA,EAKLc,IAAI,CAACb,SALA,EAMLa,IAAI,CAACZ,MANA,EAOLY,IAAI,CAACX,qBAPA,EAQLW,IAAI,CAACV,SARA,CAAP;EAUD;;AA7CU;;AA+Cb,eAAeT,MAAf"}
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
* @param {number} latitude The latitude of the region.
|
|
9
9
|
* @param {number} longitude The longitude of the region.
|
|
10
10
|
* @param {number} radius The radius of the region in meters.
|
|
11
|
-
* @param {boolean} frompositiondetection Determines whether the user's
|
|
11
|
+
* @param {boolean} frompositiondetection Determines whether the user's current position is inside the region.
|
|
12
|
+
* @param {string} eventName Describe cause of region event, Entry or Exit.
|
|
12
13
|
*/
|
|
13
14
|
declare class Region {
|
|
14
15
|
Date: number;
|
|
@@ -18,7 +19,8 @@ declare class Region {
|
|
|
18
19
|
Longitude: number;
|
|
19
20
|
Radius: number;
|
|
20
21
|
Frompositiondetection: boolean;
|
|
21
|
-
|
|
22
|
+
Eventname: string;
|
|
23
|
+
constructor(date: number, didenter: boolean, identifier: string, latitude: number, longitude: number, radius: number, frompositiondetection: boolean, eventname: string);
|
|
22
24
|
/**
|
|
23
25
|
* Converts json object to an object of type Region.
|
|
24
26
|
* @param {Object} json The json representation of the region.
|
package/src/internal/Region.tsx
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
* @param {number} latitude The latitude of the region.
|
|
9
9
|
* @param {number} longitude The longitude of the region.
|
|
10
10
|
* @param {number} radius The radius of the region in meters.
|
|
11
|
-
* @param {boolean} frompositiondetection Determines whether the user's
|
|
11
|
+
* @param {boolean} frompositiondetection Determines whether the user's current position is inside the region.
|
|
12
|
+
* @param {string} eventName Describe cause of region event, Entry or Exit.
|
|
12
13
|
*/
|
|
13
14
|
class Region {
|
|
14
15
|
Date: number;
|
|
@@ -18,6 +19,7 @@ class Region {
|
|
|
18
19
|
Longitude: number;
|
|
19
20
|
Radius: number;
|
|
20
21
|
Frompositiondetection: boolean;
|
|
22
|
+
Eventname: string;
|
|
21
23
|
constructor(
|
|
22
24
|
date: number,
|
|
23
25
|
didenter: boolean,
|
|
@@ -25,7 +27,8 @@ class Region {
|
|
|
25
27
|
latitude: number,
|
|
26
28
|
longitude: number,
|
|
27
29
|
radius: number,
|
|
28
|
-
frompositiondetection: boolean
|
|
30
|
+
frompositiondetection: boolean,
|
|
31
|
+
eventname: string
|
|
29
32
|
) {
|
|
30
33
|
this.Date = date;
|
|
31
34
|
this.Didenter = didenter;
|
|
@@ -34,6 +37,7 @@ class Region {
|
|
|
34
37
|
this.Longitude = longitude;
|
|
35
38
|
this.Radius = radius;
|
|
36
39
|
this.Frompositiondetection = frompositiondetection;
|
|
40
|
+
this.Eventname = eventname;
|
|
37
41
|
}
|
|
38
42
|
/**
|
|
39
43
|
* Converts json object to an object of type Region.
|
|
@@ -49,7 +53,8 @@ class Region {
|
|
|
49
53
|
json.latitude,
|
|
50
54
|
json.longitude,
|
|
51
55
|
json.radius,
|
|
52
|
-
json.frompositiondetection
|
|
56
|
+
json.frompositiondetection,
|
|
57
|
+
json.eventname
|
|
53
58
|
);
|
|
54
59
|
}
|
|
55
60
|
}
|