Skip to content

[Bug]: SDK dropping all active monitored geofences (Android) #2448

@PeterRisberg66

Description

@PeterRisberg66

Required Reading

  • Confirmed

Plugin Version

4.19.2

Mobile operating-system(s)

  • iOS
  • Android

Device Manufacturer(s) and Model(s)

Multiple Android device models our users are using

Device operating-systems(s)

Multiple Android OS

React Native / Expo version

React Native version 0.82.1

What happened?

We currently have a major issue in that it on Android devices occasionally loose ALL geofences it is supposed to actively monitor. It is dropping all geofences even though there are geofences in the very near vicinity.

Attached a document describing the issue. The issue occurs very often so it is not a one-time issue on a single device.

There are some questions in the end of the document that might help us all to understand the root cause of the issue. Please, help us solve this issue.

Geofence SDK Bug Report.pdf

Plugin Code and/or Config

const defaultSettings: Config = {
geofenceProximityRadius: 100000,
desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
distanceFilter: 10,
disableElasticity: false,
startOnBoot: true,
isMoving: true,
autoSync: false,
reset: true,
geofenceInitialTriggerEntry: true,
debug: false,
maxDaysToPersist: 3,
maxRecordsToPersist: 1000,
// Battery optimizations
stopOnTerminate: false,
disableStopDetection: false,
stopOnStationary: true,
heartbeatInterval: 120, // Android only as we have preventSuspend false
// Android only
enableHeadless: true,
geofenceModeHighAccuracy: true,
speedJumpFilter: 50,
locationUpdateInterval: 1000, // Android only. Ignored if distanceFilter > 0.
// iOS only
pausesLocationUpdatesAutomatically: undefined,
preventSuspend: false,
stationaryRadius: 100,
// Misc things that make sense to provide
logLevel: BackgroundGeolocation.LOG_LEVEL_DEBUG,
disableLocationAuthorizationAlert: false,
locationAuthorizationRequest: "Always"
};

Relevant log output

12-10 09:33:06.530 WARN [TSGeofence$Builder build]
 
  ✅  Dev Bergshamra.1
 
12-10 09:33:06.621 INFO [GeofenceDAO create]
 
  ✅  Dev Bergshamra.1
 
12-10 09:33:06.621 INFO [GeofenceDAO destroy]
 
  ✅  Dev Bergshamra.2
 
12-10 09:33:06.622 INFO [GeofenceDAO destroy]
 
  ✅  Dev Bergshamra.2
 
12-10 09:33:06.623 INFO [GeofenceDAO create]
 
  ✅  Dev Bergshamra.3
 
12-10 09:33:06.624 INFO [GeofenceDAO destroy]
 
  ✅  Dev Bergshamra.4
 
12-10 09:33:06.625 INFO [GeofenceDAO destroy]
 
  ✅  Dev Bergshamra.3
 
12-10 09:33:06.625 INFO [GeofenceDAO create]
 
  ✅  Dev Bergshamra.4
 
12-10 09:33:06.626 INFO [GeofenceDAO create]
 
  ✅  Dev Bergshamra.5
 
12-10 09:33:06.627 INFO [GeofenceDAO create]
 
  ✅  Dev Bergshamra.5
 
12-10 09:33:06.627 INFO [GeofenceDAO destroy]
 
  ✅  Dev Bergshamra.6
 
12-10 09:33:06.628 INFO [GeofenceDAO destroy]
 
  ✅  Dev Bergshamra.6
 
12-10 09:33:06.629 INFO [GeofenceDAO create]
 
  ✅  Dev Bergshamra.7
 
12-10 09:33:06.630 INFO [GeofenceDAO destroy]
 
  ✅  Dev Bergshamra.7
 
12-10 09:33:06.631 INFO [GeofenceDAO create]
 
  ✅  Dev Bergshamra.8
 
