如何使用

如何使用


第一步获取依赖

compile 'com.zto.common:chooselocation:1.0.0'
#其他依赖
compile 'com.android.support:appcompat-v7:27.0.0'
compile 'com.android.support:recyclerview-v7:27.0.0'
compile 'com.tbruyelle.rxpermissions2:rxpermissions:0.9.4@aar'
compile "io.reactivex.rxjava2:rxjava:2.1.6"
compile 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.33'

第二步初始化

  • 将百度平台获取的key,在你的项目清单文件里配置,将“百度平台申请的key”替换成你所申请的key

第三步获取位置

  • 启动选择位置页面,并且设置requestCode
Intent intent = new Intent(MainActivity.this,LocationActivity.class);
startActivityForResult(intent, REQUEST_CODE);
  • 获取定位参数
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (resultCode == RESULT_OK && requestCode == REQUEST_CODE ) {
                     ReverseGeoCodeResult reverseGeoCodeResult = data.getParcelableExtra(RESULT_SELECTED_POSITION);
        }
    }

你可能感兴趣的:(如何使用)