I have a simple app based on Ionic-Vue-leaflet-Capacitor. In the app I want to get the current location of the device. Th function I use (the console.log’s are fore debugging only). I want the function to pass latitude and longitude to this.toLatLng:
async getCurrentLocation() {
console.log("Bankjes: entered GetCurrentLocation");
const Position = await Geolocation.getCurrentPosition();
console.log('Bankjes: Current position:', Position);
console.log("Bankjes: ended GetCurrentLocation");
return this.toLatLng(Position.latitude,Position.longitude)
},
When I debug the app in Android STudio with an emulator I see the following in logcat:
-The first time the function is called, all the console.log’s fire, but no Position is given by the second console.log.
-All the next times the function is called, only the first console.log fires
Any idea what I am doing wrong?