Java 类com.baidu.mapapi.map.MyLocationConfiguration 实例源码

项目:Tribe    文件:NearbyFragment.java   
private void initMapSetting() {

        mMapView.showZoomControls(false);

        mBaiduMap = mMapView.getMap();
        // 开启定位图层
        mBaiduMap.setMyLocationEnabled(true);
        //设置指南针
//        UiSettings uiSettings = mBaiduMap.getUiSettings();
//        uiSettings.setCompassEnabled(true);

        mBaiduMap.setCompassPosition(new Point(660,60));

        //设置普通地图
        mBaiduMap.setMapType(BaiduMap.MAP_TYPE_NORMAL);
        //设置定位图层配置信息,只有先允许定位图层后设置定位图层配置信息才会生效
        mBaiduMap.setMyLocationConfiguration(new MyLocationConfiguration(
                MyLocationConfiguration.LocationMode.NORMAL, false, null));
        mBaiduMap.setBuildingsEnabled(false);

        //设置缩放级别
        MapStatusUpdate msu = MapStatusUpdateFactory.zoomTo(16.0f);
        mBaiduMap.setMapStatus(msu);

    }
项目:VirtualLocation    文件:MainActivity.java   
/**
 * iniMap 初始化地图
 */
private void iniMap() {
    LocationClientOption option = new LocationClientOption();
    option.setOpenGps(true);// 打开gps
    option.setCoorType("bd09ll"); // 设置坐标类型
    option.setScanSpan(3000);
    mCurrentMode = MyLocationConfiguration.LocationMode.NORMAL;

    // 缩放
    MapStatusUpdate msu = MapStatusUpdateFactory.zoomTo(14.0f);
    mBaiduMap.setMapStatus(msu);

    mBaiduMap.setMyLocationConfigeration(new MyLocationConfiguration(mCurrentMode, true, mCurrentMarker));
    mLocClient.setLocOption(option);
    mLocClient.start();
    initOverlay();

    // 开启线程,一直修改GPS坐标
    LocationUtil.startLocaton();
}
项目:camera    文件:MainActivity.java   
private void initLocation() {
    // 开启定位图层
    mCurrentMode = LocationMode.NORMAL;
     mBaiduMap
     .setMyLocationConfigeration(new MyLocationConfiguration(
             mCurrentMode, true, null));
    mBaiduMap.setMyLocationEnabled(true);
    // 定位初始化
    mLocClient = new LocationClient(this);
    myListener = new MyLocationListenner();
    mLocClient.registerLocationListener(myListener);
    LocationClientOption option = new LocationClientOption();
    option.setOpenGps(true); // 打开gps
    option.setCoorType("bd09ll"); // 设置坐标类型
    option.setScanSpan(20000);
    mLocClient.setLocOption(option);
    mLocClient.start();
}
项目:MapForTour    文件:MapFragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_map, container, false);
    // Inflate the layout for this fragment
    switchLocation = (Switch) view.findViewById(R.id.switchLocation);
    switchLBSTrace = (Switch) view.findViewById(R.id.switchLBSTrace);
    switchLocation.setOnCheckedChangeListener(this);
    switchLBSTrace.setOnCheckedChangeListener(this);
    mMapView = (TextureMapView) view.findViewById(R.id.bmapView);
    baiduMap = mMapView.getMap();
    baiduMap.setMyLocationConfigeration(new MyLocationConfiguration(MyLocationConfiguration.LocationMode.NORMAL, false, null));
    application.setMaxZoomLevel(baiduMap.getMaxZoomLevel());
    // 开启定位图层
    baiduMap.setMyLocationEnabled(true);
    baiduMap.setOnMarkerClickListener(this);
    //再次进入地图fragment时界面刷新
    if (application.latLng != null) {
        MapStatusUpdate u = MapStatusUpdateFactory.newLatLngZoom(application.getLatLng(), application.getMaxZoomLevel() - 2);
        baiduMap.animateMapStatus(u);//动画移动摄像头
        if (radarNearbyInfoList != null) {
            refreshMapUI();
        }
    }
    return view;
}
项目:MapForTour    文件:MapFragment.java   
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
    switch (buttonView.getId()) {
        case R.id.switchLBSTrace:
            if (isChecked) {
                polylineMyTrace = new PolylineOptions();
                refreshMapUI();
                mlistener.toolbarOperateCloseTrackOrOpenColor(true);
            } else {
                mlistener.toolbarOperateCloseTrackOrOpenColor(false);
            }
            break;
        case R.id.switchLocation:
            if (isChecked) {
                baiduMap.setMyLocationConfigeration(new MyLocationConfiguration(MyLocationConfiguration.LocationMode.FOLLOWING, false, null));
                baiduMap.animateMapStatus(MapStatusUpdateFactory.zoomTo(baiduMap.getMaxZoomLevel() - 2));
            } else
                baiduMap.setMyLocationConfigeration(new MyLocationConfiguration(MyLocationConfiguration.LocationMode.NORMAL, false, null));
            break;
    }
}
项目:MyApp    文件:fragment1.java   
@Override
protected void afterCreate(Bundle savedInstanceState) {
    mBaiduMap = mapView.getMap();
    btn1.setOnClickListener(this);
    btn2.setOnClickListener(this);
    btn3.setOnClickListener(this);
    btn4.setOnClickListener(this);
    btn1.setChecked(true);
    tvLocation.setText("");
    mCurrentMode = MyLocationConfiguration.LocationMode.FOLLOWING;
    mBaiduMap.setMyLocationConfigeration(new MyLocationConfiguration(
            mCurrentMode, true, mCurrentMarker));
    mBaiduMap.setMyLocationEnabled(true);// 开启定位图层
    mLocClient = new LocationClient(getActivity()); // 定位初始化
    mLocClient.registerLocationListener(myListener);
    LocationClientOption option = new LocationClientOption();
    option.setOpenGps(true); // 打开gps
    option.setCoorType("bd09ll"); // 设置坐标类型
    option.setIsNeedAddress(true);
    option.setScanSpan(1000);
    mLocClient.setLocOption(option);
    mLocClient.start();
}
项目:Mooc-map    文件:RoutePlan.java   
@Override
public void onReceiveLocation(BDLocation location) {
    MyLocationData data2 = new MyLocationData.Builder()
            .accuracy(location.getRadius())//精度
            .latitude(location.getLatitude())//纬度
            .longitude(location.getLongitude()).build();//经度
    mBaidumap.setMyLocationData(data2);
    //第三个参数设置自定义图标
    MyLocationConfiguration config =
            new MyLocationConfiguration(null, true, null);
    mBaidumap.setMyLocationConfigeration(config);
    //更新经纬度
    mLatitude = location.getLatitude();
    mLongtitude = location.getLongitude();
    if (isFirstIn) {
        LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
        MapStatusUpdate msu = MapStatusUpdateFactory.newLatLng(latLng);
        mBaidumap.animateMapStatus(msu);
        isFirstIn = false;
    }
}
项目:Mooc-map    文件:MyLocationListener.java   
@Override
public void onReceiveLocation(BDLocation location) {
    MyLocationData data = new MyLocationData.Builder()
            .direction(100)//方向
            .accuracy(location.getRadius())//精度
            .latitude(location.getLatitude())//纬度
            .longitude(location.getLongitude()).build();//经度
    mBaiduMap.setMyLocationData(data);
    MyLocationConfiguration config =
            new MyLocationConfiguration(null, true, null);
    mBaiduMap.setMyLocationConfigeration(config);
    //更新经纬度
    mLatitude = location.getLatitude();
    mLongtitude = location.getLongitude();
    if (isFirstIn) {
        LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
        MapStatusUpdate msu = MapStatusUpdateFactory.newLatLng(latLng);
        mBaiduMap.animateMapStatus(msu);
        isFirstIn = false;
    }
}
项目:Mooc-map    文件:MainActivity.java   
private void initView() {
    mMapView = (MapView) findViewById(R.id.id_bmapView);
    mBaiduMap = mMapView.getMap();
    MapStatusUpdate msu = MapStatusUpdateFactory.zoomTo(17.0f);//缩放等级17=100m
    mBaiduMap.setMapStatus(msu);
    mLocationMode = MyLocationConfiguration.LocationMode.NORMAL;
    //隐藏缩放控件和百度logo
    int childCount = mMapView.getChildCount();
    for (int i = 0; i < childCount; i++) {
        View child = mMapView.getChildAt(i);
        if (child instanceof ZoomControls || child instanceof ImageView) {
            child.setVisibility(View.GONE);
        }
    }
    //改变比例尺的位置
    final int screenheight = this.getWindowManager().getDefaultDisplay().getHeight();
    mBaiduMap.setOnMapLoadedCallback(new BaiduMap.OnMapLoadedCallback() {

        @Override
        public void onMapLoaded() {
            mMapView.setScaleControlPosition(new Point(200, screenheight - 307));
        }
    });
}
项目:Mooc-map    文件:MainActivity.java   
@Override
public void onReceiveLocation(BDLocation location) {
    MyLocationData data = new MyLocationData.Builder()
            .direction(mCurrentX)//更新当前方向
            .accuracy(400.0f)//精度
            .latitude(location.getLatitude())//纬度
            .longitude(location.getLongitude()).build();//经度
    mBaiduMap.setMyLocationData(data);
    //可在第三个参数设置自定义图标
    MyLocationConfiguration config =
            new MyLocationConfiguration(mLocationMode, true, null);
    mBaiduMap.setMyLocationConfigeration(config);
    //更新经纬度
    mLatitude = location.getLatitude();
    mLongtitude = location.getLongitude();
    mCity = location.getCity();
    if (isFirstIn) {
        LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
        MapStatusUpdate msu = MapStatusUpdateFactory.newLatLng(latLng);
        mBaiduMap.animateMapStatus(msu);
        isFirstIn = false;
        Toast.makeText(context, location.getAddrStr(), Toast.LENGTH_SHORT).show();
    }
}
项目:Mooc-map    文件:BusLineSearch.java   
@Override
public void onReceiveLocation(BDLocation location) {
    MyLocationData data = new MyLocationData.Builder()
            .accuracy(location.getRadius())//精度
            .latitude(location.getLatitude())//纬度
            .longitude(location.getLongitude()).build();//经度
    mBaiduMap.setMyLocationData(data);
    //可在第三个参数设置自定义图标
    MyLocationConfiguration config =
            new MyLocationConfiguration(null, true, null);
    mBaiduMap.setMyLocationConfigeration(config);
    //更新经纬度
    mLatitude = location.getLatitude();
    mLongtitude = location.getLongitude();
    if (isFirstIn) {
        LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
        MapStatusUpdate msu = MapStatusUpdateFactory.newLatLng(latLng);
        mBaiduMap.animateMapStatus(msu);
        isFirstIn = false;
    }
}
项目:PiBoat    文件:MapActivity.java   
private void initMapAndLoc() {
    // 地图初始化
    mMapView = (MapView) findViewById(R.id.bmapView);
    mBaiduMap = mMapView.getMap();
    // 开启定位图层
    mBaiduMap.setMyLocationEnabled(true);
    // 定位初始化
    mLocClient = new LocationClient(this);
    mLocClient.registerLocationListener(myListener);
    LocationClientOption option = new LocationClientOption();
    option.setOpenGps(true);// 打开gps
    option.setCoorType("bd09ll"); // 设置坐标类型
    option.setScanSpan(1000);
    mLocClient.setLocOption(option);
    mLocClient.start();

    mBaiduMap
            .setMyLocationConfigeration(new MyLocationConfiguration(
                    mCurrentMode, true, mCurrentMarker));

}
项目:PiBoat    文件:SmallBaiduMap.java   
private void initMapAndLoc() {
    MyLocationConfiguration.LocationMode mCurrentMode = MyLocationConfiguration.LocationMode.FOLLOWING;
    // 开启定位图层
    mBaiduMap.setMyLocationEnabled(true);
    // 定位初始化
    mLocClient = new LocationClient(context);
    mLocClient.registerLocationListener(myListener);
    LocationClientOption option = new LocationClientOption();
    option.setOpenGps(true);// 打开gps
    option.setCoorType("bd09ll"); // 设置坐标类型
    option.setScanSpan(1000);
    mLocClient.setLocOption(option);
    mLocClient.start();

    mBaiduMap
            .setMyLocationConfigeration(new MyLocationConfiguration(
                    mCurrentMode, true, mCurrentMarker));

}
项目:GitHub    文件:MainActivity.java   
private void initMap() {
    // 地图初始化
    mMapView = (MapView) findViewById(R.id.id_bmapView);
    mBaiduMap = mMapView.getMap();
    // 开启定位图层
    mBaiduMap.setMyLocationEnabled(true);
    // 定位初始化
    mlocationClient = new LocationClient(this);
    mlocationClient.registerLocationListener(myListener);
    LocationClientOption option = new LocationClientOption();
    option.setOpenGps(true); // 打开gps
    option.setCoorType("bd09ll"); // 设置坐标类型
    option.setScanSpan(5000);//设置onReceiveLocation()获取位置的频率
    option.setIsNeedAddress(true);//如想获得具体位置就需要设置为true
    mlocationClient.setLocOption(option);
    mlocationClient.start();
    mCurrentMode = MyLocationConfiguration.LocationMode.FOLLOWING;
    mBaiduMap.setMyLocationConfigeration(new MyLocationConfiguration(
            mCurrentMode, true, null));
    myOrientationListener = new MyOrientationListener(this);
    //通过接口回调来实现实时方向的改变
    myOrientationListener.setOnOrientationListener(new MyOrientationListener.OnOrientationListener() {
        @Override
        public void onOrientationChanged(float x) {
            mCurrentX = x;
        }
    });
    myOrientationListener.start();
    mSearch = RoutePlanSearch.newInstance();
    mSearch.setOnGetRoutePlanResultListener(this);
    initMarkerClickEvent();
}
项目:wzyx-android-user    文件:BaiduMapActivity.java   
private void initLocation() {
    mLocationClient=new LocationClient(getApplicationContext());
    myLocationListener = new MyLocationListener();
    mLocationClient.registerLocationListener(myLocationListener);
    mIconLocation= fromResource(R.drawable.ic_place);
    LocationClientOption option=new LocationClientOption();
    option.setCoorType("BD09LL");
    option.setIsNeedAddress(true);
    option.setScanSpan(1000);
    mLocationClient.setLocOption(option);
    MyLocationConfiguration config=new MyLocationConfiguration(MyLocationConfiguration.LocationMode.NORMAL,true,mIconLocation);
    mBaiduMap.setMyLocationConfiguration(config);
}
项目:MapDemo    文件:MainActivity.java   
@Override
public void onReceiveLocation(BDLocation location) {
    MyLocationData data = new MyLocationData.Builder()//
            .direction(mCurrentX)//
            .accuracy(location.getRadius())//
            .latitude(location.getLatitude())//
            .longitude(location.getLongitude())//
            .build();
    mbaiduMap.setMyLocationData(data);

    // 设置自定义图标
    MyLocationConfiguration config = new MyLocationConfiguration(
            locationmode, true, mIconLocation);
    mbaiduMap.setMyLocationConfigeration(config);

    // 获取经度、纬度
    mLongitude = location.getLongitude();
    mLatitude = location.getLatitude();
    // 当前的位置为开始位置。
    mStartLocation = new LatLng(location.getLatitude(),
            location.getLongitude());

    if (isFirstIn) {
        LatLng latLng = new LatLng(location.getLatitude(),
                location.getLongitude());
        MapStatusUpdate msu = MapStatusUpdateFactory.newLatLng(latLng);
        mbaiduMap.animateMapStatus(msu);
        isFirstIn = false;
        Toast.makeText(context, location.getAddrStr(),
                Toast.LENGTH_LONG).show();
    }

}
项目:Mobike    文件:MainActivity.java   
private void beginService() {
    if (!Utils.isGpsOPen(this)) {
        Utils.showDialog(this);
        return;
    }
    isNeedCurrentlocation = true;
    mScan_qrcode.setVisibility(View.GONE);
    mTvLocationInfo.setVisibility(View.GONE);
    mBikeInfoBoard.setVisibility(View.VISIBLE);
    mLoBikeInfo.setVisibility(View.VISIBLE);
    mBikeOrderBoard.setVisibility(View.GONE);
    mBtLoginOrorder.setText("结束骑行");
    mBtLoginOrorder.setVisibility(View.VISIBLE);
    mMinute1.setText("骑行时长");
    mTvDistance1.setText("骑行距离");
    mTvPrices1.setText("费用计算");
    mRefreshAll.setVisibility(View.GONE);
    countDownTimer.cancel();

    if (routeOverlay != null)
        routeOverlay.removeFromMap();
    mBaiduMap.showZoomControls(false);
    baiduMap.clear();
    if (isServiceLive)
        mlocationClient.requestLocation();
    Intent intent = new Intent(this, RouteService.class);
    startService(intent);
    MyLocationConfiguration configuration
            = new MyLocationConfiguration(locationMode, true, mIconLocation);
    //设置定位图层配置信息,只有先允许定位图层后设置定位图层配置信息才会生
}
项目:Mobike    文件:MainActivity.java   
private void initMap() {
    baiduMap = mBaiduMap.getMap();

    baiduMap.setMyLocationEnabled(true);

    mlocationClient = new LocationClient(getApplicationContext());
    mlocationClient.registerLocationListener(new MylocationListener());
    //  mBaiduMap.showScaleControl(false);// 隐藏比例尺控件
    mBaiduMap.showZoomControls(false);//隐藏缩放按钮

    LocationClientOption option = new LocationClientOption();
    option.setOpenGps(true); // 打开gps
    option.setCoorType("bd09ll"); // 设置坐标类型
    option.setScanSpan(5000);//设置onReceiveLocation()获取位置的频率
    option.setIsNeedAddress(true);//如想获得具体位置就需要设置为true
    mlocationClient.setLocOption(option);
    mlocationClient.start();
    mCurrentMode = MyLocationConfiguration.LocationMode.FOLLOWING;
    baiduMap.setMyLocationConfigeration(new MyLocationConfiguration(
            mCurrentMode, true, null));
    myOrientationListener = new MyOrientationListener(this);
    //通过接口回调来实现实时方向的改变
    myOrientationListener.setOnOrientationListener(new MyOrientationListener.OnOrientationListener() {
        @Override
        public void onOrientationChanged(float x) {
            mCurrentX = x;
        }
    });
    myOrientationListener.start();
    mSearch = RoutePlanSearch.newInstance();
    mSearch.setOnGetRoutePlanResultListener(this);
    initMarkerClickEvent();
}
项目:BikeHelper    文件:MainActivity.java   
@Override
protected void onStart() {
    super.onStart();

    MyLocationConfiguration.LocationMode locationMode = MyLocationConfiguration.LocationMode.NORMAL;
    MyLocationConfiguration configeration = new MyLocationConfiguration(locationMode, Config.UseCompass, null);
    mMapView.getMap().setMyLocationConfigeration(configeration);
    mMapView.getMap().setMapType(Config.MapType);
}
项目:MapForTour    文件:MapFragment.java   
@Override
public void onPause() {
    super.onPause();
    //在activity执行onPause时执行mMapView. onPause (),实现地图生命周期管理
    baiduMap.setMyLocationConfigeration(new MyLocationConfiguration(MyLocationConfiguration.LocationMode.NORMAL, false, null));
    mMapView.onPause();
}
项目:Tower-develop    文件:BaiduMapFragment.java   
private void setupMapUI(BaiduMap map) {
      map.setMyLocationEnabled(true);
      map.setMyLocationConfigeration(new MyLocationConfiguration(LocationMode.NORMAL, true, null));

      mBDLocClient = new LocationClient(getActivity().getApplicationContext());
mBDLocClient.registerLocationListener(mBDLocListener);

      // Hide the zoom control
      map.setViewPadding(0, 0, 0, baseBottomPadding);
      UiSettings mUiSettings = map.getUiSettings();
      mUiSettings.setCompassEnabled(false);
      mUiSettings.setOverlookingGesturesEnabled(false);
      mUiSettings.setZoomGesturesEnabled(true);
      mUiSettings.setRotateGesturesEnabled(mAppPrefs.isMapRotationEnabled());
  }
