高德地图设置为定位一次

@Override
public void activate(OnLocationChangedListener onLocationChangedListener) {
    listener = onLocationChangedListener;
    if (locationClient == null) {
        locationClient = new AMapLocationClient(this);
        locationClient.setLocationListener(this);
        locationOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Hight_Accuracy);
//下面这句就是设置只定位一次的代码,默认是1秒钟定位一次,此方法在AMAPLocationActivity这个类里面

        locationOption.setOnceLocation(true);
        locationClient.setLocationOption(locationOption);
        locationClient.startLocation();
    }
}

你可能感兴趣的:(Android)