| 程序包 | 说明 |
|---|---|
| com.amap.api.location |
| 限定符和类型 | 方法和说明 |
|---|---|
AMapLocationClientOption.AMapLocationPurpose |
AMapLocationClientOption.getLocationPurpose()
获取定位场景
Get the positioning scenario |
static AMapLocationClientOption.AMapLocationPurpose |
AMapLocationClientOption.AMapLocationPurpose.valueOf(java.lang.String name)
返回带有指定名称的该类型的枚举常量。
|
static AMapLocationClientOption.AMapLocationPurpose[] |
AMapLocationClientOption.AMapLocationPurpose.values()
按照声明该枚举类型的常量的顺序, 返回
包含这些常量的数组。
|
| 限定符和类型 | 方法和说明 |
|---|---|
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 |