项目:XPPLE_IM    文件:LocationActivity.java   
private void initLocClient() {
    // 开启定位图层
    mBaiduMap.setMyLocationEnabled(true);
    mBaiduMap.setMyLocationConfigeration(new MyLocationConfiguration(
            MyLocationConfiguration.LocationMode.NORMAL, true, null));
    // 定位初始化
    mLocClient = new LocationClient(this);
    mLocClient.registerLocationListener(myListener);
    LocationClientOption option = new LocationClientOption();
    option.setProdName("bmobim");// 设置产品线
    option.setOpenGps(true);// 打开gps
    option.setCoorType("bd09ll"); // 设置坐标类型
    option.setScanSpan(1000);
    option.setOpenGps(true);
    option.setIsNeedAddress(true);
    option.setIgnoreKillProcess(true);
    mLocClient.setLocOption(option);
    mLocClient.start();
    if (mLocClient != null && mLocClient.isStarted())
        mLocClient.requestLocation();

    if (lastLocation != null) {
        // 显示在地图上
        LatLng ll = new LatLng(lastLocation.getLatitude(),
                lastLocation.getLongitude());
        MapStatusUpdate u = MapStatusUpdateFactory.newLatLng(ll);
        mBaiduMap.animateMapStatus(u);
    }
}
项目:Hi    文件:NearLocationActivity2.java   
private void initLocClient() {
    // ������λͼ��
    mBaiduMap.setMyLocationEnabled(true);
    mBaiduMap.setMyLocationConfigeration(new MyLocationConfiguration(com.baidu.mapapi.map.MyLocationConfiguration.LocationMode.NORMAL, true, null));
    // ��λ��ʼ��
    mLocClient = new LocationClient(this);
    mLocClient.registerLocationListener(myListener);
    LocationClientOption option = new LocationClientOption();
    option.setProdName("bmobim");// ���ò�Ʒ��
    option.setOpenGps(true);// ��gps
    option.setCoorType("bd09ll"); // ������������
    option.setScanSpan(1000);
    option.setOpenGps(true);
    option.setIsNeedAddress(true);
    option.setIgnoreKillProcess(true);
    mLocClient.setLocOption(option);
    mLocClient.start();
    if (mLocClient != null && mLocClient.isStarted())
        mLocClient.requestLocation();

    if (lastLocation != null) {
        // ��ʾ�ڵ�ͼ��
        LatLng ll = new LatLng(lastLocation.getLatitude(), lastLocation.getLongitude());
        MapStatusUpdate u = MapStatusUpdateFactory.newLatLng(ll);
        mBaiduMap.animateMapStatus(u);
    }
}
项目:Hi    文件:LocationActivity.java   
private void initLocClient() {
//       ������λͼ��
        mBaiduMap.setMyLocationEnabled(true);
        mBaiduMap.setMyLocationConfigeration(new MyLocationConfiguration(
                com.baidu.mapapi.map.MyLocationConfiguration.LocationMode.NORMAL, true, null));
        // ��λ��ʼ��
        mLocClient = new LocationClient(this);
        mLocClient.registerLocationListener(myListener);
        LocationClientOption option = new LocationClientOption();
        option.setProdName("bmobim");// ���ò�Ʒ��
        option.setOpenGps(true);// ��gps
        option.setCoorType("bd09ll"); // ������������
        option.setScanSpan(1000);
        option.setOpenGps(true);
        option.setIsNeedAddress(true);
        option.setIgnoreKillProcess(true);
        mLocClient.setLocOption(option);
        mLocClient.start();
        if (mLocClient != null && mLocClient.isStarted())
            mLocClient.requestLocation();

        if (lastLocation != null) {
            // ��ʾ�ڵ�ͼ��
            LatLng ll = new LatLng(lastLocation.getLatitude(),
                    lastLocation.getLongitude());
            MapStatusUpdate u = MapStatusUpdateFactory.newLatLng(ll);
            mBaiduMap.animateMapStatus(u);
        }
    }
