i'm using ionic capacitor and want to receive GPS coordinates using the Geolocator plugin. The problem is that my app is never asking for permission therefore i cannot receive any coordinates. Here is my code:
getLocation(): void{
this.geolocation.getCurrentPosition().then((resp) => {
// resp.coords.latitude
// resp.coords.longitude
}).catch((error) => {
console.log('Error getting location', error);
});
let watch = this.geolocation.watchPosition();
watch.subscribe((data) => {
if ("coords" in data) {
this.lng = data.coords.longitude;
this.lat = data.coords.latitude;
this.getLocations();
}else{
this.snackBar.open("Kein Zugriff auf GPS Koordinaten", "Ok", {
duration: 2000,
});
}
console.log(this.lat, this.lng);
});
}
and here is my info.plist file:
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…