@transistorsoft/background-geolocation-types 5.0.0-beta.3 → 5.0.0-beta.5

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 (75) hide show
  1. package/dist/core/api/BackgroundGeolocation.d.ts +3 -1551
  2. package/dist/core/api/CurrentPositionRequest.d.ts +0 -36
  3. package/dist/core/api/DeviceSettings.d.ts +0 -63
  4. package/dist/core/api/Logger.d.ts +0 -400
  5. package/dist/core/api/State.d.ts +0 -63
  6. package/dist/core/api/TransistorAuthorizationService.d.ts +0 -110
  7. package/dist/core/config/ActivityConfig.d.ts +0 -260
  8. package/dist/core/config/AppConfig.d.ts +0 -581
  9. package/dist/core/config/AuthorizationConfig.d.ts +0 -191
  10. package/dist/core/config/Config.d.ts +1 -177
  11. package/dist/core/config/GeoConfig.d.ts +0 -876
  12. package/dist/core/config/HttpConfig.d.ts +0 -565
  13. package/dist/core/config/LocationFilter.d.ts +0 -256
  14. package/dist/core/config/LoggerConfig.d.ts +0 -313
  15. package/dist/core/config/NotificationConfig.d.ts +0 -504
  16. package/dist/core/config/PersistenceConfig.d.ts +0 -541
  17. package/dist/core/data/DeviceInfo.d.ts +0 -54
  18. package/dist/core/data/Geofence.d.ts +0 -5
  19. package/dist/core/data/Location.d.ts +0 -213
  20. package/dist/core/data/Sensors.d.ts +0 -22
  21. package/dist/core/events/AuthorizationEvent.d.ts +0 -9
  22. package/dist/core/events/ConnectivityChangeEvent.d.ts +0 -6
  23. package/dist/core/events/GeofenceEvent.d.ts +0 -10
  24. package/dist/core/events/GeofencesChangeEvent.d.ts +0 -7
  25. package/dist/core/events/HeadlessEvent.d.ts +0 -7
  26. package/dist/core/events/HeartbeatEvent.d.ts +0 -10
  27. package/dist/core/events/HttpEvent.d.ts +0 -8
  28. package/dist/core/events/MotionActivityEvent.d.ts +0 -7
  29. package/dist/core/events/MotionChangeEvent.d.ts +0 -7
  30. package/dist/core/events/ProviderChangeEvent.d.ts +0 -10
  31. package/dist/core/events/Subscription.d.ts +0 -83
  32. package/dist/docs-entry.js +0 -3
  33. package/dist/enums/AccuracyAuthorization.d.ts +0 -16
  34. package/dist/enums/AccuracyAuthorization.js +0 -12
  35. package/dist/enums/ActivityType.d.ts +0 -25
  36. package/dist/enums/ActivityType.js +0 -21
  37. package/dist/enums/AuthorizationStatus.d.ts +0 -16
  38. package/dist/enums/AuthorizationStatus.js +0 -13
  39. package/dist/enums/AuthorizationStrategy.d.ts +0 -9
  40. package/dist/enums/AuthorizationStrategy.js +0 -6
  41. package/dist/enums/DesiredAccuracy.d.ts +0 -6
  42. package/dist/enums/DesiredAccuracy.js +0 -5
  43. package/dist/enums/Event.d.ts +0 -9
  44. package/dist/enums/Event.js +0 -5
  45. package/dist/enums/GeofenceAction.d.ts +0 -17
  46. package/dist/enums/GeofenceAction.js +0 -13
  47. package/dist/enums/HttpMethod.d.ts +0 -7
  48. package/dist/enums/HttpMethod.js +0 -6
  49. package/dist/enums/KalmanProfile.d.ts +0 -26
  50. package/dist/enums/KalmanProfile.js +0 -25
  51. package/dist/enums/LocationError.d.ts +0 -19
  52. package/dist/enums/LocationError.js +0 -15
  53. package/dist/enums/LocationFilterPolicy.d.ts +0 -104
  54. package/dist/enums/LocationFilterPolicy.js +0 -103
  55. package/dist/enums/LocationRequest.d.ts +0 -19
  56. package/dist/enums/LocationRequest.js +0 -15
  57. package/dist/enums/LogLevel.d.ts +0 -20
  58. package/dist/enums/LogLevel.js +0 -16
  59. package/dist/enums/LogLevelName.d.ts +0 -6
  60. package/dist/enums/LogLevelName.js +0 -5
  61. package/dist/enums/MotionActivityType.d.ts +0 -6
  62. package/dist/enums/MotionActivityType.js +0 -5
  63. package/dist/enums/NotificationPriority.d.ts +0 -16
  64. package/dist/enums/NotificationPriority.js +0 -15
  65. package/dist/enums/PersistMode.d.ts +0 -7
  66. package/dist/enums/PersistMode.js +0 -6
  67. package/dist/enums/SQLQueryOrder.d.ts +0 -11
  68. package/dist/enums/SQLQueryOrder.js +0 -10
  69. package/dist/enums/TrackingMode.d.ts +0 -11
  70. package/dist/enums/TrackingMode.js +0 -10
  71. package/dist/enums/TriggerActivity.d.ts +0 -7
  72. package/dist/enums/TriggerActivity.js +0 -6
  73. package/dist/index.js +0 -4
  74. package/dist/legacy/LegacyConfig.d.ts +0 -19
  75. package/package.json +1 -1