项目:Hi    文件:NearLocationActivity.java   
private void initLocClient() {
    // ������λͼ��
    mBaiduMap.setMyLocationEnabled(true);
    mBaiduMap.setMyLocationConfigeration(new MyLocationConfiguration(com.baidu.mapapi.map.MyLocationConfiguration.LocationMode.NORMAL, true, null));
    // ��λ��ʼ��
    mLocClient = new LocationClient(this);
    mLocClient.registerLocationListener(myListener);
    LocationClientOption option = new LocationClientOption();
    option.setProdName("bmobim");// ���ò�Ʒ��
    option.setOpenGps(true);// ��gps
    option.setCoorType("bd09ll"); // ������������
    option.setScanSpan(1000);
    option.setOpenGps(true);
    option.setIsNeedAddress(true);
    option.setIgnoreKillProcess(true);
    mLocClient.setLocOption(option);
    mLocClient.start();
    if (mLocClient != null && mLocClient.isStarted())
        mLocClient.requestLocation();

    if (lastLocation != null) {
        // ��ʾ�ڵ�ͼ��
        LatLng ll = new LatLng(lastLocation.getLatitude(), lastLocation.getLongitude());
        MapStatusUpdate u = MapStatusUpdateFactory.newLatLng(ll);
        mBaiduMap.animateMapStatus(u);
    }
}
项目:BikeHelper    文件:MainActivity.java   
@Override
protected void onStart() {
    super.onStart();

    MyLocationConfiguration.LocationMode locationMode = MyLocationConfiguration.LocationMode.NORMAL;
    MyLocationConfiguration configeration = new MyLocationConfiguration(locationMode, Config.UseCompass, null);
    mMapView.getMap().setMyLocationConfigeration(configeration);
    mMapView.getMap().setMapType(Config.MapType);
}
项目:ExcellentWiFi    文件:MapFragment.java   
@Override
public void onReceiveLocation(BDLocation location) {
    MyLocationData data = new MyLocationData.Builder()//
            .direction(mCurrentX)//
            .accuracy(location.getRadius())//
            .latitude(location.getLatitude())//
            .longitude(location.getLongitude())//
            .build();

    // �����ҵĶ�λ
    mBaiduMap.setMyLocationData(data);

    // �����Զ���ͼ��
    MyLocationConfiguration config = new MyLocationConfiguration(
            mLocationMode, true, mIconLocation);

    mBaiduMap.setMyLocationConfigeration(config);

    // ȡ����γ��
    mLatitude = location.getLatitude();
    mLongitude = location.getLongitude();

    // �Ƿ��ǵ�һ�ζ�λ
    if (isFirstIn) {
        LatLng latLng = new LatLng(location.getLatitude(),
                location.getLongitude());

        // ���þ�γ��
        MapStatusUpdate msu = MapStatusUpdateFactory.newLatLng(latLng);

        mBaiduMap.animateMapStatus(msu);

        isFirstIn = false;
    }

}
项目:FindGasStation    文件:MainActivity.java   
/**
 * *****************************************************************************
 */

