Java Code Examples for com.baidu.location.LocationClient#setLocOption()
The following examples show how to use
com.baidu.location.LocationClient#setLocOption() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaiduMapSelectPoiFragment.java From BmapLite with Apache License 2.0 | 6 votes |
public void initBaiduSdk() { // 定位初始化 mLocClient = new LocationClient(getActivity()); mLocClient.registerLocationListener(this); LocationClientOption option = new LocationClientOption(); option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy); option.setCoorType("gcj02"); option.setOpenGps(true); option.setScanSpan(1000); option.setIsNeedAltitude(true); option.setIsNeedAddress(false); mLocClient.setLocOption(option); MyLocationConfiguration configuration = new MyLocationConfiguration(MyLocationConfiguration.LocationMode.NORMAL, true, null); mBaiduMap.setMyLocationConfiguration(configuration); mLocClient.start(); }
Example 2
Source File: RouteDetailActivity.java From Mobike with Apache License 2.0 | 6 votes |
private void initMap() { mlocationClient = new LocationClient(this); // mlistener = new MylocationListener(); // mlocationClient.registerLocationListener(mlistener); 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); if (!mlocationClient.isStarted()) { mlocationClient.start(); } UiSettings settings = routeBaiduMap.getUiSettings(); settings.setScrollGesturesEnabled(true); }
Example 3
Source File: LocationActivity.java From imsdk-android with MIT License | 6 votes |
private void initLocationClient() { geoCoder = GeoCoder.newInstance(); poiSearch = PoiSearch.newInstance(); poiSearch.setOnGetPoiSearchResultListener(this); locationClient = new LocationClient(getApplication()); LocationClientOption option = new LocationClientOption(); option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy); option.setCoorType(CoordinateType.BD09LL); // option.setScanSpan(5000);// option.setIsNeedAddress(true); option.setOpenGps(true); option.setLocationNotify(true); option.setIsNeedLocationDescribe(true); option.setIsNeedLocationPoiList(true); option.setIgnoreKillProcess(true); option.SetIgnoreCacheException(true); option.setEnableSimulateGps(true); locationClient.setLocOption(option); locationClient.registerLocationListener(this); locationClient.start(); }
Example 4
Source File: ShareLocationActivity.java From imsdk-android with MIT License | 6 votes |
private void initLocationClient() { locationClient = new LocationClient(getApplicationContext()); LocationClientOption option = new LocationClientOption(); option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy); option.setCoorType(CoordinateType.BD09LL); option.setIsNeedAddress(true); option.setOpenGps(true); option.setLocationNotify(true); option.setNeedDeviceDirect(true); option.setIsNeedLocationDescribe(false); option.setIsNeedLocationPoiList(true); option.setIgnoreKillProcess(true); option.SetIgnoreCacheException(true); option.setEnableSimulateGps(true); //5s发送一次自己的位置 option.setScanSpan(5000); locationClient.setLocOption(option); locationClient.registerLocationListener(this); locationClient.start(); }
Example 5
Source File: IndexDelegate.java From FastWaiMai with MIT License | 6 votes |
private void initLocation() { // 声明LocationClient类 mLocationClient = new LocationClient(getContext()); option = new LocationClientOption(); option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy); option.setCoorType("bd09ll"); option.setOpenGps(true); option.setLocationNotify(true); option.setIgnoreKillProcess(true); option.SetIgnoreCacheException(false); option.setEnableSimulateGps(false); option.setIsNeedLocationDescribe(true); option.setIsNeedLocationPoiList(true); option.setIsNeedAddress(true); mLocationClient.setLocOption(option); // 注册监听函数 mLocationClient.registerLocationListener(myListener); mLocationClient.start(); }
Example 6
Source File: BaiduMapSelectPoiFragment.java From BmapLite with GNU General Public License v3.0 | 6 votes |
public void initBaiduSdk() { // 定位初始化 mLocClient = new LocationClient(getActivity()); mLocClient.registerLocationListener(this); LocationClientOption option = new LocationClientOption(); option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy); option.setCoorType("gcj02"); option.setOpenGps(true); option.setScanSpan(1000); option.setIsNeedAltitude(true); option.setIsNeedAddress(false); mLocClient.setLocOption(option); MyLocationConfiguration configuration = new MyLocationConfiguration(MyLocationConfiguration.LocationMode.NORMAL, true, null); mBaiduMap.setMyLocationConfiguration(configuration); mLocClient.start(); }
Example 7
Source File: BaiduMapFragment.java From BmapLite with Apache License 2.0 | 5 votes |
public void initLocationSdk() { // 定位初始化 mLocClient = new LocationClient(getActivity()); mLocClient.registerLocationListener(this); LocationClientOption option = new LocationClientOption(); option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy); option.setCoorType("gcj02"); option.setOpenGps(true); option.setScanSpan(1000); option.setIsNeedAltitude(true); option.setIsNeedAddress(false); mLocClient.setLocOption(option); MyLocationConfiguration configuration = new MyLocationConfiguration(MyLocationConfiguration.LocationMode.NORMAL, true, null); mBaiduMap.setMyLocationConfiguration(configuration); mLocClient.start(); try { LocationManager locManager = (LocationManager) getActivity().getSystemService(Context.LOCATION_SERVICE); if (!locManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { onMessage(getResources().getString(R.string.gps_enabled_false)); } } catch (Exception e) { e.printStackTrace(); } }
Example 8
Source File: MapActivity.java From BaiduMap-TrafficAssistant with MIT License | 5 votes |
private void initLocation() { mLocationMode = LocationMode.NORMAL; mLocationClient = new LocationClient(this); mLocationListener = new MyLocationListener(); mLocationClient.registerLocationListener(mLocationListener); LocationClientOption option = new LocationClientOption(); option.setCoorType("bd09ll"); option.setIsNeedAddress(true); option.setOpenGps(true); option.setScanSpan(1000);// 设置定位一秒钟请求一次; mLocationClient.setLocOption(option); // 初始化图标 mIconLocation = BitmapDescriptorFactory .fromResource(R.drawable.navi_map_gps_locked); myOrientationListener = new MyOrientationListener(context); myOrientationListener .setOnOrientationListener(new OnOrientationListener() { @Override public void onOrientationChanged(float x) { mCurrentX = x; } }); }
Example 9
Source File: BaiduMapActivity.java From FanXin-based-HuanXin with GNU General Public License v2.0 | 5 votes |
private void showMapWithLocationClient() { progressDialog = new ProgressDialog(this); progressDialog.setCanceledOnTouchOutside(false); progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); progressDialog.setMessage("正在确定你的位置..."); progressDialog.setOnCancelListener(new OnCancelListener() { public void onCancel(DialogInterface arg0) { if (progressDialog.isShowing()) { progressDialog.dismiss(); } Log.d("map", "cancel retrieve location"); finish(); } }); progressDialog.show(); mLocClient = new LocationClient(this); mLocClient.registerLocationListener(myListener); LocationClientOption option = new LocationClientOption(); option.setOpenGps(true);// 打开gps // option.setCoorType("bd09ll"); //设置坐标类型 // Johnson change to use gcj02 coordination. chinese national standard // so need to conver to bd09 everytime when draw on baidu map option.setCoorType("gcj02"); option.setScanSpan(30000); option.setAddrType("all"); mLocClient.setLocOption(option); }
Example 10
Source File: WelcomeActivity.java From CoolWeather with Apache License 2.0 | 5 votes |
private void initBaiduMapLocation() { mLocationClient = new LocationClient(this.getApplicationContext()); mListener = new MyLocationListener(); mLocationClient.registerLocationListener(mListener);// 娉ㄥ唽鐩戝惉鍑芥暟 LocationClientOption option = new LocationClientOption(); option.setLocationMode(LocationMode.Hight_Accuracy); option.setIsNeedAddress(true); mLocationClient.setLocOption(option); mLocationClient.start(); }
Example 11
Source File: MainActivity.java From nearbydemo with Eclipse Public License 1.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { boolean first = getSharedPreferences("userinfo", Context.MODE_PRIVATE).getBoolean("first", false); if (!first) { Intent intent = new Intent(this, LoginActivity.class); startActivity(intent); } super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); reqQueue = Volley.newRequestQueue(this); imageLoader = new ImageLoader(reqQueue, new BitmapLruCache()); //百度地图定位 mLocationClient = new LocationClient(getApplicationContext());//是否有问题?? mMyLocationListener = new MyLocationListener(); mLocationClient.registerLocationListener(mMyLocationListener); LocationClientOption option = new LocationClientOption(); option.setLocationMode(LocationMode.Hight_Accuracy);// 设置定位模式 option.setCoorType("bd09ll");// 返回的定位结果是百度经纬度,默认值gcj02 option.setIsNeedAddress(true);// 返回的定位结果包含地址信息 option.setNeedDeviceDirect(true);// 返回的定位结果包含手机机头的方向 mLocationClient.setLocOption(option); }
Example 12
Source File: EaseBaiduMapActivity.java From Social with Apache License 2.0 | 5 votes |
private void showMapWithLocationClient() { String str1 = getResources().getString(R.string.Making_sure_your_location); progressDialog = new ProgressDialog(this); progressDialog.setCanceledOnTouchOutside(false); progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); progressDialog.setMessage(str1); progressDialog.setOnCancelListener(new OnCancelListener() { public void onCancel(DialogInterface arg0) { if (progressDialog.isShowing()) { progressDialog.dismiss(); } Log.d("map", "cancel retrieve location"); finish(); } }); progressDialog.show(); mLocClient = new LocationClient(this); mLocClient.registerLocationListener(myListener); LocationClientOption option = new LocationClientOption(); option.setOpenGps(true);// 打开gps // option.setCoorType("bd09ll"); //设置坐标类型 // Johnson change to use gcj02 coordination. chinese national standard // so need to conver to bd09 everytime when draw on baidu map option.setCoorType("gcj02"); option.setScanSpan(30000); option.setAddrType("all"); mLocClient.setLocOption(option); }
Example 13
Source File: WBNearbyActivity.java From Simpler with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_wb_nearby); ButterKnife.bind(this); //声明LocationClient类 mLocationClient = new LocationClient(getApplicationContext()); //注册监听函数 mLocationClient.registerLocationListener(myListener); mLocationClient.setLocOption(BDLocationUtil.getLocationClientOption()); mLocationClient.start(); // 每次刷新微博数 mRefreshCount = BaseSettings.sSettings.refreshCount; mAdapter = new StatusListAdapter(this, null); mSwipeRefresh.setRecyclerViewAndAdapter(mRvStatuses, mAdapter); mSwipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { // 刷新 if (TextUtils.isEmpty(mLongitude) || TextUtils.isEmpty(mLatitude)) { mSwipeRefresh.setRefreshing(false); return; } mPage = 1; loadStatuses(1, true); mSwipeRefresh.setRefreshing(true); } }); mSwipeRefresh.setOnLoadingListener(new DSwipeRefresh.OnLoadingListener() { @Override public void onLoading() { if (mPage != 0) { mAdapter.setFooterInfo(getString(R.string.data_loading)); loadStatuses(mPage, false); } } }); }
Example 14
Source File: BaiduLocationService.java From GeometricWeather with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void requestLocation(Context context, @NonNull LocationCallback callback){ this.callback = callback; LocationClientOption option = new LocationClientOption(); option.setLocationMode(LocationClientOption.LocationMode.Battery_Saving); // 可选,默认高精度,设置定位模式,高精度,低功耗,仅设备 option.setCoorType("wgs84"); // 可选,默认gcj02,设置返回的定位结果坐标系 option.setScanSpan(0); // 可选,默认0,即仅定位一次,设置发起定位请求的间隔需要大于等于1000ms才是有效的 option.setIsNeedAddress(true); // 可选,设置是否需要地址信息,默认不需要 option.setOpenGps(false); // 可选,默认false,设置是否使用gps option.setLocationNotify(false); // 可选,默认false,设置是否当gps有效时按照1S1次频率输出GPS结果 option.setIsNeedLocationDescribe(false); // 可选,默认false,设置是否需要位置语义化结果,可以在BDLocation.getLocationDescribe里得到,结果类似于“在北京天安门附近” option.setIsNeedLocationPoiList(false); // 可选,默认false,设置是否需要POI结果,可以在BDLocation.getPoiList里得到 option.setIgnoreKillProcess(false); // 可选,默认true,定位SDK内部是一个SERVICE,并放到了独立进程,设置是否在stop的时候杀死这个进程,默认不杀死 option.SetIgnoreCacheException(true); // 可选,默认false,设置是否收集CRASH信息,默认收集 option.setEnableSimulateGps(false); // 可选,默认false,设置是否需要过滤gps仿真结果,默认需要 option.setWifiCacheTimeOut(5 * 60 * 1000); // 可选,如果设置了该接口,首次启动定位时,会先判断当前WiFi是否超出有效期,若超出有效期,会先重新扫描WiFi,然后定位 client = new LocationClient(context.getApplicationContext()); client.setLocOption(option); client.registerLocationListener(listener); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { manager.createNotificationChannel(getLocationNotificationChannel(context)); client.enableLocInForeground( GeometricWeather.NOTIFICATION_ID_LOCATION, getLocationNotification(context)); } client.start(); }
Example 15
Source File: EaseBaiduMapActivity.java From Study_Android_Demo with Apache License 2.0 | 5 votes |
private void showMapWithLocationClient() { String str1 = getResources().getString(R.string.Making_sure_your_location); progressDialog = new ProgressDialog(this); progressDialog.setCanceledOnTouchOutside(false); progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); progressDialog.setMessage(str1); progressDialog.setOnCancelListener(new OnCancelListener() { public void onCancel(DialogInterface arg0) { if (progressDialog.isShowing()) { progressDialog.dismiss(); } Log.d("map", "cancel retrieve location"); finish(); } }); progressDialog.show(); mLocClient = new LocationClient(this); mLocClient.registerLocationListener(myListener); LocationClientOption option = new LocationClientOption(); option.setOpenGps(true);// open gps // option.setCoorType("bd09ll"); // Johnson change to use gcj02 coordination. chinese national standard // so need to conver to bd09 everytime when draw on baidu map option.setCoorType("gcj02"); option.setScanSpan(30000); option.setAddrType("all"); mLocClient.setLocOption(option); }
Example 16
Source File: BaiduMapFragment.java From BmapLite with GNU General Public License v3.0 | 5 votes |
public void initLocationSdk() { // 定位初始化 mLocClient = new LocationClient(getActivity()); mLocClient.registerLocationListener(this); LocationClientOption option = new LocationClientOption(); option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy); option.setCoorType("gcj02"); option.setOpenGps(true); option.setScanSpan(1000); option.setIsNeedAltitude(true); option.setIsNeedAddress(false); mLocClient.setLocOption(option); MyLocationConfiguration configuration = new MyLocationConfiguration(MyLocationConfiguration.LocationMode.NORMAL, true, null); mBaiduMap.setMyLocationConfiguration(configuration); mLocClient.start(); try { LocationManager locManager = (LocationManager) getActivity().getSystemService(Context.LOCATION_SERVICE); if (!locManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { onMessage(getResources().getString(R.string.gps_enabled_false)); } } catch (Exception e) { e.printStackTrace(); } }
Example 17
Source File: LocationDelegate.java From FastWaiMai with MIT License | 4 votes |
private void initLocation() { // 声明LocationClient类 使用ApplicationContext mLocationClient = new LocationClient(getProxyActivity().getApplicationContext()); // 利用LocationClientOption类配置定位SDK参数 option = new LocationClientOption(); option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy); // 可选,设置定位模式,默认高精度 LocationMode.Hight_Accuracy:高精度; LocationMode. Battery_Saving:低功耗; LocationMode. Device_Sensors:仅使用设备; option.setCoorType("bd09ll"); // 可选,设置返回经纬度坐标类型,默认gcj02 // gcj02:国测局坐标; // bd09ll:百度经纬度坐标; // bd09:百度墨卡托坐标; // 海外地区定位,无需设置坐标类型,统一返回wgs84类型坐标 option.setOpenGps(true); // 可选,设置是否使用gps,默认false // 使用高精度和仅用设备两种定位模式的,参数必须设置为true option.setLocationNotify(true); // 可选,设置是否当GPS有效时按照1S/1次频率输出GPS结果,默认false option.setIgnoreKillProcess(true); // 可选,定位SDK内部是一个service,并放到了独立进程。 // 设置是否在stop的时候杀死这个进程,默认(建议)不杀死,即setIgnoreKillProcess(true) option.SetIgnoreCacheException(false); // 可选,设置是否收集Crash信息,默认收集,即参数为false option.setEnableSimulateGps(false); // 可选,设置是否需要过滤GPS仿真结果,默认需要,即参数为false option.setIsNeedLocationDescribe(true); // 可选,是否需要位置描述信息,默认为不需要,即参数为false option.setIsNeedLocationPoiList(true); // 可选,是否需要周边POI信息,默认为不需要,即参数为false option.setIsNeedAddress(true);// 获取详细信息 //设置扫描间隔 // option.setScanSpan(10000); mLocationClient.setLocOption(option); // 注册监听函数 mLocationClient.registerLocationListener(myListener); mLocationClient.start(); }
Example 18
Source File: AddressEditDelegate.java From FastWaiMai with MIT License | 4 votes |
private void initLocation() { // 声明LocationClient类 mLocationClient = new LocationClient(getContext()); // 利用LocationClientOption类配置定位SDK参数 option = new LocationClientOption(); option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy); // 可选,设置定位模式,默认高精度 LocationMode.Hight_Accuracy:高精度; LocationMode. Battery_Saving:低功耗; LocationMode. Device_Sensors:仅使用设备; option.setCoorType("bd09ll"); // 可选,设置返回经纬度坐标类型,默认gcj02 // gcj02:国测局坐标; // bd09ll:百度经纬度坐标; // bd09:百度墨卡托坐标; // 海外地区定位,无需设置坐标类型,统一返回wgs84类型坐标 option.setOpenGps(true); // 可选,设置是否使用gps,默认false // 使用高精度和仅用设备两种定位模式的,参数必须设置为true option.setLocationNotify(true); // 可选,设置是否当GPS有效时按照1S/1次频率输出GPS结果,默认false option.setIgnoreKillProcess(true); // 可选,定位SDK内部是一个service,并放到了独立进程。 // 设置是否在stop的时候杀死这个进程,默认(建议)不杀死,即setIgnoreKillProcess(true) option.SetIgnoreCacheException(false); // 可选,设置是否收集Crash信息,默认收集,即参数为false option.setEnableSimulateGps(false); // 可选,设置是否需要过滤GPS仿真结果,默认需要,即参数为false option.setIsNeedLocationDescribe(true); // 可选,是否需要位置描述信息,默认为不需要,即参数为false option.setIsNeedLocationPoiList(true); // 可选,是否需要周边POI信息,默认为不需要,即参数为false option.setIsNeedAddress(true);// 获取详细信息 //设置扫描间隔 // option.setScanSpan(10000); mLocationClient.setLocOption(option); // 注册监听函数 mLocationClient.registerLocationListener(myListener); mLocationClient.start(); }
Example 19
Source File: MainActivity.java From BaiDuMapSelectDemo with Apache License 2.0 | 4 votes |
/** * 初始化定位相关 */ private void initLocation() { // 声明LocationClient类 mLocationClient = new LocationClient(getApplicationContext()); // 利用LocationClientOption类配置定位SDK参数 option = new LocationClientOption(); option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy); // 可选,设置定位模式,默认高精度 LocationMode.Hight_Accuracy:高精度; LocationMode. Battery_Saving:低功耗; LocationMode. Device_Sensors:仅使用设备; option.setCoorType("bd09ll"); // 可选,设置返回经纬度坐标类型,默认gcj02 // gcj02:国测局坐标; // bd09ll:百度经纬度坐标; // bd09:百度墨卡托坐标; // 海外地区定位,无需设置坐标类型,统一返回wgs84类型坐标 option.setOpenGps(true); // 可选,设置是否使用gps,默认false // 使用高精度和仅用设备两种定位模式的,参数必须设置为true option.setLocationNotify(true); // 可选,设置是否当GPS有效时按照1S/1次频率输出GPS结果,默认false option.setIgnoreKillProcess(true); // 可选,定位SDK内部是一个service,并放到了独立进程。 // 设置是否在stop的时候杀死这个进程,默认(建议)不杀死,即setIgnoreKillProcess(true) option.SetIgnoreCacheException(false); // 可选,设置是否收集Crash信息,默认收集,即参数为false option.setEnableSimulateGps(false); // 可选,设置是否需要过滤GPS仿真结果,默认需要,即参数为false option.setIsNeedLocationDescribe(true); // 可选,是否需要位置描述信息,默认为不需要,即参数为false option.setIsNeedLocationPoiList(true); // 可选,是否需要周边POI信息,默认为不需要,即参数为false option.setIsNeedAddress(true);// 获取详细信息 //设置扫描间隔 // option.setScanSpan(10000); mLocationClient.setLocOption(option); // 注册监听函数 mLocationClient.registerLocationListener(myListener); mLocationClient.start(); }
Example 20
Source File: FakeWeiBoActivity.java From AndroidAnimationExercise with Apache License 2.0 | 4 votes |
private void initLocationAndSearch() { //location mLocationClient = new LocationClient(getApplicationContext()); //声明LocationClient类 mLocationClient.registerLocationListener(this); //注册监听函数 LocationClientOption option = new LocationClientOption(); option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy );//可选,默认高精度,设置定位模式,高精度,低功耗,仅设备 option.setCoorType("bd09ll");//可选,默认gcj02,设置返回的定位结果坐标系 int span = 1000; option.setScanSpan(span);//可选,默认0,即仅定位一次,设置发起定位请求的间隔需要大于等于1000ms才是有效的 option.setIsNeedAddress(true);//可选,设置是否需要地址信息,默认不需要 option.setOpenGps(true);//可选,默认false,设置是否使用gps option.setLocationNotify(true);//可选,默认false,设置是否当GPS有效时按照1S/1次频率输出GPS结果 option.setIsNeedLocationDescribe(true);//可选,默认false,设置是否需要位置语义化结果,可以在BDLocation.getLocationDescribe里得到,结果类似于“在北京天安门附近” option.setIsNeedLocationPoiList(true);//可选,默认false,设置是否需要POI结果,可以在BDLocation.getPoiList里得到 option.setIgnoreKillProcess(false);//可选,默认true,定位SDK内部是一个SERVICE,并放到了独立进程,设置是否在stop的时候杀死这个进程,默认不杀死 option.SetIgnoreCacheException(false);//可选,默认false,设置是否收集CRASH信息,默认收集 option.setEnableSimulateGps(false);//可选,默认false,设置是否需要过滤GPS仿真结果,默认需要 mLocationClient.setLocOption(option); //search mPoiSearch = PoiSearch.newInstance(); mPoiSearch.setOnGetPoiSearchResultListener(new MyPoiSearchListener()); mNearbySearchOption = new PoiNearbySearchOption() .radius(5000) .pageNum(1) .pageCapacity(20) .sortType(PoiSortType.distance_from_near_to_far); //////////////// mGeoCoder = GeoCoder.newInstance(); mGeoCoder.setOnGetGeoCodeResultListener(new OnGetGeoCoderResultListener() { @Override public void onGetGeoCodeResult(GeoCodeResult geoCodeResult) { Log.e(TAG, "onGetGeoCodeResult: " + geoCodeResult.toString()); } @Override public void onGetReverseGeoCodeResult(ReverseGeoCodeResult reverseGeoCodeResult) { Log.e(TAG, "onGetReverseGeoCodeResult: " + reverseGeoCodeResult.toString()); } }); }