Java Code Examples for com.amap.api.location.AMapLocation#getLongitude()

The following examples show how to use com.amap.api.location.AMapLocation#getLongitude() . 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: GaodeMapLocationManager.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public void onLocationChanged(AMapLocation amapLocation) {
    if (this.mListener != null && amapLocation != null) {
        if (amapLocation == null || amapLocation.getErrorCode() != 0) {
            Log.e("AmapErr", "定位失败," + amapLocation.getErrorCode() + ": " + amapLocation.getErrorInfo());
            return;
        }
        LatLng latLng = new LatLng(amapLocation.getLatitude(), amapLocation.getLongitude());
        this.mAccuracy = amapLocation.getAccuracy();
        if (this.locationMarker == null) {
            this.locationMarker = this.aMap.addMarker(new MarkerOptions().position(latLng).icon(BitmapDescriptorFactory.fromResource(R.drawable.location_map)).anchor(0.5f, 0.5f));
            this.aMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 15.5f));
        } else if (this.useMoveToLocationWithMapMode) {
            startMoveLocationAndMap(latLng);
        } else {
            startChangeLocation(latLng);
        }
    }
}
 
Example 2
Source File: MainActivity.java    From RecordPath3D with Apache License 2.0 6 votes vote down vote up
@Override
public void onLocationChanged(AMapLocation amapLocation) {
	if (mListener != null && amapLocation != null) {
		if (amapLocation != null && amapLocation.getErrorCode() == 0) {
			mListener.onLocationChanged(amapLocation);// 显示系统小蓝点
			LatLng mylocation = new LatLng(amapLocation.getLatitude(),
					amapLocation.getLongitude());
			mAMap.moveCamera(CameraUpdateFactory.changeLatLng(mylocation));
			if (btn.isChecked()) {
				record.addpoint(amapLocation);
				mPolyoptions.add(mylocation);
				redrawline();
			}
		} else {
			String errText = "定位失败," + amapLocation.getErrorCode() + ": "
					+ amapLocation.getErrorInfo();
			Log.e("AmapErr", errText);
		}
	}
}
 
Example 3
Source File: LocationTask.java    From Android_UsingCar_Example with Apache License 2.0 6 votes vote down vote up
@Override
public void onLocationChanged(AMapLocation amapLocation) {
	if (amapLocation != null && amapLocation.getAMapException() != null
			&& amapLocation.getAMapException().getErrorCode() == 0) {
		PositionEntity entity = new PositionEntity();
		entity.latitue = amapLocation.getLatitude();
		entity.longitude = amapLocation.getLongitude();

		if (!TextUtils.isEmpty(amapLocation.getAddress())) {
			entity.address = amapLocation.getAddress();
		}
		mOnLocationGetlisGetListener.onLocationGet(entity);

	}

}
 
Example 4
Source File: MainActivity.java    From RecordPath3D with Apache License 2.0 6 votes vote down vote up
private float getDistance(List<AMapLocation> list) {
	float distance = 0;
	if (list == null || list.size() == 0) {
		return distance;
	}
	for (int i = 0; i < list.size() - 1; i++) {
		AMapLocation firstpoint = list.get(i);
		AMapLocation secondpoint = list.get(i + 1);
		LatLng firstLatLng = new LatLng(firstpoint.getLatitude(),
				firstpoint.getLongitude());
		LatLng secondLatLng = new LatLng(secondpoint.getLatitude(),
				secondpoint.getLongitude());
		double betweenDis = AMapUtils.calculateLineDistance(firstLatLng,
				secondLatLng);
		distance = (float) (distance + betweenDis);
	}
	return distance;
}
 
Example 5
Source File: LocationActivity.java    From xmpp with Apache License 2.0 6 votes vote down vote up
/**
 * 定位成功后回调函数
 */
@Override
public void onLocationChanged(AMapLocation aLocation) {
    if (mListener != null && aLocation != null && aLocation.getAMapException().getErrorCode() == 0) {
        mListener.onLocationChanged(aLocation);// 显示系统小蓝点
        marker.setPosition(new LatLng(aLocation.getLatitude(), aLocation
                .getLongitude()));// 定位雷达小图标
        float bearing = aMap.getCameraPosition().bearing;
        aMap.setMyLocationRotateAngle(bearing);// 设置小蓝点旋转角度
        aMap.getMinZoomLevel();
        double a = aLocation.getLatitude();// 维度
        double b = aLocation.getLongitude();// 精度

        lp = new LatLonPoint(a, b);

        doSearchQuery();
    }
}
 