private void initView() {
    iv_list = (ImageView) findViewById(R.id.iv_list);
    iv_list.setOnClickListener(this);
    iv_loc = (ImageView) findViewById(R.id.iv_loc);
    iv_loc.setOnClickListener(this);
    tv_title_right = (TextView) findViewById(R.id.tv_title_button);
    tv_title_right.setText(getResources().getString(R.string.kilometre_3) + " >");
    tv_title_right.setVisibility(View.VISIBLE);
    tv_title_right.setOnClickListener(this);

    ll_summary = (LinearLayout) findViewById(R.id.ll_summary);
    ll_summary.setOnClickListener(this);
    tv_name = (TextView) findViewById(R.id.tv_name);
    tv_distance = (TextView) findViewById(R.id.tv_distance);
    tv_price_a = (TextView) findViewById(R.id.tv_price_a);
    tv_price_b = (TextView) findViewById(R.id.tv_price_b);

    mMapView = (MapView) findViewById(R.id.bmapView);
    mMapView.showScaleControl(false);
    mMapView.showZoomControls(false);
    mBaiduMap = mMapView.getMap();

    mBaiduMap.setMyLocationConfigeration(new MyLocationConfiguration(MyLocationConfiguration.LocationMode.FOLLOWING, true, null));
    mBaiduMap.setMyLocationEnabled(true);

    mLocationClient = new LocationClient(mContext);
    mLocationClient.registerLocationListener(mListener);

    LocationClientOption option = new LocationClientOption();
    option.setLocationMode(LocationMode.Battery_Saving);// 模拟器测试用高精度;
                                                        // 手机真机测试用Battery_Saving:低精度.
    option.setCoorType(Config.Baidu_LatLon); // 返回国测局经纬度坐标系:gcj02 返回百度墨卡托坐标系 :bd09
                                             // 返回百度经纬度坐标系 :bd09ll
    option.setScanSpan(0);// 设置扫描间隔,单位毫秒,当<1000(1s)时,定时定位无效
    option.setIsNeedAddress(true);// 设置是否需要地址信息,默认为无地址
    option.setNeedDeviceDirect(true);// 在网络定位时,是否需要设备方向
    mLocationClient.setLocOption(option);
}
项目:PiBoat    文件:MapActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_map);
    ButterKnife.bind(this);

    mCurrentMode = MyLocationConfiguration.LocationMode.FOLLOWING;

    initMapAndLoc();
    addListener();
}
项目:CarApp    文件:PertrolStationActivity.java   
private void initView() {
    iv_list = (ImageView) findViewById(R.id.iv_list);
    iv_list.setOnClickListener(this);
    iv_loc = (ImageView) findViewById(R.id.iv_loc);
    iv_loc.setOnClickListener(this);
    tv_title_right = (TextView) findViewById(R.id.tv_title_button);
    tv_title_right.setText("3km" + " >");
    tv_title_right.setVisibility(View.VISIBLE);
    tv_title_right.setOnClickListener(this);

    ll_summary = (LinearLayout) findViewById(R.id.ll_summary);
    ll_summary.setOnClickListener(this);
    tv_name = (TextView) findViewById(R.id.tv_name);
    tv_distance = (TextView) findViewById(R.id.tv_distance);
    tv_price_a = (TextView) findViewById(R.id.tv_price_a);
    tv_price_b = (TextView) findViewById(R.id.tv_price_b);

    mMapView = (MapView) findViewById(R.id.bmapView);
    mMapView.showScaleControl(false);
    mMapView.showZoomControls(false);
    mBaiduMap = mMapView.getMap();

    mBaiduMap.setMyLocationConfigeration(new MyLocationConfiguration(
            MyLocationConfiguration.LocationMode.FOLLOWING, true, null));
    mBaiduMap.setMyLocationEnabled(true);

    mLocationClient = new LocationClient(mContext);
    mLocationClient.registerLocationListener(mListener);

    LocationClientOption option = new LocationClientOption();
    option.setLocationMode(LocationMode.Hight_Accuracy);// 高精度;
                                                        // Battery_Saving:低精度.
    option.setCoorType("bd09ll"); // 返回国测局经纬度坐标系:gcj02 返回百度墨卡托坐标系 :bd09
                                    // 返回百度经纬度坐标系 :bd09ll
    option.setScanSpan(0);// 设置扫描间隔,单位毫秒,当<1000(1s)时,定时定位无效
    option.setIsNeedAddress(true);// 设置是否需要地址信息,默认为无地址
    option.setNeedDeviceDirect(true);// 在网络定位时,是否需要设备方向
    mLocationClient.setLocOption(option);

}
项目:BMap    文件:MainActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    mCurrentMode = MyLocationConfiguration.LocationMode.NORMAL;  //定位模式
    bar = (ProgressBar) findViewById(R.id.progressBar2);
    bar.setVisibility(View.GONE);

    InitLocation();  //定位
    InitPoiSearch(); //POI
    InitrequestLocButton(); //罗盘,跟随按钮
    InitBusbutton();  //公车
}
项目:BMap    文件:MainActivity.java   
private void InitrequestLocButton() {
    requestLocButton = (FloatingActionButton) findViewById(R.id.button1);
    requestLocButton.setTitle("普通");
    requestLocButton.setIcon(R.drawable.suo);
    requestLocButton.setSize(FloatingActionButton.SIZE_MINI);
    OnClickListener btnClickListener = new OnClickListener() {
        public void onClick(View v) {
            switch (mCurrentMode) {
                case NORMAL:
                    requestLocButton.setTitle("跟随");
                    mCurrentMode = MyLocationConfiguration.LocationMode.FOLLOWING;
                    mBaiduMap
                            .setMyLocationConfigeration(new MyLocationConfiguration(
                                    mCurrentMode, true, mCurrentMarker));
                    break;
                case COMPASS:
                    requestLocButton.setTitle("普通");
                    mCurrentMode = MyLocationConfiguration.LocationMode.NORMAL;
                    mBaiduMap
                            .setMyLocationConfigeration(new MyLocationConfiguration(
                                    mCurrentMode, true, mCurrentMarker));
                    break;
                case FOLLOWING:
                    requestLocButton.setTitle("罗盘");
                    mCurrentMode = MyLocationConfiguration.LocationMode.COMPASS;
                    mBaiduMap
                            .setMyLocationConfigeration(new MyLocationConfiguration(
                                    mCurrentMode, true, mCurrentMarker));
                    break;
            }
        }
    };
    requestLocButton.setOnClickListener(btnClickListener);
}
项目:FrontOne    文件:MainActivity.java   
/**
 * 初始化方向传感器
 */
