百度定位服务的管理类

                                                                                 百度定位服务的管理类

    //5秒获取一次
    public static final int SCANSPAN_TIME = 5000;  //单位ms
    
    private static final String PRODNAME_DEFAULT = "prodName_BDLocationManager";
    
    public static final String COORTYPE_GCJ02 = "gcj02";  //国测局经纬度坐标系
    
    public static final String COORTYPE_BD09 = "bd09";  //百度墨卡托坐标系
    
    public static final String COORTYPE_BD09LL = "bd09ll";  //百度经纬度坐标系  默认
    
    
    /**
     * 百度定位客户端是否开启的标志位
     */
    private boolean isStart;
    
    /**
     * 百度定位的客户端
     */
    private LocationClient mLocationClient;
    
    /**
     * 百度定位客户端的设置信息(定位方式)
     */
    private LocationClientOption mLocationClientOption;
    
    
//    private Context mContext;
    
    /**
     *
     * @param context
     * @param bdLocationListener
     */
    public BDLocationManager(Context context,BDLocationListener bdLocationListener){
        mLocationClient = new LocationClient(context);
        mLocationClient.registerLocationListener(bdLocationListener);
    }
    
    
    /**
     * 初始化定位方式
     * @param locationClientOption
     */
    public void initLocationClientOption(LocationClientOption locationClientOption){
        this.mLocationClientOption = locationClientOption;
        mLocationClient.setLocOption(mLocationClientOption);
    }
    
    /**
     * 打开百度定位的客户端
     */
    public void startBDLocationClient(){
        if(mLocationClient != null){
            initDefaultLocationClientOption();
            mLocationClient.start();
            isStart = true;
        }
    }
    
    /**
     * 关闭百度定位的客户端
     */
    public void stopBDLocationClient(){
        if(mLocationClient != null){
            mLocationClient.stop();
            isStart = false;
        }
    }



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值