Example 6
Source File: MapsModule.java    From Maps with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void onGaodeLocationChanged(AMapLocation aMapLocation) {

    if ((mLocation == null || (mLocation.getLatitude() != aMapLocation.getLatitude() || mLocation.getLongitude() != aMapLocation.getLongitude()))) {
        Log.d("MapsAction", "onLocationChanged");

        if (mIsEnableMyLocation) {

            LatLng latLng = new LatLng(aMapLocation.getLatitude(), aMapLocation.getLongitude());
            mGaodeMap.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng, 15));

            if (marker == null) {
                MarkerOptions mMyLocationMarker = new MarkerOptions().anchor(0.5f, 0.5f).position(latLng).icon(mMyLocationIcon);
                marker = mGaodeMap.addMarker(mMyLocationMarker);
            } else {
                marker.setPosition(latLng);
            }

        }
        mLocation = aMapLocation;
    }

}
 
Example 7
Source File: MainActivity.java    From OpenWeatherPlus-Android with Apache License 2.0 6 votes vote down vote up
@Override
public void onLocationChanged(AMapLocation aMapLocation) {
    if (aMapLocation.getErrorCode() == 0) {
        ContentUtil.NOW_LON = aMapLocation.getLongitude();
        ContentUtil.NOW_LAT = aMapLocation.getLatitude();
        getNowCity(true);
        mLocationClient.onDestroy();
    } else {
        if (ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.ACCESS_FINE_LOCATION)
                != PackageManager.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE)
                != PackageManager.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.READ_PHONE_STATE)
                != PackageManager.PERMISSION_GRANTED) {
            // 没有权限
            View view = LayoutInflater.from(MainActivity.this).inflate(R.layout.pop_loc_list, null);
            LocListWindow locListWindow = new LocListWindow(view, MATCH_PARENT, MATCH_PARENT, MainActivity.this);
            locListWindow.show();
            locListWindow.showAtLocation(tvLocation, Gravity.CENTER, 0, 0);
            if (ContentUtil.FIRST_OPEN) {
                ContentUtil.FIRST_OPEN = false;
                SpUtils.putBoolean(MainActivity.this, "first_open", false);
            }
        }
        getNowCity(true);
        mLocationClient.onDestroy();
    }
}
 
Example 8
Source File: AMAPLocationActivity.java    From sealtalk-android with MIT License 6 votes vote down vote up
@Override
public void onLocationChanged(AMapLocation aMapLocation) {
    if (aMapLocation != null && aMapLocation.getAMapException().getErrorCode() == 0) {
        if (listener != null) {
            listener.onLocationChanged(aMapLocation);// 显示系统小蓝点
        }
        myLocation = new LatLng(aMapLocation.getLatitude(), aMapLocation.getLongitude());//获取当前位置经纬度
        tvCurLocation.setText(aMapLocation.getRoad() + aMapLocation.getStreet() + aMapLocation.getPoiName());//当前位置信息

        double latitude = aMapLocation.getLatitude();
        double longitude = aMapLocation.getLongitude();
        mMsg = LocationMessage.obtain(latitude, longitude, aMapLocation.getRoad() + aMapLocation.getStreet() + aMapLocation.getPoiName(), getMapUrl(latitude, longitude));
        NLog.e("LocationInit", aMapLocation.getRoad() + aMapLocation.getStreet() + aMapLocation.getPoiName() + latitude + "----" + longitude);


        addChooseMarker();
    }
}
 
Example 9
Source File: AMapLocationService.java    From GeometricWeather with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void onLocationChanged(AMapLocation aMapLocation) {
    cancel();
    if (callback != null) {
        switch (aMapLocation.getErrorCode()) {
            case 0:
                Result result = new Result(
                        (float) aMapLocation.getLatitude(),
                        (float) aMapLocation.getLongitude()
                );
                result.setGeocodeInformation(
                        aMapLocation.getCountry(),
                        aMapLocation.getProvince(),
                        aMapLocation.getCity(),
                        aMapLocation.getDistrict()
                );
                result.inChina = CoordinateConverter.isAMapDataAvailable(
                        aMapLocation.getLatitude(),
                        aMapLocation.getLongitude()
                );
                callback.onCompleted(result);
                break;

            default:
                BuglyHelper.report(
                        new LocationException(
                                aMapLocation.getErrorCode(),
                                aMapLocation.getErrorInfo()
                        )
                );
                callback.onCompleted(null);
                break;
        }
    }
}
 
