The **uriPermissionManager** module provides APIs for granting permissions on a file to or revoking the granted permission from an application. The file is identified by a uniform resource identifier (URI).
## Modules to Import
...
...
@@ -14,15 +13,18 @@ The **uriPermissionManager** module provides APIs for granting permissions on a
@@ -32,6 +34,18 @@ Grants permission on the file of the specified URI to an application. This API u
| targetBundleName | string | Yes| Bundle name of the application, to which the permission is granted.|
| callback | AsyncCallback<number> | Yes| Callback invoked to return the result. If the operation is successful, **0** is returned; otherwise, **-1** is returned.|
**Error codes**
| ID| Error Message|
| -------- | -------- |
| 201 | Permissions denied. |
| 202 | Not System App. Interface caller is not a system app. |
| 401 | The parameter check failed. |
| 16500050 | Internal error. |
| 16500058 | Invalid URI flag. |
| 16500059 | Invalid URI type. |
| 16500060 | Sandbox application can not grant URI permission. |
**Example**
```js
...
...
@@ -46,12 +60,16 @@ Grants permission on the file of the specified URI to an application. This API u
@@ -95,13 +129,22 @@ Revokes the permission on the file of the specified URI from an application. Thi
| targetBundleName | string | Yes| Bundle name of the application, from which the permission is revoked.|
| callback | AsyncCallback<number> | Yes| Callback invoked to return the result. If the operation is successful, **0** is returned; otherwise, **-1** is returned.|
**Error codes**
| ID| Error Message|
| -------- | -------- |
| 201 | Permissions denied. |
| 202 | Not System App. Interface caller is not a system app. |