未验证 提交 3d0f4f49 编写于 作者: O openharmony_ci 提交者: Gitee

!8736 翻译完成:8456 添加FA模型requestPermissionFromUser接口的promise描述

Merge pull request !8736 from wusongqing/TR8456
......@@ -174,7 +174,7 @@ Requests certain permissions from the system. This API uses an asynchronous call
| -------------- | ---------------------------------------- | ---- | ----------------------------------- |
| permissions | Array\<string> | Yes | Permissions to request. This parameter cannot be **null**. |
| requestCode | number | Yes | Request code to be passed to **PermissionRequestResult**.|
| resultCallback | AsyncCallback<[PermissionRequestResult](#permissionrequestresult)> | Yes | Permission request result. |
| resultCallback | AsyncCallback<[PermissionRequestResult](#permissionrequestresult)> | Yes | Callback used to return the permission request result. |
**Example**
......@@ -195,6 +195,44 @@ context.requestPermissionsFromUser(
```
## Context.requestPermissionsFromUser<sup>7+</sup>
requestPermissionsFromUser(permissions: Array\<string>, requestCode: number): Promise\<[PermissionRequestResult](#permissionrequestresult7)>
Requests certain permissions from the system. This API uses a promise to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Parameters**
| Name | Type | Mandatory | Description |
| -------------- | ------------------- | ----- | -------------------------------------------- |
| permissions | Array\<string> | Yes | Permissions to request. This parameter cannot be **null**. |
| requestCode | number | Yes | Request code to be passed to **PermissionRequestResult**.|
**Return value**
| Type | Description |
| ------------------------------------------------------------- | ---------------- |
| Promise\<[PermissionRequestResult](#permissionrequestresult7)> | Promise used to return the permission request result.|
**Example**
```js
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext();
context.requestPermissionsFromUser(
["com.example.permission1",
"com.example.permission2",
"com.example.permission3",
"com.example.permission4",
"com.example.permission5"],
1).then((data)=>{
console.info("====>requestdata====>" + JSON.stringify(data));
});
```
## Context.getApplicationInfo<sup>7+</sup>
......@@ -991,7 +1029,7 @@ context.getHapModuleInfo().then((data) => {
getAppVersionInfo(callback: AsyncCallback\<AppVersionInfo>): void
Obtains the version information of this application. This API uses an asynchronous callback to return the result.
Obtains the version information of the application. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
......@@ -1019,7 +1057,7 @@ context.getAppVersionInfo((err, data) => {
getAppVersionInfo(): Promise\<AppVersionInfo>
Obtains the version information of this application. This API uses a promise to return the result.
Obtains the version information of the application. This API uses a promise to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册