| 程序包 | 说明 |
|---|---|
| com.amap.api.fence | |
| com.amap.api.location |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
GeoFenceClient.setLocationClientOption(AMapLocationClientOption option) |
| 限定符和类型 | 字段和说明 |
|---|---|
static android.os.Parcelable.Creator<AMapLocationClientOption> |
AMapLocationClientOption.CREATOR |
| 限定符和类型 | 方法和说明 |
|---|---|
AMapLocationClientOption |
AMapLocationClientOption.clone()
获取AMapLocationClientOption对象的拷贝
Get a copy of the AMapLocationClientOption object |
AMapLocationClientOption |
AMapLocationClientOption.setBeidouFirst(boolean isBeidouFirst)
设置是否优先使用北斗定位
默认值 false
|
AMapLocationClientOption |
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
|
AMapLocationClientOption |
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 |
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 |
AMapLocationClientOption.setGpsFirstTimeout(long timeout)
设置优先返回卫星定位信息时等待卫星定位结果的超时时间,单位:毫秒
只有在
setGpsFirst(boolean)设置为true时才有效。 |
AMapLocationClientOption |
AMapLocationClientOption.setH5LocationFileAccessEnabled(boolean h5LocationFileAccessEnabled)
设置H5辅助定位是否允许传入WebView访问文件。
|
AMapLocationClientOption |
AMapLocationClientOption.setH5LocationJavaScriptEnabled(boolean h5LocationJavaScriptEnabled)
设置H5辅助定位是否允许SDK开启传入WebView的JavaScript。
|
AMapLocationClientOption |
AMapLocationClientOption.setHttpTimeOut(long httpTimeOut)
设置联网超时时间
单位:毫秒 默认值:30000毫秒 Set network timeout Unit: milliseconds Default value: 30000 milliseconds |
AMapLocationClientOption |
AMapLocationClientOption.setInterval(long interval)
设置发起定位请求的时间间隔
单位:毫秒 默认值:2000毫秒 Set the time interval for initiating location requests Unit: milliseconds Default value: 2000 milliseconds |
AMapLocationClientOption |
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 |
AMapLocationClientOption.setLastLocationLifeCycle(long lifeCycle)
设置跨应用缓存的有效时间 单位:毫秒(ms)
Set the validity time of cross-application cache. |
AMapLocationClientOption |
AMapLocationClientOption.setLocationCacheEnable(boolean isLocationCacheEnable)
设置是否使用缓存策略, 默认为true 使用缓存策略
Set whether to use cache strategy, default is true (use cache strategy) |
AMapLocationClientOption |
AMapLocationClientOption.setLocationMode(AMapLocationClientOption.AMapLocationMode locationMode)
设置定位模式
Set location mode |
AMapLocationClientOption |
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 |
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 |
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)
|
AMapLocationClientOption |
AMapLocationClientOption.setOffset(boolean isOffset)
设置是否偏转, 默认为true 偏转
Set whether to deflect, default is true (deflection) |
AMapLocationClientOption |
AMapLocationClientOption.setOnceLocation(boolean isOnceLocation)
设置是否单次定位
默认值:false Set whether to perform single location Default value: false |
AMapLocationClientOption |
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. |
AMapLocationClientOption |
AMapLocationClientOption.setSensorEnable(boolean sensorEnable)
设置是否使用设备传感器
默认值:false 不使用设备传感器
Set whether to use device sensor Default value: false (do not use device sensor) |
AMapLocationClientOption |
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 |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
AMapLocationClient.setLocationOption(AMapLocationClientOption option)
设置定位参数
Set location parameters |
void |
AMapLocationClient.startAssistantLocation(android.webkit.WebView webView,
AMapLocationClientOption option)
启动H5辅助定位,并配置SDK对传入WebView的WebSettings处理。
|