ionic-team / ionic-team/capacitor-geolocation
@capacitor/geolocation sometimes not working
- Dominant language
- Swift
- Stars
- 12
- Forks
- 19
- PR merge metrics
- No merged PRs in 30d
Description
## Bug Report
### Plugin(s)
@capacitor/geolocation
### Capacitor Version
@capacitor/ios: not installed
@capacitor/cli: 6.1.1
@capacitor/core: 6.1.0
@capacitor/android: 6.1.0
```
VM3:339 result Geolocation.getCurrentPosition (#95975845)
VM3:347 {message: 'location unavailable'}
```
### Platform(s)
ANDROID
### Current Behavior
Sometimes Geolocation.getCurrentPosition() simples does not provide any coordinates, just return LOCATION UNAVAILABLE. This issue occurs sometimes after install app, or after live run. But not all times.
When this issue occurs, I just open Google Maps and the dot with my current position is GRAY. After 1 or 2 seconds, it became blue and than the error on capacitor does not occur anymore
### Code Reproduction
async getCoordenadas() {
try {
const resp = await Geolocation.getCurrentPosition();
return {
error: false,
latitude: resp.coords.latitude,
longitude: resp.coords.longitude,
msg: '',
};
} catch (err: any) {
return {
error: true,
msg: `GetCoordenadas: ` + err.message,
latitude: 0,
longitude: 0,
};
}
}
### Other Technical Details
Galaxy A54, Galaxy S9, Galaxy S10 Lite
Contributor guide
Assessment
This issue has not been assessed yet.