Example 10
Source File: LocationModel.java    From Fishing with GNU General Public License v3.0 5 votes vote down vote up
private Location createLocation(AMapLocation aMapLocation){
    Location location = new Location();
    location.address = aMapLocation.getAddress();
    location.altitude = aMapLocation.getAltitude();
    location.latitude = aMapLocation.getLatitude();
    location.longitude = aMapLocation.getLongitude();
    location.city = aMapLocation.getCity();
    location.country = aMapLocation.getCountry();
    location.district = aMapLocation.getDistrict();
    location.province = aMapLocation.getProvince();
    location.regionCode = Integer.parseInt(aMapLocation.getAdCode());
    return location;
}
 
Example 11
Source File: Util.java    From RecordPath3D with Apache License 2.0 5 votes vote down vote up
/**
 * 将AMapLocation List 转为LatLng list
 * @param list
 * @return
 */
public static List<LatLng> parseLatLngList(List<AMapLocation> list) {
	List<LatLng> traceList = new ArrayList<LatLng>();
	if (list == null) {
		return traceList;
	}
	for (int i = 0; i < list.size(); i++) {
		AMapLocation loc = list.get(i);
		double lat = loc.getLatitude();
		double lng = loc.getLongitude();
		LatLng latlng = new LatLng(lat, lng);
		traceList.add(latlng);
	}
	return traceList;
}
 
Example 12
Source File: RecordShowActivity.java    From RecordPath3D with Apache License 2.0 5 votes vote down vote up
/**
 * 轨迹数据初始化
 * 
 */
private void setupRecord() {
	// 轨迹纠偏初始化
	LBSTraceClient mTraceClient = new LBSTraceClient(
			getApplicationContext());
	DbAdapter dbhelper = new DbAdapter(this.getApplicationContext());
	dbhelper.open();
	PathRecord mRecord = dbhelper.queryRecordById(mRecordItemId);
	dbhelper.close();
	if (mRecord != null) {
		List<AMapLocation> recordList = mRecord.getPathline();
		AMapLocation startLoc = mRecord.getStartpoint();
		AMapLocation endLoc = mRecord.getEndpoint();
		if (recordList == null || startLoc == null || endLoc == null) {
			return;
		}
		LatLng startLatLng = new LatLng(startLoc.getLatitude(),
				startLoc.getLongitude());
		LatLng endLatLng = new LatLng(endLoc.getLatitude(),
				endLoc.getLongitude());
		mOriginLatLngList = Util.parseLatLngList(recordList);
		addOriginTrace(startLatLng, endLatLng, mOriginLatLngList);

		List<TraceLocation> mGraspTraceLocationList = Util
				.parseTraceLocationList(recordList);
		// 调用轨迹纠偏,将mGraspTraceLocationList进行轨迹纠偏处理
		mTraceClient.queryProcessedTrace(1, mGraspTraceLocationList,
				LBSTraceClient.TYPE_AMAP, this);
	} else {
		Log.i("MY", "mRecord == null");
	}

}
 
Example 13
Source File: LocationMapActivity.java    From sealtalk-android with MIT License 5 votes vote down vote up
@Override
public void onLocationChanged(AMapLocation amapLocation) {
    if (amapLocation != null && amapLocation.getAMapException().getErrorCode() == 0) {
        //获取位置信息
        Double geoLat = amapLocation.getLatitude();
        Double geoLng = amapLocation.getLongitude();

        RongIMClient.getInstance().updateRealTimeLocationStatus(conversationType, targetId, geoLat, geoLng);
    }
}
 
