Skip to content

navigator.getCurrentPosition re-prompts for location permission even if @capacitor/geolocation has permission #42

@rahbu

Description

@rahbu

Bug Report

Plugin(s)

@capacitor/geolocation ^5.0.6

Capacitor Version

Latest Dependencies:

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

Installed Dependencies:

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

Platform(s)

iOS
(Android not tested)

Current Behavior

On device (iPhone 12 Pro with iOS 17.2.1), calls to navigator.getCurrentPosition initially re-prompt for location permission even if @capacitor/geolocation's Geolocation has permission. To reproduce, add @capacitor/geolocation and a button for each of the calls to one of the default Ionic apps. Calls to Geolocation.requestPermissions and Geolocation.getCurrentPosition work as expected but navigator.geolocation.getCurrentPosition produces a new prompt asking for permission. Closing the app and repeating the procedure produces the same behavior. Closing the app and repeating for the third time now has navigator.geolocation.getCurrentPosition succeed without a further permission prompt.

d69809c1-0228-41b4-b59f-1bf61d689a6a.mp4

Expected Behavior

If location permissions have been granted, calls to navigator.geolocation.getCurrentPosition should proceed without a further prompt.

Code Reproduction

GitHub - rahbu/geolocation-example

Other Technical Details

Additional Context

Similar issues have been resolved by injecting Platform and waiting for Platform.ready(), but that produces no change here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions