@@ -64,7 +64,7 @@ For details about the error codes, see [Application Access Control Error Codes](
| ID| Error Message|
| -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0, or the permissionName is greater than 256 bytes. |
| 12100001 | The parameter is invalid. The tokenID is 0, or the permissionName exceeds 256 bytes. |
**Example**
...
...
@@ -111,7 +111,7 @@ For details about the error codes, see [Application Access Control Error Codes](
| ID| Error Message|
| -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0, or the permissionName is greater than 256 bytes. |
| 12100001 | The parameter is invalid. The tokenID is 0, or the permissionName exceeds 256 bytes. |
**Example**
...
...
@@ -154,7 +154,7 @@ For details about the error codes, see [Application Access Control Error Codes](
| ID| Error Message|
| -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0, the permissionName is greater than 256 bytes, or the flags value is invalid. |
| 12100001 | The parameter is invalid. The tokenID is 0, the permissionName exceeds 256 bytes, or the flags value is invalid. |
| 12100002 | The specified tokenID does not exist. |
| 12100003 | The specified permission does not exist. |
| 12100006 | The application specified by the tokenID is not allowed to be granted with the specified permission. Either the application is a sandbox or the tokenID is from a remote device. |
...
...
@@ -206,7 +206,7 @@ For details about the error codes, see [Application Access Control Error Codes](
| ID| Error Message|
| -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0, the permissionName is greater than 256 bytes, or the flags value is invalid. |
| 12100001 | The parameter is invalid. The tokenID is 0, the permissionName exceeds 256 bytes, or the flags value is invalid. |
| 12100002 | TokenId does not exist. |
| 12100003 | Permission does not exist. |
| 12100006 | The application specified by the tokenID is not allowed to be granted with the specified permission. Either the application is a sandbox or the tokenID is from a remote device. |
...
...
@@ -265,7 +265,7 @@ For details about the error codes, see [Application Access Control Error Codes](
| ID| Error Message|
| -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0, the permissionName is greater than 256 bytes, or the flags value is invalid. |
| 12100001 | The parameter is invalid. The tokenID is 0, the permissionName exceeds 256 bytes, or the flags value is invalid. |
| 12100002 | The specified tokenID does not exist. |
| 12100003 | The specified permission does not exist. |
| 12100006 | The application specified by the tokenID is not allowed to be revoked with the specified permission. Either the application is a sandbox or the tokenID is from a remote device. |
...
...
@@ -317,7 +317,7 @@ For details about the error codes, see [Application Access Control Error Codes](
| ID| Error Message|
| -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0, the permissionName is greater than 256 bytes, or the flags value is invalid. |
| 12100001 | The parameter is invalid. The tokenID is 0, the permissionName exceeds 256 bytes, or the flags value is invalid. |
| 12100002 | TokenId does not exist. |
| 12100003 | Permission does not exist. |
| 12100006 | The application specified by the tokenID is not allowed to be revoked with the specified permission. Either the application is a sandbox or the tokenID is from a remote device. |
...
...
@@ -375,7 +375,7 @@ For details about the error codes, see [Application Access Control Error Codes](
| ID| Error Message|
| -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0, or the permissionName is greater than 256 bytes. |
| 12100001 | The parameter is invalid. The tokenID is 0, or the permissionName exceeds 256 bytes. |
| 12100002 | The specified tokenID does not exist. |
| 12100003 | The specified permission does not exist. |
| 12100006 | The operation is not allowed. Either the application is a sandbox or the tokenID is from a remote device. |
...
...
@@ -452,7 +452,7 @@ For details about the error codes, see [Application Access Control Error Codes](
| ID| Error Message|
| -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0, or the permissionName is greater than 256 bytes. |
| 12100001 | The parameter is invalid. The tokenID is 0, or the permissionName exceeds 256 bytes. |
| 12100004 | The interface is called repeatedly with the same input. |
| 12100005 | The registration time has exceeded the limitation. |
| 12100007 | Service is abnormal. |
...
...
@@ -462,10 +462,10 @@ For details about the error codes, see [Application Access Control Error Codes](
| tokenID | number | Yes | Token ID of the application. The value can be obtained from [ApplicationInfo](js-apis-bundleManager-applicationInfo.md). |
| permissionName | Permissions | Yes | Permission to verify. For details about the permissions, see the [Application Permission List](../../security/permission-list.md).|
| permissionName | Permissions | Yes | Permission to verify. For details about the permissions, see the [Application Permission List](../../security/permission-list.md).|
Requests permissions from the user in a dialog box. This API uses an asynchronous callback to return the result.
Requests user authorization in a dialog box opened by a UIAbility. This API uses an asynchronous callback to return the result.
> **NOTE**
>
> The API cannot be called by any non-UIAbility.
**Model restriction**: This API can be used only in the stage model.
...
...
@@ -578,7 +581,7 @@ Requests permissions from the user in a dialog box. This API uses an asynchronou
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| context | Context | Yes| Ability context of the application that requests the permissions. |
| context | Context | Yes| Context of the UIAbility.|
| permissionList | Array<Permissions> | Yes| Permissions requested. For details about the permissions, see the [Application Permission List](../../security/permission-list.md).|
| callback | AsyncCallback<[PermissionRequestResult](js-apis-permissionrequestresult.md)> | Yes| Callback invoked to return the result.|
Requests permissions from the user in a dialog box. This API uses a promise to return the result.
Requests user authorization in a dialog box opened by a UIAbility. This API uses a promise to return the result.
> **NOTE**
>
> The API cannot be called by any non-UIAbility.
**Model restriction**: This API can be used only in the stage model.
...
...
@@ -620,7 +627,7 @@ Requests permissions from the user in a dialog box. This API uses a promise to
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| context | Context | Yes| Ability context of the application that requests the permissions. |
| context | Context | Yes| Context of the UIAbility.|
| permissionList | Array<Permissions> | Yes| Permissions requested. For details about the permissions, see the [Application Permission List](../../security/permission-list.md).|
| tokenID | number | Yes | Token ID of the application. The value can be obtained from [ApplicationInfo](js-apis-bundleManager-applicationInfo.md). |
| permissionName | string | Yes | Permission to check.|
| permissionName | string | Yes | Permission to verify.|
**Return value**
...
...
@@ -730,4 +737,3 @@ Defines detailed information about the permission grant state change.
| change | [PermissionStateChangeType](#permissionstatechangetype9) | Yes | No | Operation that triggers the permission grant state change. |
| tokenID | number | Yes | No | Token ID of the application. |
| permissionName | Permissions | Yes | No | Permission whose grant state changes. For details about the permissions, see the [Application Permission List](../../security/permission-list.md). |
Adds an app account name and additional information. This API uses an asynchronous callback to return the result. This API uses a promise to return the result.
> **NOTE**
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [createAccount](#createaccount9-2).
...
...
@@ -4289,10 +4292,12 @@ Obtains the authenticator callback for an authentication session. This API uses
> This enum is supported since API version 8 and deprecated since API version 9. Error codes are used from API version 9. For details, see [Account Management Error Codes](../errorcodes/errorcode-account.md).
| src | string | Yes | Application sandbox path of the source file.|
| dest | string | Yes | Application sandbox path of the destination file.|
| dest | string | Yes | Application sandbox path of the destination file.|
| mode | number | No | Whether to overwrite the file of the same name in the destination directory. The value **0** means to overwrite the file of the same name in the destination directory. The value **1** means to throw an exception if a file of the same name exists in the destination directory. The default value is **0**.|
**Example**
...
...
@@ -1764,7 +1764,7 @@ Moves a file. This API uses an asynchronous callback to return the result.
| src | string | Yes | Application sandbox path of the source file.|
| dest | string | Yes | Application sandbox path of the destination file.|
| dest | string | Yes | Application sandbox path of the destination file.|
| mode | number | No | Whether to overwrite the file of the same name in the destination directory. The value **0** means to overwrite the file of the same name in the destination directory. The value **1** means to throw an exception if a file of the same name exists in the destination directory. The default value is **0**.|
| callback | AsyncCallback<void> | Yes | Callback invoked when the file is moved. |
| src | string | Yes | Application sandbox path of the source file.|
| dest | string | Yes | Application sandbox path of the destination file.|
| dest | string | Yes | Application sandbox path of the destination file.|
| mode | number | No | Whether to overwrite the file of the same name in the destination directory. The value **0** means to overwrite the file of the same name in the destination directory. The value **1** means to throw an exception if a file of the same name exists in the destination directory. The default value is **0**.|
**Example**
...
...
@@ -1938,7 +1938,7 @@ Creates a stream based on the file path. This API uses an asynchronous callback
| path | string | Yes | Application sandbox path of the file. |
| mode | string | Yes | - **r**: Open a file for reading. The file must exist.<br>- **r+**: Open a file for both reading and writing. The file must exist.<br>- **w**: Open a file for writing. If the file exists, clear its content. If the file does not exist, create a file.<br>- **w+**: Open a file for both reading and writing. If the file exists, clear its content. If the file does not exist, create a file.<br>- **a**: Open a file in append mode for writing at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).<br>- **a+**: Open a file in append mode for reading or updating at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).|
| callback | AsyncCallback<[Stream](#stream)> | Yes | Callback invoked when the stream is open asynchronously. |
| callback | AsyncCallback<[Stream](#stream)> | Yes | Callback invoked when the stream is created asynchronously. |
**Picker** encapsulates the system applications such as **PhotoViewPicker**, **DocumentViewPicker** and **AudioViewPicker** to provide capabilities of selecting and saving files of different types. The application can select the picker as required.
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
**Picker** encapsulates system applications, such as **PhotoViewPicker**, **DocumentViewPicker**, and **AudioViewPicker**, and provides capabilities of selecting and saving images, videos, documents, and audio clips. The application can select the picker as required.
## Modules to Import
```js
importpickerfrom'@ohos.file.picker';
...
...
@@ -27,7 +27,7 @@ let photoPicker = new picker.PhotoViewPicker();
Selects one or more images or videos in a **photoPicker** page. This API uses a promise to return the result. You can pass in **PhotoSelectOptions** to specify the media type and the maximum number of files to select.
Selects one or more images or videos in a **photoPicker** page. This API uses a promise to return the result. You can pass in **PhotoSelectOptions** to specify the media file type and the maximum number of files to select.
| option | [PhotoSelectOptions](#photoselectoptions) | No | Options for selecting images or videos.|
| option | [PhotoSelectOptions](#photoselectoptions) | No | Options for selecting files. If this parameter is not specified, images and videos are selected by default. A maximum of 50 files can be selected.|
Selects one or more images or videos in a **photoPicker** page. This API uses an asynchronous callback to return the result. You can pass in **PhotoSelectOptions** to specify the media type and the maximum number of files to select.
Selects one or more images or videos in a **photoPicker** page. This API uses an asynchronous callback to return the result. You can pass in **PhotoSelectOptions** to specify the media file type and the maximum number of files to select.
| option | [PhotoSaveOptions](#photosaveoptions) | No | Options for saving images or videos.|
| option | [PhotoSaveOptions](#photosaveoptions) | No | Options for saving files. If this parameter is not specified, a **photoPicker** page will be displayed for the user to enter the names of the files to save.|
**Return value**
...
...
@@ -265,7 +265,7 @@ Selects one or more documents in a **documentPicker** page. This API uses a prom
| option | [DocumentSelectOptions](#documentselectoptions) | No | Options for selecting documents.|
| option | [DocumentSelectOptions](#documentselectoptions) | No | Options for select documents. If this parameter is not specified, the **documentPicker** page is displayed by default.|
**Return value**
...
...
@@ -372,13 +372,13 @@ Saves one or more documents in a **documentPicker** page. This API uses a promis
| option | [DocumentSaveOptions](#documentsaveoptions) | No | Options for saving the documents.|
| option | [DocumentSaveOptions](#documentsaveoptions) | No | Options for saving the documents. If this parameter is not specified, a **documentPicker** page will be displayed for the user to enter the names of the documents to save.|
**Return value**
| Type | Description |
| ----------------------------- | :---- |
| Promise<Array<string>>| Promise used to return the URIs of the documents saved.|
| Promise<Array<string>> | Promise used to return the URIs of the documents saved.|
**Example**
...
...
@@ -492,7 +492,7 @@ Selects one or more audio files in an **audioPicker** page (currently, a **docum
| option | [AudioSelectOptions](#audioselectoptions) | No | Options for selecting audio files.|
| option | [AudioSelectOptions](#audioselectoptions) | No | Options for selecting the audio files. If this parameter is not specified, the **audioPicker** page is displayed by default. |
Saves one or more audio files in an **audioPicker** page (currently, a **documentPicker** page is displayed). This API uses a promise to return the result. You can pass in **AudioSaveOptions** to specify the file names of the audio clips to save.
Saves one or more audio files in an **audioPicker** page (currently, a **documentPicker** page is displayed). This API uses a promise to return the result. You can pass in **AudioSaveOptions** to specify the names of the audio files to save.
| option | [AudioSaveOptions](#audiosaveoptions) | No | Options for saving audio files.|
| option | [AudioSaveOptions](#audiosaveoptions) | No | Options for saving audio files. If this parameter is not specified, an **audioPicker** page will be displayed for the user to enter the names of the files to save.|
Saves one or more audio files in an **audioPicker** page (currently, a **documentPicker** page is displayed). This API uses an asynchronous callback to return the result. You can pass in **AudioSaveOptions** to specify the file names of the audio clips to save.
Saves one or more audio files in an **audioPicker** page (currently, a **documentPicker** page is displayed). This API uses an asynchronous callback to return the result. You can pass in **AudioSaveOptions** to specify the names of the audio files to save.
| newFileNames? | Array<string> | No | File names of the documents to save.|
| newFileNames? | Array<string> | No | Names of the documents to save. If this parameter is not specified, the user needs to enter the document names. |
## AudioSelectOptions
Defines the options for selecting audio clips. Currently, this parameter cannot be configured.
Defines the options for selecting audio files. Currently, this parameter cannot be configured.
| newFileNames? | Array<string> | No | File names of the audio clips to save.|
| newFileNames? | Array<string> | No | Name of the audio files to save. If this parameter is not specified, the user needs to enter the file names.|
| type | 'activate' \| 'activating' | Yes | Type of the event to subscribe to. The value **activate**means an event indicating that an OS account is activated, and **activating** means an event indicating that an OS account is being activated.|
| type | 'activate' \| 'activating' | Yes | Type of the event to subscribe to. The value **activate**indicates the state of an OS account activated, and **activating** indicates the state of an OS account being activated.|
| name | string | Yes | Subscription name, which can be customized. The value cannot be empty or exceed 1024 bytes. |
| callback | Callback<number> | Yes | Callback invoked to return the ID of the OS account being activated or activated. |
...
...
@@ -2432,7 +2432,7 @@ Unsubscribes from the OS account activation states, including the states of the
| type | 'activate' \| 'activating' | Yes | Type of the event to unsubscribe from. The value **activate**means an event indicating that an OS account is activated, and **activating** means an event indicating that an OS account is being activated.|
| type | 'activate' \| 'activating' | Yes | Type of the event to unsubscribe from. The value **activate**indicates the state of an OS account activated, and **activating** indicates the state of an OS account being activated.|
| name | string | Yes | Subscription name, which can be customized. The value cannot be empty or exceed 1024 bytes, and must be the same as the value passed by **on()**.|
| callback | Callback<number> | No | Callback to unregister. By default, **0** is returned. |
...
...
@@ -2642,7 +2642,7 @@ Obtains the constraint source information of an OS account. This API uses an asy
| -------- | ------------- |
| 12300001 | system service exception. |
| 12300002 | invalid name or constraint. |
| 12300003 | the account indicated by localId dose not exist. |
| 12300003 | The account indicated by localId dose not exist. |
**Example**
...
...
@@ -2689,7 +2689,7 @@ Obtains the constraint source information of an OS account. This API uses a prom
| -------- | ------------- |
| 12300001 | system service exception. |
| 12300002 | invalid name or constraint. |
| 12300003 | the account indicated by localId dose not exist. |
| 12300003 | The account indicated by localId dose not exist. |
**Example**
...
...
@@ -3600,7 +3600,7 @@ Obtains the type of the account to which the current process belongs. This API u