private void initOritationListener() {
    myOrientationListener = new MyOrientationListener(
            getApplicationContext());
    myOrientationListener
            .setOnOrientationListener(new OnOrientationListener() {
                @Override
                public void onOrientationChanged(float x) {
                    mXDirection = (int) x;

                    // 构造定位数据
                    MyLocationData locData = new MyLocationData.Builder()
                            .accuracy(mCurrentAccracy)
                            // 此处设置开发者获取到的方向信息,顺时针0-360
                            .direction(mXDirection)
                            .latitude(mCurrentLantitude)
                            .longitude(mCurrentLongitude).build();
                    // 设置定位数据
                    mBaiduMap.setMyLocationData(locData);

                    mBaiduMap
                            .setMyLocationConfigeration(new MyLocationConfiguration(
                                    mCurrentMode, true, null));

                    // 设置自定义图标
                    // BitmapDescriptor mCurrentMarker =
                    // BitmapDescriptorFactory
                    // .fromResource(R.drawable.navi_map_gps_locked);
                    //
                    // MyLocationConfiguration config = new
                    // MyLocationConfiguration(
                    // mCurrentMode, true, mCurrentMarker);
                    // mBaiduMap.setMyLocationConfigeration(config);

                }
            });
}
项目:Diandi1.20    文件:LocationActivity.java   
private void initLocClient() {
//       开启定位图层
        mBaiduMap.setMyLocationEnabled(true);
        mBaiduMap.setMyLocationConfigeration(new MyLocationConfiguration(
                com.baidu.mapapi.map.MyLocationConfiguration.LocationMode.NORMAL, true, null));
        // 定位初始化
        mLocClient = new LocationClient(this);
        mLocClient.registerLocationListener(myListener);
        LocationClientOption option = new LocationClientOption();
        option.setProdName("bmobim");// 设置产品线
        option.setOpenGps(true);// 打开gps
        option.setCoorType("bd09ll"); // 设置坐标类型
        option.setScanSpan(1000);
        option.setOpenGps(true);
        option.setIsNeedAddress(true);
        option.setIgnoreKillProcess(true);
        mLocClient.setLocOption(option);
        mLocClient.start();
        if (mLocClient != null && mLocClient.isStarted())
            mLocClient.requestLocation();

        if (lastLocation != null) {
            // 显示在地图上
            LatLng ll = new LatLng(lastLocation.getLatitude(),
                    lastLocation.getLongitude());
            MapStatusUpdate u = MapStatusUpdateFactory.newLatLng(ll);
            mBaiduMap.animateMapStatus(u);
        }
    }
