80,351
社区成员
发帖
与我相关
我的任务
分享
// 添加定位图层
mLocationOverlay = new MyLocationOverlay(this, mMapView);
mMapView.getOverlays().add(mLocationOverlay);
public void onLocationChanged(Location location) {
if (location != null) {
pt = new GeoPoint((int) (location.getLatitude() * 1e6),
(int) (location.getLongitude() * 1e6));
// mMapView.getController().animateTo(pt);//
mark = 0;// 本地标记
mSearch.reverseGeocode(pt);// ni地址解析
Toast.makeText(paisong2.this, "本地移动onlocation",
Toast.LENGTH_LONG).show();
upload(pt);
}
}
// 初始化Location模块
mLocationManager = mBMapMan.getLocationManager();
// 通过enableProvider和disableProvider方法,选择定位的Provider
// mLocationManager.enableProvider(MKLocationManager.MK_NETWORK_PROVIDER);
// mLocationManager.disableProvider(MKLocationManager.MK_GPS_PROVIDER);
// 添加定位图层
MyLocationOverlay mylocTest = new MyLocationOverlay(this, mMapView);
mylocTest.enableMyLocation(); // 启用定位
mylocTest.enableCompass(); // 启用指南针
mMapView.getOverlays().add(mylocTest);