Geolocation.getCurrentPosition().then((position) => {
let latLng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
//let latLng = new google.maps.LatLng(40.987469, 29.027119);
let mapOptions = {
center: latLng,
zoom: 15,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
this.map = new google.maps.Map(this.mapElement.nativeElement, mapOptions);
}).catch((error) => {
console.log('Error getting location', error);
});
I am trying to check if a user's position is available or not. When custom gps is open, the code above works. But I need to check if GPS is open, and I will set the place myself when I canβt get the user's location. How to check if a user's location is available or not? I use ion-native geolocation. Thanks in advance.
source
share