I am currently using the following service:
getPosition(): Observable<Object> {
return Observable.create(observer => {
navigator.geolocation.watchPosition((pos: Position) => {
observer.next(pos);
observer.complete();
}),
() => {
console.log('Position is not available');
},
{
enableHighAccuracy: true
};
});
}
My intention was to utilize it in this way:
this.getLocationService.getPosition().subscribe((pos: Position) => {
self._latitude = pos.coords.latitude;
self._longitude = pos.coords.longitude; }
However, I encountered an issue where the expected behavior did not occur. I anticipated that whenever the position changes, the latitude and longitude values would also update simultaneously. Unfortunately, this does not happen as intended.