提交 9b042a61 编写于 作者: S sienna1128

Merge branch 'master' of https://gitee.com/openharmony/docs into docs/0926

......@@ -22,15 +22,16 @@ import stats from '@ohos.bundleState';
| function queryAppUsagePriorityGroup(callback: AsyncCallback<number>): void | Queries the priority group of this application. This API uses an asynchronous callback to return the result.|
| function queryAppUsagePriorityGroup(): Promise<number>; | Queries the priority group of this application. This API uses a promise to return the result.|
| function isIdleState(bundleName: string, callback: AsyncCallback<boolean>): void | Checks whether the application specified by **bundleName** is in the idle state. |
| function getRecentlyUsedModules(maxNum? : number, callback: AsyncCallback<BundleActiveModuleInfo>): void | Obtains the number of FA usage records specified by **maxNum**. If **maxNum** is not specified, the default value **1000** is used.|
| function getRecentlyUsedModules(callback: AsyncCallback<BundleActiveModuleInfo>): void | Obtains the number of FA usage records specified by **1000**.|
| function getRecentlyUsedModules(maxNum: number, callback: AsyncCallback<BundleActiveModuleInfo>): void | Obtains the number of FA usage records specified by **maxNum**.|
| function queryAppNotificationNumber(begin: number, end: number, callback: AsyncCallback<Array<BundleActiveEventState>>): void | Queries the number of notifications from all applications based on the specified start time and end time.|
| function queryBundleActiveEventStates(begin: number, end: number, callback: AsyncCallback<Array<BundleActiveEventState>>): void | Queries statistics about system events (hibernation, wakeup, unlocking, and screen locking) that occur between the specified start time and end time.|
| function queryAppUsagePriorityGroup(bundleName? : string, callback: AsyncCallback<number>): void | Queries the priority group of the application specified by **bundleName**. If **bundleName** is not specified, the priority group of the current application is queried. This API uses an asynchronous callback to return the result.|
| function queryAppUsagePriorityGroup(bundleName : string, callback: AsyncCallback<number>): void | Queries the priority group of the application specified by **bundleName**. This API uses an asynchronous callback to return the result.|
| function queryAppUsagePriorityGroup(bundleName? : string): Promise<number>; | Queries the priority group of the application specified by **bundleName**. If **bundleName** is not specified, the priority group of the current application is queried. This API uses a promise to return the result.|
| function setBundleGroup(bundleName : string, newGroup: GroupType, callback: AsyncCallback>boolean>): void | Sets the group for the application specified by **bundleName**. This API uses an asynchronous callback to return the result.|
| function setBundleGroup(bundleName : string, newGroup : GroupType): Promise>boolean>; | Sets the group for the application specified by **bundleName**. This API uses a promise to return the result.|
| function registerGroupCallBack(callback: Callback>BundleActiveGroupCallbackInfo>, callback: AsyncCallback>boolean>): void | Registers a callback for application group changes. When an application group of the user changes, the change is returned to all applications that have registered the callback. This API uses an asynchronous callback to return the result.|
| function registerGroupCallBack(callback: Callback>BundleActiveGroupCallbackInfo>): Promise>boolean>; | Registers a callback for application group changes. When an application group of the user changes, the change is returned to all applications that have registered the callback. This API uses a promise to return the result.|
| function registerGroupCallBack(groupCallback: Callback>BundleActiveGroupCallbackInfo>, callback: AsyncCallback>boolean>): void | Registers a callback for application group changes. When an application group of the user changes, the change is returned to all applications that have registered the callback. This API uses an asynchronous callback to return the result.|
| function registerGroupCallBack(groupCallback: Callback>BundleActiveGroupCallbackInfo>): Promise>boolean>; | Registers a callback for application group changes. When an application group of the user changes, the change is returned to all applications that have registered the callback. This API uses a promise to return the result.|
| function unRegisterGroupCallBack(callback: AsyncCallback>boolean>): void | Deregisters the callback for application group changes. This API uses an asynchronous callback to return the result.|
| function unRegisterGroupCallBack(): Promise>boolean>; | Deregisters the callback for application group changes. This API uses a promise to return the result.|
......
# USB Service Development
The USB service provides the following functions: query of USB device list, bulk data transfer, control transfer, and access permission management.
## When to Use
In Host mode, you can obtain the list of connected devices, enable or disable the devices, manage device access permissions, and perform data transfer or control transfer.
## APIs
The USB service provides the following functions: query of USB device list, bulk data transfer, control transfer, and access permission management.
The following table lists the USB APIs currently available. For details, see the [API Reference](../reference/apis/js-apis-usb.md).
**Table 1** Open USB APIs
......@@ -16,11 +16,11 @@ The following table lists the USB APIs currently available. For details, see the
| ------------------------------------------------------------ | ------------------------------------------------------------ |
| hasRight(deviceName: string): boolean | Checks whether the user, for example, the application or system, has the device access permissions. The value **true** is returned if the user has the device access permissions; the value **false** is returned otherwise. |
| requestRight(deviceName: string): Promise\<boolean> | Requests the temporary permission for a given application to access the USB device. |
| connectDevice(device: USBDevice): Readonly\<USBDevicePipe> | Connects to the USB device based on the device information returned by **getDevices()**. |
| connectDevice(device: USBDevice): Readonly\<USBDevicePipe> | Connects to the USB device based on the device information returned by `getDevices()`. |
| getDevices(): Array<Readonly\<USBDevice>> | Obtains the USB device list. |
| setConfiguration(pipe: USBDevicePipe, config: USBConfig): number | Sets the USB device configuration. |
| setInterface(pipe: USBDevicePipe, iface: USBInterface): number | Sets a USB interface. |
| claimInterface(pipe: USBDevicePipe, iface: USBInterface, force?: boolean): number | Claims a USB interface |
| claimInterface(pipe: USBDevicePipe, iface: USBInterface, force?: boolean): number | Claims a USB interface. |
| bulkTransfer(pipe: USBDevicePipe, endpoint: USBEndpoint, buffer: Uint8Array, timeout?: number): Promise\<number> | Performs bulk transfer. |
| closePipe(pipe: USBDevicePipe): number | Closes a USB device pipe. |
| releaseInterface(pipe: USBDevicePipe, iface: USBInterface): number | Releases a USB interface. |
......@@ -30,7 +30,7 @@ The following table lists the USB APIs currently available. For details, see the
## How to Develop
You can set a USB device as a host to connect to a device for data transfer. The development procedure is as follows:
You can set a USB device as the USB host to connect to other USB devices for data transfer. The development procedure is as follows:
1. Obtain the USB device list.
......@@ -113,7 +113,7 @@ You can set a USB device as a host to connect to a device for data transfer. The
Claim the corresponding interface from deviceList.
interface1 must be one present in the device configuration.
*/
usb.claimInterface(pipe , interface1, true);
usb.claimInterface(pipe, interface1, true);
```
4. Perform data transfer.
......
# FAQs
- [Ability Framework Development](faqs-ability.md)
- [Data Management Development](faqs-data-management.md)
- [File Management Development](faqs-file-management.md)
- [Graphics and Image Development](faqs-graphics.md)
- [hdc_std Command Usage](faqs-ide.md)
- [IDE Usage](faqs-hdc-std.md)
- [ArkUI (JavaScript) Development](faqs-ui-js.md)
- [ArkUI (eTS) Development](faqs-ui-ets.md)
- [Graphics and Image Development](faqs-graphics.md)
......@@ -8,6 +13,7 @@
- [Data Management Development](faqs-data-management.md)
- [Device Management Development](faqs-device-management.md)
- [Native API Usage](faqs-native.md)
- [Network and Connection Development](faqs-connectivity.md)
- [Usage of Third- and Fourth-Party Libraries](faqs-third-party-library.md)
- [Development Board](faqs-development-board.md)
# Network and Connection Development
## What are the data formats supported by extraData in an HTTP request?
Applicable to: OpenHarmony SDK 3.2.2.5, stage model of API version 9
**extraData** indicates additional data in an HTTP request. It varies depending on the HTTP request method.
- If the HTTP request uses a POST or PUT method, **extraData** serves as the content of the HTTP request.
- If the HTTP request uses a GET, OPTIONS, DELETE, TRACE, or CONNECT method, **extraData** serves as a supplement to the HTTP request parameters and will be added to the URL when the request is sent.
- If you pass in a string object, **extraData** contains the string encoded on your own.
## What does error code 28 mean for an HTTP request?
Applicable to: OpenHarmony SDK 3.2.2.5, stage model of API version 9
Error code 28 refers to **CURLE_OPERATION_TIMEDOUT**, which means a libcurl library operation timeout. For details, see any HTTP status code description available.
Reference: [Development Guide](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-http.md#httpresponse) and [Curl Error Codes](https://curl.se/libcurl/c/libcurl-errors.html)
## What does error code 6 mean for the response of \@ohos.net.http.d.ts?
Applicable to: OpenHarmony SDK 3.2.3.5
Error code 6 indicates a failure to resolve the host in the address. You can ping the URL carried in the request to check whether the host is accessible.
Reference: [Development Guide](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-http.md#httpresponse) and [Curl Error Codes](https://curl.se/libcurl/c/libcurl-errors.html)
# hdc_std Command Usage
## What are the commands commonly used for log management?
Applicable to: OpenHarmony SDK 3.2.2.5
- Clearing logs: hdc_std shell hilog -r
- Increasing the buffer size to 20 MB: hdc_std shell hilog -G 20M
- Capturing logs: hdc_std shell hilog &gt; log.txt
## What should I do to avoid log flow control?
Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9
- Disabling log flow control: hdc_std shell hilog -Q pidoff
- Disabling the privacy flag: hdc_std shell hilog -p off
- Increasing the log buffer to 200 MB: hdc_std shell hilog -G 200M
- Enabling the log function of the specific domain (that is, disabling the global log function): hdc_std shell hilog –b D –D 0xd0xxxxx
After performing the preceding operations, restart the DevEco Studio.
## Is HiLog or Console recommended for log printing? How do I set the domain if HiLog is used?
Applicable to: OpenHarmony SDK 3.2.2.5
[HiLog](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-hilog.md) is recommended for an application to print logs. For details about domain setting, see [Development Guide](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-hilog.md#hilogisloggable).
## What is the maximum length of a log record when HiLog is used? Is it configurable?
Applicable to: OpenHarmony SDK 3.2.2.5
The maximum length of a log record is 1,024 characters, and it is not changeable.
## What should I do if a HAP package cannot be opened after being installed on the development board using the IDE?
Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9
Check whether the SDK version is consistent with the system version on the development board. You are advised to use the SDK version and system version that are released on the same day.
## How do I upload files using an hdc command?
Applicable to: OpenHarmony SDK 3.2.2.5
Run the **hdc_std file send** command.
## How do I prevent the screen of the RK3568 development board from turning off?
Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9
Run the **hdc_std shell "power-shell setmode 602"** command.
## How do I start an ability using an hdc command?
Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9
Run the **hdc_std shell aa start -a AbilityName -b bundleName -m moduleName** command.
# IDE Usage
## What should do if the error message "npm ERR! code SELF_SIGNED_CERT_IN_CHAIN" is displayed?
Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9
1. Run **npm config set strict-ssl=false** on the DevEco Studio terminal.
2. Run the **npm install** on the DevEco Studio terminal.
## After manual updating of the DevEco Studio SDK, the error message "Cannot find module 'xxx\ets\x.x.x.x\build-tools\ets-loader\node_modules\webpack\bin\webpack.js'" is displayed during HAP building. What should I do?
Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9
1. Run **npm install** in the **ets\x.x.x.x\build-tools\ets-loader** directory of the SDK.
2. Run **npm install** in the **js\x.x.x.x\build-tools\ace-loader** directory of the SDK.
3. Perform HAP building again.
......@@ -187,7 +187,7 @@
## Implementing Page Redirection
You can implement page redirection through the page router, which finds the target page based on the page URL. Import the **router** module and then perform the steps below:
You can implement page redirection through the [page router](../reference/apis/js-apis-router.md#routerpush), which finds the target page based on the page URL. Import the **router** module and then perform the steps below:
1. Implement redirection from the first page to the second page.
......
......@@ -185,7 +185,7 @@
## Implementing Page Redirection
You can implement page redirection through the page router, which finds the target page based on the page URL. Import the **router** module and then perform the steps below:
You can implement page redirection through the [page router](../reference/apis/js-apis-router.md#routerpush), which finds the target page based on the page URL. Import the **router** module and then perform the steps below:
1. Implement redirection from the first page to the second page.
......
......@@ -181,7 +181,7 @@
## Implementing Page Redirection
You can implement page redirection through the [page router](../ui/ui-js-building-ui-routes.md), which finds the target page based on the page URL. Import the **router** module and then perform the steps below:
You can implement page redirection through the [page router](../reference/apis/js-apis-router.md#routerpush), which finds the target page based on the page URL. Import the **router** module and then perform the steps below:
1. Implement redirection from the first page to the second page.
......
......@@ -146,6 +146,7 @@
- [@ohos.privacyManager](js-apis-privacyManager.md)
- [@ohos.security.huks ](js-apis-huks.md)
- [@ohos.userIAM.userAuth ](js-apis-useriam-userauth.md)
- [@ohos.userIAM.faceAuth](js-apis-useriam-faceauth.md)
- [@system.cipher](js-apis-system-cipher.md)
- Data Management
......
......@@ -484,9 +484,9 @@ Obtains the number of FA usage records specified by **maxNum**. This API uses a
## bundleState.getRecentlyUsedModules<sup>9+</sup>
getRecentlyUsedModules(maxNum?: number, callback: AsyncCallback&lt;Array&lt;BundleActiveModuleInfo&gt;&gt;): void
getRecentlyUsedModules(callback: AsyncCallback&lt;Array&lt;BundleActiveModuleInfo&gt;&gt;): void
Obtains the number of FA usage records specified by **maxNum**. This API uses an asynchronous callback to return the records sorted by time (most recent first).
This API uses an asynchronous callback to return at most 1000 records sorted by time (most recent first).
**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO
......@@ -498,13 +498,12 @@ Obtains the number of FA usage records specified by **maxNum**. This API uses an
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ----------------------------------- |
| maxNum | number | No | Maximum number of returned records. The maximum and default value is **1000**. If this parameter is not specified, **1000** is used. |
| callback | AsyncCallback&lt;Array&lt;[BundleActiveModuleInfo](#bundleactivemoduleinfo9)&gt;&gt; | Yes | Callback used to return the result.|
**Example**
```js
bundleState.getRecentlyUsedModules(1000,(err, res) => {
bundleState.getRecentlyUsedModules((err, res) => {
if(err) {
console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback failed, because: ' + err.code);
} else {
......@@ -515,9 +514,31 @@ Obtains the number of FA usage records specified by **maxNum**. This API uses an
}
}
});
```
// Invocation when maxNum is not passed
bundleState.getRecentlyUsedModules((err, res) => {
## bundleState.getRecentlyUsedModules<sup>9+</sup>
getRecentlyUsedModules(maxNum: number, callback: AsyncCallback&lt;Array&lt;BundleActiveModuleInfo&gt;&gt;): void
Obtains the number of FA usage records specified by **maxNum**. This API uses an asynchronous callback to return the records sorted by time (most recent first).
**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO
**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App
**System API**: This is a system API and cannot be called by third-party applications.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ----------------------------------- |
| maxNum | number | Yes | Maximum number of returned records. The maximum and default value is **1000**.|
| callback | AsyncCallback&lt;Array&lt;[BundleActiveModuleInfo](#bundleactivemoduleinfo9)&gt;&gt; | Yes | Callback used to return the result.|
**Example**
```js
bundleState.getRecentlyUsedModules(1000,(err, res) => {
if(err) {
console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback failed, because: ' + err.code);
} else {
......@@ -574,9 +595,9 @@ bundleState.queryAppUsagePriorityGroup().then( res => {
## bundleState.queryAppUsagePriorityGroup<sup>9+</sup>
queryAppUsagePriorityGroup(bundleName? : string, callback: AsyncCallback&lt;number&gt;): void
queryAppUsagePriorityGroup(callback: AsyncCallback&lt;number&gt;): void
Queries the priority group of the application specified by **bundleName**. If **bundleName** is not specified, the priority group of the current application is queried. This API uses an asynchronous callback to return the result.
Queries the priority group of the current application . This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO
......@@ -588,23 +609,44 @@ Queries the priority group of the application specified by **bundleName**. If **
| Name | Type | Mandatory | Description |
| ---------- | --------------------- | ---- | ---------------------------------------- |
| bundleName | string | No | Bundle name of the target application. If this parameter is not specified, the priority group of the current application is queried.|
| callback | AsyncCallback&lt;number&gt; | Yes | Callback used to return the result. |
**Example**
```javascript
// Callback with bundleName
let bundleName = "com.ohos.camera";
bundleState.queryAppUsagePriorityGroup(bundleName, (err, res) => {
bundleState.queryAppUsagePriorityGroup((err, res) => {
if(err) {
console.log('BUNDLE_ACTIVE QueryPackageGroup callback failed. because: ' + err.code);
} else {
console.log('BUNDLE_ACTIVE QueryPackageGroup callback succeeded. result: ' + JSON.stringify(res));
}
});
// Callback without bundleName
bundleState.queryAppUsagePriorityGroup((err, res) => {
```
## bundleState.queryAppUsagePriorityGroup<sup>9+</sup>
queryAppUsagePriorityGroup(bundleName : string, callback: AsyncCallback&lt;number&gt;): void
Queries the priority group of the application specified by **bundleName**. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO
**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
**System API**: This is a system API and cannot be called by third-party applications.
**Parameters**
| Name | Type | Mandatory | Description |
| ---------- | --------------------- | ---- | ---------------------------------------- |
| bundleName | string | Yes | Bundle name of the target application.|
| callback | AsyncCallback&lt;number&gt; | Yes | Callback used to return the result. |
**Example**
```javascript
let bundleName = "com.ohos.camera";
bundleState.queryAppUsagePriorityGroup(bundleName, (err, res) => {
if(err) {
console.log('BUNDLE_ACTIVE QueryPackageGroup callback failed. because: ' + err.code);
} else {
......@@ -688,7 +730,7 @@ bundleState.setBundleGroup(bundleName, newGroup, (err) => {
## bundleState.registerGroupCallBack<sup>9+</sup>
registerGroupCallBack(callback: Callback&lt;BundleActiveGroupCallbackInfo&gt;): Promise&lt;void&gt;
registerGroupCallBack(groupCallback: Callback&lt;BundleActiveGroupCallbackInfo&gt;): Promise&lt;void&gt;
Registers a callback for application group changes. When an application group of the user changes, a **[BundleActiveGroupCallbackInfo](#bundleactivegroupcallbackinfo9)** instance is returned to all applications that have registered the callback. This API uses a promise to return the result.
......@@ -730,7 +772,7 @@ bundleState.registerGroupCallBack(onBundleGroupChanged).then( () => {
## bundleState.registerGroupCallBack<sup>9+</sup>
registerGroupCallBack(callback: Callback&lt;BundleActiveGroupCallbackInfo&gt;, callback: AsyncCallback&lt;void&gt;): void
registerGroupCallBack(groupCallback: Callback&lt;BundleActiveGroupCallbackInfo&gt;, callback: AsyncCallback&lt;void&gt;): void
Registers a callback for application group changes. When an application group of the user changes, a **[BundleActiveGroupCallbackInfo](#bundleactivegroupcallbackinfo9)** instance is returned to all applications that have registered the callback. This API uses an asynchronous callback to return the result.
......@@ -1034,20 +1076,6 @@ Provides the usage duration information of applications.
| infosBeginTime | number | No | Time logged in the first application usage record in the **BundleActiveInfo** object.<br>This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.|
| infosEndTime | number | No | Time logged in the last application usage record in the **BundleActiveInfo** object.<br>This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.|
### merge
merge(toMerge: BundleStateInfo): void
Merges the application usage information that has the same bundle name.
**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App
**Parameters**
| Name | Type | Mandatory | Description |
| ------- | ----------------------------------- | ---- | -------------- |
| toMerge | [BundleStateInfo](#bundlestateinfo) | Yes | Application usage information to merge.|
## BundleActiveState
Provides information about an application event.
......
......@@ -60,6 +60,7 @@ Creates a Locale object.
**System capability**: SystemCapability.Global.I18n
**Parameters**
| Name | Type | Mandatory | Description |
| ------- | ------------- | ---- | ---------------------------- |
| locale | string | Yes | A string containing locale information, including the language, optional script, and region.|
......@@ -80,6 +81,7 @@ Converts locale information to a string.
**System capability**: SystemCapability.Global.I18n
**Return Value**
| Type | Description |
| ------ | ----------- |
| string | String containing locale information.|
......@@ -100,6 +102,7 @@ Maximizes information of the **Locale** object. If the script and locale informa
**System capability**: SystemCapability.Global.I18n
**Return Value**
| Type | Description |
| ----------------- | ---------- |
| [Locale](#locale) | **Locale** object with the maximized information.|
......@@ -120,6 +123,7 @@ Minimizes information of the **Locale** object. If the script and locale informa
**System capability**: SystemCapability.Global.I18n
**Return Value**
| Type | Description |
| ----------------- | ---------- |
| [Locale](#locale) | **Locale** object with the minimized information.|
......@@ -131,7 +135,7 @@ Minimizes information of the **Locale** object. If the script and locale informa
```
## LocaleOptions
## LocaleOptions<sup>9+</sup>
Represents the locale options.
......@@ -173,6 +177,7 @@ Creates a **DateTimeOptions** object for the specified locale.
**System capability**: SystemCapability.Global.I18n
**Parameters**
| Name | Type | Mandatory | Description |
| ------- | ----------------------------------- | ---- | ---------------------------- |
| locale | string \| Array&lt;string&gt; | Yes | A string containing locale information, including the language, optional script, and region.|
......@@ -199,11 +204,13 @@ Formats the specified date and time.
**System capability**: SystemCapability.Global.I18n
**Parameters**
| Name | Type | Mandatory | Description |
| ---- | ---- | ---- | ------- |
| date | Date | Yes | Date and time to be formatted.|
**Return Value**
| Type | Description |
| ------ | ------------ |
| string | A string containing the formatted date and time.|
......@@ -225,12 +232,14 @@ Formats the specified date range.
**System capability**: SystemCapability.Global.I18n
**Parameters**
| Name | Type | Mandatory | Description |
| --------- | ---- | ---- | -------- |
| startDate | Date | Yes | Start date and time to be formatted.|
| endDate | Date | Yes | End date and time to be formatted.|
**Return Value**
| Type | Description |
| ------ | -------------- |
| string | A string containing the formatted date and time range.|
......@@ -253,6 +262,7 @@ Obtains the formatting options for **DateTimeFormat** object.
**System capability**: SystemCapability.Global.I18n
**Return Value**
| Type | Description |
| ----------------------------------- | ----------------------------- |
| [DateTimeOptions](#datetimeoptions) | Formatting options for **DateTimeFormat** objects.|
......@@ -264,7 +274,7 @@ Obtains the formatting options for **DateTimeFormat** object.
```
## DateTimeOptions
## DateTimeOptions<sup>9+</sup>
Provides the options for the **DateTimeFormat** object.
......@@ -339,11 +349,13 @@ Formats a number.
**System capability**: SystemCapability.Global.I18n
**Parameters**
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ---- |
| number | number | Yes | Number to be formatted.|
**Return Value**
| Type | Description |
| ------ | ---------- |
| string | Formatted number.|
......@@ -365,6 +377,7 @@ Obtains the options of the **NumberFormat** object.
**System capability**: SystemCapability.Global.I18n
**Return Value**
| Type | Description |
| ------------------------------- | --------------------------- |
| [NumberOptions](#numberoptions) | Formatting options for **NumberFormat** objects.|
......@@ -377,7 +390,7 @@ Obtains the options of the **NumberFormat** object.
```
## NumberOptions
## NumberOptions<sup>9+</sup>
Provides the device capability.
......@@ -453,12 +466,14 @@ Compares two strings based on the sorting policy of the **Collator** object.
**System capability**: SystemCapability.Global.I18n
**Parameters**
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ------------ |
| first | string | Yes | First string to compare. |
| second | string | Yes | Second string to compare.|
**Return Value**
| Type | Description |
| ------ | ---------------------------------------- |
| number | Comparison result. If the value is a negative number, the first string is before the second string. If the value of number is **0**, the first string is equal to the second string. If the value of number is a positive number, the first string is after the second string.|
......@@ -479,6 +494,7 @@ Returns properties reflecting the locale and collation options of a **Collator**
**System capability**: SystemCapability.Global.I18n
**Return Value**
| Type | Description |
| ----------------------------------- | ----------------- |
| [CollatorOptions](#collatoroptions) | Properties of the **Collator** object.|
......@@ -490,7 +506,7 @@ Returns properties reflecting the locale and collation options of a **Collator**
```
## CollatorOptions<sup>8+</sup><a name=collatoroptions></a>
## CollatorOptions<sup>9+</sup>
Represents the properties of a **Collator** object.
......@@ -553,11 +569,13 @@ Obtains a string that represents the singular-plural type of the specified numbe
**System capability**: SystemCapability.Global.I18n
**Parameters**
| Name | Type | Mandatory | Description |
| ---- | ------ | ---- | ------------ |
| n | number | Yes | Number for which the singular-plural type is to be obtained.|
**Return Value**
| Type | Description |
| ------ | ---------------------------------------- |
| string | Singular-plural type. The value can be any of the following: **one**, **two**, **few**, **many**, **others**.|
......@@ -569,7 +587,7 @@ Obtains a string that represents the singular-plural type of the specified numbe
```
## PluralRulesOptions<sup>8+</sup><a name=pluralrulesoptions></a>
## PluralRulesOptions<sup>9+</sup>
Represents the properties of a **PluralRules** object.
......@@ -611,7 +629,8 @@ Creates a **RelativeTimeFormat** object.
**System capability**: SystemCapability.Global.I18n
Parameters
**Parameters**
| Name | Type | Mandatory | Description |
| ------- | ---------------------------------------- | ---- | ---------------------------- |
| locale | string \| Array&lt;string&gt; | Yes | A string containing locale information, including the language, optional script, and region.|
......@@ -632,12 +651,14 @@ Formats the value and unit based on the specified locale and formatting options.
**System capability**: SystemCapability.Global.I18n
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ------ | ---- | ---------------------------------------- |
| value | number | Yes | Value to format. |
| unit | string | Yes | Unit to format. The value can be any of the following: **year**, **quarter**, **month**, **week**, **day**, **hour**, **minute**, **second**.|
**Return Value**
| Type | Description |
| ------ | ---------- |
| string | Relative time after formatting.|
......@@ -658,12 +679,14 @@ Returns an array of RelativeTimeFormat objects in parts for locale-aware formatt
**System capability**: SystemCapability.Global.I18n
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ------ | ---- | ---------------------------------------- |
| value | number | Yes | Value to format. |
| unit | string | Yes | Unit to format. The value can be any of the following: **year**, **quarter**, **month**, **week**, **day**, **hour**, **minute**, **second**.|
**Return Value**
| Type | Description |
| ------------------- | --------------------------- |
| Array&lt;object&gt; | An array of **RelativeTimeFormat** objects in parts.|
......@@ -684,6 +707,7 @@ Obtains the formatting options for **RelativeTimeFormat** objects.
**System capability**: SystemCapability.Global.I18n
**Return Value**
| Type | Description |
| ---------------------------------------- | --------------------------------- |
| [RelativeTimeFormatResolvedOptions](#relativetimeformatresolvedoptions) | Formatting options for **RelativeTimeFormat** objects.|
......@@ -695,7 +719,7 @@ Obtains the formatting options for **RelativeTimeFormat** objects.
```
## RelativeTimeFormatInputOptions<sup>8+</sup><a name=relativetimeformatinputoptions></a>
## RelativeTimeFormatInputOptions<sup>9+</sup>
Represents the properties of a **RelativeTimeFormat** object.
......
......@@ -7,7 +7,7 @@ There are two types of updates: SD card update and over the air (OTA) update.
- The SD card update depends on the update packages and SD cards.
- The OTA update depends on the server deployed by the device manufacturer for managing update packages. The OTA server IP address is passed by the caller. The request interface is fixed and developed by the device manufacturer.
> **Note:**
> **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.
>
......@@ -239,7 +239,7 @@ var versionDigestInfo = {
// Options of the description file
var descriptionOptions = {
format: DescriptionFormat.STANDARD, // Standard format
format: update.DescriptionFormat.STANDARD, // Standard format
language: "zh-cn" // Chinese
}
......@@ -282,7 +282,7 @@ var versionDigestInfo = {
// Options of the description file
var descriptionOptions = {
format: DescriptionFormat.STANDARD, // Standard format
format: update.DescriptionFormat.STANDARD, // Standard format
language: "zh-cn" // Chinese
}
......@@ -369,7 +369,7 @@ Obtains the description file of the current version. This API uses an asynchrono
```ts
// Options of the description file
var descriptionOptions = {
format: DescriptionFormat.STANDARD, // Standard format
format: update.DescriptionFormat.STANDARD, // Standard format
language: "zh-cn" // Chinese
}
......@@ -406,7 +406,7 @@ Obtains the description file of the current version. This API uses a promise to
```ts
// Options of the description file
var descriptionOptions = {
format: DescriptionFormat.STANDARD, // Standard format
format: update.DescriptionFormat.STANDARD, // Standard format
language: "zh-cn" // Chinese
}
......@@ -1580,7 +1580,7 @@ Represents an update file.
## UpgradeTaskCallback
### (eventInfo: [EventInfo](#eventinfo)): void
(eventInfo: EventInfo): void
Represents an event callback.
......
......@@ -94,14 +94,16 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
**System capability**: SystemCapability.USB.USBManager
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| device | [USBDevice](#usbdevice) | Yes| USB device information.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| device | [USBDevice](#usbdevice) | Yes| USB device information.|
**Return value**
| Type| Description|
| -------- | -------- |
| Readonly&lt;[USBDevicePipe](#usbdevicepipe)&gt; | USB device pipe for data transfer.|
| Type| Description|
| -------- | -------- |
| Readonly&lt;[USBDevicePipe](#usbdevicepipe)&gt; | USB device pipe for data transfer.|
**Example**
......@@ -119,14 +121,16 @@ Checks whether the application has the permission to access the device.
**System capability**: SystemCapability.USB.USBManager
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| deviceName | string | Yes| Device name to set.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| deviceName | string | Yes| Device name.|
**Return value**
| Type| Description|
| -------- | -------- |
| boolean | Returns **true** if the application has the permission to access the device; returns **false** otherwise.|
| Type| Description|
| -------- | -------- |
| boolean | The value **true** indicates that the application has the permission to access the device, and the value **false** indicates the opposite.|
**Example**
......@@ -140,19 +144,21 @@ console.log(bool);
requestRight(deviceName: string): Promise&lt;boolean&gt;
Requests the temporary permission for the application to access the USB device.
Requests the temporary permission for the application to access the USB device. This API uses a promise to return the result.
**System capability**: SystemCapability.USB.USBManager
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| deviceName | string | Yes| Device name to set.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| deviceName | string | Yes| Device name.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;boolean&gt; | Returns **true** if the temporary device access permissions are granted; returns **false** otherwise.|
| Type| Description|
| -------- | -------- |
| Promise&lt;boolean&gt; | Promise used to return the result. The value **true** indicates that the temporary device access permissions are granted, and the value **false** indicates the opposite.|
**Example**
......@@ -174,16 +180,18 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
**System capability**: SystemCapability.USB.USBManager
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
| iface | [USBInterface](#usbinterface) | Yes| USB interface, which is used to determine the index of the interface to claim.|
| force | boolean | No| Whether to forcibly claim the USB interface. The default value is **false**, indicating not to forcibly claim the USB interface.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
| iface | [USBInterface](#usbinterface) | Yes| USB interface, which is used to determine the index of the interface to claim.|
| force | boolean | No| Whether to forcibly claim the USB interface. The default value is **false**, indicating not to forcibly claim the USB interface.|
**Return value**
| Type| Description|
| -------- | -------- |
| number | Returns **0** if the USB interface is successfully claimed; returns an error code otherwise.|
| Type| Description|
| -------- | -------- |
| number | The value **0** indicates that the USB interface is successfully claimed, and an error code indicates the opposite.|
**Example**
......@@ -203,15 +211,17 @@ Before you do this, ensure that you have claimed the interface by calling [usb.c
**System capability**: SystemCapability.USB.USBManager
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
| iface | [USBInterface](#usbinterface) | Yes| USB interface, which is used to determine the index of the interface to release.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
| iface | [USBInterface](#usbinterface) | Yes| USB interface, which is used to determine the index of the interface to release.|
**Return value**
| Type| Description|
| -------- | -------- |
| number | Returns **0** if the USB interface is successfully released; returns an error code otherwise.|
| Type| Description|
| -------- | -------- |
| number | The value **0** indicates that the USB interface is successfully released, and an error code indicates the opposite.|
**Example**
......@@ -231,15 +241,17 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
**System capability**: SystemCapability.USB.USBManager
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
| config | [USBConfig](#usbconfig) | Yes| USB configuration to set.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
| config | [USBConfig](#usbconfig) | Yes| USB configuration to set.|
**Return value**
| Type| Description|
| -------- | -------- |
| number | Returns **0** if the USB configuration is successfully set; returns an error code otherwise.|
| Type| Description|
| -------- | -------- |
| number | The value **0** indicates that the USB configuration is successfully set, and an error code indicates the opposite.|
**Example**
......@@ -266,9 +278,10 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
| iface | [USBInterface](#usbinterface) | Yes | USB interface to set. |
**Return value**
| Type| Description|
| -------- | -------- |
| number | Returns **0** if the USB interface is successfully set; returns an error code otherwise.|
| Type| Description|
| -------- | -------- |
| number | The value **0** indicates that the USB interface is successfully set, and an error code indicates the opposite.|
**Example**
......@@ -289,14 +302,15 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
**Return value**
| Type| Description|
| -------- | -------- |
| Uint8Array | Returns the raw USB descriptor if the operation is successful; returns **undefined** otherwise.|
| Uint8Array | The return value is the raw USB descriptor if the operation is successful, or **undefined** if the operation has failed.|
**Example**
......@@ -315,15 +329,16 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
**System capability**: SystemCapability.USB.USBManager
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
**Return value**
| Type | Description |
| ------ | -------------------- |
| number | Returns the file descriptor of the USB device if the operation is successful; returns **-1** otherwise.|
| number | The return value is the file descriptor of the USB device if the operation is successful, or **-1** if the operation has failed.|
**Example**
......@@ -342,16 +357,18 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
**System capability**: SystemCapability.USB.USBManager
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| USB device pipe, which is used to determine the USB device.|
| contrlparam | [USBControlParams](#usbcontrolparams) | Yes| Control transfer parameters.|
| timeout | number | No| Timeout duration. The default value is **0**, indicating no timeout.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| USB device pipe, which is used to determine the USB device.|
| contrlparam | [USBControlParams](#usbcontrolparams) | Yes| Control transfer parameters.|
| timeout | number | No| Timeout duration in ms. This parameter is optional. The default value is **0**, indicating no timeout.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;number&gt; | Returns the size of the transmitted or received data block if the control transfer is successful; returns **-1** if an exception occurs.|
| Type| Description|
| -------- | -------- |
| Promise&lt;number&gt; | Promise used to return the result, which is the size of the transmitted or received data block if the transfer is successful, or **-1** if an exception has occurred.|
**Example**
......@@ -372,17 +389,19 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
**System capability**: SystemCapability.USB.USBManager
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| USB device pipe, which is used to determine the USB device.|
| endpoint | [USBEndpoint](#usbendpoint) | Yes| USB endpoint, which is used to determine the USB port for data transfer.|
| buffer | Uint8Array | Yes| Buffer for writing or reading data.|
| timeout | number | No| Timeout duration. The default value is **0**, indicating no timeout.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| USB device pipe, which is used to determine the USB device.|
| endpoint | [USBEndpoint](#usbendpoint) | Yes| USB endpoint, which is used to determine the USB port for data transfer.|
| buffer | Uint8Array | Yes| Buffer for writing or reading data.|
| timeout | number | No| Timeout duration in ms. This parameter is optional. The default value is **0**, indicating no timeout.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;number&gt; | Returns the size of the transmitted or received data block if the control transfer is successful; returns **-1** if an exception occurs.|
| Type| Description|
| -------- | -------- |
| Promise&lt;number&gt; | Promise used to return the result, which is the size of the transmitted or received data block if the transfer is successful, or **-1** if an exception has occurred.|
**Example**
......@@ -406,14 +425,16 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
**System capability**: SystemCapability.USB.USBManager
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| USB device pipe.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| USB device pipe.|
**Return value**
| Type| Description|
| -------- | -------- |
| number | Returns **0** if the USB device pipe is closed successfully; returns an error code otherwise.|
| Type| Description|
| -------- | -------- |
| number | The value **0** indicates that the USB device pipe is closed successfully, and an error code indicates the opposite.|
**Example**
......@@ -499,7 +520,7 @@ Sets the current USB function list in Device mode.
**Return value**
| Type | Description |
| ------------------ | ------------------------------------------------------ |
| ------------------ | ------------------------------------------------------------ |
| Promise\<boolean\> | Promise used to return the result. The value **true** indicates that the operation is successful, and the value **false** indicates the opposite.|
**Example**
......@@ -602,7 +623,7 @@ Sets the role types supported by a specified port, which can be **powerRole** (f
**Return value**
| Type | Description |
| ------------------ | -------------- |
| ------------------ | ------------------------------------------------------------ |
| Promise\<boolean\> | Promise used to return the result. The value **true** indicates that the operation is successful, and the value **false** indicates the opposite.|
**Example**
......
# Facial Authentication
The **userIAM.faceAuth** module provides APIs for face enrollment.
> **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.
>
> The APIs provided by this module are system APIs.
## Modules to Import
```js
import userIAM_faceAuth from '@ohos.userIAM.faceAuth';
```
## FaceAuthManager
Provides APIs for facial authentication management.
### constructor
constructor()
A constructor used to create a **FaceAuthManager** object.
**System capability**: SystemCapability.UserIAM.UserAuth.FaceAuth
**Return value**
| Type | Description |
| ---------------------- | -------------------- |
| [FaceAuthManager](#faceauthmanager) | **FaceAuthManager** object.|
**Example**
```js
import userIAM_faceAuth from '@ohos.userIAM.faceAuth';
let faceAuthManager = new userIAM_faceAuth.FaceAuthManager()
```
### setSurfaceId
setSurfaceId(surfaceId: string): ResultCode;
Sets an [XComponent surface ID](../arkui-ts/ts-basic-components-xcomponent.md#getxcomponentsurfaceid) for the face preview page in the face enrollment process.
**System capability**: SystemCapability.UserIAM.UserAuth.FaceAuth
**Parameters**
| Name | Type | Mandatory| Description |
| -------------- | ---------------------------------- | ---- | -------------------------- |
| surfaceId | string | Yes | ID of the surface held by the [XComponent](../arkui-ts/ts-basic-components-xcomponent.md#getxcomponentsurfaceid).|
**Return value**
| Type | Description |
| ---------- | ------------------------------------------------------------ |
| [ResultCode](#resultcode) | Operation result code.|
**Example**
```js
import userIAM_faceAuth from '@ohos.userIAM.faceAuth';
let faceAuthManager = new userIAM_faceAuth.FaceAuthManager()
faceAuthManager.setSurfaceId("0");
```
## ResultCode
Enumerates the operation result codes.
**System capability**: SystemCapability.UserIAM.UserAuth.FaceAuth
| Name | Default Value| Description |
| ----------------------- | ------ | -------------------- |
| SUCCESS | 0 | The operation is successful. |
| FAIL | 1 | The operation fails. |
......@@ -323,7 +323,7 @@ Then, run the build commands in command line (CLI) mode or hb mode.
--compact-mode compatible with standard build system set to false if we use build.sh as build entrance
--gn-args GN_ARGS specifies gn build arguments, eg: --gn-args="foo="bar" enable=true blah=7"
--keep-ninja-going keeps ninja going until 1000000 jobs fail
--build-only-gn only do gn parse, donot run ninja
--build-only-gn only do gn parse, do not run ninja
--log-level LOG_LEVEL
specifies the log level during compilationyou can select three levels: debug, info and error
--fast-rebuild it will skip prepare, preloader, gn_gen steps so we can enable it only when there is no change
......
......@@ -8,9 +8,9 @@ When adding a module, you must declare its dependencies in **BUILD.gn**. **deps*
![Dependency Types](figure/dependency_types.png)
The dependency between modules can be classified into **desp** (left in the figure above) and **external_deps** (right in the figure above).
The dependency between modules can be classified into **deps** (left in the figure above) and **external_deps** (right in the figure above).
- **desp**: The dependent module to be added belongs to the same part with the current module. For example, module 2 depends on module 1, and both modules 1 and 2 belong to the samp component.
- **deps**: The dependent module to be added belongs to the same part with the current module. For example, module 2 depends on module 1, and both modules 1 and 2 belong to the same component.
- **external_deps**: The dependent module to be added belongs to another component. For example, module 2 depends on module 1, and modules 1 and 2 belong to different components.
......
......@@ -15,27 +15,27 @@ HiSysEvent allows you to query system events by specifying search criteria. For
>
> For details about the **HiSysEventRecord** argument in the **OnQuery()** method of **HiSysEventQueryCallback**, see Table 5 in [HiSysEvent Listening](subsys-dfx-hisysevent-listening.md).
**Table 1** Description of the HiSysEvent query API
**Table 1** Description of the HiSysEvent query API
| API| Description|
| -------- | -------- |
| API | Description |
| --- | ----------- |
| int32_t HiSysEventManager::Query(struct QueryArg&amp; arg, std::vector&lt;QueryRule&gt;&amp; rules, std::shared_ptr&lt;HiSysEventQueryCallback&gt; callback) | Queries system events by specifying search criteria such as the time segment, event domain, and event name.<br>Input arguments:<br>- **arg**: event query parameter.<br>- **rules**: rules for event filtering.<br>- **callback**: callback object for event query.<br>Return value:<br>- **0**: Query is successful.<br>- A negative value: Query has failed.|
**Table 2** Description of QueryArg
**Table 2** Description of QueryArg
| Attribute| Description|
| -------- | -------- |
| Attribute | Description |
| --------- | ----------- |
| beginTime | Start time, in the **long long int** format.|
| endTime | End time, in the **long long int** format.|
| maxEvents | Maximum number of returned events, in the **int** format.|
**Table 3** Description of QueryRule
**Table 3** Description of QueryRule
| API| Description|
| -------- | -------- |
| QueryRule(const std::string&amp; domain, const std::vector&lt;std::string&gt;&amp; eventList) | Constructor used to create a **QueryRule** object.<br>Input arguments:<br>- **domain**: domain to which the event of the **QueryRule** object belongs, in the string format. By default, an empty string indicates that the domain is successfully matched.<br>- **eventList**: event name list, in the **std::vector&lt;std::string&gt;** format. By default, an empty string indicates that the event names on the list are successfully matched.|
**Table 4** Description of HiSysEventQueryCallback
**Table 4** Description of HiSysEventQueryCallback
| API| Description|
| -------- | -------- |
......@@ -60,7 +60,7 @@ HiSysEvent allows you to query system events by specifying search criteria. For
void HiSysEventQueryCallback::OnComplete(int32_t reason, int32_t total)
```
Invoke the query API in the corresponding service logic.
Call the query API in the corresponding service logic.
```
HiSysEventManager::Query(struct QueryArg& queryArg,
......@@ -93,7 +93,7 @@ HiSysEvent allows you to query system events by specifying search criteria. For
} // namespace HiviewDFX
} // namespace OHOS
// Invoke the query callback API to obtain system events.
// Call the query callback API to obtain system events.
auto queryCallBack = std::make_shared<HiSysEventToolQuery>();
struct QueryArg args(clientCmdArg.beginTime, clientCmdArg.endTime, clientCmdArg.maxEvents);
std::vector<QueryRule> rules;
......
......@@ -286,4 +286,4 @@ The following table describes APIs available for obtaining device location infor
Location subsystem
[base_location](https://gitee.com/openharmony/base_location)
[base_location](https://gitee.com/openharmony/base_location/blob/master/README.en.md)
......@@ -6,5 +6,5 @@ The table below lists the APIs changes of the multimodal input subsystem in Open
| Module| Class| Method/Attribute/Enumeration/Constant| Change Type|
|---|---|---|---|
| ohos.multimodalInput.inputMonitor | inputMonitor | off(type:"mouse", receiver?:Callback\<MouseEvent>):void; | Added|
| ohos.multimodalInput.inputMonitor | inputMonitor | on(type:"mouse", receiver:Callback\<MouseEvent>):void; | Added|
| ohos.multimodalInput.inputMonitor | inputMonitor | off(type: "mouse", receiver?: Callback\<MouseEvent>):void; | Added|
| ohos.multimodalInput.inputMonitor | inputMonitor | on(type: "mouse", receiver: Callback\<MouseEvent>):void; | Added|
# 法律声明
**版权所有 (c) 2020-2022 OpenHarmony项目,保留一切权利。**
## 版权许可
OpenHarmony文档的著作权由OpenHarmony项目拥有。
OpenHarmony文档根据知识共享署名4.0 (Creative Commons Attribution 4.0,简称CC BY 4.0)国际公共许可协议进行版权许可。为了方便用户理解,您可以通过访问https://creativecommons.org/licenses/by/4.0/了解CC BY 4.0的概要。CC BY 4.0的完整协议内容您可以访问如下网址获取:https://creativecommons.org/licenses/by/4.0/legalcode。
## 商标声明
OpenHarmony文档不涵盖任何关于开放原子基金会和OpenHarmony项目的商标、名称或标志的许可。未经开放原子开源基金会书面事先明示许可,任何第三方不得以任何形式使用开放原子基金会和OpenHarmony项目的商标、名称或标志。
## 免责声明
OpenHarmony项目会不定期对OpenHarmony文档内容进行更新。
OpenHarmony文档在提供时不附带任何明示或默示的担保。在任何情况下,开放原子开源基金会或版权所有者不对任何人因使用OpenHarmony文档内容而引发的任何直接或间接损失承担责任,不论因何种原因导致或者基于何种法律理论,即使其曾被建议有此种损失的可能性。
......@@ -50,16 +50,39 @@
这个权限还需要在应用首次启动的时候弹窗获取用户授权,可以通过如下代码实现:
```js
// FA模型
import featureAbility from '@ohos.ability.featureAbility';
function grantPermission() {
console.info('grantPermission');
let context = featureAbility.getContext();
context.requestPermissionsFromUser(['ohos.permission.DISTRIBUTED_DATASYNC'], 666, function (result) {
console.info(`result.requestCode=${result.requestCode}`)
context.requestPermissionsFromUser(['ohos.permission.DISTRIBUTED_DATASYNC'], 666).then((data) => {
console.info('success: ${data}');
}).catch((error) => {
console.info('failed: ${error}');
})
console.info('end grantPermission');
}
grantPermission();
// Stage模型
import Ability from '@ohos.application.Ability';
let context = null;
function grantPermission() {
class MainAbility extends Ability {
onWindowStageCreate(windowStage) {
let context = this.context;
}
}
let permissions = ['ohos.permission.DISTRIBUTED_DATASYNC'];
context.requestPermissionsFromUser(permissions).then((data) => {
console.log('success: ${data}');
}).catch((error) => {
console.log('failed: ${error}');
});
}
grantPermission();
......@@ -73,25 +96,39 @@
以下为创建分布式数据库管理器的代码示例:
```js
// FA模型获取context
import featureAbility from '@ohos.ability.featureAbility';
let context = featureAbility.getContext();
// Stage模型获取context
import AbilityStage from '@ohos.application.Ability';
let context = null;
class MainAbility extends AbilityStage{
onWindowStageCreate(windowStage){
context = this.context;
}
}
let kvManager;
try {
const kvManagerConfig = {
bundleName: 'com.example.datamanagertest',
userInfo: {
context:context,
userId: '0',
userType: distributedData.UserType.SAME_USER_ID
}
}
distributedData.createKVManager(kvManagerConfig, function (err, manager) {
if (err) {
console.log("createKVManager err: " + JSON.stringify(err));
console.log('createKVManager err: ${error}');
return;
}
console.log("createKVManager success");
console.log('createKVManager success');
kvManager = manager;
});
} catch (e) {
console.log("An unexpected error occurred. Error: " + e);
console.log('An unexpected error occurred. Error: ${e}');
}
```
......@@ -115,14 +152,14 @@
};
kvManager.getKVStore('storeId', options, function (err, store) {
if (err) {
console.log("getKVStore err: " + JSON.stringify(err));
console.log('getKVStore err: ${err}');
return;
}
console.log("getKVStore success");
console.log('getKVStore success');
kvStore = store;
});
} catch (e) {
console.log("An unexpected error occurred. Error: " + e);
console.log('An unexpected error occurred. Error: ${e}');
}
```
......@@ -136,7 +173,7 @@
```js
kvStore.on('dataChange', distributedData.SubscribeType.SUBSCRIBE_TYPE_ALL, function (data) {
console.log("dataChange callback call data: " + JSON.stringify(data));
console.log("dataChange callback call data: ${data}");
});
```
......@@ -153,13 +190,13 @@
try {
kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT, function (err, data) {
if (err != undefined) {
console.log("put err: " + JSON.stringify(err));
console.log('put err: ${error}');
return;
}
console.log("put success");
console.log('put success');
});
} catch (e) {
console.log("An unexpected error occurred. Error: " + e);
console.log('An unexpected error occurred. Error: ${e}');
}
```
......@@ -176,16 +213,16 @@
try {
kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT, function (err, data) {
if (err != undefined) {
console.log("put err: " + JSON.stringify(err));
console.log('put err: ${error}');
return;
}
console.log("put success");
console.log('put success');
kvStore.get(KEY_TEST_STRING_ELEMENT, function (err, data) {
console.log("get success data: " + data);
console.log('get success data: ${data}');
});
});
} catch (e) {
console.log("An unexpected error occurred. Error: " + e);
console.log('An unexpected error occurred. Error: ${e}');
}
```
......@@ -204,7 +241,7 @@
let devManager;
// create deviceManager
deviceManager.createDeviceManager("bundleName", (err, value) => {
deviceManager.createDeviceManager('bundleName', (err, value) => {
if (!err) {
devManager = value;
// deviceIds由deviceManager调用getTrustedDeviceListSync方法得到
......@@ -219,7 +256,7 @@
// 1000表示最大延迟时间为1000ms
kvStore.sync(deviceIds, distributedData.SyncMode.PUSH_ONLY, 1000);
} catch (e) {
console.log("An unexpected error occurred. Error: " + e);
console.log('An unexpected error occurred. Error: ${e}');
}
}
});
......
......@@ -22,15 +22,16 @@ import stats from '@ohos.bundleState';
| function queryAppUsagePriorityGroup(callback: AsyncCallback&lt;number&gt;): void | 查询当前应用的使用优先级群组。callback形式。 |
| function queryAppUsagePriorityGroup(): Promise&lt;number&gt;; | 查询当前应用的使用优先级群组。promise形式。 |
| function isIdleState(bundleName: string, callback: AsyncCallback&lt;boolean&gt;): void | 判断指定Bundle Name的应用当前是否是空闲状态。 |
| function getRecentlyUsedModules(maxNum? : number, callback: AsyncCallback&lt;BundleActiveModuleInfo&gt;): void | 根据maxNum,查询FA使用记录,返回不超过maxNum条FA使用记录,若不填写maxNum参数,则默认maxNum值为1000。 |
| function getRecentlyUsedModules(callback: AsyncCallback&lt;BundleActiveModuleInfo&gt;): void | 查询FA使用记录,返回不超过1000条FA使用记录。 |
| function getRecentlyUsedModules(maxNum: number, callback: AsyncCallback&lt;BundleActiveModuleInfo&gt;): void | 根据maxNum,查询FA使用记录,返回不超过maxNum条FA使用记录。 maxNum不超过1000|
| function queryAppNotificationNumber(begin: number, end: number, callback: AsyncCallback&lt;Array&lt;BundleActiveEventState&gt;&gt;): void | 通过指定起始和结束时间查询所有应用的通知次数。 |
| function queryBundleActiveEventStates(begin: number, end: number, callback: AsyncCallback&lt;Array&lt;BundleActiveEventState&gt;&gt;): void | 通过指定起始和结束时间查询系统事件(休眠、唤醒、解锁、锁屏)统计信息。 |
| function queryAppUsagePriorityGroup(bundleName? : string, callback: AsyncCallback&lt;number&gt;): void | 查询当前调用者应用或者指定应用的使用优先级群组。callback形式。 |
| function queryAppUsagePriorityGroup(bundleName : string, callback: AsyncCallback&lt;number&gt;): void | 查询指定应用的使用优先级群组。callback形式。 |
| function queryAppUsagePriorityGroup(bundleName? : string): Promise&lt;number&gt;; | 查询当前调用者应用或者指定应用的使用优先级群组。promise形式。 |
| function setBundleGroup(bundleName : string, newGroup: GroupType, callback: AsyncCallback&gt;boolean&gt;): void | 给应用名是bundleName的应用分组设置成newGroup,返回设置结果是否成功,以callback形式返回。 |
| function setBundleGroup(bundleName : string, newGroup : GroupType): Promise&gt;boolean&gt;; | 给应用名是bundleName的应用分组设置成newGroup,返回设置结果是否成功,以promise形式返回。 |
| function registerGroupCallBack(callback: Callback&gt;BundleActiveGroupCallbackInfo&gt;, callback: AsyncCallback&gt;boolean&gt;): void | 注册应用分组变化监听回调,返回注册是否成功,当应用分组发生变化时,会给所有已注册的监听者返回回调信息,以callback形式返回。 |
| function registerGroupCallBack(callback: Callback&gt;BundleActiveGroupCallbackInfo&gt;): Promise&gt;boolean&gt;; | 注册应用分组变化监听回调,返回注册是否成功,当应用分组发生变化时,会给所有已注册的监听者返回回调信息,以promise形式返回。 |
| function registerGroupCallBack(groupCallback: Callback&gt;BundleActiveGroupCallbackInfo&gt;, callback: AsyncCallback&gt;boolean&gt;): void | 注册应用分组变化监听回调,返回注册是否成功,当应用分组发生变化时,会给所有已注册的监听者返回回调信息,以callback形式返回。 |
| function registerGroupCallBack(groupCallback: Callback&gt;BundleActiveGroupCallbackInfo&gt;): Promise&gt;boolean&gt;; | 注册应用分组变化监听回调,返回注册是否成功,当应用分组发生变化时,会给所有已注册的监听者返回回调信息,以promise形式返回。 |
| function unRegisterGroupCallBack(callback: AsyncCallback&gt;boolean&gt;): void | 解除应用分组监听回调,以callback形式返回。 |
| function unRegisterGroupCallBack(): Promise&gt;boolean&gt;; | 解除应用分组监听回调,以promise形式返回。 |
......@@ -325,14 +326,14 @@ import stats from '@ohos.bundleState';
```js
import stats from '@ohos.bundleState'
// 无异步方法promise方式
// 无bundleName异步方法promise方式
stats.queryAppUsagePriorityGroup().then(res => {
console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup promise succeeded. result: ' + JSON.stringify(res));
}).catch(err => {
console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup promise failed. because: ' + err.code);
});
// 无异步方法callback方式
// 无bundleName异步方法callback方式
stats.queryAppUsagePriorityGroup((err, res) => {
if (err) {
console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup callback failed. because: ' + err.code);
......@@ -340,16 +341,16 @@ import stats from '@ohos.bundleState';
console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup callback succeeded. result: ' + JSON.stringify(res));
}
});
// 有异步promise方式
stats.queryAppUsagePriorityGroup(this.bundleName).then(res => {
let bundleName = "com.ohos.camera";
// 有bundleName异步promise方式
stats.queryAppUsagePriorityGroup(bundleName).then(res => {
console.log('BUNDLE_ACTIVE QueryPackageGroup promise succeeded. result: ' + JSON.stringify(res));
}).catch(err => {
console.log('BUNDLE_ACTIVE QueryPackageGroup promise failed. because: ' + err.code);
});
// 有异步方法callback方式
stats.queryAppUsagePriorityGroup(this.bundleName, (err, res) => {
// 有bundleName异步方法callback方式
stats.queryAppUsagePriorityGroup(bundleName, (err, res) => {
if (err) {
console.log('BUNDLE_ACTIVE QueryPackageGroup callback failed. because: ' + err.code);
} else {
......
......@@ -13,11 +13,9 @@
**打点接口功能介绍:**
| 接口名 | 描述 |
| ------------------------------------------------------------ | ------------------------------------------------------------ |
| write(string eventName, EventType type, object keyValues, AsyncCallback\<void> callback): void | 应用事件异步打点方法,使用callback方式作为异步回调。 |
| write(string eventName, EventType type, object keyValues): Promise\<void> | 应用事件异步打点方法,使用Promise方式作为异步回调。 |
| write(AppEventInfo info, AsyncCallback\<void> callback): void | 支持domain参数的应用事件异步打点方法,使用callback方式作为异步回调。 |
| write(AppEventInfo info): Promise\<void> | 支持domain参数的应用事件异步打点方法,使用Promise方式作为异步回调。 |
| ------------------------------------------------------------ | ---------------------------------------------------- |
| write(AppEventInfo info, AsyncCallback\<void> callback): void | 应用事件异步打点方法,使用callback方式作为异步回调。 |
| write(AppEventInfo info): Promise\<void> | 应用事件异步打点方法,使用Promise方式作为异步回调。 |
当采用callback作为异步回调时,可以在callback中进行下一步处理。
......@@ -35,7 +33,7 @@
| 接口名 | 描述 |
| -------------------------------------------------- | -------------------- |
| addWatcher(Watcher watcher): AppEventPackageHolder | 新增应用事件订阅者。 |
| addWatcher(Watcher watcher): AppEventPackageHolder | 添加应用事件订阅者。 |
| removeWatcher(Watcher watcher): void | 移除应用事件订阅者。 |
**清理接口功能介绍:**
......@@ -66,7 +64,7 @@
以一次应用事件打点订阅流程为例,说明开发步骤。
1. 新建一个ets应用工程,编辑工程中的“entry > src > main > ets > pages > index.ets” 文件,依次添加三个按钮,以对应用事件打点订阅流程进行模拟。其中,按钮1模拟了应用事件打点的调用,按钮2模拟了新增自动触发回调的事件订阅者的调用,按钮3模拟了移除事件订阅者的调用,完整示例代码如下:
1. 新建一个ets应用工程,编辑工程中的“entry > src > main > ets > pages > index.ets” 文件,依次添加三个按钮,以对应用事件打点订阅流程进行模拟。其中,按钮1模拟了应用事件打点的调用,按钮2模拟了添加自动触发回调的事件订阅者的调用,按钮3模拟了移除事件订阅者的调用,完整示例代码如下:
```ts
import hiAppEvent from '@ohos.hiAppEvent';
......@@ -84,6 +82,7 @@
.fontWeight(FontWeight.Bold)
Button("1 writeTest").onClick(()=>{
// 根据传入的事件参数执行一次应用事件打点
hiAppEvent.write({
domain: "test_domain",
name: "test_event",
......@@ -100,6 +99,7 @@
})
Button("2 addWatcherTest").onClick(()=>{
// 根据传入的订阅参数添加一个应用事件订阅者
hiAppEvent.addWatcher({
name: "watcher1",
appEventFilters: [{ domain: "test_domain" }],
......@@ -109,17 +109,23 @@
timeOut: 2
},
onTrigger: function (curRow, curSize, holder) {
// 返回的holder对象为null表示订阅过程发生异常,因此在记录错误日志后直接返回
if (holder == null) {
console.error("HiAppEvent holder is null");
return;
}
// 设置每次获取的订阅事件包大小阈值为1000字节
holder.setSize(1000);
let eventPkg = null;
// 根据设置阈值大小去获取订阅事件包(返回的事件包对象为null,表示当前订阅数据被全部取出)
while ((eventPkg = holder.takeNext()) != null) {
console.info("HiAppEvent eventPkg.packageId=" + eventPkg.packageId);
console.info("HiAppEvent eventPkg.row=" + eventPkg.row);
console.info("HiAppEvent eventPkg.size=" + eventPkg.size);
// 对获取的订阅事件包进行解析,并将解析结果打印在Log界面
console.info('HiAppEvent eventPkg.packageId=' + eventPkg.packageId);
console.info('HiAppEvent eventPkg.row=' + eventPkg.row);
console.info('HiAppEvent eventPkg.size=' + eventPkg.size);
// 对订阅事件包中的事件字符串数组进行遍历解析
for (const eventInfo of eventPkg.data) {
console.info("HiAppEvent eventPkg.data=" + eventInfo);
console.info('HiAppEvent eventPkg.data=' + eventInfo);
}
}
}
......@@ -127,6 +133,7 @@
})
Button("3 removeWatcherTest").onClick(()=>{
// 移除指定名称的应用事件订阅者
hiAppEvent.removeWatcher({
name: "watcher1"
})
......@@ -147,7 +154,7 @@
success to write event: 0
```
4. 在应用界面点击按钮2进行新增事件订阅者,再多次点击按钮1进行多次打点。在满足回调任一触发条件(事件数量、事件数据大小、定时时长)后,可以在Log窗口看到回调函数触发后获取到的订阅事件包的日志:
4. 在应用界面点击按钮2进行添加事件订阅者,再多次点击按钮1进行多次打点。在满足回调任一触发条件(事件数量、事件数据大小、定时时长)后,可以在Log窗口看到回调函数触发后获取到的订阅事件包的日志:
```
HiAppEvent eventPkg.packageId=0
......
......@@ -4,24 +4,24 @@
设计自检表详细列举出了在全场景设备设计和开发过程中应当注意的设计规则,这将帮助应用减少用户舆情且提升用户体验的一致性。
自检表的要求范围分为“必选”与“推荐”两类。必选类一般为已总结出的较优解决方案或效果,表示相关设计需要按照此原则统一执行;推荐类指可能受应用品牌风格或业务特殊性影响,可适量做出修改。
自检表的要求范围分为“必须”与“推荐”两个类别。必须类一般为已总结出的较优解决方案或效果,表示相关设计需要按照此原则统一执行;推荐类指可能受应用品牌风格或业务特殊性影响,可适量做出修改。
请参考以下表格范围内提出的要求对应用进行检查。
| **类型** | **条目** | **说明** |
| -------- | ------------------ | ------------------------------------------------------------ |
| 应用架构 | 导航结构 | 在各设备上页面导航结构保持一致(同时出多个设备的UX设计)。 |
| 布局 | 拉通设计 | 拉通各设备的布局设计,保证在不同尺寸和分辨率的设备上能够无错位/不截断/不变形/不过多空白(50%以上)/不过于拥挤(间距小于16vp,明显截断)/无大图大字体地正常显示。 |
| | 响应式设计 | 栅格布局只能占N列以及N列内部的Gutter,不包含N列两侧的Gutter。 |
| | 响应式设计 | 明确标注使用什么类型的栅格、给出在不同断点下栅格三要素取值。 |
| | 响应式设计 | 按容器去对齐栅格,而不是内部子元素对齐栅格。 |
| | 响应式设计 | 栅格除了页面布局设计外,在做局部栅格设计时,需要通过明显方式如颜色等进行标注区分,避免混淆。 |
| | 响应式设计 | 禁止出现标注了栅格但实际没有通过栅格进行布局设计,避免混淆。 |
| | 自适应设计 | 非栅格设计场景下,明确标注自适应布局能力。自适应布局能力有:拉伸、均分、占比、缩放、延伸、隐藏、折行。 |
| 人机交互 | 输入方式 | 需保证在各设备上完整支持触摸、鼠标、触控、键盘、遥控器、摇杆等交互方式,并符合标准定义。 |
| | 交互归一 | 应使用系统提供的控件以达到一致的交互体验。如有定制,需保证在各场景下,不同输入设备上的操作与指南要求一致。需特别注意鼠标行为。 |
| 视觉风格 | 单位 | 用于界面布局的单位应全部使用vp。只针对严格控制元素尺寸的场景使用px。 |
| | 色彩 | 用于色彩的赋值应使用分层参数。推荐支持深色模式,需保证界面在系统切换色彩模式时没有识别性问题。 |
| | 字体 | 使用fp为文字大小单位,需要响应系统大字体模式,确保系统调节字体大小后,界面字体能响应变化大小,并且界面布局没有出现布局错乱问题。 |
| 多态控件 | 支持常用的控件状态 | 确保控件不同状态下的视觉效果没有缺失。控件的常用状态有:正常态、不可用态、点击态、获焦态、激活态、悬停态。 |
\ No newline at end of file
| **类型** | **条目** | **说明** | **类别** |
| -------- | ------------------ | ------------------------------------------------------------ | ------ |
| 应用架构 | 导航结构 | 在各设备上页面导航结构保持一致(同时出多个设备的UX设计)。 | 推荐 |
| 布局 | 拉通设计 | 拉通各设备的布局设计,保证在不同尺寸和分辨率的设备上能够无错位/不截断/不变形/不过多空白(50%以上)/不过于拥挤(间距小于16vp,明显截断)/无大图大字体地正常显示。 | 必须 |
| | 响应式设计 | 栅格布局只能占N列以及N列内部的Gutter,不包含N列两侧的Gutter。 | 必须 |
| | 响应式设计 | 明确标注使用什么类型的栅格、给出在不同断点下栅格三要素取值。 | 推荐 |
| | 响应式设计 | 按容器去对齐栅格,而不是内部子元素对齐栅格。 | 必须 |
| | 响应式设计 | 栅格除了页面布局设计外,在做局部栅格设计时,需要通过明显方式如颜色等进行标注区分,避免混淆。 | 推荐 |
| | 响应式设计 | 禁止出现标注了栅格但实际没有通过栅格进行布局设计,避免混淆。 | 必须 |
| | 自适应设计 | 非栅格设计场景下,明确标注自适应布局能力。自适应布局能力有:拉伸、均分、占比、缩放、延伸、隐藏、折行。 | 推荐 |
| 人机交互 | 输入方式 | 需保证在各设备上完整支持触摸、鼠标、触控、键盘、遥控器、摇杆等交互方式,并符合标准定义。 | 推荐 |
| | 交互归一 | 应使用系统提供的控件以达到一致的交互体验。如有定制,需保证在各场景下,不同输入设备上的操作与指南要求一致。需特别注意鼠标行为。 | 推荐 |
| 视觉风格 | 单位 | 用于界面布局的单位应全部使用vp。只针对严格控制元素尺寸的场景使用px。 | 必须 |
| | 色彩 | 用于色彩的赋值应使用分层参数。推荐支持深色模式,需保证界面在系统切换色彩模式时没有识别性问题。 | 推荐 |
| | 字体 | 使用fp为文字大小单位,需要响应系统大字体模式,确保系统调节字体大小后,界面字体能响应变化大小,并且界面布局没有出现布局错乱问题。 | 必须 |
| 多态控件 | 支持常用的控件状态 | 确保控件不同状态下的视觉效果没有缺失。控件的常用状态有:正常态、不可用态、点击态、获焦态、激活态、悬停态。 | 推荐 |
\ No newline at end of file
......@@ -25,13 +25,4 @@
接下来将依次介绍自适应布局和响应式布局,同时结合实际,通过典型布局场景以及典型页面场景详细介绍两种布局能力的用法。
## 相关实例
针对一次开发,多端部署,有以下相关实例可供参考:
- [`MusicAlbum`:一多音乐专辑主页(eTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/MultiDeviceAppDev/MusicAlbum)
- [`AppMarket`:一多应用市场首页(eTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/MultiDeviceAppDev/AppMarket)
- [`AdaptiveCapabilities`:多设备自适应能力(eTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/MultiDeviceAppDev/AdaptiveCapabilities)
- [`JsAdaptiveCapabilities`:多设备自适应能力(JS)(API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/MultiDeviceAppDev/JsAdaptiveCapabilities)
- [一次开发多端部署(eTS)(API8)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/MultiDeploymentEts)
......@@ -19,6 +19,21 @@
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> - 开发多设备上同一页面时,建议开发者多使用[自定义组件](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/ui/ts-component-based-component.md),既可以增加代码的可读性和可维护性,同时也可以尽可能的实现代码复用。
>
> - 本章中涉及的示例代码均可以在[OpenHarmony应用示例](https://gitee.com/openharmony/applications_app_samples/tree/master/MultiDeviceAppDev)中获取,感兴趣的开发者可以自行下载、运行及查看效果。
> 开发多设备上同一页面时,建议开发者多使用[自定义组件](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/ui/ts-component-based-component.md),既可以增加代码的可读性和可维护性,同时也可以尽可能的实现代码复用。
## 相关示例
[OpenHarmony应用示例](https://gitee.com/openharmony/applications_app_samples/tree/master/MultiDeviceAppDev)中提供了如下一多示例,感兴趣的开发者可以自行下载、运行及查看效果。
| 示例名称 | 开发范式 | 简介 |
| ------------------------------------------------------------ | -------------- | ------------------------------------------------------------ |
| [页面开发一多能力](https://gitee.com/openharmony/applications_app_samples/tree/master/MultiDeviceAppDev/AdaptiveCapabilities) | 声明式开发范式 | 本章配套的示例代码,包括自适应布局、响应式布局、典型布局场景以及资源文件使用等。 |
| [页面开发一多能力](https://gitee.com/openharmony/applications_app_samples/tree/master/MultiDeviceAppDev/JsAdaptiveCapabilities) | 类Web开发范式 | 本章配套的示例代码,包括自适应布局、响应式布局及资源文件使用等。 |
| [应用市场首页](https://gitee.com/openharmony/applications_app_samples/tree/master/MultiDeviceAppDev/AppMarket) | 声明式开发范式 | 本章配套的示例代码,以应用市场首页为例,演示如何使用一多能力适配多设备(或多窗口尺寸)。 |
| [音乐专辑页](https://gitee.com/openharmony/applications_app_samples/tree/master/MultiDeviceAppDev/MusicAlbum) | 声明式开发范式 | 本章配套的示例代码,以音乐专辑页为例,演示如何使用一多能力适配多设备(或多窗口尺寸)。 |
| [蔬菜百科首页](https://gitee.com/openharmony/applications_app_samples/tree/master/MultiDeviceAppDev/Vegetable) | 声明式开发范式 | 一多示例页面,以蔬菜百科首页为例,演示如何使用一多能力适配多设备(或多窗口尺寸)。 |
| [天气](https://gitee.com/openharmony/applications_app_samples/tree/master/MultiDeviceAppDev/Weather) | 声明式开发范式 | 一多示例应用,以天气应用为例,演示如何使用一多能力实现包含多个页面的应用。 |
......@@ -254,8 +254,7 @@ struct MediaQuerySample {
## 栅格布局
## <sub>栅格</sub>
### 简介
栅格是多设备场景下通用的辅助定位工具,通过将空间分割为有规律的栅格。栅格可以显著降低适配不同屏幕尺寸的设计及开发成本,使得整体设计和开发流程更有秩序和节奏感,同时也保证多设备上应用显示的协调性和一致性,提升用户体验。
......@@ -270,9 +269,6 @@ struct MediaQuerySample {
单个Column的宽度是系统结合Margin、Gutter和Columns自动计算的,不需要也不允许开发者手动配置。
### 栅格布局
栅格布局就是栅格结合了断点,实现栅格布局能力的组件叫栅格组件。在实际使用场景中,可以根据需要配置不同断点下栅格组件中元素占据的列数,同时也可以调整Margin、Gutter、Columns的取值,从而实现不同的布局效果。
| sm断点 | md断点 |
......@@ -353,7 +349,7 @@ struct GridRowSample2 {
// 侧边栏,尺寸变化范围 [100vp, 600vp]
Column(){}.width('100%').backgroundColor('#19000000')
// 内容区,尺寸变化范围 [窗口宽度550vp, 窗口宽度50vp]
// 内容区,尺寸变化范围 [550vp, 50vp]
GridRow({breakpoints: {value: ['100vp', '200vp', '300vp', '400vp', '500vp'],
reference: BreakpointsReference.ComponentSize}}) {
GridCol({span:{xs: 12, sm: 12, md: 12, lg:12, xl: 12, xxl:12}}) {
......@@ -395,7 +391,6 @@ struct GridRowSample2 {
总的来讲,margin在组件外而padding在组件内,开发者可以根据实际需要进行选择及实现目标效果。
**示例3:**
......@@ -729,8 +724,3 @@ struct GridRowSample9 {
如前所述,栅格组件提供了丰富的自定义能力,功能异常灵活和强大。只需要明确栅格在不同断点下的Columns、Margin、Gutter及span等参数,即可确定最终布局,无需关心具体的设备类型及设备状态(如横竖屏)等。栅格可以节约设计团队与开发团队的沟通成本,提升整体开发效率。
## 相关实例
针对栅格断点系统开发,有以下相关实例可供参考:
- [`Weather`:一多天气(eTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/MultiDeviceAppDev/Weather)
......@@ -182,7 +182,7 @@
## 实现页面间的跳转
页面间的导航可以通过页面路由router来实现。页面路由router根据页面url找到目标页面,从而实现跳转。使用页面路由请导入router模块。
页面间的导航可以通过[页面路由router](../reference/apis/js-apis-router.md#routerpush)来实现。页面路由router根据页面url找到目标页面,从而实现跳转。使用页面路由请导入router模块。
1. 第一个页面跳转到第二个页面。
......
......@@ -181,7 +181,7 @@
## 实现页面间的跳转
页面间的导航可以通过页面路由router来实现。页面路由router根据页面url找到目标页面,从而实现跳转。使用页面路由请导入router模块。
页面间的导航可以通过[页面路由router](../reference/apis/js-apis-router.md#routerpush)来实现。页面路由router根据页面url找到目标页面,从而实现跳转。使用页面路由请导入router模块。
1. 第一个页面跳转到第二个页面。
......
......@@ -175,7 +175,7 @@
## 实现页面间的跳转
页面间的导航可以通过[页面路由router](../ui/ui-js-building-ui-routes.md)来实现。页面路由router根据页面url找到目标页面,从而实现跳转。使用页面路由请导入router模块。
页面间的导航可以通过[页面路由router](../reference/apis/js-apis-router.md#routerpush)来实现。页面路由router根据页面url找到目标页面,从而实现跳转。使用页面路由请导入router模块。
1. 第一个页面跳转到第二个页面。
......
......@@ -8,8 +8,8 @@ wantConstant模块提供want中操作want常数和解释Flags说明的能力。
## 导入模块
```
import wantConstant from '@ohos.ability.wantConstant'
```js
import wantConstant from '@ohos.ability.wantConstant';
```
## wantConstant.Action
......@@ -26,7 +26,7 @@ want操作的常数。
| ACTION_WIRELESS_SETTINGS | ohos.settings.wireless | 指示启动提供无线网络设置的页面功能的操作,例如,Wi-Fi选项。 |
| ACTION_MANAGE_APPLICATIONS_SETTINGS | ohos.settings.manage.applications | 指示启动管理已安装应用程序的页面功能的操作。 |
| ACTION_APPLICATION_DETAILS_SETTINGS | ohos.settings.application.details | 指示启动显示指定应用程序详细信息的页面功能的操作。 |
| ACTION_SET_ALARM | ohos.want.action.setAlarm | 指示启动页面功能以设置闹钟的操作。 |
| ACTION_SET_ALARM | ohos.want.action.setAlarm | 指示启动页面功能以设置闹钟的操作。 |
| ACTION_SHOW_ALARMS | ohos.want.action.showAlarms | 指示启动显示所有警报的页面功能的操作时钟。 |
| ACTION_SNOOZE_ALARM | ohos.want.action.snoozeAlarm | 指示启动用于使闹钟睡眠的页面功能的操作。 |
| ACTION_DISMISS_ALARM | ohos.want.action.dismissAlarm | 指示启动删除闹钟的页面功能的操作。 |
......
......@@ -11,7 +11,7 @@ AbilityDelegatorArgs模块提供在应用程序启动期间,用于存储已注
通过AbilityDelegatorRegistry中getArguments方法获取。
```js
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
var args = AbilityDelegatorRegistry.getArguments();
```
......
......@@ -49,6 +49,8 @@ applyQuickFix(hapModuleQuickFixFiles: Array\<string>, callback: AsyncCallback\<v
快速修复的补丁安装接口。
**需要权限**: ohos.permission.INSTALL_BUNDLE
**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.QuickFix
**系统API**: 此接口为系统接口,三方应用不支持调用。
......@@ -77,10 +79,12 @@ applyQuickFix(hapModuleQuickFixFiles: Array\<string>, callback: AsyncCallback\<v
## quickFixManager.applyQuickFix
applyQuickFix(hapModuleQuickFixFiles: Array\<string>): Promise<void>;
applyQuickFix(hapModuleQuickFixFiles: Array\<string>): Promise\<void>;
快速修复的补丁安装接口。
**需要权限**: ohos.permission.INSTALL_BUNDLE
**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.QuickFix
**系统API**: 此接口为系统接口,三方应用不支持调用。
......@@ -116,6 +120,8 @@ getApplicationQuickFixInfo(bundleName: string, callback: AsyncCallback\<Applicat
获取应用的快速修复信息。
**需要权限**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.QuickFix
**系统API**: 此接口为系统接口,三方应用不支持调用。
......@@ -148,6 +154,8 @@ getApplicationQuickFixInfo(bundleName: string): Promise\<ApplicationQuickFixInfo
获取应用的快速修复信息。
**需要权限**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.QuickFix
**系统API**: 此接口为系统接口,三方应用不支持调用。
......
......@@ -866,7 +866,7 @@ onProcessDied(processData: ProcessData): void;
| bundleName<sup>8+</sup> | string | 是 | 否 | 应用包名。 |
| uid<sup>8+</sup> | number | 是 | 否 | 用户ID。 |
| isContinuousTask<sup>9+</sup> | boolean | 是 | 否 | 判断过程是否为连续任务。 |
| isKeepAlive<sup>8+</sup> | boolean | 是 | 否 | 判断该过程是否保持活跃。 |
| isKeepAlive<sup>9+</sup> | boolean | 是 | 否 | 判断该过程是否保持活跃。 |
## ProcessRunningInfo
......
......@@ -7,7 +7,7 @@
ExtensionAbility信息,未做特殊说明的属性,均通过GET_BUNDLE_DEFAULT获取
ExtensionAbility信息,未做特殊说明的属性,均通过[getBundleInfo](js-apis-Bundle.md#bundlegetbundleinfo)获取,flag使用[GET_BUNDLE_DEFAULT](js-apis-Bundle.md#bundleflag)获取
## ExtensionAbilityInfo
......
......@@ -830,7 +830,7 @@ promise.then(data => {
## call.reject<sup>7+</sup>
reject\(callId: number, options: RejectMessageOption, callback: AsyncCallback<void\>\): void
reject\(callId: number, options: RejectMessageOptions, callback: AsyncCallback<void\>\): void
拒绝来电。使用callback异步回调。
......
......@@ -812,7 +812,7 @@ getZoomRatioRange\(callback: AsyncCallback<Array<number\>\>\): void
| 名称 | 类型 | 必填 | 说明 |
| -------- | ------------------------------ | ---- | ------------------------ |
| callback | AsyncCallback<Array<number\>\> | 是 | 回调函数,用于获取结果。 |
| callback | AsyncCallback<Array<number\>\> | 是 | 回调函数,用于获取可变焦距比范围,返回的数组包括其最小值和最大值。 |
**示例:**
......@@ -838,7 +838,7 @@ getZoomRatioRange\(\): Promise<Array<number\>\>
| 类型 | 说明 |
| ------------------------ | ------------------------------------------- |
| Promise<Array<number\>\> | 使用Promise的方式获取当前的可变焦距比范围。 |
| Promise<Array<number\>\> | 使用Promise的方式获取当前的可变焦距比范围,返回的数组包括其最小值和最大值。 |
**示例:**
......
# 标准NFC-cardEmulation
本模块主要用于操作及管理NFC卡模拟
本模块主要提供NFC卡模拟业务,包括判断支持哪种卡模拟类型,HCE卡模拟的业务实现等
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从API version 6开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
......@@ -12,30 +12,49 @@
import cardEmulation from '@ohos.nfc.cardEmulation';
```
## FeatureType
定义不同的NFC卡模拟类型。
**系统能力**:SystemCapability.Communication.NFC.Core
| 名称 | 默认值 | 说明 |
| -------- | -------- | -------- |
| HCE | 0 | HCE 卡模拟。 |
| UICC | 1 | SIM 卡模拟。 |
| ESE | 2 | ESE卡模拟。 |
## cardEmulation.isSupported
isSupported(feature: number): boolean
是否支持某种类型的卡模拟
是否支持某种类型的卡模拟。
**需要权限**:ohos.permission.NFC_CARD_EMULATION
**系统能力**:SystemCapability.Communication.NFC.Core
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------- | -------- | ---- | ----------------------- |
| feature | number | 是 | 卡模拟类型值,详细请见[FeatureType](#featuretype)枚举值。 |
**返回值:**
| **类型** | **说明** |
| -------- | -------- |
| boolean | true:支持该类型卡模拟,&nbsp;false:不支持该类型卡模拟。 |
| boolean | true: 支持该类型卡模拟,&nbsp;false: 不支持该类型卡模拟。 |
## HceService<sup>8+</sup>
管理HCE卡模拟。在调用HceService的接口前,需要先通过new cardEmulation.HceService()创建实例
提供HCE卡模拟的实现,主要包括接收对端读卡设备的APDU数据,并响应APDU数据到对端读卡设备。使用HCE相关接口前,必须先判断设备是否支持HCE卡模拟能力
### startHCE<sup>8+</sup>
startHCE(aidList: string[]): boolean
开始使用HCE能力
启动HCE业务功能。包括设置当前应用为前台优先,动态注册AID列表
**需要权限**:ohos.permission.NFC_CARD_EMULATION
......@@ -45,13 +64,13 @@ startHCE(aidList: string[]): boolean
| 参数名 | 类型 | 必填 | 说明 |
| ------- | -------- | ---- | ----------------------- |
| aidList | string[] | 是 | 注册进行卡模拟的aid列表 |
| aidList | string[] | 是 | 动态注册卡模拟的AID列表。 |
### stopHCE<sup>8+</sup>
stopHCE(): boolean
停止使用HCE能力
停止HCE业务功能。包括退出当前应用前台优先,释放动态注册的AID列表
**需要权限**:ohos.permission.NFC_CARD_EMULATION
......@@ -61,7 +80,7 @@ stopHCE(): boolean
on(type: "hceCmd", callback: AsyncCallback<number[]>): void;
在startHCE后,订阅对端设备消息
订阅回调,用于接收对端读卡设备发送的APDU数据
**需要权限**:ohos.permission.NFC_CARD_EMULATION
......@@ -71,14 +90,14 @@ on(type: "hceCmd", callback: AsyncCallback<number[]>): void;
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------- | ---- | -------------------------------------------- |
| type | string | 是 | 固定填"hceCmd"字符串 |
| callback | AsyncCallback<number[]> | 是 | 订阅的事件回调,入参是符合APDU协议的数据数组 |
| type | string | 是 | 固定填"hceCmd"字符串 |
| callback | AsyncCallback<number[]> | 是 | 订阅的事件回调,入参是符合APDU协议的数据,每个number十六进制表示,范围是0x00~0xFF。 |
### sendResponse<sup>8+</sup>
sendResponse(responseApdu: number[]): void;
发送数据到对端设备。
发送APDU数据到对端读卡设备。
**需要权限**:ohos.permission.NFC_CARD_EMULATION
......@@ -88,16 +107,25 @@ sendResponse(responseApdu: number[]): void;
| 参数名 | 类型 | 必填 | 说明 |
| ------------ | -------- | ---- | -------------------------------------------------- |
| responseApdu | number[] | 是 | 准备发送到对端的数据,入参是符合APDU协议的数据数组 |
| responseApdu | number[] | 是 | 发送到对端读卡设备的符合APDU协议的数据,每个number十六进制表示,范围是0x00~0xFF。 |
**示例:**
```js
import cardEmulation from '@ohos.nfc.cardEmulation';
var isHceSupported = cardEmulation.isSupported(cardEmulation.FeatureType.HCE);
if (!isHceSupported) {
console.log('this device is not supported for HCE, ignore it.');
return;
}
// device supports HCE, transimit APDU with remote nfc reader.
var hceService = new cardEmulation.HceService();
hceService.startHCE([
"F0010203040506", "A0000000041010"
])
hceService.stopHCE();
]);
hceService.on("hceCmd", (err, res) => {
if(err.data === 0) {
console.log('callback => Operation hceCmd succeeded. Data: ' + JSON.stringify(res));
......@@ -108,16 +136,8 @@ hceService.on("hceCmd", (err, res) => {
console.log('callback => Operation hceCmd failed. Cause: ' + err.data);
}
})
```
## FeatureType
表示NFC支持的卡模拟类型枚举。
**系统能力**:SystemCapability.Communication.NFC.Core
| 名称 | 默认值 | 说明 |
| -------- | -------- | -------- |
| HCE | 0 | 该常量用于检查是否支持 HCE 卡模拟。 |
| UICC | 1 | 该常量用于检查是否支持 SIM 卡模拟。 |
| ESE | 2 | 该常量用于检查是否支持ESE卡模拟。 |
// stop HCE when the application exit the nfc card emulation.
hceService.stopHCE();
```
......@@ -204,8 +204,8 @@ updateContact(contact: Contact, attrs: ContactAttributes, callback: AsyncCallbac
contact.updateContact({
name: {fullName: 'xxx'},
phoneNumbers: [{phoneNumber: '138xxxxxxxx'}]
},{
attributes:[contact.Attribute.ATTR_EMAIL, contact.Attribute.ATTR_NAME]
}, {
attributes: [contact.Attribute.ATTR_EMAIL, contact.Attribute.ATTR_NAME]
}, (err) => {
if (err) {
console.log('updateContact callback: err->${JSON.stringify(err)}');
......@@ -433,7 +433,7 @@ queryMyCard(attrs: ContactAttributes, callback: AsyncCallback&lt;Contact&gt;): v
```js
contact.queryMyCard({
attributes:[contact.Attribute.ATTR_EMAIL, contact.Attribute.ATTR_NAME]
attributes: [contact.Attribute.ATTR_EMAIL, contact.Attribute.ATTR_NAME]
}, (err, data) => {
if (err) {
console.log(`queryMyCard callback: err->${JSON.stringify(err)}`);
......@@ -469,7 +469,7 @@ queryMyCard(attrs?: ContactAttributes): Promise&lt;Contact&gt;
```js
let promise = contact.queryMyCard({
attributes:[contact.Attribute.ATTR_EMAIL, contact.Attribute.ATTR_NAME]
attributes: [contact.Attribute.ATTR_EMAIL, contact.Attribute.ATTR_NAME]
});
promise.then((data) => {
console.log(`queryMyCard success: data->${JSON.stringify(data)}`);
......@@ -487,7 +487,7 @@ selectContact(callback: AsyncCallback&lt;Array&lt;Contact&gt;&gt;): void
**需要权限**:ohos.permission.READ_CONTACTS
**系统能力**:SystemCapability.Applications.ContactsData
**系统能力**:SystemCapability.Applications.Contacts
**参数:**
......@@ -516,7 +516,7 @@ selectContact(): Promise&lt;Array&lt;Contact&gt;&gt;
**需要权限**:ohos.permission.READ_CONTACTS
**系统能力**:SystemCapability.Applications.Contacts、SystemCapability.Applications.ContactsData
**系统能力**:SystemCapability.Applications.Contacts
**返回值:**
......
......@@ -483,9 +483,9 @@ getRecentlyUsedModules(maxNum?: number): Promise&lt;Array&lt;BundleActiveModuleI
## bundleState.getRecentlyUsedModules<sup>9+</sup>
getRecentlyUsedModules(maxNum?: number, callback: AsyncCallback&lt;Array&lt;BundleActiveModuleInfo&gt;&gt;): void
getRecentlyUsedModules(callback: AsyncCallback&lt;Array&lt;BundleActiveModuleInfo&gt;&gt;): void
查询FA使用记录。使用CallBack形式返回数量最大不超过maxNum设置的值,FA使用记录由近及远排序,maxNum最大为1000
查询FA使用记录。使用CallBack形式返回数量不超过1000条FA使用记录(FA记录按时间由近及远排序)
**需要权限**:ohos.permission.BUNDLE_ACTIVE_INFO
......@@ -497,13 +497,12 @@ getRecentlyUsedModules(maxNum?: number, callback: AsyncCallback&lt;Array&lt;Bund
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ----------------------------------- |
| maxNum | number | 否 | 返回条目的最大数量,最多支持1000条。若不填写,则默认为1000。 |
| callback | AsyncCallback&lt;Array&lt;[BundleActiveModuleInfo](#bundleactivemoduleinfo9)&gt;&gt; | 是 | 指定的CallBack回调方法。返回不超过maxNum条FA使用记录。 |
**示例**
```js
bundleState.getRecentlyUsedModules(1000,(err, res) => {
bundleState.getRecentlyUsedModules((err, res) => {
if(err) {
console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback failed, because: ' + err.code);
} else {
......@@ -514,9 +513,31 @@ getRecentlyUsedModules(maxNum?: number, callback: AsyncCallback&lt;Array&lt;Bund
}
}
});
```
// 无maxNum参数调用方式
bundleState.getRecentlyUsedModules((err, res) => {
## bundleState.getRecentlyUsedModules<sup>9+</sup>
getRecentlyUsedModules(maxNum: number, callback: AsyncCallback&lt;Array&lt;BundleActiveModuleInfo&gt;&gt;): void
查询FA使用记录。使用CallBack形式返回数量最大不超过maxNum设置的值,FA使用记录由近及远排序,maxNum最大为1000。
**需要权限**:ohos.permission.BUNDLE_ACTIVE_INFO
**系统能力**:SystemCapability.ResourceSchedule.UsageStatistics.App
**系统API**:此接口为系统接口,三方应用不支持调用。
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ----------------------------------- |
| maxNum | number | 是 | 返回FA记录的最大数量,maxNum最大为1000。|
| callback | AsyncCallback&lt;Array&lt;[BundleActiveModuleInfo](#bundleactivemoduleinfo9)&gt;&gt; | 是 | 指定的CallBack回调方法。返回不超过maxNum条FA使用记录。 |
**示例**
```js
bundleState.getRecentlyUsedModules(1000,(err, res) => {
if(err) {
console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback failed, because: ' + err.code);
} else {
......@@ -573,9 +594,9 @@ bundleState.queryAppUsagePriorityGroup().then( res => {
## bundleState.queryAppUsagePriorityGroup<sup>9+</sup>
queryAppUsagePriorityGroup(bundleName? : string, callback: AsyncCallback&lt;number&gt;): void
queryAppUsagePriorityGroup(callback: AsyncCallback&lt;number&gt;): void
可选参数。有参则查询指定bundleName对应应用的分组。无参数时查询当前应用的分组。使用callback形式返回其应用分组。
查询当前应用的分组。使用callback形式返回其应用分组。
**需要权限**:ohos.permission.BUNDLE_ACTIVE_INFO
......@@ -587,23 +608,44 @@ queryAppUsagePriorityGroup(bundleName? : string, callback: AsyncCallback&lt;numb
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | --------------------- | ---- | ---------------------------------------- |
| bundleName | string | 否 | 可选参数。有此参数则查询指定bundleName对应应用的分组。无此参数时查询当前应用的分组。 |
| callback | AsyncCallback&lt;number&gt; | 是 | 指定的CallBack回调方法。返回查询的应用分组。 |
| callback | AsyncCallback&lt;number&gt; | 是 | 指定的CallBack回调方法。返回当前应用的分组。 |
**示例**
```javascript
//有bundleName的callback
let bundleName = "com.ohos.camera";
bundleState.queryAppUsagePriorityGroup(bundleName, (err, res) => {
bundleState.queryAppUsagePriorityGroup((err, res) => {
if(err) {
console.log('BUNDLE_ACTIVE QueryPackageGroup callback failed. because: ' + err.code);
} else {
console.log('BUNDLE_ACTIVE QueryPackageGroup callback succeeded. result: ' + JSON.stringify(res));
}
});
//无bundleName的callback
bundleState.queryAppUsagePriorityGroup((err, res) => {
```
## bundleState.queryAppUsagePriorityGroup<sup>9+</sup>
queryAppUsagePriorityGroup(bundleName : string, callback: AsyncCallback&lt;number&gt;): void
查询指定bundleName对应应用的分组。使用callback形式返回其应用分组。
**需要权限**:ohos.permission.BUNDLE_ACTIVE_INFO
**系统能力**:SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
**系统API**:此接口为系统接口,三方应用不支持调用。
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | --------------------- | ---- | ---------------------------------------- |
| bundleName | string | 是 | 查询指定bundleName对应应用的分组。 |
| callback | AsyncCallback&lt;number&gt; | 是 | 指定的CallBack回调方法。返回制指定bundleName的应用分组。|
**示例**
```javascript
let bundleName = "com.ohos.camera";
bundleState.queryAppUsagePriorityGroup(bundleName, (err, res) => {
if(err) {
console.log('BUNDLE_ACTIVE QueryPackageGroup callback failed. because: ' + err.code);
} else {
......@@ -687,7 +729,7 @@ bundleState.setBundleGroup(bundleName, newGroup, (err) => {
## bundleState.registerGroupCallBack<sup>9+</sup>
registerGroupCallBack(callback: Callback&lt;BundleActiveGroupCallbackInfo&gt;): Promise&lt;void&gt;
registerGroupCallBack(groupCallback: Callback&lt;BundleActiveGroupCallbackInfo&gt;): Promise&lt;void&gt;
应用注册分组变化监听,待用户名下的某个应用分组发生变化时,通过callback形式向所有已注册分组变化监听的应用返回[BundleActiveGroupCallbackInfo](#bundleactivegroupcallbackinfo9)信息。使用Promise形式返回注册是否成功。
......@@ -729,7 +771,7 @@ bundleState.registerGroupCallBack(onBundleGroupChanged).then( () => {
## bundleState.registerGroupCallBack<sup>9+</sup>
registerGroupCallBack(callback: Callback&lt;BundleActiveGroupCallbackInfo&gt;, callback: AsyncCallback&lt;void&gt;): void
registerGroupCallBack(groupCallback: Callback&lt;BundleActiveGroupCallbackInfo&gt;, callback: AsyncCallback&lt;void&gt;): void
应用注册分组变化监听,待用户名下的某个应用分组发生变化时,通过callback形式向所有已注册分组变化监听的应用返回[BundleActiveGroupCallbackInfo](#bundleactivegroupcallbackinfo9)信息。使用异步callback形式返回注册监听是否成功。
......
......@@ -1008,7 +1008,7 @@ try {
}).catch((err) => {
console.log('getResultSet failed: ' + err);
});
const moved5 = resultSet.move();
const moved5 = resultSet.move(1);
console.log("move succeed:" + moved5);
} catch (e) {
console.log("move failed: " + e);
......@@ -1048,7 +1048,7 @@ try {
}).catch((err) => {
console.log('getResultSet failed: ' + err);
});
const moved6 = resultSet.moveToPosition();
const moved6 = resultSet.moveToPosition(1);
console.log("moveToPosition succeed: " + moved6);
} catch (e) {
console.log("moveToPosition failed: " + e);
......
......@@ -122,3 +122,12 @@ import formInfo from '@ohos.application.formInfo';
| Dimension_2_1<sup>9+</sup> | 5 | 2 x 1 form。 |
## FormInfoFilter
卡片信息过滤器,仅将符合过滤器内要求的卡片信息返回。
**系统能力**:SystemCapability.Ability.Form
| 名称 | 必选 | 说明 |
| ----------- | ---- | ------------ |
| moduleName<sup>9+</sup> | 否 | 可选字段,表示仅保留moduleName与提供值相符的卡片信息。 |
......@@ -183,7 +183,7 @@ getFormsInfo(filter: formInfo.FormInfoFilter, callback: AsyncCallback&lt;Array&l
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| filter | formInfo.FormInfoFilter | 是 | 过滤卡片信息 |
| filter | [formInfo.FormInfoFilter](./js-apis-formInfo.md#forminfofilter) | 是 | 过滤卡片信息 |
| callback | AsyncCallback&lt;Array&lt;[FormInfo](./js-apis-formInfo.md#forminfo-1)&gt;&gt; | 是 | callback形式返回查询到的卡片信息。 |
**示例:**
......@@ -214,7 +214,7 @@ getFormsInfo(filter?: formInfo.FormInfoFilter): Promise&lt;Array&lt;formInfo.For
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| filter | formInfo.FormInfoFilter | 否 | 过滤卡片信息 |
| filter | [formInfo.FormInfoFilter](./js-apis-formInfo.md) | 否 | 过滤卡片信息 |
**返回值:**
......
......@@ -47,8 +47,8 @@ startAbility(want: Want, callback: AsyncCallback&lt;void&gt;): void;
```js
let want = {
"bundleName": "com.example.myapp",
"abilityName": "MyAbility"};
'bundleName': 'com.example.myapp',
'abilityName': 'MyAbility'};
this.context.startAbility(want, (err) => {
console.log('startAbility result:' + JSON.stringify(err));
});
......@@ -79,8 +79,8 @@ startAbility(want: Want, options?: StartOptions): Promise\<void>;
```js
let want = {
"bundleName": "com.example.myapp",
"abilityName": "MyAbility"
'bundleName': 'com.example.myapp',
'abilityName': 'MyAbility'
};
this.context.startAbility(want).then((data) => {
console.log('success:' + JSON.stringify(data));
......@@ -110,15 +110,15 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback&lt;void&
```js
var want = {
"deviceId": "",
"bundleName": "com.extreme.test",
"abilityName": "MainAbility"
'deviceId': '',
'bundleName': 'com.extreme.test',
'abilityName': 'MainAbility'
};
var options = {
windowMode: 0,
};
this.context.startAbility(want, options, (error) => {
console.log("error.code = " + error.code)
console.log('error.code = ' + error.code)
})
```
......
......@@ -94,15 +94,15 @@ switchInputMethod(target: InputMethodProperty, callback: AsyncCallback&lt;boolea
**示例:**
```js
inputMethod.switchInputMethod({packageName:"com.example.kikakeyboard", methodId:"com.example.kikakeyboard"} ,(err,result) => {
inputMethod.switchInputMethod({packageName:'com.example.kikakeyboard', methodId:'com.example.kikakeyboard'} ,(err,result) => {
if (err) {
console.error("switchInputMethod err: " + JSON.stringify(err));
console.error('switchInputMethod err: ' + JSON.stringify(err));
return;
}
if (result) {
console.info("Success to switchInputMethod.(callback)");
console.info('Success to switchInputMethod.(callback)');
} else {
console.error("Failed to switchInputMethod.(callback)");
console.error('Failed to switchInputMethod.(callback)');
}
});
```
......@@ -129,14 +129,14 @@ switchInputMethod(target: InputMethodProperty): Promise&lt;boolean&gt;
```js
inputMethod.switchInputMethod({packageName:"com.example.kikakeyboard", methodId:"com.example.kikakeyboard"}).then((result) => {
inputMethod.switchInputMethod({packageName:'com.example.kikakeyboard', methodId:'com.example.kikakeyboard'}).then((result) => {
if (result) {
console.info("Success to switchInputMethod.(promise)");
console.info('Success to switchInputMethod.(promise)');
} else {
console.error("Failed to switchInputMethod.(promise)");
console.error('Failed to switchInputMethod.(promise)');
}
}).catch((err) => {
console.error("switchInputMethod promise err: " + err);
console.error('switchInputMethod promise err: ' + err);
})
```
## inputMethod.getCurrentInputMethod<sup>9+</sup>
......@@ -183,13 +183,13 @@ stopInput(callback: AsyncCallback&lt;boolean&gt;): void
```js
InputMethodController.stopInput((error, result) => {
if (error) {
console.error("failed to stopInput because: " + JSON.stringify(error));
console.error('failed to stopInput because: ' + JSON.stringify(error));
return;
}
if (result) {
console.info("Success to stopInput.(callback)");
console.info('Success to stopInput.(callback)');
} else {
console.error("Failed to stopInput.(callback)");
console.error('Failed to stopInput.(callback)');
}
});
```
......@@ -214,12 +214,12 @@ stopInput(): Promise&lt;boolean&gt;
```js
InputMethodController.stopInput().then((result) => {
if (result) {
console.info("Success to stopInput.(promise)");
console.info('Success to stopInput.(promise)');
} else {
console.error("Failed to stopInput.(promise)");
console.error('Failed to stopInput.(promise)');
}
}).catch((err) => {
console.error("stopInput promise err: " + err);
console.error('stopInput promise err: ' + err);
})
```
......@@ -241,7 +241,7 @@ showSoftKeyboard(callback: AsyncCallback&lt;void&gt;): void
```js
InputMethodController.showSoftKeyboard((err) => {
if (err == undefined) {
if (err === undefined) {
console.info('showSoftKeyboard success');
} else {
console.error('showSoftKeyboard failed because : ' + JSON.stringify(err));
......@@ -292,7 +292,7 @@ hideSoftKeyboard(callback: AsyncCallback&lt;void&gt;): void
```js
InputMethodController.hideSoftKeyboard((err) => {
if (err == undefined) {
if (err === undefined) {
console.info('hideSoftKeyboard success');
} else {
console.error('hideSoftKeyboard failed because : ' + JSON.stringify(err));
......@@ -347,14 +347,12 @@ listInputMethod(enable: boolean, callback: AsyncCallback&lt;Array&lt;InputMethod
**示例:**
```js
imeList: Array<inputMethod.InputMethodProperty> = null
InputMethodSetting.listInputMethod(true, (err,data) => {
if (err) {
console.error("listInputMethod failed because: " + JSON.stringify(err));
console.error('listInputMethod failed because: ' + JSON.stringify(err));
return;
}
console.log("listInputMethod success");
this.imeList = data;
console.log('listInputMethod success');
});
```
......@@ -381,12 +379,10 @@ listInputMethod(enable: boolean): Promise&lt;Array&lt;InputMethodProperty&gt;&gt
**示例:**
```js
imeList: Array<inputMethod.InputMethodProperty> = null
InputMethodSetting.listInputMethod(true).then((data) => {
console.info("listInputMethod success");
this.imeList = data;
console.info('listInputMethod success');
}).catch((err) => {
console.error("listInputMethod promise err: " + err);
console.error('listInputMethod promise err: ' + err);
})
```
......@@ -407,14 +403,12 @@ listInputMethod(callback: AsyncCallback&lt;Array&lt;InputMethodProperty&gt;&gt;)
**示例:**
```js
imeList: Array<inputMethod.InputMethodProperty> = null
InputMethodSetting.listInputMethod((err,data) => {
if (err) {
console.error("listInputMethod failed because: " + JSON.stringify(err));
console.error('listInputMethod failed because: ' + JSON.stringify(err));
return;
}
console.log("listInputMethod success");
this.imeList = data;
console.log('listInputMethod success');
});
```
......@@ -435,12 +429,10 @@ listInputMethod(): Promise&lt;Array&lt;InputMethodProperty&gt;&gt;
**示例:**
```js
imeList: Array<inputMethod.InputMethodProperty> = null
InputMethodSetting.listInputMethod().then((data) => {
console.info("listInputMethod success");
this.imeList = data;
console.info('listInputMethod success');
}).catch((err) => {
console.error("listInputMethod promise err: " + err);
console.error('listInputMethod promise err: ' + err);
})
```
......@@ -463,10 +455,10 @@ displayOptionalInputMethod(callback: AsyncCallback&lt;void&gt;): void
```js
InputMethodSetting.displayOptionalInputMethod((err) => {
if (err) {
console.error("displayOptionalInputMethod failed because: " + JSON.stringify(err));
console.error('displayOptionalInputMethod failed because: ' + JSON.stringify(err));
return;
}
console.info("displayOptionalInputMethod success");
console.info('displayOptionalInputMethod success');
});
```
......@@ -488,8 +480,8 @@ InputMethodSetting.displayOptionalInputMethod((err) => {
```js
InputMethodSetting.displayOptionalInputMethod().then(() => {
console.info("displayOptionalInputMethod success.(promise)");
console.info('displayOptionalInputMethod success.(promise)');
}).catch((err) => {
console.error("displayOptionalInputMethod promise err: " + err);
console.error('displayOptionalInputMethod promise err: ' + err);
})
```
\ No newline at end of file
......@@ -140,7 +140,7 @@ off(type: 'inputStart', callback?: (kbController: KeyboardController, textInputC
```js
InputMethodEngine.off('inputStart', (kbController, textInputClient) => {
console.log("delete inputStart notification.");
console.log('delete inputStart notification.');
});
```
......@@ -163,7 +163,7 @@ on(type: 'inputStop', callback: () => void): void
```js
InputMethodEngine.getInputMethodEngine().on('inputStop', () => {
console.log("inputMethodEngine inputStop");
console.log('inputMethodEngine inputStop');
});
```
......@@ -186,7 +186,7 @@ off(type: 'inputStop', callback: () => void): void
```js
InputMethodEngine.getInputMethodEngine().off('inputStop', () => {
console.log("inputMethodEngine delete inputStop notification.");
console.log('inputMethodEngine delete inputStop notification.');
});
```
......@@ -209,7 +209,7 @@ on(type: 'setCallingWindow', callback: (wid:number) => void): void
```js
InputMethodEngine.getInputMethodEngine().on('setCallingWindow', (wid) => {
console.log("inputMethodEngine setCallingWindow");
console.log('inputMethodEngine setCallingWindow');
});
```
......@@ -232,7 +232,7 @@ off(type: 'setCallingWindow', callback: (wid:number) => void): void
```js
InputMethodEngine.getInputMethodEngine().off('setCallingWindow', () => {
console.log("inputMethodEngine delete setCallingWindow notification.");
console.log('inputMethodEngine delete setCallingWindow notification.');
});
```
......@@ -255,10 +255,10 @@ on(type: 'keyboardShow'|'keyboardHide', callback: () => void): void
```js
InputMethodEngine.on('keyboardShow', () => {
console.log("inputMethodEngine keyboardShow.");
console.log('inputMethodEngine keyboardShow.');
});
InputMethodEngine.on('keyboardHide', () => {
console.log("inputMethodEngine keyboardHide.");
console.log('inputMethodEngine keyboardHide.');
});
```
......@@ -281,10 +281,10 @@ off(type: 'keyboardShow'|'keyboardHide', callback?: () => void): void
```js
InputMethodEngine.off('keyboardShow', () => {
console.log("inputMethodEngine delete keyboardShow notification.");
console.log('inputMethodEngine delete keyboardShow notification.');
});
InputMethodEngine.off('keyboardHide', () => {
console.log("inputMethodEngine delete keyboardHide notification.");
console.log('inputMethodEngine delete keyboardHide notification.');
});
```
......@@ -314,13 +314,13 @@ on(type: 'keyDown'|'keyUp', callback: (event: KeyEvent) => boolean): void
```js
KeyboardDelegate.on('keyUp', (keyEvent) => {
console.info("inputMethodEngine keyCode.(keyUp):" + JSON.stringify(keyEvent.keyCode));
console.info("inputMethodEngine keyAction.(keyUp):" + JSON.stringify(keyEvent.keyAction));
console.info('inputMethodEngine keyCode.(keyUp):' + JSON.stringify(keyEvent.keyCode));
console.info('inputMethodEngine keyAction.(keyUp):' + JSON.stringify(keyEvent.keyAction));
return true;
});
KeyboardDelegate.on('keyDown', (keyEvent) => {
console.info("inputMethodEngine keyCode.(keyDown):" + JSON.stringify(keyEvent.keyCode));
console.info("inputMethodEngine keyAction.(keyDown):" + JSON.stringify(keyEvent.keyAction));
console.info('inputMethodEngine keyCode.(keyDown):' + JSON.stringify(keyEvent.keyCode));
console.info('inputMethodEngine keyAction.(keyDown):' + JSON.stringify(keyEvent.keyAction));
return true;
});
```
......@@ -344,11 +344,11 @@ off(type: 'keyDown'|'keyUp', callback?: (event: KeyEvent) => boolean): void
```js
KeyboardDelegate.off('keyUp', (keyEvent) => {
console.log("delete keyUp notification.");
console.log('delete keyUp notification.');
return true;
});
KeyboardDelegate.off('keyDown', (keyEvent) => {
console.log("delete keyDown notification.");
console.log('delete keyDown notification.');
return true;
});
```
......@@ -374,9 +374,9 @@ on(type: 'cursorContextChange', callback: (x: number, y:number, height:number) =
```js
KeyboardDelegate.on('cursorContextChange', (x, y, height) => {
console.log("inputMethodEngine cursorContextChange x:" + x);
console.log("inputMethodEngine cursorContextChange y:" + y);
console.log("inputMethodEngine cursorContextChange height:" + height);
console.log('inputMethodEngine cursorContextChange x:' + x);
console.log('inputMethodEngine cursorContextChange y:' + y);
console.log('inputMethodEngine cursorContextChange height:' + height);
});
```
......@@ -400,7 +400,7 @@ off(type: 'cursorContextChange', callback?: (x: number, y:number, height:number)
```js
KeyboardDelegate.off('cursorContextChange', (x, y, height) => {
console.log("delete cursorContextChange notification.");
console.log('delete cursorContextChange notification.');
});
```
### on('selectionChange')
......@@ -422,10 +422,10 @@ on(type: 'selectionChange', callback: (oldBegin: number, oldEnd: number, newBegi
```js
KeyboardDelegate.on('selectionChange', (oldBegin, oldEnd, newBegin, newEnd) => {
console.log("inputMethodEngine beforeEach selectionChange oldBegin:" + oldBegin);
console.log("inputMethodEngine beforeEach selectionChange oldEnd:" + oldEnd);
console.log("inputMethodEngine beforeEach selectionChange newBegin:" + newBegin);
console.log("inputMethodEngine beforeEach selectionChange newEnd:" + newEnd);
console.log('inputMethodEngine beforeEach selectionChange oldBegin:' + oldBegin);
console.log('inputMethodEngine beforeEach selectionChange oldEnd:' + oldEnd);
console.log('inputMethodEngine beforeEach selectionChange newBegin:' + newBegin);
console.log('inputMethodEngine beforeEach selectionChange newEnd:' + newEnd);
});
```
......@@ -448,7 +448,7 @@ off(type: 'selectionChange', callback?: (oldBegin: number, oldEnd: number, newBe
```js
KeyboardDelegate.off('selectionChange', (oldBegin, oldEnd, newBegin, newEnd) => {
console.log("delete selectionChange notification.");
console.log('delete selectionChange notification.');
});
```
......@@ -472,7 +472,7 @@ on(type: 'textChange', callback: (text: string) => void): void
```js
KeyboardDelegate.on('textChange', (text) => {
console.log("inputMethodEngine textChange. text:" + text);
console.log('inputMethodEngine textChange. text:' + text);
});
```
......@@ -495,7 +495,7 @@ off(type: 'textChange', callback?: (text: string) => void): void
```js
keyboardDelegate.off('textChange', (text) => {
console.log("delete textChange notification. text:" + text);
console.log('delete textChange notification. text:' + text);
});
```
......@@ -522,11 +522,11 @@ hideKeyboard(callback: AsyncCallback&lt;void&gt;): void
```js
KeyboardController.hideKeyboard((err) => {
if (err == undefined) {
console.error("hideKeyboard callback result---err: " + err.msg);
if (err === undefined) {
console.error('hideKeyboard callback result---err: ' + err.msg);
return;
}
console.log("hideKeyboard callback.");
console.log('hideKeyboard callback.');
});
```
......@@ -549,9 +549,9 @@ hideKeyboard(): Promise&lt;void&gt;
```js
async function InputMethodEngine() {
await KeyboardController.hideKeyboard().then(() => {
console.info("hideKeyboard promise.");
console.info('hideKeyboard promise.');
}).catch((err) => {
console.info("hideKeyboard promise err: " + err.msg);
console.info('hideKeyboard promise err: ' + err.msg);
});
}
```
......@@ -580,11 +580,11 @@ getForward(length:number, callback: AsyncCallback&lt;string&gt;): void
```js
var length = 1;
TextInputClient.getForward(length, (err, text) => {
if (err == undefined) {
console.error("getForward callback result---err: " + err.msg);
if (err === undefined) {
console.error('getForward callback result---err: ' + err.msg);
return;
}
console.log("getForward callback result---text: " + text);
console.log('getForward callback result---text: ' + text);
});
```
......@@ -614,9 +614,9 @@ getForward(length:number): Promise&lt;string&gt;
async function InputMethodEngine() {
var length = 1;
await TextInputClient.getForward(length).then((text) => {
console.info("getForward promise result---res: " + text);
console.info('getForward promise result---res: ' + text);
}).catch((err) => {
console.error("getForward promise err: " + err.msg);
console.error('getForward promise err: ' + err.msg);
});
}
```
......@@ -641,11 +641,11 @@ getBackward(length:number, callback: AsyncCallback&lt;string&gt;): void
```js
var length = 1;
TextInputClient.getBackward(length, (err, text) => {
if (err == undefined) {
console.error("getBackward callback result---err: " + err.msg);
if (err === undefined) {
console.error('getBackward callback result---err: ' + err.msg);
return;
}
console.log("getBackward callback result---text: " + text);
console.log('getBackward callback result---text: ' + text);
});
```
......@@ -675,9 +675,9 @@ getBackward(length:number): Promise&lt;string&gt;
async function InputMethodEngine() {
var length = 1;
await TextInputClient.getBackward(length).then((text) => {
console.info("getBackward promise result---res: " + text);
console.info('getBackward promise result---res: ' + text);
}).catch((err) => {
console.error("getBackward promise err: " + err.msg);
console.error('getBackward promise err: ' + err.msg);
});
}
```
......@@ -702,14 +702,14 @@ deleteForward(length:number, callback: AsyncCallback&lt;boolean&gt;): void
```js
var length = 1;
TextInputClient.deleteForward(length, (err, result) => {
if (err == undefined) {
if (err === undefined) {
console.error('deleteForward callback result---err: ' + err.msg);
return;
}
if (result) {
console.info("Success to deleteForward.(callback) ");
console.info('Success to deleteForward.(callback) ');
} else {
console.error("Failed to deleteForward.(callback) ");
console.error('Failed to deleteForward.(callback) ');
}
});
```
......@@ -740,12 +740,12 @@ async function InputMethodEngine() {
var length = 1;
await TextInputClient.deleteForward(length).then((result) => {
if (result) {
console.info("Success to deleteForward.(promise) ");
console.info('Success to deleteForward.(promise) ');
} else {
console.error("Failed to deleteForward.(promise) ");
console.error('Failed to deleteForward.(promise) ');
}
}).catch((err) => {
console.error("deleteForward promise err: " + err.msg);
console.error('deleteForward promise err: ' + err.msg);
});
}
```
......@@ -770,14 +770,14 @@ deleteBackward(length:number, callback: AsyncCallback&lt;boolean&gt;): void
```js
var length = 1;
TextInputClient.deleteBackward(length, (err, result) => {
if (err == undefined) {
console.error("deleteBackward callback result---err: " + err.msg);
if (err === undefined) {
console.error('deleteBackward callback result---err: ' + err.msg);
return;
}
if (result) {
console.info("Success to deleteBackward.(callback) ");
console.info('Success to deleteBackward.(callback) ');
} else {
console.error("Failed to deleteBackward.(callback) ");
console.error('Failed to deleteBackward.(callback) ');
}
});
```
......@@ -809,12 +809,12 @@ async function InputMethodEngine() {
var length = 1;
await TextInputClient.deleteBackward(length).then((result) => {
if (result) {
console.info("Success to deleteBackward.(promise) ");
console.info('Success to deleteBackward.(promise) ');
} else {
console.error("Failed to deleteBackward.(promise) ");
console.error('Failed to deleteBackward.(promise) ');
}
}).catch((err) => {
console.error("deleteBackward promise err: " + err.msg);
console.error('deleteBackward promise err: ' + err.msg);
});
}
```
......@@ -837,14 +837,14 @@ sendKeyFunction(action:number, callback: AsyncCallback&lt;boolean&gt;): void
```js
TextInputClient.sendKeyFunction(keyFunction, (err, result) => {
if (err == undefined) {
console.error("sendKeyFunction callback result---err: " + err.msg);
if (err === undefined) {
console.error('sendKeyFunction callback result---err: ' + err.msg);
return;
}
if (result) {
console.info("Success to sendKeyFunction.(callback) ");
console.info('Success to sendKeyFunction.(callback) ');
} else {
console.error("Failed to sendKeyFunction.(callback) ");
console.error('Failed to sendKeyFunction.(callback) ');
}
});
```
......@@ -875,12 +875,12 @@ sendKeyFunction(action:number): Promise&lt;boolean&gt;
async function InputMethodEngine() {
await client.sendKeyFunction(keyFunction).then((result) => {
if (result) {
console.info("Success to sendKeyFunction.(promise) ");
console.info('Success to sendKeyFunction.(promise) ');
} else {
console.error("Failed to sendKeyFunction.(promise) ");
console.error('Failed to sendKeyFunction.(promise) ');
}
}).catch((err) => {
console.error("sendKeyFunction promise err:" + err.msg);
console.error('sendKeyFunction promise err:' + err.msg);
});
}
```
......@@ -904,14 +904,14 @@ insertText(text:string, callback: AsyncCallback&lt;boolean&gt;): void
```js
TextInputClient.insertText('test', (err, result) => {
if (err == undefined) {
console.error("insertText callback result---err: " + err.msg);
if (err === undefined) {
console.error('insertText callback result---err: ' + err.msg);
return;
}
if (result) {
console.info("Success to insertText.(callback) ");
console.info('Success to insertText.(callback) ');
} else {
console.error("Failed to insertText.(callback) ");
console.error('Failed to insertText.(callback) ');
}
});
```
......@@ -942,12 +942,12 @@ insertText(text:string): Promise&lt;boolean&gt;
async function InputMethodEngine() {
await TextInputClient.insertText('test').then((result) => {
if (result) {
console.info("Success to insertText.(promise) ");
console.info('Success to insertText.(promise) ');
} else {
console.error("Failed to insertText.(promise) ");
console.error('Failed to insertText.(promise) ');
}
}).catch((err) => {
console.error("insertText promise err: " + err.msg);
console.error('insertText promise err: ' + err.msg);
});
}
```
......@@ -970,12 +970,12 @@ getEditorAttribute(callback: AsyncCallback&lt;EditorAttribute&gt;): void
```js
TextInputClient.getEditorAttribute((err, editorAttribute) => {
if (err == undefined) {
console.error("getEditorAttribute callback result---err: " + err.msg);
if (err === undefined) {
console.error('getEditorAttribute callback result---err: ' + err.msg);
return;
}
console.log("editorAttribute.inputPattern(callback): " + JSON.stringify(editorAttribute.inputPattern));
console.log("editorAttribute.enterKeyType(callback): " + JSON.stringify(editorAttribute.enterKeyType));
console.log('editorAttribute.inputPattern(callback): ' + JSON.stringify(editorAttribute.inputPattern));
console.log('editorAttribute.enterKeyType(callback): ' + JSON.stringify(editorAttribute.enterKeyType));
});
```
......@@ -998,10 +998,10 @@ getEditorAttribute(): Promise&lt;EditorAttribute&gt;
```js
async function InputMethodEngine() {
await TextInputClient.getEditorAttribute().then((editorAttribute) => {
console.info("editorAttribute.inputPattern(promise): " + JSON.stringify(editorAttribute.inputPattern));
console.info("editorAttribute.enterKeyType(promise): " + JSON.stringify(editorAttribute.enterKeyType));
console.info('editorAttribute.inputPattern(promise): ' + JSON.stringify(editorAttribute.inputPattern));
console.info('editorAttribute.enterKeyType(promise): ' + JSON.stringify(editorAttribute.enterKeyType));
}).catch((err) => {
console.error("getEditorAttribute promise err: " + err.msg);
console.error('getEditorAttribute promise err: ' + err.msg);
});
}
```
......@@ -1025,8 +1025,8 @@ moveCursor(direction: number, callback: AsyncCallback&lt;void&gt;): void
```js
TextInputClient.moveCursor(inputMethodEngine.CURSOR_xxx, (err) => {
if (err == undefined) {
console.error("moveCursor callback result---err: " + err.msg);
if (err === undefined) {
console.error('moveCursor callback result---err: ' + err.msg);
return;
}
});
......@@ -1059,7 +1059,7 @@ async function InputMethodEngine() {
await TextInputClient.moveCursor(inputMethodEngine.CURSOR_xxx).then(async (err) => {
console.log('moveCursor success');
}).catch((err) => {
console.error("moveCursor success err: " + err.msg);
console.error('moveCursor success err: ' + err.msg);
});
}
```
......
......@@ -52,7 +52,7 @@ createVideoPlayer(callback: AsyncCallback\<[VideoPlayer](#videoplayer8)>): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------- | ---- | ------------------------------ |
| callback | AsyncCallback<[VideoPlayer](#videoplayer8)> | 是 | 异步创建视频播放实例回调方法。 |
| callback | AsyncCallback<[VideoPlayer](#videoplayer8)> | 是 | 回调函数。异步返回VideoPlayer实例,可用于管理和播放视频媒体。 |
**示例:**
......@@ -81,7 +81,7 @@ createVideoPlayer(): Promise<[VideoPlayer](#videoplayer8)>
| 类型 | 说明 |
| ------------------------------------- | ----------------------------------- |
| Promise<[VideoPlayer](#videoplayer8)> | 异步创建视频播放实例Promise返回值。 |
| Promise<[VideoPlayer](#videoplayer8)> | Promise对象。异步返回VideoPlayer实例,可用于管理和播放视频媒体。 |
**示例:**
......@@ -134,7 +134,7 @@ createVideoRecorder(callback: AsyncCallback\<[VideoRecorder](#videorecorder9)>):
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------------------------------- | ---- | ------------------------------ |
| callback | AsyncCallback<[VideoRecorder](#videorecorder9)> | 是 | 异步创建视频录制实例回调方法。 |
| callback | AsyncCallback<[VideoRecorder](#videorecorder9)> | 是 | 回调函数。异步返回VideoRecorder实例,可用于录制视频媒体。 |
**示例:**
......@@ -164,7 +164,7 @@ createVideoRecorder(): Promise<[VideoRecorder](#videorecorder9)>
| 类型 | 说明 |
| ----------------------------------------- | ----------------------------------- |
| Promise<[VideoRecorder](#videorecorder9)> | 异步创建视频录制实例Promise返回值。 |
| Promise<[VideoRecorder](#videorecorder9)> | Promise对象。异步返回VideoRecorder实例,可用于录制视频媒体。 |
**示例:**
......@@ -441,7 +441,7 @@ function printfDescription(obj) {
}
}
audioPlayer.getTrackDescription((error, ) => {
audioPlayer.getTrackDescription((error, arrlist) => {
if (arrlist != null) {
for (let i = 0; i < arrlist.length; i++) {
printfDescription(arrlist[i]);
......@@ -1794,7 +1794,7 @@ on(type: 'prepare' | 'start' | 'pause' | 'resume' | 'stop' | 'release' | 'reset'
```js
let audioRecorder = media.createAudioRecorder(); // 创建一个音频录制实例
let audioRecorderConfig = {
audioEncoder : media.AudioEncoder.AAC_LC, ,
audioEncoder : media.AudioEncoder.AAC_LC,
audioEncodeBitRate : 22050,
audioSampleRate : 22050,
numberOfChannels : 2,
......@@ -1849,7 +1849,7 @@ on(type: 'error', callback: ErrorCallback): void
```js
let audioRecorderConfig = {
audioEncoder : media.AudioEncoder.AAC_LC, ,
audioEncoder : media.AudioEncoder.AAC_LC,
audioEncodeBitRate : 22050,
audioSampleRate : 22050,
numberOfChannels : 2,
......@@ -1973,29 +1973,13 @@ let videoConfig = {
}
// asyncallback
let videoRecorder = null;
let events = require('events');
let eventEmitter = new events.EventEmitter();
eventEmitter.on('prepare', () => {
videoRecorder.prepare(videoConfig, (err) => {
videoRecorder.prepare(videoConfig, (err) => {
if (err == null) {
console.info('prepare success');
} else {
console.info('prepare failed and error is ' + err.message);
}
});
});
media.createVideoRecorder((err, recorder) => {
if (err == null && recorder != null) {
videoRecorder = recorder;
console.info('createVideoRecorder success');
eventEmitter.emit('prepare'); // prepare事件触发
} else {
console.info('createVideoRecorder failed and error is ' + err.message);
}
});
})
```
### prepare<sup>9+</sup><a name=videorecorder_prepare2></a>
......@@ -2046,21 +2030,10 @@ let videoConfig = {
}
// promise
let videoRecorder = null;
media.createVideoRecorder().then((recorder) => {
if (recorder != null) {
videoRecorder = recorder;
console.info('createVideoRecorder success');
videoRecorder.prepare(videoConfig).then(() => {
videoRecorder.prepare(videoConfig).then(() => {
console.info('prepare success');
}).catch((err) => {
console.info('prepare failed and catch error is ' + err.message);
});
} else {
console.info('createVideoRecorder failed');
}
}).catch((err) => {
console.info('catch err error message is ' + err.message);
console.info('prepare failed and catch error is ' + err.message);
});
```
......@@ -2474,11 +2447,10 @@ on(type: 'error', callback: ErrorCallback): void
**示例:**
```js
// 当获取videoRecordState接口出错时通过此订阅事件上报
videoRecorder.on('error', (error) => { // 设置'error'事件回调
console.info(`audio error called, error: ${error}`);
}
// 当获取videoRecordState接口出错时通过此订阅事件上报
});
})
```
## VideoRecordState<sup>9+</sup>
......
......@@ -68,6 +68,8 @@ hasDefaultNet(callback: AsyncCallback\<boolean>): void
检查默认数据网络是否被激活,使用callback方式作为异步方法。
默认数据网络:以太网>Wi-Fi>蜂窝,当只有一个网络为连接状态时,当前连接网络为默认数据网络。
**需要权限**:ohos.permission.GET_NETWORK_INFO
**系统能力**:SystemCapability.Communication.NetManager.Core
**参数:**
......@@ -92,6 +94,8 @@ hasDefaultNet(): Promise\<boolean>
检查默认数据网络是否被激活,使用Promise方式作为异步方法。
默认数据网络:以太网>Wi-Fi>蜂窝,当只有一个网络为连接状态时,当前连接网络为默认数据网络。
**需要权限**:ohos.permission.GET_NETWORK_INFO
**系统能力**:SystemCapability.Communication.NetManager.Core
**返回值:**
......
# 标准NFC
本模块主要用于操作及管理NFC
本模块主要用于管理NFC状态,包括打开和关闭NFC,读取NFC的状态等
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
......@@ -12,12 +12,24 @@
import controller from '@ohos.nfc.controller';
```
## NfcState
定义不同的NFC状态值。
**系统能力**:SystemCapability.Communication.NFC.Core
| 名称 | 默认值 | 说明 |
| -------- | -------- | -------- |
| STATE_OFF | 1 | NFC已关闭状态。 |
| STATE_TURNING_ON | 2 | NFC正在打开状态。 |
| STATE_ON | 3 | NFC已打开状态。 |
| STATE_TURNING_OFF | 4 | NFC正在关闭状态。 |
## controller.isNfcAvailable
isNfcAvailable(): boolean
查询是否有NFC功能
查询设备是否有NFC能力。
**系统能力**:SystemCapability.Communication.NFC.Core
......@@ -25,7 +37,7 @@ isNfcAvailable(): boolean
| **类型** | **说明** |
| -------- | -------- |
| boolean | true:有NFC功能,&nbsp;false:无NFC功能。 |
| boolean | true: 设备具备NFC能力,&nbsp;false: 设备不具备NFC能力。 |
## controller.openNfc
......@@ -42,7 +54,7 @@ openNfc(): boolean
| **类型** | **说明** |
| -------- | -------- |
| boolean | true:打开NFC成功,&nbsp;false:打开NFC失败。 |
| boolean | true: 打开NFC成功,&nbsp;false: 打开NFC失败。 |
## controller.closeNfc
......@@ -58,7 +70,7 @@ closeNfc(): boolean
| **类型** | **说明** |
| -------- | ------------------------------------------- |
| boolean | true:关闭NFC成功,&nbsp;false:关闭NFC失败。 |
| boolean | true: 关闭NFC成功,&nbsp;false: 关闭NFC失败。 |
## controller.isNfcOpen
......@@ -72,11 +84,11 @@ isNfcOpen(): boolean
| **类型** | **说明** |
| -------- | ----------------------------------- |
| boolean | true:NFC打开,&nbsp;false:NFC关闭。 |
| boolean | true: NFC是打开的,&nbsp;false: NFC是关闭的。 |
## controller.getNfcState
getNfcState(): NfcState
getNfcState(): [NfcState](#nfcstate)
查询NFC状态。
......@@ -86,13 +98,13 @@ getNfcState(): NfcState
| **类型** | **说明** |
| -------- | ---------------------- |
| NfcState | 详细请见NfcState枚举值 |
| [NfcState](#nfcstate) | NFC状态值,详细请见[NfcState](#nfcstate)枚举值。 |
## controller.on('nfcStateChange')
on(type: "nfcStateChange", callback: Callback&lt;NfcState&gt;): void
on(type: "nfcStateChange", callback: Callback&lt;[NfcState](#nfcstate)&gt;): void
注册NFC开关状态事件。
注册NFC开关状态事件,通过Callback方式获取NFC状态的变化通知
**系统能力**:SystemCapability.Communication.NFC.Core
......@@ -100,16 +112,16 @@ on(type: "nfcStateChange", callback: Callback&lt;NfcState&gt;): void
| **参数名** | **类型** | **必填** | **说明** |
| -------- | -------- | -------- | -------- |
| type | string | 是 | 固定填"nfcStateChange"字符串 |
| callback | Callback&lt;NfcState&gt; | 是 | 状态改变回调函数。 |
| type | string | 是 | 固定填"nfcStateChange"字符串 |
| callback | Callback&lt;[NfcState](#nfcstate)&gt; | 是 | NFC状态改变通知的回调函数。 |
## controller.off('nfcStateChange')
off(type: "nfcStateChange", callback?: Callback&lt;NfcState&gt;): void
off(type: "nfcStateChange", callback?: Callback&lt;[NfcState](#nfcstate)&gt;): void
取消NFC开关状态事件的注册。
取消NFC开关状态事件的注册,取消后NFC状态变化时,就不会再收到Callback的通知
**系统能力**:SystemCapability.Communication.NFC.Core
......@@ -117,36 +129,38 @@ off(type: "nfcStateChange", callback?: Callback&lt;NfcState&gt;): void
| **参数名** | **类型** | **必填** | **说明** |
| -------- | -------- | -------- | -------- |
| type | string | 是 | 固定填"nfcStateChange"字符串 |
| callback | Callback&lt;NfcState&gt; | 否 | 状态改变回调函数。如果callback不填,将“去注册”该事件关联的所有回调函数。 |
| type | string | 是 | 固定填"nfcStateChange"字符串 |
| callback | Callback&lt;[NfcState](#nfcstate)&gt; | 否 | NFC状态改变回调函数,可以空缺不填。 |
**示例**
```js
import nfcController from '@ohos.nfcController';
import controller from '@ohos.nfc.controller';
var NFC_STATE_NOTIFY = "nfcStateChange";
// callback key definition
var NFC_STATE_CALLBACK_KEY = "nfcStateChange";
var recvNfcStateNotifyFunc = result => {
console.info("nfc state receive state: " + result);
// register callback to receive the nfc state changed notification
controller.on(NFC_STATE_CALLBACK_KEY, (err, nfcState)=> {
if (err) {
console.log("controller on callback err: " + err);
} else {
console.log("controller on callback nfcState: " + nfcState);
}
});
// 注册事件
nfcController.on(NFC_STATE_NOTIFY, recvNfcStateNotifyFunc);
// 解注册事件
nfcController.off(NFC_STATE_NOTIFY, recvNfcStateNotifyFunc);
```
## NfcState
表示NFC状态的枚举。
// open nfc, require permission: ohos.permission.MANAGE_SECURE_SETTINGS
if (!controller.isNfcOpen()) {
var ret = controller.openNfc();
console.log("controller openNfc ret: " + ret);
}
**系统能力**:SystemCapability.Communication.NFC.Core
// close nfc, require permission: ohos.permission.MANAGE_SECURE_SETTINGS
if (controller.isNfcOpen()) {
var ret = controller.closeNfc();
console.log("controller closeNfc ret: " + ret);
}
| 名称 | 默认值 | 说明 |
| -------- | -------- | -------- |
| STATE_OFF | 1 | NFC关闭状态 |
| STATE_TURNING_ON | 2 | NFC正在打开状态 |
| STATE_ON | 3 | NFC打开状态 |
| STATE_TURNING_OFF | 4 | NFC正在关闭状态 |
// unregister callback
controller.off(NFC_STATE_CALLBACK_KEY);
```
......@@ -384,6 +384,26 @@ promise.then(data => {
});
```
## radio.isNrSupported<sup>7+</sup>
isNrSupported\(\): boolean
判断当前设备是否支持5G\(NR\)
**系统能力**:SystemCapability.Telephony.CoreService
**返回值:**
| 类型 | 说明 |
| ------- | -------------------------------- |
| boolean | - true:支持<br/>- false:不支持 |
**示例:**
```js
let result = radio.isNrSupported();
console.log("Result: "+ result);
```
## radio.isNrSupported<sup>8+</sup>
......
......@@ -2620,11 +2620,11 @@ queryLocalInterface(descriptor: string): IRemoteBroker
### sendRequest<sup>(deprecated)</sup>
sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options : MessageOption): boolean
> **说明:**
> 从 API Version 8 开始废弃,建议使用[sendRequestAsync<sup>9+</sup>](#sendrequestasync9)替代。
sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options : MessageOption): boolean
以同步或异步方式向对端进程发送MessageParcel消息。如果为选项设置了异步模式,则期约立即兑现,reply报文里没有内容。如果为选项设置了同步模式,则期约将在sendRequest返回时兑现,回复内容在reply报文里。
**系统能力**:SystemCapability.Communication.IPC.Core
......@@ -2647,11 +2647,11 @@ sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options
### sendRequest<sup>8+(deprecated)</sup>
sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options : MessageOption): Promise&lt;SendRequestResult&gt;
> **说明:**
> 从 API Version 9 开始废弃,建议使用[sendRequestAsync<sup>9+</sup>](#sendrequestasync9)替代。
sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options : MessageOption): Promise&lt;SendRequestResult&gt;
以同步或异步方式向对端进程发送MessageParcel消息。如果为选项设置了异步模式,则期约立即兑现,reply报文里没有内容。如果为选项设置了同步模式,则期约将在sendRequest返回时兑现,回复内容在reply报文里。
**系统能力**:SystemCapability.Communication.IPC.Core
......@@ -2806,11 +2806,11 @@ isObjectDead(): boolean
### sendRequest<sup>(deprecated)</sup>
sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options : MessageOption): boolean
> **说明:**
> 从 API Version 8 开始废弃,建议使用[sendRequestAsync<sup>9+</sup>](#sendrequestasync9-1)替代。
sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options : MessageOption): boolean
以同步或异步方式向对端进程发送MessageParcel消息。如果为选项设置了异步模式,则期约立即兑现,reply报文里没有内容。如果为选项设置了同步模式,则期约将在sendRequest返回时兑现,回复内容在reply报文里。
**系统能力**:SystemCapability.Communication.IPC.Core
......@@ -2873,11 +2873,11 @@ sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options
### sendRequest<sup>8+(deprecated)</sup>
sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options : MessageOption): Promise&lt;SendRequestResult&gt;
> **说明:**
> 从 API Version 9 开始废弃,建议使用[sendRequestAsync<sup>9+</sup>](#sendrequestasync9-1)替代。
sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options : MessageOption): Promise&lt;SendRequestResult&gt;
以同步或异步方式向对端进程发送MessageParcel消息。如果为选项设置了异步模式,则期约立即兑现,reply报文里没有内容。如果为选项设置了同步模式,则期约将在sendRequest返回时兑现,回复内容在reply报文里。
**系统能力**:SystemCapability.Communication.IPC.Core
......@@ -3725,11 +3725,11 @@ RemoteObject构造函数。
### sendRequest<sup>(deprecated)</sup>
sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options : MessageOption): boolean
> **说明:**
> 从 API Version 8 开始废弃,建议使用[sendRequestAsync<sup>9+</sup>](#sendrequestasync9-2)替代。
sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options : MessageOption): boolean
以同步或异步方式向对端进程发送MessageParcel消息。如果为选项设置了异步模式,则期约立即兑现,reply报文里没有内容。如果为选项设置了同步模式,则期约将在sendRequest返回时兑现,回复内容在reply报文里。
**系统能力**:SystemCapability.Communication.IPC.Core
......@@ -3794,11 +3794,11 @@ sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options
### sendRequest<sup>8+(deprecated)</sup>
sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options : MessageOption): Promise&lt;SendRequestResult&gt;
> **说明:**
> 从 API Version 9 开始废弃,建议使用[sendRequestAsync<sup>9+</sup>](#sendrequestasync9-2)替代。
sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options : MessageOption): Promise&lt;SendRequestResult&gt;
以同步或异步方式向对端进程发送MessageParcel消息。如果为选项设置了异步模式,则期约立即兑现,reply报文里没有内容。如果为选项设置了同步模式,则期约将在sendRequest返回时兑现,回复内容在reply报文里。
**系统能力**:SystemCapability.Communication.IPC.Core
......@@ -4004,6 +4004,7 @@ sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: Me
onRemoteRequest(code : number, data : MessageParcel, reply: MessageParcel, options : MessageOption): boolean
> **说明:**
> 从 API Version 9 开始废弃,建议使用[onRemoteRequestEx<sup>9+</sup>](#onremoterequestex9)替代。
......
......@@ -2657,8 +2657,6 @@ getOpKey(slotId: number, callback: AsyncCallback<string\>): void
获取指定卡槽中SIM卡的opkey。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
......@@ -2683,8 +2681,6 @@ getOpKey(slotId: number): Promise<string\>
获取指定卡槽中SIM卡的opkey。使用Promise异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
......@@ -2716,8 +2712,6 @@ getOpName(slotId: number, callback: AsyncCallback<string\>): void
获取指定卡槽中SIM卡的OpName。使用callback异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
......@@ -2742,8 +2736,6 @@ getOpName(slotId: number): Promise<string\>
获取指定卡槽中SIM卡的OpName。使用Promise异步回调。
此接口为系统接口。
**系统能力**:SystemCapability.Telephony.CoreService
**参数:**
......
......@@ -9,7 +9,7 @@
```js
import cipher from '@system.cipher'
import cipher from '@system.cipher';
```
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册