On https://play.nativescript.org/ is a component called Location, when using it inside HelloWorld.vue it looks like below, but the location doesn't change / update when moving around my house and waiting or pressing the Show location button again. I set both desiredAccuracy and updateDistance to 1 meter, but also tried it with the value Accuracy.high after importing the module. What could be the issue?
<template>
<Page>
<ActionBar title="Home" />
<ScrollView>
<StackLayout>
<Button text="Show location" @tap="enableLocationServices"/>
<StackLayout>
<Label :text="'Latitude: ' + currentGeoLocation.latitude" />
<Label :text="'Longitude: ' + currentGeoLocation.longitude" />
<Label :text="'Altitude: ' + currentGeoLocation.altitude" />
<Label :text="'Direction: ' + currentGeoLocation.direction" />
</StackLayout>
</StackLayout>
</ScrollView>
</Page>
</template>
<script>
const geoLocation = require("nativescript-geolocation");
export default {
methods: {
enableLocationServices: function() {
geoLocation.isEnabled().then(enabled => {
if (!enabled) {
geoLocation
.enableLocationRequest()
.then(() => this.showLocation());
} else {
this.showLocation();
}
});
},
showLocation: function() {
geoLocation.watchLocation(
location => { this.currentGeoLocation = location; },
error => { alert(error); },
{
desiredAccuracy: 1,
updateDistance: 1,
minimumUpdateTime: 1000 * 1
}
);
}
},
data() {
return {
currentGeoLocation: {
latitude: null,
longitude: null,
altitude: null,
direction: null
}
};
}
};
</script>