12-10 09:33:06.632 INFO [GeofenceDAO create]
 
  ✅  Dev Bergshamra.8
 
12-10 09:33:06.632 INFO [GeofenceDAO destroy]
 
  ✅  Dev Heikki
 
12-10 09:33:06.633 INFO [GeofenceDAO destroy]
 
  ✅  Dev Heikki
 
12-10 09:33:06.634 INFO [GeofenceDAO create]
 
  ✅  Dev Peter
 
12-10 09:33:06.635 INFO [GeofenceDAO create]
 
  ✅  Dev Peter
 
12-10 09:33:06.635 INFO [GeofenceDAO destroy]
 
  ✅  Dev Peter 1
 
12-10 09:33:06.636 INFO [GeofenceDAO destroy]
 
  🎾  start [ActivityRecognitionService  startId: 1, eventCount: 1]
 
12-10 09:33:06.636 DEBUG [AbstractService a]
 
  🚘 ️DetectedActivity [type=UNKNOWN, confidence=40]
 
12-10 09:33:06.637 DEBUG [ActivityRecognitionService a]
 
  ✅  Dev Peter 1
 
12-10 09:33:06.637 INFO [GeofenceDAO create]
 
  ✅  Dev Peter 2
 
12-10 09:33:06.638 INFO [GeofenceDAO create]
 
  ✅  Dev Peter 2
 
12-10 09:33:06.638 INFO [GeofenceDAO destroy]
 
  ✅  Dev Peter 3
 
12-10 09:33:06.639 INFO [GeofenceDAO destroy]
 
  ✅  Dev Peter 3
 
12-10 09:33:06.640 INFO [GeofenceDAO create]
 
  ✅  Dev Peter 4.1
 
12-10 09:33:06.641 INFO [GeofenceDAO create]
 
  ✅  Dev Peter 4.1
 
12-10 09:33:06.641 INFO [GeofenceDAO destroy]
 
  ✅  Dev Peter 4.3
 
12-10 09:33:06.642 INFO [GeofenceDAO destroy]
 
  ✅  Dev Peter 4.2
 
12-10 09:33:06.643 INFO [GeofenceDAO destroy]
 
  ✅  Dev Peter 4.3
 
12-10 09:33:06.643 INFO [GeofenceDAO create]
 
  ✅  Dev Peter 4.2
 
12-10 09:33:06.644 INFO [GeofenceDAO create]
 
  ✅  Dev Peter 5
 
12-10 09:33:06.645 INFO [GeofenceDAO create]
 
  ⚙️︎   FINISH [ActivityRecognitionService startId: 1, eventCount: 0, sticky: false]
 
12-10 09:33:06.646 DEBUG [AbstractService a]
 
  ✅  Dev Peter 6
 
12-10 09:33:06.646 INFO [GeofenceDAO destroy]
 
  ✅  Dev Peter 7
 
12-10 09:33:06.647 INFO [GeofenceDAO destroy]
 
  ✅  Dev Peter 6
 
12-10 09:33:06.647 INFO [GeofenceDAO create]
 
  ✅  Dev Peter 7
 
12-10 09:33:06.648 INFO [GeofenceDAO create]
 
  ✅  Dev Peter 8
 
12-10 09:33:06.649 INFO [GeofenceDAO create]
 
  ✅  Dev Peter 8
 
12-10 09:33:06.649 INFO [GeofenceDAO destroy]
 
  ✅  Dev Peter W
 
12-10 09:33:06.650 INFO [GeofenceDAO create]
 
  ✅  Dev Peter W
 
12-10 09:33:06.650 INFO [GeofenceDAO destroy]
 
  ✅  Dev Sidney
 
12-10 09:33:06.651 INFO [GeofenceDAO create]
 
  ✅  Dev Sidney
 
12-10 09:33:06.651 INFO [GeofenceDAO destroy]
 
  ✅  Dev Solna United
 
