未验证 提交 7e7545c7 编写于 作者: O openharmony_ci 提交者: Gitee

!15975 doc fix pick to monthly

Merge pull request !15975 from 褚晨辉/doc-fix-release
......@@ -662,7 +662,7 @@ on(type: 'nmeaMessage', callback: Callback<string>): void;
订阅GNSS NMEA信息上报事件。
**需要权限**:ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
**需要权限**:ohos.permission.LOCATION ohos.permission.APPROXIMATELY_LOCATION
**系统能力**:SystemCapability.Location.Location.Gnss
......@@ -705,7 +705,7 @@ off(type: 'nmeaMessage', callback?: Callback<string>): void;
取消订阅GNSS NMEA信息上报事件。
**需要权限**:ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
**需要权限**:ohos.permission.LOCATION ohos.permission.APPROXIMATELY_LOCATION
**系统能力**:SystemCapability.Location.Location.Gnss
......@@ -882,7 +882,6 @@ on(type: 'countryCodeChange', callback: Callback<CountryCode>): void;
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
|3301000 | Location service is unavailable. |
|3301100 | The location switch is off. |
|3301500 | Failed to query the area information. |
......@@ -924,7 +923,6 @@ off(type: 'countryCodeChange', callback?: Callback<CountryCode>): void;
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
|3301000 | Location service is unavailable. |
|3301100 | The location switch is off. |
|3301500 | Failed to query the area information. |
**示例**
......
......@@ -21,44 +21,22 @@ ohos.permission.LOCATION
## geolocation.getLocation<sup>(deprecated)</sup>
getLocation(Object): void
getLocation(options?: GetLocationOption): void
获取设备的地理位置。
> **说明:**<br/>
> 从API version 9开始废弃,建议使用[geoLocationManager.getCurrentLocation](js-apis-geoLocationManager.md#geolocationmanagergetcurrentlocation)替代。
**需要权限**:ohos.permission.LOCATION
**系统能力:** SystemCapability.Location.Location.Lite
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| timeout | number | 否 | 超时时间,单位为ms,默认值为30000。<br/>设置超时,是为了防止出现权限被系统拒绝、定位信号弱或者定位设置不当,导致请求阻塞的情况。超时后会使用fail回调函数。<br/>取值范围为32位正整数。如果设置值小于等于0,系统按默认值处理。 |
| coordType | string | 否 | 坐标系的类型,可通过getSupportedCoordTypes获取可选值,缺省值为wgs84。 |
| success | Function | 否 | 接口调用成功的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 |
| complete | Function | 否 | 接口调用结束的回调函数。 |
success返回值:
| 参数名 | 类型 | 说明 |
| -------- | -------- | -------- |
| longitude | number | 设备位置信息:经度。 |
| latitude | number | 设备位置信息:纬度。 |
| altitude | number | 设备位置信息:海拔。 |
| accuracy | number | 设备位置信息:精确度。 |
| time | number | 设备位置信息:时间。 |
fail返回错误代码:
| 错误码 | 说明 |
| -------- | -------- |
| 601 | 获取定位权限失败,失败原因:用户拒绝。 |
| 602 | 权限未声明。 |
| 800 | 超时,失败原因:网络状况不佳或GNSS不可用。 |
| 801 | 系统位置开关未打开。 |
| 802 | 该次调用结果未返回前接口又被重新调用,该次调用失败返回错误码。 |
| options | [GetLocationOption](#getlocationoptiondeprecated) | 否 | 单次定位请求的配置参数。 |
**示例:**
......@@ -80,7 +58,7 @@ export default {
## geolocation.getLocationType<sup>(deprecated)</sup>
getLocationType(Object): void
getLocationType(options?: GetLocationTypeOption): void
获取当前设备支持的定位类型。
......@@ -93,15 +71,7 @@ getLocationType(Object): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| success | Function | 否 | 接口调用成功的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 |
| complete | Function | 否 | 接口调用结束的回调函数。 |
success返回值:
| 参数名 | 类型 | 说明 |
| -------- | -------- | -------- |
| types | Array&lt;string&gt; | 可选的定位类型['gps',&nbsp;'network']。 |
| options | [GetLocationTypeOption](#getlocationtypeoptiondeprecated) | 否 | 回调函数,用于接收查询结果,或者接收查询失败的结果。 |
**示例:**
......@@ -123,40 +93,22 @@ export default {
## geolocation.subscribe<sup>(deprecated)</sup>
subscribe(Object): void
subscribe(options: SubscribeLocationOption): void
订阅设备的地理位置信息。多次调用的话,只有最后一次的调用生效。
> **说明:**<br/>
> 从API version 9开始废弃,建议使用[geoLocationManager.on('locationChange')](js-apis-geoLocationManager.md#geolocationmanageronlocationchange)替代。
**需要权限**:ohos.permission.LOCATION
**系统能力:** SystemCapability.Location.Location.Lite
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| coordType | string | 否 | 坐标系的类型,可通过getSupportedCoordTypes获取可选值,默认值为wgs84。 |
| success | Function | 是 | 位置信息发生变化的回调函数。 |
| fail | Function | 否 | 接口调用失败的回调函数。 |
success返回值:
| 参数名 | 类型 | 说明 |
| -------- | -------- | -------- |
| longitude | number | 设备位置信息:经度。 |
| latitude | number | 设备位置信息:纬度。 |
| altitude | number | 设备位置信息:海拔。 |
| accuracy | number | 设备位置信息:精确度。 |
| time | number | 设备位置信息:时间。 |
fail返回错误代码:
| 错误码 | 说明 |
| -------- | -------- |
| 601 | 获取定位权限失败,失败原因:用户拒绝。 |
| 602 | 权限未声明。 |
| 801 | 系统位置开关未打开。 |
| options | [SubscribeLocationOption](#subscribelocationoptiondeprecated) | 是 | 持续定位的配置参数。 |
**示例:**
......@@ -185,6 +137,8 @@ unsubscribe(): void
> **说明:**<br/>
> 从API version 9开始废弃,建议使用[geoLocationManager.off('locationChange')](js-apis-geoLocationManager.md#geolocationmanagerofflocationchange)替代。
**需要权限**:ohos.permission.LOCATION
**系统能力:** SystemCapability.Location.Location.Lite
**示例:**
......@@ -223,4 +177,103 @@ export default {
var types = geolocation.getSupportedCoordTypes();
},
}
```
\ No newline at end of file
```
## GetLocationOption<sup>(deprecated)</sup>
单次定位请求的配置参数。
> **说明:**<br/>
> 从API version 9开始废弃,建议使用[geoLocationManager.CurrentLocationRequest](js-apis-geoLocationManager.md#CurrentLocationRequest)替代。
**需要权限**:ohos.permission.LOCATION
**系统能力**:SystemCapability.Location.Location.Lite
| 名称 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| timeout | number | 否 | 超时时间,单位为ms,默认值为30000。<br/>设置超时,是为了防止出现权限被系统拒绝、定位信号弱或者定位设置不当,导致请求阻塞的情况。超时后会使用fail回调函数。<br/>取值范围为32位正整数。如果设置值小于等于0,系统按默认值处理。 |
| coordType | string | 否 | 坐标系的类型,可通过getSupportedCoordTypes获取可选值,缺省值为wgs84。 |
| success | (data: [GeolocationResponse](#geolocationresponsedeprecated)) => void | 否 | 接口调用成功的回调函数。 |
| fail | (data: string, code: number) => void | 否 | 接口调用失败的回调函数。data为错误信息,code为错误码。 |
| complete | () => void | 否 | 接口调用结束的回调函数。 |
fail返回错误代码:
| 错误码 | 说明 |
| -------- | -------- |
| 601 | 获取定位权限失败,失败原因:用户拒绝。 |
| 602 | 权限未声明。 |
| 800 | 超时,失败原因:网络状况不佳或GNSS不可用。 |
| 801 | 系统位置开关未打开。 |
| 802 | 该次调用结果未返回前接口又被重新调用,该次调用失败返回错误码。 |
## GeolocationResponse<sup>(deprecated)</sup>
位置信息,包含经度、纬度、定位精度等信息。
> **说明:**<br/>
> 从API version 9开始废弃,建议使用[geoLocationManager.Location](js-apis-geoLocationManager.md#location)替代。
**系统能力**:SystemCapability.Location.Location.Lite
| 名称 | 类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| longitude | number | 是 | 否 | 设备位置信息:经度。 |
| latitude | number | 是 | 否 | 设备位置信息:纬度。 |
| altitude | number | 是 | 否 | 设备位置信息:海拔。 |
| accuracy | number | 是 | 否 | 设备位置信息:精确度。 |
| time | number | 是 | 否 | 设备位置信息:时间。 |
## GetLocationTypeOption<sup>(deprecated)</sup>
查询定位类型接口的入参,用于存放回调函数,在查询成功或者失败时接收查询结果。
> **说明:**<br/>
> 从API version 9开始废弃。
**系统能力**:SystemCapability.Location.Location.Lite
| 名称 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| success | (data: [GetLocationTypeResponse](#getlocationtyperesponsedeprecated)) => void | 否 | 接口调用成功的回调函数。 |
| fail | (data: string, code: number) => void | 否 | 接口调用失败的回调函数。 |
| complete | () => void | 否 | 接口调用结束的回调函数。 |
## GetLocationTypeResponse<sup>(deprecated)</sup>
当前设备支持的定位类型列表
> **说明:**<br/>
> 从API version 9开始废弃。
**系统能力**:SystemCapability.Location.Location.Lite
| 名称 | 类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| types | Array&lt;string&gt; | 是 | 否 | 可选的定位类型['gps',&nbsp;'network']。 |
## SubscribeLocationOption<sup>(deprecated)</sup>
持续定位请求的配置参数。
> **说明:**<br/>
> 从API version 9开始废弃,建议使用[geoLocationManager.CurrentLocationRequest](js-apis-geoLocationManager.md#locationrequest)替代。
**需要权限**:ohos.permission.LOCATION
**系统能力**:SystemCapability.Location.Location.Lite
| 名称 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| coordType | string | 否 | 坐标系的类型,可通过getSupportedCoordTypes获取可选值,默认值为wgs84。 |
| success | (data: [GeolocationResponse](#geolocationresponsedeprecated)) => void | 是 | 位置信息发生变化的回调函数。 |
| fail | (data: string, code: number) => void | 否 | 接口调用失败的回调函数。 |
fail返回错误代码:
| 错误码 | 说明 |
| -------- | -------- |
| 601 | 获取定位权限失败,失败原因:用户拒绝。 |
| 602 | 权限未声明。 |
| 801 | 系统位置开关未打开。 |
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册