项目:GitHub    文件:MainActivity.java   
private void beginService() {
    if (!Utils.isGpsOPen(this)) {
        Utils.showDialog(this);
        return;
    }
    title.setText(getString(R.string.routing));
    textview_time.setText(getString(R.string.bike_time));
    textview_distance.setText(getString(R.string.bike_distance));
    textview_price.setText(getString(R.string.bike_price));
    prompt.setText(getString(R.string.routing_prompt));

    textview_time.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20);
    textview_distance.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20);
    textview_price.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20);
    bike_time.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20);
    bike_distance.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20);
    bike_price.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20);

    prompt.setVisibility(View.VISIBLE);
    bike_layout.setVisibility(View.VISIBLE);
    current_addr.setVisibility(View.GONE);
    menu_icon.setVisibility(View.GONE);
    unlock.setVisibility(View.GONE);
    divider.setVisibility(View.GONE);
    btn_refresh.setVisibility(View.GONE);

    countDownTimer.cancel();
    bike_info_layout.setVisibility(View.GONE);
    confirm_cancel_layout.setVisibility(View.GONE);
    bike_distance_layout.setVisibility(View.VISIBLE);
    book_bt.setVisibility(View.GONE);
    if (routeOverlay != null)
        routeOverlay.removeFromMap();

    btn_locale.setVisibility(View.GONE);
    bike_info_layout.setVisibility(View.GONE);
    end_route.setVisibility(View.VISIBLE);
    mMapView.showZoomControls(false);
    mBaiduMap.clear();
    if (isServiceLive)
        mlocationClient.requestLocation();
    Intent intent = new Intent(this, RouteService.class);
    startService(intent);
    MyLocationConfiguration configuration
            = new MyLocationConfiguration(locationMode, true, mIconLocation);
    //设置定位图层配置信息,只有先允许定位图层后设置定位图层配置信息才会生
}
项目:GitHub    文件:RouteService.java   
private void initLocation() {
        mIconLocation = BitmapDescriptorFactory
                .fromResource(R.mipmap.location_marker);
        locationMode = MyLocationConfiguration.LocationMode.NORMAL;

        //定位服务的客户端。宿主程序在客户端声明此类,并调用,目前只支持在主线程中启动
        mlocationClient = new LocationClient(this);
        mlistener = new MylocationListener();
//        initMarkerClickEvent();
        //注册监听器
        mlocationClient.registerLocationListener(mlistener);
        //配置定位SDK各配置参数,比如定位模式、定位时间间隔、坐标系类型等
        LocationClientOption mOption = new LocationClientOption();
        //设置坐标类型
        mOption.setCoorType("bd09ll");
        //设置是否需要地址信息,默认为无地址
        mOption.setIsNeedAddress(true);
        //设置是否打开gps进行定位
        mOption.setOpenGps(true);
        //设置扫描间隔,单位是毫秒 当<1000(1s)时,定时定位无效
        int span = 10000;
        mOption.setScanSpan(span);
        //设置 LocationClientOption
        mlocationClient.setLocOption(mOption);

        //初始化图标,BitmapDescriptorFactory是bitmap 描述信息工厂类.
        mIconLocation = BitmapDescriptorFactory
                .fromResource(R.mipmap.location_marker);

        myOrientationListener = new MyOrientationListener(this);
        //通过接口回调来实现实时方向的改变
        myOrientationListener.setOnOrientationListener(new MyOrientationListener.OnOrientationListener() {
            @Override
            public void onOrientationChanged(float x) {
            }
        });
//        mSearch = RoutePlanSearch.newInstance();
//        mSearch.setOnGetRoutePlanResultListener(this);
//        //开启定位
//        mBaiduMap.setMyLocationEnabled(true);
        if (!mlocationClient.isStarted()) {
            mlocationClient.start();
        }
        myOrientationListener.start();
    }