@@ -1,44 +1,8 @@
1
- /**
2
- * Options provided to {@link BackgroundGeolocation.getCurrentPosition}.
3
- *
4
- * @example
5
- * ```typescript
6
- * let location = await BackgroundGeolocation.getCurrentPosition({
7
- * timeout: 30, // 30 second timeout to fetch location
8
- * persist: true, // Defaults to state.enabled
9
- * maximumAge: 5000, // Accept the last-known-location if not older than 5000 ms.
10
- * desiredAccuracy: 10, // Try to fetch a location with an accuracy of `10` meters.
11
- * samples: 3, // How many location samples to attempt.
12
- * extras: { // Custom meta-data.
13
- * "route_id": 123
14
- * }
15
- * });
16
- * ```
17
- * @category Primary API
18
- */
19
1
  export interface CurrentPositionRequest {
20
- /**
21
- * Sets the maximum number of location-samples to fetch before returning the best possible location to your `callback`. Default is `3`. Only the final Location will be persisted.
22
- */
23
2
  samples?: number;
24
- /**
25
- * Sets the desired accuracy of location you're attempting to fetch. When a location having `accuracy <= desiredAccuracy` is retrieved, the plugin will stop sampling and immediately return that location. Defaults to your configured [[Config.stationaryRadius]].
26
- */
27
3
  desiredAccuracy?: number;
28
- /**
29
- * Location-timeout in `seconds`. Default: `30`. If the timeout expires before a [[Location]] is retrieved, a [[LocationError]] will fire.
30
- */
31
4
  timeout?: number;
32
- /**
33
- * Defaults to `true` when plugin is `enabled`; `false`, otherwise. Set `false` to disable persisting the retrieved Location in the plugin's SQLite database.
34
- */
35
5
  persist?: boolean;
36
- /**
37
- * Accept the last-recorded-location if no older than supplied value in `milliseconds`. Default is `0`.
38
- */
39
6
  maximumAge?: number;
40
- /**
41
- * Optional meta-data to attach to the location. These `extras` will be merged to the configured [[Config.extras]] and persisted / POSTed to your server (if you've configured a [[Config.url]].
42
- */
43
7
  extras?: Record<string, any>;
44
8
  }
@@ -1,77 +1,14 @@
1
- /**
2
- * An object for redirecting a User to an Android device's settings screen from a {@link DeviceSettings} request.
3
- *
4
- * Contains meta-data about the device (`manufacturer`, `model`, `version`) and whether you’ve already shown this screen.
5
- *
6
- * @category Device
7
- */
8
1
  export interface DeviceSettingsRequest {
9
- /** Device manufacturer (e.g., "Huawei", "Samsung"). */
10
2
  manufacturer: string;
11
- /** Device model (e.g., "P40", "SM-G991B"). */
12
3
  model: string;
13
- /** OS version string. */
14
4
  version: string;
15
- /** Whether this screen has previously been shown. */
16
5
  seen: boolean;
17
- /** Timestamp of when this screen was last shown. */
18
6
  lastSeenAt: Date;
19
- /**
20
- * The settings screen action to be shown.
21
- * ⚠️ Set automatically by the native layer.
22
- */
23
7
  action: string;
24
8
  }
