@mojro/react-native-gnss-tracking-health 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -14
- package/android/src/main/AndroidManifest.xml +10 -0
- package/android/src/main/java/com/gnsstrackinghealth/GnssTrackingHealthSettingsModule.java +358 -153
- package/package.json +1 -1
- package/src/TrackingQualityMonitor.js +9 -2
- package/src/backgroundSettings.js +175 -40
- package/src/index.d.ts +62 -17
- package/src/index.js +5 -1
- package/src/systemHealth.js +5 -3
package/README.md
CHANGED
|
@@ -176,16 +176,18 @@ import { collectSystemHealth, useSystemHealth } from "react-native-gnss-tracking
|
|
|
176
176
|
const health = await collectSystemHealth();
|
|
177
177
|
```
|
|
178
178
|
|
|
179
|
-
### Background restrictions (battery optimization +
|
|
179
|
+
### Background restrictions (battery optimization + OEM allowlists)
|
|
180
180
|
|
|
181
181
|
Android only. The library ships a small native module (autolinked; rebuild the app after installing). It reports **two different settings separately**:
|
|
182
182
|
|
|
183
183
|
| Setting | Detectable? | How |
|
|
184
184
|
|---------|-------------|-----|
|
|
185
185
|
| Android "Ignore battery optimizations" (Doze) | **Yes** | `PowerManager.isIgnoringBatteryOptimizations()` |
|
|
186
|
-
| Samsung
|
|
186
|
+
| OEM allowlists (Samsung Never sleeping apps, Oppo/OnePlus Startup manager, Vivo Background startup, Xiaomi Autostart, …) | **No** | OEMs expose intents to *open* the screen but no public API to *read* membership |
|
|
187
187
|
|
|
188
|
-
Because
|
|
188
|
+
Because no OEM lets an app read these lists, the library never reports membership as verified. `neverSleepingApps.verifiable` is always `false`; `userConfirmed` only reflects what the driver told you via `setNeverSleepingAppsConfirmed()` (persisted natively).
|
|
189
|
+
|
|
190
|
+
Supported OEM families for direct navigation: **Samsung**, **Xiaomi/Redmi/POCO**, **Huawei/Honor**, **Oppo**, **Realme**, **OnePlus**, **Vivo/iQOO**, **Asus**, **Nokia/HMD**, **Letv/LeEco**, **Meizu**, **Motorola/Moto**.
|
|
189
191
|
|
|
190
192
|
```js
|
|
191
193
|
import {
|
|
@@ -198,25 +200,29 @@ import {
|
|
|
198
200
|
|
|
199
201
|
const s = await getBackgroundSettingsStatus();
|
|
200
202
|
// s.ignoringBatteryOptimizations -> true | false (verified) | null
|
|
201
|
-
// s.isSamsung, s.manufacturer, s.model
|
|
203
|
+
// s.isSamsung, s.oemFamily, s.manufacturer, s.model
|
|
202
204
|
// s.neverSleepingApps = {
|
|
203
205
|
// applicable, verifiable: false,
|
|
204
206
|
// state: "not_applicable" | "unverified" | "user_confirmed" | "user_reported_missing",
|
|
205
207
|
// userConfirmed: true | false | null,
|
|
206
|
-
// settingsScreenAvailable
|
|
208
|
+
// settingsScreenAvailable, oemFamily, label, target
|
|
207
209
|
// }
|
|
208
210
|
|
|
209
|
-
if (
|
|
210
|
-
|
|
211
|
-
|
|
211
|
+
if (
|
|
212
|
+
s.neverSleepingApps.applicable &&
|
|
213
|
+
s.neverSleepingApps.state !== NEVER_SLEEPING_STATE.USER_CONFIRMED
|
|
214
|
+
) {
|
|
215
|
+
const r = await openNeverSleepingApps(); // OEM screen only (no generic fallback)
|
|
216
|
+
// { opened, target, isOemScreen, manufacturer, oemFamily }
|
|
217
|
+
if (!r.opened) await openBatteryOptimizationSettings(); // fallback
|
|
212
218
|
// When the driver returns, ask them, then:
|
|
213
219
|
await setNeverSleepingAppsConfirmed(true); // or false / null to clear
|
|
214
220
|
}
|
|
215
221
|
```
|
|
216
222
|
|
|
217
|
-
`collectSystemHealth()` also includes `manufacturer`, `isSamsung` and `neverSleepingApps`. These are diagnostic only and do **not** affect device fitness. If `configure({ isIgnoringBatteryOptimizations })` is not set, the native PowerManager check is used.
|
|
223
|
+
`collectSystemHealth()` also includes `manufacturer`, `isSamsung`, `oemFamily` and `neverSleepingApps`. These are diagnostic only and do **not** affect device fitness. If `configure({ isIgnoringBatteryOptimizations })` is not set, the native PowerManager check is used.
|
|
218
224
|
|
|
219
|
-
|
|
225
|
+
Samsung's screen is `com.samsung.android.sm.ACTION_OPEN_CHECKABLE_LISTACTIVITY` (package `com.samsung.android.lool`, `activity_type=2`). ColorOS / OxygenOS / Oplus devices try `com.oplus.safecenter` then legacy `com.coloros.safecenter` / `com.oneplus.security`. Vivo tries Background startup + whitelist activities. OEM screens change between OS versions, so `openNeverSleepingApps()` resolves `{ opened: false }` instead of throwing; test on the builds you support. The library manifest adds the `<queries>` entries needed on Android 11+.
|
|
220
226
|
|
|
221
227
|
#### Open the right background screen on any Android device
|
|
222
228
|
|
|
@@ -224,10 +230,10 @@ The Samsung screen is `com.samsung.android.sm.ACTION_OPEN_CHECKABLE_LISTACTIVITY
|
|
|
224
230
|
import { openBackgroundRestrictionSettings } from "react-native-gnss-tracking-health";
|
|
225
231
|
|
|
226
232
|
const r = await openBackgroundRestrictionSettings();
|
|
227
|
-
// { opened: true, target: "xiaomi_autostart", isOemScreen: true, manufacturer: "Xiaomi" }
|
|
233
|
+
// { opened: true, target: "xiaomi_autostart", isOemScreen: true, manufacturer: "Xiaomi", oemFamily: "xiaomi" }
|
|
228
234
|
```
|
|
229
235
|
|
|
230
|
-
Tries, in order: the manufacturer's own screen (Samsung Never sleeping apps, Xiaomi Autostart, Huawei/Honor Startup manager, Oppo/Realme/OnePlus Startup manager, Vivo/iQOO Background startup, Asus, Nokia, Letv), then Android's "Optimize battery usage" list, then this app's "App info" page. It never rejects. `target` tells you which one opened (`isOemScreen: false` means a universal fallback). OEM screens are undocumented and vary by model and OS version, so test on the devices you support. No manufacturer lets an app read whether it was added to these lists, so this only navigates; it cannot verify.
|
|
236
|
+
Tries, in order: the manufacturer's own screen (Samsung Never sleeping apps, Xiaomi Autostart, Huawei/Honor Startup manager, Oppo/Realme/OnePlus Startup manager, Vivo/iQOO Background startup, Asus, Nokia, Letv, Meizu, Motorola/Lenovo background or system battery list), then Android's "Optimize battery usage" list, then this app's "App info" page. It never rejects. `target` tells you which one opened (`isOemScreen: false` means a universal fallback). OEM screens are undocumented and vary by model and OS version, so test on the devices you support. No manufacturer lets an app read whether it was added to these lists, so this only navigates; it cannot verify.
|
|
231
237
|
|
|
232
238
|
### Time / timezone (standalone)
|
|
233
239
|
|
|
@@ -235,7 +241,7 @@ Android auto date/time + timezone lives in its **own native package** (not mixed
|
|
|
235
241
|
|
|
236
242
|
```
|
|
237
243
|
android/src/main/java/com/gnsstrackinghealth/
|
|
238
|
-
GnssTrackingHealthSettingsModule.java # battery
|
|
244
|
+
GnssTrackingHealthSettingsModule.java # battery + OEM allowlist screens
|
|
239
245
|
autodatetime/
|
|
240
246
|
AutoDateTimeModule.java # AUTO_TIME + AUTO_TIME_ZONE
|
|
241
247
|
AutoDateTimePackage.java
|
|
@@ -350,7 +356,7 @@ src/
|
|
|
350
356
|
gnssMonitor.js # peer: react-native-gnss-status-checker
|
|
351
357
|
deviceFitness.js
|
|
352
358
|
systemHealth.js
|
|
353
|
-
backgroundSettings.js # battery optimization +
|
|
359
|
+
backgroundSettings.js # battery optimization + OEM allowlist screens
|
|
354
360
|
timeValidation.js # standalone time/tz
|
|
355
361
|
traceAnalyzer.js
|
|
356
362
|
adapters/normalizeLocation.js
|
|
@@ -11,14 +11,24 @@
|
|
|
11
11
|
<package android:name="com.miui.securitycenter" />
|
|
12
12
|
<package android:name="com.miui.powerkeeper" />
|
|
13
13
|
<package android:name="com.huawei.systemmanager" />
|
|
14
|
+
<!-- ColorOS / OxygenOS / Oplus (Oppo, Realme, OnePlus) -->
|
|
15
|
+
<package android:name="com.oplus.safecenter" />
|
|
16
|
+
<package android:name="com.oplus.battery" />
|
|
14
17
|
<package android:name="com.coloros.safecenter" />
|
|
18
|
+
<package android:name="com.coloros.oppoguardelf" />
|
|
15
19
|
<package android:name="com.oppo.safe" />
|
|
16
20
|
<package android:name="com.oneplus.security" />
|
|
21
|
+
<!-- Vivo / iQOO -->
|
|
17
22
|
<package android:name="com.vivo.permissionmanager" />
|
|
18
23
|
<package android:name="com.iqoo.secure" />
|
|
24
|
+
<package android:name="com.vivo.abe" />
|
|
19
25
|
<package android:name="com.asus.mobilemanager" />
|
|
20
26
|
<package android:name="com.evenwell.powersaving.g3" />
|
|
21
27
|
<package android:name="com.letv.android.letvsafe" />
|
|
28
|
+
<package android:name="com.meizu.safe" />
|
|
29
|
+
<!-- Motorola / Lenovo (some Motos share Lenovo security screens) -->
|
|
30
|
+
<package android:name="com.lenovo.security" />
|
|
31
|
+
<package android:name="com.lenovo.safecenter" />
|
|
22
32
|
</queries>
|
|
23
33
|
|
|
24
34
|
</manifest>
|