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

The following examples show how to use com.amap.api.location.AMapLocation#getErrorInfo() . 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: GeoFence_Polygon_Activity.java    From Android_Location_Demo 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) {
			tvResult.setVisibility(View.GONE);
			mListener.onLocationChanged(amapLocation);// 显示系统小蓝点
		} else {
			String errText = "定位失败," + amapLocation.getErrorCode() + ": "
					+ amapLocation.getErrorInfo();
			Log.e("AmapErr", errText);
			tvResult.setVisibility(View.VISIBLE);
			tvResult.setText(errText);
		}
	}
}
 
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: GeoFence_Multiple_Activity.java    From Android_Location_Demo 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) {
			tvResult.setVisibility(View.GONE);
			mListener.onLocationChanged(amapLocation);// 显示系统小蓝点
		} else {
			String errText = "定位失败," + amapLocation.getErrorCode() + ": "
					+ amapLocation.getErrorInfo();
			Log.e("AmapErr", errText);
			tvResult.setVisibility(View.VISIBLE);
			tvResult.setText(errText);
		}
	}
}
 
Example 4
Source File: GeoFence_Polygon_Activity.java    From Android_Location_Demo 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) {
			tvResult.setVisibility(View.GONE);
			mListener.onLocationChanged(amapLocation);// 显示系统小蓝点
		} else {
			String errText = "定位失败," + amapLocation.getErrorCode() + ": "
					+ amapLocation.getErrorInfo();
			Log.e("AmapErr", errText);
			tvResult.setVisibility(View.VISIBLE);
			tvResult.setText(errText);
		}
	}
}
 
Example 5
Source File: GeoFence_Nearby_Activity.java    From Android_Location_Demo 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) {
			tvResult.setVisibility(View.GONE);
			mListener.onLocationChanged(amapLocation);// 显示系统小蓝点
		} else {
			String errText = "定位失败," + amapLocation.getErrorCode() + ": "
					+ amapLocation.getErrorInfo();
			Log.e("AmapErr", errText);
			tvResult.setVisibility(View.VISIBLE);
			tvResult.setText(errText);
		}
	}
}
 
Example 6
Source File: GeoFence_Keyword_Activity.java    From Android_Location_Demo 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) {
			tvResult.setVisibility(View.GONE);
			mListener.onLocationChanged(amapLocation);// 显示系统小蓝点
		} else {
			String errText = "定位失败," + amapLocation.getErrorCode() + ": "
					+ amapLocation.getErrorInfo();
			Log.e("AmapErr", errText);
			tvResult.setVisibility(View.VISIBLE);
			tvResult.setText(errText);
		}
	}
}
 
Example 7
Source File: GeoFence_Round_Activity.java    From Android_Location_Demo 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) {
			tvResult.setVisibility(View.GONE);
			mListener.onLocationChanged(amapLocation);// 显示系统小蓝点
		} else {
			String errText = "定位失败," + amapLocation.getErrorCode() + ": "
					+ amapLocation.getErrorInfo();
			Log.e("AmapErr", errText);
			tvResult.setVisibility(View.VISIBLE);
			tvResult.setText(errText);
		}
	}
}
 
Example 8
Source File: GeoFence_District_Activity.java    From Android_Location_Demo 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) {
			tvResult.setVisibility(View.GONE);
			mListener.onLocationChanged(amapLocation);// 显示系统小蓝点
		} else {
			String errText = "定位失败," + amapLocation.getErrorCode() + ": "
					+ amapLocation.getErrorInfo();
			Log.e("AmapErr", errText);
			tvResult.setVisibility(View.VISIBLE);
			tvResult.setText(errText);
		}
	}
}
 
Example 9
Source File: GeoFence_Multiple_Activity.java    From Android_Location_Demo 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) {
			tvResult.setVisibility(View.GONE);
			mListener.onLocationChanged(amapLocation);// 显示系统小蓝点
		} else {
			String errText = "定位失败," + amapLocation.getErrorCode() + ": "
					+ amapLocation.getErrorInfo();
			Log.e("AmapErr", errText);
			tvResult.setVisibility(View.VISIBLE);
			tvResult.setText(errText);
		}
	}
}
 
