-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
Bug Report
Capacitor Version
npx cap doctor output:
💊 Capacitor Doctor 💊
Latest Dependencies:
@capacitor/cli: 2.1.2
@capacitor/core: 2.1.2
@capacitor/android: 2.1.2
@capacitor/electron: 2.1.2
@capacitor/ios: 2.1.2
Installed Dependencies:
@capacitor/ios not installed
@capacitor/electron not installed
@capacitor/cli 2.1.2
@capacitor/android 2.1.2
@capacitor/core 2.1.2
[success] Android looking great! 👌Affected Platform(s)
- Android
- iOS
- Electron
- Web
Current Behavior
If multiple parallel calls to Geolocation.getCurrentPosition() are made, only last one returns any result, success or error.
Expected Behavior
Every call to Geolocation.getCurrentPosition() should have it's promise fullfilled or rejected.
This shoud be the way, besides what the plugin does internally (which native API uses, cached position, ...)
Sample Code or Sample Application Repo
const params = {
enableHighAccuracy: true,
maximumAge: 20000,
timeout: 50,
};
console.log('position 1 start')
Capacitor.Plugins.Geolocation.getCurrentPosition(params).then(
position => console.log('position 1', position),
error => console.error('position 1 error', error)
);
console.log('position 2 start')
Capacitor.Plugins.Geolocation.getCurrentPosition(params).then(
position => console.log('position 2', position),
error => console.error('position 2 error', error)
);
console.log('position 3 start')
Capacitor.Plugins.Geolocation.getCurrentPosition(params).then(
position => console.log('position 3', position),
error => console.error('position 3 error', error)
);
console.log('position 4 start')
Capacitor.Plugins.Geolocation.getCurrentPosition(params).then(
position => console.log('position 4', position),
error => console.error('position 4 error', error)
);Reproduction Steps
- Create a new test project based on capacitor starter
npx @capacitor/cli create - Add the example code below to any JS file/script (I put it in
js/capacitor-welcome.jsfile)
Other Technical Details
npm --version output: 6.14.4
node --version output: v12.17.0
ramoncarreras, mjason24 and AKRFranko
Metadata
Metadata
Assignees
Labels
No labels