12-10 09:33:06.652 INFO [GeofenceDAO create]
 
  ✅  Dev Solna United 2x.2
 
12-10 09:33:06.652 INFO [GeofenceDAO destroy]
 
  ✅  Dev Solna United
 
12-10 09:33:06.652 INFO [GeofenceDAO destroy]
 
  ✅  Dev Solna United 2x.1
 
12-10 09:33:06.653 INFO [GeofenceDAO destroy]
 
  ✅  Dev Solna United 2x.2
 
12-10 09:33:06.653 INFO [GeofenceDAO create]
 
  ✅  Dev Solna United 2x.1
 
12-10 09:33:06.654 INFO [GeofenceDAO create]
 
  ✅  Dev-JM
 
12-10 09:33:06.655 INFO [GeofenceDAO create]
 
  ✅  Dev-JM
 
12-10 09:33:06.655 INFO [GeofenceDAO destroy]
 
  ✅  Dev-TM
 
12-10 09:33:06.656 INFO [GeofenceDAO create]
 
  ✅  Dev-TM
 
12-10 09:33:06.656 INFO [GeofenceDAO destroy]
 
  ✅  Dev-TM1
 
12-10 09:33:06.657 INFO [GeofenceDAO create]
 
  ✅  Dev-TM1
 
12-10 09:33:06.657 INFO [GeofenceDAO destroy]
 
  ✅  Dev-TM3
 
12-10 09:33:06.658 INFO [GeofenceDAO destroy]
 
  ✅  Dev-TM2
 
12-10 09:33:06.658 INFO [GeofenceDAO create]
 
  ✅  Dev-TM2
 
12-10 09:33:06.658 INFO [GeofenceDAO destroy]
 
  🎾  start [ActivityRecognitionService  startId: 2, eventCount: 1]
 
12-10 09:33:06.797 DEBUG [AbstractService a]
 
12-10 09:33:06.799 DEBUG [TSConfig e] ℹ️   Persist config, dirty: [isMoving]
 
12-10 09:33:06.799 DEBUG [ActivityRecognitionService a] *** wasMoving: false, nowMoving: true, startedMoving: true, justStopped; false
 
  🔴  Stop heartbeat
 
12-10 09:33:06.801 INFO [HeartbeatService stop]
 
  ⏰ Cancel OneShot: HEARTBEAT
 
12-10 09:33:06.803 INFO [TSScheduleManager cancelOneShot]
 
  🎾  Start monitoring significant location changes
 
12-10 09:33:06.810 INFO [TSGeofenceManager$a run]
 
  ⚙️︎   FINISH [ActivityRecognitionService startId: 2, eventCount: 0, sticky: false]
 
12-10 09:33:06.810 DEBUG [AbstractService a]
 
╟─ 🎾  ENTER: in_vehicle
 
║ Motion Transition Result
 
12-10 09:33:06.810 INFO [ActivityRecognitionService a]
 
12-10 09:33:06.811 DEBUG [TSConfig translateDesiredAccuracy] translateDesiredAccuracy (true): -1
 
  ℹ️  LocationAuthorization: Permission granted
 
12-10 09:33:06.816 DEBUG [LocationAuthorization withBackgroundPermission]
 
12-10 09:33:06.982 DEBUG [TSGeofenceManager b] ℹ️  GeofencingClient removeGeofences SUCCESS
 
12-10 09:33:06.983 DEBUG [TSGeofenceManager d] ℹ️  Persist monitored geofences: []
 
12-10 09:33:07.001 INFO [GeofenceDAO destroyAll] ✅ 
 
  ⚙️︎  ActivityRecognitionService.stopSelfResult(2): true
 
12-10 09:33:07.014 DEBUG [AbstractService f]
 
  🔴  ActivityRecognitionService stopped
 
12-10 09:33:07.015 DEBUG [AbstractService onDestroy]
 