项目:AssistantBySDK    文件:NaviConfirmPointActivity.java   
@OnClick({R.id.ancp_back_bt, R.id.ancp_map_locate_bt, R.id.ancp_zoom_in_bt, R.id.ancp_zoom_out_bt,
        R.id.ancp_poi_detial_pre_bt, R.id.ancp_poi_detial_next_bt, R.id.ancp_map_its_bt})
public void onClick(View view) {
    switch (view.getId()) {
        case R.id.ancp_back_bt:
            onBackPressed();
            break;
        case R.id.ancp_map_locate_bt:
            /* 封装定位信息 */
            BDLocation location = new BDLocation();
            location.setLatitude(address.getLatitude());
            location.setLongitude(address.getLongitude());
            location.setRadius(address.getRadius());
            location.setSpeed(address.getSpeed());
            location.setSatelliteNumber(address.getSatelliteNumber());
            location = LocationClient.getBDLocationInCoorType(location, BDLocation.BDLOCATION_GCJ02_TO_BD09LL);
            /* 开启定位图层 */
            baiduMap.setMyLocationEnabled(true);
            // 设置定位图层的配置(定位模式,是否允许方向信息,用户自定义定位图标)
            baiduMap.setMyLocationConfigeration(new MyLocationConfiguration(MyLocationConfiguration.LocationMode.FOLLOWING, true, null));
            /* 构造定位数据并设置 */
            baiduMap.setMyLocationData(new MyLocationData.Builder().latitude(location.getLatitude())
                    .longitude(location.getLongitude())
                    .accuracy(location.getRadius())
                    .direction(location.getDirection())
                    .satellitesNum(location.getSatelliteNumber())
                    .speed(location.getSpeed())
                    .build());
            break;
        case R.id.ancp_zoom_in_bt:
            baiduMap.setMapStatus(MapStatusUpdateFactory.zoomIn());
            break;
        case R.id.ancp_zoom_out_bt:
            baiduMap.setMapStatus(MapStatusUpdateFactory.zoomOut());
            break;
        case R.id.ancp_poi_detial_pre_bt:
            if (mAncpPoiDetailPager.getCurrentItem() > 0 && mAncpPoiDetailPager.getCurrentItem() < list.size()) {
                showPoiDetail(mAncpPoiDetailPager.getCurrentItem() - 1);
            }
            break;
        case R.id.ancp_poi_detial_next_bt:
            if (mAncpPoiDetailPager.getCurrentItem() >= 0 && mAncpPoiDetailPager.getCurrentItem() < list.size() - 1) {
                showPoiDetail(mAncpPoiDetailPager.getCurrentItem() + 1);
            }
            break;
        case R.id.ancp_map_its_bt:
            if (baiduMap.isTrafficEnabled()) {
                baiduMap.setTrafficEnabled(false);
                ((ImageButton) view).setImageResource(R.drawable.bnav_common_ic_map_its_off);
            } else {
                baiduMap.setTrafficEnabled(true);
                ((ImageButton) view).setImageResource(R.drawable.bnav_common_ic_map_its_on);
            }
            break;
    }
}
项目:Mobike    文件:RouteService.java   
private void initLocation() {
        mIconLocation = BitmapDescriptorFactory
                .fromResource(R.mipmap.location_marker);
        locationMode = MyLocationConfiguration.LocationMode.NORMAL;

        //定位服务的客户端。宿主程序在客户端声明此类,并调用,目前只支持在主线程中启动
        mlocationClient = new LocationClient(this);
        mlistener = new MylocationListener();
//        initMarkerClickEvent();
        //注册监听器
        mlocationClient.registerLocationListener(mlistener);
        //配置定位SDK各配置参数,比如定位模式、定位时间间隔、坐标系类型等
        LocationClientOption mOption = new LocationClientOption();
        //设置坐标类型
        mOption.setCoorType("bd09ll");
        //设置是否需要地址信息,默认为无地址
        mOption.setIsNeedAddress(true);
        //设置是否打开gps进行定位
        mOption.setOpenGps(true);
        //设置扫描间隔,单位是毫秒 当<1000(1s)时,定时定位无效
        int span = 10000;
        mOption.setScanSpan(span);
        //设置 LocationClientOption
        mlocationClient.setLocOption(mOption);

        //初始化图标,BitmapDescriptorFactory是bitmap 描述信息工厂类.
        mIconLocation = BitmapDescriptorFactory
                .fromResource(R.mipmap.location_marker);

        myOrientationListener = new MyOrientationListener(this);
        //通过接口回调来实现实时方向的改变
        myOrientationListener.setOnOrientationListener(new MyOrientationListener.OnOrientationListener() {
            @Override
            public void onOrientationChanged(float x) {
            }
        });
//        mSearch = RoutePlanSearch.newInstance();
//        mSearch.setOnGetRoutePlanResultListener(this);
//        //开启定位
//        mBaiduMap.setMyLocationEnabled(true);
        if (!mlocationClient.isStarted()) {
            mlocationClient.start();
        }
        myOrientationListener.start();
    }
