我的离子型3应用程序试图使用“@离子型-本机/地理定位/ngx”中的地理位置来获取当前位置。
当我在android中使用我的应用程序时,getLoc()正在被调用,而getCurrentPosition()方法却没有被调用。
getLoc() {
alert('getLoc');
this.geolocation.getCurrentPosition().then((resp) => {
resp.coords.latitude
resp.coords.longitude
alert('inside then');
}).catch((error) => {
console.log('Error getting location', error);
alert('catch');
});
}发布于 2019-07-16 07:50:56
离子3的正确进口是:
import { Geolocation } from '@ionic-native/geolocation';尝试改变导入,如果它不工作,降级地理定位插件版本。
https://stackoverflow.com/questions/57039709
复制相似问题