[Help Wanted]: no EXIT event after the app was booted in background.
Required Reading
- [x] Confirmed
Plugin Version
4.16.9
Mobile operating-system(s)
- [x] iOS
- [ ] Android
Device Manufacturer(s) and Model(s)
iPhone 14 Pro
Device operating-systems(s)
18.4.1
What do you require assistance about?
Hi,
after receiving the ENTER event, I force quit the app, walk at least 200 meters, and see the app display a notification that the app has booted in the background. However, no EXIT event was triggered. The problem occurs with either start() or startGeofence().
ENTER event
2025-05-15 17:06:34.094 ╔═══════════════════════════════════════════════════════════ ║ -[TSGeofenceManager fireGeofenceEvent:] 📢ENTER Geofence: 14 ╚═══════════════════════════════════════════════════════════
After waking up, it shows that I have already left the polygon's geofence.
2025-05-15 17:10:17.273 ╔═══════════════════════════════════════════════════════════ ║ -[PolygonGeofencingService didExitRegion:] EXIT containing geofence of polygon: 14 ╚═══════════════════════════════════════════════════════════
but no EXIT event.
Do you have any ideas?
[Optional] Plugin Code and/or Config
bg.BackgroundGeolocation.ready(bg.Config(
reset: true,
enableHeadless: true,
foregroundService: true,
desiredAccuracy: bg.Config.DESIRED_ACCURACY_HIGH,
isMoving: true,
stationaryRadius: 25,
distanceFilter: 10.0,
notification: bg.Notification(
smallIcon: "drawable/launcher_icon",
largeIcon: "mipmap/launcher_icon",
sticky: false,
title: "$title - tracking your location",
text:
"$title accessing background location to track your location, even when it's not running."),
backgroundPermissionRationale: bg.PermissionRationale(
title: "Allow {applicationName} to access this device's location even when the app is closed or not in use.",
message: "This app collects location data to change your status based on geofence.",
positiveAction: 'Change to "{backgroundPermissionOptionLabel}"',
negativeAction: 'Cancel'
),
stopOnTerminate: false,
startOnBoot: true,
stopTimeout: 5,
debug: true,
geofenceProximityRadius: 2000,
heartbeatInterval: 60,
preventSuspend: false,
persistMode: bg.Config.PERSIST_MODE_ALL,
geofenceModeHighAccuracy: true,
showsBackgroundLocationIndicator: true,
maxDaysToPersist: 3,
locationAuthorizationRequest: 'Always',
logLevel: bg.Config.LOG_LEVEL_VERBOSE))
.then((bg.State state) {
print('[ready] - $state');
print('!!!!!!!!!!!!!!! start background geolocation with forceRestart: $forceRestart and enableDebugMode: $enableDebugMode');
if (enableDebugMode) {
startDebugMode();
} else {
if (!state.enabled || forceRestart) {
// start the plugin
bg.BackgroundGeolocation.startGeofences();
}
}
});
[Optional] Relevant log output
2025-05-15 17:06:34.094
╔═══════════════════════════════════════════════════════════
║ -[TSGeofenceManager fireGeofenceEvent:] 📢ENTER Geofence: 14
╚═══════════════════════════════════════════════════════════
2025-05-15 17:06:34.097 ✅-[TSGeofenceManager fireGeofenceEvent:] INSERT: E496D7A1-48ED-47C9-A459-AAA580FFF66A
2025-05-15 17:06:34.097
╔═══════════════════════════════════════════════════════════
║ -[TSHttpService flush:]
╚═══════════════════════════════════════════════════════════
2025-05-15 17:06:34.099 ✅-[BackgroundTaskManager createBackgroundTask] 37
2025-05-15 17:06:34.100 ✅-[BackgroundTaskManager createBackgroundTask] 38
2025-05-15 17:06:34.100 ℹ️-[TSLocationManager log:message:] showZoneEntryNotification called with zoneIdentifier: 14 with name Home §§§ and action: ENTER
2025-05-15 17:06:34.103 ✅-[TSHttpService schedulePost] LOCKED: E496D7A1-48ED-47C9-A459-AAA580FFF66A
2025-05-15 17:06:34.106 ℹ️-[TSLocationManager log:message:] Waiting for 1 second before proceeding...
2025-05-15 17:06:34.257 🔵-[HttpResponse handleResponse] Response: 200
2025-05-15 17:06:34.267 ✅-[TSHttpService post:]_block_invoke DESTROY: E496D7A1-48ED-47C9-A459-AAA580FFF66A
2025-05-15 17:06:34.267
╔═══════════════════════════════════════════════════════════
║ -[TSHttpService finish:error:] Success: 1
╚═══════════════════════════════════════════════════════════
2025-05-15 17:06:34.267 ✅-[BackgroundTaskManager stopBackgroundTask:]_block_invoke 37 OF (
37,
38
)
2025-05-15 17:06:35.088
╔═══════════════════════════════════════════════════════════
║ -[PolygonGeofencingService isInPolygon:] 📍 52.571370, 13.516401, acy: 4.7m
╚═══════════════════════════════════════════════════════════
2025-05-15 17:06:35.089 ℹ️-[PolygonGeofencingService isInPolygon:] --> 14: 100.0%
2025-05-15 17:06:35.256 ℹ️-[TSLocationManager log:message:] showZoneEntryNotification completed
2025-05-15 17:06:35.256 ✅-[BackgroundTaskManager stopBackgroundTask:]_block_invoke 38 OF (
38
)
2025-05-15 17:06:36.093
╔═══════════════════════════════════════════════════════════
║ -[PolygonGeofencingService isInPolygon:] 📍 52.571370, 13.516401, acy: 4.7m
╚═══════════════════════════════════════════════════════════
2025-05-15 17:06:36.093 ℹ️-[PolygonGeofencingService isInPolygon:] --> 14: 100.0%
2025-05-15 17:06:37.088
╔═══════════════════════════════════════════════════════════
║ -[PolygonGeofencingService isInPolygon:] 📍 52.571370, 13.516401, acy: 4.8m
╚═══════════════════════════════════════════════════════════
2025-05-15 17:06:37.088 ℹ️-[PolygonGeofencingService isInPolygon:] --> 14: 100.0%
2025-05-15 17:06:37.435
╔═══════════════════════════════════════════════════════════
║ -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | still/33 | isMoving: 0
╚═══════════════════════════════════════════════════════════
2025-05-15 17:06:38.087
╔═══════════════════════════════════════════════════════════
║ -[PolygonGeofencingService isInPolygon:] 📍 52.571370, 13.516401, acy: 4.9m
╚═══════════════════════════════════════════════════════════
2025-05-15 17:06:38.087 ℹ️-[PolygonGeofencingService isInPolygon:] --> 14: 100.0%
2025-05-15 17:06:39.092
╔═══════════════════════════════════════════════════════════
║ -[PolygonGeofencingService isInPolygon:] 📍 52.571370, 13.516401, acy: 6.4m
╚═══════════════════════════════════════════════════════════
2025-05-15 17:06:39.092 ℹ️-[PolygonGeofencingService isInPolygon:] --> 14: 100.0%
2025-05-15 17:06:39.367
╔═══════════════════════════════════════════════════════════
║ -[TSLocationManager createMotionTypeChangedHandler]_block_invoke | on_foot/100 | isMoving: 1
╚═══════════════════════════════════════════════════════════
2025-05-15 17:06:40.095
╔═══════════════════════════════════════════════════════════
║ -[PolygonGeofencingService isInPolygon:] 📍 52.571370, 13.516401, acy: 8.1m
╚═══════════════════════════════════════════════════════════
2025-05-15 17:06:40.095 ℹ️-[PolygonGeofencingService isInPolygon:] --> 14: 100.0%
2025-05-15 17:06:41.091
╔═══════════════════════════════════════════════════════════
║ -[PolygonGeofencingService isInPolygon:] 📍 52.571356, 13.516391, acy: 8.0m
╚═══════════════════════════════════════════════════════════
2025-05-15 17:06:41.091 ℹ️-[PolygonGeofencingService isInPolygon:] --> 14: 100.0%
2025-05-15 17:06:42.090
╔═══════════════════════════════════════════════════════════
║ -[PolygonGeofencingService isInPolygon:] 📍 52.571356, 13.516388, acy: 8.1m
╚═══════════════════════════════════════════════════════════
2025-05-15 17:06:42.091 ℹ️-[PolygonGeofencingService isInPolygon:] --> 14: 100.0%
2025-05-15 17:06:43.084
╔═══════════════════════════════════════════════════════════
║ -[PolygonGeofencingService isInPolygon:] 📍 52.571353, 13.516385, acy: 8.2m
╚═══════════════════════════════════════════════════════════
2025-05-15 17:06:43.084 ℹ️-[PolygonGeofencingService isInPolygon:] --> 14: 100.0%
2025-05-15 17:06:44.084
╔═══════════════════════════════════════════════════════════
║ -[PolygonGeofencingService isInPolygon:] 📍 52.571352, 13.516389, acy: 8.3m
╚═══════════════════════════════════════════════════════════
2025-05-15 17:06:44.084 ℹ️-[PolygonGeofencingService isInPolygon:] --> 14: 100.0%
2025-05-15 17:06:45.083
╔═══════════════════════════════════════════════════════════
║ -[PolygonGeofencingService isInPolygon:] 📍 52.571350, 13.516389, acy: 8.3m
╚═══════════════════════════════════════════════════════════
2025-05-15 17:06:45.083 ℹ️-[PolygonGeofencingService isInPolygon:] --> 14: 100.0%
2025-05-15 17:06:45.594 🔵-[TSLocationManager onSuspend:] enabled? 1)
2025-05-15 17:06:45.600 ℹ️-[TSDBLogger db_save] Log committed
2025-05-15 17:06:46.093
╔═══════════════════════════════════════════════════════════
║ -[PolygonGeofencingService isInPolygon:] 📍 52.571348, 13.516391, acy: 8.3m
╚═══════════════════════════════════════════════════════════
2025-05-15 17:06:46.093 ℹ️-[PolygonGeofencingService isInPolygon:] --> 14: 100.0%
2025-05-15 17:06:47.095
╔═══════════════════════════════════════════════════════════
║ -[PolygonGeofencingService isInPolygon:] 📍 52.571348, 13.516392, acy: 8.2m
╚═══════════════════════════════════════════════════════════
2025-05-15 17:06:47.095 ℹ️-[PolygonGeofencingService isInPolygon:] --> 14: 100.0%
2025-05-15 17:06:48.086
╔═══════════════════════════════════════════════════════════
║ -[PolygonGeofencingService isInPolygon:] 📍 52.571347, 13.516394, acy: 8.1m
╚═══════════════════════════════════════════════════════════
2025-05-15 17:06:48.087 ℹ️-[PolygonGeofencingService isInPolygon:] --> 14: 100.0%
2025-05-15 17:06:49.088
╔═══════════════════════════════════════════════════════════
║ -[PolygonGeofencingService isInPolygon:] 📍 52.571346, 13.516397, acy: 8.1m
╚═══════════════════════════════════════════════════════════
2025-05-15 17:06:49.088 ℹ️-[PolygonGeofencingService isInPolygon:] --> 14: 100.0%
2025-05-15 17:10:17.241 ℹ️-[TSDBLogger db_delete] maxAge: 259200
2025-05-15 17:10:17.241 ℹ️-[TSLocationManager init]
╔═════════════════════════════════════════════
║ TSLocationManager (build 388)
╠══════════════════════════════════════════════
{
activityRecognitionInterval = 10000;
activityType = 1;
authorization = {
accessToken = "eyJhb<redacted>";
expires = "-1";
refreshHeaders = {
};
refreshPayload = {
"refresh_token" = "{refreshToken}";
};
refreshToken = "d4bdf<redacted>";
refreshUrl = "https://app.emessage.de/dev/debug/api/refresh_token";
strategy = jwt;
};
autoSync = 1;
autoSyncThreshold = 0;
batchSync = 0;
debug = 1;
desiredAccuracy = "-1";
desiredOdometerAccuracy = 100;
didDeviceReboot = 0;
didLaunchInBackground = 0;
didRequestUpgradeLocationAuthorization = 1;
disableAutoSyncOnCellular = 0;
disableElasticity = 0;
disableLocationAuthorizationAlert = 0;
disableMotionActivityUpdates = 0;
disableStopDetection = 0;
distanceFilter = 10;
elasticityMultiplier = 1;
enableTimestampMeta = 0;
enabled = 1;
extras = {
};
geofenceInitialTriggerEntry = 1;
geofenceProximityRadius = 2000;
geofenceTemplate = "";
headers = {
};
heartbeatInterval = 60;
httpRootProperty = location;
httpTimeout = 60000;
iOSHasWarnedLocationServicesOff = 0;
isFirstBoot = 0;
isMoving = 0;
lastLocationAuthorizationStatus = 3;
locationAuthorizationAlert = {
cancelButton = Cancel;
instructions = "To use background location, you must enable '{locationAuthorizationRequest}' in the Location Services settings";
settingsButton = Settings;
titleWhenNotEnabled = "Background location is not enabled";
titleWhenOff = "Location services are off";
};
locationAuthorizationRequest = Always;
locationTemplate = "";
locationTimeout = 60;
locationsOrderDirection = ASC;
logLevel = 5;
logMaxDays = 3;
maxBatchSize = "-1";
maxDaysToPersist = 3;
maxRecordsToPersist = "-1";
method = POST;
minimumActivityRecognitionConfidence = 70;
odometer = "856.3650369332488";
params = {
};
pausesLocationUpdatesAutomatically = 1;
persistMode = 2;
preventSuspend = 0;
schedule = (
);
schedulerEnabled = 0;
showsBackgroundLocationIndicator = 1;
startOnBoot = 1;
stationaryRadius = 25;
stopAfterElapsedMinutes = "-1";
stopDetectionDelay = 0;
stopOnStationary = 0;
stopOnTerminate = 0;
stopTimeout = 5;
trackingMode = 0;
triggerActivities = "";
url = "https://app.emessage.de/dev/debug/api/locations";
useSignificantChangesOnly = 0;
}
2025-05-15 17:10:17.243 ℹ️-[GeofenceDAO init] CREATE TABLE IF NOT EXISTS geofences (id INTEGER PRIMARY KEY AUTOINCREMENT, identifier TEXT NOT NULL UNIQUE, latitude DOUBLE NOT NULL, sin_latitude DOUBLE NOT NULL, cos_latitude DOUBLE NOT NULL, longitude DOUBLE NOT NULL, sin_longitude DOUBLE NOT NULL, cos_longitude DOUBLE NOT NULL, radius DOUBLE NOT NULL, notifyOnEntry BOOLEAN NOT NULL DEFAULT 0, notifyOnExit BOOLEAN NOT NULL DEFAULT 0, notifyOnDwell BOOLEAN NOT NULL DEFAULT 0, loiteringDelay DOUBLE NOT NULL DEFAULT 0, extras TEXT, vertices TEXT)
2025-05-15 17:10:17.243 ℹ️-[GeofenceDAO init] CREATE index IF NOT EXISTS identifier ON geofences (identifier);CREATE index IF NOT EXISTS latitude ON geofences (latitude);CREATE index IF NOT EXISTS longitude ON geofences (longitude);CREATE index IF NOT EXISTS sin_latitude ON geofences (sin_latitude);CREATE index IF NOT EXISTS cos_latitude ON geofences (cos_latitude);CREATE index IF NOT EXISTS sin_longitude ON geofences (sin_longitude);CREATE index IF NOT EXISTS cos_longitude ON geofences (cos_longitude);
2025-05-15 17:10:17.271 🔵-[TSLocationManager locationManager:didChangeAuthorizationStatus:] status 3
2025-05-15 17:10:17.273 🔵-[LocationManager locationManager:didChangeAuthorizationStatus:] 3
2025-05-15 17:10:17.273 🔴-[TSGeofenceManager locationManager:didExitRegion:] 14
2025-05-15 17:10:17.273
╔═══════════════════════════════════════════════════════════
║ -[PolygonGeofencingService didExitRegion:] EXIT containing geofence of polygon: 14
╚═══════════════════════════════════════════════════════════
2025-05-15 17:10:17.273 🔴-[PolygonGeofencingService stopMonitoring:] 14
2025-05-15 17:10:17.273 ℹ️-[PolygonGeofencingService persistMonitoredPolygons] {
}
2025-05-15 17:10:17.274 🔵-[PolygonGeofencingService locationManager:didChangeAuthorizationStatus:] 3
2025-05-15 17:10:17.274 🔵-[LocationManager locationManager:didChangeAuthorizationStatus:] 3
2025-05-15 17:10:17.274 🔵-[BackgroundTaskManager locationManager:didChangeAuthorizationStatus:] 3
2025-05-15 17:10:17.274 🔵-[LocationManager locationManager:didChangeAuthorizationStatus:] 3
2025-05-15 17:10:17.278 ℹ️+[LocationAuthorization run:onCancel:] status: 3
2025-05-15 17:10:17.319 ℹ️-[TSGeofenceManager onGeofence:]
2025-05-15 17:10:17.319 ℹ️-[TSHttpService onAuthorization:]
2025-05-15 17:10:17.319 ℹ️-[TSGeofenceManager onGeofencesChange:]
2025-05-15 17:10:17.324 ℹ️-[TSConfig persist]
2025-05-15 17:10:17.325 ℹ️-[TSConfig persist]
2025-05-15 17:10:17.326 ℹ️-[TSConfig persist]
2025-05-15 17:10:17.326 🔵-[TSLocationManager ready]
2025-05-15 17:10:17.327 🔵-[TSLocationManager ready] Booted in background
2025-05-15 17:10:17.327 ℹ️-[TSLocationManager doStart:] trackingMode: 0
2025-05-15 17:10:17.327 ℹ️-[TSLocationManager clearLastOdometerLocation]
2025-05-15 17:10:17.327 🎾-[TSGeofenceManager start]
2025-05-15 17:10:17.327 🎾-[SOMotionDetector startDetection]
2025-05-15 17:10:17.327 🔵-[TSLocationManager setPace:] 0
2025-05-15 17:10:17.327 ℹ️-[TSConfig persist]
2025-05-15 17:10:17.328 🎾-[TSLocationManager startUpdatingLocation] Location-services: ON
2025-05-15 17:10:17.328 🎾-[TSLocationManager startMonitoringSignificantLocationChanges]
2025-05-15 17:10:17.331 ✅-[SOMotionDetector startDetection]_block_invoke Enabled M7 MotionActivity updates
2025-05-15 17:10:17.332
📍<+52.57410049,+13.51727771> +/- 1414.00m (speed -1.00 mps / course -1.00) @ 15.05.25, 14:35:57 Central European Summer Time
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.