Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Geofencing not working accurately #1360

Open
pratikbutani opened this issue Oct 1, 2024 · 4 comments
Open

Geofencing not working accurately #1360

pratikbutani opened this issue Oct 1, 2024 · 4 comments
Labels

Comments

@pratikbutani
Copy link

I've implemented geofencing in my app where I want to check whether user is entered/exited from given radius. Its working fine but taking time to give status and if radius is less than 50 meters, it's not giving an update even if I walk 70-80 meters.

Here is the video:
I've printed log on ENTER/EXIT but it is not occurring on EXIT as well as on ENTER (Second time)

  1. EXITing but onGeofenceChange is not getting called:
    Radius is 35 meters
whatsapp-video-2024-10-01-at-51713-pm-1_qDc0vido.mp4
  1. ENTERING AGAIN but onGeofenceChange is not getting called:
    Radius is 35 meters
whatsapp-video-2024-10-01-at-51713-pm_wIvqBYZM.mp4

Your Environment

  • Plugin version: ^4.16.0
  • Platform: Android
  • OS version: 14
  • Device manufacturer / model: OnePlus 9
  • Flutter info (flutter doctor):
[✓] Flutter (Channel stable, 3.24.0, on macOS 15.0 24A335 darwin-arm64, locale en-IN)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.0)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.3)
[✓] Connected device (4 available)
    ! Error: Browsing on the local area network for Ruchit’s iPhone. 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
  • Plugin config:
await bg.BackgroundGeolocation.ready(
      bg.Config(
        reset: true,
        geofenceInitialTriggerEntry: true,
        geofenceModeHighAccuracy: true,
        desiredAccuracy: bg.Config.DESIRED_ACCURACY_HIGH,
        distanceFilter: 10,
        enableHeadless: true,
        notification: bg.Notification(
          title: "TrackOn",
          text: "Getting Location",
        ),
        stopOnTerminate: false,
        startOnBoot: true,
        debug: false,
        locationAuthorizationRequest: 'Always',
        backgroundPermissionRationale: bg.PermissionRationale(
          title:
              "Allow {applicationName} to access this device's location even when the app is closed or not in use.",
          message:
              "This application gathers location information so that we can determine the user's activity level and adjust their health insurance benefits appropriately.",
          positiveAction: 'Change to "{backgroundPermissionOptionLabel}"',
          negativeAction: 'Cancel',
        ),
        logLevel: bg.Config.LOG_LEVEL_VERBOSE,
      ),
    ).then((bg.State state) async {
      debugPrint('[ready] ${state.toMap()}');
      if (!state.enabled) {
        await bg.BackgroundGeolocation.start();
      }
    }).catchError((error) {
      debugPrint('[ready] ERROR: $error');
    });

Expected Behavior

If should give the update on change of Geofence status whether it is ENTERed or EXITed.

Actual Behavior

It is only giving an update if we go more ahead then border line of Geofence.

Steps to Reproduce

  1. Add Geofences with radius less than 100.
  2. Checking by Walking

Context

I want to cover my office area through geofence so I can check whether any user is entered/exited into/from the office.

@christocracy
Copy link
Member

Add Geofences with radius less than 100.

The minimum geofence radius is 150 meters.

When having issues, set debug: true so you can hear debug sound FX.

@pratikbutani
Copy link
Author

Hello @christocracy, I'd tried with 200 meters radius as well.

The event only occurs if I move further ahead of the geofence line.

Do I need to change anything in the configuration or it will work as it is.

@christocracy
Copy link
Member

Do I need to change anything in the configuration

no.

The event only occurs if I move further ahead of the geofence line.

geofences are not guaranteed to fire exactly at the radius. It is perfectly normal that they can fire late.

if it works, it works.

Copy link

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants