diff --git a/en/application-dev/reference/apis/js-apis-Context.md b/en/application-dev/reference/apis/js-apis-Context.md index c432f719593a2aa3f32db509b339b2cc783ea5b4..dc2f0ef50ad05bc74b3e7ba301c421dfc3dae741 100644 --- a/en/application-dev/reference/apis/js-apis-Context.md +++ b/en/application-dev/reference/apis/js-apis-Context.md @@ -174,7 +174,7 @@ Requests certain permissions from the system. This API uses an asynchronous call | -------------- | ---------------------------------------- | ---- | ----------------------------------- | | permissions | Array\ | 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.requestPermissionsFromUser7+ + +requestPermissionsFromUser(permissions: Array\, 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\ | 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.getApplicationInfo7+ @@ -991,7 +1029,7 @@ context.getHapModuleInfo().then((data) => { getAppVersionInfo(callback: AsyncCallback\): 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\ -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