use of com.baidu.mapapi.map.MyLocationConfiguration.LocationMode in project SmartCampus by Vegen.
the class EaseBaiduMapActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
instance = this;
// initialize SDK with context, should call this before setContentView
SDKInitializer.initialize(getApplicationContext());
setContentView(R.layout.ease_activity_baidumap);
mMapView = (MapView) findViewById(R.id.bmapView);
sendButton = (Button) findViewById(R.id.btn_location_send);
Intent intent = getIntent();
double latitude = intent.getDoubleExtra("latitude", 0);
LocationMode mCurrentMode = LocationMode.NORMAL;
mBaiduMap = mMapView.getMap();
MapStatusUpdate msu = MapStatusUpdateFactory.zoomTo(15.0f);
mBaiduMap.setMapStatus(msu);
initMapView();
if (latitude == 0) {
mMapView = new MapView(this, new BaiduMapOptions());
mBaiduMap.setMyLocationConfigeration(new MyLocationConfiguration(mCurrentMode, true, null));
showMapWithLocationClient();
} else {
double longtitude = intent.getDoubleExtra("longitude", 0);
String address = intent.getStringExtra("address");
LatLng p = new LatLng(latitude, longtitude);
mMapView = new MapView(this, new BaiduMapOptions().mapStatus(new MapStatus.Builder().target(p).build()));
showMap(latitude, longtitude, address);
}
IntentFilter iFilter = new IntentFilter();
iFilter.addAction(SDKInitializer.SDK_BROADTCAST_ACTION_STRING_PERMISSION_CHECK_ERROR);
iFilter.addAction(SDKInitializer.SDK_BROADCAST_ACTION_STRING_NETWORK_ERROR);
mBaiduReceiver = new BaiduSDKReceiver();
registerReceiver(mBaiduReceiver, iFilter);
}
Aggregations