public class AMapLocation
extends android.location.Location
implements java.lang.Cloneable, android.os.Parcelable
| 限定符和类型 | 字段和说明 |
|---|---|
static java.lang.String |
COORD_TYPE_GCJ02
GCJ02坐标系
GCJ02 coordinate system |
static java.lang.String |
COORD_TYPE_WGS84
WGS84坐标系
WGS84 coordinate system |
static android.os.Parcelable.Creator<AMapLocation> |
CREATOR |
static int |
ERROR_CODE_AIRPLANEMODE_WIFIOFF
定位错误码:定位失败,飞行模式下关闭了WIFI开关,请关闭飞行模式或者打开WIFI开关
Location error code: Location failed because the WiFi switch is turned off in airplane mode. |
static int |
ERROR_CODE_FAILURE_AUTH
定位错误码:KEY错误,可以通过
getLocationDetail()获取详细信息来跟注册的KEY信息进行对照
Location error code: KEY error. |
static int |
ERROR_CODE_FAILURE_CELL
定位错误码:错误的基站信息,请检查是否安装SIM卡
Location error code: Incorrect base station information. |
static int |
ERROR_CODE_FAILURE_COARSE_LOCATION
定位错误码:定位失败,模糊权限下定位异常,可以通过
getErrorInfo() 获取详细信息
Location error code: Location failed due to abnormal positioning under fuzzy permissions. |
static int |
ERROR_CODE_FAILURE_CONNECTION
定位错误码:网络连接异常,可以通过
getLocationDetail()获取详细信息
Location error code: Network connection exception. |
static int |
ERROR_CODE_FAILURE_INIT
定位错误码:初始化异常,可以通过
getLocationDetail()获取详细信息
Location error code: Initialization exception. |
static int |
ERROR_CODE_FAILURE_LOCATION
定位错误码:定位结果错误,可以通过
getLocationDetail()获取详细信息
Location error code: Location result error. |
static int |
ERROR_CODE_FAILURE_LOCATION_PARAMETER
定位错误码:获取到的请求参数为空,可能获取过程中出现异常,可以通过
getLocationDetail()获取详细信息
Location error code: The obtained request parameters are empty, possibly due to an exception during the process. |
static int |
ERROR_CODE_FAILURE_LOCATION_PERMISSION
定位错误码:缺少定位权限,请检查是否配置定位权限,并在安全软件和设置中给应用打开定位权限
Location error code: Missing location permission. |
static int |
ERROR_CODE_FAILURE_NOENOUGHSATELLITES
定位错误码:卫星定位失败,可用卫星数不足
Location error code: Satellite positioning failed due to insufficient available satellites. |
static int |
ERROR_CODE_FAILURE_NOWIFIANDAP
定位错误码:网络定位失败,请检查设备是否插入sim卡、开启移动网络或开启了wifi模块
Location error code: Network location failed. |
static int |
ERROR_CODE_FAILURE_PARSER
定位错误码:解析XML出错,可以通过
getLocationDetail()获取详细信息
Location error code: Error parsing XML. |
static int |
ERROR_CODE_FAILURE_SIMULATION_LOCATION
定位错误码:定位位置可能被模拟
Location error code: The location may be simulated. |
static int |
ERROR_CODE_FAILURE_WIFI_INFO
定位错误码:定位失败,由于设备仅扫描到单个wifi,不能精准的计算出位置信息。
|
static int |
ERROR_CODE_INVALID_PARAMETER
定位错误码:一些重要参数为空,如context,可以通过
getLocationDetail()获取详细信息
Location error code: Some important parameters are empty, such as context. |
static int |
ERROR_CODE_NO_COMPENSATION_CACHE
定位错误码:首次加速定位失败
Location error code: First accelerated positioning failed. |
static int |
ERROR_CODE_NOCGI_WIFIOFF
定位错误码:定位失败,没有检查到SIM卡,并且关闭了WIFI开关,请打开WIFI开关或者插入SIM卡
Location error code: Location failed. |
static int |
ERROR_CODE_SERVICE_FAIL
定位错误码:定位服务启动失败,请检查是否配置service并且manifest中service标签是否配置在application标签内
Location error code: Location service failed to start. |
static int |
ERROR_CODE_UNKNOWN
定位错误码:其他错误,可以通过
getLocationDetail()获取详细信息
Location error code: Other errors. |
static int |
GPS_ACCURACY_BAD
卫星信号弱
Weak satellite signal |
static int |
GPS_ACCURACY_GOOD
卫星信号强
Strong satellite signal |
static int |
GPS_ACCURACY_UNKNOWN
卫星状态未知
Satellite status unknown |
static java.lang.String |
LBS_REAL_LOCATION_TYPE
缓存定位类型的真实定位结果,从extras bundle中获取
The real location result of the cached location type, obtained from the extras bundle |
static int |
LOCATION_COMPENSATION |
static int |
LOCATION_SUCCESS
定位错误码:定位成功
Location error code: Location successful |
static int |
LOCATION_TYPE_AMAP
定位结果类型:补偿定位(极少返回)
Location type: Compensatory location (rarely returned) |
static int |
LOCATION_TYPE_CELL
定位结果类型:基站定位结果
属于网络定位
Location type: Base station location Belongs to network location. |
static int |
LOCATION_TYPE_COARSE_LOCATION
模糊定位类型
Fuzzy location type |
static int |
LOCATION_TYPE_FAST
已过时。
已合并到
LOCATION_TYPE_SAME_REQ
Merged into LOCATION_TYPE_SAME_REQ |
static int |
LOCATION_TYPE_FIX_CACHE
定位结果类型:缓存定位结果
返回一段时间前设备在相同的环境中缓存下来的网络定位结果,节省无必要的设备定位消耗
Location type: Cached location
Returns a network location result cached by the device in the same environment some time ago, saving unnecessary device location consumption.
|
static int |
LOCATION_TYPE_GPS
定位结果类型:卫星定位结果
通过设备卫星定位模块返回的定位结果
Location result type: Satellite positioning result
Location result returned by the device's satellite positioning module.
|
static int |
LOCATION_TYPE_LAST_LOCATION_CACHE
定位结果类型: 最后位置缓存
Location type: Last location cache |
static int |
LOCATION_TYPE_NETWORK
系统网络定位类型
System network location type |
static int |
LOCATION_TYPE_OFFLINE
定位结果类型: 离线定位结果
Location type: Offline location result |
static int |
LOCATION_TYPE_SAME_REQ
定位结果类型:前次定位结果
网络定位请求低于1秒、或两次定位之间设备位置变化非常小时返回,设备位移通过传感器感知
Location type: Previous location
Returned when the network location request is less than 1 second, or when the device's position changes very little between two location requests.
|
static int |
LOCATION_TYPE_WIFI
定位结果类型:Wifi定位结果
属于网络定位,定位精度相对基站定位会更好
Location type: Wifi location
Belongs to network location, and the location accuracy is better compared to base station location.
|
static int |
TRUSTED_LEVEL_BAD
定位结果的可信度-非常不可信
周边信息的新鲜度超过10分钟
模拟定位结果
Reliability of positioning result - Very unreliable Freshness of surrounding information exceeds 10 minutes Simulated positioning result |
static int |
TRUSTED_LEVEL_HIGH
定位结果的可信度-非常可信
周边信息的新鲜度在15s之内
实时GPS定位结果
Reliability of positioning result - Highly reliable Freshness of surrounding information within 15 seconds Real-time GPS positioning result |
static int |
TRUSTED_LEVEL_LOW
定位结果的可信度-可信度较低
周边信息的新鲜度在2-10分钟之间
Reliability of positioning result - Low reliability Freshness of surrounding information between 2 and 10 minutes |
static int |
TRUSTED_LEVEL_NORMAL
定位结果的可信度-可信度一般
周边信息的新鲜度在15秒-2分钟之间
缓存、离线定位、最后位置
Reliability of positioning result - Moderately reliable Freshness of surrounding information between 15 seconds and 2 minutes Cached, offline positioning, last known location |
| 构造器和说明 |
|---|
AMapLocation(AmapLocation location) |
AMapLocation(AmapLocationNetwork location) |
AMapLocation(android.location.Location location)
根据android.location.Location对象构造
Construct based on android.location.Location object |
AMapLocation(java.lang.String provider)
根据定位提供者构造
Construct based on location provider |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
clearOptAttrs() |
AMapLocation |
clone() |
java.util.HashMap<java.lang.String,java.lang.Object> |
cloneOptAttrs() |
int |
describeContents() |
float |
getAccuracy()
获取定位精度
单位:米
Get Location Accuracy Unit: meters |
java.lang.String |
getAdCode()
获取区域编码
2.9.0之前的版本定位类型为
LOCATION_TYPE_GPS时不会返回区域编码自2.9.0版本开始,当 LOCATION_TYPE_GPS时也可以返回区域编码
Get area code Before version 2.9.0, area code would not be returned when the location type was LOCATION_TYPE_GPSStarting from version 2.9.0, area code can also be returned when the type is LOCATION_TYPE_GPS
|
java.lang.String |
getAddress()
获取地址
2.9.0之前的版本定位类型为
LOCATION_TYPE_GPS时不会返回地址信息自2.9.0版本开始,当类型为 LOCATION_TYPE_GPS时也可以返回地址信息(需要网络通畅,第一次有可能没有地址信息返回)
Get address Before version 2.9.0, address information would not be returned when the location type was LOCATION_TYPE_GPSStarting from version 2.9.0, address information can also be returned when the type is LOCATION_TYPE_GPS (requires a stable network connection, and the first attempt might not return address information)
|
double |
getAltitude()
获取海拔高度(单位:米)
默认值:0.0
3.1.0之前的版本只有定位类型为 LOCATION_TYPE_GPS时才有值自3.1.0版本开始,不限定定位类型,当定位类型不是 LOCATION_TYPE_GPS时,可以通过
AMapLocationClientOption.setSensorEnable(boolean)
控制是否返回海拔高度,当设置为true时会通过手机传感器获取海拔高度,如果手机没有对应的传感器会返回0.0
Get altitude (unit: meters) Default value: 0.0 Before version 3.1.0, this value was only available when the location type was LOCATION_TYPE_GPSStarting from version 3.1.0, the location type is not restricted. |
java.lang.String |
getAoiName()
获取兴趣面名称
2.9.0之前的版本定位类型为
LOCATION_TYPE_GPS时不会返回兴趣面名称自2.9.0版本开始,当 LOCATION_TYPE_GPS时也可以返回兴趣面名称
Get AOI Name Versions before 2.9.0 did not return AOI names when the location type was LOCATION_TYPE_GPSSince 2.9.0, AOI names can also be returned when LOCATION_TYPE_GPS
|
float |
getBearing()
获取方向角(单位:度)
默认值:0.0
取值范围:【0,360】,其中0度表示正北方向,90度表示正东,180度表示正南,270度表示正西 3.1.0之前的版本只有定位类型为 LOCATION_TYPE_GPS时才有值自3.1.0版本开始,不限定定位类型,当定位类型不是 LOCATION_TYPE_GPS时,可以通过
AMapLocationClientOption.setSensorEnable(boolean)
控制是否返回方向角,当设置为true时会通过手机传感器获取方向角,如果手机没有对应的传感器会返回0.0
注意:定位类型为 LOCATION_TYPE_GPS时,方向角指的是运动方向定位类型不是 LOCATION_TYPE_GPS时,方向角指的是手机朝向Get bearing (unit: degrees) Default value: 0.0 Range: [0, 360], where 0 degrees represents true north, 90 degrees represents true east, 180 degrees represents true south, and 270 degrees represents true west Before version 3.1.0, this value was only available when the location type was LOCATION_TYPE_GPSStarting from version 3.1.0, the location type is not restricted. |
float |
getBearingAccuracyDegrees() |
java.lang.String |
getBuildingId()
返回支持室内定位的建筑物ID信息
Return the building ID information that supports indoor positioning |
java.lang.String |
getCity()
获取城市名称
2.9.0之前的版本定位类型为
LOCATION_TYPE_GPS时不会返回城市名称自2.9.0版本开始,当 LOCATION_TYPE_GPS时也可以返回省城市名称
Get city name Before version 2.9.0, city name would not be returned when the location type was LOCATION_TYPE_GPSStarting from version 2.9.0, city name can also be returned when the type is LOCATION_TYPE_GPS
|
java.lang.String |
getCityCode()
获取城市编码
2.9.0之前的版本定位类型为
LOCATION_TYPE_GPS时不会返回城市编码自2.9.0版本开始,当 LOCATION_TYPE_GPS时也可以返回城市编码
Get city code Before version 2.9.0, city code would not be returned when the location type was LOCATION_TYPE_GPSStarting from version 2.9.0, city code can also be returned when the type is LOCATION_TYPE_GPS
|
int |
getConScenario()
室内外置信度
室内:且置信度取值在[1 ~ 100],值越大在室内的可能性越大
室外:且置信度取值在[-100 ~ -1] ,值越小在室外的可能性越大
无法识别室内外:置信度返回值为 0
|
int |
getCoord()
获取坐标系
|
java.lang.String |
getCoordType()
获取坐标系类型
高德定位sdk会返回两种坐标系
COORD_TYPE_GCJ02 -- GCJ02坐标系
COORD_TYPE_WGS84 -- WGS84坐标系,国外定位时返回的是WGS84坐标系
Get coordinate system type The AMap location SDK returns two types of coordinate systems COORD_TYPE_GCJ02 -- GCJ02 coordinate system
COORD_TYPE_WGS84 -- WGS84 coordinate system, the WGS84 coordinate system is returned when locating abroad
|
java.lang.String |
getCountry()
获取国家名称
Get country name |
java.lang.String |
getDescription()
获取位置语义信息
Get Location Semantic Information |
int |
getDiagnosisType()
返回伪造识别类型
|
java.lang.String |
getDistrict()
获取区的名称
2.9.0之前的版本定位类型为
LOCATION_TYPE_GPS时不会返回区的名称自2.9.0版本开始,当 LOCATION_TYPE_GPS时也可以返回区的名称
Get district name Before version 2.9.0, district name would not be returned when the location type was LOCATION_TYPE_GPSStarting from version 2.9.0, district name can also be returned when the type is LOCATION_TYPE_GPS
|
int |
getErrorCode()
获取错误码
Get error code |
java.lang.String |
getErrorInfo()
获取错误信息
Get error message |
android.os.Bundle |
getExtras() |
java.lang.String |
getFloor()
获取室内定位的楼层信息
Get Floor Information for Indoor Positioning |
java.lang.String |
getFloorName() |
java.lang.String |
getGeoLanguage() |
int |
getGpsAccuracyStatus()
获取卫星信号强度,仅在卫星定位时有效,值为
#GPS_ACCURACY_BAD,#GPS_ACCURACY_GOOD,#GPS_ACCURACY_UNKNOWN |
int |
getIod()
返回室内外状态
0:半室内,1:室内,2:室外
|
int |
getIodConfidence()
返回室内外状态置信度
|
double |
getLatitude()
获取纬度
Get Latitude |
java.lang.String |
getLocationDetail()
获取定位信息描述
Get location information description |
AMapLocationQualityReport |
getLocationQualityReport()
获取定位质量
Get location quality |
long |
getLocationTickTime()
返回定位的系统滴答数时间
单位是纳秒
开机以后的累计时间,重启后归0
|
int |
getLocationType()
获取定位结果来源
Get location result source |
long |
getLocationUtcTime()
返回定位的UTC时间
单位是毫秒
1970年到现在过去的毫秒数
|
double |
getLongitude()
获取经度
Get Longitude |
java.lang.Object |
getOptAttr(java.lang.String var1) |
boolean |
getOptAttrBoolean(java.lang.String var1,
boolean var2) |
double |
getOptAttrDouble(java.lang.String var1,
double var2) |
float |
getOptAttrFloat(java.lang.String var1,
float var2) |
int |
getOptAttrInt(java.lang.String var1,
int var2) |
long |
getOptAttrLong(java.lang.String var1,
long var2) |
java.lang.String |
getOptAttrString(java.lang.String var1,
java.lang.String var2) |
java.lang.String |
getOptContent()
获取可选的字符串内容
一般存储位置的排查信息
|
java.lang.String |
getPoiName()
获取兴趣点名称
2.9.0之前的版本定位类型为
LOCATION_TYPE_GPS时不会返回兴趣点名称自2.9.0版本开始,当 LOCATION_TYPE_GPS时也可以返回兴趣点名称
Get POI name Before version 2.9.0, POI name would not be returned when the location type was LOCATION_TYPE_GPSStarting from version 2.9.0, POI name can also be returned when the type is LOCATION_TYPE_GPS
|
int |
getPriority()
获取位置优先级 内部使用
|
java.lang.String |
getProvider()
获取定位提供者
Get location provider |
java.lang.String |
getProvince()
获取省的名称
2.9.0之前的版本定位类型为
LOCATION_TYPE_GPS时不会返回省份名称自2.9.0版本开始,当 LOCATION_TYPE_GPS时也可以返回省份名称
Get province name Before version 2.9.0, province name would not be returned when the location type was LOCATION_TYPE_GPSStarting from version 2.9.0, province name can also be returned when the type is LOCATION_TYPE_GPS
|
java.lang.String |
getRoad()
已过时。
使用
getStreet()方法代替
Use getStreet() method instead |
int |
getSatellites()
获取当前可用卫星数量, 仅在卫星定位时有效,
Get the current number of available satellites, only valid during satellite positioning, |
java.lang.String |
getSemantics()
返回语义定位
是一个json串,协议复杂
|
java.lang.String |
getSource()
返回定位来源
例如高德自身产生定位,第三方提供的定位
|
float |
getSpeed()
获取当前速度(单位:米/秒)
默认值:0.0
3.1.0之前的版本只有定位类型为 LOCATION_TYPE_GPS时才有值自3.1.0版本开始,不限定定位类型,当定位类型不是 LOCATION_TYPE_GPS时,可以通过
AMapLocationClientOption.setSensorEnable(boolean)
控制是否返回速度值,当设置为true时会通过手机传感器获取速度,如果手机没有对应的传感器会返回0.0
Get current speed (unit: meters/second) Default value: 0.0 Before version 3.1.0, this value was only available when the location type was LOCATION_TYPE_GPSStarting from version 3.1.0, the location type is not restricted. |
float |
getSpeedAccuracyMetersPerSecond() |
java.lang.String |
getStreet()
获取街道名称
2.9.0之前的版本定位类型为
LOCATION_TYPE_GPS时不会返回街道名称自2.9.0版本开始,当 LOCATION_TYPE_GPS时也可以返回街道名称
Get Street Name Versions before 2.9.0 did not return street names when the location type was LOCATION_TYPE_GPSSince 2.9.0, street names can also be returned when LOCATION_TYPE_GPS
|
java.lang.String |
getStreetNum()
获取门牌号
2.9.0之前的版本定位类型为
LOCATION_TYPE_GPS时不会返回门牌号自2.9.0版本开始,当 LOCATION_TYPE_GPS时也可以返回门牌号
Get House Number Versions before 2.9.0 did not return house numbers when the location type was LOCATION_TYPE_GPSSince 2.9.0, house numbers can also be returned when LOCATION_TYPE_GPS
|
int |
getSubType()
返回定位子类型
|
int |
getTrustedLevel()
获取定位结果的可信度
只有在定位成功时才有意义
非常可信
TRUSTED_LEVEL_HIGH
可信度一般TRUSTED_LEVEL_NORMAL
可信度较低 TRUSTED_LEVEL_LOW
非常不可信 TRUSTED_LEVEL_BAD
Get reliability of positioning result Only meaningful when positioning is successful Highly reliable TRUSTED_LEVEL_HIGH
Moderately reliable TRUSTED_LEVEL_NORMAL
Low reliability TRUSTED_LEVEL_LOW
Very unreliable TRUSTED_LEVEL_BAD
|
int |
getType()
返回定位类型
|
float |
getVerticalAccuracyMeters() |
boolean |
has(java.lang.String var1) |
boolean |
isCoorCanUseInMap()
返回坐标是否可以直接在地图上显示
默认坐标是WGS84,是世界通用的经纬度坐标,但在国内无法显示在地图上
如果国内偏转过或者在国外,即可直接显示
|
boolean |
isDim()
是否为模糊定位
|
boolean |
isFixLastLocation()
是否命中最后位置缓存
Whether the last location cache is hit |
boolean |
isMock()
是否为模拟定位
Whether It Is a Simulated Location |
boolean |
isOffset()
获取是否偏转
Get Whether to Deflect |
boolean |
isReversegeo() |
boolean |
isSpeedKmh()
返回速度单位是否为千米/时
|
void |
putOptAttr(java.lang.String var1,
java.lang.Object var2) |
void |
removeOptAttr(java.lang.String var1) |
void |
setAdCode(java.lang.String adCode)
设置区域编码
Set area code |
void |
setAddress(java.lang.String address)
设置地址信息
Set address information |
void |
setAltitude(double altitude)
设置海拔高度
Set altitude |
void |
setAMapErrorCode(java.lang.String errorType,
int errorCode) |
void |
setAoiName(java.lang.String aoiName)
设置aoiName
Set AOI Name |
void |
setBearing(float bearing)
设置方向角
Set Bearing |
void |
setBearingAccuracyDegrees(float var1) |
void |
setBuildingId(java.lang.String mPoiid)
建筑物的POIID,只有室内定位的时候才会返回
The POIID of the building is only returned during indoor positioning |
void |
setCity(java.lang.String city)
设置城市名称
Set city name |
void |
setCityCode(java.lang.String cityCode)
设置城市编码
Set city code |
void |
setConScenario(int conScenario)
室内外置信度
室内:且置信度取值在[1 ~ 100],值越大在室内的可能性越大
室外:且置信度取值在[-100 ~ -1] ,值越小在室外的可能性越大
无法识别室内外:置信度返回值为 0
Indoor/outdoor confidence Indoor: Confidence value ranges from [1 to 100], the higher the value, the more likely it is to be indoor Outdoor: Confidence value ranges from [-100 to -1], the lower the value, the more likely it is to be outdoor Unable to determine indoor/outdoor: Confidence value is 0 |
void |
setCoorCanUseInMap(boolean coorCanUseInMap) |
void |
setCoord(int coord) |
void |
setCoord(java.lang.String strCoord)
设置坐标系
|
void |
setCoordType(java.lang.String coordType)
设置坐标系类型
Set coordinate system type |
void |
setCountry(java.lang.String country)
获取国家名称
Get country name |
void |
setDescription(java.lang.String description)
设置位置语义信息
Set Location Semantic Information |
void |
setDiagnosisType(int diagnosisType) |
void |
setDim(boolean dim) |
void |
setDistrict(java.lang.String district)
设置区的名称
Set district name |
void |
setErrorCode(int errorCode)
设置错误码
Set error code |
void |
setErrorInfo(java.lang.String errorInfo)
设置错误信息
Set error message |
void |
setExtras(android.os.Bundle extras)
设置扩展参数
Set extended parameters |
void |
setFixLastLocation(boolean isFixLastLocation)
设置是否命中最后位置缓存
Set Whether to Hit the Last Location Cache |
void |
setFloor(java.lang.String floor)
设置楼层信息,只有室内定位的时候才会返回
Set Floor Information, Only Returned During Indoor Positioning |
void |
setFloorName(java.lang.String floorName) |
void |
setGeoLanguage(java.lang.String geoLanguage) |
void |
setGpsAccuracyStatus(int signalIntensity)
设置卫星信号强度,仅在卫星定位时有效
|
void |
setIod(int iod) |
void |
setIodConfidence(int iodConfidence) |
void |
setLatitude(double latitude)
设置纬度
Set Latitude |
void |
setLocationDetail(java.lang.String detailErrorInfo)
设置定位信息描述
Set location information description |
void |
setLocationQualityReport(AMapLocationQualityReport qualityReport)
设置定位质量
Set location quality |
void |
setLocationTickTime(long locationTickTime) |
void |
setLocationType(AmapLocation location) |
void |
setLocationType(int locationType)
设置定位结果来源
Set location result source |
void |
setLocationUtcTime(long locationUtcTime) |
void |
setLongitude(double longitude)
设置经度
Set Longitude |
void |
setMock(boolean mock)
设置是否为模拟定位
Set Whether It Is a Simulated Location |
void |
setNumber(java.lang.String number)
设置门牌号
Set House Number |
void |
setOffset(boolean offset)
设置是否偏转
Set Whether to Deflect |
void |
setOptAttrs(java.util.HashMap<java.lang.String,java.lang.Object> attrs) |
void |
setOptContent(java.lang.String optContent) |
void |
setPoiName(java.lang.String poiName)
设置兴趣点名称
Set POI name |
void |
setPriority(int priority) |
void |
setProvider(java.lang.String provider)
设置位置提供者
Set location provider |
void |
setProvince(java.lang.String province)
设置省的名称
Set province name |
void |
setReversegeo(boolean isReversegeo) |
void |
setRoad(java.lang.String road)
已过时。
|
void |
setSatellites(int satellites)
设置卫星数量
Set Number of Satellites |
void |
setSemantics(java.lang.String semantics) |
void |
setSource(java.lang.String source) |
void |
setSpeed(float speed)
设置当前速度
Set current speed |
void |
setSpeedAccuracyMetersPerSecond(float var1) |
void |
setSpeedKmh(boolean speedKmh) |
void |
setStreet(java.lang.String street)
设置街道名称
Set Street Name |
void |
setSubType(int subType) |
void |
setTrustedLevel(int trustedLevel)
设置定位结果可信度
Set reliability of positioning result |
void |
setType(int type) |
void |
setVerticalAccuracyMeters(float var1) |
org.json.JSONObject |
toJson(int iT)
将记录转化为字符串
Convert record to string |
java.lang.String |
toStr()
将定位结果转换成字符串
Convert Location Result to String |
java.lang.String |
toStr(int iT)
将定位结果转化为字符串
Convert Location Result to String |
java.lang.String |
toString() |
void |
writeToParcel(android.os.Parcel parcel,
int flags) |
bearingTo, convert, convert, distanceBetween, distanceTo, dump, equals, getElapsedRealtimeNanos, getElapsedRealtimeUncertaintyNanos, getTime, hasAccuracy, hasAltitude, hasBearing, hasBearingAccuracy, hasElapsedRealtimeUncertaintyNanos, hashCode, hasSpeed, hasSpeedAccuracy, hasVerticalAccuracy, isFromMockProvider, removeAccuracy, removeAltitude, removeBearing, removeSpeed, reset, set, setAccuracy, setElapsedRealtimeNanos, setElapsedRealtimeUncertaintyNanos, setTimepublic static final int LOCATION_SUCCESS
public static final int ERROR_CODE_INVALID_PARAMETER
getLocationDetail()获取详细信息
getLocationDetail()public static final int ERROR_CODE_FAILURE_WIFI_INFO
public static final int ERROR_CODE_FAILURE_LOCATION_PARAMETER
getLocationDetail()获取详细信息
getLocationDetail()public static final int ERROR_CODE_FAILURE_CONNECTION
getLocationDetail()获取详细信息
getLocationDetail()public static final int ERROR_CODE_FAILURE_PARSER
getLocationDetail()获取详细信息
getLocationDetail()public static final int ERROR_CODE_FAILURE_LOCATION
getLocationDetail()获取详细信息
getLocationDetail()public static final int ERROR_CODE_FAILURE_AUTH
getLocationDetail()获取详细信息来跟注册的KEY信息进行对照
getLocationDetail() to compare with the registered KEY information.public static final int ERROR_CODE_UNKNOWN
getLocationDetail()获取详细信息
getLocationDetail()public static final int ERROR_CODE_FAILURE_INIT
getLocationDetail()获取详细信息
getLocationDetail()public static final int ERROR_CODE_SERVICE_FAIL
public static final int ERROR_CODE_FAILURE_CELL
public static final int ERROR_CODE_FAILURE_LOCATION_PERMISSION
public static final int ERROR_CODE_FAILURE_NOWIFIANDAP
public static final int ERROR_CODE_FAILURE_NOENOUGHSATELLITES
public static final int ERROR_CODE_FAILURE_SIMULATION_LOCATION
public static final int ERROR_CODE_AIRPLANEMODE_WIFIOFF
public static final int ERROR_CODE_NOCGI_WIFIOFF
public static final int ERROR_CODE_FAILURE_COARSE_LOCATION
getErrorInfo() 获取详细信息
getErrorInfo()public static final int ERROR_CODE_NO_COMPENSATION_CACHE
public static final int LOCATION_TYPE_GPS
通过设备卫星定位模块返回的定位结果
Location result type: Satellite positioning result
Location result returned by the device's satellite positioning module.
public static final int LOCATION_TYPE_SAME_REQ
网络定位请求低于1秒、或两次定位之间设备位置变化非常小时返回,设备位移通过传感器感知
Location type: Previous location
Returned when the network location request is less than 1 second, or when the device's position changes very little between two location requests. The device's displacement is sensed by sensors.
public static final int LOCATION_TYPE_FAST
LOCATION_TYPE_SAME_REQ
LOCATION_TYPE_SAME_REQpublic static final int LOCATION_TYPE_FIX_CACHE
返回一段时间前设备在相同的环境中缓存下来的网络定位结果,节省无必要的设备定位消耗
Location type: Cached location
Returns a network location result cached by the device in the same environment some time ago, saving unnecessary device location consumption.
public static final int LOCATION_TYPE_WIFI
属于网络定位,定位精度相对基站定位会更好
Location type: Wifi location
Belongs to network location, and the location accuracy is better compared to base station location.
public static final int LOCATION_TYPE_CELL
属于网络定位
Location type: Base station location
Belongs to network location.
public static final int LOCATION_TYPE_AMAP
public static final int LOCATION_TYPE_OFFLINE
public static final int LOCATION_TYPE_LAST_LOCATION_CACHE
public static final int LOCATION_COMPENSATION
public static final int LOCATION_TYPE_COARSE_LOCATION
public static final int LOCATION_TYPE_NETWORK
public static final java.lang.String COORD_TYPE_WGS84
public static final java.lang.String COORD_TYPE_GCJ02
public static final int GPS_ACCURACY_GOOD
public static final int GPS_ACCURACY_BAD
public static final int GPS_ACCURACY_UNKNOWN
public static final java.lang.String LBS_REAL_LOCATION_TYPE
public static final android.os.Parcelable.Creator<AMapLocation> CREATOR
public static final int TRUSTED_LEVEL_HIGH
public static final int TRUSTED_LEVEL_NORMAL
public static final int TRUSTED_LEVEL_LOW
public static final int TRUSTED_LEVEL_BAD
public AMapLocation(java.lang.String provider)
provider - 定位提供者名称
public AMapLocation(android.location.Location location)
location - android。location.Location对象
public AMapLocation(AmapLocation location)
public AMapLocation(AmapLocationNetwork location)
public boolean isReversegeo()
public void setReversegeo(boolean isReversegeo)
public int getCoord()
public void setCoord(int coord)
public void setCoord(java.lang.String strCoord)
public java.lang.String getGeoLanguage()
public void setGeoLanguage(java.lang.String geoLanguage)
public int getType()
public int getSubType()
public long getLocationUtcTime()
public long getLocationTickTime()
public java.lang.String getSource()
public int getDiagnosisType()
public boolean isDim()
public int getIod()
public int getIodConfidence()
public java.lang.String getSemantics()
public boolean isSpeedKmh()
public boolean isCoorCanUseInMap()
public int getPriority()
public java.lang.String getOptContent()
public int getGpsAccuracyStatus()
#GPS_ACCURACY_BAD,#GPS_ACCURACY_GOOD,#GPS_ACCURACY_UNKNOWNpublic float getVerticalAccuracyMeters()
getVerticalAccuracyMeters 在类中 android.location.Locationpublic float getSpeedAccuracyMetersPerSecond()
getSpeedAccuracyMetersPerSecond 在类中 android.location.Locationpublic float getBearingAccuracyDegrees()
getBearingAccuracyDegrees 在类中 android.location.Locationpublic void setVerticalAccuracyMeters(float var1)
setVerticalAccuracyMeters 在类中 android.location.Locationpublic void setSpeedAccuracyMetersPerSecond(float var1)
setSpeedAccuracyMetersPerSecond 在类中 android.location.Locationpublic void setBearingAccuracyDegrees(float var1)
setBearingAccuracyDegrees 在类中 android.location.Locationpublic void setGpsAccuracyStatus(int signalIntensity)
public void setType(int type)
public void setSubType(int subType)
public void setLocationUtcTime(long locationUtcTime)
public void setLocationTickTime(long locationTickTime)
public void setSource(java.lang.String source)
public void setDiagnosisType(int diagnosisType)
public void setDim(boolean dim)
public void setIod(int iod)
public void setIodConfidence(int iodConfidence)
public void setSemantics(java.lang.String semantics)
public void setSpeedKmh(boolean speedKmh)
public void setCoorCanUseInMap(boolean coorCanUseInMap)
public void setPriority(int priority)
public void setOptContent(java.lang.String optContent)
public void setOptAttrs(java.util.HashMap<java.lang.String,java.lang.Object> attrs)
public boolean has(java.lang.String var1)
public java.lang.String getOptAttrString(java.lang.String var1,
java.lang.String var2)
public long getOptAttrLong(java.lang.String var1,
long var2)
public int getOptAttrInt(java.lang.String var1,
int var2)
public double getOptAttrDouble(java.lang.String var1,
double var2)
public float getOptAttrFloat(java.lang.String var1,
float var2)
public boolean getOptAttrBoolean(java.lang.String var1,
boolean var2)
public java.lang.Object getOptAttr(java.lang.String var1)
public java.util.HashMap<java.lang.String,java.lang.Object> cloneOptAttrs()
public void putOptAttr(java.lang.String var1,
java.lang.Object var2)
public void removeOptAttr(java.lang.String var1)
public void clearOptAttrs()
public int getLocationType()
public void setLocationType(int locationType)
locationType - 定位结果来源
public void setLocationType(AmapLocation location)
public java.lang.String getLocationDetail()
public void setLocationDetail(java.lang.String detailErrorInfo)
detailErrorInfo - 定位信息描述
public int getErrorCode()
public void setErrorCode(int errorCode)
errorCode - 错误码
public void setAMapErrorCode(java.lang.String errorType,
int errorCode)
public java.lang.String getErrorInfo()
public void setErrorInfo(java.lang.String errorInfo)
errorInfo - 错误信息
public java.lang.String getCountry()
public void setCountry(java.lang.String country)
country - public java.lang.String getRoad()
getStreet()方法代替
getStreet() method insteadpublic void setRoad(java.lang.String road)
road - 街道或者道路名称
public java.lang.String getAddress()
2.9.0之前的版本定位类型为LOCATION_TYPE_GPS时不会返回地址信息
自2.9.0版本开始,当类型为LOCATION_TYPE_GPS时也可以返回地址信息(需要网络通畅,第一次有可能没有地址信息返回)
Before version 2.9.0, address information would not be returned when the location type was LOCATION_TYPE_GPS
Starting from version 2.9.0, address information can also be returned when the type is LOCATION_TYPE_GPS (requires a stable network connection, and the first attempt might not return address information)
public void setAddress(java.lang.String address)
address - 地址信息
public java.lang.String getProvince()
2.9.0之前的版本定位类型为LOCATION_TYPE_GPS时不会返回省份名称
自2.9.0版本开始,当LOCATION_TYPE_GPS时也可以返回省份名称
Before version 2.9.0, province name would not be returned when the location type was LOCATION_TYPE_GPS
Starting from version 2.9.0, province name can also be returned when the type is LOCATION_TYPE_GPS
public void setProvince(java.lang.String province)
province - 省的名称
public java.lang.String getCity()
2.9.0之前的版本定位类型为LOCATION_TYPE_GPS时不会返回城市名称
自2.9.0版本开始,当LOCATION_TYPE_GPS时也可以返回省城市名称
Before version 2.9.0, city name would not be returned when the location type was LOCATION_TYPE_GPS
Starting from version 2.9.0, city name can also be returned when the type is LOCATION_TYPE_GPS
public void setCity(java.lang.String city)
city - 城市名称
public java.lang.String getDistrict()
2.9.0之前的版本定位类型为LOCATION_TYPE_GPS时不会返回区的名称
自2.9.0版本开始,当LOCATION_TYPE_GPS时也可以返回区的名称
Before version 2.9.0, district name would not be returned when the location type was LOCATION_TYPE_GPS
Starting from version 2.9.0, district name can also be returned when the type is LOCATION_TYPE_GPS
public void setDistrict(java.lang.String district)
district - 区的名称
public java.lang.String getCityCode()
2.9.0之前的版本定位类型为LOCATION_TYPE_GPS时不会返回城市编码
自2.9.0版本开始,当LOCATION_TYPE_GPS时也可以返回城市编码
Before version 2.9.0, city code would not be returned when the location type was LOCATION_TYPE_GPS
Starting from version 2.9.0, city code can also be returned when the type is LOCATION_TYPE_GPS
public void setCityCode(java.lang.String cityCode)
cityCode - 城市编码
public java.lang.String getAdCode()
2.9.0之前的版本定位类型为LOCATION_TYPE_GPS时不会返回区域编码
自2.9.0版本开始,当LOCATION_TYPE_GPS时也可以返回区域编码
Before version 2.9.0, area code would not be returned when the location type was LOCATION_TYPE_GPS
Starting from version 2.9.0, area code can also be returned when the type is LOCATION_TYPE_GPS
public void setAdCode(java.lang.String adCode)
adCode - 区域编码
public java.lang.String getPoiName()
2.9.0之前的版本定位类型为LOCATION_TYPE_GPS时不会返回兴趣点名称
自2.9.0版本开始,当LOCATION_TYPE_GPS时也可以返回兴趣点名称
Before version 2.9.0, POI name would not be returned when the location type was LOCATION_TYPE_GPS
Starting from version 2.9.0, POI name can also be returned when the type is LOCATION_TYPE_GPS
public void setPoiName(java.lang.String poiName)
poiName - public double getLatitude()
getLatitude 在类中 android.location.Locationpublic void setLatitude(double latitude)
setLatitude 在类中 android.location.Locationpublic double getLongitude()
getLongitude 在类中 android.location.Locationpublic void setLongitude(double longitude)
setLongitude 在类中 android.location.Locationpublic int getSatellites()
public void setSatellites(int satellites)
satellites - public java.lang.String getStreet()
2.9.0之前的版本定位类型为LOCATION_TYPE_GPS时不会返回街道名称
自2.9.0版本开始,当LOCATION_TYPE_GPS时也可以返回街道名称
Versions before 2.9.0 did not return street names when the location type was LOCATION_TYPE_GPS
Since 2.9.0, street names can also be returned when LOCATION_TYPE_GPS
public void setStreet(java.lang.String street)
street - 街道名称
public java.lang.String getStreetNum()
2.9.0之前的版本定位类型为LOCATION_TYPE_GPS时不会返回门牌号
自2.9.0版本开始,当LOCATION_TYPE_GPS时也可以返回门牌号
Versions before 2.9.0 did not return house numbers when the location type was LOCATION_TYPE_GPS
Since 2.9.0, house numbers can also be returned when LOCATION_TYPE_GPS
public void setNumber(java.lang.String number)
number - public void setOffset(boolean offset)
offset - public boolean isOffset()
public java.lang.String getAoiName()
2.9.0之前的版本定位类型为LOCATION_TYPE_GPS时不会返回兴趣面名称
自2.9.0版本开始,当LOCATION_TYPE_GPS时也可以返回兴趣面名称
Versions before 2.9.0 did not return AOI names when the location type was LOCATION_TYPE_GPS
Since 2.9.0, AOI names can also be returned when LOCATION_TYPE_GPS
public void setAoiName(java.lang.String aoiName)
aoiName - public java.lang.String getBuildingId()
public void setBuildingId(java.lang.String mPoiid)
public java.lang.String getFloor()
public java.lang.String getFloorName()
public boolean isFixLastLocation()
public void setFixLastLocation(boolean isFixLastLocation)
public void setFloor(java.lang.String floor)
public void setFloorName(java.lang.String floorName)
public boolean isMock()
isMock 在类中 android.location.Locationpublic void setMock(boolean mock)
setMock 在类中 android.location.Locationmock - 是否为模拟定位
public java.lang.String getDescription()
public void setDescription(java.lang.String description)
description - public java.lang.String toString()
toString 在类中 android.location.Locationpublic java.lang.String toStr()
public java.lang.String toStr(int iT)
iT - 【1代表完整描述,2代表精简描述,3代表极简描述】
public float getAccuracy()
单位:米
Get Location Accuracy
Unit: meters
getAccuracy 在类中 android.location.Locationpublic void setBearing(float bearing)
setBearing 在类中 android.location.Locationbearing - public float getBearing()
默认值:0.0
取值范围:【0,360】,其中0度表示正北方向,90度表示正东,180度表示正南,270度表示正西
3.1.0之前的版本只有定位类型为 LOCATION_TYPE_GPS时才有值
自3.1.0版本开始,不限定定位类型,当定位类型不是LOCATION_TYPE_GPS时,可以通过
AMapLocationClientOption.setSensorEnable(boolean)
控制是否返回方向角,当设置为true时会通过手机传感器获取方向角,如果手机没有对应的传感器会返回0.0
注意:
定位类型为LOCATION_TYPE_GPS时,方向角指的是运动方向
定位类型不是LOCATION_TYPE_GPS时,方向角指的是手机朝向
Default value: 0.0
Range: [0, 360], where 0 degrees represents true north, 90 degrees represents true east, 180 degrees represents true south, and 270 degrees represents true west
Before version 3.1.0, this value was only available when the location type was LOCATION_TYPE_GPS
Starting from version 3.1.0, the location type is not restricted. When the location type is not LOCATION_TYPE_GPS, you can use
AMapLocationClientOption.setSensorEnable(boolean)
to control whether the bearing is returned. When set to true, the bearing will be obtained via the phone's sensors. If the phone does not have the corresponding sensors, 0.0 will be returned.
Note:
When the location type is LOCATION_TYPE_GPS, the bearing refers to the direction of movement.
When the location type is not LOCATION_TYPE_GPS, the bearing refers to the phone's orientation.
getBearing 在类中 android.location.Locationpublic void setAltitude(double altitude)
setAltitude 在类中 android.location.Locationaltitude - public double getAltitude()
默认值:0.0
3.1.0之前的版本只有定位类型为 LOCATION_TYPE_GPS时才有值
自3.1.0版本开始,不限定定位类型,当定位类型不是LOCATION_TYPE_GPS时,可以通过
AMapLocationClientOption.setSensorEnable(boolean)
控制是否返回海拔高度,当设置为true时会通过手机传感器获取海拔高度,如果手机没有对应的传感器会返回0.0
Default value: 0.0
Before version 3.1.0, this value was only available when the location type was LOCATION_TYPE_GPS
Starting from version 3.1.0, the location type is not restricted. When the location type is not LOCATION_TYPE_GPS, you can use
AMapLocationClientOption.setSensorEnable(boolean)
to control whether the altitude is returned. When set to true, the altitude will be obtained via the phone's sensors. If the phone does not have the corresponding sensors, 0.0 will be returned.
getAltitude 在类中 android.location.Locationpublic void setSpeed(float speed)
setSpeed 在类中 android.location.Locationspeed - public float getSpeed()
默认值:0.0
3.1.0之前的版本只有定位类型为 LOCATION_TYPE_GPS时才有值
自3.1.0版本开始,不限定定位类型,当定位类型不是LOCATION_TYPE_GPS时,可以通过
AMapLocationClientOption.setSensorEnable(boolean)
控制是否返回速度值,当设置为true时会通过手机传感器获取速度,如果手机没有对应的传感器会返回0.0
Default value: 0.0
Before version 3.1.0, this value was only available when the location type was LOCATION_TYPE_GPS
Starting from version 3.1.0, the location type is not restricted. When the location type is not LOCATION_TYPE_GPS, you can use
AMapLocationClientOption.setSensorEnable(boolean)
to control whether the speed is returned. When set to true, the speed will be obtained via the phone's sensors. If the phone does not have the corresponding sensors, 0.0 will be returned.
getSpeed 在类中 android.location.Locationpublic void setProvider(java.lang.String provider)
setProvider 在类中 android.location.Locationprovider - public java.lang.String getProvider()
getProvider 在类中 android.location.Locationlbs:高德网络定位
gps:卫星定位
Location provider
lbs: AMap network positioning
gps: Satellite positioning
public void setExtras(android.os.Bundle extras)
setExtras 在类中 android.location.Locationextras - public android.os.Bundle getExtras()
getExtras 在类中 android.location.Locationpublic org.json.JSONObject toJson(int iT)
iT - 【1代表完整描述,2代表精简描述,3代表极简描述】
public int describeContents()
describeContents 在接口中 android.os.ParcelabledescribeContents 在类中 android.location.Locationpublic void writeToParcel(android.os.Parcel parcel,
int flags)
writeToParcel 在接口中 android.os.ParcelablewriteToParcel 在类中 android.location.Locationpublic AMapLocation clone()
clone 在类中 java.lang.Objectpublic AMapLocationQualityReport getLocationQualityReport()
public void setLocationQualityReport(AMapLocationQualityReport qualityReport)
qualityReport - public java.lang.String getCoordType()
高德定位sdk会返回两种坐标系
COORD_TYPE_GCJ02 -- GCJ02坐标系
COORD_TYPE_WGS84 -- WGS84坐标系,国外定位时返回的是WGS84坐标系
The AMap location SDK returns two types of coordinate systems
COORD_TYPE_GCJ02 -- GCJ02 coordinate system
COORD_TYPE_WGS84 -- WGS84 coordinate system, the WGS84 coordinate system is returned when locating abroad
public void setCoordType(java.lang.String coordType)
coordType - 坐标系类型
public void setTrustedLevel(int trustedLevel)
trustedLevel - 可信度
public int getTrustedLevel()
TRUSTED_LEVEL_HIGHTRUSTED_LEVEL_NORMALTRUSTED_LEVEL_LOWTRUSTED_LEVEL_BAD
TRUSTED_LEVEL_HIGHTRUSTED_LEVEL_NORMALTRUSTED_LEVEL_LOWTRUSTED_LEVEL_BADpublic int getConScenario()
public void setConScenario(int conScenario)
conScenario - 室内外置信度