Reputation: 2742
There are two question I wanna ask.
timeout
option is in seconds
or miliseconds
?timeout
reached? (do something after timeout).
let wait: string;
wait = Plugins.Geolocation.watchPosition({
enableHighAccuracy: true,
timeout:5 // i dont if this is seconds or miliseconds
}, (position, err) => {
// do something
Plugins.Geolocation.clearWatch({
id: wait
});
});
// i want to detect if the location still doesnt detect, and it already time-out, i want to do something
The documention is too simple. Very hard to understand. https://capacitor.ionicframework.com/docs/apis/geolocation/
Upvotes: 2
Views: 1528
Reputation: 443
The timeout is defined in miliseconds based on the assumption, that the Capacitor API is probably equal to the Web Geolocation API. If the timeout is reached and watchPosition() couldn't get a position, you should be able to check your err value.
Upvotes: 1