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

[Geolocation / Android] The GPS position is only updated every 5 seconds when using "watchPosition" function on Android #2062

Closed
carelliguillaume opened this issue Mar 20, 2024 · 3 comments

Comments

@carelliguillaume
Copy link

Bug Report

Plugin(s)

Geolocation

Capacitor Version

💊 Capacitor Doctor 💊

Latest Dependencies:

@capacitor/cli: 5.7.3
@capacitor/core: 5.7.3
@capacitor/android: 5.7.3
@capacitor/ios: 5.7.3

Installed Dependencies:

@capacitor/cli: 5.5.1
@capacitor/core: 5.5.1
@capacitor/android: 5.5.1
@capacitor/ios: 5.5.1

[success] iOS looking great! 👌
[success] Android looking great! 👌

Platform(s)

Android

Current Behavior

When you use "watchPosition" function of the Geolocation Plugin on Android, the GPS position is only updated every 5 seconds which is not sufficient for position tracking. The refresh on Android is jerky compared to iOS which is much smoother. Moreover, its hardcoded in the following class when calling method setMinUpdateIntervalMillis :
https://github.com/ionic-team/capacitor-plugins/blob/main/geolocation/android/src/main/java/com/capacitorjs/plugins/geolocation/Geolocation.java

  LocationRequest locationRequest = new LocationRequest.Builder(10000)
      .setMaxUpdateDelayMillis(timeout)
      .setMinUpdateIntervalMillis(5000)
      .setPriority(priority)
      .build();

Expected Behavior

We should be able to configure the setMinUpdateIntervalMillis to have more accurate position tracking on Android. We should have a parameter like the "timeout" parameter used in the setMaxUpdateDelayMillis call. At least we should be able to remove the setMinUpdateIntervalMillis call to let Android manage the refreshing automatically like iOS Geolocation Plugin.

Code Reproduction

Just call the "watchPosition" of the Geolocation Plugin on Android

Copy link

ionitron-bot bot commented Apr 9, 2024

This issue has been labeled as type: bug. This label is added to issues that that have been reproduced and are being tracked in our internal issue tracker.

@alexgerardojacinto
Copy link
Collaborator

@carelliguillaume we just released @capacitor/geolocation@6.1.0 which adds a new minimumUpdateInterval parameter to startWatch, solving this issue.

Copy link

ionitron-bot bot commented Dec 24, 2024

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of the plugin, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Dec 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants