Wenn ich Geolocation Plugin getCurrentPostion verwenden, hat es Problem manchmal Ort basierend auf WIFI bekommen, aber ich möchte Position basierend auf GPS (wenn auf handy) wie dies zu tun die Einstellungen? alle Hinweise gut sein mehr als willkommen!Geolocation Plugin verwenden GetCurrentPostion basierend auf GPS
import { Geolocation } from ‘@ionic-native/geolocation’;
…
constructor(private geolocation: Geolocation) {}
…
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) => {
// data can be a set of coordinates, or an error (if an error occurred).
// data.coords.latitude
// data.coords.longitude
});