Example 14
Source File: TrackPresenterImpl.java    From RunMap with Apache License 2.0 5 votes vote down vote up
@Override
public void onNewLocation(AMapLocation location) {
    if(mLocationTypeFiler != null && mapObject.removeLocationFilter(mLocationTypeFiler)) {
        mLocationTypeFiler = null;
        //locate succeed, dismiss refresh layout
        mMovementTrackActivity.dismissRefresh();
    }
    if(!isTimerStarted){
        isTimerStarted = true;
        mSecondTimer.sendEmptyMessageDelayed(0, TIME_UPDATE_FREQUENCY);
    }
    LatLng cur = new LatLng(location.getLatitude(), location.getLongitude());
    //新坐标点
    TrackPoint trackPoint = new TrackPoint(cur, SystemClock.elapsedRealtime());
    mapObject.requestRegeoAddress(location, trackPoint);

    List<TrackPoint> trackPoints = mMoveModel.getHistoryCoordiates();
    if(trackPoints.size() >= 1) {
        mapObject.drawPolyLine(location.getSpeed(), trackPoint.getLocation(),
                trackPoints.get(trackPoints.size() - 1).getLocation());
    }

    float distance = mMoveModel.onNewLocation(trackPoint);
    String distanceText = mDistanceFormater.format(distance / 1000.0);
    mMovementTrackActivity.updateDistance(distanceText);

    Message msg = new Message();
    msg.what = MoveHintForeService.MSG_DISTANCE_UPDATE;
    msg.obj = distanceText;
    sendMsgToForeService(msg);
}
 
Example 15
Source File: LetvUtils.java    From letv with Apache License 2.0 5 votes vote down vote up
public static GSMInfo getGSMInfo(Context context) {
    try {
        GSMInfo info = new GSMInfo();
        TelephonyManager manager = (TelephonyManager) context.getSystemService("phone");
        if (manager != null) {
            CellLocation cellLocation = manager.getCellLocation();
            int lac = 0;
            int cellid = 0;
            if (cellLocation != null) {
                if (cellLocation instanceof GsmCellLocation) {
                    lac = ((GsmCellLocation) cellLocation).getLac();
                    cellid = ((GsmCellLocation) cellLocation).getCid();
                } else if (cellLocation instanceof CdmaCellLocation) {
                    cellid = ((CdmaCellLocation) cellLocation).getNetworkId();
                    lac = ((CdmaCellLocation) cellLocation).getBaseStationId();
                }
            }
            info.lac = lac;
            info.cid = cellid;
        }
        AMapLocation location = AMapLocationTool.getInstance().location();
        if (location != null) {
            info.latitude = location.getLatitude();
            info.longitude = location.getLongitude();
            return info;
        }
        info.latitude = Double.parseDouble(PreferencesManager.getInstance().getLocationLongitude());
        info.longitude = Double.parseDouble(PreferencesManager.getInstance().getLocationLatitude());
        return info;
    } catch (Exception e) {
        LogInfo.log("ZSM++ ==== GSM exception e == " + e.getMessage());
        e.printStackTrace();
        return null;
    }
}
 
Example 16
Source File: CustomLocationModeActivity.java    From TraceByAmap with MIT License 5 votes vote down vote up
/**
 * 定位成功后回调函数
 */
@Override
public void onLocationChanged(AMapLocation amapLocation) {
	if (mListener != null && amapLocation != null) {
		if (amapLocation != null
				&& amapLocation.getErrorCode() == 0) {
			LatLng latLng = new LatLng(amapLocation.getLatitude(), amapLocation.getLongitude());
			//展示自定义定位小蓝点
			if(locationMarker == null) {
				//首次定位
				locationMarker = aMap.addMarker(new MarkerOptions().position(latLng)
						.icon(BitmapDescriptorFactory.fromResource(R.drawable.location_marker))
						.anchor(0.5f, 0.5f));

				//首次定位,选择移动到地图中心点并修改级别到15级
				aMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 15));
			} else {

				if(useMoveToLocationWithMapMode) {
					//二次以后定位,使用sdk中没有的模式,让地图和小蓝点一起移动到中心点(类似导航锁车时的效果)
					startMoveLocationAndMap(latLng);
				} else {
					startChangeLocation(latLng);
				}
				
			}


		} else {
			String errText = "定位失败," + amapLocation.getErrorCode()+ ": " + amapLocation.getErrorInfo();
			Log.e("AmapErr",errText);
		}
	}
}
 
