如何基于GPS使用地理位置插件GetCurrentPostion



当我使用地理位置插件getCurrentPostion时,它会有问题有时它会根据wifi获得位置,但我想根据GPS获得邮局(如果方便)如何进行此设置?任何提示都比welcom更重要!

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
});

它在我的方便方面运作良好,但就在最近它开始使用wifi进行CurrentLocation而不是GPS。我不知道自己对自己的方便做了什么。我将尝试在API上发出高清晰度,以查看它是否有帮助

最新更新