如果只是要獲取定位的位置欲间,不需要調(diào)用高德顯示地圖控件馏锡,步驟如下
添加定位接口LocationSource,AMapLocationListener
-
初始化AMapLocationClient并進(jìn)行配置
mLocationClient = new AMapLocationClient(getApplicationContext());
3.開始定位
mLocationClient.startLocation();
4.實(shí)現(xiàn)LocationSource接口的onLocationChanged(AMapLocation amapLocation) 方法獲取定位結(jié)果
amapLocation.getAddress();//地址秘通,如果option中設(shè)置isNeedAddress為false罪佳,則沒有此結(jié)果却舀,網(wǎng)絡(luò)定位結(jié)果中會(huì)有地址信息虫几,GPS定位不返回地址信息。
amapLocation.getCountry();//國(guó)家信息
amapLocation.getProvince();//省信息
amapLocation.getCity();//城市信息
amapLocation.getDistrict();//城區(qū)信息
amapLocation.getStreet();//街道信息
amapLocation.getStreetNum();//街道門牌號(hào)信息
amapLocation.getCityCode();//城市編碼
amapLocation.getAdCode();//地區(qū)編碼