CapacitorJS Geolocation watchPosition giving coordinates only every 4 seconds on Android, i need every 1 second

Viewed 10

I am using this code and for some reason it updates coordinates only every 4 seconds. How can I make the Android give me coordinates every second? Is there any settings I don't know about?

      function startWatchPosition() {
        Geolocation.watchPosition(watchOptions, process_coordinates).then(function(id) {
            console.log("watchpos id = ", id);
            watchTransactionID = id;
        }).catch(function(error) {
            console.log("watchpos error: ", error);
        });
      }

      function stopWatchPosition() {
        Geolocation.clearWatch( { id: watchTransactionID } );
      }

The function process_coordinates is called back only every 4 seconds. But why?

capacitor.config.json:

{
  "appId": "*************",
  "appName": "*******",
  "bundledWebRuntime": false,
  "webDir": "dist",
  "plugins": {
    "SplashScreen": {
      "launchShowDuration": 2000
    }
  }
}

Permissions in AndroidManifest.xml:

    <!-- Permissions -->
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-feature android:name="android.hardware.location.gps" />
0 Answers
Related