Closed anton-chikunov closed 4 years ago
Are your geofence radius >= 200 meters?
It's default value
Set it to 200.
Sorry for confusing you, geofence points is already using 200 as radius when it’s passing
Are you testing in the iOS simulator?
Real device, iPhone XS
Test your geofences in the simulator with “Freeway Drive”.
Also try testing the SampleApp in simulator. In the “Advanced App”, you can add geofences by long-pressing on the map.
Okay, I’ll try to do that, but honestly I don’t think if it will help. We are using your plugin at least one year and already track a lot of stuff on real devices and sometimes geofencing don’t want to work properly and miss events
to provide additional information : this behaviour that we are seeing is intermittent, and we are seeing this on live iOS devices. Our observation is that the geofence triggers ok on Android devices but isn’t triggering properly on some iOS devices. Our app and logic around geofence has been the same for the last 3 months and we haven’t implemented any changes there.
I monitor 6 geofences in my neighborhood that I’ve been field-testing almost daily for the last 4 years. They never fail.
Yesterday's walk:
~ last 5 weeks
Your logs contain 2 geofences. I see enter & exit for both.
2020-01-09 10:58:03.800
╔═══════════════════════════════════════════════════════════
║ -[TSGeofenceManager fireGeofenceEvent:] 📢ENTER Geofence: ShipmentItem-24132
╚═══════════════════════════════════════════════════════════
2020-01-09 10:58:03.809 ✅-[TSGeofenceManager fireGeofenceEvent:] INSERT: 55C38B43-5885-4EA4-968C-C7FA8EB7B95A
2020-01-09 10:58:03.810
╔═══════════════════════════════════════════════════════════
║ -[TSHttpService flush:]
╚═══════════════════════════════════════════════════════════
2020-01-09 10:58:03.811 ✅-[BackgroundTaskManager createBackgroundTask] 44
2020-01-09 10:58:03.812
╔═══════════════════════════════════════════════════════════
║ -[TSGeofenceManager fireGeofenceEvent:] 📢ENTER Geofence: ShipmentItem-24134
╚═══════════════════════════════════════════════════════════
2020-01-09 10:58:03.815 ✅-[TSGeofenceManager fireGeofenceEvent:] INSERT: 048C0B86-B14A-4A83-A108-421D81BCF560
2020-01-09 11:02:16.696
╔═══════════════════════════════════════════════════════════
║ -[TSGeofenceManager fireGeofenceEvent:] 📢EXIT Geofence: ShipmentItem-24132
╚═══════════════════════════════════════════════════════════
2020-01-09 11:02:16.700 ✅-[TSGeofenceManager fireGeofenceEvent:] INSERT: 6C4A981E-50A3-4E58-80D0-CF69CFB786CD
2020-01-09 11:02:16.700
╔═══════════════════════════════════════════════════════════
║ -[TSHttpService flush:]
╚═══════════════════════════════════════════════════════════
2020-01-09 11:02:16.700 ✅-[BackgroundTaskManager createBackgroundTask] 138
2020-01-09 11:02:16.701
╔═══════════════════════════════════════════════════════════
║ -[TSGeofenceManager fireGeofenceEvent:] 📢EXIT Geofence: ShipmentItem-24134
╚═══════════════════════════════════════════════════════════
2020-01-09 11:02:16.708 ✅-[TSHttpService schedulePost] LOCKED: 6C4A981E-50A3-4E58-80D0-CF69CFB786CD
2020-01-09 11:02:16.711 ✅-[TSGeofenceManager fireGeofenceEvent:] INSERT: 59B333FF-5991-439F-A7D4-FA6A018D5D9D
Our log contains 3 geo-fences, please fast forward to 2020-01-09 11:17:02.184 🎾-[TSGeofenceManager locationManager:didEnterRegion:] ShipmentItem-24133 this is the item that has a geo-fence enter but no exit.
See line item : 2020-01-09 11:44:45.924 ℹ️-[TSLocationManager locationManager:didExitRegion:] Exit provisional authorization inducer
Kindly check between 2020-01-09 11:17:02.184 and 2020-01-09 11:20:04.139 . This happened to a real user in production version of the app.
What is the lat/lng and radius of ShipmentItem-24133
the Geo-Fence radius for the 3 are the same, 200m.
2020-01-09 10:57:53.506 ℹ️-[TSLocationManager log:message:] Location::installGeofences [
{"identifier":"ShipmentItem-24132","radius":200,"latitude":49.2535183,"longitude":-123.0099238,"notifyOnEntry":true,"notifyOnExit":true,"extras":{"driverId":2138,"itemId":24132,"shipmentId":10493}},
{"identifier":"ShipmentItem-24133","radius":200,"latitude":49.2534191,"longitude":-122.9181315,"notifyOnEntry":true,"notifyOnExit":true,"extras":{"driverId":2138,"itemId":24133,"shipmentId":10493}},
{"identifier":"ShipmentItem-24134","radius":200,"latitude":49.2535183,"longitude":-123.0099238,"notifyOnEntry":true,"notifyOnExit":true,"extras":{"driverId":2138,"itemId":24134,"shipmentId":10493}}]
Are you trying to detect entry / exit on the Sky Train?
In this case it was setup for / around "Production Way-University Station" . Please note that the trip was not on foot, but in car.
24133
at this location
2020-01-09 11:17:02.190 🔵-[TSGeofenceManager locationManager:didUpdateLocations:] <+49.25285006,-122.91547531> +/- 8.46m (speed 14.43 mps / course 282.15) @ 2020-01-09, 11:17:02 AM Pacific Standard Time
2020-01-09 11:17:02.191 ╔═══════════════════════════════════════════════════════════ ║ -[TSGeofenceManager fireGeofenceEvent:] 📢ENTER Geofence: ShipmentItem-24133 ╚═══════════════════════════════════════════════════════════
- The device stops moving; the stopTimeout timer engages.
2020-01-09 11:19:08.834 🔵-[TSLocationManager beginStopDetection] ⏲Stop-timeout engaged: 300 s...
- A [low accuracy location](https://www.google.com/maps/place/49%C2%B014'42.7%22N+122%C2%B056'05.9%22W/@49.2451918,-122.9437319,15z/data=!4m5!3m4!1s0x0:0x0!8m2!3d49.2451918!4d-122.9349772) arrives (accuracy: 1338 meters). This causes the current geofence 24133 to exist outside the geofenceProximityRadius and the plugin stops monitoring it.
2020-01-09 11:20:04.138 ℹ️-[TSLocationManager locationManager:didUpdateLocations:] IGNORED LOCATION <+49.24519184,-122.93497715> +/- 1338.00m (speed -1.00 mps / course -1.00) @ 2020-01-09, 11:20:04 AM Pacific Standard Time
2020-01-09 11:20:04.139 ℹ️-[GeofenceDAO allWithinRadius:latitude:longitude:limit:]_block_invoke No geofences in proximity of 1000 meters
2020-01-09 11:20:04.139 ╔═══════════════════════════════════════════════════════════ ║ -[TSGeofenceManager evaluateProximity:] Found 0 / 2 within 1000 m ╚═══════════════════════════════════════════════════════════
2020-01-09 11:20:04.145 🔴-[TSGeofenceManager evaluateProximity:]_block_invoke STOP MONITORING ShipmentItem-24133
- About 5 min later, a Better location arrives. 24133 is detected within geofenceProximityRadius and monitoring is once again activated:
2020-01-09 11:24:05.918 📍<+49.25366968,-122.91887996> +/- 12.87m (speed 0.08 mps / course 186.35) @ 2020-01-09, 11:24:05 AM Pacific Standard Time
2020-01-09 11:24:05.918 ╔═══════════════════════════════════════════════════════════ ║ -[TSLocationManager locationManager:didUpdateLocations:] Enabled: 1 | isMoving: 1 | df: 100.0m | age: 0.4s ╚═══════════════════════════════════════════════════════════ 2020-01-09 11:24:05.974 ╔═══════════════════════════════════════════════════════════ ║ -[TSGeofenceManager evaluateProximity:] Found 1 / 2 within 1000 m ╚═══════════════════════════════════════════════════════════
2020-01-09 11:24:05.977 🎾-[TSGeofenceManager startMonitoringGeofence:] ShipmentItem-24133
- About 10 seconds later, the Geofence `24133` is enter once again [here](https://www.google.com/maps/place/49%C2%B015'13.4%22N+122%C2%B055'07.8%22W/@49.2537207,-122.9210302,17z/data=!3m1!4b1!4m5!3m4!1s0x0:0x0!8m2!3d49.2537207!4d-122.9188415)
2020-01-09 11:24:16.165 🔵-[TSGeofenceManager locationManager:didUpdateLocations:] <+49.25372070,-122.91884146> +/- 8.66m (speed 0.01 mps / course 137.28) @ 2020-01-09, 11:24:16 AM Pacific Standard Time
2020-01-09 11:24:16.166 ╔═══════════════════════════════════════════════════════════ ║ -[TSGeofenceManager fireGeofenceEvent:] 📢ENTER Geofence: ShipmentItem-24133 ╚═══════════════════════════════════════════════════════════
2020-01-09 11:24:16.173 ✅-[TSGeofenceManager fireGeofenceEvent:] INSERT: 9D64AA76-075F-4DA3-AAAF-A6EE58FBAA0E
- About 5 min later, the device is detected to be stopped. The plugin enters the stationary state [here](https://www.google.com/maps/place/49%C2%B015'13.3%22N+122%C2%B055'08.0%22W/@49.2537034,-122.9210844,17z/data=!3m1!4b1!4m5!3m4!1s0x0:0x0!8m2!3d49.2537034!4d-122.9188957)
2020-01-09 11:29:17.024 🔵-[TSLocationManager onStopTimeout:] stopTimer fired
2020-01-09 11:29:17.024 🔵-[TSLocationManager setPace:] 0
2020-01-09 11:29:17.093 ✅-[TSLocationManager locationManager:didUpdateLocations:] Acquired motionchange position: <+49.25370339,-122.91889572> +/- 6.88m (speed 0.06 mps / course 229.02) @ 2020-01-09, 11:29:16 AM Pacific Standard Time
2020-01-09 11:29:17.093 🔵-[TSLocationManager startMonitoringStationaryRegion:radius:] Radius: 25
- About 4 min later, the plugin's motion-detector detects the device is moving:
2020-01-09 11:33:12.447 🔵-[TSLocationManager setPace:] 1
- Within the same time-frame, as the plugin turns on location-services to start tracking, [the initial location is poor accuracy](https://www.google.com/maps/place/49%C2%B014'28.7%22N+122%C2%B054'50.6%22W/@49.2412921,-122.916242,17z/data=!3m1!4b1!4m5!3m4!1s0x0:0x0!8m2!3d49.2412921!4d-122.9140533) arrives. The plugin once again determines that geofence `24133` is outside the geofenceProximityRadius and stops monitoring it.
2020-01-09 11:33:12.459 ℹ️-[GeofenceDAO allWithinRadius:latitude:longitude:limit:]_block_invoke No geofences in proximity of 1000 meters
2020-01-09 11:33:12.459 ╔═══════════════════════════════════════════════════════════ ║ -[TSGeofenceManager evaluateProximity:] Found 0 / 2 within 1000 m ╚═══════════════════════════════════════════════════════════
2020-01-09 11:33:12.461 🔴-[TSGeofenceManager evaluateProximity:]_block_invoke STOP MONITORING ShipmentItem-24133
2020-01-09 11:33:12.515 📍<+49.24129208,-122.91405328> +/- 567.42m (speed -1.00 mps / course -1.00) @ 2020-01-09, 11:33:12 AM Pacific Standard Time
- Finally, about 14 seconds later, [a high quality location](https://www.google.com/maps/place/49%C2%B015'15.3%22N+122%C2%B055'44.1%22W/@49.2543413,-122.9273427,17z/data=!4m5!3m4!1s0x0:0x0!8m2!3d49.2542362!4d-122.9289119) arrives and geofence 24133 is once again within geofenceProximityRadius. However, the device is *already* outside this geofence when it becomes monitored.
2020-01-09 11:33:26.595 📍<+49.25423618,-122.92891193> +/- 16.09m (speed 21.12 mps / course 271.87) @ 2020-01-09, 11:33:26 AM Pacific Standard Time 2020-01-09 11:33:26.618 ╔═══════════════════════════════════════════════════════════ ║ -[TSGeofenceManager evaluateProximity:] Found 1 / 2 within 1000 m ╚═══════════════════════════════════════════════════════════
2020-01-09 11:33:26.625 🎾-[TSGeofenceManager startMonitoringGeofence:] ShipmentItem-24133
- The device carries on [moving west](https://www.google.com/maps/place/49%C2%B015'15.4%22N+122%C2%B056'06.3%22W/@49.254264,-122.9372655,17z/data=!3m1!4b1!4m5!3m4!1s0x0:0x0!8m2!3d49.254264!4d-122.9350768), away from the geofence 24133.
The distance from geofende 24133
to the poor accuracy location that was used to evaluate geofences, causing 24133
to stop being monitored is ~1.5km, confirming it exists outside the geofenceProximityRadius
(which defaults to 1000
meters.)
geofenceProximityRadius + location.accuracy
).geofenceProximityRadius
as desired (eg: 5000
).The plugin's default geofenceProximityRadius: 1000
is probably too low. I think I'll double it to 2000
.
And if you're always monitoring less than 18 geofences at any given time, it wouldn't matter if you make geofenceProximityRadius
the radius of earth (6371km).
@christocracy we will wait for the next plugin update and in the meantime I will talk to the team to maybe increase the geo-fence radius.
We appreciate your responsiveness.
If all this stuff about "geofence proximity radius" is new to you, read the Geofencing Guide in API docs. See the section Infinite Geofencing.
It's completely safe to use geofenceProximityRadius: 5000
. It's very clear to me it would have prevented the issue above.
@christocracy thanks so yes, we will configure geofenceProximityRadius to a high number (5000) , and I will talk to the team to see if we can increase also geofence radius.. I think combined this should cover our use case.
Thanks again
Just found another interesting case: in this case the geo-fence got triggered pre-maturely because 1GPS fix was inaccurate, this relates back to your point that if you take location.accuracy into consideration when doing the geo-fence calculation, we won't have the geo-fence trigger prematurely.
The excel attached shows the entire trip, see data item
In this case, a less accurate GPS fix triggered geo-fence prematurely
Phone logs + XLS of entire trip attached. hope this helps refine geo-fencing
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You may also mark this issue as a "discussion" and I will leave this open.
Closing this issue after a prolonged period of inactivity. Fell free to reopen this issue, if this still affecting you.
Sometimes geofence events are not triggered. In logs I found out, that exitregion is called but return this message instead of usual 'identifier'
Your Environment
react-native -v
): 0.61.5Expected Behavior
Triggering geofence exit event
Actual Behavior
ℹ️-[TSLocationManager locationManager:didExitRegion:] Exit provisional authorization inducer
Steps to Reproduce
Context
Trying to track whole path of user and do some logic when user comes and exits geofence zone
Debug logs
Logs
Logs is too long, I put it on [drive](https://drive.google.com/open?id=1BwInqMOLDIupQUVaghcVdhTWC0jp_7Nz)