Skip to content

Commit a8f4119

Browse files
ding-chengjie林志鹏
authored and
林志鹏
committed
!1203 docs: [Issues: #IAFLBX] 补充组件中权限的使用说明并修正实际的接口列表
* docs: [Issues: #IAFLBX] 补充组件中权限的使用说明并修正实际的接口列表
1 parent 11a9f4a commit a8f4119

File tree

1 file changed

+48
-36
lines changed

1 file changed

+48
-36
lines changed

zh-cn/react-native-amap-geolocation.md

+48-36
Original file line numberDiff line numberDiff line change
@@ -246,12 +246,12 @@ ohpm install
246246

247247
```diff
248248
...
249-
+ import {AmapGeolocationPackage} from '@react-native-oh-tpl/react-native-amap-geolocation';
249+
+ import {AMapGeolocationPackage} from '@react-native-oh-tpl/react-native-amap-geolocation';
250250

251251
export function createRNPackages(ctx: RNPackageContext): RNPackage[] {
252252
return [
253253
new SamplePackage(ctx),
254-
+ new AmapGeolocationPackage(ctx)
254+
+ new AMapGeolocationPackage(ctx)
255255
];
256256
}
257257
```
@@ -277,43 +277,54 @@ ohpm install
277277

278278
请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[@react-native-oh-tpl/react-native-amap-geolocation Releases](https://github.com/react-native-oh-library/react-native-amap-geolocation/releases)
279279

280+
### 权限要求
280281

281-
## 属性
282+
#### 在 entry 目录下的module.json5中添加权限
282283

283-
> [!TIP] "Platform"列表示该属性在原三方库上支持的平台。
284+
打开 `entry/src/main/module.json5`,添加:
284285

285-
> [!TIP] "HarmonyOS Support"列为 yes 表示 HarmonyOS 平台支持该属性;no 则表示不支持;partially 表示部分支持。使用方法跨平台一致,效果对标 iOS 或 Android 的效果。
286+
```
287+
...
288+
"requestPermissions": [
289+
{
290+
"name": "ohos.permission.LOCATION",
291+
"reason": "$string:Access_Location",
292+
"usedScene": {
293+
"when":"inuse"
294+
}
295+
},
296+
{
297+
"name": "ohos.permission.APPROXIMATELY_LOCATION",
298+
"reason": "$string:Access_AppRoximatelyLocation",
299+
"usedScene": {
300+
"when":"inuse"
301+
}
302+
}
303+
{
304+
"name": "ohos.permission.INTERNET",
305+
}
306+
]
307+
```
286308

287-
| Name | Description | Type | Required | Platform | HarmonyOS Support |
288-
| ---- | ----------- | ---- | -------- | -------- | ------------------ |
289-
| code | 错误代码 | number | yes | iOS/Android | yes |
290-
| message | 错误信息 | string | yes | iOS/Android | yes |
291-
| android | Android平台 | string | yes | iOS/Android | yes |
292-
| iOS | iOS平台 | string | yes | iOS/Android | yes |
293-
| accuracy | 定位精度 (米) | number | yes | iOS/Android | yes |
294-
| altitude | 海拔(米),需要 GPS | number | yes | iOS/Android | yes |
295-
| altitudeAccuracy | 海拔精度 | number | yes | iOS/Android | yes |
296-
| latitude | 经度,[-180, 180] | number | yes | iOS/Android | yes |
297-
| longitude | 纬度,[-90, 90] | number | yes | iOS/Android | yes |
298-
| speed | 移动速度(米/秒),需要 GPS | number | yes | iOS/Android | yes |
299-
| coordinateType | 坐标系类型 | string | yes | Android | yes |
300-
| errorInfo | 错误信息 | string | yes | iOS/Android | yes |
301-
| heading | 移动方向,需要 GPS | number | yes | iOS/Android | yes |
302-
| locationDetail | 定位信息描述 | string | yes | Android | yes |
303-
| timestamp | 定位时间(毫秒) | number | yes | iOS/Android | yes |
304-
| distanceFilter | 位置信息的距离过滤器,用于限制位置更新的触发频率 | number | yes | iOS/Android | yes |
305-
| enableHighAccuracy | 是否启用高精度模式来获取位置信息。 | boolean | yes | iOS/Android | yes |
306-
| maximumAge | 获取位置信息的最大缓存时间 | number | yes | iOS/Android | yes |
307-
| timeout | 获取位置信息的超时时间 | number | yes | iOS/Android | yes |
308-
| address | 详细地址 | number | yes | iOS/Android | yes |
309-
|city | 城市 | string | yes | iOS/Android | yes |
310-
| cityCode | 城市编码 | string | yes | iOS/Android | yes |
311-
| country | 国家 | string | yes | iOS/Android | yes |
312-
| district | 地区 | string | yes | iOS/Android | yes |
313-
| poiName | 兴趣点 | string | yes | iOS/Android | yes |
314-
| province | 省份 | string | yes | iOS/Android | yes |
315-
| street | 街道 | string | yes | iOS/Android | yes |
316-
| streetNumber | 门牌号 | string | yes | iOS/Android | yes |
309+
#### 在 entry 目录下添加位置权限的原因
310+
311+
打开 `entry/src/main/resources/base/element/string.json`,添加:
312+
313+
```
314+
...
315+
{
316+
"string": [
317+
{
318+
"name": "Access_Location",
319+
"value": "access Location"
320+
}
321+
{
322+
"name": "Access_AppRoximatelyLocation",
323+
"value": "access AppRoximatelyLocation"
324+
}
325+
]
326+
}
327+
```
317328

318329

319330
## API
@@ -334,7 +345,7 @@ ohpm install
334345
| setGpsFirstTimeout | 设置优先返回卫星定位信息时等待卫星定位结果的超时时间(毫秒) | void | yes | Android | no |
335346
| setHttpTimeout | 设置联网超时时间(毫秒) | void | yes | Android | no |
336347
| setInterval | 设置发起定位请求的时间间隔(毫秒),默认 2000,最小值为 1000 | void | yes | Android | yes |
337-
| setLocatingWithReGeocode | 连续定位是否返回逆地理编码 | void | yes | iOS | yes |
348+
| setLocatingWithReGeocode | 连续定位是否返回逆地理编码 | void | yes | iOS | no |
338349
| setLocationCacheEnable | 设置是否使用缓存策略 | void | yes | Android | no |
339350
| setLocationMode | 设置定位模式 | void | yes | Android | no |
340351
| setLocationPurpose | 设置定位场景 | void | yes | Android | no |
@@ -367,6 +378,7 @@ ohpm install
367378
- [ ] setLocationCacheEnable()接口获取当前是否正在定位的状态,harmony暂不支持[issue#13](https://github.com/react-native-oh-library/react-native-amap-geolocation/issues/13)
368379
- [ ] setLocationMode()接口获取当前是否正在定位的状态,harmony暂不支持[issue#14](https://github.com/react-native-oh-library/react-native-amap-geolocation/issues/14)
369380
- [ ] setLocationPurpose()接口获取当前是否正在定位的状态,harmony暂不支持[issue#15](https://github.com/react-native-oh-library/react-native-amap-geolocation/issues/15)
381+
- [ ] setLocatingWithReGeocode()接口获取当前是否正在定位的状态设置连续定位是否返回逆地理编码,harmony暂不支持[issue#19](https://github.com/react-native-oh-library/react-native-amap-geolocation/issues/19)
370382

371383

372384
## 其他

0 commit comments

Comments
 (0)