12-10 09:33:07.039 DEBUG [TSGeofenceManager b] ℹ️  GeofencingClient removeGeofences SUCCESS
 
12-10 09:33:07.040 DEBUG [TSGeofenceManager d] ℹ️  Persist monitored geofences: []
 
╟─ 📍  Location[HIDDEN]
 
║ motionchange LocationResult: 14 (5111ms old)
 
12-10 09:33:07.066 INFO [TSLocationManager a]
 
  🔵  Acquired motionchange position, isMoving: true
 
12-10 09:33:07.069 INFO [TSLocationManager onSingleLocationResult]
 
12-10 09:33:07.070 DEBUG [TSLocationManager a] Median accuracy: 10.0
 
  🎾  start [GeofencingService  startId: 1, eventCount: 1]
 
12-10 09:33:07.147 DEBUG [AbstractService a]
 
  ⚙️︎   FINISH [GeofencingService startId: 1, eventCount: 0, sticky: false]
 
12-10 09:33:07.148 DEBUG [AbstractService a]
 
12-10 09:33:07.291 DEBUG [TSGeofenceManager$d run] evaluation buffer timer elapsed
 
  🔴  Stop motion-activity updates
 
12-10 09:33:07.303 INFO [ActivityRecognitionService stop]
 
  🔴  Stop monitoring stationary region
 
12-10 09:33:07.306 DEBUG [TSGeofenceManager stopMonitoringStationaryRegion]
 
  🔴  Stop monitoring significant location changes
 
12-10 09:33:07.308 INFO [TSGeofenceManager stopMonitoringSignificantLocationChanges]
 
║ TSGeofenceManager monitoring 0/0
 
12-10 09:33:07.310 DEBUG [TSGeofenceManager$e run]
 
  ⚙️︎  GeofencingService.stopSelfResult(1): true
 
12-10 09:33:07.353 DEBUG [AbstractService f]
 
  🔴  GeofencingService stopped
 
12-10 09:33:07.354 DEBUG [AbstractService onDestroy]
 
║ ⏰ OneShot event fired: TERMINATE_EVENT
 
12-10 09:33:12.376 INFO [ScheduleEvent a]
 
  ℹ️  TERMINATE_EVENT ignored (MainActivity is still active).
 
12-10 09:33:12.377 DEBUG [TerminateEvent$a onChange]
 
  ⏰ Scheduled OneShot: TERMINATE_EVENT in 10000ms (jobID: -1708771588)
 
12-10 09:35:04.379 INFO [TSScheduleManager oneShot]
 
12-10 09:35:05.061 DEBUG [LifecycleManager onPause] ☯️  onPause
 
12-10 09:35:05.062 DEBUG [LifecycleManager onStop] ☯️  onStop
 
║ ⏰ OneShot event fired: TERMINATE_EVENT
 
12-10 09:35:14.474 INFO [ScheduleEvent a]
 
  ℹ️  TERMINATE_EVENT ignored (MainActivity is still active).
 
12-10 09:35:14.475 DEBUG [TerminateEvent$a onChange]
 
12-10 12:52:53.796 DEBUG [LifecycleManager onStart] ☯️  onStart
 
12-10 12:52:53.978 DEBUG [LifecycleManager onResume] ☯️  onResume
 
12-10 12:52:54.479 DEBUG [TSConfig e] ℹ️   Persist config, dirty: [isMoving]
 
  ℹ️  Clear last odometer location
 
12-10 12:52:54.506 DEBUG [TSLocationManager a]
 
  🔴  Stop motion-activity updates
 
12-10 12:52:54.522 INFO [ActivityRecognitionService stop]
 
  🔴  Stop heartbeat
 
12-10 12:52:54.524 INFO [HeartbeatService stop]
 
  🔴  Stop monitoring connectivity changes
 
12-10 12:52:54.526 DEBUG [HttpService stopMonitoringConnectivityChanges]
 
  🔴  Stop monitoring geofences

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions