The **AuthorizationExtensionAbility** module provides APIs for implementing authorization to app accounts based on the ExtensionAbility framework.
> **NOTE**
>
> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
@@ -13,7 +13,7 @@ Applications can call the APIs to:
...
@@ -13,7 +13,7 @@ Applications can call the APIs to:
> **NOTE**
> **NOTE**
>
>
> - The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
## Modules to Import
...
@@ -39,9 +39,9 @@ Creates a **DeviceManager** instance. The **DeviceManager** instance is the entr
...
@@ -39,9 +39,9 @@ Creates a **DeviceManager** instance. The **DeviceManager** instance is the entr
| discoverParam | {[key: string]: Object} | Yes | Identifier of the device to discover. It specifies the type of the target to discover.<br>**discoverTargetType**: The default discovery target is device. The value is **1**.|
| discoverParam | {[key: string]: Object} | Yes | Identifier of the device to discover. It specifies the type of the target to discover.<br>**discoverTargetType**: The default discovery target is device. The value is **1**.|
| filterOptions | {[key: string]: Object} | No | Options for filtering discovered devices. The default value is **undefined**, which means to discover offline devices. The following **key** values are carried:<br>**availableStatus(0-1)**: Discover trusted devices only. The value **0** indicates that the device is untrusted.<br>- **0**: The device is offline. The client needs to call **bindTarget** to bind the device.<br>- **1**: The device is online and can be connected.<br>**discoverDistance(0-100)**: Discover devices within a certain distance (in cm) from the local device.<br>**authenticationStatus(0-1)**: Discover devices based on the authentication status.<br>- **0**: The device is not authenticated.<br>- **1**: The device has been authenticated.<br>**authorizationType(0-2)**: Discover devices based on the authorization type.<br>- **0**: device authenticated by a temporarily agreed session key.<br>- **1**: device authenticated by a key of the same account.<br>- **2**: devices authenticated by a credential key of different accounts.|
| filterOptions | {[key: string]: Object} | No | Options for filtering discovered devices. The default value is **undefined**, which means to discover offline devices. The following **key** values are carried:<br>**availableStatus(0-1)**: Discover trusted devices only. The value **0** indicates that the device is untrusted.<br>- **0**: The device is offline. The client needs to call **bindTarget** to bind the device.<br>- **1**: The device is online and can be connected.<br>**discoverDistance(0-100)**: Discover devices within a certain distance (in cm) from the local device.<br>**authenticationStatus(0-1)**: Discover devices based on the authentication status.<br>- **0**: The device is not authenticated.<br>- **1**: The device has been authenticated.<br>**authorizationType(0-2)**: Discover devices based on the authorization type.<br>- **0**: device authenticated by a temporarily agreed session key.<br>- **1**: device authenticated by a key of the same account.<br>- **2**: devices authenticated by a credential key of different accounts.|
| bindParam | {[key: string]: Object} | Yes | Authentication parameters. You can determine the key-value pair to be passed in. By default, the following **key** values are carried:<br>**bindType**: binding type.<br>- **1**: PIN.<br>- **2**: QR code.<br>- 3: NFC.<br>- 4: No interaction.<br>**targetPkgName**: bundle name of the target to bind.<br>**appName**: application that attempts to bind the target.<br>**appOperation**: reason for the application to bind the target.<br>**customDescription**: detailed description of the operation. |
| bindParam | {[key: string]: Object} | Yes | Authentication parameters. You can determine the key-value pair to be passed in. By default, the following **key** values are carried:<br>**bindType**: binding type.<br>- **1**: PIN.<br>- **2**: QR code.<br>- 3: NFC.<br>- 4: No interaction.<br>**targetPkgName**: bundle name of the target to bind.<br>**appName**: application that attempts to bind the target.<br>**appOperation**: reason for the application to bind the target.<br>**customDescription**: detailed description of the operation. |
| callback | AsyncCallback<{deviceId: string, }> | Yes | Callback invoked to return the authentication result.|
| callback | AsyncCallback<{deviceId: string, }> | Yes | Callback invoked to return the authentication result.|
| type | string | Yes | Event type. The value **'deviceStateChange'** indicates a device state change event.|
| type | string | Yes | Event type. The value **'deviceStateChange'** indicates a device state change event.|
| callback | Callback<{ action: [DeviceStateChange](#devicestatechange), device: [DeviceBasicInfo](#devicebasicinfo) }> | Yes | Callback invoked to return the device information and state. |
| callback | Callback<{ action: [DeviceStateChange](#devicestatechange), device: [DeviceBasicInfo](#devicebasicinfo) }> | Yes | Callback invoked to return the device information and state. |
**Example**
**Example**
...
@@ -754,10 +754,10 @@ Unsubscribes from changes in the device state.
...
@@ -754,10 +754,10 @@ Unsubscribes from changes in the device state.
| type | string | Yes | Event type. The value **'deviceStateChange'** indicates a device state change event. |
| type | string | Yes | Event type. The value **'deviceStateChange'** indicates a device state change event. |
| callback | Callback<{ action: [deviceStateChange](#devicestatechange), device: [DeviceBasicInfo](#devicebasicinfo) }> | No | Callback for the device information and state.|
| callback | Callback<{ action: [deviceStateChange](#devicestatechange), device: [DeviceBasicInfo](#devicebasicinfo) }> | No | Callback for the device information and state.|
**Example**
**Example**
...
@@ -783,10 +783,10 @@ Subscribes to device discovery events.
...
@@ -783,10 +783,10 @@ Subscribes to device discovery events.
| type | string | Yes | Event type. The value **'serviceDie'** indicates an event reported when the **DeviceManager** service is terminated unexpectedly.|
| type | string | Yes | Event type. The value **'serviceDie'** indicates an event reported when the **DeviceManager** service is terminated unexpectedly.|
| callback | Callback<{}> | No | Callback invoked when a dead event of the **DeviceManager** service occurs. |
| callback | Callback<{}> | No | Callback invoked when a dead event of the **DeviceManager** service occurs. |
**Example**
**Example**
...
@@ -986,10 +986,10 @@ Unsubscribes from dead events of the **DeviceManager** service.
...
@@ -986,10 +986,10 @@ Unsubscribes from dead events of the **DeviceManager** service.
| type | string | Yes | Event type. The value **'serviceDie'** indicates an event reported when the **DeviceManager** service is terminated unexpectedly.|
| type | string | Yes | Event type. The value **'serviceDie'** indicates an event reported when the **DeviceManager** service is terminated unexpectedly.|
| callback | Callback<{}> | No | Callback for the dead event of the **DeviceManager** service. |
| callback | Callback<{}> | No | Callback for the dead event of the **DeviceManager** service. |
**Example**
**Example**
...
@@ -1002,4 +1002,4 @@ Unsubscribes from dead events of the **DeviceManager** service.
...
@@ -1002,4 +1002,4 @@ Unsubscribes from dead events of the **DeviceManager** service.
| ino | number | Yes | No | File ID. Different files on the same device have different **ino**s.| |
| ino | number | Yes | No | File ID. Different files on the same device have different **ino**s.| |
| mode | number | Yes | No | File permissions. The meaning of each bit is as follows:<br>- **0o400**: The owner has the read permission on a regular file or a directory entry.<br>- **0o200**: The owner has the permission to write a regular file or create and delete a directory entry.<br>- **0o100**: The owner has the permission to execute a regular file or search for the specified path in a directory.<br>- **0o040**: The user group has the read permission on a regular file or a directory entry.<br>- **0o020**: The user group has the permission to write a regular file or create and delete a directory entry.<br>- **0o010**: The user group has the permission to execute a regular file or search for the specified path in a directory.<br>- **0o004**: Other users have the permission to read a regular file or read a directory entry.<br>- **0o002**: Other users have the permission to write a regular file or create and delete a directory entry.<br>- **0o001**: Other users have the permission to execute a regular file or search for the specified path in a directory.|
| mode | number | Yes | No | File permissions. The meaning of each bit is as follows:<br>**NOTE**<br>The following values are in octal format. The returned values are in decimal format. You need to convert the values.<br>- **0o400**: The owner has the permission to read a regular file or a directory entry.<br>- **0o200**: The owner has the permission to write a regular file or create and delete a directory entry.<br>- **0o100**: The owner has the permission to execute a regular file or search for the specified path in a directory.<br>- **0o040**: The user group has the permission to read a regular file or a directory entry.<br>- **0o020**: The user group has the permission to write a regular file or create and delete a directory entry.<br>- **0o010**: The user group has the permission to execute a regular file or search for the specified path in a directory.<br>- **0o004**: Other users have the permission to read a regular file or a directory entry.<br>- **0o002**: Other users have the permission to write a regular file or create and delete a directory entry.<br>- **0o001**: Other users have the permission to execute a regular file or search for the specified path in a directory.|
| uid | number | Yes | No | ID of the file owner.|
| uid | number | Yes | No | ID of the file owner.|
| gid | number | Yes | No | ID of the user group of the file.|
| gid | number | Yes | No | ID of the user group of the file.|
| size | number | Yes | No | File size, in bytes. This parameter is valid only for regular files. |
| size | number | Yes | No | File size, in bytes. This parameter is valid only for regular files. |
# @ohos.file.fileAccess (User File Access and Management)
# @ohos.file.fileAccess (User File Access and Management)
The **fileAccess** module provides a framework for accessing and operating user files based on the ExtensionAbility mechanism. This module interacts with file management services, such as the media library and external storage management service, and provides a set of unified interfaces for system applications to access and manage files. The media library service allows access to user files on local and distributed devices. The external storage management service allows access to the user files stored on devices, such as shared disks, USB flash drives, and SD cards.
The **fileAccess** module provides a framework for accessing and operating user files based on the ExtensionAbility mechanism. This module interacts with a variety of file management services, such as the storage management service, and provides a set of unified file access and management interfaces for system applications. The storage management service manages both the directories of the built-in storage and resources on external devices, such as shared disks, USB flash drives, and SD cards.
>**NOTE**
>**NOTE**
>
>
...
@@ -124,10 +124,9 @@ For details about error codes, see [File Management Error Codes](../errorcodes/e
...
@@ -124,10 +124,9 @@ For details about error codes, see [File Management Error Codes](../errorcodes/e
createFileAccessHelper(){
createFileAccessHelper(){
letfileAccessHelper=null;
letfileAccessHelper=null;
// Obtain wantInfos by using getFileAccessAbilityInfo().
// Obtain wantInfos by using getFileAccessAbilityInfo().
// Create a helper object to interact with the media library service only.
| sourceUri | string | Yes | URI of the file or directory to copy, for example, **file://media/file/102**. |
| sourceUri | string | Yes | URI of the file or folder to copy, for example, **file://docs/storage/Users/currentUser/Download/1.txt**. |
| destUri | string | Yes | URI of the destination directory, for example, **file://media/file/101**. |
| destUri | string | Yes | URI of the file or folder created, for example, **file://docs/storage/Users/currentUser/Download/test**. |
| force | boolean | No | Whether to forcibly overwrite the file with the same name. <br>If **force** is **true**, the file with the same name will be overwritten. If **force** is **false** or not specified, the file with the same name will not be overwritten.|
| force | boolean | No | Whether to forcibly overwrite the file with the same name. <br>If **force** is **true**, the file with the same name will be overwritten. If **force** is **false** or not specified, the file with the same name will not be overwritten.|
**Return value**
**Return value**
...
@@ -1579,11 +1492,11 @@ Copies a file or directory. This API uses a promise to return the result.
...
@@ -1579,11 +1492,11 @@ Copies a file or directory. This API uses a promise to return the result.
Example 1: Copy a file with **force** unspecified.
Example 1: Copy a file with **force** unspecified.
```js
```js
// The media library URI is used as an example.
// A built-in storage directory is used as an example.
// In the sample code, sourceFile indicates the file (directory) in the Download directory to copy, destFile indicates the destination directory in the Download directory, and uri is to URI in fileInfo.
// In the sample code, sourceFile indicates the file (directory) in the Download directory to copy, destFile indicates the destination directory in the Download directory, and uri is to URI in fileInfo.
Example 2: Copy a file or directory when **force** set to **true**.
Example 2: Copy a file or directory when **force** set to **true**.
```js
```js
// The media library URI is used as an example.
// A built-in storage directory is used as an example.
// In the sample code, sourceFile indicates the file (directory) in the Download directory to copy, destFile indicates the destination directory in the Download directory, and uri is to URI in fileInfo.
// In the sample code, sourceFile indicates the file (directory) in the Download directory to copy, destFile indicates the destination directory in the Download directory, and uri is to URI in fileInfo.
| sourceUri | string | Yes | URI of the file or directory to copy, for example, **file://media/file/102**. |
| sourceUri | string | Yes | URI of the file or folder to copy, for example, **file://docs/storage/Users/currentUser/Download/1.txt**. |
| destUri | string | Yes | URI of the destination directory, for example, **file://media/file/101**. |
| destUri | string | Yes | URI of the file or folder created, for example, **file://docs/storage/Users/currentUser/Download/test**. |
| callback | AsyncCallback<Array<[CopyResult](#copyresult10)>> | Yes | Callback invoked to return the result. If the file or directory is copied successfully, no information is returned. If the file copy fails, **copyResult** is returned.|
| callback | AsyncCallback<Array<[CopyResult](#copyresult10)>> | Yes | Callback invoked to return the result. If the file or directory is copied successfully, no information is returned. If the file copy fails, **copyResult** is returned.|
**Example**
**Example**
```js
```js
// The media library URI is used as an example.
// A built-in storage directory is used as an example.
// In the sample code, sourceFile indicates the file (directory) in the Download directory to copy, destFile indicates the destination directory in the Download directory, and uri is to URI in fileInfo.
// In the sample code, sourceFile indicates the file (directory) in the Download directory to copy, destFile indicates the destination directory in the Download directory, and uri is to URI in fileInfo.
| sourceUri | string | Yes | URI of the file or directory to copy, for example, **file://media/file/102**. |
| sourceUri | string | Yes | URI of the file or folder to copy, for example, **file://docs/storage/Users/currentUser/Download/1.txt**. |
| destUri | string | Yes | URI of the destination directory, for example, **file://media/file/101**. |
| destUri | string | Yes | URI of the file or folder created, for example, **file://docs/storage/Users/currentUser/Download/test**. |
| force | boolean | Yes | Whether to forcibly overwrite the file with the same name. <br>If **force** is **true**, the file with the same name will be overwritten. If **force** is **false** or not specified, the file with the same name will not be overwritten.|
| force | boolean | Yes | Whether to forcibly overwrite the file with the same name. <br>If **force** is **true**, the file with the same name will be overwritten. If **force** is **false** or not specified, the file with the same name will not be overwritten.|
| callback | AsyncCallback<Array<[CopyResult](#copyresult10)>> | Yes | Callback invoked to return the result. If the file or directory is copied successfully, no information is returned. If the file copy fails, **copyResult** is returned.|
| callback | AsyncCallback<Array<[CopyResult](#copyresult10)>> | Yes | Callback invoked to return the result. If the file or directory is copied successfully, no information is returned. If the file copy fails, **copyResult** is returned.|
**Example**
**Example**
```js
```js
// The media library URI is used as an example.
// A built-in storage directory is used as an example.
// In the sample code, sourceFile indicates the file (directory) in the Download directory to copy, destFile indicates the destination directory in the Download directory, and uri is to URI in fileInfo.
// In the sample code, sourceFile indicates the file (directory) in the Download directory to copy, destFile indicates the destination directory in the Download directory, and uri is to URI in fileInfo.
@@ -23,20 +23,18 @@ Before developing applications related to tag read and write, you must declare N
...
@@ -23,20 +23,18 @@ Before developing applications related to tag read and write, you must declare N
// Add the nfc tag action.
// Add the nfc tag action.
"ohos.nfc.tag.action.TAG_FOUND"
"ohos.nfc.tag.action.TAG_FOUND"
],
"uris":[
{
"type":"tag-tech/NfcA"
},
{
"type":"tag-tech/IsoDep"
}
// Add other technology if neccessary,
// such as NfcB, NfcF, NfcV, Ndef, MifareClassic, MifareUL, and NdefFormatable.
]
]
}
}
],
"metadata":[
{
"name":"tag-tech",
"value":"NfcA"
},
{
"name":"tag-tech",
"value":"IsoDep"
}
// Add other technologies,
// such as NfcB, NfcF, NfcV, Ndef, MifareClassic, MifareUL, and NdefFormatable.
]
]
}
}
],
],
...
@@ -49,13 +47,11 @@ Before developing applications related to tag read and write, you must declare N
...
@@ -49,13 +47,11 @@ Before developing applications related to tag read and write, you must declare N
}
}
}
}
```
```
> **CAUTION**<br>
> **CAUTION**
>
>
> - The **actions** field is mandatory. It must be **ohos.nfc.tag.action.TAG_FOUND** and cannot be changed.
> - The **actions** field is mandatory. It must be **ohos.nfc.tag.action.TAG_FOUND** and cannot be changed.
> - The **name** field under **metadata** is mandatory. It must be **tag-tech** and cannot be changed.
> - The **type** field under **uris** must start with **tag-tech/**, followed by NfcA, NfcB, NfcF, NfcV, IsoDep, Ndef, MifareClassic, MifareUL, or NdefFormatable. If there are multiple types, enter them in different lines. Incorrect settings of this field will cause a parsing failure.
> - The **value** field under **metadata** is mandatory. It can be **NfcA**, **NfcB**, **NfcF**, **NfcV**, **IsoDep**, **Ndef**, **MifareClassic**, **MifareUL**, **NdefFormatable** or any of their combinations. Incorrect settings of this field will cause a parsing failure.
> - The **name** field under **requestPermissions** is mandatory. It must be **ohos.permission.NFC_TAG** and cannot be changed.
> - The **name** field under **requestPermissions** is mandatory. It must be **ohos.permission.NFC_TAG** and cannot be changed.
## **Modules to Import**
## **Modules to Import**
```js
```js
...
@@ -528,8 +524,16 @@ import tag from '@ohos.nfc.tag';
...
@@ -528,8 +524,16 @@ import tag from '@ohos.nfc.tag';
letelementName=null;
letelementName=null;
letdiscTech=[tag.NFC_A,tag.NFC_B];// replace with the tech(s) that is needed by foreground ability
letdiscTech=[tag.NFC_A,tag.NFC_B];// replace with the tech(s) that is needed by foreground ability
functionforegroundCb(tagInfo:any){
console.log("foreground callback: tag found tagInfo = ",JSON.stringify(tagInfo));
functionforegroundCb(err,taginfo){
if(!err){
console.log("foreground callback: tag found tagInfo = ",JSON.stringify(tagInfo));
| photoUri | string | Yes | URI of the media asset whose index is to be obtained.|
| albumUri | string | Yes | Album URI, which can be an empty string. If it is an empty string, all the media assets in the Gallery are obtained by default. |
| options | [FetchOptions](#fetchoptions) | Yes | Fetch options. Only one search condition or sorting mode must be set in **predicates**. If no value is set or multiple search conditions or sorting modes are set, the API cannot be called successfully. |
| photoUri | string | Yes | URI of the media asset whose index is to be obtained.|
| albumUri | string | Yes | Album URI, which can be an empty string. If it is an empty string, all the media assets in the Gallery are obtained by default. |
| options | [FetchOptions](#fetchoptions) | Yes | Fetch options. Only one search condition or sorting mode must be set in **predicates**. If no value is set or multiple search conditions or sorting modes are set, the API cannot be called successfully. |
| uri | string | Yes | No | File asset URI, for example, **file://media/image/2**. |
| uri | string | Yes | No | File asset URI, for example, **file://media/Photo/1/IMG_datetime_0001/displayName.jpg**. |
| photoType | [PhotoType](#phototype) | Yes | No | Type of the file. |
| photoType | [PhotoType](#phototype) | Yes | No | Type of the file. |
| displayName | string | Yes | No | File name, including the file name extension, to display. |
| displayName | string | Yes | No | File name, including the file name extension, to display. |
...
@@ -2243,6 +2388,282 @@ async function example() {
...
@@ -2243,6 +2388,282 @@ async function example() {
}
}
```
```
### getExif<sup>10+</sup>
getExif(): Promise<string>
Obtains a JSON string consisting of the EXIF tags of this JPG image. This API uses a promise to return the result.
**CAUTION**<br>This API returns a JSON string consisting of EXIF tags. The complete EXIF information consists of **all_exif** and **js-apis-photoAccessHelper.md**. These two fields must be passed in via **fetchColumns**.
Obtains a JSON string consisting of the EXIF tags of this JPG image. This API uses an asynchronous callback to return the result.
**CAUTION**<br>This API returns a JSON string consisting of EXIF tags. The complete EXIF information consists of **all_exif** and **ImageVideoKey.USER_COMMENT**. These two fields must be passed in via **fetchColumns**.
console.error('setUserComment failed with error: '+err);
}
});
}catch(err){
console.error('setUserCommentDemoCallback failed with error: '+err);
}
}
```
## FetchResult
## FetchResult
Provides APIs to manage the file retrieval result.
Provides APIs to manage the file retrieval result.
...
@@ -3726,6 +4147,7 @@ Defines the key information about an image or video file.
...
@@ -3726,6 +4147,7 @@ Defines the key information about an image or video file.
| DATE_TRASHED | 'date_trashed' | Date when the file was deleted. The value is the number of seconds between the time when the file is deleted and January 1, 1970. **System API**: This is a system API. |
| DATE_TRASHED | 'date_trashed' | Date when the file was deleted. The value is the number of seconds between the time when the file is deleted and January 1, 1970. **System API**: This is a system API. |
| HIDDEN | 'hidden' | Whether the file is hidden. **System API**: This is a system API. |
| HIDDEN | 'hidden' | Whether the file is hidden. **System API**: This is a system API. |
| CAMERA_SHOT_KEY | 'camera_shot_key' | Key for the Untra Snamshot feature, which allows the camera to take photos or record videos with the screen off. (This parameter is available only for the system camera, and the key value is defined by the system camera.)<br/>**System API**: This is a system API. |
| CAMERA_SHOT_KEY | 'camera_shot_key' | Key for the Untra Snamshot feature, which allows the camera to take photos or record videos with the screen off. (This parameter is available only for the system camera, and the key value is defined by the system camera.)<br/>**System API**: This is a system API. |
| USER_COMMENT<sup>10+</sup> | 'user_comment' | User comment information. **System API**: This is a system API. |
| photoUri | string | Yes | URI of the media asset whose index is to be obtained.|
| albumUri | string | Yes | Album URI, which can be an empty string. If it is an empty string, all the media assets in the Gallery are obtained by default. |
| options | [FetchOptions](#fetchoptions) | Yes | Fetch options. Only one search condition or sorting mode must be set in **predicates**. If no value is set or multiple search conditions or sorting modes are set, the API cannot be called successfully. |
| photoUri | string | Yes | URI of the media asset whose index is to be obtained.|
| albumUri | string | Yes | Album URI, which can be an empty string. If it is an empty string, all the media assets in the Gallery are obtained by default. |
| options | [FetchOptions](#fetchoptions) | Yes | Fetch options. Only one search condition or sorting mode must be set in **predicates**. If no value is set or multiple search conditions or sorting modes are set, the API cannot be called successfully. |
| uri | string | Yes | No | File asset URI, for example, **file://media/image/2**. |
| uri | string | Yes | No | File asset URI, for example, **file://media/Photo/1/IMG_datetime_0001/displayName.jpg**. |
| fileType | [FileType](#filetype) | Yes | No | Type of the file. |
| fileType | [FileType](#filetype) | Yes | No | Type of the file. |
| displayName | string | Yes | Yes | File name, including the file name extension, to display. |
| displayName | string | Yes | Yes | File name, including the file name extension, to display. |
...
@@ -2350,6 +2495,282 @@ async function example() {
...
@@ -2350,6 +2495,282 @@ async function example() {
}
}
```
```
### getExif<sup>10+</sup>
getExif(): Promise<string>
Obtains a JSON string consisting of the exchangeable image file format (EXIF) tags of this JPG image. This API uses a promise to return the result.
**CAUTION**<br>This API returns a JSON string consisting of EXIF tags. The complete EXIF information consists of **all_exif** and **ImageVideoKey.USER_COMMENT**. These two fields must be passed in via **fetchColumns**.
Obtains a JSON string consisting of the EXIF tags of this JPG image. This API uses an asynchronous callback to return the result.
**CAUTION**<br>This API returns a JSON string consisting of EXIF tags. The complete EXIF information consists of **all_exif** and **ImageVideoKey.USER_COMMENT**. These two fields must be passed in via **fetchColumns**.
console.error('setUserComment failed with error: '+err);
}
});
}catch(err){
console.error('setUserCommentDemoCallback failed with error: '+err);
}
}
```
## FetchResult
## FetchResult
Provides APIs to manage the file retrieval result.
Provides APIs to manage the file retrieval result.
...
@@ -3962,6 +4383,7 @@ Defines the key information about an image or video file.
...
@@ -3962,6 +4383,7 @@ Defines the key information about an image or video file.
| DATE_TRASHED<sup>10+</sup> | date_trashed | Date when the file was deleted. The value is the number of seconds between the time when the file is deleted and January 1, 1970. |
| DATE_TRASHED<sup>10+</sup> | date_trashed | Date when the file was deleted. The value is the number of seconds between the time when the file is deleted and January 1, 1970. |
| HIDDEN<sup>10+</sup> | hidden | Whether the file is hidden. |
| HIDDEN<sup>10+</sup> | hidden | Whether the file is hidden. |
| CAMERA_SHOT_KEY<sup>10+</sup> | camera_shot_key | Key for the Untra Snamshot feature, which allows the camera to take photos or record videos with the screen off. (This parameter is available only for the system camera, and the key value is defined by the system camera.) |
| CAMERA_SHOT_KEY<sup>10+</sup> | camera_shot_key | Key for the Untra Snamshot feature, which allows the camera to take photos or record videos with the screen off. (This parameter is available only for the system camera, and the key value is defined by the system camera.) |
| USER_COMMENT<sup>10+</sup> | user_comment | User comment information. |
@@ -6,11 +6,11 @@ Deprecated **X509Cert.getSerialNumber()** and replaced it with **X509Cert.getCer
...
@@ -6,11 +6,11 @@ Deprecated **X509Cert.getSerialNumber()** and replaced it with **X509Cert.getCer
**Change Impact**
**Change Impact**
**X509Cert.getSerialNumber()** is deprecated since API version 10. **X509Cert.getCertSerialNumber()** should be used to replace**X509Cert.getSerialNumber()** in application development. The API function remains unchanged.
Since API version 10, use **X509Cert.getCertSerialNumber()** instead of**X509Cert.getSerialNumber()** in application development. The API function remains unchanged.
1. The location permission is not required if a random MAC is returned.
1. The GET_WIFI_PEERS_MAC permission is required if a real MAC address is returned.
| API| Permission|
| -------- | ---------------------------- |
|**function** getCandidateConfigs(): Array<WifiDeviceConfig>; | 1. The location permission is not required.|
|**function** getDeviceConfigs(): Array<WifiDeviceConfig>; | 1. The location permission is not required.|
|**function** getStations(): Array<StationInfo>; | 1. The location permission is not required. <br/>2. A random MAC address is returned (the GET_WIFI_PEERS_MAC permission is required if a real MAC address is returned). |
| **function** getCurrentP2pGroup(): Promise<WifiP2pGroupInfo>; | 1. The location permission is not required.|
| **function** getCurrentP2pGroup(callback: AsyncCallback<WifiP2pGroupInfo>): **void**; | 1. The location permission is not required.|
| **function** getP2pPeerDevices(): Promise<WifiP2pDevice[]>; | 1. The location permission is not required. <br/>2. A random MAC address is returned (the GET_WIFI_PEERS_MAC permission is required if a real MAC address is returned). |
| **function** getP2pPeerDevices(callback: AsyncCallback<WifiP2pDevice[]>): **void**; | 1. The location permission is not required. <br/>2. A random MAC address is returned (the GET_WIFI_PEERS_MAC permission is required if a real MAC address is returned). |
| **function** p2pConnect(config: WifiP2PConfig): **void**; | 1. The location permission is not required.|
| **function** startDiscoverDevices(): **void**; | 1. The location permission is not required.|
| **function** getP2pGroups(): Promise<Array<WifiP2pGroupInfo>>; | 1. The location permission is not required.|
| **function** getP2pGroups(callback: AsyncCallback<Array<WifiP2pGroupInfo>>): **void**; | 1. The location permission is not required.|
| **function** on(**type**: "p2pDeviceChange", callback: Callback<WifiP2pDevice>): **void**; | 1. The location permission is not required. <br/>2. A random MAC address is returned (the GET_WIFI_PEERS_MAC permission is required if a real MAC address is returned). |
| **function** off(**type**: "p2pDeviceChange", callback?: Callback<WifiP2pDevice>): **void**; | 1. The location permission is not required. <br/>2. A random MAC address is returned (the GET_WIFI_PEERS_MAC permission is required if a real MAC address is returned). |
| **function** on(**type**: "p2pPeerDeviceChange", callback: Callback<WifiP2pDevice[]>): **void**; | 1. The location permission is not required. <br/>2. A random MAC address is returned (the GET_WIFI_PEERS_MAC permission is required if a real MAC address is returned). |
| **function** off(**type**: "p2pPeerDeviceChange", callback?: Callback<WifiP2pDevice[]>): **void**; | 1. The location permission is not required. <br/>2. A random MAC address is returned (the GET_WIFI_PEERS_MAC permission is required if a real MAC address is returned). |
## 2 Added APIs
| API| Description|
|------|---------|
| **function** startScan(): **void**; | Starts a scan.|
| **function** getScanInfoList(): Array<WifiScanInfo>; | Obtains the scan list. |