react-native-background-geolocation icon indicating copy to clipboard operation
react-native-background-geolocation copied to clipboard

Demo app - BGLocation does not trigger onGeofence enter/exit events on polygon geofences

Open BugraDemiral opened this issue 1 year ago • 3 comments

Your Environment

  • Plugin version: 4.17.1
  • Platform: iOS
  • OS version: 18.0.1
  • Device manufacturer / model: Apple iPhone 15
  • React Native version (react-native -v): 0.75.4
  • Plugin config
// Ready the SDK and fetch the current state.
    const state:State = await BackgroundGeolocation.ready({
      // Debug
      reset: false,
      debug: true,
      logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
      transistorAuthorizationToken: token,
      // Geolocation
      desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_NAVIGATION,
      distanceFilter: 10,
      stopTimeout: 5,
      // Permissions
      locationAuthorizationRequest: 'Always',
      backgroundPermissionRationale: {
        title: "Allow {applicationName} to access this device's location even when closed or not in use.",
        message: "This app collects location data to enable recording your trips to work and calculate distance-travelled.",
        positiveAction: 'Change to "{backgroundPermissionOptionLabel}"',
        negativeAction: 'Cancel'
      },
      // HTTP & Persistence
      autoSync: true,
      maxDaysToPersist: 14,
      // Application
      stopOnTerminate: false,
      startOnBoot: true,
      enableHeadless: true
    });

Expected Behavior

Polygon geofences should trigger onGeofence events with polygon geofences as stated it is fully functional in debug mode.

Actual Behavior

Polygon geofence triggers native didEnterRegion and didExitRegion in native side but not triggering onGeofence event in RN

Steps to Reproduce

  1. Goto Advanced part of demo app - debug with Xcode
  2. Enable switch on top right
  3. Create a polygon geofence
  4. Trigger inside / outside location in geofence from Xcode

Context

Trying to simulate enter/exit to polygon geofence with gpx files on Xcode with real device.

Debug logs

Logs
╔═══════════════════════════════════════════════════════════
║ -[PolygonGeofencingService isInPolygon:] 📍 41.552363, 2.098692, acy: 5.0m
╚═══════════════════════════════════════════════════════════
ℹ️-[PolygonGeofencingService isInPolygon:] --> polygon test: 0.0%
🔴-[TSGeofenceManager locationManager:didExitRegion:] polygon test
 
╔═══════════════════════════════════════════════════════════
║ -[PolygonGeofencingService didExitRegion:] EXIT containing geofence of polygon: polygon test
╚═══════════════════════════════════════════════════════════
🔴-[PolygonGeofencingService stopMonitoring:] polygon test
[Geofencing] clearPolygon polygon test
ℹ️-[PolygonGeofencingService persistMonitoredPolygons] {
}
ℹ️-[PolygonGeofencingService resetStopTimeout]
🔴-[PolygonGeofencingService stopUpdatingLocation]
🎾-[TSGeofenceManager locationManager:didEnterRegion:] polygon test
 
╔═══════════════════════════════════════════════════════════
║ -[PolygonGeofencingService didEnterRegion:] ENTER containing geofence of polygon: polygon test
╚═══════════════════════════════════════════════════════════
🎾-[PolygonGeofencingService startMonitoring:] polygon test
[Geofencing] loadPolygon polygon test
ℹ️-[PolygonGeofencingService persistMonitoredPolygons] {
    "polygon test" = 0;
}
🎾-[PolygonGeofencingService startUpdatingLocation:]
🎾-[PolygonGeofencingService beginStopTimeout]
ℹ️+[LocationAuthorization run:onCancel:] status: 3
 
╔═══════════════════════════════════════════════════════════
║ -[PolygonGeofencingService isInPolygon:] 📍 41.557393, 2.109790, acy: 5.0m
╚═══════════════════════════════════════════════════════════
ℹ️-[PolygonGeofencingService isInPolygon:] --> polygon test: 100.0%
 

BugraDemiral avatar Oct 10 '24 09:10 BugraDemiral