@transistorsoft/background-geolocation-types 5.0.0-beta.2 → 5.0.0-beta.4
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/dist/core/api/BackgroundGeolocation.d.ts +115 -359
- package/dist/core/api/CurrentPositionRequest.d.ts +0 -36
- package/dist/core/api/DeviceSettings.d.ts +0 -63
- package/dist/core/api/Logger.d.ts +0 -400
- package/dist/core/api/State.d.ts +0 -63
- package/dist/core/api/TransistorAuthorizationService.d.ts +0 -110
- package/dist/core/config/ActivityConfig.d.ts +0 -260
- package/dist/core/config/AppConfig.d.ts +0 -581
- package/dist/core/config/AuthorizationConfig.d.ts +0 -191
- package/dist/core/config/Config.d.ts +0 -176
- package/dist/core/config/GeoConfig.d.ts +0 -876
- package/dist/core/config/HttpConfig.d.ts +0 -565
- package/dist/core/config/LocationFilter.d.ts +0 -256
- package/dist/core/config/LoggerConfig.d.ts +0 -313
- package/dist/core/config/NotificationConfig.d.ts +0 -504
- package/dist/core/config/PersistenceConfig.d.ts +0 -541
- package/dist/core/data/DeviceInfo.d.ts +0 -54
- package/dist/core/data/Geofence.d.ts +0 -5
- package/dist/core/data/Location.d.ts +0 -213
- package/dist/core/data/Sensors.d.ts +0 -22
- package/dist/core/events/AuthorizationEvent.d.ts +0 -9
- package/dist/core/events/ConnectivityChangeEvent.d.ts +0 -6
- package/dist/core/events/GeofenceEvent.d.ts +0 -10
- package/dist/core/events/GeofencesChangeEvent.d.ts +0 -7
- package/dist/core/events/HeadlessEvent.d.ts +0 -7
- package/dist/core/events/HeartbeatEvent.d.ts +0 -10
- package/dist/core/events/HttpEvent.d.ts +0 -8
- package/dist/core/events/MotionActivityEvent.d.ts +0 -7
- package/dist/core/events/MotionChangeEvent.d.ts +0 -7
- package/dist/core/events/ProviderChangeEvent.d.ts +0 -10
- package/dist/core/events/Subscription.d.ts +0 -83
- package/dist/docs-entry.js +0 -3
- package/dist/enums/AccuracyAuthorization.d.ts +1 -12
- package/dist/enums/AccuracyAuthorization.js +0 -12
- package/dist/enums/ActivityType.d.ts +1 -21
- package/dist/enums/ActivityType.js +0 -21
- package/dist/enums/AuthorizationStatus.d.ts +1 -13
- package/dist/enums/AuthorizationStatus.js +0 -13
- package/dist/enums/AuthorizationStrategy.d.ts +1 -6
- package/dist/enums/AuthorizationStrategy.js +0 -6
- package/dist/enums/DesiredAccuracy.d.ts +1 -5
- package/dist/enums/DesiredAccuracy.js +0 -5
- package/dist/enums/Event.d.ts +1 -5
- package/dist/enums/Event.js +0 -5
- package/dist/enums/GeofenceAction.d.ts +1 -13
- package/dist/enums/GeofenceAction.js +0 -13
- package/dist/enums/HttpMethod.d.ts +1 -6
- package/dist/enums/HttpMethod.js +0 -6
- package/dist/enums/KalmanProfile.d.ts +1 -25
- package/dist/enums/KalmanProfile.js +0 -25
- package/dist/enums/LocationError.d.ts +1 -15
- package/dist/enums/LocationError.js +0 -15
- package/dist/enums/LocationFilterPolicy.d.ts +1 -103
- package/dist/enums/LocationFilterPolicy.js +0 -103
- package/dist/enums/LocationRequest.d.ts +1 -15
- package/dist/enums/LocationRequest.js +0 -15
- package/dist/enums/LogLevel.d.ts +1 -16
- package/dist/enums/LogLevel.js +0 -16
- package/dist/enums/LogLevelName.d.ts +8 -1
- package/dist/enums/LogLevelName.js +0 -5
- package/dist/enums/MotionActivityType.d.ts +1 -5
- package/dist/enums/MotionActivityType.js +0 -5
- package/dist/enums/NotificationPriority.d.ts +1 -15
- package/dist/enums/NotificationPriority.js +0 -15
- package/dist/enums/PersistMode.d.ts +1 -6
- package/dist/enums/PersistMode.js +0 -6
- package/dist/enums/SQLQueryOrder.d.ts +0 -11
- package/dist/enums/SQLQueryOrder.js +0 -10
- package/dist/enums/TrackingMode.d.ts +1 -10
- package/dist/enums/TrackingMode.js +0 -10
- package/dist/enums/TriggerActivity.d.ts +1 -6
- package/dist/enums/TriggerActivity.js +0 -6
- package/dist/index.js +0 -4
- package/dist/legacy/LegacyConfig.d.ts +0 -19
- package/package.json +8 -9
- package/dist/core/config/CompoundConfig.d.ts +0 -19
- package/dist/core/config/CompoundConfig.js +0 -2
|
@@ -1,272 +1,16 @@
|
|
|
1
1
|
import { LocationFilterPolicy } from '../../enums/LocationFilterPolicy';
|
|
2
2
|
import { KalmanProfile } from '../../enums/KalmanProfile';
|
|
3
|
-
/**
|
|
4
|
-
* Defines how raw GPS samples are filtered, denoised, and smoothed before being
|
|
5
|
-
* recorded or used for odometer calculations.
|
|
6
|
-
*
|
|
7
|
-
* `LocationFilter` is supplied via {@link GeoConfig.filter} and provides
|
|
8
|
-
* fine-grained control over how the SDK handles noisy or inconsistent
|
|
9
|
-
* location data from the underlying platform.
|
|
10
|
-
*
|
|
11
|
-
* **Overview**
|
|
12
|
-
*
|
|
13
|
-
* The native platform continuously produces raw `CLLocation` (iOS) or
|
|
14
|
-
* `Location` (Android) samples. The `LocationFilter` applies:
|
|
15
|
-
*
|
|
16
|
-
* - Kalman filtering
|
|
17
|
-
* - rolling-window averaging
|
|
18
|
-
* - speed, distance, and accuracy constraints
|
|
19
|
-
*
|
|
20
|
-
* These produce smoother paths, reduce jitter, and improve odometer stability.
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```ts
|
|
24
|
-
* BackgroundGeolocation.ready({
|
|
25
|
-
* geolocation: {
|
|
26
|
-
* filter: {
|
|
27
|
-
* policy: LocationFilterPolicy.Adjust,
|
|
28
|
-
* useKalman: true,
|
|
29
|
-
* kalmanProfile: KalmanProfile.Default,
|
|
30
|
-
* trackingAccuracyThreshold: 100,
|
|
31
|
-
* odometerAccuracyThreshold: 20
|
|
32
|
-
* }
|
|
33
|
-
* }
|
|
34
|
-
* });
|
|
35
|
-
* ```
|
|
36
|
-
*
|
|
37
|
-
* **Filtering Flow**
|
|
38
|
-
*
|
|
39
|
-
* 
|
|
40
|
-
*
|
|
41
|
-
* **Parameters**
|
|
42
|
-
*
|
|
43
|
-
* | Field | Description |
|
|
44
|
-
* |-------|-------------|
|
|
45
|
-
* | **{@link policy}** | Selects which filtering policy to apply. See {@link LocationFilterPolicy}. |
|
|
46
|
-
* | **{@link useKalman}** | Enables Kalman filtering of speed and position (default: `true`). |
|
|
47
|
-
* | **{@link kalmanDebug}** | Enables verbose Kalman diagnostic logs. |
|
|
48
|
-
* | **{@link kalmanProfile}** | Selects a Kalman tuning profile (see {@link KalmanProfile}). |
|
|
49
|
-
* | **{@link rollingWindow}** | Number of samples for rolling burst averaging. Larger values increase smoothness but reduce responsiveness. |
|
|
50
|
-
* | **{@link burstWindow}** | Duration of each averaging burst (seconds). Default: `10`. |
|
|
51
|
-
* | **{@link maxBurstDistance}** | Maximum distance (meters) for samples to be included in the same burst window. Default: `300`. |
|
|
52
|
-
* | **{@link trackingAccuracyThreshold}** | Minimum GPS horizontal accuracy (meters) required to accept a location. Default: `100`. |
|
|
53
|
-
* | **{@link maxImpliedSpeed}** | Maximum implied speed (m/s) before rejecting a sample as unrealistic. Default: `60` (~216 km/h). |
|
|
54
|
-
* | **{@link filterDebug}** | Enables verbose logging of filter decisions (`ACCEPTED`, `REJECTED`, etc). |
|
|
55
|
-
* | **{@link odometerUseKalmanFilter}** | Applies Kalman smoothing to odometer calculations. |
|
|
56
|
-
* | **{@link odometerAccuracyThreshold}** | Maximum accuracy (meters) allowed for a sample to affect the odometer. Default: `100`. |
|
|
57
|
-
*
|
|
58
|
-
* **Notes**
|
|
59
|
-
*
|
|
60
|
-
* - Distances are in **meters**.
|
|
61
|
-
* - Time fields are in **milliseconds** unless otherwise specified.
|
|
62
|
-
* - Filtering affects **recorded** locations only; it does *not* influence real-time motion detection.
|
|
63
|
-
*
|
|
64
|
-
* **Disable all filtering**
|
|
65
|
-
*
|
|
66
|
-
* @example
|
|
67
|
-
* ```ts
|
|
68
|
-
* BackgroundGeolocation.ready({
|
|
69
|
-
* geolocation: {
|
|
70
|
-
* filter: {
|
|
71
|
-
* policy: LocationFilterPolicy.PassThrough,
|
|
72
|
-
* useKalman: false
|
|
73
|
-
* }
|
|
74
|
-
* }
|
|
75
|
-
* });
|
|
76
|
-
* ```
|
|
77
|
-
* @category Config
|
|
78
|
-
*/
|
|
79
3
|
export interface LocationFilter {
|
|
80
|
-
/**
|
|
81
|
-
* Defines the filtering policy applied to incoming raw GPS samples before they
|
|
82
|
-
* are accepted, averaged, or rejected by the {@link LocationFilter}.
|
|
83
|
-
*
|
|
84
|
-
* The filtering policy determines how aggressively the plugin removes noisy,
|
|
85
|
-
* inaccurate, or redundant location updates. It represents the *first stage*
|
|
86
|
-
* in the SDK’s data-quality pipeline — before Kalman smoothing, burst averaging,
|
|
87
|
-
* or other denoising steps are applied.
|
|
88
|
-
*
|
|
89
|
-
* Choosing the correct policy depends on your app’s tolerance for jitter versus
|
|
90
|
-
* responsiveness:
|
|
91
|
-
*
|
|
92
|
-
* - Fitness or vehicle-tracking apps often prefer stronger filtering.
|
|
93
|
-
* - Survey or scientific apps may prefer capturing unmodified raw samples.
|
|
94
|
-
*
|
|
95
|
-
* **Profiles**
|
|
96
|
-
*
|
|
97
|
-
* | Policy | Description | Use Case |
|
|
98
|
-
* |--------|-------------|----------|
|
|
99
|
-
* | {@link LocationFilterPolicy.PassThrough} | **No filtering.** Every received sample is recorded, even if noisy or identical to the previous one. | Debugging, diagnostics, scenarios requiring raw data. |
|
|
100
|
-
* | {@link LocationFilterPolicy.Adjust} | **Balanced filtering.** Smooths and rejects only clearly invalid samples. *(Default)* | Most use cases — walking, cycling, automotive tracking. |
|
|
101
|
-
* | {@link LocationFilterPolicy.Conservative} | **Strict filtering.** Strongly smooths data and rejects high-variance samples, prioritizing stability over responsiveness. | Analytics, long-term background logging, noise-sensitive applications. |
|
|
102
|
-
*
|
|
103
|
-
* **Notes**
|
|
104
|
-
*
|
|
105
|
-
* - This policy affects only the SDK’s *internal* filtering pipeline.
|
|
106
|
-
* It does **not** modify the raw values returned to {@link BackgroundGeolocation.onLocation}.
|
|
107
|
-
* - For more granular tuning, see {@link LocationFilter.trackingAccuracyThreshold},
|
|
108
|
-
* {@link LocationFilter.maxImpliedSpeed}, and other {@link LocationFilter} fields.
|
|
109
|
-
*
|
|
110
|
-
* **Examples**
|
|
111
|
-
*
|
|
112
|
-
* Balanced default filtering:
|
|
113
|
-
*
|
|
114
|
-
* ```ts
|
|
115
|
-
* BackgroundGeolocation.ready({
|
|
116
|
-
* geolocation: {
|
|
117
|
-
* filter: {
|
|
118
|
-
* policy: LocationFilterPolicy.Adjust
|
|
119
|
-
* }
|
|
120
|
-
* }
|
|
121
|
-
* });
|
|
122
|
-
* ```
|
|
123
|
-
*
|
|
124
|
-
* No filtering — capture all raw locations:
|
|
125
|
-
*
|
|
126
|
-
* ```ts
|
|
127
|
-
* BackgroundGeolocation.ready({
|
|
128
|
-
* geolocation: {
|
|
129
|
-
* filter: {
|
|
130
|
-
* policy: LocationFilterPolicy.PassThrough
|
|
131
|
-
* }
|
|
132
|
-
* }
|
|
133
|
-
* });
|
|
134
|
-
* ```
|
|
135
|
-
*
|
|
136
|
-
* Maximum smoothing for analytics:
|
|
137
|
-
*
|
|
138
|
-
* ```ts
|
|
139
|
-
* BackgroundGeolocation.ready({
|
|
140
|
-
* geolocation: {
|
|
141
|
-
* filter: {
|
|
142
|
-
* policy: LocationFilterPolicy.Conservative
|
|
143
|
-
* }
|
|
144
|
-
* }
|
|
145
|
-
* });
|
|
146
|
-
* ```
|
|
147
|
-
*
|
|
148
|
-
* **See also**
|
|
149
|
-
* - {@link GeoConfig.filter}
|
|
150
|
-
* - {@link LocationFilter}
|
|
151
|
-
* - {@link KalmanProfile}
|
|
152
|
-
*/
|
|
153
4
|
policy?: LocationFilterPolicy;
|
|
154
|
-
/**
|
|
155
|
-
* Enables the Kalman filter to smooth incoming location speed and position.
|
|
156
|
-
*
|
|
157
|
-
* When `true`, the SDK applies a Kalman filter to reduce noise and stabilize
|
|
158
|
-
* velocity and distance calculations. Defaults to `true`.
|
|
159
|
-
*/
|
|
160
5
|
useKalman?: boolean;
|
|
161
|
-
/**
|
|
162
|
-
* Enables verbose Kalman debug output in logs.
|
|
163
|
-
*
|
|
164
|
-
* When `true`, the SDK logs additional diagnostic data about the Kalman
|
|
165
|
-
* filter’s internal state (for example, variance and innovation) for
|
|
166
|
-
* each incoming sample.
|
|
167
|
-
*/
|
|
168
6
|
kalmanDebug?: boolean;
|
|
169
|
-
/**
|
|
170
|
-
* Specifies the preset tuning profile for the Kalman filter used in location
|
|
171
|
-
* denoising.
|
|
172
|
-
*
|
|
173
|
-
* Each profile adjusts the Kalman filter’s process and measurement noise
|
|
174
|
-
* parameters, trading off between responsiveness and smoothness:
|
|
175
|
-
*
|
|
176
|
-
* | Profile | Behavior |
|
|
177
|
-
* |----------------------|---------------------------------------------------------------------|
|
|
178
|
-
* | `defaultProfile` | **Balanced** — General-purpose; suitable for most movement types. |
|
|
179
|
-
* | `aggressive` | **Aggressive** — Fast response; minimal smoothing. |
|
|
180
|
-
* | `conservative` | **Conservative** — Maximum smoothing; slowest response to changes. |
|
|
181
|
-
*
|
|
182
|
-
* - If no profile is provided, `defaultProfile` is applied.
|
|
183
|
-
* - Use `aggressive` for fast-changing activities requiring rapid updates.
|
|
184
|
-
* - Use `conservative` when stability and track smoothness are more important
|
|
185
|
-
* than immediate responsiveness.
|
|
186
|
-
*
|
|
187
|
-
* This maps directly to native Kalman tuning implementations on both Android and iOS.
|
|
188
|
-
*/
|
|
189
7
|
kalmanProfile?: KalmanProfile;
|
|
190
|
-
/**
|
|
191
|
-
* Number of samples in the rolling window used for burst averaging.
|
|
192
|
-
*
|
|
193
|
-
* Higher values produce smoother averaged locations but introduce greater
|
|
194
|
-
* latency in responsiveness to movement.
|
|
195
|
-
*
|
|
196
|
-
* **Default:** `5`.
|
|
197
|
-
*/
|
|
198
8
|
rollingWindow?: number;
|
|
199
|
-
/**
|
|
200
|
-
* Duration (in seconds) of each burst window used for averaging samples.
|
|
201
|
-
*
|
|
202
|
-
* The plugin groups all locations received within this time window into a
|
|
203
|
-
* single averaged output sample.
|
|
204
|
-
*
|
|
205
|
-
* **Default:** `10` seconds.
|
|
206
|
-
*/
|
|
207
9
|
burstWindow?: number;
|
|
208
|
-
/**
|
|
209
|
-
* Maximum distance (in meters) between samples considered part of the same burst.
|
|
210
|
-
*
|
|
211
|
-
* Prevents the filter from merging location samples that are too far apart into
|
|
212
|
-
* a single averaged point.
|
|
213
|
-
*
|
|
214
|
-
* **Default:** `300` meters.
|
|
215
|
-
*/
|
|
216
10
|
maxBurstDistance?: number;
|
|
217
|
-
/**
|
|
218
|
-
* Minimum acceptable horizontal accuracy (in meters) for a sample to qualify
|
|
219
|
-
* for tracking.
|
|
220
|
-
*
|
|
221
|
-
* Locations with an accuracy value **greater (worse)** than this threshold
|
|
222
|
-
* are discarded and will not be used in path or odometer calculations.
|
|
223
|
-
*
|
|
224
|
-
* **Default:** `100` meters.
|
|
225
|
-
*/
|
|
226
11
|
trackingAccuracyThreshold?: number;
|
|
227
|
-
/**
|
|
228
|
-
* Maximum implied speed (in meters/second) permitted before a location
|
|
229
|
-
* sample is rejected.
|
|
230
|
-
*
|
|
231
|
-
* If a raw sample implies a speed **greater than this threshold**, it is
|
|
232
|
-
* considered an unrealistic outlier and will be discarded by the filter.
|
|
233
|
-
*
|
|
234
|
-
* **Default:** `60` m/s (≈ 216 km/h).
|
|
235
|
-
*/
|
|
236
12
|
maxImpliedSpeed?: number;
|
|
237
|
-
/**
|
|
238
|
-
* Enables verbose debug logging for the filtering engine.
|
|
239
|
-
*
|
|
240
|
-
* When `true`, the SDK logs detailed decisions for each incoming sample,
|
|
241
|
-
* including whether it was **ACCEPTED**, **REJECTED**, or **IGNORED** by the
|
|
242
|
-
* filtering pipeline.
|
|
243
|
-
*/
|
|
244
13
|
filterDebug?: boolean;
|
|
245
|
-
/**
|
|
246
|
-
* Applies a Kalman filter **only to odometer calculations**, independent of
|
|
247
|
-
* {@link LocationFilter.useKalman}.
|
|
248
|
-
*
|
|
249
|
-
* When `true`, the odometer’s internal distance-accumulation logic applies a
|
|
250
|
-
* Kalman filter to smooth incoming samples, reducing jitter and noise **without**
|
|
251
|
-
* modifying the recorded track points.
|
|
252
|
-
*
|
|
253
|
-
* This is useful when you want smoother odometer readings while preserving
|
|
254
|
-
* the raw location stream for mapping, analysis, or debugging.
|
|
255
|
-
*
|
|
256
|
-
* If both {@link LocationFilter.useKalman} and
|
|
257
|
-
* {@link LocationFilter.odometerUseKalmanFilter} are `true`, the SDK maintains
|
|
258
|
-
* **independent Kalman filter instances** for tracking and odometer calculations.
|
|
259
|
-
*
|
|
260
|
-
* Default: `true`.
|
|
261
|
-
*/
|
|
262
14
|
odometerUseKalmanFilter?: boolean;
|
|
263
|
-
/**
|
|
264
|
-
* Maximum horizontal accuracy (in meters) allowed for a sample to affect the odometer.
|
|
265
|
-
*
|
|
266
|
-
* Any location whose `accuracy` exceeds this threshold is **ignored** for
|
|
267
|
-
* odometer updates.
|
|
268
|
-
*
|
|
269
|
-
* Default: `20`.
|
|
270
|
-
*/
|
|
271
15
|
odometerAccuracyThreshold?: number;
|
|
272
16
|
}
|
|
@@ -1,319 +1,6 @@
|
|
|
1
1
|
import { LogLevel } from '../../enums/LogLevel';
|
|
2
|
-
/**
|
|
3
|
-
* Logging & diagnostics configuration.
|
|
4
|
-
*
|
|
5
|
-
* The **{@link LoggerConfig}** group controls diagnostic logging for the SDK.
|
|
6
|
-
* Use it to adjust how much information is written to the internal log,
|
|
7
|
-
* whether to enable developer-friendly debug aids (soundFX, notifications),
|
|
8
|
-
* and how long logs are retained on the device.
|
|
9
|
-
*
|
|
10
|
-
* __Configure via:__ `config.logger`
|
|
11
|
-
*
|
|
12
|
-
* ```ts
|
|
13
|
-
* BackgroundGeolocation.ready({
|
|
14
|
-
* logger: {
|
|
15
|
-
* debug: true,
|
|
16
|
-
* logLevel: LogLevel.Verbose,
|
|
17
|
-
* logMaxDays: 7,
|
|
18
|
-
* }
|
|
19
|
-
* });
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
* __Overview__
|
|
23
|
-
*
|
|
24
|
-
* Logging serves two major purposes:
|
|
25
|
-
*
|
|
26
|
-
* 1. **Development & QA**
|
|
27
|
-
* High-verbosity logs and optional audible soundFX make debugging intuitive.
|
|
28
|
-
* You can hear when locations are recorded, when motion changes occur, and
|
|
29
|
-
* when geofences trigger — without watching the console.
|
|
30
|
-
*
|
|
31
|
-
* 2. **Production diagnostics**
|
|
32
|
-
* Lower verbosity preserves essential operational traces without excessive
|
|
33
|
-
* storage use or privacy impact.
|
|
34
|
-
*
|
|
35
|
-
* **See also:** {@link Config.logger}
|
|
36
|
-
*
|
|
37
|
-
* | Area | Keys | Notes |
|
|
38
|
-
* |-------------|--------------------------------------------|-------|
|
|
39
|
-
* | Verbosity | {@link logLevel} | off → verbose |
|
|
40
|
-
* | Debug aids | {@link debug} | Enables audible soundFX & debug indicators |
|
|
41
|
-
* | Retention | {@link logMaxDays} | Rolling on-device TTL |
|
|
42
|
-
*
|
|
43
|
-
* __Log Levels__
|
|
44
|
-
*
|
|
45
|
-
* Choose the level appropriate for your environment:
|
|
46
|
-
*
|
|
47
|
-
* | Level | Value | Description |
|
|
48
|
-
* |-------------|:-----:|-------------|
|
|
49
|
-
* | {@link LogLevel.Off} | 0 | Disable logging entirely |
|
|
50
|
-
* | {@link LogLevel.Error} | 1 | Failures & critical errors |
|
|
51
|
-
* | {@link LogLevel.Warning} | 2 | Problems that may affect behavior |
|
|
52
|
-
* | {@link LogLevel.Info} | 3 | Operational milestones (start/stop, HTTP, geofence state) |
|
|
53
|
-
* | {@link LogLevel.Debug} | 4 | Granular detail during integration |
|
|
54
|
-
* | {@link LogLevel.Verbose} | 5 | Maximum detail; full introspection |
|
|
55
|
-
*
|
|
56
|
-
* SoundFX and debug indicators require {@link debug} = `true`.
|
|
57
|
-
*
|
|
58
|
-
* __Debug Behavior__
|
|
59
|
-
*
|
|
60
|
-
* When `debug: true`, the SDK plays short, distinct soundFX when key events occur:
|
|
61
|
-
*
|
|
62
|
-
* - Location recorded
|
|
63
|
-
* - Location error
|
|
64
|
-
* - `onMotionChange` transitions
|
|
65
|
-
* - Geofence enter / exit / dwell
|
|
66
|
-
*
|
|
67
|
-
* It may also show temporary developer notifications (Android) to visualize state
|
|
68
|
-
* transitions and background operation.
|
|
69
|
-
*
|
|
70
|
-
* ⚠️ **Never enable `debug` in production.**
|
|
71
|
-
*
|
|
72
|
-
* __Retention__
|
|
73
|
-
*
|
|
74
|
-
* Use {@link logMaxDays} to control how long logs remain on device.
|
|
75
|
-
* Old entries are purged automatically on a rolling basis.
|
|
76
|
-
*
|
|
77
|
-
* Recommended:
|
|
78
|
-
* - Development: 5–7 days
|
|
79
|
-
* - Production: 1–3 days
|
|
80
|
-
*
|
|
81
|
-
* __Retrieving Logs__
|
|
82
|
-
*
|
|
83
|
-
* ```ts
|
|
84
|
-
* // Retrieve full log as a string
|
|
85
|
-
* const log = await BackgroundGeolocation.logger.getLog({});
|
|
86
|
-
*
|
|
87
|
-
* // Email the log as an attachment
|
|
88
|
-
* await BackgroundGeolocation.logger.emailLog("support@yourcompany.com");
|
|
89
|
-
* ```
|
|
90
|
-
*
|
|
91
|
-
* Logs include:
|
|
92
|
-
* - SQLite-backed diagnostic history
|
|
93
|
-
* - Event traces
|
|
94
|
-
* - HTTP upload events
|
|
95
|
-
* - Configuration transitions
|
|
96
|
-
*
|
|
97
|
-
* **See also:** {@link logMaxDays}, {@link logLevel}
|
|
98
|
-
*
|
|
99
|
-
* __Examples__
|
|
100
|
-
*
|
|
101
|
-
* **1) Development profile (maximum visibility)**
|
|
102
|
-
*
|
|
103
|
-
* ```ts
|
|
104
|
-
* BackgroundGeolocation.ready({
|
|
105
|
-
* logger: {
|
|
106
|
-
* debug: true,
|
|
107
|
-
* logLevel: LogLevel.Verbose,
|
|
108
|
-
* logMaxDays: 7,
|
|
109
|
-
* }
|
|
110
|
-
* });
|
|
111
|
-
* ```
|
|
112
|
-
*
|
|
113
|
-
* **2) Production profile (quiet & conservative)**
|
|
114
|
-
*
|
|
115
|
-
* ```ts
|
|
116
|
-
* BackgroundGeolocation.ready({
|
|
117
|
-
* logger: {
|
|
118
|
-
* debug: false,
|
|
119
|
-
* logLevel: LogLevel.Info,
|
|
120
|
-
* logMaxDays: 3,
|
|
121
|
-
* }
|
|
122
|
-
* });
|
|
123
|
-
* ```
|
|
124
|
-
*
|
|
125
|
-
* **3) Disable all logging**
|
|
126
|
-
*
|
|
127
|
-
* ```ts
|
|
128
|
-
* BackgroundGeolocation.setConfig({
|
|
129
|
-
* logger: {
|
|
130
|
-
* logLevel: LogLevel.Off,
|
|
131
|
-
* }
|
|
132
|
-
* });
|
|
133
|
-
* ```
|
|
134
|
-
*
|
|
135
|
-
* __Migration from legacy flat Config__
|
|
136
|
-
*
|
|
137
|
-
* Legacy:
|
|
138
|
-
*
|
|
139
|
-
* ```ts
|
|
140
|
-
* Config({
|
|
141
|
-
* debug: true,
|
|
142
|
-
* logLevel: LogLevel.Verbose,
|
|
143
|
-
* logMaxDays: 3,
|
|
144
|
-
* });
|
|
145
|
-
* ```
|
|
146
|
-
*
|
|
147
|
-
* New (compound):
|
|
148
|
-
*
|
|
149
|
-
* ```ts
|
|
150
|
-
* Config({
|
|
151
|
-
* logger: {
|
|
152
|
-
* debug: true,
|
|
153
|
-
* logLevel: LogLevel.Verbose,
|
|
154
|
-
* logMaxDays: 3,
|
|
155
|
-
* }
|
|
156
|
-
* });
|
|
157
|
-
* ```
|
|
158
|
-
*
|
|
159
|
-
* Legacy keys are still supported (deprecated), but the compound form is recommended.
|
|
160
|
-
*
|
|
161
|
-
* __Recommendations__
|
|
162
|
-
*
|
|
163
|
-
* - Use `Verbose` + `debug: true` during active development.
|
|
164
|
-
* - Use `Info` or `Warning` in production.
|
|
165
|
-
* - Do not set `Off` unless required — logs are invaluable for field diagnostics.
|
|
166
|
-
*
|
|
167
|
-
* @category Config
|
|
168
|
-
*/
|
|
169
2
|
export interface LoggerConfig {
|
|
170
|
-
/**
|
|
171
|
-
* Configure the plugin to emit sound effects and local-notifications during development.
|
|
172
|
-
*
|
|
173
|
-
* Defaults to **`false`**. When set to **`true`**, the plugin will emit debugging sounds and notifications for life-cycle events of [[BackgroundGeolocation | BackgroundGeolocation]].
|
|
174
|
-
*
|
|
175
|
-
* ## iOS
|
|
176
|
-
*
|
|
177
|
-
* In you wish to hear debug sounds in the background, you must manually enable the background-mode:
|
|
178
|
-
*
|
|
179
|
-
* **`[x] Audio and Airplay`** background mode in *Background Capabilities* of XCode.
|
|
180
|
-
*
|
|
181
|
-
* 
|
|
182
|
-
*
|
|
183
|
-
* ## Event Debug Sound Effects
|
|
184
|
-
*
|
|
185
|
-
* | Event | iOS | Android |
|
|
186
|
-
* |----------------------------|-------------------------|----------------------------|
|
|
187
|
-
* | `LOCATION_RECORDED` | <mediaplayer:https://dl.dropbox.com/s/yestzqdb6gzx7an/location-recorded.mp3?dl=0> | <mediaplayer:https://dl.dropboxusercontent.com/s/d3e821scn5fppq6/tslocationmanager_ooooiii3_full_vol.wav?dl=0> |
|
|
188
|
-
* | `LOCATION_SAMPLE` | <mediaplayer:https://dl.dropbox.com/s/8gp2nkzza2hql4r/location-sample.mp3?dl=0> | <mediaplayer:https://dl.dropboxusercontent.com/s/8bgiyifowyf9c7n/tslocationmanager_click_tap_done_checkbox5_full_vol.wav?dl=0> |
|
|
189
|
-
* | `LOCATION_ERROR` | <mediaplayer:https://dl.dropbox.com/s/l3rmf99rj3g5u6b/location-error.mp3?dl=0> | <mediaplayer:https://dl.dropboxusercontent.com/s/wadrz2x6elhc65l/tslocationmanager_digi_warn.mp3?dl=0> |
|
|
190
|
-
* | `LOCATION_SERVICES_ON` | <mediaplayer:https://dl.dropbox.com/s/urbjiqn0f4g1jhi/location-services-on.mp3?dl=0> | n/a |
|
|
191
|
-
* | `LOCATION_SERVICES_OFF` | <mediaplayer:https://dl.dropbox.com/s/0wb7qajfb0yy9w0/location-services-off.mp3?dl=0> | n/a |
|
|
192
|
-
* | `STATIONARY_GEOFENCE_EXIT` | <mediaplayer:https://dl.dropbox.com/s/p8ee60qvfgx4vi5/motionchange-true.mp3?dl=0> | <mediaplayer:https://dl.dropboxusercontent.com/s/gjgv51pot3h2n3t/tslocationmanager_zap_fast.mp3?dl=0> |
|
|
193
|
-
* | `MOTIONCHANGE_FALSE` | <mediaplayer:https://dl.dropbox.com/s/xk00hsfi87nrw3q/motionchange-false.mp3?dl=0> | <mediaplayer:https://dl.dropboxusercontent.com/s/fm4j2t8nqzd5856/tslocationmanager_marimba_drop.mp3?dl=0> |
|
|
194
|
-
* | `MOTIONCHANGE_TRUE` | <mediaplayer:https://dl.dropbox.com/s/p8ee60qvfgx4vi5/motionchange-true.mp3?dl=0> | <mediaplayer:https://dl.dropboxusercontent.com/s/n5mn6tr7x994ivg/tslocationmanager_chime_short_chord_up.mp3?dl=0> |
|
|
195
|
-
* | `MOTION_TRIGGER_DELAY_START` | n/a | <mediaplayer:https://dl.dropboxusercontent.com/s/cb3fa0zp0c4xjmt/tslocationmanager_dot_retry.wav?dl=0> |
|
|
196
|
-
* | `MOTION_TRIGGER_DELAY_CANCEL`| n/a | <mediaplayer:https://dl.dropboxusercontent.com/s/4pg3r4xooi9pe0g/tslocationmanager_dot_stopaction2.wav?dl=0> |
|
|
197
|
-
* | `STOP_DETECTION_DELAY_INITIATED` | <mediaplayer:https://dl.dropbox.com/s/y898zopjfolx42d/stopDetectionDelay.mp3?dl=0> | n/a |
|
|
198
|
-
* | `STOP_TIMER_ON` | <mediaplayer:https://dl.dropbox.com/s/7mjcmnszhjo6ywj/stop-timeout-start.mp3?dl=0> | <mediaplayer:https://dl.dropboxusercontent.com/s/q4a9pf0vlztfafh/tslocationmanager_chime_bell_confirm.mp3?dl=0> |
|
|
199
|
-
* | `STOP_TIMER_OFF` | <mediaplayer:https://dl.dropbox.com/s/qnsdu7b6vxic01i/stop-timeout-cancel.mp3?dl=0> | <mediaplayer:https://dl.dropboxusercontent.com/s/9o9v826was19lyi/tslocationmanager_bell_ding_pop.mp3?dl=0> |
|
|
200
|
-
* | `HEARTBEAT` | <mediaplayer:https://dl.dropbox.com/s/90vyfo3woe52ijo/heartbeat.mp3?dl=0> | <mediaplayer:https://dl.dropboxusercontent.com/s/bsdtw21hscqqy67/tslocationmanager_peep_note1.wav?dl=0> |
|
|
201
|
-
* | `GEOFENCE_ENTER` | <mediaplayer:https://dl.dropbox.com/s/h3047lybsggats7/geofence-enter.mp3?dl=0> | <mediaplayer:https://dl.dropboxusercontent.com/s/76up5ik215xwxh1/tslocationmanager_beep_trip_up_dry.mp3?dl=0> |
|
|
202
|
-
* | `GEOFENCE_EXIT` | <mediaplayer:https://dl.dropbox.com/s/2e8bg22c6g9zwxr/geofence-exit.mp3?dl=0> | <mediaplayer:https://dl.dropboxusercontent.com/s/xuyyagffheyk8r7/tslocationmanager_beep_trip_dry.mp3?dl=0> |
|
|
203
|
-
* | `GEOFENCE_DWELL_START` | <mediaplayer:https://dl.dropbox.com/s/7nysvyjxuxm9pms/geofence-dwell-start.mp3?dl=0> | n/a |
|
|
204
|
-
* | `GEOFENCE_DWELL_CANCEL` | <mediaplayer:https://dl.dropbox.com/s/sk2hur6nxch1zvm/geofence-dwell-cancel.mp3?dl=0> | n/a |
|
|
205
|
-
* | `GEOFENCE_DWELL` | `GEOFENCE_ENTER` after `GEOFENCE_DWELL_START` | <mediaplayer:https://dl.dropboxusercontent.com/s/uw5vjuatm3wnuid/tslocationmanager_beep_trip_up_echo.mp3?dl=0> |
|
|
206
|
-
* | `ERROR` | <mediaplayer:https://dl.dropbox.com/s/h5b52m056pfc734/error.mp3?dl=0> | <mediaplayer:https://dl.dropboxusercontent.com/s/32e93c1t4kh69p1/tslocationmanager_music_timpani_error_01.mp3?dl=0> |
|
|
207
|
-
* | `WARNING` | n/a | <mediaplayer:https://dl.dropboxusercontent.com/s/wadrz2x6elhc65l/tslocationmanager_digi_warn.mp3?dl=0> |
|
|
208
|
-
* | `BACKGROUND_FETCH` | <mediaplayer:https://dl.dropbox.com/s/mcsjqye0xx2kapk/background-fetch.mp3?dl=0> | n/a |
|
|
209
|
-
*
|
|
210
|
-
*/
|
|
211
3
|
debug?: boolean;
|
|
212
|
-
/**
|
|
213
|
-
* Controls the volume of recorded events in the plugin's logging database.
|
|
214
|
-
*
|
|
215
|
-
* {@link BackgroundGeolocation} contains powerful logging features. By default,
|
|
216
|
-
* the plugin starts with {@link LogLevel.Off},
|
|
217
|
-
* storing {@link LoggerConfig.logMaxDays | logMaxDays} days worth of logs in its
|
|
218
|
-
* internal SQLite database (default: `3`).
|
|
219
|
-
*
|
|
220
|
-
* The following log levels are defined as constants on {@link BackgroundGeolocation}:
|
|
221
|
-
*
|
|
222
|
-
* | Label | Value |
|
|
223
|
-
* |-------------------------|------------------------------------|
|
|
224
|
-
* | {@link LogLevel.Off} | `0` |
|
|
225
|
-
* | {@link LogLevel.Error} | `1` |
|
|
226
|
-
* | {@link LogLevel.Warning} | `2` |
|
|
227
|
-
* | {@link LogLevel.Info} | `3` |
|
|
228
|
-
* | {@link LogLevel.Debug} | `4` |
|
|
229
|
-
* | {@link LogLevel.Verbose} | `5` |
|
|
230
|
-
*
|
|
231
|
-
* __Example log data__
|
|
232
|
-
*
|
|
233
|
-
* ```text
|
|
234
|
-
* 09-19 11:12:18.716 ╔═════════════════════════════════════════════
|
|
235
|
-
* 09-19 11:12:18.716 ║ BackgroundGeolocation Service started
|
|
236
|
-
* 09-19 11:12:18.716 ╠═════════════════════════════════════════════
|
|
237
|
-
* 09-19 11:12:18.723 [c.t.l.BackgroundGeolocationService d]
|
|
238
|
-
* 09-19 11:12:18.723 ✅ Started in foreground
|
|
239
|
-
* 09-19 11:12:18.737 [c.t.l.ActivityRecognitionService a]
|
|
240
|
-
* 09-19 11:12:18.737 🎾 Start activity updates: 10000
|
|
241
|
-
* 09-19 11:12:18.761 [c.t.l.BackgroundGeolocationService k]
|
|
242
|
-
* 09-19 11:12:18.761 🔴 Stop heartbeat
|
|
243
|
-
* 09-19 11:12:18.768 [c.t.l.BackgroundGeolocationService a]
|
|
244
|
-
* 09-19 11:12:18.768 🎾 Start heartbeat (60)
|
|
245
|
-
* 09-19 11:12:18.778 [c.t.l.BackgroundGeolocationService a]
|
|
246
|
-
* 09-19 11:12:18.778 🔵 setPace: null → false
|
|
247
|
-
* 09-19 11:12:18.781 [c.t.l.adapter.TSConfig c] ℹ️ Persist config
|
|
248
|
-
* 09-19 11:12:18.794 [c.t.locationmanager.util.b a]
|
|
249
|
-
* 09-19 11:12:18.794 ℹ️ LocationAuthorization: Permission granted
|
|
250
|
-
* 09-19 11:12:18.842 [c.t.l.http.HttpService flush]
|
|
251
|
-
* 09-19 11:12:18.842 ╔═════════════════════════════════════════════
|
|
252
|
-
* 09-19 11:12:18.842 ║ HTTP Service
|
|
253
|
-
* 09-19 11:12:18.842 ╠═════════════════════════════════════════════
|
|
254
|
-
* 09-19 11:12:19.000 [c.t.l.BackgroundGeolocationService onActivityRecognitionResult] still (100%)
|
|
255
|
-
* 09-19 11:12:21.314 [c.t.l.l.SingleLocationRequest$2 onLocationResult]
|
|
256
|
-
* 09-19 11:12:21.314 ╔═════════════════════════════════════════════
|
|
257
|
-
* 09-19 11:12:21.314 ║ SingleLocationRequest: 1
|
|
258
|
-
* 09-19 11:12:21.314 ╠═════════════════════════════════════════════
|
|
259
|
-
* 09-19 11:12:21.314 ╟─ 📍 Location[fused 45.519239,-73.617058 hAcc=15]999923706055 vAcc=2 sAcc=??? bAcc=???
|
|
260
|
-
* 09-19 11:12:21.327 [c.t.l.l.TSLocationManager onSingleLocationResult]
|
|
261
|
-
* 09-19 11:12:21.327 🔵 Acquired motionchange position, isMoving: false
|
|
262
|
-
* 09-19 11:12:21.342 [c.t.l.l.TSLocationManager a] 15.243
|
|
263
|
-
* 09-19 11:12:21.405 [c.t.locationmanager.data.a.c persist]
|
|
264
|
-
* 09-19 11:12:21.405 ✅ INSERT: bca5acc8-e358-4d8f-827f-b8c0d556b7bb
|
|
265
|
-
* 09-19 11:12:21.423 [c.t.l.http.HttpService flush]
|
|
266
|
-
* 09-19 11:12:21.423 ╔═════════════════════════════════════════════
|
|
267
|
-
* 09-19 11:12:21.423 ║ HTTP Service
|
|
268
|
-
* 09-19 11:12:21.423 ╠═════════════════════════════════════════════
|
|
269
|
-
* 09-19 11:12:21.446 [c.t.locationmanager.data.a.c first]
|
|
270
|
-
* 09-19 11:12:21.446 ✅ Locked 1 records
|
|
271
|
-
* 09-19 11:12:21.454 [c.t.l.http.HttpService a]
|
|
272
|
-
* 09-19 11:12:21.454 🔵 HTTP POST: bca5acc8-e358-4d8f-827f-b8c0d556b7bb
|
|
273
|
-
* 09-19 11:12:22.083 [c.t.l.http.HttpService$a onResponse]
|
|
274
|
-
* 09-19 11:12:22.083 🔵 Response: 200
|
|
275
|
-
* 09-19 11:12:22.100 [c.t.locationmanager.data.a.c destroy]
|
|
276
|
-
* 09-19 11:12:22.100 ✅ DESTROY: bca5acc8-e358-4d8f-827f-b8c0d556b7bb
|
|
277
|
-
* 09-19 11:12:55.226 [c.t.l.BackgroundGeolocationService onActivityRecognitionResult] still (100%)
|
|
278
|
-
* ```
|
|
279
|
-
*
|
|
280
|
-
* @example
|
|
281
|
-
* ```ts
|
|
282
|
-
* BackgroundGeolocation.ready({
|
|
283
|
-
* logger: {
|
|
284
|
-
* logLevel: LogLevel.Verbose
|
|
285
|
-
* },
|
|
286
|
-
* });
|
|
287
|
-
* ```
|
|
288
|
-
*
|
|
289
|
-
* __See also__
|
|
290
|
-
* - {@link logMaxDays}
|
|
291
|
-
* - {@link Logger.getLog}
|
|
292
|
-
* - {@link Logger.emailLog}
|
|
293
|
-
* - {@link Logger.destroyLog}
|
|
294
|
-
*
|
|
295
|
-
* __⚠️ Warning__
|
|
296
|
-
* When submitting your app to production, configure `logLevel` appropriately
|
|
297
|
-
* (for example, {@link LogLevel.Error}),
|
|
298
|
-
* since logs can grow to several megabytes over {@link LoggerConfig.logMaxDays | logMaxDays}.
|
|
299
|
-
*
|
|
300
|
-
*/
|
|
301
4
|
logLevel?: LogLevel;
|
|
302
|
-
/**
|
|
303
|
-
* Maximum number of days to persist a log-entry in database.
|
|
304
|
-
*
|
|
305
|
-
* Defaults to **`3`** days.
|
|
306
|
-
*
|
|
307
|
-
* @example
|
|
308
|
-
* ```ts
|
|
309
|
-
* BackgroundGeolocation.ready({
|
|
310
|
-
* logger: {
|
|
311
|
-
* logMaxDays: 3
|
|
312
|
-
* }
|
|
313
|
-
* });
|
|
314
|
-
* ```
|
|
315
|
-
* **See also:**
|
|
316
|
-
* - {@link logLevel}
|
|
317
|
-
*/
|
|
318
5
|
logMaxDays?: number;
|
|
319
6
|
}
|