flutter_background_geolocation icon indicating copy to clipboard operation
flutter_background_geolocation copied to clipboard

Custom locationTemplate that produces multiple repeat locations by setting it every 10m

Open ANMARBA opened this issue 3 years ago • 1 comments

Your Environment

  • Plugin version: 4.7.0
  • Platform: Android 11
  • OS version: MIUI Global 12.5.6
  • Device manufacturer / model: M2003J6A1G
  • Flutter info (flutter doctor): [√] Flutter (Channel stable, 2.10.5, on Microsoft Windows [Versión 10.0.19044.1826], locale es-CO) [√] Android toolchain - develop for Android devices (Android SDK version 31.0.0) [√] Chrome - develop for the web [!] Visual Studio - develop for Windows (Visual Studio Community 2022 17.1.2) X Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the "Desktop development with C++" workload, and include these components: MSVC v142 - VS 2019 C++ x64/x86 build tools - If there are multiple build tool versions available, install the latest C++ CMake tools for Windows Windows 10 SDK [√] Android Studio (version 2020.3) [√] VS Code, 64-bit edition (version 1.58.2) [√] Connected device (3 available) [√] HTTP Host Availability
  • Plugin config:
bg.Config(
        locationAuthorizationRequest: "Always",
        reset: true,
        debug: false,
        enableHeadless: true,
        stopOnStationary: false,
        stopOnTerminate: false,
        startOnBoot: true,
        foregroundService: false,
        isMoving: true,
        url: "${Constants.hostAppDrivers}/gps",
        autoSync: true,
        // autoSyncThreshold: 25,
        batchSync: true,
        maxBatchSize: 100,
        locationsOrderDirection: "DESC",
        maxDaysToPersist: 15,
        disableAutoSyncOnCellular: false,
        method: 'POST',
        httpRootProperty: 'coords',
        locationTemplate:
            '{"lat":<%= latitude %>, "lng":<%= longitude %>, "dateEventGps":"<%= timestamp %>"}',
        httpTimeout: 300000, // 5 minutes
        enableTimestampMeta: false,
        headers: {
          'Content-Type': 'application/json',
          'Accept': 'application/json',
          'Authorization': 'Bearer ${user.token}',
        },
        showsBackgroundLocationIndicator: false,
        // Minutes to wait in moving state with no movement before considering the device stationary.
        // Defaults to 5 minutes. When in the moving state, specifies the number of minutes to wait before turning off location-services and transitioning to stationary state after the ActivityRecognition
        stopTimeout: 5,
        useSignificantChangesOnly: false,
        persistMode: bg.Config.PERSIST_MODE_ALL,
        desiredAccuracy: bg.Config.DESIRED_ACCURACY_HIGH,
        logLevel: bg.Config.LOG_LEVEL_VERBOSE,
        // heartbeatInterval:
        //     60, // Android minimum interval is 60 seconds. It is impossible to have a heartbeatInterval faster than this on Android.
        // disableElasticity: true,
        /**
         *  Android only -  To use locationUpdateInterval you must also configure distanceFilter:0, since distanceFilter overrides locationUpdateInterval
         **/
        distanceFilter: 10.0,
        // elasticityMultiplier: 0.0,
        // enableTimestampMeta: true,
        // locationUpdateInterval: 300000, // 5 minutes
        locationAuthorizationAlert: getLocalAuthorizationAlert(),
        backgroundPermissionRationale: bg.PermissionRationale(
            title:
                "¿Permitir el acceso a la ubicación de este dispositivo en segundo plano?",
            message:
                "In order to allow Geofencing and Breadcrumbing in the background, please enable 'Allow all the time' permission",
            positiveAction: "Change to Allow all the time",
            negativeAction: "Cancel"),
      );

Expected Behavior

Send gps pulses every 10 m to the server

Actual Behavior

  • Pulses that arrive with the same date and time but with different coordinates.
  • Pulses that are repeated in coordinates and same date.

Steps to Reproduce

Context

The purpose is to generate pulses every 10 m and they are sent to my server.

However, reviewing I realize the following problems:

  • Pulses that arrive with the same date and time but with different coordinates.

-Pulses that are repeated in coordinates and same date.

How would be the correct configuration to solve these 2 problems?

Debug logs

Logs
PASTE_YOUR_LOGS_HERE

ANMARBA avatar Aug 02 '22 22:08 ANMARBA

I have no idea what you’re talking about.

how are you testing?

See Config.transistorAuthorizationToken to send your data to the demo server tracker.transistorsoft.com so we can both see your data on a map. Share with me the Organization name you choose.

christocracy avatar Aug 02 '22 22:08 christocracy