react-native-background-geolocation icon indicating copy to clipboard operation
react-native-background-geolocation copied to clipboard

Got same entries when there is changes in provider (internet ,location app open/kill)

Open Nishad013 opened this issue 11 months ago • 3 comments

Your Environment

System: OS: macOS 14.4 CPU: (8) arm64 Apple M2 Memory: 59.80 MB / 8.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 16.20.2 - ~/.nvm/versions/node/v16.20.2/bin/node Yarn: 1.22.21 - ~/Documents/GitHub/alt-tomrex-app/node_modules/.bin/yarn npm: 8.19.4 - ~/.nvm/versions/node/v16.20.2/bin/npm Watchman: 2024.01.22.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.15.0 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: DriverKit 23.2, iOS 17.2, macOS 14.2, tvOS 17.2, visionOS 1.0, watchOS 10.2 Android SDK: Not Found IDEs: Android Studio: 2023.1 AI-231.9392.1.2311.11330709 Xcode: 15.2/15C500b - /usr/bin/xcodebuild Languages: Java: 15.0.2 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 16.13.1 => 16.13.1 react-native: ^0.64.0 => 0.64.4 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

  • Plugin version: "react-native-background-geolocation": "^4.15.0",

  • Platform: iOS or Android: android realme 7pro

  • OS version:12

  • Device manufacturer / model:realme

  • React Native version (react-native -v):0.64

  • Plugin config

    const state = await BackgroundGeolocation.ready({
      url: API_URL + API_ENDPOINTS.SAVELOCATION,
      // url: 'https://655469d763cafc694fe66d97.mockapi.io/getLocation',
      logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
      desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
      distanceFilter: 1,
      stopTimeout: 5,
      locationTemplate:
        '{"Latitude":<%= latitude %>,"Longitude":<%= longitude %>,"TimeStamp": "<%= timestamp %>"}',
      locationAuthorizationRequest: 'Always',
      backgroundPermissionRationale: {
        title:
          "Allow {applicationName} to access this device's location even when closed or not in use.",
        message:
          'This app collects location data to enable recording your trips to work and calculate distance-travelled.',
        positiveAction: 'Change to "{backgroundPermissionOptionLabel}"',
        negativeAction: 'Cancel',
      },
      headers: {
        authorization: 'Bearer ' + getToken.data.Token,
        source: source,
      },
      params: {
        ClientId: respo_storage.data.ClientId,
      },
      batchSync: false,
      autoSync: true,
      maxDaysToPersist: 14,
      stopOnTerminate: false,
      startOnBoot: true,
      enableHeadless: true,
    });
    

Expected Behavior

it should have send location data once and after sending that data it should have destroyed it from SQlite database

Actual Behavior

We tested that with app open net ON device location ON we get data in our database but when we start switching net on/off and walk then we faced that it has given as data twice . when we first off the internet and start walking after 200 meter we switch ON the internet and then again start walking . While checking in our database we see the same data twice from where we have switch OFF the internet and switch ON the internet .That time of data comes twice in our database .

Steps to Reproduce

  1. JUST TRY RUNNING WITH INTERNET OFF AND THEN ON AND AGAIN RUN

Context

We want to track location of the person IM ATTACHING AN EXCEL SHEET https://docs.google.com/spreadsheets/d/1jKMtPPbsYeuw1Jvaga5ZUK9A4_2f9Uh-KT0pcgYYZ2c/edit#gid=0 PLEASE CHECK THIS AND TELL US WHAT WE CAN DO TO AVOID GETTING LOCATION DATA TWICE

Nishad013 avatar Mar 22 '24 10:03 Nishad013

Anyone reply this questions .

Sarveshwins avatar Mar 26 '24 05:03 Sarveshwins

Every time onProviderChange fires on Android, the plug-in records a location to say “here is where the device was when location settings were changed”, the location will have attribute event: “providerchange” attached to it.

This is so that it can be known when/where a device was when location was disabled in Settings, for example.

if you do not desire this behaviour, see api docs Config.disableProviderChangeRecord.

christocracy avatar Mar 26 '24 12:03 christocracy

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

github-actions[bot] avatar Apr 26 '24 01:04 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar May 10 '24 01:05 github-actions[bot]