Example 17
Source File: MapSimFragment.java    From AndroidSDK with MIT License 5 votes vote down vote up
@Override
public void onLocationChanged(AMapLocation aMapLocation) {
    mProgressDialog.dismiss();
    if (aMapLocation != null && aMapLocation.getErrorCode() == 0) {
        mCorrectedLatLng = new LatLng(aMapLocation.getLatitude(), aMapLocation.getLongitude());
        mRealLatLng = getRealLatLng(mCorrectedLatLng);
        mAmap.animateCamera(CameraUpdateFactory.zoomTo(17));
        mAmap.animateCamera(CameraUpdateFactory.changeLatLng(mCorrectedLatLng));
        mLocationTextView.setText("lon: " + aMapLocation.getLongitude() + "° / lat: " + aMapLocation.getLatitude() + "°");
        mAmap.clear();
        mAmap.addMarker(new MarkerOptions().position(mCorrectedLatLng));
    }
}
 
Example 18
Source File: FindMapAroundAty.java    From myapplication with Apache License 2.0 4 votes vote down vote up
@Override
public void onLocationChanged(AMapLocation amapLocation) {
    if (amapLocation != null) {
        if (amapLocation.getErrorCode() == 0) {
            //定位成功回调信息,设置相关消息
            amapLocation.getLocationType();//获取当前定位结果来源,如网络定位结果,详见官方定位类型表
            mLatitude = amapLocation.getLatitude();//获取纬度
            mLongitude = amapLocation.getLongitude();//获取经度
            amapLocation.getAccuracy();//获取精度信息
            SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            Date date = new Date(amapLocation.getTime());
            df.format(date);//定位时间
            amapLocation.getAddress();//地址,如果option中设置isNeedAddress为false,则没有此结果,网络定位结果中会有地址信息,GPS定位不返回地址信息。
            amapLocation.getCountry();//国家信息
            amapLocation.getProvince();//省信息
            mCity = amapLocation.getCity();//城市信息
            amapLocation.getDistrict();//城区信息
            amapLocation.getStreet();//街道信息
            amapLocation.getStreetNum();//街道门牌号信息
            amapLocation.getCityCode();//城市编码
            amapLocation.getAdCode();//地区编码

            titleCenterTv.setText(amapLocation.getCity());
            lp = new LatLonPoint(mLongitude, mLatitude);
            Log.i(LOG, ">>>>> " + mCity + ", " + mLongitude + ", " + mLatitude);

            // 如果不设置标志位,此时再拖动地图时,它会不断将地图移动到当前的位置
            if (isFirstLoc) {
                //设置缩放级别
                aMap.moveCamera(CameraUpdateFactory.zoomTo(17));
                //将地图移动到定位点
                aMap.moveCamera(CameraUpdateFactory.changeLatLng(new LatLng(amapLocation.getLatitude(), amapLocation.getLongitude())));
                //点击定位按钮 能够将地图的中心移动到定位点
                mListener.onLocationChanged(amapLocation);
                //添加图钉
                mMarker = aMap.addMarker(getMarkerOptions(amapLocation));

                isFirstLoc = false;
            }

        } else {
            //显示错误信息ErrCode是错误码,errInfo是错误信息,详见错误码表。
            Log.e("AmapError", "location Error, ErrCode:"
                    + amapLocation.getErrorCode() + ", errInfo:"
                    + amapLocation.getErrorInfo());

            Toast.makeText(FindMapAroundAty.this, "定位失败", Toast.LENGTH_LONG).show();
        }
    }
}
 
