michalchudziak / react-native-geolocation

Geolocation APIs for React Native
MIT License
1.28k stars 220 forks source link

I can't get the location to update faster than a second #252

Open Lavhe opened 1 year ago

Lavhe commented 1 year ago

Environment

System: OS: macOS 13.2.1 CPU: (8) arm64 Apple M1 Pro Memory: 122.23 MB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 16.19.1 - ~/.nvm/versions/node/v16.19.1/bin/node Yarn: 1.22.18 - /opt/homebrew/bin/yarn npm: 8.19.3 - ~/.nvm/versions/node/v16.19.1/bin/npm Watchman: Not Found Managers: CocoaPods: 1.12.0 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4 Android SDK: API Levels: 28, 29, 30, 31, 32, 33 Build Tools: 28.0.3, 29.0.2, 29.0.3, 30.0.0, 30.0.2, 30.0.3, 31.0.0, 32.0.0, 33.0.0 System Images: android-31 | Google Play ARM 64 v8a, android-32 | Google APIs ARM 64 v8a Android NDK: Not Found IDEs: Android Studio: 2021.1 AI-211.7628.21.2111.8193401 Xcode: 14.3/14E222b - /usr/bin/xcodebuild Languages: Java: 11.0.2 - /Users/lavhe/.sdkman/candidates/java/current/bin/javac npmPackages: @react-native-community/cli: 10.1.3 => 10.1.3 react: 18.2.0 => 18.2.0 react-native: 0.71.2 => 0.71.2 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Platforms

Android and iOS

Versions

Description

I am trying to get the device's location every 400 milliseconds or so, but I noticed no matter what interval I set, the location only updates in one second intervals on both iOS and Android

I am creating a car speed timer application, I would like to get the user's speed as frequent as possible, and one second is very slow. Is this possible?

Reproducible Demo

        watchLocationId = watchPosition(
          (loc) => console.log({ loc }),
          (err) => {
            console.log({ err });
          },
          {
            interval: 200,
            fastestInterval: 300,
          }
        );
michalchudziak commented 1 year ago

Thanks for reporting. I will look onto this issue when I'll have some time, however if you'd like to help, I encourage to send a PR.