25
- /**
26
- * Device Settings API (types-only).
27
- *
28
- * Provides an API to show Android & vendor-specific Battery / Power Management settings screens that can
29
- * affect performance of the Background Geolocation SDK on various devices.
30
- *
31
- * See: https://dontkillmyapp.com/
32
- *
33
- * @example
34
- * ```ts
35
- * // Is Android device ignoring battery optimizations?
36
- * const isIgnoring = await BackgroundGeolocation.deviceSettings.isIgnoringBatteryOptimizations();
37
- * if (!isIgnoring) {
38
- * const req = await BackgroundGeolocation.deviceSettings.showIgnoreBatteryOptimizations();
39
- * if (!req.seen) {
40
- * const confirmed = await showMyConfirmDialog({ title: 'Settings request', text: 'Please disable battery optimizations' });
41
- * if (confirmed) {
42
- * await BackgroundGeolocation.deviceSettings.show(req);
43
- * }
44
- * }
45
- * }
46
- * ```
47
- * @category Device
48
- */
49
9
  export interface DeviceSettings {
50
- /**
51
- * Returns `true` if device is ignoring battery optimizations for your app.
52
- *
53
- * In most cases, the SDK performs normally with battery optimizations enabled.
54
- */
55
10
  isIgnoringBatteryOptimizations(): Promise<boolean>;
56
- /**
57
- * Prepare a request to show Android’s *Ignore Battery Optimizations* settings screen.
58
- *
59
- * Does **not** immediately redirect — returns a {@link DeviceSettingsRequest} first so you can
60
- * decide whether to prompt the user (eg: avoid annoying them if `seen === true`).
61
- *
62
- * ⚠️ On some devices/OS versions, this screen may not exist; callers should `catch` errors.
63
- */
64
11
  showIgnoreBatteryOptimizations(): Promise<DeviceSettingsRequest>;
65
- /**
66
- * Prepare a request to show a vendor-specific “Power Manager” screen (Huawei, Xiaomi, Vivo, etc).
67
- *
68
- * Does **not** immediately redirect — returns a {@link DeviceSettingsRequest} first.
69
- * Not all vendors/versions implement this screen; callers should `catch` errors.
70
- */
71
12
  showPowerManager(): Promise<DeviceSettingsRequest>;
72
- /**
73
- * Execute a previously prepared {@link DeviceSettingsRequest} to actually show the screen.
74
- * Resolves `true` if the redirect was attempted.
75
- */
76
13
  show(request: DeviceSettingsRequest): Promise<boolean>;
77
14
  }
@@ -1,421 +1,21 @@
1
1
  import { SQLQueryOrder } from "../../enums/SQLQueryOrder";
2
- /**
3
- * Used for selecting a range of records from the SDK's log database.
4
- *
5
- * Used with:
6
- * - {@link Logger.getLog}
7
- * - {@link Logger.emailLog}
8
- * - {@link Logger.uploadLog}
9
- *
10
- * ```ts
11
- * // Constrain results between optional start/end dates using an SQLQuery
12
- * const log = await BackgroundGeolocation.logger.getLog({
13
- * start: Date.parse("2019-10-21 13:00"), // <-- optional HH:mm:ss
14
- * end: Date.parse("2019-10-22")
15
- * });
16
- *
17
- * // Or just a start date
18
- * const partial = await BackgroundGeolocation.logger.getLog({
19
- * start: Date.parse("2019-10-21 13:00")
20
- * });
21
- *
22
- * // Or just an end date
23
- * await BackgroundGeolocation.logger.uploadLog("https://my.server.com/users/123/logs", {
24
- * end: Date.parse("2019-10-21")
25
- * });
26
- *
27
- * // Select first 100 records from log (ascending)
28
- * const Logger = BackgroundGeolocation.logger;
29
- * await Logger.emailLog("foo@bar.com", {
30
- * order: SQLQueryOrder.Asc,
31
- * limit: 100
32
- * });
33
- *
34
- * // Select most recent 100 records from log (descending)
35
- * await Logger.emailLog("foo@bar.com", {
36
- * order: SQLQueryOrder.Desc,
37
- * limit: 100
38
- * });
39
- * ```
40
- *
41
- * @category Logger
42
- */
43
2
  export interface SQLQuery {
44
- /**
45
- * Start date of logs to select (unix timestamp in **milliseconds**).
46
- */
47
3
  start?: number;
48
- /**
49
- * End date of logs to select (unix timestamp in **milliseconds**).
50
- */
51
4
  end?: number;
52
- /**
53
- * Limit number of records returned.
54
- */
55
5
  limit?: number;
56
- /**
57
- * Offset into the result set (for paging).
58
- */
59
6
  offset?: number;
60
- /**
61
- * Sort order for results.
62
- *
63
- * - `SQLQueryOrder.Asc` → ascending by time
64
- * - `SQLQueryOrder.Desc` → descending by time
65
- *
66
- * Historically this corresponded to:
67
- * - `1` = ASC
68
- * - `-1` = DESC
69
- */
70
7
  order?: SQLQueryOrder;
71
8
  }
72
- /**
73
- * Logger API
74
- *
75
- * The Background Geolocation SDK includes powerful logging features for debugging location-tracking problems. The SDK stores log-entries for a period of {@link LoggerConfig.logMaxDays} (default `3`). The volume of logging events
76
- * inserted into the database is controlled via {@link LoggerConfig.logLevel}.
77
- *
78
- * For more information, see the 📘[Debugging Guide](github:wiki/Debugging).
79
- *
80
- * The `Logger` API is accessed via {@link BackgroundGeolocation.logger} property:
81
- *
82
- * @example
83
- * ```typescript
84
- * let Logger = BackgroundGeolocation.logger;
85
- * let log = await Logger.getLog();
86
- * ```
87
- *
88
- * ## Fetching the Logs:
89
- *
90
- * Logs can be fetched from the SDK in three ways:
91
- * 1. [[getLog]]
92
- * 2. [[emailLog]]
93
- * 3. [[uploadLog]]
94
- *
95
- * ## Inserting your own log messages
96
- *
97
- * You can even insert your own log messages into the SDK's Log database using the following methods:
98
- *
99
- * | method | logLevel | icon |
100
- * |--------------|----------|-----------------|
101
- * |[[error]] |`ERROR` | ❗️ |
102
- * |[[warn]] |`WARNING` | ⚠️ |
103
- * |[[debug]] |`DEBUG` | 🐞 |
104
- * |[[info]] |`INFO` | ℹ️ |
105
- * |[[notice]] |`INFO` | 🔵 |
106
- *
107
- * @example
108
- * ```typescript
109
- * let Logger = BackgroundGeolocation.logger;
110
- * BackgroundGeolocation.onLocation((location) => {
111
- * Logger.debug("Location received in Javascript: " + location.uuid);
112
- * });
113
- * ```
114
- *
115
- * __Example Logs__
116
- *
117
- * ```
118
- * 09-19 11:12:18.716 ╔═════════════════════════════════════════════
119
- * 09-19 11:12:18.716 ║ BackgroundGeolocation Service started
120
- * 09-19 11:12:18.716 ╠═════════════════════════════════════════════
121
- * 09-19 11:12:18.723 [c.t.l.BackgroundGeolocationService d]
122
- * 09-19 11:12:18.723 ✅ Started in foreground
123
- * 09-19 11:12:18.737 [c.t.l.ActivityRecognitionService a]
124
- * 09-19 11:12:18.737 🎾 Start activity updates: 10000
125
- * 09-19 11:12:18.761 [c.t.l.BackgroundGeolocationService k]
126
- * 09-19 11:12:18.761 🔴 Stop heartbeat
127
- * 09-19 11:12:18.768 [c.t.l.BackgroundGeolocationService a]
128
- * 09-19 11:12:18.768 🎾 Start heartbeat (60)
129
- * 09-19 11:12:18.778 [c.t.l.BackgroundGeolocationService a]
130
- * 09-19 11:12:18.778 🔵 setPace: null → false
131
- * 09-19 11:12:18.781 [c.t.l.adapter.TSConfig c] ℹ️ Persist config
132
- * 09-19 11:12:18.794 [c.t.locationmanager.util.b a]
133
- * 09-19 11:12:18.794 ℹ️ LocationAuthorization: Permission granted
134
- * 09-19 11:12:18.842 [c.t.l.http.HttpService flush]
135
- * 09-19 11:12:18.842 ╔═════════════════════════════════════════════
136
- * 09-19 11:12:18.842 ║ HTTP Service
137
- * 09-19 11:12:18.842 ╠═════════════════════════════════════════════
138
- * 09-19 11:12:19.000 [c.t.l.BackgroundGeolocationService onActivityRecognitionResult] still (100%)
139
- * 09-19 11:12:21.314 [c.t.l.l.SingleLocationRequest$2 onLocationResult]
140
- * 09-19 11:12:21.314 ╔═════════════════════════════════════════════
141
- * 09-19 11:12:21.314 ║ SingleLocationRequest: 1
142
- * 09-19 11:12:21.314 ╠═════════════════════════════════════════════
143
- * 09-19 11:12:21.314 ╟─ 📍 Location[fused 45.519239,-73.617058 hAcc=15]999923706055 vAcc=2 sAcc=??? bAcc=???
144
- * 09-19 11:12:21.327 [c.t.l.l.TSLocationManager onSingleLocationResult]
145
- * 09-19 11:12:21.327 🔵 Acquired motionchange position, isMoving: false
146
- * 09-19 11:12:21.342 [c.t.l.l.TSLocationManager a] 15.243
147
- * 09-19 11:12:21.405 [c.t.locationmanager.data.a.c persist]
148
- * 09-19 11:12:21.405 ✅ INSERT: bca5acc8-e358-4d8f-827f-b8c0d556b7bb
149
- * 09-19 11:12:21.423 [c.t.l.http.HttpService flush]
150
- * 09-19 11:12:21.423 ╔═════════════════════════════════════════════
151
- * 09-19 11:12:21.423 ║ HTTP Service
152
- * 09-19 11:12:21.423 ╠═════════════════════════════════════════════
153
- * 09-19 11:12:21.446 [c.t.locationmanager.data.a.c first]
154
- * 09-19 11:12:21.446 ✅ Locked 1 records
155
- * 09-19 11:12:21.454 [c.t.l.http.HttpService a]
156
- * 09-19 11:12:21.454 🔵 HTTP POST: bca5acc8-e358-4d8f-827f-b8c0d556b7bb
157
- * 09-19 11:12:22.083 [c.t.l.http.HttpService$a onResponse]
158
- * 09-19 11:12:22.083 🔵 Response: 200
159
- * 09-19 11:12:22.100 [c.t.locationmanager.data.a.c destroy]
160
- * 09-19 11:12:22.100 ✅ DESTROY: bca5acc8-e358-4d8f-827f-b8c0d556b7bb
161
- * 09-19 11:12:55.226 [c.t.l.BackgroundGeolocationService onActivityRecognitionResult] still (100%)
162
- * ```
163
- *
164
- * @category Logger
165
- */
166
9
  export interface Logger {
167
- /** Sort ascending when querying logs. Mirrors {@link Logger.ORDER_ASC} constant. */
168
10
  readonly ORDER_ASC: 1;
169
- /** Sort descending when querying logs. Mirrors {@link Logger.ORDER_DESC} constant. */
170
11
  readonly ORDER_DESC: -1;
171
- /**
172
- * Inserts a debug log message into the SDK's log database
173
- *
174
- * @example
175
- * ```typescript
176
- * BackgroundGeolocation.logger.debug("This is a debug message");
177
- * ```
178
- * &nbsp;
179
- * ```
180
- * D TSLocationManager: [c.t.l.logger.TSLog log] This is a debug message
181
- * ```
182
- */
183
12
  debug(message: string): void;
184
- /**
185
- * Inserts an "error" log message into the SDK's log database
186
- *
187
- * @example
188
- * ```typescript
189
- * BackgroundGeolocation.logger.error("Something BAD");
190
- * ```
191
- * &nbsp;
192
- * ```
193
- * E TSLocationManager: [c.t.l.logger.TSLog log]
194
- * E TSLocationManager: ‼ Something BAD
195
- * ```
196
- */
197
13
  error(message: string): void;
198
- /**
199
- * Inserts a "warning" log message into the SDK's log database
200
- *
201
- * @example
202
- * ```typescript
203
- * BackgroundGeolocation.logger.warn("Something WEIRD");
204
- * ```
205
- * &nbsp;
206
- *
207
- * ```
208
- * E TSLocationManager: [c.t.l.logger.TSLog log]
209
- * E TSLocationManager: ⚠️ Something WEIRD
210
- * ```
211
- */
212
14
  warn(message: string): void;
213
- /**
214
- * Inserts an "info" log message into the SDK's log database
215
- *
216
- * @example
217
- * ```typescript
218
- * BackgroundGeolocation.logger.info("Something informative");
219
- * ```
220
- * &nbsp;
221
- * ```
222
- * E TSLocationManager: [c.t.l.logger.TSLog log]
223
- * I TSLocationManager: ℹ️ Something informative
224
- * ```
225
- */
226
15
  info(message: string): void;
227
- /**
228
- * Inserts a "notice" log message into the SDK's log database
229
- *
230
- * @example
231
- * ```typescript
232
- * BackgroundGeolocation.logger.notice("A Notice");
233
- * ```
234
- * &nbsp;
235
- * ```
236
- * E TSLocationManager: [c.t.l.logger.TSLog log]
237
- * I TSLocationManager: 🔵 A Notice
238
- * ```
239
- */
240
16
  notice(message: string): void;
241
- /**
242
- * Returns the records from log database as a `String`. Provide an optional {@link SQLQuery} to contrain results between dates.
243
- *
244
- * Depending on the configured {@link LoggerConfig.logLevel}, the plugin can store an *immense* amount of helpful logging information for debugging location-tracking
245
- * problems.
246
- *
247
- * __ℹ️ See also:__
248
- * - {@link LoggerConfig.logMaxDays} (default `3` days)
249
- * - {@link LoggerConfig.logLevel} (default {@link LogLevel.Off})
250
- * - {@link emailLog}
251
- * - {@link uploadLog}
252
- * - {@link getLog}
253
- * - 📘[Debugging Guide](github:wiki/Debugging)
254
- *
255
- * @example
256
- * ```typescript
257
- * BackgroundGeolocation.logger.getLog().then((log) => {
258
- * // Warning: this string could be several megabytes.
259
- * console.log("[log] success: ", log);
260
- * });
261
- *
262
- * // Or constrain results by providing a SQLQuery
263
- * let Logger = BackgroundGeolocation.logger;
264
- *
265
- * let log = await Logger.getLog({
266
- * start: Date.parse("2019-09-19 11:12"),
267
- * end: Date.parse("2019-09-19 11:13"),
268
- * order: Logger.ORDER_ASC,
269
- * limit: 100
270
- * });
271
- * ```
272
- *
273
- * ```
274
- * 09-19 11:12:18.716 ╔═════════════════════════════════════════════
275
- * 09-19 11:12:18.716 ║ BackgroundGeolocation Service started
276
- * 09-19 11:12:18.716 ╠═════════════════════════════════════════════
277
- * 09-19 11:12:18.723 [c.t.l.BackgroundGeolocationService d]
278
- * 09-19 11:12:18.723 ✅ Started in foreground
279
- * 09-19 11:12:18.737 [c.t.l.ActivityRecognitionService a]
280
- * 09-19 11:12:18.737 🎾 Start activity updates: 10000
281
- * 09-19 11:12:18.761 [c.t.l.BackgroundGeolocationService k]
282
- * 09-19 11:12:18.761 🔴 Stop heartbeat
283
- * 09-19 11:12:18.768 [c.t.l.BackgroundGeolocationService a]
284
- * 09-19 11:12:18.768 🎾 Start heartbeat (60)
285
- * 09-19 11:12:18.778 [c.t.l.BackgroundGeolocationService a]
286
- * 09-19 11:12:18.778 🔵 setPace: null → false
287
- * 09-19 11:12:18.781 [c.t.l.adapter.TSConfig c] ℹ️ Persist config
288
- * 09-19 11:12:18.794 [c.t.locationmanager.util.b a]
289
- * 09-19 11:12:18.794 ℹ️ LocationAuthorization: Permission granted
290
- * 09-19 11:12:18.842 [c.t.l.http.HttpService flush]
291
- * 09-19 11:12:18.842 ╔═════════════════════════════════════════════
292
- * 09-19 11:12:18.842 ║ HTTP Service
293
- * 09-19 11:12:18.842 ╠═════════════════════════════════════════════
294
- * 09-19 11:12:19.000 [c.t.l.BackgroundGeolocationService onActivityRecognitionResult] still (100%)
295
- * 09-19 11:12:21.314 [c.t.l.l.SingleLocationRequest$2 onLocationResult]
296
- * 09-19 11:12:21.314 ╔═════════════════════════════════════════════
297
- * 09-19 11:12:21.314 ║ SingleLocationRequest: 1
298
- * 09-19 11:12:21.314 ╠═════════════════════════════════════════════
299
- * 09-19 11:12:21.314 ╟─ 📍 Location[fused 45.519239,-73.617058 hAcc=15]999923706055 vAcc=2 sAcc=??? bAcc=???
300
- * 09-19 11:12:21.327 [c.t.l.l.TSLocationManager onSingleLocationResult]
301
- * 09-19 11:12:21.327 🔵 Acquired motionchange position, isMoving: false
302
- * 09-19 11:12:21.342 [c.t.l.l.TSLocationManager a] 15.243
303
- * 09-19 11:12:21.405 [c.t.locationmanager.data.a.c persist]
304
- * 09-19 11:12:21.405 ✅ INSERT: bca5acc8-e358-4d8f-827f-b8c0d556b7bb
305
- * 09-19 11:12:21.423 [c.t.l.http.HttpService flush]
306
- * 09-19 11:12:21.423 ╔═════════════════════════════════════════════
307
- * 09-19 11:12:21.423 ║ HTTP Service
308
- * 09-19 11:12:21.423 ╠═════════════════════════════════════════════
309
- * 09-19 11:12:21.446 [c.t.locationmanager.data.a.c first]
310
- * 09-19 11:12:21.446 ✅ Locked 1 records
311
- * 09-19 11:12:21.454 [c.t.l.http.HttpService a]
312
- * 09-19 11:12:21.454 🔵 HTTP POST: bca5acc8-e358-4d8f-827f-b8c0d556b7bb
313
- * 09-19 11:12:22.083 [c.t.l.http.HttpService$a onResponse]
314
- * 09-19 11:12:22.083 🔵 Response: 200
315
- * 09-19 11:12:22.100 [c.t.locationmanager.data.a.c destroy]
316
- * 09-19 11:12:22.100 ✅ DESTROY: bca5acc8-e358-4d8f-827f-b8c0d556b7bb
317
- * 09-19 11:12:55.226 [c.t.l.BackgroundGeolocationService onActivityRecognitionResult] still (100%)
318
- *```
319
- */
320
17
  getLog(query?: SQLQuery): Promise<string>;
321
- /**
322
- * Email the result of {@link Logger.getLog} using device's mail client.
323
- *
324
- * @example
325
- * ```typescript
326
- * let Logger = BackgroundGeolocation.logger;
327
- * Logger.emailLog("foo@bar.com").then((success) => {
328
- * console.log("[emailLog] success");
329
- * }).catch((error) => {
330
- * console.log("[emailLog] FAILURE: ", error);
331
- * });
332
- *
333
- * // Or constrain results by providing a SQLQuery
334
- * Logger.emailLog("foo@bar.com", {
335
- * start: Date.parse("2019-09-19"),
336
- * end: Date.parse("2019-09-20"),
337
- * order: Logger.ORDER_ASC,
338
- * limit: 1000
339
- * });
340
- * ```
341
- *
342
- * __ℹ️ See also:__
343
- * - {@link LoggerConfig.logLevel}
344
- * - {@link Logger.getLog}
345
- * - {@link Logger.uploadLog}
346
- * - 📘[Debugging Guide](github:wiki/Debugging).
347
- */
348
18
  emailLog(email: string, query?: SQLQuery): Promise<void | boolean>;
349
- /**
350
- * Upload the result of {@link getLog} to provided url. Provide an optional {@link SQLQuery} to contrain results between dates. The file-upload
351
- * request will attach your configured {@link HttpConfig.headers} for authentication.
352
- *
353
- * @example
354
- *
355
- * ```typescript
356
- * BackgroundGeolocation.logger.uploadLog("https://my.server.com/users/123/logs").then((success) => {
357
- * console.log("[uploadLog] success");
358
- * }).catch((error) => {
359
- * console.log("[uploadLog] FAILURE:", error);
360
- * });
361
- *
362
- * // Or constrain results by providing a [SQLQuery]:
363
- * BackgroundGeolocation.logger.uploadLog("https://my.server.com/users/123/logs", {
364
- * start: Date.parse("2019-10-20 09:00"),
365
- * end: Date.parse("2019-10-20 11:59")
366
- * }).then((success) => {
367
- * console.log("[uploadLog] success");
368
- * }).catch((error) => {
369
- * console.log("[uploadLog] FAILURE:", error);
370
- * });
371
- * ```
372
- *
373
- * __MultiPart File Upload__
374
- * The SDK will upload the gzipped log-file to your server as a *Multi-part* file upload, the same log-file as used in {@link emailLog}. This is what I see with my [Node server](https://github.com/transistorsoft/background-geolocation-console) at `request.files`:
375
- *
376
- * ```typescript
377
- * app.post("/log", async function(req, res) {
378
- * console.log("[body]: ", req.body);
379
- * console.log("[files]: ", req.files);
380
- * res.status(200).send();
381
- * });
382
- * ```
383
- * ![](https://dl.dropbox.com/s/cn86cu0vieor0j4/uploadLog-npm-server-request.png?dl=1)
384
- *
385
- * __Form Part__
386
- *
387
- * In addition to the log-file, the SDK will upload a form as well, containing the following parameters:
388
- *
389
- * | Key | Value |
390
- * |--------------|------------------------------------------|
391
- * | **`state`** | *JSON-encoded result of SDK's `#getState`*|
392
- * | **`model`** | *Device model* |
393
- * | **`manufacturer`** | *Device manufacturer* |
394
- * | **`platform`** | *iOS or Android* |
395
- * | **`version`** | *OS version* |
396
- *
397
- * ### ℹ️ See also:
398
- * - {@link LoggerConfig.logLevel}
399
- * - {@link getLog}
400
- * - {@link emailLog}
401
- * - {@link destroyLog}
402
- * - 📘[Debugging Guide](github:wiki/Debugging).
403
- */
404
19
  uploadLog(url: string, query?: SQLQuery): Promise<void | boolean>;
405
- /**
406
- * Destroy the entire contents of SDK's log database.
407
- *
408
- * @example
409
- * ```typescript
410
- * BackgroundGeolocation.logger.destroyLog();
411
- * ```
412
- *
413
- * __ℹ️ See also:__
414
- * - {@link LoggerConfig.logLevel}
415
- * - {@link getLog}
416
- * - {@link emailLog}
417
- * - {@link uploadLog}
418
- * - 📘[Debugging Guide](github:wiki/Debugging)
419
- */
420
20
  destroyLog(): Promise<void>;
421
21
  }