项目:MapLocation    文件:MainActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_location);
    requestLocButton = (Button) findViewById(R.id.button1);
    mCurrentMode = MyLocationConfiguration.LocationMode.NORMAL;
    requestLocButton.setText("普通");
    View.OnClickListener btnClickListener = new View.OnClickListener() {
        public void onClick(View v) {
            switch (mCurrentMode) {
                case NORMAL:
                    requestLocButton.setText("跟随");
                    mCurrentMode = MyLocationConfiguration.LocationMode.FOLLOWING;
                    mBaiduMap
                            .setMyLocationConfigeration(new MyLocationConfiguration(
                                    mCurrentMode, true, mCurrentMarker));
                    break;
                case COMPASS:
                    requestLocButton.setText("普通");
                    mCurrentMode = MyLocationConfiguration.LocationMode.NORMAL;
                    mBaiduMap
                            .setMyLocationConfigeration(new MyLocationConfiguration(
                                    mCurrentMode, true, mCurrentMarker));
                    break;
                case FOLLOWING:
                    requestLocButton.setText("罗盘");
                    mCurrentMode = MyLocationConfiguration.LocationMode.COMPASS;
                    mBaiduMap
                            .setMyLocationConfigeration(new MyLocationConfiguration(
                                    mCurrentMode, true, mCurrentMarker));
                    break;
                default:
                    break;
            }
        }
    };
    requestLocButton.setOnClickListener(btnClickListener);

    RadioGroup group = (RadioGroup) this.findViewById(R.id.radioGroup);
    radioButtonListener = new RadioGroup.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(RadioGroup group, int checkedId) {
            if (checkedId == R.id.defaulticon) {
                // 传入null则,恢复默认图标
                mCurrentMarker = null;
                mBaiduMap
                        .setMyLocationConfigeration(new MyLocationConfiguration(
                                mCurrentMode, true, null));
            }
            if (checkedId == R.id.customicon) {
                // 修改为自定义marker
                mCurrentMarker = BitmapDescriptorFactory
                        .fromResource(R.drawable.ic_launcher);
                mBaiduMap
                        .setMyLocationConfigeration(new MyLocationConfiguration(
                                mCurrentMode, true, mCurrentMarker,
                                accuracyCircleFillColor, accuracyCircleStrokeColor));
            }
        }
    };
    group.setOnCheckedChangeListener(radioButtonListener);

    // 地图初始化
    mMapView = (MapView) findViewById(R.id.bmapView);
    mBaiduMap = mMapView.getMap();
    // 开启定位图层
    mBaiduMap.setMyLocationEnabled(true);
    // 定位初始化
    mLocClient = new LocationClient(this);
    mLocClient.registerLocationListener(myListener);
    LocationClientOption option = new LocationClientOption();
    option.setOpenGps(true); // 打开gps
    option.setCoorType("bd09ll"); // 设置坐标类型
    option.setScanSpan(1000);
    mLocClient.setLocOption(option);
    mLocClient.start();
    init();
}
项目:FindYou    文件:RoutePlan.java   
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_routeplan);
    Log.e("sid",netWork.session_id);
    //netWork.fun(7.0,1.3);
    CharSequence titleLable = "FindYou";
    setTitle(titleLable);
    mWalk=(Button)findViewById(R.id.walk);
    // 初始化地图
    mMapView = (MapView) findViewById(R.id.map);
    mBaidumap = mMapView.getMap();
    editSt = (EditText) findViewById(R.id.start);
    editEn = (EditText) findViewById(R.id.end);
    editSt.setFocusable(false);
    editEn.setFocusable(false);
    mBtnPre = (Button) findViewById(R.id.pre);
    mBtnNext = (Button) findViewById(R.id.next);
    mBtnPre.setVisibility(View.INVISIBLE);
    mBtnNext.setVisibility(View.INVISIBLE);
    //mBtnPre.setVisibility(View.INVISIBLE);
    //mBtnNext.setVisibility(View.INVISIBLE);
    // 地图点击事件处理
    mBaidumap.setOnMapClickListener(this);
    // 初始化搜索模块,注册事件监听
    mSearch = RoutePlanSearch.newInstance();
    mSearch.setOnGetRoutePlanResultListener(this);
    mCurrentMode = MyLocationConfiguration.LocationMode.NORMAL;
    mCurrentMarker = BitmapDescriptorFactory
            .fromResource(R.drawable.icon_geo);
    mBaidumap
            .setMyLocationConfigeration(new MyLocationConfiguration(
                    mCurrentMode, true, null));

    mLocClient = new LocationClient(this);
    mLocClient.registerLocationListener(myListener);
    LocationClientOption option = new LocationClientOption();
    option.setOpenGps(true); // 打开gps
    option.setCoorType("bd09ll"); // 设置坐标类型
    option.setScanSpan(3000);
    mLocClient.setLocOption(option);
    mLocClient.start();


}