I'm using this code:
this.watchID = navigator.geolocation.watchPosition((localizacion) => {
console.log("En el enviarPos", localizacion);
}, (err) => {
console.log(err);
}, { enableHighAccuracy: true });
It works in background, but only doesn't work when the phone is locked.
Error:
GeolocationPositionError {code: 3, message: "Timeout expired"}