expo-beacon 0.6.9 → 0.6.10
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.
|
@@ -348,7 +348,12 @@ class BeaconForegroundService : Service(), BeaconConsumer {
|
|
|
348
348
|
missCounters[region.uniqueId] = count
|
|
349
349
|
|
|
350
350
|
if (enteredRegions.contains(region.uniqueId) && count >= EXIT_MISS_THRESHOLD) {
|
|
351
|
-
|
|
351
|
+
// Do NOT cancel the timeout here. A miss-based exit is triggered by BLE
|
|
352
|
+
// scan gaps (unreliable signal disappearance), not a confirmed physical
|
|
353
|
+
// departure. Cancelling the timeout here would prevent it from ever firing
|
|
354
|
+
// when the configured timeout (e.g. 25 s) exceeds the miss window (~21 s).
|
|
355
|
+
// The timeout runnable fires unconditionally; distance-based exits still
|
|
356
|
+
// call cancelTimeout() reliably when the beacon moves out of range.
|
|
352
357
|
enteredRegions.remove(region.uniqueId)
|
|
353
358
|
missCounters[region.uniqueId] = 0
|
|
354
359
|
enterCounters[region.uniqueId] = 0
|
|
@@ -458,10 +463,11 @@ class BeaconForegroundService : Service(), BeaconConsumer {
|
|
|
458
463
|
cancelTimeout(region.uniqueId)
|
|
459
464
|
val runnable = Runnable {
|
|
460
465
|
timeoutRunnables.remove(region.uniqueId)
|
|
461
|
-
//
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
466
|
+
// Fire unconditionally. A miss-based exit may have cleared enteredRegions before
|
|
467
|
+
// the timer elapsed (BLE gaps can cause false exits at ~21 s), but the beacon
|
|
468
|
+
// may still be physically present. Distance-based exits call cancelTimeout() so
|
|
469
|
+
// this runnable is never queued when the beacon has genuinely moved away.
|
|
470
|
+
sendBeaconBroadcast(region, "timeout", -1.0)
|
|
465
471
|
}
|
|
466
472
|
timeoutRunnables[region.uniqueId] = runnable
|
|
467
473
|
timeoutHandler.postDelayed(runnable, seconds * 1000L)
|