Example 19
Source File: AMapLocationReactModule.java    From react-native-amap-location with MIT License 4 votes vote down vote up
private WritableMap amapLocationToObject(AMapLocation amapLocation) {
    WritableMap map = Arguments.createMap();
    Integer errorCode = amapLocation.getErrorCode();
    if (errorCode > 0) {
        map.putInt("errorCode", errorCode);
        map.putString("errorInfo", amapLocation.getErrorInfo());
    } else {
        Double latitude = amapLocation.getLatitude();
        Double longitude =  amapLocation.getLongitude();
        if (!needMars) {

            try {
                CoordinateConverter converter  = new CoordinateConverter(mReactContext);
                //返回true代表当前位置在大陆、港澳地区,反之不在。
                boolean isAMapDataAvailable = converter.isAMapDataAvailable(latitude,longitude);
                if (isAMapDataAvailable) {
                    // 在中国境内,火星了
                    double[] deltas = delta(latitude, longitude);
                    latitude = latitude - deltas[0];
                    longitude = longitude - deltas[1];
                }
            } catch (Exception ex) {
                return null;
            }
        }

        map.putInt("locationType", amapLocation.getLocationType());
        map.putDouble("latitude", latitude);
        map.putDouble("longitude", longitude);


        if (needDetail) {
            // GPS Only
            map.putDouble("accuracy", amapLocation.getAccuracy());
            map.putInt("satellites", amapLocation.getSatellites());
            map.putDouble("altitude", amapLocation.getAltitude());
            map.putDouble("speed", amapLocation.getSpeed());
            map.putDouble("bearing", amapLocation.getBearing());

            map.putString("address", amapLocation.getAddress());
            map.putString("adCode", amapLocation.getAdCode());
            map.putString("country", amapLocation.getCountry());
            map.putString("province", amapLocation.getProvince());
            map.putString("poiName", amapLocation.getPoiName());
            map.putString("provider", amapLocation.getProvider());
            map.putString("locationDetail", amapLocation.getLocationDetail());
            map.putString("street", amapLocation.getStreet());
            map.putString("streetNum", amapLocation.getStreetNum());
            map.putString("city", amapLocation.getCity());
            map.putString("cityCode", amapLocation.getCityCode());
            map.putString("country", amapLocation.getCountry());
            map.putString("district", amapLocation.getDistrict());
            // map.putString("aoiName", amapLocation.getAOIName());
        }

    }
   return map;
}
 
Example 20
Source File: NewLocationManager.java    From NewFastFrame with Apache License 2.0 4 votes vote down vote up
@Override
    public void onLocationChanged(AMapLocation aMapLocation) {
        if (aMapLocation != null) {
            if (aMapLocation.getErrorCode() == 0) {
                CommonLogger.e("1获取到位置信息拉");
                //                获取纬度
                if (latitude != aMapLocation.getLatitude() || longitude != aMapLocation.getLongitude()) {
                    latitude = aMapLocation.getLatitude();
                    //                获取经度
                    longitude = aMapLocation.getLongitude();
                    address = aMapLocation.getAddress();
                    CommonLogger.e(aMapLocation.toString());
//                                        aMapLocation.getLocationType();//获取当前定位结果来源
//                                        aMapLocation.getLatitude();//获取纬度
//                                        aMapLocation.getLongitude();//获取经度
//                                        aMapLocation.getAccuracy();//获取精度信息
//                                        aMapLocation.getAddress();//地址,如果option中设置isNeedAddress为false,则没有此结果,网络定位结果中会有地址信息,GPS定位不返回地址信息。
//                                        aMapLocation.getCountry();//国家信息
//                                        aMapLocation.getProvince();//省信息
//                                        aMapLocation.getCity();//城市信息
//                                        aMapLocation.getDistrict();//城区信息
//                                        aMapLocation.getStreet();//街道信息
//                                        aMapLocation.getStreetNum();//街道门牌号信息
//                                        aMapLocation.getCityCode();//城市编码
//                                        aMapLocation.getAdCode();//地区编码
//                                        aMapLocation.getAoiName();//获取当前定位点的AOI信息
                    LocationEvent locationEvent = new LocationEvent();
                    locationEvent.setLongitude(longitude);
                    locationEvent.setLatitude(latitude);
                    locationEvent.setLocation(address);
                    locationEvent.setCountry(aMapLocation.getCountry());
                    locationEvent.setProvince(aMapLocation.getProvince());
                    locationEvent.setCity(aMapLocation.getCity());
                    locationEvent.setTitle(aMapLocation.getPoiName());
                    RxBusManager.getInstance().post(locationEvent);
                    BaseApplication.getAppComponent().getSharedPreferences().edit().putString(ConstantUtil.LATITUDE, latitude+"")
                            .putString(ConstantUtil.LONGITUDE,longitude+"")
                            .putString(ConstantUtil.ADDRESS, address)
                    .putString(ConstantUtil.CITY,aMapLocation.getCity()).apply();
                    if (UserManager.getInstance().getCurrentUser() != null) {
                        UserManager.getInstance().updateUserInfo(ConstantUtil.LOCATION,longitude+"&"+latitude,null);
                    }
                } else {
                    CommonLogger.e("定位相同,不定位");
                }
            } else {
                CommonLogger.e("出错消息:" + aMapLocation.getErrorInfo() + "\n" + "错误码:" + aMapLocation.getErrorCode() + "\n" + "错误的细节" +
                        aMapLocation.getLocationDetail());
            }
        }
    }