Skip to content

Geolocation.watchPosition() almost always call the callback passed to it two times instantly #48

@JulienLecoq

Description

@JulienLecoq

Bug Report

Plugin(s)

@capacitor/geolocation: "^6.0.1"

Capacitor Version

💊   Capacitor Doctor  💊 

Latest Dependencies:

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

Installed Dependencies:

  @capacitor/android: not installed
  @capacitor/ios: not installed
  @capacitor/cli: 6.1.2
  @capacitor/core: 6.1.2

Platform(s) affected

WEB, I didn't check if this also affects the other platforms.

Current Behavior

The call to Geolocation.watchPosition() almost always call the callback passed to it two times instantly, and often the two calls have the same position (same timestamp).

Expected Behavior

It should call the callback just once or at least, never give two times the same position.

Code Reproduction

https://github.com/JulienLecoq/bug_watching_position

Other Technical Details

npm --version: 10.7.0
node --version: v20.14.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions