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

!8791 翻译完成:8627 添加requestPermissionsFromUser的promise描述 Cherry-Pick

Merge pull request !8791 from wusongqing/cherry-pick-1661586116
...@@ -174,7 +174,7 @@ Requests certain permissions from the system. This API uses an asynchronous call ...@@ -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**. | | permissions | Array\<string> | Yes | Permissions to request. This parameter cannot be **null**. |
| requestCode | number | Yes | Request code to be passed to **PermissionRequestResult**.| | 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** **Example**
...@@ -195,6 +195,44 @@ context.requestPermissionsFromUser( ...@@ -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> ## Context.getApplicationInfo<sup>7+</sup>
...@@ -991,7 +1029,7 @@ context.getHapModuleInfo().then((data) => { ...@@ -991,7 +1029,7 @@ context.getHapModuleInfo().then((data) => {
getAppVersionInfo(callback: AsyncCallback\<AppVersionInfo>): void 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 **System capability**: SystemCapability.Ability.AbilityRuntime.Core
...@@ -1019,7 +1057,7 @@ context.getAppVersionInfo((err, data) => { ...@@ -1019,7 +1057,7 @@ context.getAppVersionInfo((err, data) => {
getAppVersionInfo(): Promise\<AppVersionInfo> 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 **System capability**: SystemCapability.Ability.AbilityRuntime.Core
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册