transistorsoft / transistorsoft/flutter_background_geolocation

[Bug]: After calling ready() on app start, it automatically stop the tracking and start automatically

Open
#1,714 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Dart
Stars
732
Forks
285
PR merge metrics
No merged PRs in 30d

Description

Required Reading
  • Confirmed
Plugin Version

5.6.0

Flutter Doctor
[✓] Flutter (Channel stable, 3.47.2, on macOS 26.5.2 25F84 darwin-arm64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 26.1.1)
[✓] Chrome - develop for the web
[✓] Connected device (4 available)
[✓] Network resources

• No issues found!
Mobile operating-system(s)
  • iOS
  • Android
Device Manufacturer(s) and Model(s)

Iphone 11

Device operating-systems(s)

ios 26

What happened?

With our app logs in profile mode, we noticed two things:

After calling ready() on app start, it automatically stop the tracking and start automatically, and within a few milliseconds, we receive an Enter event from the onGeofence callback, even though neither stop(), start(), nor startGeofence() has been called yet.

Plugin Code and/or Config
await _backgroundGeolocation.ready(
        bg.Config(
          geolocation: const bg.GeoConfig(
            locationAuthorizationAlert: {
              'titleWhenNotEnabled': TextConstants.locationServicesDisabled,
              'titleWhenOff': TextConstants.locationServicesDisabled,
              'instructions': TextConstants.pleaseEnableLocationServices,
              'cancelButton': TextConstants.cancel,
              'settingsButton': TextConstants.settings,
            },
            locationAuthorizationRequest: 'Always',
            geofenceModeHighAccuracy: true,
            geofenceProximityRadius: 2000,
            geofenceInitialTriggerEntry: true,
            showsBackgroundLocationIndicator: false,
            // Only takes effect when we call start() (full tracking); the
            // plugin ignores it in geofences-only mode. Set once here so the
            // start()/startGeofences() wrappers never have to setConfig it
            // per transition.
            useSignificantChangesOnly: true,
            //Preserve v4 behavior (PassThrough / “passthrough mode”)
            filter: bg.LocationFilter(
              policy: bg.LocationFilterPolicy.passThrough,
              useKalman: false, // optional
              trackingAccuracyThreshold: 0, // optional: disables accuracy gate
              odometerAccuracyThreshold: 0, // optional: disables accuracy gate
            ),
          ),
          app: bg.AppConfig(
            notification: bg.Notification(
              channelName: groupChannelName,
              channelId: groupChannelId,
              smallIcon: 'mipmap/ic_launcher',
              title: TextConstants.notificationMainTitle,
              priority: bg.NotificationPriority.min,
            ),
            startOnBoot: true,
            stopOnTerminate: false,
            enableHeadless: true,
          ),
          http: bg.HttpConfig(
            autoSync: false,
          ),
          persistence: const bg.PersistenceConfig(
            persistMode: bg.PersistMode.none,
            maxRecordsToPersist: 0,
          ),
          logger: bg.LoggerConfig(
            /// Enable it when debugging geofences
            // debug: devToolEnabled,
            debug: AppRunnerMode.instance.isDebugMode,
            logLevel: bg.LogLevel.verbose,
          ),
          reset: true,
          isMoving: true,
        ),
      );

Default 
BackgroundGeolocation.startGeofences();

When ENTER Zone 
BackgroundGeolocation.start();

When EXIT Zone 
BackgroundGeolocation.startGeofences();
Relevant log output
║ -[TSTrackingService start:] 🟢 trackingMode: 1
║ -[TSTrackingService stop] 🛑 stop
║ -[TSTrackingService start:] 🟢 trackingMode: 1
║ -[TSTrackingService stop] 🛑 stop
║ -[TSTrackingService onMotionActivityChange:] | still/100 | isMoving: 0
║ -[TSTrackingService start:] 🟢 trackingMode: 1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the startup sequence using ready() with the shown configuration, followed by startGeofences(), and compare logs around start(), stop(), and onGeofence. Trace the tracking-mode transitions and determine why tracking changes before an explicit start or stop call; done means startup no longer causes unexpected transitions or Enter events.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.