Example 10
Source File: GeoFence_Nearby_Activity.java    From Android_Location_Demo 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) {
			tvResult.setVisibility(View.GONE);
			mListener.onLocationChanged(amapLocation);// 显示系统小蓝点
		} else {
			String errText = "定位失败," + amapLocation.getErrorCode() + ": "
					+ amapLocation.getErrorInfo();
			Log.e("AmapErr", errText);
			tvResult.setVisibility(View.VISIBLE);
			tvResult.setText(errText);
		}
	}
}
 
Example 11
Source File: GeoFence_Keyword_Activity.java    From Android_Location_Demo 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) {
			tvResult.setVisibility(View.GONE);
			mListener.onLocationChanged(amapLocation);// 显示系统小蓝点
		} else {
			String errText = "定位失败," + amapLocation.getErrorCode() + ": "
					+ amapLocation.getErrorInfo();
			Log.e("AmapErr", errText);
			tvResult.setVisibility(View.VISIBLE);
			tvResult.setText(errText);
		}
	}
}
 
Example 12
Source File: GeoFence_Round_Activity.java    From Android_Location_Demo 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) {
			tvResult.setVisibility(View.GONE);
			mListener.onLocationChanged(amapLocation);// 显示系统小蓝点
		} else {
			String errText = "定位失败," + amapLocation.getErrorCode() + ": "
					+ amapLocation.getErrorInfo();
			Log.e("AmapErr", errText);
			tvResult.setVisibility(View.VISIBLE);
			tvResult.setText(errText);
		}
	}
}
 
Example 13
Source File: GeoFence_District_Activity.java    From Android_Location_Demo 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) {
			tvResult.setVisibility(View.GONE);
			mListener.onLocationChanged(amapLocation);// 显示系统小蓝点
		} else {
			String errText = "定位失败," + amapLocation.getErrorCode() + ": "
					+ amapLocation.getErrorInfo();
			Log.e("AmapErr", errText);
			tvResult.setVisibility(View.VISIBLE);
			tvResult.setText(errText);
		}
	}
}
 
Example 14
Source File: MapActivity.java    From WechatHook-Dusan with Apache License 2.0 6 votes vote down vote up
@Override
public void onLocationChanged(AMapLocation aMapLocation) {
    if (aMapLocation != null
            && aMapLocation.getErrorCode() == 0) {
        //longitude = aMapLocation.getLongitude();
        //latitude = aMapLocation.getLatitude();
        if (!aMapLocation.getCountry().equals("中国")){
            changeToGoogleMapView();
        } else {
            amap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(latitude,longitude), 15));
        }
        //Toast.makeText(context,aMapLocation.getCountry(),Toast.LENGTH_LONG).show();
        mIsAuto = false;
        mcheckbtn.setChecked(false);
        //setCurrentPositionInfo();
    } else {
        String errText = "定位失败," + aMapLocation.getErrorCode() + ": " + aMapLocation.getErrorInfo();
        LogUtils.debug("AmapErr", errText);
        Toast.makeText(context, errText, Toast.LENGTH_LONG).show();
    }
}
 
Example 15
Source File: LocationModeSourceActivity_Old.java    From TraceByAmap with MIT License 6 votes vote down vote up
/**
 * 定位成功后回调函数
 */
@Override
public void onLocationChanged(AMapLocation amapLocation) {
	if (mListener != null && amapLocation != null) {
		if (amapLocation != null
				&& amapLocation.getErrorCode() == 0) {
			mLocationErrText.setVisibility(View.GONE);
			mListener.onLocationChanged(amapLocation);// 显示系统小蓝点
		} else {
			String errText = "定位失败," + amapLocation.getErrorCode()+ ": " + amapLocation.getErrorInfo();
			Log.e("AmapErr",errText);
			mLocationErrText.setVisibility(View.VISIBLE);
			mLocationErrText.setText(errText);
		}
	}
}
 
Example 16
Source File: LocationService.java    From OpenWeatherPlus-Android with Apache License 2.0 5 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();
        Log.i(TAG, "now location: " +  ContentUtil.NOW_LON + "," + ContentUtil.NOW_LAT);
    }else {
        String errText = "定位失败," + aMapLocation.getErrorCode() + ": " + aMapLocation.getErrorInfo();
        Log.e(TAG, errText);
    }
}
 
Example 17
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);
		}
	}
}