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

Unknown Consistent Location #1406

Open
asaddigital2809 opened this issue Jan 13, 2025 · 1 comment
Open

Unknown Consistent Location #1406

asaddigital2809 opened this issue Jan 13, 2025 · 1 comment

Comments

@asaddigital2809
Copy link

asaddigital2809 commented Jan 13, 2025

Your Environment

  • Plugin version: flutter_background_geolocation: ^4.16.3
  • Platform: iOS & Android
    Flutter info (flutter doctor):
    [!] Flutter (Channel [user-branch], 3.22.0, on macOS 13.6.9 22G830 darwin-x64, locale en-GB)
    ! Flutter version 3.22.0 on channel [user-branch] at /Users/naeemtariq/Desktop/Developer/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/docs/get-started/install.
    ! 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 34.0.0)
    [✓] Xcode - develop for iOS and macOS (Xcode 15.2)
    [✓] Chrome - develop for the web
    [✓] Android Studio (version 2023.1)
    [✓] VS Code (version 1.64.2)
    [✓] VS Code (version 1.94.0)
    [✓] Connected device (1 available)
    [✓] Network resources
  • Plugin config:
  Future configure() async {
    SharedPreferences prefs = await SharedPreferences.getInstance();
    String driverId = prefs.getString('riderId') ?? '';
    String token = getUserObject(prefs)?.jwtToken ?? '';
    bg.BackgroundGeolocation.ready(bg.Config(
            url: ApiEndPoints.CUSTOMER_BASE_URL +
                ApiEndPoints.CREATE_LOCATION_LOGS_V1,
            // url: "https://filmzilla.online/driver_logs.php",
            // url: "https://webhook.site/b211f0d3-97af-484f-95f1-278256003150",
            desiredAccuracy: bg.Config.DESIRED_ACCURACY_HIGH,
            // enableHeadless: true,
            // disableStopDetection: true,
            stopOnTerminate: false,
            startOnBoot: true,
            stopOnStationary: false,
            debug: false,
            foregroundService: true,
            heartbeatInterval: 20,
            stationaryRadius: Platform.isAndroid ? 0 : 25,
            distanceFilter: Platform.isAndroid ? 0 : 25,
            locationUpdateInterval: 11000,
            fastestLocationUpdateInterval: 11000,
            maxRecordsToPersist: 5,
            allowIdenticalLocations: true,
            enableHeadless: true,
            maxDaysToPersist: 1,
            pausesLocationUpdatesAutomatically: false,
            preventSuspend: true,
            activityType: bg.Config.ACTIVITY_TYPE_AUTOMOTIVE_NAVIGATION,
            locationTemplate:
                '{"driver_lat":<%= latitude %>,"driver_lan":<%= longitude %>,"speed":<%= speed %>,"event":"<%= event %>","driver_id":$driverId,"loc_time":"<%= timestamp %>","orders":${[]}}',
            headers: {
              "Content-Type": "application/json; charset=UTF-8",
              "Authorization": 'Bearer $token'
            },
            notificationPriority: Platform.isAndroid ? 0 : -2,
            logLevel: Platform.isAndroid
                ? bg.Config.LOG_LEVEL_VERBOSE
                : bg.Config.LOG_LEVEL_OFF))
        .then((bg.State state) {
      if (!state.enabled) {
        bg.BackgroundGeolocation.start();
      }

      bg.BackgroundGeolocation.onLocation((bg.Location location) {
        if (location.mock) {
          log('Mock location detected');
          // Handle mock location scenario
        } else {
          log('Genuine location detected');
          // Proceed with normal location handling
        }
      });
    });
    bg.BackgroundGeolocation.removeListeners().then((_) {
      bg.BackgroundGeolocation.onHeartbeat((heartBeat) {
        uploadLocation(
            heartBeat.location?.coords.latitude ?? 0,
            heartBeat.location?.coords.longitude ?? 0,
            heartBeat.location?.coords.speed.toString() ?? '');
      });
    });
  }

Expected Behavior

I am receiving a consistent location of my driver of a place where he hasn't visited in life and the plugin sends it continously even my driver is walking or driving. I am sharing some DB logs. The location fluctuates. From the map screenshot you can clearly see the point on Bury and that point has almost 400+markers.

Actual Behavior

There should be no unknow location

Screenshots

Map
DB Logs
DB Logs
Screenshot 2025-01-13 190651

@christocracy
Copy link
Member

christocracy commented Jan 13, 2025

See Wiki "Debugging". Learn to fetch logs from the plugin using method ".emailLog" (see the API docs for more information).

Your screenshots of raw data are not helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants