@mojro/react-native-gnss-tracking-health 0.0.0-stage → 0.1.0

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.
@@ -0,0 +1,118 @@
1
+ import { useCallback, useEffect, useState } from "react";
2
+ import trackingQualityMonitor from "../TrackingQualityMonitor";
3
+
4
+ /**
5
+ * Primary integration hook for a tracking-quality screen.
6
+ * Returns the full status object + control helpers + latest alert/action.
7
+ */
8
+ export function useTrackingQuality({ autoStart = false, tripId = null } = {}) {
9
+ const [status, setStatus] = useState(() =>
10
+ trackingQualityMonitor.getStatus()
11
+ );
12
+ const [lastAlert, setLastAlert] = useState(null);
13
+ const [lastAction, setLastAction] = useState(null);
14
+ const [actions, setActions] = useState([]);
15
+
16
+ useEffect(() => {
17
+ const unsubStatus = trackingQualityMonitor.onStatus(setStatus);
18
+ const unsubAlert = trackingQualityMonitor.onAlert((alert) => {
19
+ setLastAlert(alert);
20
+ });
21
+ const unsubAction = trackingQualityMonitor.onAction((action) => {
22
+ setLastAction(action);
23
+ setActions((prev) => [action, ...prev].slice(0, 100));
24
+ });
25
+
26
+ setStatus(trackingQualityMonitor.getStatus());
27
+
28
+ let cancelled = false;
29
+ if (autoStart) {
30
+ trackingQualityMonitor
31
+ .start({ tripId })
32
+ .then((s) => {
33
+ if (!cancelled) setStatus(s);
34
+ })
35
+ .catch(() => {});
36
+ }
37
+
38
+ return () => {
39
+ cancelled = true;
40
+ unsubStatus();
41
+ unsubAlert();
42
+ unsubAction();
43
+ };
44
+ }, [autoStart, tripId]);
45
+
46
+ const start = useCallback(async (opts = {}) => {
47
+ const s = await trackingQualityMonitor.start(opts);
48
+ setStatus(s);
49
+ return s;
50
+ }, []);
51
+
52
+ const stop = useCallback(async (opts = {}) => {
53
+ await trackingQualityMonitor.stop(opts);
54
+ setStatus(trackingQualityMonitor.getStatus());
55
+ }, []);
56
+
57
+ const onTripStarted = useCallback((id) => {
58
+ trackingQualityMonitor.onTripStarted(id);
59
+ setStatus(trackingQualityMonitor.getStatus());
60
+ }, []);
61
+
62
+ const ingestLocation = useCallback((location) => {
63
+ trackingQualityMonitor.ingestLocation(location);
64
+ }, []);
65
+
66
+ const evaluateDeviceFitness = useCallback(async (opts) => {
67
+ const fit = await trackingQualityMonitor.evaluateDeviceFitness(opts);
68
+ setStatus(trackingQualityMonitor.getStatus());
69
+ return fit;
70
+ }, []);
71
+
72
+ const evaluateDeviceFitnessOnLogin = useCallback(async (opts) => {
73
+ const fit = await trackingQualityMonitor.evaluateDeviceFitnessOnLogin(opts);
74
+ setStatus(trackingQualityMonitor.getStatus());
75
+ return fit;
76
+ }, []);
77
+
78
+ const setLocationTrackingActive = useCallback((active) => {
79
+ trackingQualityMonitor.setLocationTrackingActive(active);
80
+ setStatus(trackingQualityMonitor.getStatus());
81
+ }, []);
82
+
83
+ const heartbeat = useCallback(() => {
84
+ trackingQualityMonitor.heartbeat();
85
+ }, []);
86
+
87
+ return {
88
+ /** Full screen payload */
89
+ status,
90
+ running: !!status?.running,
91
+ locationTrackingActive: !!status?.locationTrackingActive,
92
+ platform: status?.platform,
93
+ apiLevel: status?.apiLevel,
94
+ gnssSupported: !!status?.gnssSupported,
95
+ gnssListening: !!status?.gnssListening,
96
+ tripId: status?.tripId,
97
+ tripStartMaxSats: status?.tripStartMaxSats,
98
+ tripStartSatWindowFired: !!status?.tripStartSatWindowFired,
99
+ deviceFitness: status?.deviceFitness,
100
+ latestGnss: status?.latestGnss,
101
+ latestSystem: status?.latestSystem,
102
+ lastLocation: status?.lastLocation,
103
+ recentAlerts: status?.recentAlerts || [],
104
+ lastAlert,
105
+ lastAction,
106
+ actions,
107
+ start,
108
+ stop,
109
+ onTripStarted,
110
+ ingestLocation,
111
+ evaluateDeviceFitness,
112
+ evaluateDeviceFitnessOnLogin,
113
+ setLocationTrackingActive,
114
+ heartbeat,
115
+ getStatus: () => trackingQualityMonitor.getStatus(),
116
+ monitor: trackingQualityMonitor,
117
+ };
118
+ }
@@ -0,0 +1,22 @@
1
+ import { useEffect, useState } from "react";
2
+ import trackingQualityMonitor from "../TrackingQualityMonitor";
3
+
4
+ /**
5
+ * Subscribe only to alerts raised by the monitor.
6
+ */
7
+ export function useTrackingQualityAlerts({ max = 20 } = {}) {
8
+ const [alerts, setAlerts] = useState(
9
+ () => trackingQualityMonitor.getStatus().recentAlerts || []
10
+ );
11
+ const [lastAlert, setLastAlert] = useState(null);
12
+
13
+ useEffect(() => {
14
+ const unsub = trackingQualityMonitor.onAlert((alert) => {
15
+ setLastAlert(alert);
16
+ setAlerts((prev) => [alert, ...prev].slice(0, max));
17
+ });
18
+ return unsub;
19
+ }, [max]);
20
+
21
+ return { alerts, lastAlert };
22
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,476 @@
1
+ import type { ComponentType } from "react";
2
+
3
+ export type AlertSeverity = "blocker" | "warning" | "info";
4
+
5
+ export interface TrackingQualityAlert {
6
+ type: string;
7
+ severity: AlertSeverity;
8
+ title: string;
9
+ message: string;
10
+ meta?: Record<string, unknown>;
11
+ tripId?: string | null;
12
+ at: number;
13
+ gnss?: {
14
+ satellitesVisible?: number;
15
+ satellitesUsedInFix?: number;
16
+ } | null;
17
+ }
18
+
19
+ export interface DeviceFitnessResult {
20
+ platform: string;
21
+ apiLevel: number | null;
22
+ apiScore: string;
23
+ apiReason: string;
24
+ gnssCapability: Record<string, unknown>;
25
+ settingsIssues: string[];
26
+ fitness: string;
27
+ capableForTracking: boolean;
28
+ thresholds: Record<string, number>;
29
+ assessedAt: number;
30
+ }
31
+
32
+ export interface SystemHealthResult {
33
+ platform: string;
34
+ powerSaveMode: boolean;
35
+ lowPowerMode: boolean;
36
+ batteryOptimizationEnabled: boolean;
37
+ batteryOptimizationIgnored: boolean;
38
+ batteryLevel: number | null;
39
+ lowBatteryMode: boolean;
40
+ autoDateTimeEnabled: boolean | null;
41
+ clockSkewed: boolean;
42
+ badTimeOrTimezone: boolean;
43
+ timeValidation?: TimeValidationResult;
44
+ backgroundTrackingRestricted: boolean;
45
+ manufacturer: string | null;
46
+ isSamsung: boolean;
47
+ /** Diagnostic only; does not affect device fitness. */
48
+ neverSleepingApps: NeverSleepingAppsInfo | null;
49
+ checkedAt: number;
50
+ }
51
+
52
+ export type NeverSleepingState =
53
+ | "not_applicable"
54
+ | "unverified"
55
+ | "user_confirmed"
56
+ | "user_reported_missing";
57
+
58
+ export interface NeverSleepingAppsInfo {
59
+ /** True only on Samsung Android devices. */
60
+ applicable: boolean;
61
+ /** Always false: Samsung exposes no public API to read the list. */
62
+ verifiable: false;
63
+ state: NeverSleepingState;
64
+ /** What the user reported (self-reported, NOT verified). */
65
+ userConfirmed: boolean | null;
66
+ /** Whether Samsung's Never sleeping apps screen can be opened. */
67
+ settingsScreenAvailable: boolean;
68
+ note: string;
69
+ }
70
+
71
+ export interface BackgroundSettingsStatus {
72
+ platform: string;
73
+ nativeModuleAvailable: boolean;
74
+ manufacturer: string | null;
75
+ brand?: string | null;
76
+ model?: string | null;
77
+ sdkInt?: number | null;
78
+ isSamsung: boolean;
79
+ /** Verified via PowerManager. null when it cannot be determined. */
80
+ ignoringBatteryOptimizations: boolean | null;
81
+ neverSleepingApps: NeverSleepingAppsInfo;
82
+ error?: string;
83
+ checkedAt: number;
84
+ }
85
+
86
+ export interface TimeValidationResult {
87
+ platform: string;
88
+ autoDateTimeEnabled: boolean | null;
89
+ clockSkewed: boolean;
90
+ clockSkewCheckInconclusive: boolean;
91
+ badTimeOrTimezone: boolean;
92
+ thresholdMinutes: number;
93
+ checkedAt: number;
94
+ }
95
+
96
+ export interface GnssStatusSnapshot {
97
+ isGNSSSupported: boolean;
98
+ isDualFrequencySupported: boolean;
99
+ isNavICSupported: boolean;
100
+ satellitesVisible: number;
101
+ satellitesUsedInFix: number;
102
+ averageSignalToNoiseRatio: number;
103
+ supportedConstellations: string[];
104
+ carrierFrequencies: number[];
105
+ satellites: unknown[];
106
+ apiLevel?: number;
107
+ supportsCn0?: boolean;
108
+ supportsCarrierFreq?: boolean;
109
+ platform: string;
110
+ unsupported?: boolean;
111
+ updatedAt: number;
112
+ error?: string;
113
+ }
114
+
115
+ export interface TrackingQualityStatus {
116
+ running: boolean;
117
+ platform: string;
118
+ apiLevel: number | null;
119
+ gnssSupported: boolean;
120
+ gnssListening: boolean;
121
+ tripId: string | null;
122
+ tripStartedAt: number | null;
123
+ tripStartMaxSats: number;
124
+ tripStartSatWindowFired: boolean;
125
+ lastTraceAt: number | null;
126
+ lastLocation: NormalizedLocation | null;
127
+ poorTrackingStartedAt: number | null;
128
+ latestGnss: GnssStatusSnapshot | null;
129
+ latestSystem: SystemHealthResult | null;
130
+ deviceFitness: DeviceFitnessResult | null;
131
+ recentAlerts: TrackingQualityAlert[];
132
+ thresholds: Thresholds;
133
+ }
134
+
135
+ export interface NormalizedLocation {
136
+ coords: {
137
+ latitude: number;
138
+ longitude: number;
139
+ accuracy: number | null;
140
+ altitude: number | null;
141
+ speed: number | null;
142
+ heading: number | null;
143
+ mocked: boolean;
144
+ };
145
+ timestamp: number | string;
146
+ mock: boolean;
147
+ raw: unknown;
148
+ }
149
+
150
+ export interface Thresholds {
151
+ tripStartSatWindowMs: number;
152
+ minSatellitesForGoodFix: number;
153
+ poorTrackingDurationMs: number;
154
+ poorAccuracyThresholdM: number;
155
+ teleportImpliedSpeedKmh: number;
156
+ teleportMinJumpMeters: number;
157
+ expectedTraceIntervalMs: number;
158
+ throttleGapMultiplier: number;
159
+ throttleMinGapMs: number;
160
+ systemCheckIntervalMs: number;
161
+ alertCooldownMs: number;
162
+ timeSkewThresholdMinutes: number;
163
+ lowBatteryFraction: number;
164
+ }
165
+
166
+ export interface ApiLevelThresholds {
167
+ MIN_LEGACY_GNSS: number;
168
+ MIN_BASIC_GNSS: number;
169
+ MIN_FULL_GNSS_STATUS: number;
170
+ MIN_CARRIER_FREQUENCY: number;
171
+ MIN_BACKGROUND_LOCATION_PERMISSION: number;
172
+ MIN_PRECISE_LOCATION_MODEL: number;
173
+ MIN_FGS_LOCATION_TYPE: number;
174
+ MIN_ACCEPTABLE_FOR_TRACKING: number;
175
+ PREFERRED_FOR_ENHANCED_GNSS: number;
176
+ }
177
+
178
+ export interface ConfigureOptions {
179
+ getPowerSaveMode?: (() => Promise<boolean>) | null;
180
+ isIgnoringBatteryOptimizations?: (() => Promise<boolean>) | null;
181
+ getPowerState?: (() => Promise<unknown>) | null;
182
+ getBatteryLevel?: (() => Promise<number | null>) | null;
183
+ isAutomaticDateTimeEnabled?: (() => Promise<boolean | null>) | null;
184
+ showNotification?:
185
+ | ((
186
+ title: string,
187
+ message: string,
188
+ options?: Record<string, unknown>
189
+ ) => void | Promise<void>)
190
+ | null;
191
+ persistAlert?: ((alert: TrackingQualityAlert) => void) | null;
192
+ logger?: {
193
+ log?: (...args: unknown[]) => void;
194
+ warn?: (...args: unknown[]) => void;
195
+ error?: (...args: unknown[]) => void;
196
+ } | null;
197
+ /** Partial override of DEFAULT_THRESHOLDS */
198
+ thresholds?: Partial<Thresholds>;
199
+ /** Partial override of DEFAULT_API_LEVEL_THRESHOLDS */
200
+ apiLevelThresholds?: Partial<ApiLevelThresholds>;
201
+ }
202
+
203
+ export interface TrackingQualityAction {
204
+ type: string;
205
+ message: string;
206
+ meta?: unknown;
207
+ tripId?: string | null;
208
+ at: number;
209
+ }
210
+
211
+ export declare function configure(options?: ConfigureOptions): ConfigureOptions;
212
+ export declare function getConfig(): ConfigureOptions;
213
+ export declare function resetConfig(): void;
214
+ export declare function getThresholds(): Thresholds;
215
+ export declare function getApiLevelThresholds(): ApiLevelThresholds;
216
+ export declare const DEFAULT_THRESHOLDS: Thresholds;
217
+ export declare const DEFAULT_API_LEVEL_THRESHOLDS: ApiLevelThresholds;
218
+
219
+ export declare function collectSystemHealth(): Promise<SystemHealthResult>;
220
+
221
+ export declare const NEVER_SLEEPING_STATE: {
222
+ NOT_APPLICABLE: "not_applicable";
223
+ UNVERIFIED: "unverified";
224
+ USER_CONFIRMED: "user_confirmed";
225
+ USER_REPORTED_MISSING: "user_reported_missing";
226
+ };
227
+ /** Battery optimization (verified) + Samsung Never sleeping apps (unverifiable). */
228
+ export declare function getBackgroundSettingsStatus(): Promise<BackgroundSettingsStatus>;
229
+ /** Android "Ignore battery optimizations". null when undeterminable. */
230
+ export declare function isIgnoringBatteryOptimizations(): Promise<boolean | null>;
231
+ /** Opens Samsung's Never sleeping apps screen. false if unavailable / not Samsung. */
232
+ export declare function openNeverSleepingApps(): Promise<boolean>;
233
+ export interface OpenBackgroundRestrictionResult {
234
+ /** true when some settings screen was started. */
235
+ opened: boolean;
236
+ /**
237
+ * Which screen opened, e.g. "samsung_never_sleeping", "xiaomi_autostart",
238
+ * "huawei_startup_manager", "coloros_startup_manager", "vivo_background_startup",
239
+ * "battery_optimization", "app_details", or "none".
240
+ */
241
+ target: string;
242
+ /** true for a manufacturer-specific screen, false for the universal fallbacks. */
243
+ isOemScreen: boolean;
244
+ manufacturer: string | null;
245
+ }
246
+ /**
247
+ * Opens the best background / autostart / never-sleeping screen for this
248
+ * device on any Android phone: OEM screen -> battery optimization list ->
249
+ * app info. Best-effort; cannot verify the app was added to any list.
250
+ * Never rejects.
251
+ */
252
+ export declare function openBackgroundRestrictionSettings(): Promise<OpenBackgroundRestrictionResult>;
253
+ /** Opens Android's "Optimize battery usage" list. false on failure. */
254
+ export declare function openBatteryOptimizationSettings(): Promise<boolean>;
255
+ /** Persist what the user reports about the list (null clears). Not verification. */
256
+ export declare function setNeverSleepingAppsConfirmed(
257
+ confirmed: boolean | null
258
+ ): Promise<boolean>;
259
+ export declare function assessDeviceFitness(options?: {
260
+ apiLevel?: number | null;
261
+ systemHealth?: SystemHealthResult | null;
262
+ gnssCapabilityFlags?: Record<string, unknown> | null;
263
+ }): DeviceFitnessResult;
264
+ export declare function getAndroidApiLevel(): number | null;
265
+ export declare function getGnssCapabilityProfile(
266
+ apiLevel: number | null
267
+ ): Record<string, unknown>;
268
+ export declare function scoreApiLevel(apiLevel: number | null): {
269
+ score: string;
270
+ reason: string;
271
+ };
272
+
273
+ export declare function validateTimeAndTimezone(options?: {
274
+ thresholdMinutes?: number;
275
+ }): Promise<TimeValidationResult>;
276
+ export declare function isAutomaticDateTimeEnabled(): Promise<boolean | null>;
277
+ /** Opens Android Date & time settings. Returns false on iOS / if unavailable. */
278
+ export declare function openDateTimeSettings(): Promise<boolean>;
279
+ export declare function isClockSkewed(options?: {
280
+ thresholdMinutes?: number;
281
+ }): Promise<boolean | null>;
282
+ export declare function getTimeDifferenceInMinutes(options?: {
283
+ thresholdMinutes?: number;
284
+ }): Promise<boolean | null>;
285
+
286
+ export declare function normalizeLocation(raw: unknown): NormalizedLocation | null;
287
+
288
+ export declare const ALERT_TYPES: Record<string, string>;
289
+ export declare const ALERT_SEVERITY: Record<string, AlertSeverity>;
290
+ export declare const EVENT_NAMES: Record<string, string>;
291
+ export declare const API_LEVEL_THRESHOLDS: Record<string, number>;
292
+ export declare const DEVICE_FITNESS: Record<string, string>;
293
+ export declare const MIN_SATELLITES_FOR_GOOD_FIX: number;
294
+ export declare const TRIP_START_SAT_WINDOW_MS: number;
295
+ export declare const POOR_TRACKING_DURATION_MS: number;
296
+ export declare const SYSTEM_CHECK_INTERVAL_MS: number;
297
+ export declare const TIME_SKEW_THRESHOLD_MINUTES: number;
298
+
299
+ export declare class TrackingQualityMonitor {
300
+ readonly isRunning: boolean;
301
+ readonly isLocationTrackingActive: boolean;
302
+ getStatus(): TrackingQualityStatus;
303
+ setLocationTrackingActive(active: boolean): void;
304
+ evaluateDeviceFitnessOnLogin(options?: {
305
+ force?: boolean;
306
+ }): Promise<DeviceFitnessResult>;
307
+ evaluateDeviceFitness(options?: {
308
+ logActions?: boolean;
309
+ }): Promise<DeviceFitnessResult>;
310
+ start(options?: {
311
+ tripId?: string | null;
312
+ notify?: boolean;
313
+ /** Alias of `notify` (driver-app parity). */
314
+ notifyDriver?: boolean;
315
+ }): Promise<TrackingQualityStatus>;
316
+ onTripStarted(tripId?: string | null): void;
317
+ ingestLocation(location: unknown): void;
318
+ heartbeat(): void;
319
+ stop(options?: { clearTrip?: boolean }): Promise<void>;
320
+ onAlert(callback: (alert: TrackingQualityAlert) => void): () => void;
321
+ onStatus(callback: (status: TrackingQualityStatus) => void): () => void;
322
+ onGnssUpdate(callback: (gnss: GnssStatusSnapshot) => void): () => void;
323
+ onAction(callback: (action: TrackingQualityAction) => void): () => void;
324
+ }
325
+
326
+ export interface TrackingMonitorLogLine {
327
+ id: string;
328
+ at: number;
329
+ level: string;
330
+ message: string;
331
+ }
332
+
333
+ declare const trackingQualityMonitor: TrackingQualityMonitor;
334
+ export { trackingQualityMonitor };
335
+ export default trackingQualityMonitor;
336
+
337
+ export declare function useTrackingQuality(options?: {
338
+ autoStart?: boolean;
339
+ tripId?: string | null;
340
+ }): {
341
+ status: TrackingQualityStatus;
342
+ running: boolean;
343
+ locationTrackingActive: boolean;
344
+ platform: string;
345
+ apiLevel: number | null;
346
+ gnssSupported: boolean;
347
+ gnssListening: boolean;
348
+ tripId: string | null;
349
+ tripStartMaxSats: number;
350
+ tripStartSatWindowFired: boolean;
351
+ deviceFitness: DeviceFitnessResult | null;
352
+ latestGnss: GnssStatusSnapshot | null;
353
+ latestSystem: SystemHealthResult | null;
354
+ lastLocation: NormalizedLocation | null;
355
+ recentAlerts: TrackingQualityAlert[];
356
+ lastAlert: TrackingQualityAlert | null;
357
+ lastAction: TrackingQualityAction | null;
358
+ actions: TrackingQualityAction[];
359
+ start: (opts?: {
360
+ tripId?: string | null;
361
+ notify?: boolean;
362
+ notifyDriver?: boolean;
363
+ }) => Promise<TrackingQualityStatus>;
364
+ stop: (opts?: { clearTrip?: boolean }) => Promise<void>;
365
+ onTripStarted: (id?: string | null) => void;
366
+ ingestLocation: (location: unknown) => void;
367
+ evaluateDeviceFitness: (opts?: {
368
+ logActions?: boolean;
369
+ }) => Promise<DeviceFitnessResult>;
370
+ evaluateDeviceFitnessOnLogin: (opts?: {
371
+ force?: boolean;
372
+ }) => Promise<DeviceFitnessResult>;
373
+ setLocationTrackingActive: (active: boolean) => void;
374
+ heartbeat: () => void;
375
+ getStatus: () => TrackingQualityStatus;
376
+ monitor: TrackingQualityMonitor;
377
+ };
378
+
379
+ /**
380
+ * Full monitoring hook (POC-equivalent): status + alerts + throttled live log + controls.
381
+ */
382
+ export declare function useTrackingMonitor(options?: {
383
+ autoStart?: boolean;
384
+ tripId?: string | null;
385
+ maxLogLines?: number;
386
+ gnssLogThrottleMs?: number;
387
+ }): {
388
+ status: TrackingQualityStatus;
389
+ running: boolean;
390
+ locationTrackingActive: boolean;
391
+ platform: string;
392
+ apiLevel: number | null;
393
+ gnssSupported: boolean;
394
+ gnssListening: boolean;
395
+ tripId: string | null;
396
+ tripStartMaxSats: number;
397
+ tripStartSatWindowFired: boolean;
398
+ deviceFitness: DeviceFitnessResult | null;
399
+ latestGnss: GnssStatusSnapshot | null;
400
+ latestSystem: SystemHealthResult | null;
401
+ lastLocation: NormalizedLocation | null;
402
+ recentAlerts: TrackingQualityAlert[];
403
+ thresholds: Thresholds | undefined;
404
+ lastAlert: TrackingQualityAlert | null;
405
+ lastAction: TrackingQualityAction | null;
406
+ logs: TrackingMonitorLogLine[];
407
+ appendLog: (level: string, message: string) => void;
408
+ clearLogs: () => void;
409
+ refresh: () => void;
410
+ start: (opts?: {
411
+ tripId?: string | null;
412
+ notify?: boolean;
413
+ notifyDriver?: boolean;
414
+ }) => Promise<TrackingQualityStatus>;
415
+ stop: (opts?: { clearTrip?: boolean }) => Promise<void>;
416
+ onTripStarted: (id?: string | null) => void;
417
+ ingestLocation: (location: unknown) => void;
418
+ evaluateDeviceFitness: (opts?: {
419
+ logActions?: boolean;
420
+ }) => Promise<DeviceFitnessResult>;
421
+ evaluateDeviceFitnessOnLogin: (opts?: {
422
+ force?: boolean;
423
+ }) => Promise<DeviceFitnessResult>;
424
+ setLocationTrackingActive: (active: boolean) => void;
425
+ heartbeat: () => void;
426
+ getStatus: () => TrackingQualityStatus;
427
+ monitor: TrackingQualityMonitor;
428
+ };
429
+
430
+ export declare function useDeviceFitness(options?: {
431
+ evaluateOnMount?: boolean;
432
+ }): {
433
+ fitness: DeviceFitnessResult | null;
434
+ loading: boolean;
435
+ error: unknown;
436
+ evaluate: () => Promise<DeviceFitnessResult>;
437
+ apiLevel: number | null;
438
+ capableForTracking: boolean;
439
+ settingsIssues: string[];
440
+ };
441
+
442
+ export declare function useSystemHealth(options?: {
443
+ refreshOnMount?: boolean;
444
+ intervalMs?: number;
445
+ }): {
446
+ health: SystemHealthResult | null;
447
+ loading: boolean;
448
+ error: unknown;
449
+ refresh: () => Promise<SystemHealthResult>;
450
+ batteryLevel: number | null | undefined;
451
+ lowPowerMode: boolean;
452
+ batteryOptimizationEnabled: boolean;
453
+ backgroundTrackingRestricted: boolean;
454
+ badTimeOrTimezone: boolean;
455
+ };
456
+
457
+ export declare function useTimeValidation(options?: {
458
+ validateOnMount?: boolean;
459
+ }): {
460
+ result: TimeValidationResult | null;
461
+ loading: boolean;
462
+ error: unknown;
463
+ validate: (options?: {
464
+ thresholdMinutes?: number;
465
+ }) => Promise<TimeValidationResult>;
466
+ autoDateTimeEnabled: boolean | null | undefined;
467
+ clockSkewed: boolean;
468
+ badTimeOrTimezone: boolean;
469
+ };
470
+
471
+ export declare function useTrackingQualityAlerts(options?: {
472
+ max?: number;
473
+ }): {
474
+ alerts: TrackingQualityAlert[];
475
+ lastAlert: TrackingQualityAlert | null;
476
+ };