On device, calls to navigator.getCurrentPosition re-prompt for location permission even if @capacitor/geolocation Geolocation plugin has been granted permission.
Example: adding @capacitor/geolocation and buttons plus methods to one of the default Ionic apps
has 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.
Similar issues have been resolved by injecting Platform and waiting for Platform.ready(), but that produces no change here. In our case, the navigator.geolocation.getCurrentPosition() calls are coming from a major third-party dependency, so simply removing the calls isn’t an option.
Example Repo: GitHub - rahbu/geolocation-example
Device info:
iPhone 12 Pro
iOS 17.2.1