@@ -1,75 +1,12 @@
1
1
  import type { Config } from '../config/Config';
2
2
  import type { TrackingMode } from '../../enums/TrackingMode';
3
- /**
4
- * Effective runtime state returned by `BackgroundGeolocation.ready/getState`.
5
- *
6
- * `State` **is** the active {@link Config} (compound), plus runtime-only fields.
7
- *
8
- * @category Primary API
9
- */
10
3
  export interface State extends Config {
11
- /** Whether the SDK has been enabled via `start` or `startGeofences`. */
12
4
  enabled: boolean;
13
- /**
14
- * Whether the SDK is currently in the *moving* state (vs stationary).
15
- *
16
- * @example
17
- * ```typescript
18
- * // If the SDK is currently in the *stationary* state, with State.isMoving == false:
19
- *
20
- * BackgroundGeolocation.onMotionChange((isMoving) => {
21
- * console.log('[onMotionChange] isMoving?', isMoving);
22
- * });
23
- *
24
- * await BackgroundGeolocation.changePace(true);
25
- * // State.isMoving is now true.
26
- * ```
27
- */
28
5
  isMoving: boolean;
29
- /**
30
- * `true` when a schedule is configured and `startSchedule()` executed.
31
- * `stopSchedule()` will set this to `false`.
32
- */
33
6
  schedulerEnabled: boolean;
34
- /**
35
- * Tracking mode.
36
- *
37
- * | Value | Name | Description |
38
- * |------:|------------|-------------------------------|
39
- * | 0 | Geofences | Monitor geofences only. |
40
- * | 1 | Location | Monitor location + geofences. |
41
- *
42
- * @example
43
- * ```typescript
44
- * await BackgroundGeolocation.start();
45
- *
46
- * const state = await BackgroundGeolocation.getState();
47
- * console.log('Tracking mode:', state.trackingMode);
48
- * > 'Tracking mode: 1'
49
- *
50
- * await BackgroundGeolocation.startGeofences();
51
- * console.log('Tracking mode:', state.trackingMode);
52
- * > 'Tracking mode: 0'
53
- * ```
54
- */
55
7
  trackingMode: TrackingMode;
56
- /**
57
- * Current distance-traveled in meters.
58
- * See: {@link odometerError}, {@link BackgroundGeolocation.setOdometer}, {@link BackgroundGeolocation.getOdometer}.
59
- */
60
8
  odometer: number;
61
- /**
62
- * The accumulated error in the odometer (in meters).
63
- */
64
9
  odometerError: number;
65
- /**
66
- * iOS only. `true` when the app was launched in the background due to a
67
- * background event (fetch, geofence exit, stationary geofence exit).
68
- * Always `false` on Android.
69
- */
70
10
  didLaunchInBackground: boolean;
71
- /**
72
- * Indicates if the app was launched after a device reboot.
73
- */
74
11
  didDeviceReboot: boolean;
75
12
  }