Closed stevegaunt closed 5 months ago
Register event-listeners before calling .ready(), not after.
@christocracy there currently are.
bg.BackgroundGeolocation.onGeofence((bg.GeofenceEvent event) async {
log('[geofence] ${event.identifier}, ${event.action}');
});
bg.BackgroundGeolocation.onGeofencesChange((bg.GeofencesChangeEvent event) async {
log('[GeofencesChangeEvent off] ${event.off}');
log('[GeofencesChangeEvent on] ${event.on}');
});
//this config is **only** used for the first install and is ignored thereafter. It becomes the default.
var locationTrackingConfig = await sdk.getBaseLocationConfig(deviceInfoHeadersFactory);
try {
await bg.BackgroundGeolocation.ready(locationTrackingConfig);
} catch (error, stack) {
CrashReporting.instance.recordError(error, stack);
}
I've been running the /example app for years on my main iOS device (currently iPhone 13 Pro @ 15.5). I constantly monitor about 15 geofences throughout my neighbourhood.
I just took a little bike ride.
onGeofence
event.I am not able to reproduce the issue "Initial Geofence events missed for IOS handlers when the app is launched as a service form the background".
onGeofence
renders markers to highlight a geofence event.EXIT
event.onGeofence
did not fire after re-launching in background, the markers would not be rendered.Hello @christocracy, I need to track geofence event action in the terminate state of the app. In IOS it's not working, I have also tried preventSuspend true in geofence config. Please help me with that. Thanks in advance!
Software Version: 15.3.1 Device: iPhone X
I have also tried preventSuspend tru
This has nothing to do with geofence firing.
Software Version: 15.3.1
This os version is know to have bugs. Upgrade to latest.
Okay, then I will not use preventSuspend & let me try in another version. I will get back to you. Thanks!
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.
Your Environment
Plugin version: 4.7.0
Platform: IOS
OS version: 15.5
Device manufacturer / model: Iphone 12 mini
Flutter info (
flutter doctor
): [✓] Flutter (Channel stable, 2.8.1, on macOS 12.4 21F79 darwin-x64, locale en-GB) [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 13.4.1) [✓] Chrome - develop for the web [!] Android Studio (not installed) [✓] IntelliJ IDEA Ultimate Edition (version 2021.2) [✓] Connected device (3 available)Plugin config:
bg.Config( // tracking turning off issue is present on both android and ios: we don't want to set preventSuspend to true because it will increase our battery drain dramatically // preventSuspend: true, // heartbeatInterval: 60, autoSync: true, autoSyncThreshold: 20, desiredAccuracy: Config.DESIRED_ACCURACY_HIGH, distanceFilter: 50.0, elasticityMultiplier: 4.0, geofenceModeHighAccuracy: true, stopOnTerminate: false, startOnBoot: true, logLevel: Config.LOG_LEVEL_INFO, logMaxDays: 1, reset: kDebugMode, debug: kDebugMode, locationAuthorizationRequest: 'Always', enableHeadless: true, url: Config.LOCATION_API_URL, headers: headers, batchSync: true, maxBatchSize: 500, maxRecordsToPersist: 100000, maxDaysToPersist: 7, backgroundPermissionRationale: bg.PermissionRationale( title: "Allow {applicationName} to access this device's location even when closed or not in use?", message: "This enables the automatic logging", positiveAction: "Change to \"{backgroundPermissionOptionLabel}\"", negativeAction: "")); }
bg.onGeofence((GeofenceEvent event) { print('[onGeofence] ${event}'); });