public class AMapLocationClientOption
extends java.lang.Object
implements java.lang.Cloneable, android.os.Parcelable
| 限定符和类型 | 类和说明 |
|---|---|
static class |
AMapLocationClientOption.AMapLocationMode
定位模式,目前支持三种定位模式
高精度定位模式: 在这种定位模式下,将同时使用高德网络定位和卫星定位,优先返回精度高的定位 低功耗定位模式: 在这种模式下,将只使用高德网络定位 仅设备定位模式: 在这种模式下,将只使用卫星定位。 |
static class |
AMapLocationClientOption.AMapLocationProtocol
定位协议,目前支持二种定位协议
http协议: 在这种定位协议下,会使用http请求定位 https协议: 在这种定位协议下,会使用https请求定位 Positioning protocols, currently two protocols are supported: HTTP protocol: Under this protocol, HTTP requests will be used for positioning. |
static class |
AMapLocationClientOption.AMapLocationPurpose
定位场景
Positioning scenarios |
static class |
AMapLocationClientOption.GeoLanguage
设置返回逆地理使用的语言,目前有三种选择
默认: 选择这种模式,会根据位置按照相应的语言返回逆地理信息,在国外按英语返回,在国内按中文返回 中文: 设置只中文后,无论在国外还是国内都为返回中文的逆地理信息 英文: 设置英文后,无论在国外还是国内都为返回英文的逆地理信息 Set the language for reverse geocoding, currently three options are available: Default: In this mode, reverse geocoding information will be returned in the appropriate language based on location: English abroad and Chinese domestically. |
| 限定符和类型 | 字段和说明 |
|---|---|
static java.lang.String |
APIKEY
用户设置的KEY
User-set KEY |
static android.os.Parcelable.Creator<AMapLocationClientOption> |
CREATOR |
static boolean |
OPEN_ALWAYS_SCAN_WIFI
是否开启始终扫描开关
Whether to enable the always scan switch |
static long |
SCAN_WIFI_INTERVAL
Android P上wifi扫描间隔
Wifi scanning interval on Android P |
| 构造器和说明 |
|---|
AMapLocationClientOption() |
| 限定符和类型 | 方法和说明 |
|---|---|
AMapLocationClientOption |
clone()
获取AMapLocationClientOption对象的拷贝
Get a copy of the AMapLocationClientOption object |
int |
describeContents() |
static java.lang.String |
getAPIKEY()
获取通过client的setApikey接口设置的key
Get the key set via the client's setApikey interface |
java.lang.String |
getAuuid() |
boolean |
getCacheCallBack()
获取是否打开2分钟缓存提速开关
Get whether the 2-minute cache acceleration switch is enabled |
int |
getCacheCallBackTime()
获取缓存提速超时时间
Get the timeout for cache acceleration |
int |
getCacheTimeOut()
获取提速功能缓存最大时间
Get the maximum cache time for the acceleration function |
float |
getDeviceModeDistanceFilter()
获取仅设备模式/高精度模式的系统定位自动回调最少间隔距离值
默认值:0米 只有当定位模式为 AMapLocationClientOption.AMapLocationMode.Device_Sensors(仅设备模式)或 AMapLocationClientOption.AMapLocationMode.Hight_Accuracy(高精度模式)有效
Get the minimum interval distance for system location auto callback in device-only/high-accuracy mode Default value: 0 meters Only valid when the location mode is AMapLocationClientOption.AMapLocationMode.Device_Sensors (device-only mode) or AMapLocationClientOption.AMapLocationMode.Hight_Accuracy (high-accuracy mode)
|
AMapLocationClientOption.GeoLanguage |
getGeoLanguage()
获取逆地理的语言
Get the language of reverse geocoding |
long |
getGpsFirstTimeout()
获取优先返回定位信息时等待GPS结果的超时时间
Get the timeout for waiting for GPS results when prioritizing returning location information |
long |
getHttpTimeOut()
获取联网超时时间
单位:毫秒 默认值:30000毫秒 Get network timeout Unit: milliseconds Default value: 30000 milliseconds |
long |
getInterval()
获取发起定位请求的时间间隔
默认值:2000毫秒 Get the time interval for initiating location requests Default value: 2000 milliseconds |
long |
getLastLocationLifeCycle()
获取跨应用缓存的有效时间, 默认30s
Get the validity time of cross-application cache, default is 30s |
AMapLocationClientOption.AMapLocationMode |
getLocationMode()
获取定位模式 默认值:Hight_Accuracy 高精度模式
Get location mode Default: Hight_Accuracy High accuracy mode |
AMapLocationClientOption.AMapLocationProtocol |
getLocationProtocol()
获取定位协议 默认值:HTTP http协议
Get location protocol Default: HTTP http protocol |
AMapLocationClientOption.AMapLocationPurpose |
getLocationPurpose()
获取定位场景
Get the positioning scenario |
long |
getScanWifiInterval()
获取Android P上wifi扫描间隔
Get the wifi scanning interval on Android P |
boolean |
isBeidouFirst()
优先使用北斗定位
|
static boolean |
isDownloadCoordinateConvertLibrary()
获取是否下载集团偏转so,文档中不体现
Get whether to download group deflection so. |
boolean |
isGpsFirst()
获取高精度模式下单次定位是否优先返回卫星定位信息
默认值:false 只有在单次定位高精度定位模式下有效 为true时,会等待卫星定位结果返回,最多等待30秒,若30秒后仍无卫星定位结果返回,返回网络定位结果 Get whether to prioritize returning satellite positioning information in high accuracy mode for single positioning Default: false Only effective in single positioning high accuracy mode When true, it will wait for satellite positioning results to return, up to 30 seconds. |
boolean |
isH5LocationFileAccessEnabled()
获取H5辅助定位是否允许传入WebView访问文件。
|
boolean |
isH5LocationJavaScriptEnabled()
获取H5辅助定位是否允许SDK开启传入WebView的JavaScript。
|
boolean |
isKillProcess()
获取退出时是否杀死进程
默认值:false, 不杀死 注意:如果设置为true,并且配置的service不是remote的则会杀死当前页面进程,请慎重使用 Get whether to kill the process when exiting Default: false, do not kill Note: If set to true, and the configured service is not remote, it will kill the current page process. |
boolean |
isLBSLocationEnable()
是否开启高德网络定位
默认值:true Whether to enable AMap network positioning Default value: true |
boolean |
isLocationCacheEnable()
获取是否使用缓存策略, 默认为true 使用缓存策略
Get whether to use cache strategy, default is true (use cache strategy) |
boolean |
isMockEnable()
获取是否允许模拟位置
从3.4.0开始,默认值为true,允许模拟;
3.4.0之前的版本,默认值为false,不允许模拟 Get whether mock locations are allowed Starting from 3.4.0, the default value is true, allowing mocks; Versions before 3.4.0, the default value is false, not allowing mocks. |
boolean |
isNeedAddress()
获取是否需要地址信息
默认值:false 不返回地址信息 2.9.0之前的版本定位类型为 AMapLocation.LOCATION_TYPE_GPS时不会返回地址信息自2.9.0版本开始,当类型为 AMapLocation.LOCATION_TYPE_GPS时也可以返回地址信息(需要网络通畅,第一次有可能没有地址信息返回)
Get whether address information is needed Default value: false, no address information returned For versions before 2.9.0, when the location type is AMapLocation.LOCATION_TYPE_GPS, address information will not be returnedStarting from 2.9.0, when the type is AMapLocation.LOCATION_TYPE_GPS, address information can also be returned (requires a stable network connection, the first time might not return address information) |
boolean |
isNoLocReqCgiEnable()
停止定位时是否允许更新基站信息
默认值:true Whether to allow updating base station information when stopping positioning Default value: true |
boolean |
isOffset()
获取是否需要偏转
默认值:true 偏转 Get whether deflection is needed Default value: true (deflection) |
boolean |
isOnceLocation()
是否单次单次定位
默认值:false Whether to perform single location Default value: false |
boolean |
isOnceLocationLatest()
获取首次定位是否等待WIFI列表刷新
Get whether the first location waits for WIFI list refresh |
static boolean |
isOpenAlwaysScanWifi()
是否开启始终wifi扫描
只有设置了android.permission.WRITE_SECURE_SETTINGS权限后才会开启
开启后,即使关闭wifi开关的情况下也会扫描wifi
默认值为:true, 开启wifi始终扫描
Whether to enable always wifi scanning Only enabled after setting the android.permission.WRITE_SECURE_SETTINGS permission After enabling, wifi will be scanned even if the wifi switch is turned off Default value: true, enable always wifi scanning |
boolean |
isSelfStartServiceEnable()
是否允许定位服务自启动
默认值:true Whether to allow location service to auto-start Default value: true |
boolean |
isSensorEnable()
获取是否使用设备传感器
Get whether to use device sensor |
boolean |
isSysNetworkLocEnable()
是否开启系统网络定位
默认值:true Whether to enable system network positioning Default value: true |
boolean |
isWifiActiveScan()
已过时。
|
boolean |
isWifiScan()
获取是否允许主动调用WIFI刷新
Get whether to allow actively calling WIFI refresh |
void |
setAuuid(java.lang.String auuid) |
AMapLocationClientOption |
setBeidouFirst(boolean isBeidouFirst)
设置是否优先使用北斗定位
默认值 false
|
void |
setCacheCallBack(boolean fastCallBack)
设置是否打开缓存提速开关
Set whether to enable the cache acceleration switch |
void |
setCacheCallBackTime(int fastCallBackTime)
设置缓存提速超时时间
Set the timeout for cache acceleration |
void |
setCacheTimeOut(int timeOut)
设置提速功能缓存最大时间
Set the maximum cache time for the acceleration function |
AMapLocationClientOption |
setDeviceModeDistanceFilter(float distanceFilter)
设置仅设备模式/高精度模式的系统定位自动回调最少间隔距离值
单位:米 默认值:0米 只有当定位模式为 AMapLocationClientOption.AMapLocationMode.Device_Sensors(仅设备模式)或 AMapLocationClientOption.AMapLocationMode.Hight_Accuracy(高精度模式)有效,值小于0时无效
Set the minimum interval distance value for automatic callback of system positioning in device-only mode/high-accuracy mode Unit: meters Default value: 0 meters Only valid when the positioning mode is AMapLocationClientOption.AMapLocationMode.Device_Sensors (device-only mode) or AMapLocationClientOption.AMapLocationMode.Hight_Accuracy (high-accuracy mode), invalid if the value is less than 0
|
static void |
setDownloadCoordinateConvertLibrary(boolean isDownload)
设置是否下载集团偏转so,如果要一开始就不下载,需要保证在所有的Client初始化之前设置为false,文档中不体现
Set whether to download group deflection so. |
AMapLocationClientOption |
setGeoLanguage(AMapLocationClientOption.GeoLanguage geoLanguage)
设置逆地理信息的语言,目前之中中文和英文
默认值:
AMapLocationClientOption.GeoLanguage.DEFAULT
Set the language of reverse geocoding, currently only Chinese and English Default value: AMapLocationClientOption.GeoLanguage.DEFAULT
|
AMapLocationClientOption |
setGpsFirst(boolean isGpsFirst)
设置首次定位是否等待卫星定位结果
默认值:false 只有在单次定位高精度定位模式下有效 设置为true时,会等待卫星定位结果返回,最多等待30秒,若30秒后仍无卫星定位结果返回,返回网络定位结果 从4.5.0版本开始等待卫星定位结果返回的时间可以通过 setGpsFirstTimeout(long)进行设置
Set whether to wait for satellite positioning results during the first positioning Default: false Only effective in single positioning high accuracy mode When set to true, it will wait for satellite positioning results to return, up to 30 seconds. |
AMapLocationClientOption |
setGpsFirstTimeout(long timeout)
设置优先返回卫星定位信息时等待卫星定位结果的超时时间,单位:毫秒
只有在
setGpsFirst(boolean)设置为true时才有效。 |
AMapLocationClientOption |
setH5LocationFileAccessEnabled(boolean h5LocationFileAccessEnabled)
设置H5辅助定位是否允许传入WebView访问文件。
|
AMapLocationClientOption |
setH5LocationJavaScriptEnabled(boolean h5LocationJavaScriptEnabled)
设置H5辅助定位是否允许SDK开启传入WebView的JavaScript。
|
AMapLocationClientOption |
setHttpTimeOut(long httpTimeOut)
设置联网超时时间
单位:毫秒 默认值:30000毫秒 Set network timeout Unit: milliseconds Default value: 30000 milliseconds |
AMapLocationClientOption |
setInterval(long interval)
设置发起定位请求的时间间隔
单位:毫秒 默认值:2000毫秒 Set the time interval for initiating location requests Unit: milliseconds Default value: 2000 milliseconds |
AMapLocationClientOption |
setKillProcess(boolean isKillProcess)
设置退出时是否杀死进程
默认值:false, 不杀死 注意:如果设置为true,并且配置的service不是remote的则会杀死当前页面进程,请慎重使用 Set whether to kill the process when exiting Default: false, do not kill Note: If set to true, and the configured service is not remote, it will kill the current page process. |
AMapLocationClientOption |
setLastLocationLifeCycle(long lifeCycle)
设置跨应用缓存的有效时间 单位:毫秒(ms)
Set the validity time of cross-application cache. |
void |
setLBSLocationEnable(boolean isLBSLocationEnable)
设置是否开启高德网络定位
默认值:true Set whether to enable AMap network positioning Default value: true |
AMapLocationClientOption |
setLocationCacheEnable(boolean isLocationCacheEnable)
设置是否使用缓存策略, 默认为true 使用缓存策略
Set whether to use cache strategy, default is true (use cache strategy) |
AMapLocationClientOption |
setLocationMode(AMapLocationClientOption.AMapLocationMode locationMode)
设置定位模式
Set location mode |
static void |
setLocationProtocol(AMapLocationClientOption.AMapLocationProtocol amapLocationProtocol)
设置定位协议
Set location protocol |
AMapLocationClientOption |
setLocationPurpose(AMapLocationClientOption.AMapLocationPurpose locationPurpose)
设置定位场景,根据场景快速修改option,不支持动态改变,修改后需要调用
AMapLocationClient.startLocation()使其生效当不需要场景时,可以设置为NULL, 注意: 不建议设置场景和自定义option混合使用 设置场景后,如果已经开始定位了,建议调用一次 AMapLocationClient.stopLocation(),然后主动调用一次AMapLocationClient.startLocation()以保证option正确生效
当主动设置的option和场景中的option有冲突时,以后设置的为准,
比如:签到场景中默认的为单次定位,当主动设置option为连续定位时,
如果先设置的场景,后改变的option,这时如果不调用startLocation不会变为连续定位,如果调用了startLocation则会变为连续定位,
如果先改变option,后设置场景为签到场景,则会变为单次定位
Set the positioning scenario, quickly modify the option based on the scenario, dynamic changes are not supported, after modification, call AMapLocationClient.startLocation() to make it take effectWhen no scenario is needed, it can be set to NULL, Note: It is not recommended to mix scenario settings with custom options After setting the scenario, if positioning has already started, it is recommended to call AMapLocationClient.stopLocation() once, then actively call AMapLocationClient.startLocation() once to ensure the option takes effect correctly
When there is a conflict between the actively set option and the option in the scenario, the latter set one takes precedence,
for example: the default in the check-in scenario is single positioning, when actively setting the option to continuous positioning,
if the scenario is set first and the option is changed later, then if startLocation is not called, it will not become continuous positioning, if startLocation is called, it will become continuous positioning,
if the option is changed first and the scenario is set to check-in scenario later, it will become single positioning |
AMapLocationClientOption |
setMockEnable(boolean isMockEnable)
设置是否允许模拟位置
从3.4.0开始,默认值为true,允许模拟; 3.4.0之前的版本,默认值为false,不允许模拟 Set whether to allow mock location Starting from 3.4.0, the default value is true, allowing mock; For versions before 3.4.0, the default value is false, not allowing mock |
AMapLocationClientOption |
setNeedAddress(boolean isNeedAddress)
设置是否返回地址信息,默认返回地址信息
默认值:false, 返回地址信息 2.9.0之前的版本定位类型为 AMapLocation.LOCATION_TYPE_GPS时不会返回地址信息自2.9.0版本开始,当类型为 AMapLocation.LOCATION_TYPE_GPS时也可以返回地址信息(需要网络通畅,第一次有可能没有地址信息返回)
Set whether to return address information, default returns address information Default value: true, return address information For versions before 2.9.0, when the location type is AMapLocation.LOCATION_TYPE_GPS, address information will not be returnedStarting from 2.9.0, when the type is AMapLocation.LOCATION_TYPE_GPS, address information can also be returned (requires a stable network connection, the first time might not return address information)
|
void |
setNoLocReqCgiEnable(boolean noLocReqCgiEnable)
设置停止定位时是否允许更新基站信息
默认值:true Set whether to allow updating base station information when stopping positioning Default value: true |
AMapLocationClientOption |
setOffset(boolean isOffset)
设置是否偏转, 默认为true 偏转
Set whether to deflect, default is true (deflection) |
AMapLocationClientOption |
setOnceLocation(boolean isOnceLocation)
设置是否单次定位
默认值:false Set whether to perform single location Default value: false |
AMapLocationClientOption |
setOnceLocationLatest(boolean isOnceLocationLatest)
设置定位是否等待WIFI列表刷新
定位精度会更高,但是定位速度会变慢1-3秒
从3.7.0版本开始,支持连续定位(连续定位时首次会等待刷新)
3.7.0之前的版本,仅适用于单次定位,当设置为true时,连续定位会自动变为单次定位,
Set whether the location waits for WIFI list refresh Location accuracy will be higher, but location speed will slow down by 1-3 seconds Starting from version 3.7.0, continuous location is supported (first time will wait for refresh during continuous location) For versions before 3.7.0, it only applies to single location. |
static void |
setOpenAlwaysScanWifi(boolean openAlwaysScanWifi)
设置是否开启wifi始终扫描
只有设置了android.permission.WRITE_SECURE_SETTINGS权限后才会开启
开启后,即使关闭wifi开关的情况下也会扫描wifi
默认值为:true, 开启wifi始终扫描
此方法为静态方法,设置一次后其他定位Client也会生效
Set whether to enable always wifi scanning Only enabled after setting the android.permission.WRITE_SECURE_SETTINGS permission After enabling, wifi will be scanned even if the wifi switch is turned off Default value: true, enable always wifi scanning This method is a static method, setting it once will also take effect for other positioning Clients |
static void |
setScanWifiInterval(long interval)
设置Android P上wifi扫描间隔
Set the wifi scanning interval on Android P |
void |
setSelfStartServiceEnable(boolean selfStartServiceEnable)
设置是否允许定位服务自启动
默认值:true Set whether to allow location service to auto-start Default value: true |
AMapLocationClientOption |
setSensorEnable(boolean sensorEnable)
设置是否使用设备传感器
默认值:false 不使用设备传感器
Set whether to use device sensor Default value: false (do not use device sensor) |
void |
setSysNetworkLocEnable(boolean sysNetworkLocEnable)
设置开启系统网络定位
默认值:true Set whether to enable system network positioning Default value: true |
AMapLocationClientOption |
setWifiScan(boolean isWifiPassiveScan)
设置是否允许调用WIFI刷新
默认值为true,当设置为false时会停止主动调用WIFI刷新,将会极大程度影响定位精度,但可以有效的降低定位耗电
Set whether to allow calling WIFI refresh Default value is true, when set to false, it will stop actively calling WIFI refresh, which will greatly affect positioning accuracy, but can effectively reduce positioning power consumption |
java.lang.String |
toString() |
void |
writeToParcel(android.os.Parcel dest,
int flags) |
public static java.lang.String APIKEY
public static final android.os.Parcelable.Creator<AMapLocationClientOption> CREATOR
public static boolean OPEN_ALWAYS_SCAN_WIFI
public static long SCAN_WIFI_INTERVAL
public void setAuuid(java.lang.String auuid)
public java.lang.String getAuuid()
public boolean isH5LocationJavaScriptEnabled()
AMapLocationClient.startAssistantLocation(android.webkit.WebView)和
AMapLocationClient.startAssistantLocation(android.webkit.WebView, AMapLocationClientOption)生效。
AMapLocationClient.startAssistantLocation(android.webkit.WebView) and
AMapLocationClient.startAssistantLocation(android.webkit.WebView, AMapLocationClientOption).public AMapLocationClientOption setH5LocationJavaScriptEnabled(boolean h5LocationJavaScriptEnabled)
h5LocationJavaScriptEnabled - true:允许;false:不允许
public boolean isH5LocationFileAccessEnabled()
public AMapLocationClientOption setH5LocationFileAccessEnabled(boolean h5LocationFileAccessEnabled)
h5LocationFileAccessEnabled - true:允许;false:不允许
public boolean isLBSLocationEnable()
public void setLBSLocationEnable(boolean isLBSLocationEnable)
isLBSLocationEnable - 是否开启高德网络定位 public boolean isSysNetworkLocEnable()
public void setSysNetworkLocEnable(boolean sysNetworkLocEnable)
sysNetworkLocEnable - 是否开启系统网络定位 public boolean isNoLocReqCgiEnable()
public void setNoLocReqCgiEnable(boolean noLocReqCgiEnable)
noLocReqCgiEnable - 停止定位时是否允许更新基站信息 public boolean isSelfStartServiceEnable()
public void setSelfStartServiceEnable(boolean selfStartServiceEnable)
selfStartServiceEnable - 是否允许定位服务自启动 public boolean isBeidouFirst()
public AMapLocationClientOption setBeidouFirst(boolean isBeidouFirst)
isBeidouFirst - 是否优先使用北斗定位public void setCacheCallBack(boolean fastCallBack)
fastCallBack - public boolean getCacheCallBack()
public void setCacheCallBackTime(int fastCallBackTime)
fastCallBackTime - public int getCacheCallBackTime()
public void setCacheTimeOut(int timeOut)
timeOut - public int getCacheTimeOut()
public static java.lang.String getAPIKEY()
public boolean isMockEnable()
从3.4.0开始,默认值为true,允许模拟;
3.4.0之前的版本,默认值为false,不允许模拟
Starting from 3.4.0, the default value is true, allowing mocks;
Versions before 3.4.0, the default value is false, not allowing mocks.
public AMapLocationClientOption setMockEnable(boolean isMockEnable)
从3.4.0开始,默认值为true,允许模拟;
3.4.0之前的版本,默认值为false,不允许模拟
Starting from 3.4.0, the default value is true, allowing mock;
For versions before 3.4.0, the default value is false, not allowing mock
isMockEnable - 是否允许模拟位置public long getInterval()
public AMapLocationClientOption setInterval(long interval)
interval - 时间间隔 public boolean isOnceLocation()
public AMapLocationClientOption setOnceLocation(boolean isOnceLocation)
isOnceLocation - 是否单次定位 public boolean isNeedAddress()
AMapLocation.LOCATION_TYPE_GPS时不会返回地址信息AMapLocation.LOCATION_TYPE_GPS时也可以返回地址信息(需要网络通畅,第一次有可能没有地址信息返回)
AMapLocation.LOCATION_TYPE_GPS, address information will not be returnedAMapLocation.LOCATION_TYPE_GPS, address information can also be returned (requires a stable network connection, the first time might not return address information)public AMapLocationClientOption setNeedAddress(boolean isNeedAddress)
2.9.0之前的版本定位类型为AMapLocation.LOCATION_TYPE_GPS时不会返回地址信息
自2.9.0版本开始,当类型为AMapLocation.LOCATION_TYPE_GPS时也可以返回地址信息(需要网络通畅,第一次有可能没有地址信息返回)
For versions before 2.9.0, when the location type is AMapLocation.LOCATION_TYPE_GPS, address information will not be returned
Starting from 2.9.0, when the type is AMapLocation.LOCATION_TYPE_GPS, address information can also be returned (requires a stable network connection, the first time might not return address information)
isNeedAddress - 是否返回地址信息public boolean isWifiActiveScan()
public boolean isWifiScan()
public AMapLocationClientOption setWifiScan(boolean isWifiPassiveScan)
默认值为true,当设置为false时会停止主动调用WIFI刷新,将会极大程度影响定位精度,但可以有效的降低定位耗电
Default value is true, when set to false, it will stop actively calling WIFI refresh, which will greatly affect positioning accuracy, but can effectively reduce positioning power consumption
isWifiPassiveScan - 是否允许wifi刷新,默认为:true
public AMapLocationClientOption.AMapLocationMode getLocationMode()
public AMapLocationClientOption setLocationMode(AMapLocationClientOption.AMapLocationMode locationMode)
locationMode - 定位模式public AMapLocationClientOption.AMapLocationProtocol getLocationProtocol()
public static void setLocationProtocol(AMapLocationClientOption.AMapLocationProtocol amapLocationProtocol)
amapLocationProtocol - 协议类型public boolean isKillProcess()
注意:如果设置为true,并且配置的service不是remote的则会杀死当前页面进程,请慎重使用
Note: If set to true, and the configured service is not remote, it will kill the current page process. Please use with caution.
public AMapLocationClientOption setKillProcess(boolean isKillProcess)
注意:如果设置为true,并且配置的service不是remote的则会杀死当前页面进程,请慎重使用
Note: If set to true, and the configured service is not remote, it will kill the current page process. Please use with caution.
isKillProcess - 退出时是否杀死进程public boolean isGpsFirst()
只有在单次定位高精度定位模式下有效
为true时,会等待卫星定位结果返回,最多等待30秒,若30秒后仍无卫星定位结果返回,返回网络定位结果
Get whether to prioritize returning satellite positioning information in high accuracy mode for single positioning
Default: false
Only effective in single positioning high accuracy mode
When true, it will wait for satellite positioning results to return, up to 30 seconds. If no satellite positioning results are returned after 30 seconds, it will return network positioning results
public AMapLocationClientOption setGpsFirst(boolean isGpsFirst)
只有在单次定位高精度定位模式下有效
设置为true时,会等待卫星定位结果返回,最多等待30秒,若30秒后仍无卫星定位结果返回,返回网络定位结果
从4.5.0版本开始等待卫星定位结果返回的时间可以通过 setGpsFirstTimeout(long)进行设置
Only effective in single positioning high accuracy mode
When set to true, it will wait for satellite positioning results to return, up to 30 seconds. If no satellite positioning results are returned after 30 seconds, it will return network positioning results
Starting from 4.5.0 version, the waiting time for satellite positioning results can be set via setGpsFirstTimeout(long)
isGpsFirst - 是否优先返回卫星定位信息setGpsFirstTimeout(long)public AMapLocationClientOption setGpsFirstTimeout(long timeout)
只有在setGpsFirst(boolean)设置为true时才有效。
最小间隔5s, 最大间隔30s
Only effective when setGpsFirst(boolean) is set to true.
Minimum interval 5s, maximum interval 30s
timeout - 优先返回卫星定位信息时等待卫星定位结果的超时时间, 范围[5000-30000], 单位:毫秒
setGpsFirst(boolean)public long getGpsFirstTimeout()
public AMapLocationClientOption clone()
clone 在类中 java.lang.Objectpublic long getHttpTimeOut()
public AMapLocationClientOption setHttpTimeOut(long httpTimeOut)
httpTimeOut - 联网超时时间public boolean isOffset()
public AMapLocationClientOption setOffset(boolean isOffset)
isOffset - 是否偏转
public boolean isLocationCacheEnable()
public AMapLocationClientOption setLocationCacheEnable(boolean isLocationCacheEnable)
isLocationCacheEnable - 是否使用缓存策略
<public boolean isOnceLocationLatest()
public AMapLocationClientOption setOnceLocationLatest(boolean isOnceLocationLatest)
定位精度会更高,但是定位速度会变慢1-3秒
从3.7.0版本开始,支持连续定位(连续定位时首次会等待刷新) 3.7.0之前的版本,仅适用于单次定位,当设置为true时,连续定位会自动变为单次定位,
Location accuracy will be higher, but location speed will slow down by 1-3 seconds
Starting from version 3.7.0, continuous location is supported (first time will wait for refresh during continuous location) For versions before 3.7.0, it only applies to single location. When set to true, continuous location will automatically switch to single location,
isOnceLocationLatest - 是否等待WIFI列表刷新
public boolean isSensorEnable()
public AMapLocationClientOption setSensorEnable(boolean sensorEnable)
默认值:false 不使用设备传感器
Default value: false (do not use device sensor)
sensorEnable - 是否开启设备传感器,当设置为true时,网络定位可以返回海拔、角度和速度。
public AMapLocationClientOption setLastLocationLifeCycle(long lifeCycle)
lifeCycle - 跨应用缓存的有效时间, 默认30s
public long getLastLocationLifeCycle()
public AMapLocationClientOption.GeoLanguage getGeoLanguage()
public AMapLocationClientOption setGeoLanguage(AMapLocationClientOption.GeoLanguage geoLanguage)
默认值:AMapLocationClientOption.GeoLanguage.DEFAULT
Default value: AMapLocationClientOption.GeoLanguage.DEFAULT
geoLanguage - public static void setDownloadCoordinateConvertLibrary(boolean isDownload)
isDownload - public static boolean isDownloadCoordinateConvertLibrary()
public float getDeviceModeDistanceFilter()
只有当定位模式为AMapLocationClientOption.AMapLocationMode.Device_Sensors(仅设备模式)或 AMapLocationClientOption.AMapLocationMode.Hight_Accuracy(高精度模式)有效
Only valid when the location mode is AMapLocationClientOption.AMapLocationMode.Device_Sensors (device-only mode) or AMapLocationClientOption.AMapLocationMode.Hight_Accuracy (high-accuracy mode)
public AMapLocationClientOption setDeviceModeDistanceFilter(float distanceFilter)
只有当定位模式为AMapLocationClientOption.AMapLocationMode.Device_Sensors(仅设备模式)或 AMapLocationClientOption.AMapLocationMode.Hight_Accuracy(高精度模式)有效,值小于0时无效
Only valid when the positioning mode is AMapLocationClientOption.AMapLocationMode.Device_Sensors (device-only mode) or AMapLocationClientOption.AMapLocationMode.Hight_Accuracy (high-accuracy mode), invalid if the value is less than 0
distanceFilter - public AMapLocationClientOption setLocationPurpose(AMapLocationClientOption.AMapLocationPurpose locationPurpose)
AMapLocationClient.startLocation()使其生效当不需要场景时,可以设置为NULL,
注意:AMapLocationClient.stopLocation(),然后主动调用一次AMapLocationClient.startLocation()以保证option正确生效AMapLocationClient.startLocation() to make it take effectWhen no scenario is needed, it can be set to NULL,
Note:AMapLocationClient.stopLocation() once, then actively call AMapLocationClient.startLocation() once to ensure the option takes effect correctlylocationPurpose - 定位场景, 默认值 :NULL(无场景设置)
public AMapLocationClientOption.AMapLocationPurpose getLocationPurpose()
public java.lang.String toString()
toString 在类中 java.lang.Objectpublic int describeContents()
describeContents 在接口中 android.os.Parcelablepublic void writeToParcel(android.os.Parcel dest,
int flags)
writeToParcel 在接口中 android.os.Parcelablepublic static boolean isOpenAlwaysScanWifi()
public static void setOpenAlwaysScanWifi(boolean openAlwaysScanWifi)
openAlwaysScanWifi - 是否开启
public static void setScanWifiInterval(long interval)
interval - public long getScanWifiInterval()