Skip to content

[Bug]: iOS Geofencing stops when force killing the app #1650

@rick-hl

Description

@rick-hl

Required Reading

  • Confirmed

Plugin Version

5.0.5

Flutter Doctor

[!] Flutter (Channel [user-branch], 3.27.0, on macOS 26.2 25C56 darwin-arm64, locale en-PH)
    ! Flutter version 3.27.0 on channel [user-branch] at /Users/k/Documents/GitHub/flutter
      Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
      If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/setup.
    ! Upstream repository unknown source is not a standard remote.
      Set environment variable "FLUTTER_GIT_URL" to unknown source to dismiss this error.
[✓] Android toolchain - develop for Android devices (Android SDK version 36.1.0)
[✓] Xcode - develop for iOS and macOS (Xcode 26.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2025.1)
[✓] VS Code (version 1.109.5)
[✓] Connected device (4 available)
    ! Error: Browsing on the local area network for Rick KrystianneのiPad. Ensure the device is unlocked and attached
      with a cable or associated with the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] Network resources

! Doctor found issues in 1 category.

Mobile operating-system(s)

  • iOS
  • Android

Device Manufacturer(s) and Model(s)

iPhone 12 mini

Device operating-systems(s)

iOS 26

What happened?

There are no location data sent to our server when force killing the app in iOS.

Tested the app while driving. Minimizing the app works fine.

        <key>UIBackgroundModes</key>
	<array>
		<string>fetch</string>
		<string>location</string>
	</array>

Plugin Code and/or Config

bg.Config(
          debug: DevUtils.showTrackingDebugging,
          minimumActivityRecognitionConfidence: 50,
          locationTimeout: 120,
          distanceFilter: 300.0,
          startOnBoot: false,
          stopOnTerminate: false,
          httpRootProperty: '.',
          locationsOrderDirection: 'ASC',
          logLevel: DevUtils.showTrackingDebugging
              ? bg.Config.LOG_LEVEL_DEBUG
              : bg.Config.LOG_LEVEL_OFF,
          desiredAccuracy: Platform.isIOS
              ? bg.Config.DESIRED_ACCURACY_NAVIGATION
              : bg.Config.DESIRED_ACCURACY_HIGH,
          locationTemplate:
              '{"Latitude":"<%= latitude %>", "Longitude":"<%= longitude %>", "Timestamp":"<%= timestamp %>", "BatteryLevel":"<%= battery.level %>", "IsCharging":"<%= battery.is_charging %>", "PollEvent":"<%= event %>"}',
          headers: {
            ...
            ...
          },
          activityType: bg.Config.ACTIVITY_TYPE_AUTOMOTIVE_NAVIGATION,
          logMaxDays: 3,
          maxDaysToPersist: 14,
          maxRecordsToPersist: -1,
          autoSync: true,
          url: '$baseUrl${Endpoints.tracking}',
          disableElasticity: true,
          disableLocationAuthorizationAlert: true,
          backgroundPermissionRationale: bg.PermissionRationale(
            title: Strings.permissionAndroidRationaleTitle,
            message: Strings.permissionAndroidRationaleCaption,
          ),
          // No activity sensor usage
          disableMotionActivityUpdates: true,
        ),

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions