Open SAPLMobileDev opened 3 weeks ago
Observe the plugin's native logs with $ adb logcat *:S TSLocationManager:V
.
Ensure the native geofence event fires just once. If it does, then the problem is within your own Javascript.
04-17 09:37:13.992 19996 14041 I TSLocationManager: [c.t.l.s.GeofencingService a]
04-17 09:37:13.992 19996 14041 I TSLocationManager: ╔═════════════════════════════════════════════
04-17 09:37:13.992 19996 14041 I TSLocationManager: ║ Geofencing Event: ENTER
04-17 09:37:13.992 19996 14041 I TSLocationManager: ╠═════════════════════════════════════════════
04-17 09:37:13.992 19996 14041 I TSLocationManager: ╟─ Home
04-17 09:37:13.992 19996 14041 I TSLocationManager: ╚═════════════════════════════════════════════
Yes, we checked as you said but event is triggerd 8 times and 12 times
Show me more of your code. Where you’re adding/removing geofences and the specific attributes you’re providing your geofences.
this are referance files, usegeofence :- custom hook Goefence:- first screen registration done from here for the library its a separate screen Plotgeofence:- screen where in db operation done and then passed to hook to register geofence
--TS files converted into TXT for upload
Your Environment
react-native -v
): "react-native": "0.73.2"useEffect(() => { console.log(
subscribe
); subscribe(BackgroundGeolocation.onGeofence(setGeofenceEvent)); return () => { // Important for with live-reload to remove BackgroundGeolocation event subscriptions. unsubscribe(); clearMarkers(); }; }, []);useEffect(() => { if (!geofenceEvent) return; const updatedGeofenceHitEvents = updateGeofenceHitEvents(geofenceEvent); if ( updatedGeofenceHitEvents.length !== geofenceHitEvent.length || !updatedGeofenceHitEvents.every( (newItem, index) => newItem.ShopId === geofenceHitEvent[index].ShopId && newItem.Action === geofenceHitEvent[index].Action, ) ) { setGeofenceHitEvent(updatedGeofenceHitEvents); } }, [geofenceEvent]);