flutter_background_geolocation
flutter_background_geolocation copied to clipboard
How to stop data sending to the test server.
Your Environment
- Plugin version: 4.7.1
- Platform: Android
- OS version: 11
- Device manufacturer / model: Xiaomi Redmi Note 11
- Flutter info (
flutter doctor
): Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel stable, 3.3.4, on Microsoft Windows [Version 10.0.19044.2130], locale en-GB) Checking Android licenses is taking an unexpectedly long time...[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3) [√] Chrome - develop for the web [√] Android Studio (version 2021.3) [√] Connected device (4 available) [√] HTTP Host Availability No issues found. - Plugin config:
bg.TransistorAuthorizationToken token =
await bg.TransistorAuthorizationToken.findOrCreate(
orgname, username, ENV.TRACKER_HOST);
bg.BackgroundGeolocation.ready(bg.Config(
reset: false,
transistorAuthorizationToken: token,
debug: false,
logLevel: bg.Config.LOG_LEVEL_VERBOSE,
desiredAccuracy: bg.Config.DESIRED_ACCURACY_NAVIGATION,
distanceFilter: 10.0,
stopTimeout: 5,
autoSync: true,
stopOnTerminate: true,
locationAuthorizationRequest: 'Always',
startOnBoot: true,
enableHeadless: true,
heartbeatInterval: 60))
.then((bg.State state) async {
if (state.schedule!.isNotEmpty) {
bg.BackgroundGeolocation.startSchedule();
}
setState(() {
_enabled = state.enabled;
_isMoving = state.isMoving!;
});
}).catchError((error) {
print('[ready] ERROR: $error');
});
Expected Behavior
Don't want to send geofence event data to test server in release version of app.
Actual Behavior
What part of geofence sdk code is making this test server call is not clear, I can see every geofence event call in test server after my testing.
Context
I have removed call of ${ENV.TRACKER_HOST}/api/devices and bg.BackgroundGeolocation.setConfig(bg.Config(url: "${ENV.TRACKER_HOST}/api/locations")); lines from my application code but it's not making any sense, I'm not getting this test server call method in SDK.
bg.TransistorAuthorizationToken token = await bg.TransistorAuthorizationToken.findOrCreate( orgname, username, ENV.TRACKER_HOST);
transistorAuthorizationToken: token,
delete ALL of that.
Read the api docs.
reset: false
and set this the true
.
It looks like you’re just copying code from the demo app. 99% of use-cases don’t need reset: false
. That’s a special case designed for the demo app, so the Settings screen can drive the Config and not be reset back with each launch. That is not a typical use-case for the typical app.
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.