【发布时间】:2018-08-24 13:56:25
【问题描述】:
我正在尝试在 ionic 中构建构建时执行此操作,但该位置位于 IOS 上,不适用于 ionic 2 应用程序中的地理定位。
我已经安装了 ionic cordova 插件添加 cordova-plugin-geolocation 和
在 android 设备中,它在定位服务启动时工作。当定位服务关闭时,它不起作用。在 iOS 设备中,这两种情况都不起作用。需要帮助!!
import { Geolocation } from '@ionic-native/geolocation';
在提供者中我提到了地理位置;在 home.ts 中,我导入了 Geolocation。
为了获取当前位置我写了如下代码
getCurrentLocation(){
this.geolocation.getCurrentPosition().then((position) => {
let loc = {
placeId: null,
name:null,
lat:null,
long:null,
}
var lat = position.coords.latitude;
var lng = position.coords.longitude;
var latlng = new google.maps.LatLng(lat, lng);
var geocoder = geocoder = new google.maps.Geocoder();
}
【问题讨论】:
标签: javascript ios ionic-framework ionic-native