diff --git a/README.md b/README.md index 602a868e0c5966d52b77eff891a6f32232c7d579..9351f7f58964229343c0dbfc3c9875e212a4a54f 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ This repository stores device and application development documents provided by - master: the latest version. - - OpenHarmony 3.2 Beta3. [Learn more](en/release-notes/OpenHarmony-v3.2-beta3.md) + - OpenHarmony 3.2 Beta5. [Learn more](en/release-notes/OpenHarmony-v3.2-beta5.md) - OpenHarmony 3.1 Release. [Learn more](en/release-notes/OpenHarmony-v3.1-release.md) @@ -34,7 +34,7 @@ This repository stores device and application development documents provided by ### Historical Stable Versions -OpenHarmony_v1.x_release: OpenHarmony v1.1.5 LTS. [Learn more](en/release-notes/OpenHarmony-v1.1.5-LTS.md) +OpenHarmony_v1.x_release: OpenHarmony 1.1.5 LTS. [Learn more](en/release-notes/OpenHarmony-v1.1.5-LTS.md) [More versions](en/release-notes/) @@ -51,6 +51,6 @@ You can evaluate available documents, make simple modifications, provide feedbac Excellent contributors will be awarded and the contributions will be publicized in the developer community. -- Mail list: docs@openharmony.io +- Mailing list: docs@openharmony.io - Zulip group: documentation_sig \ No newline at end of file diff --git a/en/application-dev/Readme-EN.md b/en/application-dev/Readme-EN.md index a627e1116a792c5d4fc885ae01aa6ccb172b7b1d..29bcc1f42bc0624e1eccf130493642699bdc5994 100644 --- a/en/application-dev/Readme-EN.md +++ b/en/application-dev/Readme-EN.md @@ -70,7 +70,7 @@ - [DevEco Studio (OpenHarmony) User Guide](quick-start/deveco-studio-user-guide-for-openharmony.md) - [Debugging Tools](tools/Readme-EN.md) - Hands-On Tutorials - - [Samples](https://gitee.com/openharmony/applications_app_samples/blob/master/README.md) + - [Samples](https://gitee.com/openharmony/applications_app_samples/blob/monthly_20221018/README.md) - [Codelabs](https://gitee.com/openharmony/codelabs) - API References - [SystemCapability](reference/syscap.md) diff --git a/en/application-dev/application-dev-guide-for-gitee.md b/en/application-dev/application-dev-guide-for-gitee.md index 96e956f86e1528c5946c094b204c83e6e7d96222..a7e38127fecf4cf89afff3bb59a1a1a0a5811746 100644 --- a/en/application-dev/application-dev-guide-for-gitee.md +++ b/en/application-dev/application-dev-guide-for-gitee.md @@ -48,7 +48,7 @@ DevEco Studio is a high-performance integrated development environment (IDE) rec ### Hands-On Tutorials -To make you better understand how functions work together and jumpstart your application development projects, we provide stripped-down, real-world [samples](https://gitee.com/openharmony/applications_app_samples/blob/master/README.md) and [codelabs](https://gitee.com/openharmony/codelabs). +To make you better understand how functions work together and jumpstart your application development projects, we provide stripped-down, real-world [samples](https://gitee.com/openharmony/applications_app_samples/blob/monthly_20221018/README.md) and [codelabs](https://gitee.com/openharmony/codelabs). ### API References diff --git a/en/application-dev/application-dev-guide.md b/en/application-dev/application-dev-guide.md index b9bc5bb92ed39b292ca4eede0023989364eb473c..403eded3099303d5b618691bce5846a0f216a16b 100644 --- a/en/application-dev/application-dev-guide.md +++ b/en/application-dev/application-dev-guide.md @@ -24,7 +24,7 @@ First thing first, familiarize yourself with the two cornerstone frameworks in O All applications should be developed on top of these frameworks. Then, equip yourself for developing the key features, with the following guidelines: -- [Common Event and Notification](notification/notification-brief.md) +- [Common Event and Notification](notification/notification-overview.md) - [Window Manager](windowmanager/window-overview.md) - [WebGL](webgl/webgl-overview.md) - [Media](media/audio-overview.md) @@ -48,7 +48,7 @@ DevEco Studio is a high-performance integrated development environment (IDE) rec ### Hands-On Tutorials -To make you better understand how functions work together and jumpstart your application development projects, we provide stripped-down, real-world [samples](https://gitee.com/openharmony/applications_app_samples/blob/master/README.md) and [codelabs](https://gitee.com/openharmony/codelabs). +To make you better understand how functions work together and jumpstart your application development projects, we provide stripped-down, real-world [samples](https://gitee.com/openharmony/applications_app_samples/blob/monthly_20221018/README.md) and [codelabs](https://gitee.com/openharmony/codelabs). ### API References diff --git a/en/application-dev/application-models/Readme-EN.md b/en/application-dev/application-models/Readme-EN.md index 2a920300623358bc25f7256d6af8b957665bc600..46ed4f21a9b9654552b106e59aa0f702fa9fcea4 100644 --- a/en/application-dev/application-models/Readme-EN.md +++ b/en/application-dev/application-models/Readme-EN.md @@ -17,8 +17,10 @@ - ExtensionAbility Component - [ExtensionAbility Component Overview](extensionability-overview.md) - [ServiceExtensionAbility](serviceextensionability.md) - - [DataShareExtensionAbility](datashareextensionability.md) + - [DataShareExtensionAbility (System Applications Only)](datashareextensionability.md) - [FormExtensionAbility (Widget)](widget-development-stage.md) + - [AccessibilityExtensionAbility](accessibilityextensionability.md) + - [WindowExtensionAbility](windowextensionability.md) - [AbilityStage Component Container](abilitystage.md) - [Context](application-context-stage.md) - Want @@ -31,8 +33,8 @@ - [Component Startup Rules](component-startup-rules.md) - Inter-Device Application Component Interaction (Continuation) - [Continuation Overview](inter-device-interaction-hop-overview.md) - - [Cross-Device Migration](hop-cross-device-migration.md) - - [Multi-device Collaboration](hop-multi-device-collaboration.md) + - [Cross-Device Migration (System Applications Only)](hop-cross-device-migration.md) + - [Multi-device Collaboration (System Applications Only)](hop-multi-device-collaboration.md) - IPC - [Process Model](process-model-stage.md) - Common Events @@ -49,7 +51,6 @@ - [Mission Management Scenarios](mission-management-overview.md) - [Mission Management and Launch Type](mission-management-launch-type.md) - [Page Stack and MissionList](page-mission-stack.md) - - [Application Configuration File](config-file-stage.md) - FA Model Development - [FA Model Development Overview](fa-model-development-overview.md) - FA Mode Application Components @@ -62,7 +63,7 @@ - [Creating a PageAbility](create-pageability.md) - [Starting a Local PageAbility](start-local-pageability.md) - [Stopping a PageAbility](stop-pageability.md) - - [Starting a Remote PageAbility](start-remote-pageability.md) + - [Starting a Remote PageAbility (System Applications Only)](start-remote-pageability.md) - [Starting a Specified Page](start-page.md) - [Window Properties](window-properties.md) - [Requesting Permissions](request-permissions.md) @@ -94,7 +95,6 @@ - [Thread Model](thread-model-fa.md) - [Inter-Thread Communication](itc-fa-overview.md) - [Mission Management](mission-management-fa.md) - - [Application Configuration File](config-file-fa.md) - Development of Component Interaction Between the FA Model and Stage Model - [Component Interaction Between the FA Model and Stage Model](fa-stage-interaction-overview.md) - [Starting a UIAbility from the FA Model](start-uiability-from-fa.md) diff --git a/en/application-dev/application-models/accessibilityextensionability.md b/en/application-dev/application-models/accessibilityextensionability.md new file mode 100644 index 0000000000000000000000000000000000000000..4c912d5e58a1b8083ba1037cccf449dd953d245c --- /dev/null +++ b/en/application-dev/application-models/accessibilityextensionability.md @@ -0,0 +1,118 @@ +# AccessibilityExtensionAbility Development + +The **AccessibilityExtensionAbility** module provides accessibility extension capabilities based on the **ExtensionAbility** framework. You can develop your accessibility applications by applying the **AccessibilityExtensionAbility** template to enhance usability. + +> **Environment Requirements** +> +> IDE: DevEco Studio 3.0 Beta3 (3.0.0.900) or later +> +> SDK: API version 9 or later +> +> Model: stage + +This document is organized as follows: + +- [Creating an AccessibilityExtAbility File](#creating-an-accessibility-extension-service) +- [Processing an Accessibility Event](#processing-an-accessibility-event) +- [Declaring Capabilities of Accessibility Extension Services](#declaring-capabilities-of-accessibility-extension-services) +- [Enabling a Custom Accessibility Extension Service](#enabling-a-custom-accessibility-extension-service) + +## Creating an Accessibility Extension Service + +You can create an accessibility extension service by creating a project from scratch or adding the service to an existing project. + +### Creating a Project + +Perform the following steps in DevEco Studio: +1. From the upper left corner of DevEco Studio, choose **File** > **New** > **Create Project**. +2. By following the project creation wizard, click the **OpenHarmony** tab, select the **Empty Ability** template, and then click **Next**. +3. Set **Project type** to **Application**, **Compile API** (or **Compile SDK**, depending on the version used) to **9**, and **Model** to **Stage**, and then click **Finish**. + +### Creating an AccessibilityExtAbility File + +To add an accessibility extension service to a project, create the **AccessibilityExtAbility** folder in the **ets** folder of the project, create the **AccessibilityExtAbility.ts** file in the new folder, and add the following code to the new file: + +```typescript +import AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtensionAbility'; + +class AccessibilityExtAbility extends AccessibilityExtensionAbility { + onConnect() { + console.log('AccessibilityExtAbility onConnect'); + } + + onDisconnect() { + console.log('AccessibilityExtAbility onDisconnect'); + } + + onAccessibilityEvent(accessibilityEvent) { + console.log('AccessibilityExtAbility onAccessibilityEvent: ' + JSON.stringify(accessibilityEvent)); + } +} + +export default AccessibilityExtAbility; +``` + +The APIs defined in the file are as follows. + +| API| Description| +| ---- | ---- | +| onConnect(): void | Called when a connection with the extension service is set up.| +| onDisconnect(): void | Called when the connection with the extension service is severed.| +| onAccessibilityEvent(event: AccessibilityEvent): void | Called when an accessibility event occurs| + +## Processing an Accessibility Event + +You can process the service logic for accessibility events in the **onAccessibilityEvent()** API. For details about the events, see [AccessibilityEvent](../reference/apis/js-apis-application-accessibilityExtensionAbility.md#accessibilityevent). The following code snippet uses the **pageStateUpdate** event as an example. + +```typescript +onAccessibilityEvent(accessibilityEvent) { + console.log('AccessibilityExtAbility onAccessibilityEvent: ' + JSON.stringify(accessibilityEvent)); + if (accessibilityEvent.eventType === 'pageStateUpdate') { + console.log('AccessibilityExtAbility onAccessibilityEvent: pageStateUpdate'); + // TODO: Develop custom logic. + } +} +``` +For an accessibility event, you can use the APIs of the [AccessibilityExtensionContext](../reference/apis/js-apis-inner-application-accessibilityExtensionContext.md) module to configure the concerned information, obtain root information, and inject gestures. + +You can also process physical key events in the accessibility extension service. For details, see [onKeyEvent](../reference/apis/js-apis-application-accessibilityExtensionAbility.md#accessibilityextensionabilityonkeyevent). + +## Declaring Capabilities of Accessibility Extension Services + +After developing the custom logic for an accessibility extension service, you must add the configuration information of the service to the corresponding module-level **module.json5** file in the project directory. In the file, the **srcEntrance** tag indicates the path to the accessibility extension service. Make sure the value of the **type** tag is fixed at **accessibility**. Otherwise, the connection to the service will fail. + +```json +"extensionAbilities": [ + { + "name": "AccessibilityExtAbility", + "srcEntrance": "./ets/AccessibilityExtAbility/AccessibilityExtAbility.ts", + "label": "$string:MainAbility_label", + "description": "$string:MainAbility_desc", + "type": "accessibility", + "metadata": [ + { + "name": "ohos.accessibleability", + "resource": "$profile:accessibility_config" + } + ] + } +] +``` +**accessibility_config** is the specific configuration of the accessibility extension service. You need to create the **accessibility_config.json** file in **resources/base/profile/** and declare the [capabilities](../reference/apis/js-apis-accessibility.md#capability) of the service in the file. +```json +{ + "accessibilityCapabilities": [ + "retrieve", + "gesture" + ] +} +``` +## Enabling a Custom Accessibility Extension Service + +To enable or disable an accessibility extension service, run the following command: +- To enable the service: **accessibility enable -a AccessibilityExtAbility -b com.example.demo -c rg** +- To disable the service: **accessibility disable -a AccessibilityExtAbility -b com.example.demo** + +In the preceding commands, **AccessibilityExtAbility** indicates the name of the accessibility extension service, **com.example.demo** indicates the bundle name, and **rg** indicates the capabilities (**r** is short for retrieve). + +If the service is enabled or disabled successfully, the message "enable ability successfully" or "disable ability successfully" is displayed. diff --git a/en/application-dev/application-models/application-component-configuration-stage.md b/en/application-dev/application-models/application-component-configuration-stage.md index de9e29941b5ddcc9e29f62ddc039fb38b6bc54b6..356429972800d60f1062a6c180934d237e648e26 100644 --- a/en/application-dev/application-models/application-component-configuration-stage.md +++ b/en/application-dev/application-models/application-component-configuration-stage.md @@ -3,7 +3,8 @@ When developing an application, you may need to configure certain tags to identify the application, such as the bundle name and application icon. This topic describes key tags that need to be configured during application development. Icons and labels are usually configured together. There is the application icon, application label, entry icon, and entry label, which correspond to the **icon** and **label** fields in the [app.json5 file](../quick-start/app-configuration-file.md) and [module.json5 file](../quick-start/module-configuration-file.md). The application icon and label are used in **Settings**. For example, they are displayed in the application list in **Settings**. The entry icon is displayed on the device's home screen after the application is installed. The entry icon maps to a [UIAbility](uiability-overview.md) component. Therefore, an application can have multiple entry icons and labels. When you touch one of them, the corresponding UIAbility page is displayed. -**Figure 1** Icons and labels + + **Figure 1** Icons and labels ![application-component-configuration-stage](figures/application-component-configuration-stage.png) @@ -14,11 +15,11 @@ When developing an application, you may need to configure certain tags to identi - **Configuring the application icon and label** - The application icon is specified by the **icon** field in the [app.json5 file](../quick-start/app-configuration-file.md) in the **AppScope** directory of the project. The **icon** field must be set to the index of an image so that the image is displayed as the application icon. The application icon is usually displayed in an application list, for example, the application list in **Settings**. + You must configure an icon and label for an application on the stage model. - The application label is specified by the **label** field in the [app.json5 file](../quick-start/app-configuration-file.md) in the **AppScope** module of the project. The **label** field specifies the application name displayed to users. It must be set to the index of a string resource. + The application icon is specified by the **icon** field in the [app.json5 file](../quick-start/app-configuration-file.md) in the **AppScope** directory of the project. The **icon** field must be set to the index of an image so that the image is displayed as the application icon. - The **icon** and **label** fields in the **app.json5** file are under **app**, as follows: + The application label is specified by the **label** field in the [app.json5 file](../quick-start/app-configuration-file.md) in the **AppScope** module of the project. The **label** field specifies the application name displayed to users. It must be set to the index of a string resource. ```json { @@ -32,7 +33,11 @@ When developing an application, you may need to configure certain tags to identi - **Configuring the entry icon and label** - The entry icon and label are configured by specifying **icon** and **label** under **abilities** in the [module.json5 file](../quick-start/module-configuration-file.md). For example, if you want to display the icon and label of the UIAbility component on the home screen, add **entity.system.home** to **entities** and **action.system.home** to **actions** under **skills**. If the preceding fields are configured for multiple UIAbility components of an application, multiple icons and labels are displayed on the home screen, corresponding to their respective UIAbility component. + On the stage model, you can configure an entry icon and label for each application component. The entry icon and label are displayed on the home screen. + + The entry icon is configured by specifying **icon** under **abilities** in the [module.json5 file](../quick-start/module-configuration-file.md). For example, if you want to display the icon of the UIAbility component on the home screen, add **entity.system.home** to **entities** and **action.system.home** to **actions** under **skills**. If this field is configured for multiple UIAbility components of an application, multiple icons are displayed on the home screen, corresponding to their respective UIAbility component. + + The entry label is configured by specifying **label** under **abilities** in the [module.json5 file](../quick-start/module-configuration-file.md). For example, if you want to display the icon of the UIAbility component on the home screen, add **entity.system.home** to **entities** and **action.system.home** to **actions** under **skills**. If this field is configured for multiple UIAbility components of an application, multiple labels are displayed on the home screen, corresponding to their respective UIAbility component. ```json { @@ -58,6 +63,7 @@ When developing an application, you may need to configure certain tags to identi } } ``` + - **Configuring application version declaration** To declare the application version, configure the **versionCode** and **versionName** fields in the [app.json5 file](../quick-start/app-configuration-file.md) in the **AppScope** directory of the project. **versionCode** specifies the version number of the application. The value is a 32-bit non-negative integer. It is used only to determine whether a version is later than another version. A larger value indicates a later version. **versionName** provides the text description of the version number. @@ -69,4 +75,3 @@ When developing an application, you may need to configure certain tags to identi - **Configuring the module permission** The **requestPermission** field in the [module.json5 file](../quick-start/module-configuration-file.md) is used to configure the permission information required by the module to access the protected part of the system or other applications. This field declares the name of the permission to request, the reason for requesting the permission, and the scenario where the permission is used. - diff --git a/en/application-dev/application-models/application-model-description.md b/en/application-dev/application-models/application-model-description.md index de7e3045d79eff2c681291f8d4de55129d361245..0cdfa7323c6ef367a47a44e2c30104d3201ca159 100644 --- a/en/application-dev/application-models/application-model-description.md +++ b/en/application-dev/application-models/application-model-description.md @@ -14,7 +14,7 @@ The stage model is designed based on the following considerations, which make it 1. **Designed for complex applications** - In the stage model, multiple application components share an ArkTS engine (VM running the programming language ArkTS) instance, making it easy for application components to share objects and status while requiring less memory. -- The object-oriented development mode makes the code of complex applications easy to read, maintain, and scale. + - The object-oriented development mode makes the code of complex applications easy to read, maintain, and scale. 2. **Native support for [cross-device migration](hop-cross-device-migration.md) and [multi-device collaboration](hop-multi-device-collaboration.md) at the application component level** @@ -48,13 +48,12 @@ In the stage model, multiple application components share the same ArkTS engine The table below describes their differences in detail. - **Table 1** Differences between the FA model and stage model +**Table 1** Differences between the FA model and stage model | Item| FA model| Stage model| | -------- | -------- | -------- | -| **Application component**| 1. Component classification
- PageAbility: has the UI and supports user interaction. For details, see [PageAbility Component Overview](pageability-overview.md).
- ServiceAbility: provides background services and has no UI. For details, see [ServiceAbility Component Overview](serviceability-overview.md).
- DataAbility: provides the data sharing capability and has no UI. For details, see [DataAbility Component Overview](dataability-overview.md).
2. Development mode
Application components are specified by exporting anonymous objects and fixed entry files. You cannot perform derivation. It is inconvenient for capability expansion.| 1. Component classification
- UIAbility: has the UI and supports user interaction. For details, see [UIAbility Component Overview](uiability-overview.md).
- ExtensionAbility: provides extension capabilities (such as widget and input methods) for specific scenarios. For details, see [ExtensionAbility Component Overview](extensionability-overview.md).
2. Development mode
The object-oriented mode is used to provide open application components as classes. You can derive application components for capability expansion.| -| **Process model**| There are two types of processes:
1. Main process
2. Rendering process
For details, see [Process Model (FA Model)](process-model-fa.md). | There are three types of processes:
1. Main process
2. ExtensionAbility process
3. Rendering process
For details, see [Process Model (Stage Model)](process-model-stage.md). | -| **Thread model**| 1. ArkTS engine instance creation
A process can run multiple application component instances, and each application component instance runs in an independent ArkTS engine instance.
2. Thread model
Each ArkTS engine instance is created on an independent thread (non-main thread). The main thread does not have an ArkTS engine instance.
3. Intra-process object sharing: not supported.
For details, see [Thread Model (FA Model)](thread-model-fa.md). | 1. ArkTS engine instance creation
A process can run multiple application component instances, and all application component instances share one ArkTS engine instance.
2. Thread model
The ArkTS engine instance is created on the main thread.
3. Intra-process object sharing: supported.
For details, see [Thread Model (Stage Model)](thread-model-stage.md). | +| **Application component**| 1. Component classification
![fa-model-component](figures/fa-model-component.png)
- PageAbility: has the UI and supports user interaction For details, see [PageAbility Component Overview](pageability-overview.md).
- ServiceAbility: provides background services and has no UI. For details, see [ServiceAbility Component Overview](serviceability-overview.md).
- DataAbility: provides the data sharing capability and has no UI. For details, see [DataAbility Component Overview](dataability-overview.md).
2. Development mode
Application components are specified by exporting anonymous objects and fixed entry files. You cannot perform derivation. It is inconvenient for capability expansion. | 1. Component classification
![stage-model-component](figures/stage-model-component.png)
- UIAbility: has the UI and supports user interaction. For details, see [UIAbility Component Overview](uiability-overview.md).
- ExtensionAbility: provides extension capabilities (such as widget and input methods) for specific scenarios. For details, see [ExtensionAbility Component Overview](extensionability-overview.md).
2. Development mode
The object-oriented mode is used to provide open application components as classes. You can derive application components for capability expansion. | +| **Process model**| There are two types of processes:
1. Main process
2. Rendering process
For details, see [Process Model (FA Model)](process-model-fa.md).| There are three types of processes:
1. Main process
2. ExtensionAbility process
3. Rendering process
For details, see [Process Model (Stage Model)](process-model-stage.md).| +| **Thread model**| 1. ArkTS engine instance creation
A process can run multiple application component instances, and each application component instance runs in an independent ArkTS engine instance.
2. Thread model
Each ArkTS engine instance is created on an independent thread (non-main thread). The main thread does not have an ArkTS engine instance.
3. Intra-process object sharing: not supported.
For details, see [Thread Model (FA Model)](thread-model-fa.md).| 1. ArkTS engine instance creation
A process can run multiple application component instances, and all application component instances share one ArkTS engine instance.
2. Thread model
The ArkTS engine instance is created on the main thread.
3. Intra-process object sharing: supported.
For details, see [Thread Model (Stage Model)](thread-model-stage.md).| | **Mission management model**| - A mission is created for each PageAbility component instance.
- Missions are stored persistently until the number of missions exceeds the maximum (customized based on the product configuration) or users delete missions.
- PageAbility components do not form a stack structure.
For details, see [Mission Management Scenarios](mission-management-overview.md).| - A mission is created for each UIAbility component instance.
- Missions are stored persistently until the number of missions exceeds the maximum (customized based on the product configuration) or users delete missions.
- UIAbility components do not form a stack structure.
For details, see [Mission Management Scenarios](mission-management-overview.md).| | **Application configuration file**| The **config.json** file is used to describe the application, HAP, and application component information.
For details, see [Application Configuration File Overview (FA Model)](../quick-start/application-configuration-file-overview-fa.md).| The **app.json5** file is used to describe the application information, and the **module.json5** file is used to describe the HAP and application component information.
For details, see [Application Configuration File Overview (Stage Model)](../quick-start/application-configuration-file-overview-stage.md).| - diff --git a/en/application-dev/application-models/datashareextensionability.md b/en/application-dev/application-models/datashareextensionability.md index 5b07ba68180fbcc2a51047d37ca9a82addd89cd8..1f968abfa743d7fb917fb7db3e0e41342e41c848 100644 --- a/en/application-dev/application-models/datashareextensionability.md +++ b/en/application-dev/application-models/datashareextensionability.md @@ -1,4 +1,4 @@ -# DataShareExtensionAbility +# DataShareExtensionAbility (System Applications Only) -DataShareExtensionAbility is available only for system application. It provides the data sharing capability. System applications can implement a DataShareExtensionAbility or access an existing DataShareExtensionAbility in the system. Third-party applications can only access an existing DataShareExtensionAbility. For details, see [DataShare Development](../database/database-datashare-guidelines.md). +DataShareExtensionAbility provides the data sharing capability. System applications can implement a DataShareExtensionAbility or access an existing DataShareExtensionAbility in the system. Third-party applications can only access an existing DataShareExtensionAbility. For details, see [DataShare Development](../database/database-datashare-guidelines.md). diff --git a/en/application-dev/application-models/extensionability-overview.md b/en/application-dev/application-models/extensionability-overview.md index d85f02ace879e409a8d42d6f09408680a99f8056..5f03c023d20bc16e64a2eb4a28bbe026f0a7feb7 100644 --- a/en/application-dev/application-models/extensionability-overview.md +++ b/en/application-dev/application-models/extensionability-overview.md @@ -9,7 +9,7 @@ An [ExtensionAbilityType](../reference/apis/js-apis-bundleManager.md#extensionab - [FormExtensionAbility](../reference/apis/js-apis-app-form-formExtensionAbility.md): ExtensionAbility component of the form type, which provides APIs related to widgets. -- [WorkSchedulerExtensionAbility](../reference/apis/js-apis-resourceschedule-workScheduler.md): ExtensionAbility component of the work_scheduler type, which provides APIs for registering, canceling, and querying Work Scheduler tasks. +- [WorkSchedulerExtensionAbility](../reference/apis/js-apis-WorkSchedulerExtensionAbility.md): ExtensionAbility component of the work_scheduler type, which provides APIs for registering, canceling, and querying Work Scheduler tasks. - [InputMethodExtensionAbility](../reference/apis/js-apis-inputmethod.md): ExtensionAbility component of the input_method type, which provides an input method framework that can be used to hide the keyboard, obtain the list of installed input methods, display the dialog box for input method selection, and more. @@ -21,7 +21,7 @@ An [ExtensionAbilityType](../reference/apis/js-apis-bundleManager.md#extensionab - [StaticSubscriberExtensionAbility](../reference/apis/js-apis-application-staticSubscriberExtensionAbility.md): ExtensionAbility component of the static_subscriber type, which provides APIs for static broadcast. -- [WindowExtensionAbility](../reference/apis/js-apis-application-windowExtensionAbility.md): ExtensionAbility component of the window type, which allows system applications to display UIs of other applications. +- [WindowExtensionAbility](../reference/apis/js-apis-application-windowExtensionAbility.md): ExtensionAbility component of the window type, which allows a system application to be embedded in and displayed over another application. - [EnterpriseAdminExtensionAbility](../reference/apis/js-apis-EnterpriseAdminExtensionAbility.md): ExtensionAbility component of the enterprise_admin type, which provides APIs for processing enterprise management events, such as application installation events on devices and events indicating too many incorrect screen-lock password attempts. @@ -33,6 +33,7 @@ All types of ExtensionAbility components are started by the corresponding system The following uses [InputMethodExtensionAbility](../reference/apis/js-apis-inputmethod.md) as an example. As shown in the figure below, when an application calls the InputMethodExtensionAbility component, the input method management service is called first. The input method management service starts the InputMethodExtensionAbility component, returns the component to the application, and starts to manage its lifecycle. **Figure 1** Using the InputMethodExtensionAbility component + ![ExtensionAbility-start](figures/ExtensionAbility-start.png) @@ -48,11 +49,11 @@ You do not need to care when to add or delete a widget. The lifecycle of the For > **NOTE** > > For an application, all ExtensionAbility components of the same type run in an independent process, whereas UIAbility, ServiceExtensionAbility, and DataShareExtensionAbility run in another independent process. For details, see [Process Model (Stage Model)](process-model-stage.md). -> +> > For example, an application has one UIAbility component, one ServiceExtensionAbility, one DataShareExtensionAbility, two FormExtensionAbility, and one ImeExtensionAbility. When the application is running, there are three processes: -> +> > - UIAbility, ServiceExtensionAbility, and DataShareExtensionAbility run in an independent process. -> +> > - The two FormExtensionAbility components run in an independent process. -> +> > - The two ImeExtensionAbility components run in an independent process. diff --git a/en/application-dev/application-models/figures/fa-model-component.png b/en/application-dev/application-models/figures/fa-model-component.png new file mode 100644 index 0000000000000000000000000000000000000000..0c28038326c5475abb3f897c5f7cbe9eb50aec00 Binary files /dev/null and b/en/application-dev/application-models/figures/fa-model-component.png differ diff --git a/en/application-dev/application-models/figures/mission-chain3.png b/en/application-dev/application-models/figures/mission-chain3.png index e02c135ad4a90f99bb65bdccd821d29990b9536e..0357874ea633a490da800ef5baa2e70d53ce6a2d 100644 Binary files a/en/application-dev/application-models/figures/mission-chain3.png and b/en/application-dev/application-models/figures/mission-chain3.png differ diff --git a/en/application-dev/application-models/figures/stage-model-component.png b/en/application-dev/application-models/figures/stage-model-component.png new file mode 100644 index 0000000000000000000000000000000000000000..6de8c778aff28cc9c7353270ce8ab4ad0c10fb02 Binary files /dev/null and b/en/application-dev/application-models/figures/stage-model-component.png differ diff --git a/en/application-dev/application-models/hop-cross-device-migration.md b/en/application-dev/application-models/hop-cross-device-migration.md index 6d30435a819da49855cf9ae818bac419a1c0b614..a482ae26ced4987d0b0c02382ac132c42ea932c0 100644 --- a/en/application-dev/application-models/hop-cross-device-migration.md +++ b/en/application-dev/application-models/hop-cross-device-migration.md @@ -1,9 +1,9 @@ -# Cross-Device Migration +# Cross-Device Migration (System Applications Only)] ## When to Use -Cross-device migration is available only for system applications. The main task is to migrate the current task (including the page control status) of an application to the target device so that the task can continue on it. Cross-device migration supports the following functionalities: +The main task of cross-device migration is to migrate the current task (including the page control status) of an application to the target device so that the task can continue on it. Cross-device migration supports the following functionalities: - Storage and restoration of custom data diff --git a/en/application-dev/application-models/hop-multi-device-collaboration.md b/en/application-dev/application-models/hop-multi-device-collaboration.md index 3a6fa2646a37785d41793407d4803d60743342dd..50fa38b975f137a508063869ac2760beb2dbbcdb 100644 --- a/en/application-dev/application-models/hop-multi-device-collaboration.md +++ b/en/application-dev/application-models/hop-multi-device-collaboration.md @@ -1,9 +1,9 @@ -# Multi-device Collaboration +# Multi-device Collaboration (System Applications Only) ## When to Use -Multi-device coordination is available only for system applications. It involves the following scenarios: +Multi-device coordination involves the following scenarios: - [Starting UIAbility and ServiceExtensionAbility Across Devices (No Data Returned)](#starting-uiability-and-serviceextensionability-across-devices-no-data-returned) diff --git a/en/application-dev/application-models/serviceextensionability.md b/en/application-dev/application-models/serviceextensionability.md index c4ffdbd980fff4ce568115f92af884da06739ad2..edccb0b736c9ad81f5ae316e7310b6cc35ae34e0 100644 --- a/en/application-dev/application-models/serviceextensionability.md +++ b/en/application-dev/application-models/serviceextensionability.md @@ -1,5 +1,6 @@ # ServiceExtensionAbility + [ServiceExtensionAbility](../reference/apis/js-apis-app-ability-serviceExtensionAbility.md) is an ExtensionAbility component of the service type that provides extension capabilities related to background services. @@ -17,9 +18,9 @@ Each type of ExtensionAbility has its own context. ServiceExtensionAbility has [ This topic describes how to use ServiceExtensionAbility in the following scenarios: -- [Implementing a Background Service](#implementing-a-background-service) +- [Implementing a Background Service (System Applications Only)](#implementing-a-background-service-system-applications-only) -- [Starting a Background Service](#starting-a-background-service) +- [Starting a Background Service (System Applications Only)](#starting-a-background-service-system-applications-only) - [Connecting to a Background Service](#connecting-to-a-background-service) @@ -32,36 +33,32 @@ This topic describes how to use ServiceExtensionAbility in the following scenari > - Third-party applications can connect to ServiceExtensionAbility provided by the system only when they gain focus in the foreground. -## Implementing a Background Service +## Implementing a Background Service (System Applications Only) -This feature applies only to system applications. [ServiceExtensionAbility](../reference/apis/js-apis-app-ability-serviceExtensionAbility.md) provides the callbacks **onCreate()**, **onRequest()**, **onConnect()**, **onDisconnect()**, and **onDestory()**. Override them as required. The following figure shows the lifecycle of ServiceExtensionAbility. +[ServiceExtensionAbility](../reference/apis/js-apis-app-ability-serviceExtensionAbility.md) provides the callbacks **onCreate()**, **onRequest()**, **onConnect()**, **onDisconnect()**, and **onDestory()**. Override them as required. The following figure shows the lifecycle of ServiceExtensionAbility. **Figure 1** ServiceExtensionAbility lifecycle ![ServiceExtensionAbility-lifecycle](figures/ServiceExtensionAbility-lifecycle.png) - **onCreate** - -This callback is triggered when a service is created for the first time. You can perform initialization operations, for example, registering a common event listener. + This callback is triggered when a service is created for the first time. You can perform initialization operations, for example, registering a common event listener. > **NOTE** -> + > > If a service has been created, starting it again does not trigger the **onCreate()** callback. - **onRequest** - -This callback is triggered when another component calls the **startServiceExtensionAbility()** method to start the service. After being started, the service runs in the background. + This callback is triggered when another component calls the **startServiceExtensionAbility()** method to start the service. After being started, the service runs in the background. - **onConnect** - -This callback is triggered when another component calls the **connectServiceExtensionAbility()** method to connect to the service. In this method, a remote proxy object (IRemoteObject) is returned, through which the client communicates with the server by means of RPC. + This callback is triggered when another component calls the **connectServiceExtensionAbility()** method to connect to the service. In this method, a remote proxy object (IRemoteObject) is returned, through which the client communicates with the server by means of RPC. - **onDisconnect** - -This callback is triggered when a component calls the **disconnectServiceExtensionAbility()** method to disconnect from the service. + This callback is triggered when a component calls the **disconnectServiceExtensionAbility()** method to disconnect from the service. - **onDestroy** @@ -167,9 +164,9 @@ To implement a background service, manually create a ServiceExtensionAbility com ``` -## Starting a Background Service +## Starting a Background Service (System Applications Only) -This feature applies only to system applications. A system application uses the [startServiceExtensionAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#abilitycontextstartserviceextensionability) method to start a background service. The [onRequest()](../reference/apis/js-apis-app-ability-serviceExtensionAbility.md#serviceextensionabilityonrequest) callback is invoked, and the **Want** object passed by the caller is received through the callback. After the background service is started, its lifecycle is independent of that of the client. In other words, even if the client is destroyed, the background service can still run. Therefore, the background service must be stopped by calling [terminateSelf()](../reference/apis/js-apis-inner-application-serviceExtensionContext.md#serviceextensioncontextterminateself) when its work is complete. Alternatively, another component can call [stopServiceExtensionAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#abilitycontextstopserviceextensionability) to stop the background service. +A system application uses the [startServiceExtensionAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#abilitycontextstartserviceextensionability) method to start a background service. The [onRequest()](../reference/apis/js-apis-app-ability-serviceExtensionAbility.md#serviceextensionabilityonrequest) callback is invoked, and the **Want** object passed by the caller is received through the callback. After the background service is started, its lifecycle is independent of that of the client. In other words, even if the client is destroyed, the background service can still run. Therefore, the background service must be stopped by calling [terminateSelf()](../reference/apis/js-apis-inner-application-serviceExtensionContext.md#serviceextensioncontextterminateself) when its work is complete. Alternatively, another component can call [stopServiceExtensionAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#abilitycontextstopserviceextensionability) to stop the background service. > **NOTE** > diff --git a/en/application-dev/application-models/start-remote-pageability.md b/en/application-dev/application-models/start-remote-pageability.md index 4e998a15d23d298bfdb402bd18ea0db2a9f819eb..7d270a68058448025def436e71ace635b4a1297c 100644 --- a/en/application-dev/application-models/start-remote-pageability.md +++ b/en/application-dev/application-models/start-remote-pageability.md @@ -1,7 +1,7 @@ -# Starting a Remote PageAbility +# Starting a Remote PageAbility (System Applications Only) -This feature applies only to system applications. The **startAbility()** method in the **featureAbility** class is used to start a remote PageAbility. +The **startAbility()** method in the **featureAbility** class is used to start a remote PageAbility. In addition to **'\@ohos.ability.featureAbility'**, you must import **'\@ohos.distributedHardware.deviceManager'**, which provides account-independent distributed device networking capabilities. Then you can use **getTrustedDeviceListSync** of the **DeviceManager** module to obtain the remote device ID and pass the remote device ID in the **want** parameter for starting the remote PageAbility. diff --git a/en/application-dev/application-models/uiability-intra-device-interaction.md b/en/application-dev/application-models/uiability-intra-device-interaction.md index 78363a3a2b65bee17a2ea7524b2fe7180de38909..4ec507ae7043e9b95f47a2ec954f1e95c52d53cb 100644 --- a/en/application-dev/application-models/uiability-intra-device-interaction.md +++ b/en/application-dev/application-models/uiability-intra-device-interaction.md @@ -17,7 +17,7 @@ This topic describes the UIAbility interaction modes in the following scenarios. - [Starting a Specified Page of UIAbility](#starting-a-specified-page-of-uiability) -- [Using Ability Call to Implement UIAbility Interaction](#using-ability-call-to-implement-uiability-interaction) +- [Using Ability Call to Implement UIAbility Interaction (System Applications Only)](#using-ability-call-to-implement-uiability-interaction-system-applications-only) ## Starting UIAbility in the Same Application @@ -416,9 +416,9 @@ In summary, when a UIAbility instance of application A has been created and the > When the [launch type of the callee UIAbility](uiability-launch-type.md) is set to **standard**, a new instance is created each time the callee UIAbility is started. In this case, the [onNewWant()](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonnewwant) callback will not be invoked. -## Using Ability Call to Implement UIAbility Interaction +## Using Ability Call to Implement UIAbility Interaction (System Applications Only) -This feature applies only to system applications. Ability call is an extension of the UIAbility capability. It enables the UIAbility to be invoked by and communicate with external systems. The UIAbility invoked can be either started in the foreground or created and run in the background. You can use the ability call to implement data sharing between two UIAbility instances (caller ability and callee ability) through IPC. +Ability call is an extension of the UIAbility capability. It enables the UIAbility to be invoked by and communicate with external systems. The UIAbility invoked can be either started in the foreground or created and run in the background. You can use the ability call to implement data sharing between two UIAbility instances (caller ability and callee ability) through IPC. The core API used for the ability call is **startAbilityByCall**, which differs from **startAbility** in the following ways: diff --git a/en/application-dev/application-models/uiability-overview.md b/en/application-dev/application-models/uiability-overview.md index 14cb5c4652749c97dd6e50c4232b6f65fb6feaab..6767d667e441f6baee987d175c30052bac0afc01 100644 --- a/en/application-dev/application-models/uiability-overview.md +++ b/en/application-dev/application-models/uiability-overview.md @@ -3,7 +3,7 @@ ## Overview -UIAbility has the UI and is mainly used for user interaction. +UIAbility is a type of application component that provides the UI for user interaction. UIAbility is the basic unit scheduled by the system and provides a window for applications to draw UIs. A UIAbility component can implement a functional module through multiple pages. Each UIAbility component instance corresponds to a mission in **Recents**. @@ -32,8 +32,3 @@ To enable an application to properly use a UIAbility component, declare the UIAb } } ``` - -> **NOTE** -> -> For the ability composition, see [Adding an Ability to a Module](https://developer.harmonyos.com/en/docs/documentation/doc-guides-V3/ohos-adding-ability-0000001218280664-V3). - diff --git a/en/application-dev/application-models/windowextensionability.md b/en/application-dev/application-models/windowextensionability.md new file mode 100644 index 0000000000000000000000000000000000000000..cf2ce01947412e479d29516601c45aebc2b55b17 --- /dev/null +++ b/en/application-dev/application-models/windowextensionability.md @@ -0,0 +1,112 @@ +# WindowExtensionAbility + +[WindowExtensionAbility](../reference/apis/js-apis-application-windowExtensionAbility.md) is a type of ExtensionAbility component that allows a system application to be embedded in and displayed over another application. + + +The WindowExtensionAbility component must be used together with the [AbilityComponent](../reference/arkui-ts/ts-container-ability-component.md) to process services of the started application. WindowExtensionAbility is run in connection mode. A system application must use the AbilityComponent to start the WindowExtensionAbility component. + +Each ExtensionAbility has its own context. For WindowExtensionAbility, +the context is [WindowExtensionContext](../reference/apis/js-apis-inner-application-windowExtensionContext.md). + +> **NOTE** +> +> **WindowExtensionAbility** is a system API. To embed a third-party application in another application and display it over the application, switch to the full SDK by following the instructions provided in [Guide to Switching to Full SDK](../../application-dev/quick-start/full-sdk-switch-guide.md). +> + + +## Setting an Embedded Ability (System Applications Only) + +The **WindowExtensionAbility** class provides **onConnect()**, **onDisconnect()**, and **onWindowReady()** lifecycle callbacks, which can be overridden. + +- The **onWindowReady()** callback is invoked when a window is created for the ability. + +- The **onConnect()** callback is invoked when the AbilityComponent corresponding to the window connects to the ability. + +- The **onDisconnect()** callback is invoked when the AbilityComponent disconnects from the ability. + + +**How to Develop** + +To implement an embedded application, manually create a WindowExtensionAbility in DevEco Studio as follows: + +1. In the **ets** directory of the **Module** project, right-click and choose **New > Directory** to create a directory named **WindowExtAbility**. + +2. Right-click the **WindowExtAbility** directory, and choose **New > TypeScript File** to create a file named **WindowExtAbility.ts**. + +3. Open the **WindowExtAbility.ts** file and import the dependency package of **WindowExtensionAbility**. Customize a class that inherits from **WindowExtensionAbility** and implement the **onWindowReady()**, **onConnect()**, and **onDisconnect()** lifecycle callbacks. + + ```ts + import Extension from '@ohos.application.WindowExtensionAbility' + + export default class WindowExtAbility extends Extension { + onWindowReady(window) { + window.loadContent('WindowExtAbility/pages/index1').then(() => { + window.getProperties().then((pro) => { + console.log("WindowExtension " + JSON.stringify(pro)); + }) + window.show(); + }) + } + + onConnect(want) { + console.info('JSWindowExtension onConnect ' + want.abilityName); + } + + onDisconnect(want) { + console.info('JSWindowExtension onDisconnect ' + want.abilityName); + } + } + ``` + +4. Register the WindowExtensionAbility in the [module.json5 file](../quick-start/module-configuration-file.md) corresponding to the **Module** project. Set **type** to **"window"** and **srcEntrance** to the code path of the ExtensionAbility component. + + ```json + { + "module": { + "extensionAbilities": [ + { + "name": "WindowExtAbility", + "srcEntrance": "./ets/WindowExtAbility/WindowExtAbility.ts", + "icon": "$media:icon", + "description": "WindowExtension", + "type": "window", + "visible": true, + } + ], + } + } + ``` + + +## Starting an Embedded Ability (System Applications Only) + +System applications can load the created WindowExtensionAbility through the AbilityComponent. + +**How to Develop** + +1. To connect to an embedded application, add the AbilityComponent to the corresponding pages in the DevEco Studio project. + +2. Set **bundleName** and **abilityName** in the AbilityComponent. + +3. Set the width and height. The sample code is as follows: + +```ts +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + build() { + Row() { + Column() { + AbilityComponent({ abilityName: "WindowExtAbility", bundleName: "com.example.WindowExtAbility"}) + .width(500) + .height(500) + } + .width('100%') + } + .height('100%') + .backgroundColor(0x64BB5c) + } +} +``` diff --git a/en/application-dev/application-test/arkxtest-guidelines.md b/en/application-dev/application-test/arkxtest-guidelines.md index ce7a28154635b724d127a50af801c74f84607402..5f4f36e78850272bc5101fa1b86e76f6e91d5f37 100644 --- a/en/application-dev/application-test/arkxtest-guidelines.md +++ b/en/application-dev/application-test/arkxtest-guidelines.md @@ -108,7 +108,7 @@ You write a UI test script based on the unit test framework, adding the invoking In this example, the UI test script is written based on the preceding unit test script. First, add the dependency package, as shown below: ```js -import {UiDriver,BY,UiComponent,MatchPattern} from '@ohos.uitest' +import {Driver,ON,Component,MatchPattern} from '@ohos.uitest' ``` Then, write specific test code. Specifically, implement the click action on the started application page and add checkpoint check cases. @@ -131,16 +131,16 @@ export default function abilityTest() { expect(Ability.context.abilityInfo.name).assertEqual('MainAbility'); }) //ui test code - //init uidriver - var driver = await UiDriver.create(); + //init driver + var driver = await Driver.create(); await driver.delayMs(1000); //find button by text 'Next' - var button = await driver.findComponent(BY.text('Next')); + var button = await driver.findComponent(ON.text('Next')); //click button await button.click(); await driver.delayMs(1000); //check text - await driver.assertComponentExist(BY.text('after click')); + await driver.assertComponentExist(ON.text('after click')); await driver.pressBack(); done(); }) diff --git a/en/application-dev/application-test/figures/Execute.PNG b/en/application-dev/application-test/figures/Execute.PNG index 90dcb55338ad473d29557e4c761801b16c770d45..0260b7983a13851dc1ef8e45928f952eb509a7d8 100644 Binary files a/en/application-dev/application-test/figures/Execute.PNG and b/en/application-dev/application-test/figures/Execute.PNG differ diff --git a/en/application-dev/database/database-distributedobject-guidelines.md b/en/application-dev/database/database-distributedobject-guidelines.md index ec77d5330b57751e36b3ba2d96b57028c340dd36..dcbc34b48912020e0a7c6e0c987ce5de1d0b75c8 100644 --- a/en/application-dev/database/database-distributedobject-guidelines.md +++ b/en/application-dev/database/database-distributedobject-guidelines.md @@ -16,16 +16,18 @@ Call **createDistributedObject()** to create a distributed data object instance. **Table 1** API for creating a distributed data object instance -| Package| API| Description| + +| Bundle Name| API| Description| | -------- | -------- | -------- | -| ohos.data.distributedDataObject| createDistributedObject(source: object): DistributedObject | Creates a distributed data object instance for data operations.
- **source**: attributes of the distributed data object to set.
- **DistributedObject**: returns the distributed data object created. | +| ohos.data.distributedDataObject| createDistributedObject(source: object): DistributedObject | Creates a distributed data object instance for data operations.
- **source**: attributes of the distributed data object to create.
- **DistributedObject**: returns the distributed data object created.| ### Generating a Session ID Call **genSessionId()** to generate a session ID randomly. The generated session ID can be used to set the session ID of a distributed data object. **Table 2** API for generating a session ID randomly -| Package| API| Description| + +| Bundle Name| API| Description| | -------- | -------- | -------- | | ohos.data.distributedDataObject| genSessionId(): string | Generates a session ID, which can be used as the session ID of a distributed data object.| @@ -34,9 +36,10 @@ Call **genSessionId()** to generate a session ID randomly. The generated session Call **setSessionId()** to set a session ID for a distributed data object. The session ID is a unique identifier for one collaboration across devices. The distributed data objects to be synchronized must be associated with the same session ID. **Table 3** API for setting a session ID + | Class| API| Description| | -------- | -------- | -------- | -| DistributedDataObject | setSessionId(sessionId?: string): boolean | Sets a session ID for a distributed data object.
**sessionId**: session ID of a distributed data object in a trusted network. To remove a distributed data object from the network, set this parameter to "" or leave it empty. | +| DistributedDataObject | setSessionId(sessionId?: string): boolean | Sets a session ID for this distributed data object.
**sessionId**: ID of the distributed data object on a trusted network. To remove a distributed data object from the network, set this parameter to "" or leave it empty.| ### Observing Data Changes @@ -54,6 +57,7 @@ Call **on()** to subscribe to data changes of a distributed data object. When th Call **on()** to subscribe to status changes of a distributed data object. The status can be online or offline. When the status changes, a callback will be invoked to return the status. You can use **off()** to unsubscribe from the status changes. **Table 5** APIs for observing status changes of a distributed data object + | Class| API| Description| | -------- | -------- | -------- | | DistributedDataObject| on(type: 'status', callback: Callback<{ sessionId: string, networkId: string, status: 'online' \| 'offline' }>): void | Subscribes to the status changes of a distributed data object.| @@ -87,89 +91,105 @@ The following example shows how to implement distributed data object synchroniza ```js import distributedObject from '@ohos.data.distributedDataObject'; ``` - 2. Apply for the permission. - Add the permissions required (FA model) to the **config.json** file. The sample code is as follows: + Add the required permission (FA model) to the **config.json** file. - ```json - { + ```json + { "module": { "reqPermissions": [ { - "name": "ohos.permission.DISTRIBUTED_DATASYNC" + "name": "ohos.permission.DISTRIBUTED_DATASYNC" } ] } - } - ``` + } + ``` For the apps based on the stage model, see [Declaring Permissions](../security/accesstoken-guidelines.md#stage-model). - This permission must also be granted by the user when the application is started for the first time. The sample code is as follows: + This permission must also be granted by the user when the application is started for the first time. - ```js - 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}`) - - }) - console.info('end grantPermission'); - } - - grantPermission(); - ``` + ```js + // FA model + 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(`requestPermissionsFromUser CallBack`); + + }) + console.info('end grantPermission'); + } + + grantPermission(); + ``` + + ```ts + // Stage model + import UIAbility from '@ohos.app.ability.UIAbility'; + + let context = null; + + class EntryAbility extends UIAbility { + onWindowStageCreate(windowStage) { + context = this.context; + } + } + + function grantPermission() { + let permissions = ['ohos.permission.DISTRIBUTED_DATASYNC']; + context.requestPermissionsFromUser(permissions).then((data) => { + console.info('success: ${data}'); + }).catch((error) => { + console.error('failed: ${error}'); + }); + } + + grantPermission(); + ``` 3. Obtain a distributed data object instance. - The sample code is as follows: - ```js - var local_object = distributedObject.createDistributedObject({ - name: undefined, - age: undefined, - isVis: true, - parent: undefined, - list: undefined + let localObject = distributedObject.createDistributedObject({ + name: undefined, + age: undefined, + isVis: true, + parent: undefined, + list: undefined }); - var sessionId = distributedObject.genSessionId(); + let sessionId = distributedObject.genSessionId(); ``` 4. Add the distributed data object instance to a network for data synchronization. The data objects in the synchronization network include the local and remote objects. - - The sample code is as follows: ```js // Local object - var local_object = distributedObject.createDistributedObject({ - name: "jack", - age: 18, - isVis: true, - parent: { mother: "jack mom", father: "jack Dad" }, - list: [{ mother: "jack mom" }, { father: "jack Dad" }] + let localObject = distributedObject.createDistributedObject({ + name: "jack", + age: 18, + isVis: true, + parent: { mother: "jack mom", father: "jack Dad" }, + list: [{ mother: "jack mom" }, { father: "jack Dad" }] }); - local_object.setSessionId(sessionId); + localObject.setSessionId(sessionId); // Remote object - var remote_object = distributedObject.createDistributedObject({ - name: undefined, - age: undefined, - isVis: true, - parent: undefined, - list: undefined + let remoteObject = distributedObject.createDistributedObject({ + name: undefined, + age: undefined, + isVis: true, + parent: undefined, + list: undefined }); // After learning that the local device goes online, the remote object synchronizes data. That is, name changes to jack and age to 18. - remote_object.setSessionId(sessionId); + remoteObject.setSessionId(sessionId); ``` - -5. Observe the data changes of the distributed data object. - You can subscribe to data changes of the remote object. When the data in the remote object changes, a callback will be called to return the data changes. - - The sample code is as follows: +5. Observe the data changes of the distributed data object. You can subscribe to data changes of the remote object. When the data in the remote object changes, a callback will be invoked to return the data changes. ```js function changeCallback(sessionId, changeData) { @@ -177,109 +197,86 @@ The following example shows how to implement distributed data object synchroniza if (changeData != null && changeData != undefined) { changeData.forEach(element => { - console.info("changed !" + element + " " + local_object[element]); - }); - } + console.info("changed !" + element + " " + localObject[element]); + }); + } } // To refresh the page in changeCallback, correctly bind (this) to the changeCallback. - local_object.on("change", this.changeCallback.bind(this)); + localObject.on("change", this.changeCallback.bind(this)); ``` -6. Modify attributes of the distributed data object. - - The object attributes support basic data types (such as number, Boolean, and string) and complex data types (array and nested basic types). - - The sample code is as follows: +6. Modify attributes of the distributed data object. The object attributes support basic data types (such as number, Boolean, and string) and complex data types (array and nested basic types). ```js - local_object.name = "jack"; - local_object.age = 19; - local_object.isVis = false; - local_object.parent = { mother: "jack mom", father: "jack Dad" }; - local_object.list = [{ mother: "jack mom" }, { father: "jack Dad" }]; + localObject.name = "jack"; + localObject.age = 19; + localObject.isVis = false; + localObject.parent = { mother: "jack mom", father: "jack Dad" }; + localObject.list = [{ mother: "jack mom" }, { father: "jack Dad" }]; ``` > **NOTE**
- > For the distributed data object of the complex type, only the root attribute can be modified. The subordinate attributes cannot be modified. Example: + > For the distributed data object of the complex type, only the root attribute can be modified. The subordinate attributes cannot be modified. ```js // Supported modification. - local_object.parent = { mother: "mom", father: "dad" }; + localObject.parent = { mother: "mom", father: "dad" }; // Modification not supported. - local_object.parent.mother = "mom"; + localObject.parent.mother = "mom"; ``` -7. Access the distributed data object. - - Obtain the distributed data object attributes, which are the latest data on the network. - - The sample code is as follows: +7. Access the distributed data object.
Obtain the distributed data object attributes, which are the latest data on the network. ```js - console.info("name " + local_object["name"]); + console.info("name " + localObject["name"]); ``` - -8. Unsubscribe from data changes. - - You can specify the callback to unregister. If you do not specify the callback, all data change callbacks of the distributed data object will be unregistered. - - The sample code is as follows: +8. Unsubscribe from data changes. You can specify the callback to unregister. If you do not specify the callback, all data change callbacks of the distributed data object will be unregistered. ```js // Unregister the specified data change callback. - local_object.off("change", changeCallback); + localObject.off("change", changeCallback); // Unregister all data change callbacks. - local_object.off("change"); + localObject.off("change"); ``` - -9. Subscribe to the status (online/offline) changes of the distributed data object. A callback will be invoked to report the status change when the target distributed data object goes online or offline. - The sample code is as follows: +9. Subscribe to status changes of this distributed data object. A callback will be invoked to report the status change when the target distributed data object goes online or offline. ```js - function statusCallback(sessionId, networkId, status) { - this.response += "status changed " + sessionId + " " + status + " " + networkId; - } + function statusCallback(sessionId, networkId, status) { + this.response += "status changed " + sessionId + " " + status + " " + networkId; + } - local_object.on("status", this.statusCallback); + localObject.on("status", this.statusCallback); ``` 10. Save a distributed data object and delete it. ```js // Save a distributed data object. - g_object.save("local").then((result) => { - console.info("save sessionId " + result.sessionId); - console.info("save version " + result.version); - console.info("save deviceId " + result.deviceId); + localObject.save("local").then((result) => { + console.info("save sessionId " + result.sessionId); + console.info("save version " + result.version); + console.info("save deviceId " + result.deviceId); }, (result) => { - console.info("save local failed."); + console.info("save local failed."); }); - // Delete a distributed data object.. - g_object.revokeSave().then((result) => { - console.info("revokeSave success."); + // Revoke the data saving operation. + localObject.revokeSave().then((result) => { + console.info("revokeSave success."); }, (result) => { - console.info("revokeSave failed."); + console.info("revokeSave failed."); }); ``` - -11. Unsubscribe from the status changes of the distributed data object. - - You can specify the callback to unregister. If you do not specify the callback, all status change callbacks of this distributed data object will be unregistered. - - The sample code is as follows: +11. Unsubscribe from the status changes of this distributed data object. You can specify the callback to unregister. If you do not specify the callback, this API unregisters all status change callbacks of this distributed data object. ```js // Unregister the specified status change callback. - local_object.off("status", this.statusCallback); + localObject.off("status", this.statusCallback); // Unregister all status change callbacks. - local_object.off("status"); + localObject.off("status"); ``` - -12. Remove a distributed data object from the synchronization network. Data changes on the local object will not be synchronized to the removed distributed data object. - - The sample code is as follows: +12. Remove the distributed data object from the synchronization network. The data changes on the local object will not be synchronized to the removed distributed data object. ```js - local_object.setSessionId(""); + localObject.setSessionId(""); ``` diff --git a/en/application-dev/database/database-preference-guidelines.md b/en/application-dev/database/database-preference-guidelines.md index c440e385232bf3f3bb8c4aa3a7e254a5e6fc0d90..724e273675061c4b6969fb3fcd6f6cbdd984a15f 100644 --- a/en/application-dev/database/database-preference-guidelines.md +++ b/en/application-dev/database/database-preference-guidelines.md @@ -24,7 +24,7 @@ Obtain a **Preferences** instance for data operations. A **Preferences** instanc **Table 1** API for obtaining a **Preferences** instance -| Package | API | Description | +| Bundle Name | API | Description | | --------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | | ohos.data.preferences | getPreferences(context: Context, name: string): Promise\ | Obtains a **Preferences** instance.| @@ -75,7 +75,7 @@ You can use the following APIs to delete a **Preferences** instance or data file **Table 6** APIs for deleting **Preferences** -| Package | API | Description | +| Bundle Name | API | Description | | --------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | | ohos.data.preferences | deletePreferences(context: Context, name: string): Promise\ | Deletes a **Preferences** instance from the memory and its files from the device.| | ohos.data.preferences | removePreferencesFromCache(context: Context, name: string): Promise\ | Removes a **Preferences** instance from the memory to release memory. | @@ -113,22 +113,20 @@ You can use the following APIs to delete a **Preferences** instance or data file ```ts // Obtain the context. - import UIAbility from '@ohos.app.ability.UIAbility' - let context = null; + import UIAbility from '@ohos.app.ability.UIAbility'; let preferences = null; export default class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage){ - context = this.context; + onWindowStageCreate(windowStage) { + let promise = data_preferences.getPreferences(this.context, 'mystore'); + promise.then((pref) => { + preferences = pref; + }).catch((err) => { + console.info("Failed to get the preferences."); + }) } } - let promise = data_preferences.getPreferences(context, 'mystore'); - promise.then((pref) => { - preferences = pref; - }).catch((err) => { - console.info("Failed to get the preferences."); - }) ``` 3. Write data. @@ -200,6 +198,6 @@ You can use the following APIs to delete a **Preferences** instance or data file proDelete.then(() => { console.info("Deleted data successfully."); }).catch((err) => { - console.info("Failed to delete data. Cause: " + err); + console.info("Failed to delete data. Cause: " + err); }) ``` diff --git a/en/application-dev/device-usage-statistics/device-usage-statistics-overview.md b/en/application-dev/device-usage-statistics/device-usage-statistics-overview.md index 69fca5fb8177eddc65ddfc0ffade70350446a8a1..d8d93e847c73e5c6eb1e96604a17bd456b010162 100644 --- a/en/application-dev/device-usage-statistics/device-usage-statistics-overview.md +++ b/en/application-dev/device-usage-statistics/device-usage-statistics-overview.md @@ -36,5 +36,5 @@ Currently you can have access to statistics on the application usage, and the no Deregister the callback for application group changes. ## Required Permissions -- Before calling the following system APIs, you need to apply for the **ohos.permission.BUNDLE_ACTIVE_INFO** permission: **queryBundleActiveStates**, **queryBundleStateInfos**, **queryBundleStateInfoByInterval**, **queryBundleActiveEventStates**, **queryAppNotificationNumber**, **queryAppUsagePriorityGroup(bundleName?)**, **setBundleGroup**, **registerGroupCallBack**, and **unRegisterGroupCallBack**. -- This permission is not required for calling third-party APIs: **queryCurrentBundleActiveStates**, **queryAppUsagePriorityGroup()**, and **isIdleState**. +- Before calling the following system APIs, you must request the **ohos.permission.BUNDLE_ACTIVE_INFO** permission: **isIdleState**, **queryBundleEvents**, **queryBundleStatsInfos**, **queryBundleStatsInfoByInterval**, **queryDeviceEventStats**, **queryNotificationEventStats**, **queryAppGroup(bundleName)**, **setAppGroup**, **registerAppGroupCallBack**, **unregisterAppGroupCallBack**, **queryModuleUsageRecords**, and **queryModuleUsageRecords(maxnum)**. +- You do not need to request this permission before calling **queryCurrentBundleEvents** and **queryAppGroup()**, which are third-party APIs. diff --git a/en/application-dev/device-usage-statistics/device-usage-statistics-use-guide.md b/en/application-dev/device-usage-statistics/device-usage-statistics-use-guide.md index 45255f18ee313ad96d072e42f620b219315a8adf..82027e91a9c15b1fd1b62a8c5ef4cddc2f9c0ef3 100644 --- a/en/application-dev/device-usage-statistics/device-usage-statistics-use-guide.md +++ b/en/application-dev/device-usage-statistics/device-usage-statistics-use-guide.md @@ -225,7 +225,7 @@ import usageStatistics from '@ohos.resourceschedule.usageStatistics'; } ``` -7. Check whether the application specified by **bundleName** is in the idle state. This requires no permission to be configured. A third-party application can only check the idle status of itself. +7. Check whether the application specified by **bundleName** is in the idle state. This requires the **ohos.permission.BUNDLE_ACTIVE_INFO** permission to be configured. ```js import usageStatistics from '@ohos.resourceschedule.usageStatistics' @@ -531,4 +531,4 @@ import usageStatistics from '@ohos.resourceschedule.usageStatistics'; } catch (error) { console.log('BUNDLE_ACTIVE unregisterAppGroupCallBack throw error, code is: ' + error.code + ',message is: ' + error.message); } - ``` \ No newline at end of file + ``` diff --git a/en/application-dev/device/Readme-EN.md b/en/application-dev/device/Readme-EN.md index 6e7fd27fd4506a487faeac457371c7c015a6b771..e3b30cb70e0cfb49e53391f497ae24727e959bee 100644 --- a/en/application-dev/device/Readme-EN.md +++ b/en/application-dev/device/Readme-EN.md @@ -1,4 +1,4 @@ -# Device +# Device Management - USB Service - [USB Service Overview](usb-overview.md) @@ -17,3 +17,5 @@ - Update Service - [Sample Server Overview](sample-server-overview.md) - [Sample Server Development](sample-server-guidelines.md) +- Stationary + - [stationary Development](stationary-guidelines.md) diff --git a/en/application-dev/device/stationary-guidelines.md b/en/application-dev/device/stationary-guidelines.md new file mode 100644 index 0000000000000000000000000000000000000000..9f6693027a29f48c2c434b842df74beb5209f319 --- /dev/null +++ b/en/application-dev/device/stationary-guidelines.md @@ -0,0 +1,84 @@ +# Stationary Development + + +## When to Use + +An application can call the **Stationary** module to obtain the device status, for example, whether the device is absolutely or relatively still. + +For details about the APIs, see [Stationary](../reference/apis/js-apis-stationary.md). + +## Device Status Type Parameters + +| Name| Description| +| -------- | -------- | +| still | Absolutely still.| +| relativeStill | Relatively still.| + +## Parameters for Subscribing to Device Status events + +| Name | Value | Description | +| ------------------------------ | ---- | ---------------------------------------- | +| ENTER | 1 | Event indicating entering device status. | +| EXIT | 2 | Event indicating exiting device status.| +| ENTER_EXIT | 3 | Event indicating entering and exiting device status.| + +## Returned Device Status Parameters + +| Name | Value | Description | +| ------------------------------ | ---- | ---------------------------------------- | +| ENTER | 1 | Entering device status. | +| EXIT | 2 | Exiting device status.| + +## Available APIs + +| Module | Name | Description | +| ------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | +| ohos.stationary | on(activity: ActivityType, event: ActivityEvent, reportLatencyNs: number, callback: Callback<ActivityResponse>): void | Subscribes to the device status. This API uses an asynchronous callback to return the result.| +| ohos.stationary | once(activity: ActivityType, callback: Callback<ActivityResponse>): void | Obtains the device status. This API uses an asynchronous callback to return the result.| +| ohos.stationary | off(activity: ActivityType, event: ActivityEvent, callback?: Callback<ActivityResponse>): void | Unsubscribes from the device status. | + +## Constraints + +The device must support the acceleration sensor. + +## How to Develop + +1. Subscribe to the event indicating entering the absolute still state, and the event is reported every 1 second. + + ```js + import stationary from '@ohos.stationary'; + var reportLatencyNs = 1000000000; + try { + stationary.on('still', stationary.ActivityEvent.ENTER, reportLatencyNs, (data) => { + console.log('data='+ JSON.stringify(data)); + }) + } catch (err) { + console.error('errCode: ' + err.code + ' ,msg: ' + err.message); + } + ``` + +2. Obtain the event indicating entering the absolute still state. + + ```js + import stationary from '@ohos.stationary'; + try { + stationary.once('still', (data) => { + console.log('data='+ JSON.stringify(data)); + }) + } catch (err) { + console.error('errCode: ' + err.code + ' ,msg: ' + err.message); + } + ``` + +3. Unsubscribe from the event indicating entering the absolute still state. + + ```js + import stationary from '@ohos.stationary'; + try { + stationary.off('still', stationary.ActivityEvent.ENTER, (data) => { + console.log('data='+ JSON.stringify(data)); + }) + } catch (err) { + console.error('errCode: ' + err.code + ' ,msg: ' + err.message); + } + ``` diff --git a/en/application-dev/dfx/Readme-EN.md b/en/application-dev/dfx/Readme-EN.md index f46c27be2587586dfeb65552a0afe340b5a6187b..b8a4496e09420b3a7557e5c8b8996deaf14ce1c9 100644 --- a/en/application-dev/dfx/Readme-EN.md +++ b/en/application-dev/dfx/Readme-EN.md @@ -1,11 +1,8 @@ # DFX -- Application Event Logging - - [Development of Application Event Logging](hiappevent-guidelines.md) -- Performance Tracing - - [Development of Performance Tracing](hitracemeter-guidelines.md) -- Distributed Call Chain Tracing - - [Development of Distributed Call Chain Tracing](hitracechain-guidelines.md) +- [Development of Application Event Logging](hiappevent-guidelines.md) +- [Development of Performance Tracing](hitracemeter-guidelines.md) +- [Development of Distributed Call Chain Tracing](hitracechain-guidelines.md) - Error Management - [Development of Error Manager](errormanager-guidelines.md) - - [Development of Application Recovery](apprecovery-guidelines.md) \ No newline at end of file + - [Development of Application Recovery](apprecovery-guidelines.md) diff --git a/en/application-dev/dfx/apprecovery-guidelines.md b/en/application-dev/dfx/apprecovery-guidelines.md index b2992e7c9958f0a1ffd87db9e4549bf0187bad78..bae804c558a57b61915760d37f46b73a03ebcf84 100644 --- a/en/application-dev/dfx/apprecovery-guidelines.md +++ b/en/application-dev/dfx/apprecovery-guidelines.md @@ -134,7 +134,7 @@ After the callback triggers **appRecovery.saveAppState()**, **onSaveState(state, - Restore data. -After the callback triggers **appRecovery.restartApp()**, the application is restarted. After the restart, **onSaveState(state, wantParams)** of **MainAbility** is called, and the saved data is in **parameters** of **want**. +After the callback triggers **appRecovery.restartApp()**, the application is restarted. After the restart, **onCreate(want, launchParam)** of **MainAbility** is called, and the saved data is in **parameters** of **want**. ```ts storage: LocalStorage diff --git a/en/application-dev/dfx/errormanager-guidelines.md b/en/application-dev/dfx/errormanager-guidelines.md index 631445b862097d5aa71320ff154d6e235660a95e..a43d7c1fcec9042c6d8cbeb1287cebdddd3915d1 100644 --- a/en/application-dev/dfx/errormanager-guidelines.md +++ b/en/application-dev/dfx/errormanager-guidelines.md @@ -37,10 +37,10 @@ When an asynchronous callback is used, the return value can be processed directl ## Development Example ```ts import Ability from '@ohos.application.Ability' -import errorManager from '@ohos.application.errorManager' +import errorManager from '@ohos.app.ability.errorManager'; -var registerId = -1; -var callback = { +let registerId = -1; +let callback = { onUnhandledException: function (errMsg) { console.log(errMsg); } @@ -48,13 +48,13 @@ var callback = { export default class MainAbility extends Ability { onCreate(want, launchParam) { console.log("[Demo] MainAbility onCreate") - registerId = errorManager.registerErrorObserver(callback); + registerId = errorManager.on("error", callback); globalThis.abilityWant = want; } onDestroy() { console.log("[Demo] MainAbility onDestroy") - errorManager.unregisterErrorObserver(registerId, (result) => { + errorManager.off("error", registerId, (result) => { console.log("[Demo] result " + result.code + ";" + result.message) }); } diff --git a/en/application-dev/file-management/filepicker-guidelines.md b/en/application-dev/file-management/filepicker-guidelines.md index 8fcf96b2219151a9c197cd1f6bc2e738775646b7..ec813e256d3f4c1b3fe302aaf1653866a837a36a 100644 --- a/en/application-dev/file-management/filepicker-guidelines.md +++ b/en/application-dev/file-management/filepicker-guidelines.md @@ -9,11 +9,10 @@ FilePicker provides the following modes: ## Development Guidelines > **NOTE** -> > FilePicker supports only the applications developed based on the stage model. > For details about the stage model, see [Interpretation of the Application Model](../application-models/application-model-description.md). -You can use [AbilityContext.startAbilityForResult(want, options)](../reference/apis/js-apis-ability-context.md##abilitycontextstartabilityforresult-1) with different parameters to start different FilePicker modes. +You can use [AbilityContext.startAbilityForResult(want, options)](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartabilityforresult-1) with different parameters to start FilePicker in different modes. You need to use [Want](../reference/apis/js-apis-application-want.md) to specify **bundleName** and **abilityName** to start FilePicker. For details, see the following sample code. @@ -32,8 +31,7 @@ ArkTS sample code: // Start FilePicker to select a file. globalThis.context.startAbilityForResult( { - bundleName: "com.ohos.filepicker", - abilityName: "EntryAbility", + action: "ohos.want.action.OPEN_FILE", parameters: { 'startMode': 'choose', //choose or save } @@ -44,8 +42,7 @@ globalThis.context.startAbilityForResult( // Start FilePicker to save a file. globalThis.context.startAbilityForResult( { - bundleName: "com.ohos.filepicker", - abilityName: "EntryAbility", + action: "ohos.want.action.CREATE_FILE", parameters: { 'startMode': 'save', //choose or save 'saveFile': 'test.jpg', diff --git a/en/application-dev/file-management/medialibrary-album-guidelines.md b/en/application-dev/file-management/medialibrary-album-guidelines.md index f03e11cf3cbc0e94737d3a66214f72dfb0a47ba3..0fa043bad49b51aff526198137550f5079bd4349 100644 --- a/en/application-dev/file-management/medialibrary-album-guidelines.md +++ b/en/application-dev/file-management/medialibrary-album-guidelines.md @@ -39,19 +39,19 @@ The following describes how to create an album named **myAlbum**. ```ts async function example() { - let mediaType = mediaLibrary.MediaType.IMAGE; - let DIR_IMAGE = mediaLibrary.DirectoryType.DIR_IMAGE; - const context = getContext(this); - let media = mediaLibrary.getMediaLibrary(context); - const path = await media.getPublicDirectory(DIR_IMAGE); - // myAlbum is the path for storing the new file and the name of the new album. - media.createAsset(mediaType, 'test.jpg', path + 'myAlbum/', (err, fileAsset) => { - if (fileAsset != undefined) { - console.info('createAlbum successfully, message = ' + fileAsset); - } else { - console.info('createAlbum failed, message = ' + err); - } - }); + let mediaType = mediaLibrary.MediaType.IMAGE; + let DIR_IMAGE = mediaLibrary.DirectoryType.DIR_IMAGE; + const context = getContext(this); + let media = mediaLibrary.getMediaLibrary(context); + const path = await media.getPublicDirectory(DIR_IMAGE); + // myAlbum is the path for storing the new file and the name of the new album. + media.createAsset(mediaType, 'test.jpg', path + 'myAlbum/', (err, fileAsset) => { + if (fileAsset === undefined) { + console.error('createAlbum failed, message = ' + err); + } else { + console.info('createAlbum successfully, message = ' + JSON.stringify(fileAsset)); + } + }); } ``` @@ -75,20 +75,20 @@ The following describes how to rename the album **newAlbum**. ```ts async function example() { - let AlbumNoArgsfetchOp = { - selections: '', - selectionArgs: [], - }; - const context = getContext(this); - let media = mediaLibrary.getMediaLibrary(context); - let albumList = await media.getAlbums(AlbumNoArgsfetchOp); - let album = albumList[0]; - album.albumName = 'newAlbum'; - // Void callback. - album.commitModify().then(function() { - console.info("albumRename successfully"); - }).catch(function(err){ - console.info("albumRename failed with error: " + err); - }); + let AlbumNoArgsfetchOp = { + selections: '', + selectionArgs: [], + }; + const context = getContext(this); + let media = mediaLibrary.getMediaLibrary(context); + let albumList = await media.getAlbums(AlbumNoArgsfetchOp); + let album = albumList[0]; + album.albumName = 'newAlbum'; + // Void callback. + album.commitModify().then(() => { + console.info("albumRename successfully"); + }).catch((err) => { + console.error("albumRename failed with error: " + err); + }); } ``` diff --git a/en/application-dev/file-management/medialibrary-filepath-guidelines.md b/en/application-dev/file-management/medialibrary-filepath-guidelines.md index 7e4a1cdaff6cbd76995b295d5f4606f54c35913e..4c7e2ecd4db6723a66930e624bd4b36b556330d1 100644 --- a/en/application-dev/file-management/medialibrary-filepath-guidelines.md +++ b/en/application-dev/file-management/medialibrary-filepath-guidelines.md @@ -37,15 +37,15 @@ The following describes how to obtain the public directory that stores camera fi ```ts async function example(){ - const context = getContext(this); - let media = mediaLibrary.getMediaLibrary(context); - let DIR_CAMERA = mediaLibrary.DirectoryType.DIR_CAMERA; - const dicResult = await media.getPublicDirectory(DIR_CAMERA); - if (dicResult == 'Camera/') { - console.info('mediaLibraryTest : getPublicDirectory passed'); - } else { - console.info('mediaLibraryTest : getPublicDirectory failed'); - } + const context = getContext(this); + let media = mediaLibrary.getMediaLibrary(context); + let DIR_CAMERA = mediaLibrary.DirectoryType.DIR_CAMERA; + const dicResult = await media.getPublicDirectory(DIR_CAMERA); + if (dicResult == 'Camera/') { + console.info('mediaLibraryTest : getPublicDirectory passed'); + } else { + console.error('mediaLibraryTest : getPublicDirectory failed'); + } } ``` @@ -59,47 +59,52 @@ Users can access files stored in the public directories through the system appli You can call [mediaLibrary.FileAsset.open](../reference/apis/js-apis-medialibrary.md#open8-1) to open a file in a public directory. -You can call [fileio.open](../reference/apis/js-apis-fileio.md#fileioopen7) to open a file in the application sandbox. The sandbox directory can be accessed only through the application context. +You can call [fs.open](../reference/apis/js-apis-file-fs.md#fsopen) to open a file in the application sandbox. The sandbox directory can be accessed only through the application context. **Prerequisites** - You have obtained a **MediaLibrary** instance. -- You have granted the permission **ohos.permission.WRITE_MEDIA**. -- You have imported the module [@ohos.fileio](../reference/apis/js-apis-fileio.md) in addition to @ohos.multimedia.mediaLibrary. +- You have granted the permissions **ohos.permission.READ_MEDIA** and **ohos.permission.WRITE_MEDIA**. +- You have imported the module [@ohos.file.fs](../reference/apis/js-apis-file-fs.md) in addition to @ohos.multimedia.mediaLibrary. +- The **testFile.txt** file has been created and contains content. **How to Develop** -1. Call [context.filesDir](../reference/apis/js-apis-inner-app-context.md#contextgetfilesdir) to obtain the directory of the application sandbox. +1. Call [context.filesDir](../reference/apis/js-apis-file-fs.md) to obtain the directory of the application sandbox. 2. Call **MediaLibrary.getFileAssets** and **FetchFileResult.getFirstObject** to obtain the first file in the result set of the public directory. -3. Call **fileio.open** to open the file in the sandbox. +3. Call **fs.open** to open the file in the sandbox. 4. Call **fileAsset.open** to open the file in the public directory. -5. Call **fileio.copyfile** to copy the file. -6. Call **fileAsset.close** and **fileio.close** to close the file. +5. Call [fs.copyfile](../reference/apis/js-apis-file-fs.md#fscopyfile) to copy the file. +6. Call **fileAsset.close** and [fs.close](../reference/apis/js-apis-file-fs.md#fsclose) to close the file. **Example 1: Copying Files from the Public Directory to the Sandbox** ```ts async function copyPublic2Sandbox() { + try { const context = getContext(this); let media = mediaLibrary.getMediaLibrary(context); - let sandboxDirPath = globalThis.context.filesDir; + let sandboxDirPath = context.filesDir; let fileKeyObj = mediaLibrary.FileKey; let fileAssetFetchOp = { - selections: fileKeyObj.DISPLAY_NAME + '= ?', - selectionArgs: ['testFile.txt'], + selections: fileKeyObj.DISPLAY_NAME + '= ?', + selectionArgs: ['testFile.txt'], }; let fetchResult = await media.getFileAssets(fileAssetFetchOp); let fileAsset = await fetchResult.getFirstObject(); let fdPub = await fileAsset.open('rw'); - let fdSand = await fileio.open(sandboxDirPath + '/testFile.txt', 0o2 | 0o100, 0o666); - await fileio.copyFile(fdPub, fdSand); + let fdSand = await fs.open(sandboxDirPath + '/testFile.txt', fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); + await fs.copyFile(fdPub, fdSand.fd); await fileAsset.close(fdPub); - await fileio.close(fdSand); + await fs.close(fdSand.fd); - let content_sand = await fileio.readText(sandboxDirPath + '/testFile.txt'); - console.log('content read from sandbox file: ', content_sand) + let content_sand = await fs.readText(sandboxDirPath + '/testFile.txt'); + console.info('content read from sandbox file: ', content_sand) + } catch (err) { + console.info('[demo] copyPublic2Sandbox fail, err: ', err); + } } ``` @@ -107,81 +112,81 @@ async function copyPublic2Sandbox() { ```ts async function copySandbox2Public() { - const context = getContext(this); - let media = mediaLibrary.getMediaLibrary(context); - let sandboxDirPath = globalThis.context.filesDir; - - let DIR_DOCUMENTS = mediaLibrary.DirectoryType.DIR_DOCUMENTS; - const publicDirPath = await media.getPublicDirectory(DIR_DOCUMENTS); - try { - let fileAsset = await media.createAsset(mediaLibrary.MediaType.FILE, 'testFile02.txt', publicDirPath); - console.info('createFile successfully, message = ' + fileAsset); - } catch (err) { - console.info('createFile failed, message = ' + err); - } - try { - let fileKeyObj = mediaLibrary.FileKey; - let fileAssetFetchOp = { - selections: fileKeyObj.DISPLAY_NAME + '= ?', - selectionArgs: ['testFile02.txt'], - }; - let fetchResult = await media.getFileAssets(fileAssetFetchOp); - var fileAsset = await fetchResult.getFirstObject(); - } catch (err) { - console.info('file asset get failed, message = ' + err); - } - let fdPub = await fileAsset.open('rw'); - let fdSand = await fileio.open(sandboxDirPath + 'testFile.txt', 0o2); - await fileio.copyFile(fdSand, fdPub); - await fileio.close(fdPub); - await fileio.close(fdSand); - let fdPubRead = await fileAsset.open('rw'); - try { - let arrayBuffer = new ArrayBuffer(4096); - await fileio.read(fdPubRead, arrayBuffer); - var content_pub = String.fromCharCode(...new Uint8Array(arrayBuffer)); - fileAsset.close(fdPubRead); - } catch (err) { - console.log('read text failed, message = ', err); - } - console.log('content read from public file: ', content_pub); + const context = getContext(this); + let media = mediaLibrary.getMediaLibrary(context); + let sandboxDirPath = context.filesDir; + + let DIR_DOCUMENTS = mediaLibrary.DirectoryType.DIR_DOCUMENTS; + const publicDirPath = await media.getPublicDirectory(DIR_DOCUMENTS); + try { + let fileAsset = await media.createAsset(mediaLibrary.MediaType.FILE, 'testFile02.txt', publicDirPath); + console.info('createFile successfully, message = ' + fileAsset); + } catch (err) { + console.error('createFile failed, message = ' + err); + } + try { + let fileKeyObj = mediaLibrary.FileKey; + let fileAssetFetchOp = { + selections: fileKeyObj.DISPLAY_NAME + '= ?', + selectionArgs: ['testFile02.txt'], + }; + let fetchResult = await media.getFileAssets(fileAssetFetchOp); + var fileAsset = await fetchResult.getFirstObject(); + } catch (err) { + console.error('file asset get failed, message = ' + err); + } + let fdPub = await fileAsset.open('rw'); + let fdSand = await fs.open(sandboxDirPath + 'testFile.txt', OpenMode.READ_WRITE); + await fs.copyFile(fdSand.fd, fdPub); + await fileAsset.close(fdPub); + await fs.close(fdSand.fd); + let fdPubRead = await fileAsset.open('rw'); + try { + let arrayBuffer = new ArrayBuffer(4096); + await fs.read(fdPubRead, arrayBuffer); + var content_pub = String.fromCharCode(...new Uint8Array(arrayBuffer)); + fileAsset.close(fdPubRead); + } catch (err) { + console.error('read text failed, message = ', err); + } + console.info('content read from public file: ', content_pub); } ``` ### Reading and Writing a File -You can use **FileAsset.open** and **FileAsset.close** of [mediaLibrary](../reference/apis/js-apis-medialibrary.md) to open and close a file, and use **fileio.read** and **fileio.write** of [fileio](../reference/apis/js-apis-fileio.md) to read and write a file. +You can use **FileAsset.open** and **FileAsset.close** of [mediaLibrary](../reference/apis/js-apis-medialibrary.md) to open and close a file, and use **fs.read** and **fs.write** in [file.fs](../reference/apis/js-apis-file-fs.md) to read and write the file. **Prerequisites** - You have obtained a **MediaLibrary** instance. -- You have granted the permission **ohos.permission.WRITE_MEDIA**. -- You have imported the module [@ohos.fileio](../reference/apis/js-apis-fileio.md) in addition to @ohos.multimedia.mediaLibrary. +- You have granted the permissions **ohos.permission.READ_MEDIA** and **ohos.permission.WRITE_MEDIA**. +- You have imported the module [@ohos.file.fs](../reference/apis/js-apis-file-fs.md) in addition to @ohos.multimedia.mediaLibrary. **How to Develop** 1. Create a file. - ```ts - async function example() { - let mediaType = mediaLibrary.MediaType.FILE; - let DIR_DOCUMENTS = mediaLibrary.DirectoryType.DIR_DOCUMENTS; - const context = getContext(this); - let media = mediaLibrary.getMediaLibrary(context); - const path = await media.getPublicDirectory(DIR_DOCUMENTS); - media.createAsset(mediaType, "testFile.text", path).then (function (asset) { - console.info("createAsset successfully:" + JSON.stringify(asset)); - }).catch(function(err){ - console.info("createAsset failed with error: " + err); - }); - } - ``` +```ts +async function example() { + let mediaType = mediaLibrary.MediaType.FILE; + let DIR_DOCUMENTS = mediaLibrary.DirectoryType.DIR_DOCUMENTS; + const context = getContext(this); + let media = mediaLibrary.getMediaLibrary(context); + const path = await media.getPublicDirectory(DIR_DOCUMENTS); + media.createAsset(mediaType, "testFile.text", path).then((asset) => { + console.info("createAsset successfully:" + JSON.stringify(asset)); + }).catch((err) => { + console.error("createAsset failed with error: " + err); + }); +} +``` 2. Call **FileAsset.open** to open the file. -3. Call **fileio.write** to write a string to the file. +3. Call [fs.write](../reference/apis/js-apis-file-fs.md#fswrite) to write a string to the file. -4. Call **fileio.read** to read the file and save the data read in an array buffer. +4. Call [fs.read](../reference/apis/js-apis-file-fs.md#fsread) to read the file and save the data read in an array buffer. 5. Convert the array buffer to a string. @@ -191,25 +196,25 @@ You can use **FileAsset.open** and **FileAsset.close** of [mediaLibrary](../refe ```ts async function writeOnlyPromise() { - const context = getContext(this); - let media = mediaLibrary.getMediaLibrary(context); - let fileKeyObj = mediaLibrary.FileKey; - let fileAssetFetchOp = { - selections: fileKeyObj.DISPLAY_NAME + '= ?', - selectionArgs: ['testFile.txt'], - }; - let fetchResult = await media.getFileAssets(fileAssetFetchOp); - let fileAsset = await fetchResult.getFirstObject(); - console.info('fileAssetName: ', fileAsset.displayName); - - try { - let fd = await fileAsset.open('w'); - console.info('file descriptor: ', fd); - await fileio.write(fd, "Write file test content."); - await fileAsset.close(fd); - } catch (err) { - console.info('write file failed, message = ', err); - } + const context = getContext(this); + let media = mediaLibrary.getMediaLibrary(context); + let fileKeyObj = mediaLibrary.FileKey; + let fileAssetFetchOp = { + selections: fileKeyObj.DISPLAY_NAME + '= ?', + selectionArgs: ['testFile.txt'], + }; + let fetchResult = await media.getFileAssets(fileAssetFetchOp); + let fileAsset = await fetchResult.getFirstObject(); + console.info('fileAssetName: ', fileAsset.displayName); + + try { + let fd = await fileAsset.open('w'); + console.info('file descriptor: ', fd); + await fs.write(fd, "Write file test content."); + await fileAsset.close(fd); + } catch (err) { + console.error('write file failed, message = ', err); + } } ``` @@ -217,28 +222,28 @@ async function writeOnlyPromise() { ```ts async function readOnlyPromise() { - const context = getContext(this); - let media = mediaLibrary.getMediaLibrary(context); - let fileKeyObj = mediaLibrary.FileKey; - let fileAssetFetchOp = { - selections: fileKeyObj.DISPLAY_NAME + '= ?' , - selectionArgs: ['testFile.txt'], - }; - let fetchResult = await media.getFileAssets(fileAssetFetchOp); - let fileAsset = await fetchResult.getFirstObject(); - console.info('fileAssetName: ', fileAsset.displayName); - - try { - let fd = await fileAsset.open('r'); - let arrayBuffer = new ArrayBuffer(4096); - await fileio.read(fd, arrayBuffer); - let fileContent = String.fromCharCode(...new Uint8Array(arrayBuffer)); - globalThis.fileContent = fileContent; - globalThis.fileName = fileAsset.displayName; - console.info('file content: ', fileContent); - await fileAsset.close(fd); - } catch (err) { - console.info('read file failed, message = ', err); - } + const context = getContext(this); + let media = mediaLibrary.getMediaLibrary(context); + let fileKeyObj = mediaLibrary.FileKey; + let fileAssetFetchOp = { + selections: fileKeyObj.DISPLAY_NAME + '= ?' , + selectionArgs: ['testFile.txt'], + }; + let fetchResult = await media.getFileAssets(fileAssetFetchOp); + let fileAsset = await fetchResult.getFirstObject(); + console.info('fileAssetName: ', fileAsset.displayName); + + try { + let fd = await fileAsset.open('r'); + let arrayBuffer = new ArrayBuffer(4096); + await fs.read(fd, arrayBuffer); + let fileContent = String.fromCharCode(...new Uint8Array(arrayBuffer)); + globalThis.fileContent = fileContent; + globalThis.fileName = fileAsset.displayName; + console.info('file content: ', fileContent); + await fileAsset.close(fd); + } catch (err) { + console.error('read file failed, message = ', err); + } } ``` diff --git a/en/application-dev/file-management/medialibrary-overview.md b/en/application-dev/file-management/medialibrary-overview.md index b29472da8ca9558385bd0371dbdfa00012a45f32..f7e0ab9ac4772a7770b1e2bc9f6b63845cb654b5 100644 --- a/en/application-dev/file-management/medialibrary-overview.md +++ b/en/application-dev/file-management/medialibrary-overview.md @@ -64,64 +64,64 @@ After configuring the permissions in the **module.json5** file, the application 1. Declare the permissions in the **module.json5** file. Add the **requestPermissions** tag under **module** in the file, and set the tag based on the project requirements. For details about the tag, see [Guide for Requesting Permissions from User](../security/accesstoken-guidelines.md). - ```json - { - "module": { - "requestPermissions": [ - { - "name": "ohos.permission.MEDIA_LOCATION", - "reason": "$string:reason", - "usedScene": { - "abilities": [ - "MainAbility" - ], - "when": "always" - } - }, - { - "name": "ohos.permission.READ_MEDIA", - "reason": "$string:reason", - "usedScene": { - "abilities": [ - "MainAbility" - ], - "when": "always" - } - }, - { - "name": "ohos.permission.WRITE_MEDIA", - "reason": "$string:reason", - "usedScene": { - "abilities": [ - "MainAbility" - ], - "when": "always" - } - } - ] - } - } - ``` +```json +{ + "module": { + "requestPermissions": [ + { + "name": "ohos.permission.MEDIA_LOCATION", + "reason": "$string:reason", + "usedScene": { + "abilities": [ + "EntryAbility" + ], + "when": "always" + } + }, + { + "name": "ohos.permission.READ_MEDIA", + "reason": "$string:reason", + "usedScene": { + "abilities": [ + "EntryAbility" + ], + "when": "always" + } + }, + { + "name": "ohos.permission.WRITE_MEDIA", + "reason": "$string:reason", + "usedScene": { + "abilities": [ + "EntryAbility" + ], + "when": "always" + } + } + ] + } +} +``` 2. In the **Ability.ts** file, call **requestPermissionsFromUser** in the **onWindowStageCreate** callback to check for the required permissions and if they are not granted, request the permissions from the user by displaying a dialog box. - ```ts - import UIAbility from '@ohos.app.ability.UIAbility'; - import abilityAccessCtrl, {Permissions} from '@ohos.abilityAccessCtrl'; - - export default class MainAbility extends Ability { - onWindowStageCreate(windowStage) { - let list : Array = ['ohos.permission.READ_MEDIA', 'ohos.permission.WRITE_MEDIA']; - let permissionRequestResult; - let atManager = abilityAccessCtrl.createAtManager(); - atManager.requestPermissionsFromUser(this.context, list, (err, result) => { - if (err) { - console.log('requestPermissionsFromUserError: ' + JSON.stringify(err)); - } else { - permissionRequestResult=result; - console.log('permissionRequestResult: ' + JSON.stringify(permissionRequestResult)); - } - }); - } - } - ``` +```ts +import UIAbility from '@ohos.app.ability.UIAbility'; +import abilityAccessCtrl, {Permissions} from '@ohos.abilityAccessCtrl'; + +export default class EntryAbility extends UIAbility { + onWindowStageCreate(windowStage) { + let list : Array = ['ohos.permission.READ_MEDIA', 'ohos.permission.WRITE_MEDIA']; + let permissionRequestResult; + let atManager = abilityAccessCtrl.createAtManager(); + atManager.requestPermissionsFromUser(this.context, list, (err, result) => { + if (err) { + console.error('requestPermissionsFromUserError: ' + JSON.stringify(err)); + } else { + permissionRequestResult = result; + console.info('permissionRequestResult: ' + JSON.stringify(permissionRequestResult)); + } + }); + } +} +``` diff --git a/en/application-dev/file-management/medialibrary-resource-guidelines.md b/en/application-dev/file-management/medialibrary-resource-guidelines.md index dea130ff3de563a904684d021a7d8f7f9b514c83..7d120ec9a4fa9fd38ba92be97ee7fdd5a6f33816 100644 --- a/en/application-dev/file-management/medialibrary-resource-guidelines.md +++ b/en/application-dev/file-management/medialibrary-resource-guidelines.md @@ -33,30 +33,33 @@ To specify the image as the media type, set **selectionArgs** to **MediaType.IMA ```ts async function example() { - let fileKeyObj = mediaLibrary.FileKey; - let fileType = mediaLibrary.MediaType.IMAGE; - let option = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [fileType.toString()], - }; - const context = getContext(this); - let media = mediaLibrary.getMediaLibrary(context); - const fetchFileResult = await media.getFileAssets(option); - for (let i = 0; i < fetchFileResult.getCount(); i++) { - fetchFileResult.getNextObject((err, fileAsset) => { - if (err) { - console.error('Failed '); - return; - } - console.log('fileAsset.displayName ' + i + ': ' + fileAsset.displayName); - }) - } + let fileKeyObj = mediaLibrary.FileKey; + let fileType = mediaLibrary.MediaType.IMAGE; + let option = { + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [fileType.toString()], + }; + const context = getContext(this); + let media = mediaLibrary.getMediaLibrary(context); + const fetchFileResult = await media.getFileAssets(option); + fetchFileResult.getFirstObject().then((fileAsset) => { + console.log('getFirstObject.displayName : ' + fileAsset.displayName); + for (let i = 1; i < fetchFileResult.getCount(); i++) { + fetchFileResult.getNextObject().then((fileAsset) => { + console.info('fileAsset.displayName ' + i + ': ' + fileAsset.displayName); + }).catch((err) => { + console.error('Failed to get next object: ' + err); + }); + } + }).catch((err) => { + console.error('Failed to get first object: ' + err); + }); } ``` ### Querying Media Assets with the Specified Date -The following describes how to obtain media assets that are added on the specified date. You can also use the modification date and shooting date as the retrieval conditions. +The following describes how to obtain all the media assets that are added from the specified date. You can also use the modification date and shooting date as the retrieval conditions. To specify the date when the files are added as the retrieval condition, set **selections** to **FileKey.DATE_ADDED**. @@ -64,23 +67,26 @@ To specify the date 2022-8-5, set **selectionArgs** to **2022-8-5**. ```ts async function example() { - let fileKeyObj = mediaLibrary.FileKey; - let option = { - selections: fileKeyObj.DATE_ADDED + '= ?', - selectionArgs: ['2022-8-5'], - }; - const context = getContext(this); - let media = mediaLibrary.getMediaLibrary(context); - const fetchFileResult = await media.getFileAssets(option); - for (let i = 0; i < fetchFileResult.getCount(); i++) { - fetchFileResult.getNextObject((err, fileAsset) => { - if (err) { - console.error('Failed '); - return; - } - console.log('fileAsset.displayName ' + i + ': ' + fileAsset.displayName); - }) - } + let fileKeyObj = mediaLibrary.FileKey; + let option = { + selections: fileKeyObj.DATE_ADDED + '> ?', + selectionArgs: ['2022-8-5'], + }; + const context = getContext(this); + let media = mediaLibrary.getMediaLibrary(context); + const fetchFileResult = await media.getFileAssets(option); + fetchFileResult.getFirstObject().then((fileAsset) => { + console.info('getFirstObject.displayName : ' + fileAsset.displayName); + for (let i = 1; i < fetchFileResult.getCount(); i++) { + fetchFileResult.getNextObject().then((fileAsset) => { + console.info('fileAsset.displayName ' + i + ': ' + fileAsset.displayName); + }).catch((err) => { + console.error('Failed to get next object: ' + err); + }); + } + }).catch((err) => { + console.error('Failed to get first object: ' + err); + }); } ``` @@ -92,25 +98,28 @@ To sort files in descending order by the date when they are added, set **order** ```ts async function example() { - let fileKeyObj = mediaLibrary.FileKey; - let fileType = mediaLibrary.MediaType.IMAGE; - let option = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [fileType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - }; - const context = getContext(this); - let media = mediaLibrary.getMediaLibrary(context); - const fetchFileResult = await media.getFileAssets(option); - for (let i = 0; i < fetchFileResult.getCount(); i++) { - fetchFileResult.getNextObject((err, fileAsset) => { - if (err) { - console.error('Failed '); - return; - } - console.log('fileAsset.displayName ' + i + ': ' + fileAsset.displayName); - }) - } + let fileKeyObj = mediaLibrary.FileKey; + let fileType = mediaLibrary.MediaType.IMAGE; + let option = { + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [fileType.toString()], + order: fileKeyObj.DATE_ADDED + " DESC", + }; + const context = getContext(this); + let media = mediaLibrary.getMediaLibrary(context); + const fetchFileResult = await media.getFileAssets(option); + fetchFileResult.getFirstObject().then((fileAsset) => { + console.info('getFirstObject.displayName : ' + fileAsset.displayName); + for (let i = 1; i < fetchFileResult.getCount(); i++) { + fetchFileResult.getNextObject().then((fileAsset) => { + console.info('fileAsset.displayName ' + i + ': ' + fileAsset.displayName); + }).catch((err) => { + console.error('Failed to get next object: ' + err); + }); + } + }).catch((err) => { + console.error('Failed to get first object: ' + err); + }); } ``` @@ -124,31 +133,29 @@ To specify the album name **'myAlbum'**, set **selectionArgs** to **'myAlbum'**. ```ts async function example() { - let fileKeyObj = mediaLibrary.FileKey; - let fileType = mediaLibrary.MediaType.IMAGE; - let option = { - selections: fileKeyObj.ALBUM_NAME + '= ?', - selectionArgs: ['myAlbum'], - }; - const context = getContext(this); - let media = mediaLibrary.getMediaLibrary(context); - const fetchFileResult = await media.getFileAssets(option); - for (let i = 0; i < fetchFileResult.getCount(); i++) { - fetchFileResult.getNextObject((err, fileAsset) => { - if (err) { - console.error('Failed '); - return; - } - console.log('fileAsset.displayName ' + i + ': ' + fileAsset.displayName); - }) - } + let fileKeyObj = mediaLibrary.FileKey; + let option = { + selections: fileKeyObj.ALBUM_NAME + '= ?', + selectionArgs: ['myAlbum'], + }; + const context = getContext(this); + let media = mediaLibrary.getMediaLibrary(context); + const fetchFileResult = await media.getFileAssets(option); + if (albumList.length > 0) { + fetchFileResult.getFirstObject().then((album) => { + console.info('getFirstObject.displayName : ' + album.albumName); + }).catch((err) => { + console.error('Failed to get first object: ' + err); + }); + } else { + console.info('getAlbum list is: 0'); + } } ``` ## Obtaining Images and Videos in an Album You can obtain media assets in an album in either of the following ways: - - Call [MediaLibrary.getFileAssets](../reference/apis/js-apis-medialibrary.md#getfileassets7-1) with an album specified, as described in [Querying Media Assets with the Specfied Album Name](#querying-media-assets-with-the-specified-album-name). - Call [Album.getFileAssets](../reference/apis/js-apis-medialibrary.md#getfileassets7-3) to obtain an **Album** instance, so as to obtain the media assets in it. @@ -163,24 +170,24 @@ The following describes how to obtain videos in an album named **New Album 1**. 1. Create a retrieval condition for obtaining the target **Album** instance. - ```ts - let fileKeyObj = mediaLibrary.FileKey; - let AlbumNoArgsFetchOp = { - selections: fileKeyObj.ALBUM_NAME + '= ?', - selectionArgs:['New Album 1'] - } - ``` +```ts +let fileKeyObj = mediaLibrary.FileKey; +let AlbumNoArgsFetchOp = { + selections: fileKeyObj.ALBUM_NAME + '= ?', + selectionArgs:['New Album 1'] +} +``` 2. Create a retrieval condition for obtaining videos in the target album. - ```ts - let fileKeyObj = mediaLibrary.FileKey; - let imageType = mediaLibrary.MediaType.VIDEO; - let imagesFetchOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - } - ``` +```ts +let fileKeyObj = mediaLibrary.FileKey; +let videoType = mediaLibrary.MediaType.VIDEO; +let videoFetchOp = { + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [videoType.toString()], +} +``` 3. Call **Album.getFileAssets** to obtain the videos in the target album. @@ -188,28 +195,28 @@ Complete sample code: ```ts async function getCameraImagePromise() { - const context = getContext(this); - let media = mediaLibrary.getMediaLibrary(context); - let fileKeyObj = mediaLibrary.FileKey; - let imageType = mediaLibrary.MediaType.IMAGE; - let imagesFetchOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - } - let AlbumNoArgsFetchOp = { - selections: fileKeyObj.ALBUM_NAME + '= ?', - selectionArgs:['New Album 1'] - } - - let albumList = await media.getAlbums(AlbumNoArgsFetchOp); - if (albumList.length > 0) { - const album = albumList[0]; - let fetchFileResult = await album.getFileAssets(imagesFetchOp); - let count = fetchFileResult.getCount(); - console.info("get mediaLibrary IMAGE number", count); - } else { - console.info('getAlbum list is: 0'); - } + const context = getContext(this); + let media = mediaLibrary.getMediaLibrary(context); + let fileKeyObj = mediaLibrary.FileKey; + let videoType = mediaLibrary.MediaType.VIDEO; + let videoFetchOp = { + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [videoType.toString()], + } + let AlbumNoArgsFetchOp = { + selections: fileKeyObj.ALBUM_NAME + '= ?', + selectionArgs:['New Album 1'] + } + + let albumList = await media.getAlbums(AlbumNoArgsFetchOp); + if (albumList.length > 0) { + const album = albumList[0]; + let fetchFileResult = await album.getFileAssets(videoFetchOp); + let count = fetchFileResult.getCount(); + console.info("get mediaLibrary VIDEO number", count); + } else { + console.info('getAlbum list is: 0'); + } } ``` @@ -235,31 +242,32 @@ The following describes how to obtain the thumbnail (size: 720 x 720) of the fir ```ts async function getFirstThumbnailPromise() { - const context = getContext(this); - let media = mediaLibrary.getMediaLibrary(context); - let fileKeyObj = mediaLibrary.FileKey; - let imageType = mediaLibrary.MediaType.IMAGE; - let imagesFetchOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - } - - let size = { width: 720, height: 720 }; - const fetchFileResult = await media.getFileAssets(imagesFetchOp); - if (fetchFileResult != undefined) { - const asset = await fetchFileResult.getFirstObject(); - asset.getThumbnail(size).then((pixelMap) => { - pixelMap.getImageInfo().then((info) => { - console.info('get Thumbnail info: ' + "width: " + info.size.width + " height: " + info.size.height); - }).catch((err) => { - console.info("getImageInfo failed with error:" + err); - }); - }).catch((err) => { - console.info("getImageInfo failed with error:" + err); - }); - } else { - console.info("get image failed with error"); - } + const context = getContext(this); + let media = mediaLibrary.getMediaLibrary(context); + let fileKeyObj = mediaLibrary.FileKey; + let imageType = mediaLibrary.MediaType.IMAGE; + let imagesFetchOp = { + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + } + + let size = { width: 720, height: 720 }; + const fetchFileResult = await media.getFileAssets(imagesFetchOp); + if (fetchFileResult === undefined) { + console.error("get image failed with error"); + return; + } else { + const asset = await fetchFileResult.getFirstObject(); + asset.getThumbnail(size).then((pixelMap) => { + pixelMap.getImageInfo().then((info) => { + console.info('get Thumbnail info: ' + "width: " + info.size.width + " height: " + info.size.height); + }).catch((err) => { + console.error("getImageInfo failed with error: " + err); + }); + }).catch((err) => { + console.error("getImageInfo failed with error: " + err); + }); + } } ``` @@ -277,16 +285,16 @@ The following describes how to create a file of the **MediaType.FILE** type. ```ts async function example() { - let mediaType = mediaLibrary.MediaType.FILE; - let DIR_DOCUMENTS = mediaLibrary.DirectoryType.DIR_DOCUMENTS; - const context = getContext(this); - let media = mediaLibrary.getMediaLibrary(context); - const path = await media.getPublicDirectory(DIR_DOCUMENTS); - media.createAsset(mediaType, "testFile.text", path).then ((asset) => { - console.info("createAsset successfully:"+ JSON.stringify(asset)); - }).catch((err) => { - console.info("createAsset failed with error:"+ err); - }); + let mediaType = mediaLibrary.MediaType.FILE; + let DIR_DOCUMENTS = mediaLibrary.DirectoryType.DIR_DOCUMENTS; + const context = getContext(this); + let media = mediaLibrary.getMediaLibrary(context); + const path = await media.getPublicDirectory(DIR_DOCUMENTS); + media.createAsset(mediaType, "testFile.text", path).then((asset) => { + console.info("createAsset successfully:"+ JSON.stringify(asset)); + }).catch((err) => { + console.error("createAsset failed with error: " + err); + }); } ``` @@ -312,26 +320,26 @@ The following describes how to move the first file in the result set to the recy ```ts async function example() { - let fileKeyObj = mediaLibrary.FileKey; - let fileType = mediaLibrary.MediaType.FILE; - let option = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [fileType.toString()], - }; - const context = getContext(this); - let media = mediaLibrary.getMediaLibrary(context); - const fetchFileResult = await media.getFileAssets(option); - let asset = await fetchFileResult.getFirstObject(); - if (asset == undefined) { - console.error('asset not exist'); - return; - } - // Void callback. - asset.trash(true).then(() => { - console.info("trash successfully"); - }).catch((err) => { - console.info("trash failed with error: " + err); - }); + let fileKeyObj = mediaLibrary.FileKey; + let fileType = mediaLibrary.MediaType.FILE; + let option = { + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [fileType.toString()], + }; + const context = getContext(this); + let media = mediaLibrary.getMediaLibrary(context); + const fetchFileResult = await media.getFileAssets(option); + let asset = await fetchFileResult.getFirstObject(); + if (asset === undefined) { + console.error('asset not exist'); + return; + } + // Void callback. + asset.trash(true).then(() => { + console.info("trash successfully"); + }).catch((err) => { + console.error("trash failed with error: " + err); + }); } ``` @@ -346,7 +354,7 @@ Before renaming a file, you must obtain the file, for example, by calling [Fetch - You have obtained a **MediaLibrary** instance. - You have granted the permission **ohos.permission.WRITE_MEDIA**. -The following describes how to rename the first file in the result set as **newtitle.text**. +The following describes how to rename the first file in the result set as **newImage.jpg**. **How to Develop** @@ -358,28 +366,28 @@ The following describes how to rename the first file in the result set as **newt ```ts async function example() { - let fileKeyObj = mediaLibrary.FileKey; - let fileType = mediaLibrary.MediaType.FILE; - let option = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [fileType.toString()], - }; - const context = getContext(this); - let media = mediaLibrary.getMediaLibrary(context); - const fetchFileResult = await media.getFileAssets(option); - let asset = await fetchFileResult.getFirstObject(); - if (asset == undefined) { - console.error('asset not exist'); + let fileKeyObj = mediaLibrary.FileKey; + let fileType = mediaLibrary.MediaType.IMAGE; + let option = { + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [fileType.toString()], + }; + const context = getContext(this); + let media = mediaLibrary.getMediaLibrary(context); + const fetchFileResult = await media.getFileAssets(option); + let asset = await fetchFileResult.getFirstObject(); + if (asset === undefined) { + console.error('asset not exist'); + return; + } + asset.displayName = 'newImage.jpg'; + // Void callback. + asset.commitModify((err) => { + if (err) { + console.error('fileRename Failed '); return; } - asset.displayName = 'newImage.jpg'; - // Void callback. - asset.commitModify((err) => { - if (err) { - console.error('fileRename Failed '); - return; - } - console.log('fileRename successful.'); - }); + console.info('fileRename successful.'); + }); } ``` diff --git a/en/application-dev/media/Readme-EN.md b/en/application-dev/media/Readme-EN.md index d65c0d9dbe51f963385afaac0b75deccc6b21d2b..94f8605a284976058c8df8537a5ae9aa4a624740 100755 --- a/en/application-dev/media/Readme-EN.md +++ b/en/application-dev/media/Readme-EN.md @@ -1,9 +1,7 @@ # Media -- Audio +- Audio and Video - [Audio Overview](audio-overview.md) - - [Audio Playback Development](audio-playback.md) - - [Audio Recording Development](audio-recorder.md) - [Audio Rendering Development](audio-renderer.md) - [Audio Stream Management Development](audio-stream-manager.md) - [Audio Capture Development](audio-capturer.md) @@ -12,10 +10,12 @@ - [Audio Interruption Mode Development](audio-interruptmode.md) - [Volume Management Development](audio-volume-manager.md) - [Audio Routing and Device Management Development](audio-routing-manager.md) - -- Video - - [Video Playback Development](video-playback.md) - - [Video Recording Development](video-recorder.md) + - [AVPlayer Development (Recommended)](avplayer-playback.md) + - [AVRecorder Development (Recommended)](avrecorder.md) + - [Audio Playback Development (To Be Deprecated)](audio-playback.md) + - [Audio Recording Development (To Be Deprecated)](audio-recorder.md) + - [Video Playback Development (To Be Deprecated)](video-playback.md) + - [Video Recording Development (To Be Deprecated)](video-recorder.md) - AVSession - [AVSession Overview](avsession-overview.md) diff --git a/en/application-dev/media/audio-capturer.md b/en/application-dev/media/audio-capturer.md index 539de6bb5c5a0723aa68a8994f7ee1970f393a3f..e9dde600b1e01a5550174f282c2787ba8ba66511 100644 --- a/en/application-dev/media/audio-capturer.md +++ b/en/application-dev/media/audio-capturer.md @@ -21,7 +21,7 @@ This following figure shows the audio capturer state transitions. ## Constraints -Before developing the audio data collection feature, configure the **ohos.permission.MICROPHONE** permission for your application. For details about permission configuration, see [Permission Application Guide](../security/accesstoken-guidelines.md). +Before developing the audio data collection feature, configure the **ohos.permission.MICROPHONE** permission for your application. For details, see [Permission Application Guide](../security/accesstoken-guidelines.md). ## How to Develop @@ -72,7 +72,7 @@ For details about the APIs, see [AudioCapturer in Audio Management](../reference } await audioCapturer.start(); - let state = audioCapturer.state; + state = audioCapturer.state; if (state == audio.AudioState.STATE_RUNNING) { console.info('AudioRecLog: Capturer started'); } else { @@ -86,7 +86,7 @@ For details about the APIs, see [AudioCapturer in Audio Management](../reference The following example shows how to write recorded data into a file. ```js - import fileio from '@ohos.fileio'; + import fs from '@ohos.file.fs'; let state = audioCapturer.state; // The read operation can be performed only when the state is STATE_RUNNING. @@ -96,31 +96,36 @@ For details about the APIs, see [AudioCapturer in Audio Management](../reference } const path = '/data/data/.pulse_dir/capture_js.wav'; // Path for storing the collected audio file. - let fd = fileio.openSync(path, 0o102, 0o777); - if (fd !== null) { - console.info('AudioRecLog: file fd created'); - } - else{ - console.info('AudioRecLog: file fd create : FAILED'); + let file = fs.openSync(filePath, 0o2); + let fd = file.fd; + if (file !== null) { + console.info('AudioRecLog: file created'); + } else { + console.info('AudioRecLog: file create : FAILED'); return; } - - fd = fileio.openSync(path, 0o2002, 0o666); + if (fd !== null) { console.info('AudioRecLog: file fd opened in append mode'); } let numBuffersToCapture = 150; // Write data for 150 times. + let count = 0; while (numBuffersToCapture) { + let bufferSize = await audioCapturer.getBufferSize(); let buffer = await audioCapturer.read(bufferSize, true); + let options = { + offset: count * this.bufferSize, + length: this.bufferSize + } if (typeof(buffer) == undefined) { console.info('AudioRecLog: read buffer failed'); } else { - let number = fileio.writeSync(fd, buffer); + let number = fs.writeSync(fd, buffer, options); console.info(`AudioRecLog: data written: ${number}`); - } - + } numBuffersToCapture--; + count++; } ``` @@ -178,18 +183,18 @@ For details about the APIs, see [AudioCapturer in Audio Management](../reference // Obtain the audio capturer information. let audioCapturerInfo : audio.AuduioCapturerInfo = await audioCapturer.getCapturerInfo(); - + // Obtain the audio stream information. let audioStreamInfo : audio.AudioStreamInfo = await audioCapturer.getStreamInfo(); - + // Obtain the audio stream ID. let audioStreamId : number = await audioCapturer.getAudioStreamId(); - + // Obtain the Unix timestamp, in nanoseconds. let audioTime : number = await audioCapturer.getAudioTime(); - + // Obtain a proper minimum buffer size. - let bufferSize : number = await audioCapturer.getBuffersize(); + let bufferSize : number = await audioCapturer.getBufferSize(); ``` 7. (Optional) Use **on('markReach')** to subscribe to the mark reached event, and use **off('markReach')** to unsubscribe from the event. diff --git a/en/application-dev/media/audio-playback.md b/en/application-dev/media/audio-playback.md index bbdb993ecdb9a1289a939af43db0e670ec10f98f..1c7953d32b8ecee4c0ff34e82ab8d13947ac9271 100644 --- a/en/application-dev/media/audio-playback.md +++ b/en/application-dev/media/audio-playback.md @@ -38,7 +38,7 @@ For details about the **src** types supported by **AudioPlayer**, see the [src a ```js import media from '@ohos.multimedia.media' -import fileIO from '@ohos.fileio' +import fs from '@ohos.file.fs' // Print the stream track information. function printfDescription(obj) { @@ -112,14 +112,8 @@ async function audioPlayerDemo() { let pathDir = "/data/storage/el2/base/haps/entry/files" // The path used here is an example. Obtain the path based on project requirements. // The stream in the path can be pushed to the device by running the "hdc file send D:\xxx\01.mp3 /data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files" command. let path = pathDir + '/01.mp3' - await fileIO.open(path).then((fdNumber) => { - fdPath = fdPath + '' + fdNumber; - console.info('open fd success fd is' + fdPath); - }, (err) => { - console.info('open fd failed err is' + err); - }).catch((err) => { - console.info('open fd failed err is' + err); - }); + let file = await fs.open(path); + fdPath = fdPath + '' + file.fd; audioPlayer.src = fdPath; // Set the src attribute and trigger the 'dataLoad' event callback. } ``` @@ -128,7 +122,7 @@ async function audioPlayerDemo() { ```js import media from '@ohos.multimedia.media' -import fileIO from '@ohos.fileio' +import fs from '@ohos.file.fs' export class AudioDemo { // Set the player callbacks. @@ -154,14 +148,8 @@ export class AudioDemo { let pathDir = "/data/storage/el2/base/haps/entry/files" // The path used here is an example. Obtain the path based on project requirements. // The stream in the path can be pushed to the device by running the "hdc file send D:\xxx\01.mp3 /data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files" command. let path = pathDir + '/01.mp3' - await fileIO.open(path).then((fdNumber) => { - fdPath = fdPath + '' + fdNumber; - console.info('open fd success fd is' + fdPath); - }, (err) => { - console.info('open fd failed err is' + err); - }).catch((err) => { - console.info('open fd failed err is' + err); - }); + let file = await fs.open(path); + fdPath = fdPath + '' + file.fd; audioPlayer.src = fdPath; // Set the src attribute and trigger the 'dataLoad' event callback. } } @@ -171,7 +159,7 @@ export class AudioDemo { ```js import media from '@ohos.multimedia.media' -import fileIO from '@ohos.fileio' +import fs from '@ohos.file.fs' export class AudioDemo { // Set the player callbacks. @@ -202,14 +190,8 @@ export class AudioDemo { let pathDir = "/data/storage/el2/base/haps/entry/files" // The path used here is an example. Obtain the path based on project requirements. // The stream in the path can be pushed to the device by running the "hdc file send D:\xxx\02.mp3 /data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files" command. let nextpath = pathDir + '/02.mp3' - await fileIO.open(nextpath).then((fdNumber) => { - nextFdPath = nextFdPath + '' + fdNumber; - console.info('open fd success fd is' + nextFdPath); - }, (err) => { - console.info('open fd failed err is' + err); - }).catch((err) => { - console.info('open fd failed err is' + err); - }); + let nextFile = await fs.open(nextpath); + nextFdPath = nextFdPath + '' + nextFile.fd; audioPlayer.src = nextFdPath; // Set the src attribute and trigger the 'dataLoad' event callback. } @@ -220,14 +202,8 @@ export class AudioDemo { let pathDir = "/data/storage/el2/base/haps/entry/files" // The path used here is an example. Obtain the path based on project requirements. // The stream in the path can be pushed to the device by running the "hdc file send D:\xxx\01.mp3 /data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files" command. let path = pathDir + '/01.mp3' - await fileIO.open(path).then((fdNumber) => { - fdPath = fdPath + '' + fdNumber; - console.info('open fd success fd is' + fdPath); - }, (err) => { - console.info('open fd failed err is' + err); - }).catch((err) => { - console.info('open fd failed err is' + err); - }); + let file = await fs.open(path); + fdPath = fdPath + '' + file.fd; audioPlayer.src = fdPath; // Set the src attribute and trigger the 'dataLoad' event callback. } } @@ -237,7 +213,7 @@ export class AudioDemo { ```js import media from '@ohos.multimedia.media' -import fileIO from '@ohos.fileio' +import fs from '@ohos.file.fs' export class AudioDemo { // Set the player callbacks. @@ -259,14 +235,8 @@ export class AudioDemo { let pathDir = "/data/storage/el2/base/haps/entry/files" // The path used here is an example. Obtain the path based on project requirements. // The stream in the path can be pushed to the device by running the "hdc file send D:\xxx\01.mp3 /data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files" command. let path = pathDir + '/01.mp3' - await fileIO.open(path).then((fdNumber) => { - fdPath = fdPath + '' + fdNumber; - console.info('open fd success fd is' + fdPath); - }, (err) => { - console.info('open fd failed err is' + err); - }).catch((err) => { - console.info('open fd failed err is' + err); - }); + let file = await fs.open(path); + fdPath = fdPath + '' + file.fd; audioPlayer.src = fdPath; // Set the src attribute and trigger the 'dataLoad' event callback. } } diff --git a/en/application-dev/media/audio-renderer.md b/en/application-dev/media/audio-renderer.md index 0b5b382d72fec98bfa18c3cfdee7bd61ef713da1..6a631bddc5437b677c6b1188c37d8ab5ebeb5dbe 100644 --- a/en/application-dev/media/audio-renderer.md +++ b/en/application-dev/media/audio-renderer.md @@ -33,33 +33,32 @@ The following figure shows the audio renderer state transitions. For details about the APIs, see [AudioRenderer in Audio Management](../reference/apis/js-apis-audio.md#audiorenderer8). 1. Use **createAudioRenderer()** to create an **AudioRenderer** instance. - - -Set parameters of the **AudioRenderer** instance in **audioRendererOptions**. This instance is used to render audio, control and obtain the rendering status, and register a callback for notification. + Set parameters of the **AudioRenderer** instance in **audioRendererOptions**. This instance is used to render audio, control and obtain the rendering status, and register a callback for notification. + ```js - import audio from '@ohos.multimedia.audio'; + import audio from '@ohos.multimedia.audio'; - let audioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - let audioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 0 // 0 is the extended flag bit of the audio renderer. The default value is 0. + let audioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + let audioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 0 // 0 is the extended flag bit of the audio renderer. The default value is 0. + } + let audioRendererOptions = { + streamInfo: audioStreamInfo, + rendererInfo: audioRendererInfo } - let audioRendererOptions = { - streamInfo: audioStreamInfo, - rendererInfo: audioRendererInfo - } - - let audioRenderer = await audio.createAudioRenderer(audioRendererOptions); - console.log("Create audio renderer success."); + + let audioRenderer = await audio.createAudioRenderer(audioRendererOptions); + console.log("Create audio renderer success."); ``` - + 2. Use **start()** to start audio rendering. ```js @@ -82,15 +81,15 @@ Set parameters of the **AudioRenderer** instance in **audioRendererOptions**. Th } } ``` - The renderer state will be **STATE_RUNNING** once the audio renderer is started. The application can then begin reading buffers. + The renderer state will be **STATE_RUNNING** once the audio renderer is started. The application can then begin reading buffers. 3. Call **write()** to write data to the buffer. Read the audio data to be played to the buffer. Call **write()** repeatedly to write the data to the buffer. ```js - import fileio from '@ohos.fileio'; + import fs from '@ohos.file.fs'; import audio from '@ohos.multimedia.audio'; async function writeBuffer(buf) { @@ -109,35 +108,33 @@ Set parameters of the **AudioRenderer** instance in **audioRendererOptions**. Th // Set a proper buffer size for the audio renderer. You can also select a buffer of another size. const bufferSize = await audioRenderer.getBufferSize(); let dir = globalThis.fileDir; // You must use the sandbox path. - const path = dir + '/file_example_WAV_2MG.wav'; // The file to render is in the following path: /data/storage/el2/base/haps/entry/files/file_example_WAV_2MG.wav - console.info(`file path: ${ path}`); - let ss = fileio.createStreamSync(path, 'r'); - const totalSize = fileio.statSync(path).size; // Size of the file to render. - let discardHeader = new ArrayBuffer(bufferSize); - ss.readSync(discardHeader); - let rlen = 0; - rlen += bufferSize; - - let id = setInterval(() => { - if (audioRenderer.state == audio.AudioState.STATE_RELEASED) { // The rendering stops if the audio renderer is in the STATE_RELEASED state. - ss.closeSync(); - await audioRenderer.stop(); - clearInterval(id); + const filePath = dir + '/file_example_WAV_2MG.wav'; // The file to render is in the following path: /data/storage/el2/base/haps/entry/files/file_example_WAV_2MG.wav + console.info(`file filePath: ${ filePath}`); + + let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY); + let stat = await fs.stat(filePath); // Music file information. + let buf = new ArrayBuffer(bufferSize); + let len = stat.size % this.bufferSize == 0 ? Math.floor(stat.size / this.bufferSize) : Math.floor(stat.size / this.bufferSize + 1); + for (let i = 0;i < len; i++) { + let options = { + offset: i * this.bufferSize, + length: this.bufferSize } - if (audioRenderer.state == audio.AudioState.STATE_RUNNING) { - if (rlen >= totalSize) { // The rendering stops if the file finishes reading. - ss.closeSync(); - await audioRenderer.stop(); - clearInterval(id); - } - let buf = new ArrayBuffer(bufferSize); - rlen += ss.readSync(buf); - console.info(`Total bytes read from file: ${rlen}`); - writeBuffer(buf); - } else { - console.info('check after next interval'); - } - }, 30); // The timer interval is set based on the audio format. The unit is millisecond. + let readsize = await fs.read(file.fd, buf, options) + let writeSize = await new Promise((resolve,reject)=>{ + this.audioRenderer.write(buf,(err,writeSize)=>{ + if(err){ + reject(err) + }else{ + resolve(writeSize) + } + }) + }) + } + + fs.close(file) + await audioRenderer.stop(); // Stop rendering. + await audioRenderer.release(); // Releases the resources. ``` 4. (Optional) Call **pause()** or **stop()** to pause or stop rendering. @@ -242,7 +239,7 @@ Set parameters of the **AudioRenderer** instance in **audioRendererOptions**. Th let audioTime : number = await audioRenderer.getAudioTime(); // Obtain a proper minimum buffer size. - let bufferSize : number = await audioRenderer.getBuffersize(); + let bufferSize : number = await audioRenderer.getBufferSize(); // Obtain the audio renderer rate. let renderRate : audio.AudioRendererRate = await audioRenderer.getRenderRate(); @@ -424,35 +421,31 @@ Set parameters of the **AudioRenderer** instance in **audioRendererOptions**. Th let dir = globalThis.fileDir; // You must use the sandbox path. const path1 = dir + '/music001_48000_32_1.wav'; // The file to render is in the following path: /data/storage/el2/base/haps/entry/files/music001_48000_32_1.wav console.info(`audioRender1 file path: ${ path1}`); - let ss1 = await fileio.createStream(path1,'r'); - const totalSize1 = fileio.statSync(path1).size; // Size of the file to render. - console.info(`totalSize1 -------: ${totalSize1}`); - let discardHeader = new ArrayBuffer(bufferSize); - ss1.readSync(discardHeader); - let rlen = 0; - rlen += bufferSize; - + let file1 = fs.openSync(path1, fs.OpenMode.READ_ONLY); + let stat = await fs.stat(path1); // Music file information. + let buf = new ArrayBuffer(bufferSize); + let len = stat.size % this.bufferSize == 0 ? Math.floor(stat.size / this.bufferSize) : Math.floor(stat.size / this.bufferSize + 1); + // 1.7 Render the original audio data in the buffer by using audioRender. - let id = setInterval(async () => { - if (audioRenderer1.state == audio.AudioState.STATE_RELEASED) { // The rendering stops if the audio renderer is in the STATE_RELEASED state. - ss1.closeSync(); - audioRenderer1.stop(); - clearInterval(id); + for (let i = 0;i < len; i++) { + let options = { + offset: i * this.bufferSize, + length: this.bufferSize } - if (audioRenderer1.state == audio.AudioState.STATE_RUNNING) { - if (rlen >= totalSize1) { // The rendering stops if the file finishes reading. - ss1.closeSync(); - await audioRenderer1.stop(); - clearInterval(id); - } - let buf = new ArrayBuffer(bufferSize); - rlen += ss1.readSync(buf); - console.info(`Total bytes read from file: ${rlen}`); - await writeBuffer(buf, that.audioRenderer1); - } else { - console.info('check after next interval'); - } - }, 30); // The timer interval is set based on the audio format. The unit is millisecond. + let readsize = await fs.read(file.fd, buf, options) + let writeSize = await new Promise((resolve,reject)=>{ + this.audioRenderer1.write(buf,(err,writeSize)=>{ + if(err){ + reject(err) + }else{ + resolve(writeSize) + } + }) + }) + } + fs.close(file1) + await audioRenderer1.stop(); // Stop rendering. + await audioRenderer1.release(); Releases the resources. } async runningAudioRender2(){ @@ -499,36 +492,32 @@ Set parameters of the **AudioRenderer** instance in **audioRendererOptions**. Th // 2.6 Read the original audio data file. let dir = globalThis.fileDir; // You must use the sandbox path. const path2 = dir + '/music002_48000_32_1.wav'; // The file to render is in the following path: /data/storage/el2/base/haps/entry/files/music002_48000_32_1.wav - console.error(`audioRender1 file path: ${ path2}`); - let ss2 = await fileio.createStream(path2,'r'); - const totalSize2 = fileio.statSync(path2).size; // Size of the file to render. - console.error(`totalSize2 -------: ${totalSize2}`); - let discardHeader2 = new ArrayBuffer(bufferSize); - ss2.readSync(discardHeader2); - let rlen = 0; - rlen += bufferSize; - + console.info(`audioRender2 file path: ${ path2}`); + let file2 = fs.openSync(path2, fs.OpenMode.READ_ONLY); + let stat = await fs.stat(path2); // Music file information. + let buf = new ArrayBuffer(bufferSize); + let len = stat.size % this.bufferSize == 0 ? Math.floor(stat.size / this.bufferSize) : Math.floor(stat.size / this.bufferSize + 1); + // 2.7 Render the original audio data in the buffer by using audioRender. - let id = setInterval(async () => { - if (audioRenderer2.state == audio.AudioState.STATE_RELEASED) { // The rendering stops if the audio renderer is in the STATE_RELEASED state. - ss2.closeSync(); - that.audioRenderer2.stop(); - clearInterval(id); + for (let i = 0;i < len; i++) { + let options = { + offset: i * this.bufferSize, + length: this.bufferSize } - if (audioRenderer1.state == audio.AudioState.STATE_RUNNING) { - if (rlen >= totalSize2) { // The rendering stops if the file finishes reading. - ss2.closeSync(); - await audioRenderer2.stop(); - clearInterval(id); - } - let buf = new ArrayBuffer(bufferSize); - rlen += ss2.readSync(buf); - console.info(`Total bytes read from file: ${rlen}`); - await writeBuffer(buf, that.audioRenderer2); - } else { - console.info('check after next interval'); - } - }, 30); // The timer interval is set based on the audio format. The unit is millisecond. + let readsize = await fs.read(file.fd, buf, options) + let writeSize = await new Promise((resolve,reject)=>{ + this.audioRenderer2.write(buf,(err,writeSize)=>{ + if(err){ + reject(err) + }else{ + resolve(writeSize) + } + }) + }) + } + fs.close(file2) + await audioRenderer2.stop(); // Stop rendering. + await audioRenderer2.release(); // Releases the resources. } async writeBuffer(buf, audioRender) { @@ -548,4 +537,4 @@ Set parameters of the **AudioRenderer** instance in **audioRendererOptions**. Th await runningAudioRender2(); } - ``` + ``` \ No newline at end of file diff --git a/en/application-dev/media/avplayer-playback.md b/en/application-dev/media/avplayer-playback.md index 270081373fb500877ca4352366982b66f72bc09a..324dd43e6f73d46e5f0d264ae81ba36802ee6021 100644 --- a/en/application-dev/media/avplayer-playback.md +++ b/en/application-dev/media/avplayer-playback.md @@ -104,7 +104,7 @@ The full playback process includes creating an instance, setting resources, sett ```js import media from '@ohos.multimedia.media' import audio from '@ohos.multimedia.audio'; -import fileIO from '@ohos.fileio' +import fs from '@ohos.file.fs' const TAG = 'AVPlayerDemo:' export class AVPlayerDemo { @@ -223,14 +223,8 @@ export class AVPlayerDemo { let pathDir = "/data/storage/el2/base/haps/entry/files" // The path used here is an example. Obtain the path based on project requirements. // The stream in the path can be pushed to the device by running the "hdc file send D:\xxx\H264_AAC.mp4 /data/app/el2/100/base/ohos.acts.multimedia.media.avplayer/haps/entry/files" command. let path = pathDir + '/H264_AAC.mp4' - await fileIO.open(path).then((fdNumber) => { - fdPath = fdPath + '' + fdNumber - console.info('open fd success fd is' + fdPath) - }, (err) => { - console.info('open fd failed err is' + err) - }).catch((err) => { - console.info('open fd failed err is' + err) - }); + let file = await fs.open(path) + fdPath = fdPath + '' + file.fd this.avPlayer.url = fdPath } } @@ -240,7 +234,7 @@ export class AVPlayerDemo { ```js import media from '@ohos.multimedia.media' -import fileIO from '@ohos.fileio' +import fs from '@ohos.file.fs' const TAG = 'AVPlayerDemo:' export class AVPlayerDemo { @@ -280,7 +274,7 @@ export class AVPlayerDemo { break; case 'stopped': // This state is reported upon a successful callback of stop(). console.info(TAG + 'state stopped called') - this.avPlayer.reset() // Call reset() to initialize the AVPlayer state. + this.avPlayer.release() // Call reset() to initialize the AVPlayer state. break; case 'released': console.info(TAG + 'state released called') @@ -302,24 +296,18 @@ export class AVPlayerDemo { let pathDir = "/data/storage/el2/base/haps/entry/files" // The path used here is an example. Obtain the path based on project requirements. // The stream in the path can be pushed to the device by running the "hdc file send D:\xxx\H264_AAC.mp4 /data/app/el2/100/base/ohos.acts.multimedia.media.avplayer/haps/entry/files" command. let path = pathDir + '/H264_AAC.mp4' - await fileIO.open(path).then((fdNumber) => { - fdPath = fdPath + '' + fdNumber - console.info('open fd success fd is' + fdPath) - }, (err) => { - console.info('open fd failed err is' + err) - }).catch((err) => { - console.info('open fd failed err is' + err) - }); + let file = await fs.open(path) + fdPath = fdPath + '' + file.fd this.avPlayer.url = fdPath } } ``` -### Switching to the Next Video Clip +### Looping a Song ```js import media from '@ohos.multimedia.media' -import fileIO from '@ohos.fileio' +import fs from '@ohos.file.fs' const TAG = 'AVPlayerDemo:' export class AVPlayerDemo { @@ -362,7 +350,7 @@ export class AVPlayerDemo { break; case 'stopped': // This state is reported upon a successful callback of stop(). console.info(TAG + 'state stopped called') - this.avPlayer.reset() // Call reset() to initialize the AVPlayer state. + this.avPlayer.release() // Call reset() to initialize the AVPlayer state. break; case 'released': console.info(TAG + 'state released called') @@ -393,23 +381,17 @@ export class AVPlayerDemo { let pathDir = "/data/storage/el2/base/haps/entry/files" // The path used here is an example. Obtain the path based on project requirements. // The stream in the path can be pushed to the device by running the "hdc file send D:\xxx\H264_AAC.mp4 /data/app/el2/100/base/ohos.acts.multimedia.media.avplayer/haps/entry/files" command. let path = pathDir + '/H264_AAC.mp4' - await fileIO.open(path).then((fdNumber) => { - fdPath = fdPath + '' + fdNumber - console.info('open fd success fd is' + fdPath) - }, (err) => { - console.info('open fd failed err is' + err) - }).catch((err) => { - console.info('open fd failed err is' + err) - }); + let file = await fs.open(path) + fdPath = fdPath + '' + file.fd this.avPlayer.url = fdPath } } ``` -### Looping a Song +### Switching to the Next Video Clip ```js import media from '@ohos.multimedia.media' -import fileIO from '@ohos.fileio' +import fs from '@ohos.file.fs' const TAG = 'AVPlayerDemo:' export class AVPlayerDemo { @@ -422,14 +404,8 @@ export class AVPlayerDemo { let pathDir = "/data/storage/el2/base/haps/entry/files" // The path used here is an example. Obtain the path based on project requirements. // The stream in the path can be pushed to the device by running the "hdc file send D:\xxx\H264_MP3.mp4 /data/app/el2/100/base/ohos.acts.multimedia.media.avplayer/haps/entry/files" command. let path = pathDir + '/H264_MP3.mp4' - await fileIO.open(path).then((fdNumber) => { - fdPath = fdPath + '' + fdNumber - console.info('open fd success fd is' + fdPath) - }, (err) => { - console.info('open fd failed err is' + err) - }).catch((err) => { - console.info('open fd failed err is' + err) - }); + let file = await fs.open(path) + fdPath = fdPath + '' + file.fd this.avPlayer.url = fdPath // The initialized state is reported again. } @@ -493,14 +469,8 @@ export class AVPlayerDemo { let pathDir = "/data/storage/el2/base/haps/entry/files" // The path used here is an example. Obtain the path based on project requirements. // The stream in the path can be pushed to the device by running the "hdc file send D:\xxx\H264_AAC.mp4 /data/app/el2/100/base/ohos.acts.multimedia.media.avplayer/haps/entry/files" command. let path = pathDir + '/H264_AAC.mp4' - await fileIO.open(path).then((fdNumber) => { - fdPath = fdPath + '' + fdNumber - console.info('open fd success fd is' + fdPath) - }, (err) => { - console.info('open fd failed err is' + err) - }).catch((err) => { - console.info('open fd failed err is' + err) - }); + let file = await fs.open(path) + fdPath = fdPath + '' + file.fd this.avPlayer.url = fdPath } } diff --git a/en/application-dev/media/avrecorder.md b/en/application-dev/media/avrecorder.md index 6378b7515e675fcc0b924fc47a4af9db60707a47..d97ed9fb27f983d643b62244b2ba1d1f36929c69 100644 --- a/en/application-dev/media/avrecorder.md +++ b/en/application-dev/media/avrecorder.md @@ -67,14 +67,14 @@ export class AVRecorderDemo { let surfaceID; // The surface ID is obtained by calling getInputSurface and transferred to the videoOutput object of the camera. await this.getFd('01.mp4'); - // Configure the parameters related to audio and video recording. + // Configure the parameters related to audio and video recording based on those supported by the hardware device. let avProfile = { audioBitrate : 48000, audioChannels : 2, audioCodec : media.CodecMimeType.AUDIO_AAC, audioSampleRate : 48000, fileFormat : media.ContainerFormatType.CFT_MPEG_4, - videoBitrate : 48000, + videoBitrate : 2000000, videoCodec : media.CodecMimeType.VIDEO_MPEG4, videoFrameWidth : 640, videoFrameHeight : 480, @@ -363,10 +363,10 @@ export class VideoRecorderDemo { let surfaceID; // The surface ID is obtained by calling getInputSurface and transferred to the videoOutput object of the camera. await this.getFd('01.mp4'); - // Configure the parameters related to video recording. + // Configure the parameters related to pure video recording based on those supported by the hardware device. let videoProfile = { fileFormat : media.ContainerFormatType.CFT_MPEG_4, - videoBitrate : 48000, + videoBitrate : 2000000, videoCodec : media.CodecMimeType.VIDEO_MPEG4, videoFrameWidth : 640, videoFrameHeight : 480, diff --git a/en/application-dev/media/figures/en-us_image_avplayer_state_machine.png b/en/application-dev/media/figures/en-us_image_avplayer_state_machine.png index aa8afdbcbf142fd745cee03fc422caec51cfe41b..12adecd8865a9ff1faaa2c6654e8558f2fac77aa 100644 Binary files a/en/application-dev/media/figures/en-us_image_avplayer_state_machine.png and b/en/application-dev/media/figures/en-us_image_avplayer_state_machine.png differ diff --git a/en/application-dev/media/video-playback.md b/en/application-dev/media/video-playback.md index b324f19b3cf0f3621bd74809c4f1a2d0b57d0abd..d4c895b452aa31b28690bd96bd9ef0fac64c4eb4 100644 --- a/en/application-dev/media/video-playback.md +++ b/en/application-dev/media/video-playback.md @@ -51,7 +51,7 @@ For details about how to create an XComponent, see [XComponent](../reference/ark ```js import media from '@ohos.multimedia.media' -import fileIO from '@ohos.fileio' +import fs from '@ohos.file.fs' export class VideoPlayerDemo { // Report an error in the case of a function invocation failure. failureCallback(error) { @@ -82,14 +82,8 @@ export class VideoPlayerDemo { let fdPath = 'fd://' // The stream in the path can be pushed to the device by running the "hdc file send D:\xxx\H264_AAC.mp4 /data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile" command. let path = '/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/H264_AAC.mp4'; - await fileIO.open(path).then((fdNumber) => { - fdPath = fdPath + '' + fdNumber; - console.info('open fd success fd is' + fdPath); - }, (err) => { - console.info('open fd failed err is' + err); - }).catch((err) => { - console.info('open fd failed err is' + err); - }); + let file = await fs.open(path); + fdPath = fdPath + '' + file.fd; // Call createVideoPlayer to create a VideoPlayer instance. await media.createVideoPlayer().then((video) => { if (typeof (video) != 'undefined') { @@ -180,7 +174,7 @@ export class VideoPlayerDemo { ```js import media from '@ohos.multimedia.media' -import fileIO from '@ohos.fileio' +import fs from '@ohos.file.fs' export class VideoPlayerDemo { // Report an error in the case of a function invocation failure. failureCallback(error) { @@ -211,14 +205,8 @@ export class VideoPlayerDemo { let fdPath = 'fd://' // The stream in the path can be pushed to the device by running the "hdc file send D:\xxx\H264_AAC.mp4 /data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile" command. let path = '/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/H264_AAC.mp4'; - await fileIO.open(path).then((fdNumber) => { - fdPath = fdPath + '' + fdNumber; - console.info('open fd success fd is' + fdPath); - }, (err) => { - console.info('open fd failed err is' + err); - }).catch((err) => { - console.info('open fd failed err is' + err); - }); + let file = await fs.open(path); + fdPath = fdPath + '' + file.fd; // Call createVideoPlayer to create a VideoPlayer instance. await media.createVideoPlayer().then((video) => { if (typeof (video) != 'undefined') { @@ -267,7 +255,7 @@ export class VideoPlayerDemo { ```js import media from '@ohos.multimedia.media' -import fileIO from '@ohos.fileio' +import fs from '@ohos.file.fs' export class VideoPlayerDemo { // Report an error in the case of a function invocation failure. failureCallback(error) { @@ -299,14 +287,8 @@ export class VideoPlayerDemo { // The stream in the path can be pushed to the device by running the "hdc file send D:\xxx\H264_AAC.mp4 /data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile" command. let path = '/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/H264_AAC.mp4'; let nextPath = '/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/MP4_AAC.mp4'; - await fileIO.open(path).then((fdNumber) => { - fdPath = fdPath + '' + fdNumber; - console.info('open fd success fd is' + fdPath); - }, (err) => { - console.info('open fd failed err is' + err); - }).catch((err) => { - console.info('open fd failed err is' + err); - }); + let file = await fs.open(path); + fdPath = fdPath + '' + file.fd; // Call createVideoPlayer to create a VideoPlayer instance. await media.createVideoPlayer().then((video) => { if (typeof (video) != 'undefined') { @@ -341,14 +323,8 @@ export class VideoPlayerDemo { // Obtain the next video FD address. fdPath = 'fd://' - await fileIO.open(nextPath).then((fdNumber) => { - fdPath = fdPath + '' + fdNumber; - console.info('open fd success fd is' + fdPath); - }, (err) => { - console.info('open fd failed err is' + err); - }).catch((err) => { - console.info('open fd failed err is' + err); - }); + let nextFile = await fs.open(nextPath); + fdPath = fdPath + '' + nextFile.fd; // Set the second video playback source. videoPlayer.url = fdPath; @@ -378,7 +354,7 @@ export class VideoPlayerDemo { ```js import media from '@ohos.multimedia.media' -import fileIO from '@ohos.fileio' +import fs from '@ohos.file.fs' export class VideoPlayerDemo { // Report an error in the case of a function invocation failure. failureCallback(error) { @@ -409,14 +385,8 @@ export class VideoPlayerDemo { let fdPath = 'fd://' // The stream in the path can be pushed to the device by running the "hdc file send D:\xxx\H264_AAC.mp4 /data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile" command. let path = '/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/H264_AAC.mp4'; - await fileIO.open(path).then((fdNumber) => { - fdPath = fdPath + '' + fdNumber; - console.info('open fd success fd is' + fdPath); - }, (err) => { - console.info('open fd failed err is' + err); - }).catch((err) => { - console.info('open fd failed err is' + err); - }); + let file = await fs.open(path); + fdPath = fdPath + '' + file.fd; // Call createVideoPlayer to create a VideoPlayer instance. await media.createVideoPlayer().then((video) => { if (typeof (video) != 'undefined') { diff --git a/en/application-dev/media/video-recorder.md b/en/application-dev/media/video-recorder.md index bef55899bcb51359a6b6d68ef6d7894d70e435ae..fd9de91b4bae0591e2a5dc4869455bdd4055943e 100644 --- a/en/application-dev/media/video-recorder.md +++ b/en/application-dev/media/video-recorder.md @@ -76,14 +76,14 @@ export class VideoRecorderDemo { let surfaceID = null; // Used to save the surface ID returned by getInputSurface. // Obtain the FD address of the video to be recorded. await this.getFd('01.mp4'); - // Recording-related parameter settings + // Configure the parameters related to video recording based on those supported by the hardware device. let videoProfile = { audioBitrate : 48000, audioChannels : 2, audioCodec : 'audio/mp4a-latm', audioSampleRate : 48000, fileFormat : 'mp4', - videoBitrate : 48000, + videoBitrate : 2000000, videoCodec : 'video/mp4v-es', videoFrameWidth : 640, videoFrameHeight : 480, diff --git a/en/application-dev/napi/napi-guidelines.md b/en/application-dev/napi/napi-guidelines.md index 5113c413d523b9d58363b78ac94ba42cc1954e9d..4448869d84d51b0fb17836e69af14ad28433f395 100644 --- a/en/application-dev/napi/napi-guidelines.md +++ b/en/application-dev/napi/napi-guidelines.md @@ -4,9 +4,7 @@ OpenHarmony applications use JavaScript (JS) when calling native APIs. The nativ ## How to Develop -The DevEco Studio has a default project that uses NAPIs. - -You can choose **File** > **New** > **Create Project** to create a **Native C++** project. The **cpp** directory is generated in the **main** directory. You can use the NAPIs provided by the **ace_napi** repository for development. +The DevEco Studio has a default project that uses NAPIs. You can choose **File** > **New** > **Create Project** to create a **Native C++** project. The **cpp** directory is generated in the **main** directory. You can use the NAPIs provided by the **ace_napi** repository for development. You can import the native .so that contains the JS processing logic. For example, **import hello from 'libhello.so'** to use the **libhello.so** capability. Then, the JS object created using the NAPI can be passed to the **hello** object of the application to call the native capability. @@ -19,7 +17,10 @@ You can import the native .so that contains the JS processing logic. For example ### .so Naming Rules -Each module has a .so file. For example, if the module name is **hello**, name the .so file **libhello.so**. The **nm_modname** field in **napi_module** must be **hello**, which is the same as the module name. The sample code for importing the .so file is **import hello from 'libhello.so'**. +The .so file names must comply with the following rules: + +* Each module has a .so file. +* The **nm_modname** field in **napi_module** must be the same as the module name. For example, if the module name is **hello**, name the .so file **libhello.so**. The sample code for importing the .so file is **import hello from 'libhello.so'**. ### JS Objects and Threads diff --git a/en/application-dev/quick-start/figures/hap-release.png b/en/application-dev/quick-start/figures/hap-release.png index 527cefcf7e466e105f74065c3d8b59b18802d94b..9c7692a87e3975e01d125893fd276c247743c4e8 100644 Binary files a/en/application-dev/quick-start/figures/hap-release.png and b/en/application-dev/quick-start/figures/hap-release.png differ diff --git a/en/application-dev/quick-start/module-configuration-file.md b/en/application-dev/quick-start/module-configuration-file.md index 260d0cab1f9aa5b9365848e58bf070e1a70b4924..531d85960588b32a9f23a1a9e01a2202576219c1 100644 --- a/en/application-dev/quick-start/module-configuration-file.md +++ b/en/application-dev/quick-start/module-configuration-file.md @@ -22,19 +22,19 @@ This document gives an overview of the **module.json5** configuration file. To s { "name": "string", "value": "string", - "resource": "$profile:distrofilter_config" + "resource": "$profile:distributionFilter_config" } ], "abilities": [ { "name": "EntryAbility", - "srcEntrance": "./ets/entryability/EntryAbility.ts", + "srcEntry": "./ets/entryability/EntryAbility.ts", "description": "$string:EntryAbility_desc", "icon": "$media:icon", "label": "$string:EntryAbility_label", "startWindowIcon": "$media:icon", "startWindowBackground": "$color:start_window_background", - "visible": true, + "exported": true, "skills": [ { "entities": [ @@ -71,9 +71,9 @@ As shown above, the **module.json5** file contains several tags. | Name| Description| Data Type| Initial Value Allowed| | -------- | -------- | -------- | -------- | -| name | Name of the module. The value is a string with a maximum of 31 bytes and must be unique in the entire application.| String| No| +| name | Name of the module. The value is a string with a maximum of 31 bytes and must be unique in the entire application. Chinese characters are not allowed.| String| No| | type | Type of the module. The value can be **entry** or **feature**.
- **entry**: main module of the application.
- **feature**: dynamic feature module of the application.| String| No| -| srcEntrance | Code path corresponding to the module. The value is a string with a maximum of 127 bytes.| String| Yes (initial value: left empty)| +| srcEntry | Code path corresponding to the module. The value is a string with a maximum of 127 bytes.| String| Yes (initial value: left empty)| | description | Description of the module. The value is a string with a maximum of 255 bytes or a string resource index.| String| Yes (initial value: left empty)| | process | Process name of the current module. The value is a string with a maximum of 31 bytes. If **process** is configured under **HAP**, all UIAbility, DataShareExtensionAbility, and ServiceExtensionAbility components of the application run in the specified process.
**NOTE**
This tag applies only to system applications and does not take effect for third-party applications.| String| Yes (initial value: value of **bundleName** under **app** in the **app.json5** file)| | mainElement | Name of the entry UIAbility or ExtensionAbility of the module. The value is a string with a maximum of 255 bytes.| String| Yes (initial value: left empty)| @@ -81,7 +81,6 @@ As shown above, the **module.json5** file contains several tags. | deliveryWithInstall | Whether the HAP file of the module will be installed when the user installs the application.
- **true**: The HAP file will be installed when the user installs the application.
- **false**: The HAP file will not be installed when the user installs the application.| Boolean| No| | installationFree | Whether the module supports the installation-free feature.
- **true**: The module supports the installation-free feature and meets installation-free constraints.
- **false**: The module does not support the installation-free feature.
**NOTE**
- If this tag is set to **true** for an entry-type module, it must also be set to **true** for feature-type modules of the same application.
- If this tag is set to **false** for an entry-type module, it can be set to **true** or **false** for feature-type modules of the same application based on service requirements.| Boolean| No| | virtualMachine | Type of the target virtual machine (VM) where the module runs. It is used for cloud distribution, such as distribution by the application market and distribution center.
If the target VM type is ArkTS engine, the value is **ark**+*version number*.| String| Yes (initial value: automatically inserted when DevEco Studio builds the HAP file)| -| uiSyntax (deprecated)| Syntax type of the component defined by the module syntax. This tag is deprecated since API version 9.
- **"hml"**: The component is developed using HML, CSS, or JS.
- **"ets"**: The component is developed using ArkTS.| String| Yes (initial value: **"hml"**)| | [pages](#pages)| Profile that represents information about each page in the current module. The value can contain a maximum of 255 bytes.| String| No in the UIAbility scenario| | [metadata](#metadata)| Custom metadata of the module. The setting is valid only for the current module, UIAbility, or ExtensionAbility.| Object array| Yes (initial value: left empty)| | [abilities](#abilities) | UIAbility configuration of the module, which is valid only for the current UIAbility component.| Object| Yes (initial value: left empty)| @@ -201,24 +200,25 @@ The **metadata** tag represents the custom metadata of the HAP file. The tag val ## abilities -The **abilities** tag describes the UIAbility configuration of the component, which is valid only for the current UIAbility component. The tag value is an array. +UIAbility configuration of the module, which is valid only for the current UIAbility component. + **Table 4** abilities | Name| Description| Data Type| Initial Value Allowed| | -------- | -------- | -------- | -------- | -| name | Name of the UIAbility component, which must be unique in the entire application. The value is a string with a maximum of 127 bytes.| String| No| -| srcEntrance | Code path of the entry UIAbility component. The value is a string with a maximum of 127 bytes.| String| No| -| [launchType](../application-models/uiability-launch-type.md) | Launch type of the UIAbility component. The options are as follows:
- **standard**: A new UIAbility instance is created each time the UIAbility component is started.
- **singleton**: A new UIAbility instance is created only when the UIAbility component is started for the first time.
- **specified**: You can determine whether to create a new UIAbility instance when the application is running.| String| Yes (initial value: **"singleton"**)| +| name | Name of the UIAbility component, which must be unique in the entire application. The value is a string with a maximum of 127 bytes. Chinese characters are not allowed.| String| No| +| srcEntry | Code path of the entry UIAbility component. The value is a string with a maximum of 127 bytes.| String| No| +| [launchType](../application-models/uiability-launch-type.md) | Launch type of the UIAbility component. The options are as follows:
- **multiton**: A new UIAbility instance is created each time the UIAbility component is started.
- **singleton**: A new UIAbility instance is created only when the UIAbility component is started for the first time.
- **specified**: You can determine whether to create a new UIAbility instance when the application is running.| String| Yes (initial value: **"singleton"**)| | description | Description of the UIAbility component. The value is a string with a maximum of 255 bytes or a resource index to the description in multiple languages.| String| Yes (initial value: left empty)| -| icon | Icon of the UIAbility component. The value is an icon resource index.
If **UIAbility** is set to **MainElement**, this attribute is mandatory. | String| Yes (initial value: left empty) | +| icon | Icon of the UIAbility component. The value is an icon resource index.| String| Yes (initial value: left empty)
If **UIAbility** is set to **MainElement**, this attribute is mandatory.| | label | Name of the UIAbility component displayed to users. The value is a string resource index.
If **UIAbility** is set to **MainElement** of the current module, this attribute is mandatory and its value must be unique in the application.| String| No| | permissions | Permissions required for another application to access the UIAbility component.
The value is an array of permission names predefined by the system, generally in the reverse domain name notation. It contains a maximum of 255 bytes.| String array| Yes (initial value: left empty)| | [metadata](#metadata)| Metadata information of the UIAbility component.| Object array| Yes (initial value: left empty)| -| visible | Whether the UIAbility component can be called by other applications.
- **true**: The UIAbility component can be called by other applications.
- **false**: The UIAbility component cannot be called by other applications.| Boolean| Yes (initial value: **false**)| +| exported | Whether the UIAbility component can be called by other applications.
- **true**: The UIAbility component can be called by other applications.
- **false**: The UIAbility component cannot be called by other applications.| Boolean| Yes (initial value: **false**)| | continuable | Whether the UIAbility component can be [migrated](../application-models/hop-cross-device-migration.md).
- **true**: The UIAbility component can be migrated.
- **false**: The UIAbility component cannot be migrated.| Boolean| Yes (initial value: **false**)| | [skills](#skills) | Feature set of [wants](../application-models/want-overview.md) that can be received by the current UIAbility or ExtensionAbility component.
Configuring rule:
- For HAPs of the entry type, you can configure multiple **skills** attributes with the entry capability for an OpenHarmony application. (A **skills** attribute with the entry capability is the one that has **ohos.want.action.home** and **entity.system.home** configured.)
- For HAPs of the feature type, you can configure **skills** attributes with the entry capability for an OpenHarmony application, but not for an OpenHarmony service.| Object array| Yes (initial value: left empty)| -| backgroundModes | Continuous tasks of the UIAbility component.
Continuous tasks are classified into the following types:
- **dataTransfer**: service for downloading, backing up, sharing, or transferring data from the network or peer devices.
- **audioPlayback**: audio playback service.
- **audioRecording**: audio recording service.
- **location**: location and navigation services.
- **bluetoothInteraction**: Bluetooth scanning, connection, and transmission services (wearables).
- **multiDeviceConnection**: multi-device interconnection service.
- **wifiInteraction**: Wi-Fi scanning, connection, and transmission services (as used in the Multi-screen Collaboration and clone features)
- **voip**: voice/video call and VoIP services.
- **taskKeeping**: computing service.| String array| Yes (initial value: left empty)| +| backgroundModes | Continuous tasks of the UIAbility component.
Continuous tasks are classified into the following types:
- **dataTransfer**: service for downloading, backing up, sharing, or transferring data from the network or peer devices.
- **audioPlayback**: audio playback service.
- **audioRecording**: audio recording service.
- **location**: location and navigation services.
- **bluetoothInteraction**: Bluetooth scanning, connection, and transmission services (wearables).
- **multiDeviceConnection**: multi-device interconnection service.
- **wifiInteraction**: Wi-Fi scanning, connection, and transmission services (as used in the Multi-screen Collaboration and clone features)
- **voip**: voice/video call and VoIP services.
- **taskKeeping**: computing service.| String array| Yes (initial value: left empty)| | startWindowIcon | Index to the icon file of the UIAbility component startup page. Example: **$media:icon**.
The value is a string with a maximum of 255 bytes.| String| No| | startWindowBackground | Index to the background color resource file of the UIAbility component startup page. Example: **$color:red**.
The value is a string with a maximum of 255 bytes.| String| No| | removeMissionAfterTerminate | Whether to remove the relevant task from the task list after the UIAbility component is destroyed.
- **true**: Remove the relevant task from the task list after the UIAbility component is destroyed.
- **false**: Do not remove the relevant task from the task list after the UIAbility component is destroyed.| Boolean| Yes (initial value: **false**)| @@ -240,14 +240,14 @@ Example of the **abilities** structure: { "abilities": [{ "name": "EntryAbility", - "srcEntrance": "./ets/entryability/EntryAbility.ts", - "launchType":"standard", + "srcEntry": "./ets/entryability/EntryAbility.ts", + "launchType":"singleton", "description": "$string:description_main_ability", "icon": "$media:icon", "label": "Login", "permissions": [], "metadata": [], - "visible": true, + "exported": true, "continuable": true, "skills": [{ "actions": ["ohos.want.action.home"], @@ -335,7 +335,6 @@ Example of the **skills** structure: } ``` - ## extensionAbilities The **extensionAbilities** tag represents the configuration of extensionAbilities, which is valid only for the current extensionAbility. @@ -345,16 +344,16 @@ The **extensionAbilities** tag represents the configuration of extensionAbilitie | Name| Description| Data Type| Initial Value Allowed| | -------- | -------- | -------- | -------- | | name | Name of the ExtensionAbility component. The value is a string with a maximum of 127 bytes. The name must be unique in the entire application.| String| No| -| srcEntrance | Code path corresponding to the ExtensionAbility component. The value is a string with a maximum of 127 bytes.| String| No| +| srcEntry | Code path corresponding to the ExtensionAbility component. The value is a string with a maximum of 127 bytes.| String| No| | description | Description of the ExtensionAbility component. The value is a string with a maximum of 255 bytes or a resource index to the description.| String| Yes (initial value: left empty)| | icon | Icon of the ExtensionAbility component. The value is an icon resource index. If **ExtensionAbility** is set to **MainElement** of the current module, this attribute is mandatory and its value must be unique in the application.| String| Yes (initial value: left empty)| | label | Name of the ExtensionAbility component displayed to users. The value is a string resource index.
**NOTE**
If **ExtensionAbility** is set to **MainElement** of the current module, this attribute is mandatory and its value must be unique in the application.| String| No| | type | Type of the ExtensionAbility component. The options are as follows:
- **form**: ExtensionAbility of a widget.
- **workScheduler**: ExtensionAbility of a Work Scheduler task.
- **inputMethod**: ExtensionAbility of an input method.
- **service**: service component running in the background.
- **accessibility**: ExtensionAbility of an accessibility feature.
- **dataShare**: ExtensionAbility for data sharing.
- **fileShare**: ExtensionAbility for file sharing.
- **staticSubscriber**: ExtensionAbility for static broadcast.
- **wallpaper**: ExtensionAbility of the wallpaper.
- **backup**: ExtensionAbility for data backup.
- **window**: ExtensionAbility of a window. This type of ExtensionAbility creates a window during startup for which you can develop the GUI. The window is then combined with other application windows through **abilityComponent**.
- **thumbnail**: ExtensionAbility for obtaining file thumbnails. You can provide thumbnails for files of customized file types.
- **preview**: ExtensionAbility for preview. This type of ExtensionAbility can parse the file and display it in a window. You can combine the window with other application windows.
**NOTE**
The **service** and **dataShare** types apply only to system applications and do not take effect for third-party applications. | String| No| | permissions | Permissions required for another application to access the ExtensionAbility component.
The value is generally in the reverse domain name notation and contains a maximum of 255 bytes. It is an array of permission names predefined by the system or customized. The name of a customized permission must be the same as the **name** value of a permission defined in the **defPermissions** attribute.| String array| Yes (initial value: left empty)| | uri | Data URI provided by the ExtensionAbility component. The value is a string with a maximum of 255 bytes, in the reverse domain name notation.
**NOTE**
This attribute is mandatory when **type** of the ExtensionAbility component is set to **dataShare**.| String| Yes (initial value: left empty)| -|skills | Feature set of [wants](../application-models/want-overview.md) that can be received by the ExtensionAbility component.
Configuration rule: In an entry package, you can configure multiple **skills** attributes with the entry capability. (A **skills** attribute with the entry capability is the one that has **ohos.want.action.home** and **entity.system.home** configured.) The **label** and **icon** in the first ExtensionAbility that has **skills** configured are used as the **label** and **icon** of the entire OpenHarmony service/application.
**NOTE**
The **skills** attribute with the entry capability can be configured for the feature-type package of an OpenHarmony application, but not for an OpenHarmony service. | Array| Yes (initial value: left empty)| +|skills | Feature set of [wants](../application-models/want-overview.md) that can be received by the ExtensionAbility component.
Configuration rule: In an entry package, you can configure multiple **skills** attributes with the entry capability. (A **skills** attribute with the entry capability is the one that has **ohos.want.action.home** and **entity.system.home** configured.) The **label** and **icon** in the first ExtensionAbility that has **skills** configured are used as the **label** and **icon** of the entire OpenHarmony service/application.
**NOTE**
The **skills** attribute with the entry capability can be configured for the feature-type package of an OpenHarmony application,
but not for an OpenHarmony service.| Array| Yes (initial value: left empty)| | [metadata](#metadata)| Metadata of the ExtensionAbility component.| Object| Yes (initial value: left empty)| -| visible | Whether the ExtensionAbility component can be called by other applications.
- **true**: The ExtensionAbility component can be called by other applications.
- **false**: The UIAbility component cannot be called by other applications.| Boolean| Yes (initial value: **false**)| +| exported | Whether the ExtensionAbility component can be called by other applications.
- **true**: The ExtensionAbility component can be called by other applications.
- **false**: The UIAbility component cannot be called by other applications.| Boolean| Yes (initial value: **false**)| Example of the **extensionAbilities** structure: @@ -364,7 +363,7 @@ Example of the **extensionAbilities** structure: "extensionAbilities": [ { "name": "FormName", - "srcEntrance": "./form/MyForm.ts", + "srcEntry": "./form/MyForm.ts", "icon": "$media:icon", "label" : "$string:extension_name", "description": "$string:form_description", @@ -372,7 +371,7 @@ Example of the **extensionAbilities** structure: "permissions": ["ohos.abilitydemo.permission.PROVIDER"], "readPermission": "", "writePermission": "", - "visible": true, + "exported": true, "uri":"scheme://authority/path/query", "skills": [{ "actions": [], @@ -395,12 +394,12 @@ Example of the **extensionAbilities** structure: The **requestPermissions** tage represents a set of permissions that the application needs to request from the system for running correctly. - **Table 8** requestPermissions +**Table 8** requestPermissions | Name| Description| Data Type| Value Range| Default Value| | -------- | -------- | -------- | -------- | -------- | | name | Permission name. This attribute is mandatory.| String| Custom| –| -| reason | Reason for requesting the permission. This attribute is mandatory when the permission to request is **user_grant**.
**NOTE**
If the permission to request is **user_grant**, this attribute is required for the application to be released to the application market, and multi-language adaptation is required. | String| Resource reference of the string type in $string: \*\*\* format| A null value| +| reason | Reason for requesting the permission. This attribute is mandatory when the permission to request is **user_grant**.
**NOTE**
If the permission to request is **user_grant**, this attribute is required for the application to be released to the application market, and multi-language adaptation is required.| String| Resource reference of the string type in $string: \*\*\* format| A null value| | usedScene | Scene under which the permission is used. It consists of the **abilities** and **when** sub-attributes. Multiple abilities can be configured.
**NOTE**
This attribute is optional by default. If the permission to request is **user_grant**, the **abilities** sub-attribute is mandatory and **when** is optional.| **abilities**: string array
**when**: string| **abilities**: array of names of UIAbility or ExtensionAbility components
**when**: **inuse** or **always**| **abilities**: null
**when**: null| Example of the **requestPermissions** structure: @@ -473,7 +472,7 @@ The **shortcut** information is identified in **metadata**, where: "abilities": [ { "name": "EntryAbility", - "srcEntrance": "./ets/entryability/EntryAbility.ts", + "srcEntry": "./ets/entryability/EntryAbility.ts", // ... "skills": [ { @@ -498,49 +497,42 @@ The **shortcut** information is identified in **metadata**, where: ``` -## distroFilter +## distributionFilter -The **distroFilter** tag defines the rules for distributing HAP files based on different device specifications, so that precise matching can be performed when the application market distributes applications. Distribution rules cover five factors: API version, screen shape, screen size, screen resolution, and country code. During distribution, a unique HAP is determined based on the mapping between **deviceType** and these five factors. This tag must be configured in the **/resource/profile resource** directory. +The **distributionFilter** tag defines the rules for distributing HAP files based on different device specifications, so that precise matching can be performed when the application market distributes applications. Distribution rules cover five factors: API version, screen shape, screen size, screen resolution, and country code. During distribution, a unique HAP is determined based on the mapping between **deviceType** and these five factors. This tag must be configured in the **/resource/profile resource** directory. Its sub-tags are optional. - **Table 9** distroFilter + **Table 9** distributionFilter | Name| Description| Data Type| Initial Value Allowed| | -------- | -------- | -------- | -------- | -| apiVersion | Supported API versions.| Object array| Yes (initial value: left empty)| | screenShape | Supported screen shapes.| Object array| Yes (initial value: left empty)| | screenWindow | Supported window resolutions for when the application is running. This attribute applies only to the lite wearables.| Object array| Yes (initial value: left empty)| | screenDensity | Pixel density of the screen, in dots per inch (DPI). This attribute is optional. The value options are as follows:
- **sdpi**: small-scale DPI. This value is applicable to devices with a DPI range of (0, 120].
- **mdpi**: medium-scale DPI. This value is applicable to devices with a DPI range of (120, 160].
- **ldpi**: large-scale DPI. This value is applicable to devices with a DPI range of (160, 240].
- **xldpi**: extra-large-scale DPI. This value is applicable to devices with a DPI range of (240, 320].
- **xxldpi**: extra-extra-large-scale DPI. This value is applicable to devices with a DPI range of (320, 480].
- **xxxldpi**: extra-extra-extra-large-scale DPI. This value is applicable to devices with a DPI range of (480, 640].| Object array| Yes (initial value: left empty)| | countryCode | Code of the country or region to which the application is to be distributed. The value is subject to the ISO-3166-1 standard. Enumerated definitions of multiple countries and regions are supported.| Object array| Yes (initial value: left empty)| - **Table 10** apiVersion - -| Name| Description| Data Type| Initial Value Allowed| -| -------- | -------- | -------- | -------- | -| policy | Rule for the sub-attribute value. Set this attribute to **exclude** or **include**.
- **exclude**: Exclude the matches of the sub-attribute value.
- **include**: Include the matches of the sub-attribute value.| String| No| -| value | API versions, for example, 4, 5, or 6. Example: If an application comes with two versions developed using API version 5 and API version 6 for the same device model, two installation packages of the entry type can be released for the application.| Array| No| - **Table 11** screenShape + **Table 10** screenShape | Name| Description| Data Type| Initial Value Allowed| | -------- | -------- | -------- | -------- | | policy | Rule for the sub-attribute value. Set this attribute to **exclude** or **include**.
- **exclude**: Exclude the matches of the sub-attribute value.
- **include**: Include the matches of the sub-attribute value.| String| No| | value | Screen shapes. The value can be **circle**, **rect**, or both. Example: Different HAP files can be provided for a smart watch with a circular face and that with a rectangular face.| String array| No| - **Table 12** screenWindow + **Table 11** screenWindow | Name| Description| Data Type| Initial Value Allowed| | -------- | -------- | -------- | -------- | | policy | Rule for the sub-attribute value. Set this attribute to **exclude** or **include**.
- **exclude**: Exclude the matches of the sub-attribute value.
- **include**: Include the matches of the sub-attribute value.| String| No| | value | Screen width and height, in pixels. The value an array of supported width and height pairs, each in the "width * height" format, for example, **"454 * 454"**.| String array| No| - **Table 13** screenDensity + **Table 12** screenDensity | Name| Description| Data Type| Initial Value Allowed| | -------- | -------- | -------- | -------- | | policy | Rule for the sub-attribute value. Set this attribute to **exclude** or **include**.
- **exclude**: Exclude the matches of the sub-attribute value.
- **include**: Include the matches of the sub-attribute value.| String| No| | value | Pixel density of the screen, in DPI.| String array| No| - **Table 14** countryCode + **Table 13** countryCode | Name| Description| Data Type| Initial Value Allowed| | -------- | -------- | -------- | -------- | @@ -552,14 +544,7 @@ Configure the **distro_filter_config.json** file (this file name is customizable ```json { - "distroFilter": { - "apiVersion": { - "policy": "include", - "value": [ - 3, - 4 - ] - }, + "distributionFilter": { "screenShape": { "policy": "include", "value": [ @@ -614,7 +599,7 @@ Configure **metadata** in the **module** tag in the **module.json5** file. The **testRunner** tag represents the supported test runner. - **Table 15** testRunner + **Table 14** testRunner | Name| Description| Data Type| Initial Value Allowed| | -------- | -------- | -------- | -------- | diff --git a/en/application-dev/quick-start/multi-hap-build-view.md b/en/application-dev/quick-start/multi-hap-build-view.md index 3266828fdbda2b969668410a98ce4b64cce54411..a2c2a530ce1e4edbb4681ff1400398f997c23daa 100644 --- a/en/application-dev/quick-start/multi-hap-build-view.md +++ b/en/application-dev/quick-start/multi-hap-build-view.md @@ -3,25 +3,27 @@ DevEco Studio allows you to develop and build multiple HAP files in one application project, as shown below. + **Figure 1** Multi-HAP build view - **Figure 1** Multi-HAP build view ![hap-multi-view](figures/hap-multi-view.png) 1. Development view in DevEco Studio - - AppScope folder - - [app.json5](app-configuration-file.md): application-wide configuration, such as the application bundle name, version number, application icon, application name, and dependent SDK version number. + - **AppScope** folder + + - **[app.json5](app-configuration-file.md)**: stores application-wide configuration, such as the application bundle name, version number, application icon, application name, and dependent SDK version number. - **resources** folder: stores application icon resources and application name string resources. - - **NOTE** - - The folder is automatically generated by DevEco Studio and its name cannot be changed. - - The file names in the **AppScope** folder cannot be the same as those in the entry- or feature-type module directories. Otherwise, DevEco Studio reports an error. - - Entry- or feature-type module directories (the names are customizable) - - You implement service logic of your application in these module directories. In this example, the module folders are **entry.hap** and **feature.hap**. - - **resources** directory: stores the resources used by the module. + + **NOTE** + + - The folder is automatically generated by DevEco Studio and its name cannot be changed. + - The file names in the **AppScope** folder cannot be the same as those in the entry- or feature-type module folder. Otherwise, an error will be reported. + - **entry** or **feature** folder (whose name is customizable) + - A module folder created by the developer by following the creation wizard of DevEco Studio. It stores the service logic implementation of the application. Multiple module folders can be created. In the preceding figure, **entry** and **feature** are two created module folders. + - **resources** folder: stores the resources used by the module. - **ets** folder: stores the service logic. - - [module.json5](module-configuration-file.md): module configuration, such as the module name, entry code path of the module, and component information. - + - **[module.json5](module-configuration-file.md)**: stores module configuration, such as the module name, entry code path of the module, and component information. + 2. View after build and packaging - After a module is built, a HAP file for deployment is generated. Each module corresponds to a HAP file. - The **module.json** file in the HAP file is composed of the **app.json5** and **module.json5** files in the development view. diff --git a/en/application-dev/quick-start/multi-hap-release-deployment.md b/en/application-dev/quick-start/multi-hap-release-deployment.md index ec688879ebb61ceb595feb974f2276d700479ef5..b4587f2c2125c526b86bfa0646af4b1fcbc9e9d3 100644 --- a/en/application-dev/quick-start/multi-hap-release-deployment.md +++ b/en/application-dev/quick-start/multi-hap-release-deployment.md @@ -6,32 +6,40 @@ Below is the process of developing, debugging, releasing, and deploying multiple ![hap-release](figures/hap-release.png) ## Development -You can use [DevEco Studio](https://developer.harmonyos.com/en/develop/deveco-studio) to create multiple modules based on service requirements and develop services in independent modules. +You can use [DevEco Studio](https://developer.harmonyos.com/en/develop/deveco-studio) to create multiple modules as needed and develop services in respective modules. ## Debugging -You can use DevEco Studio to build code into one or more HAP files. Then, you can debug the HAP files. +After building code into one or more HAP files and installing or updating these HAP files, you can debug them by using the methods: * Using DevEco Studio for debugging Follow the instructions in [Debugging Configuration](https://developer.harmonyos.com/en/docs/documentation/doc-guides/ohos-debugging-and-running-0000001263040487#section10491183521520). -* Using [hdc_std](../../device-dev/subsystems/subsys-toolchain-hdc-guide.md) for debugging +* Using [hdc](../../device-dev/subsystems/subsys-toolchain-hdc-guide.md) (which can be obtained in the **toolchains** directory of the OpenHarmony SDK) for debugging + + Before debugging HAP files, install or update them using either of the methods: + + 1. Use hdc to install and update the HAP files. + + When specifying the HAP files, use the paths of the files on the operating system, for example, Windows. - You can obtain the hdc_std tool from the **toolchains** directory of the SDK. When using this tool to install an HAP file, the HAP file path is the one on the operating platform. In this example, the Windows operating platform is used. The command reference is as follows: ``` // Installation and update: Multiple file paths can be specified. - hdc_std install C:\entry.hap C:\feature.hap + hdc install C:\entry.hap C:\feature.hap // The execution result is as follows: install bundle successfully. // Uninstall - hdc_std uninstall com.example.myapplication + hdc uninstall com.example.myapplication // The execution result is as follows: uninstall bundle successfully. ``` + + 2. Run the hdc shell command, and then use the Bundle Manager (bm) tool to install and update the HAP files. -* Using [Bundle Manager (bm)](../../application-dev/tools/bm-tool.md) for debugging - - When using bm to install or update an HAP file, the HAP file path is the one on the real device. The command reference is as follows: + When specifying the HAP files, use the paths of the files on the real device. The sample code is as follows: + ``` + // Run the hdc shell command before using the bm tool. + hdc shell // Installation and update: Multiple file paths can be specified. bm install -p /data/app/entry.hap /data/app/feature.hap // The execution result is as follows: @@ -41,6 +49,8 @@ You can use DevEco Studio to build code into one or more HAP files. Then, you ca // The execution result is as follows: uninstall bundle successfully. ``` + After the HAP files are installed or updated, you can debug them by following the instructions in [Ability Assistant](https://docs.openharmony.cn/pages/v3.2Beta/en/application-dev/tools/aa-tool.md/). + ## Release When your application package meets the release requirements, you can package and build it into an App Pack and release it to the application market on the cloud. The application market verifies the signature of the App Pack. If the signature verification is successful, the application market obtains the HAP files from the App Pack, signs them, and distributes the signed HAP files. diff --git a/en/application-dev/quick-start/multi-hap-rules.md b/en/application-dev/quick-start/multi-hap-rules.md index 34b7824cb62b7e1ca73232faa9f58685df2077ac..7c2675325cfecd0bfd5a6e5595c947daa8e8085d 100644 --- a/en/application-dev/quick-start/multi-hap-rules.md +++ b/en/application-dev/quick-start/multi-hap-rules.md @@ -1,14 +1,14 @@ # Multi-HAP Usage Rules -- The App Pack cannot be directly installed on the device. It is only a unit that is released to AppGallery. +- The App Pack cannot be directly installed on a device. It is only used to be released to the application market. - All HAP files in the App Pack must share the same **bundleName** value in the configuration files. - All HAP files in the App Pack must share the same **versionCode** value in the configuration files. -- In an application, each type of device supports only one HAP of the entry type. Each application can contain zero, one, or more HAP files of the feature type. +- In an App Pack, each type of device supports only one HAP file of the entry type and zero, one, or more HAP files of the feature type. -- Each HAP file in the App Pack must have **moduleName** configured. The **moduleName** value corresponding to all HAP files of the same device type must be unique. +- Each HAP file in the App Pack must have **moduleName** configured. Among HAP files of the same device type, the **moduleName** value must be unique. -- The signing certificates of all HAP files in the same application must be the same. Applications are released to the application market in the form of App Pack after being signed. Before distribution, the application market splits an App Pack into HAP files and resigns them to ensure the consistency of all HAP file signing certificates. Before installing HAP files on a device through the CLI or DevEco Studio for debugging, you must ensure that their signing certificates are the same. Otherwise, the installation will fail. +- The signing certificates of all HAP files in the same application must be the same. Applications are released to the application market in the form of App Pack after being signed. Before distribution, the application market splits an App Pack into HAP files and resigns them to ensure the consistency of HAP file signing certificates. Before installing HAP files on a device through the CLI or DevEco Studio for debugging, ensure that their signing certificates are the same. Otherwise, the installation will fail. diff --git a/en/application-dev/quick-start/resource-categories-and-access.md b/en/application-dev/quick-start/resource-categories-and-access.md index 56e8209a5c19e353a21b80ff8b34dd51885db310..aa5e53ae90c1794125f5b6ae8a8f7a5115128743 100644 --- a/en/application-dev/quick-start/resource-categories-and-access.md +++ b/en/application-dev/quick-start/resource-categories-and-access.md @@ -35,7 +35,7 @@ resources | Category | base Subdirectory | Qualifiers Subdirectory | rawfile Subdirectory | | ---- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | -| Structure| The **base** subdirectory is a default directory. If no qualifiers subdirectories in the **resources** directory of the application match the device status, the resource file in the **base** subdirectory will be automatically referenced.
Resource group subdirectories are located at the second level of subdirectories to store basic elements such as strings, colors, and boolean values, as well as resource files such as media, animations, and layouts. For details, see [Resource Group Subdirectories](#resource-group-subdirectories).| You need to create qualifiers subdirectories on your own. Each directory name consists of one or more qualifiers that represent the application scenarios or device characteristics. For details, see [Qualifiers Subdirectories](#qualifiers-subdirectories).
Resource group subdirectories are located at the second level of subdirectories to store basic elements such as strings, colors, and boolean values, as well as resource files such as media, animations, and layouts. For details, see [Resource Group Subdirectories](#resource-group-subdirectories). | You can create multiple levels of subdirectories with custom directory names. They can be used to store various resource files.
However, resource files in the **rawfile** subdirectory will not be matched based on the device status.| +| Structure| The **base** subdirectory is a default directory. If no qualifiers subdirectories in the **resources** directory of the application match the device status, the resource file in the **base** subdirectory will be automatically referenced.
Resource group subdirectories are located at the second level of subdirectories to store basic elements such as strings, colors, and boolean values, as well as resource files such as media, animations, and layouts. For details, see [Resource Group Subdirectories](#resource-group-subdirectories).| You need to create qualifiers subdirectories on your own. Each directory name consists of one or more qualifiers that represent the application scenarios or device characteristics. For details, see [Qualifiers Subdirectories](#qualifiers-subdirectories).
Resource group subdirectories are located at the second level of subdirectories to store basic elements such as strings, colors, and boolean values, as well as resource files such as media, animations, and layouts. For details, see [Resource Group Subdirectories](#resource-group-subdirectories).| You can create multiple levels of subdirectories with custom directory names. They can be used to store various resource files.
However, resource files in the **rawfile** subdirectory will not be matched based on the device status.| | Compilation| Resource files in the subdirectory are compiled into binary files, and each resource file is assigned an ID. | Resource files in the subdirectory are compiled into binary files, and each resource file is assigned an ID. | Resource files in the subdirectory are directly packed into the application without being compiled, and no IDs will be assigned to the resource files. | | Reference| Resource files in the subdirectory are referenced based on the resource type and resource name. | Resource files in the subdirectory are referenced based on the resource type and resource name. | Resource files in the subdirectory are referenced based on the file path and file name. | @@ -81,9 +81,9 @@ You can create resource group subdirectories (including element, media, and prof | Resource Group Subdirectory | Description | Resource File | | ------- | ---------------------------------------- | ---------------------------------------- | -| element | Indicates element resources. Each type of data is represented by a JSON file. The options are as follows:
- **boolean**: boolean data
- **color**: color data
- **float**: floating-point data
- **intarray**: array of integers
- **integer**: integer data
- **pattern**: pattern data
- **plural**: plural form data
- **strarray**: array of strings
- **string**: string data| It is recommended that files in the **element** subdirectory be named the same as the following files, each of which can contain only data of the same type:
- boolean.json
- color.json
- float.json
- intarray.json
- integer.json
- pattern.json
- plural.json
- strarray.json
- string.json | -| media | Indicates media resources, including non-text files such as images, audios, and videos. | The file name can be customized, for example, **icon.png**. | -| profile | Indicates a user-defined configuration file. You can obtain the file content by using the [getProfileByAbility](../reference/apis/js-apis-bundleManager.md#bundlemanagergetprofilebyability) API. | The file name can be customized, for example, **test_profile.json**. | +| element | Indicates element resources. Each type of data is represented by a JSON file. (Only files are supported in this directory.) The options are as follows:
- **boolean**: boolean data
- **color**: color data
- **float**: floating-point data
- **intarray**: array of integers
- **integer**: integer data
- **pattern**: pattern data
- **plural**: plural form data
- **strarray**: array of strings
- **string**: string data| It is recommended that files in the **element** subdirectory be named the same as the following files, each of which can contain only data of the same type:
- boolean.json
- color.json
- float.json
- intarray.json
- integer.json
- pattern.json
- plural.json
- strarray.json
- string.json | +| media | Indicates media resources, including non-text files such as images, audios, and videos. (Only files are supported in this directory.) | The file name can be customized, for example, **icon.png**. | +| profile | Indicates a custom configuration file. You can obtain the file content by using the [getProfileByAbility](../reference/apis/js-apis-bundleManager.md#bundlemanagergetprofilebyability) API. (Only files are supported in this directory.) | The file name can be customized, for example, **test_profile.json**. | | rawfile | Indicates other types of files, which are stored in their raw formats after the application is built as an HAP file. They will not be integrated into the **resources.index** file.| The file name can be customized. | **Media Resource Types** @@ -229,7 +229,7 @@ When referencing resources in the **rawfile** subdirectory, use the **"$rawfile( > > Resource descriptors accept only strings, such as **'app.type.name'**, and cannot be combined. > -> The return value of **$r** is a **Resource** object. You can obtain the corresponding string by using the [getStringValue](../reference/apis/js-apis-resource-manager.md) API. +> The return value of **$r** is a **Resource** object. You can obtain the corresponding string by using the [getStringValue](../reference/apis/js-apis-resource-manager.md#getstringvalue9) API. In the **.ets** file, you can use the resources defined in the **resources** directory. The following is a resource usage example based on the resource file examples in [Resource Group Sub-directories](#resource-group-subdirectories): @@ -252,7 +252,6 @@ Text($r('app.string.message_arrive', "five'o clock")) Text($r('app.plural.eat_apple', 5, 5)) .fontColor($r('app.color.color_world')) .fontSize($r('app.float.font_world')) -} Image($r('app.media.my_background_image')) // Reference media resources. diff --git a/en/application-dev/reference/apis/Readme-EN.md b/en/application-dev/reference/apis/Readme-EN.md index 906daa5313d94afe26b059802e891295326a5783..497dcf4054e62ec63f27d4ca2067b1cb6b82b1d6 100644 --- a/en/application-dev/reference/apis/Readme-EN.md +++ b/en/application-dev/reference/apis/Readme-EN.md @@ -19,13 +19,9 @@ - [@ohos.application.DataShareExtensionAbility (DataShare Extension Ability)](js-apis-application-dataShareExtensionAbility.md) - [@ohos.application.StaticSubscriberExtensionAbility (StaticSubscriberExtensionAbility)](js-apis-application-staticSubscriberExtensionAbility.md) - Stage Model (To Be Deprecated Soon) - - [@ohos.application.Ability (Ability)](js-apis-application-ability.md) - [@ohos.application.AbilityConstant (AbilityConstant)](js-apis-application-abilityConstant.md) - - [@ohos.application.AbilityLifecycleCallback (AbilityLifecycleCallback)](js-apis-application-abilityLifecycleCallback.md) - [@ohos.application.AbilityStage (AbilityStage)](js-apis-application-abilityStage.md) - - [@ohos.application.context (Context)](js-apis-application-context.md) - [@ohos.application.EnvironmentCallback (EnvironmentCallback)](js-apis-application-environmentCallback.md) - - [@ohos.application.ExtensionAbility (ExtensionAbility)](js-apis-application-extensionAbility.md) - [@ohos.application.FormExtension (FormExtension)](js-apis-application-formExtension.md) - [@ohos.application.ServiceExtensionAbility (ServiceExtensionAbility)](js-apis-application-serviceExtensionAbility.md) - [@ohos.application.StartOptions (StartOptions)](js-apis-application-startOptions.md) @@ -59,7 +55,6 @@ - [@ohos.application.appManager (appManager)](js-apis-application-appManager.md) - [@ohos.application.Configuration (Configuration)](js-apis-application-configuration.md) - [@ohos.application.ConfigurationConstant (ConfigurationConstant)](js-apis-application-configurationConstant.md) - - [@ohos.application.errorManager (ErrorManager)](js-apis-application-errorManager.md) - [@ohos.application.formBindingData (formBindingData)](js-apis-application-formBindingData.md) - [@ohos.application.formError (FormError)](js-apis-application-formError.md) - [@ohos.application.formHost (FormHost)](js-apis-application-formHost.md) @@ -82,7 +77,6 @@ - [context](js-apis-inner-app-context.md) - [processInfo](js-apis-inner-app-processInfo.md) - application - - [AbilityContext](js-apis-ability-context.md) - [abilityDelegator](js-apis-inner-application-abilityDelegator.md) - [abilityDelegatorArgs](js-apis-inner-application-abilityDelegatorArgs.md) - [abilityMonitor](js-apis-inner-application-abilityMonitor.md) @@ -146,6 +140,7 @@ - [abilityInfo](js-apis-bundleManager-abilityInfo.md) - [applicationInfo](js-apis-bundleManager-applicationInfo.md) - [bundleInfo](js-apis-bundleManager-bundleInfo.md) + - [BundlePackInfo](js-apis-bundleManager-BundlePackInfo.md) - [dispatchInfo](js-apis-bundleManager-dispatchInfo.md) - [elementName](js-apis-bundleManager-elementName.md) - [extensionAbilityInfo](js-apis-bundleManager-extensionAbilityInfo.md) @@ -222,10 +217,11 @@ - [@ohos.file.hash (File Hash Processing)](js-apis-file-hash.md) - [@ohos.file.securityLabel (Data Label)](js-apis-file-securityLabel.md) - [@ohos.file.statvfs (File System Space Statistics)](js-apis-file-statvfs.md) + - [@ohos.file.storageStatistics (Application Storage Statistics)](js-apis-file-storage-statistics.md) + - [@ohos.file.volumeManager (Volume Management)](js-apis-file-volumemanager.md) - [@ohos.filemanagement.userFileManager (User Data Management)](js-apis-userFileManager.md) - [@ohos.multimedia.medialibrary (Media Library Management)](js-apis-medialibrary.md) - - [@ohos.storageStatistics (Application Storage Statistics)](js-apis-storage-statistics.md) - - [@ohos.volumeManager (Volume Management)](js-apis-volumemanager.md) + - Telephony Service - [@ohos.contact (Contacts)](js-apis-contact.md) - [@ohos.telephony.call (Call)](js-apis-call.md) @@ -277,7 +273,7 @@ - [@ohos.InputMethodSubtype (Input Method Subtype)](js-apis-inputmethod-subtype.md) - [@ohos.pasteboard (Pasteboard)](js-apis-pasteboard.md) - [@ohos.screenLock (Screenlock)](js-apis-screen-lock.md) - - [@ohos.systemTime (System Time and Time Zone)](js-apis-system-time.md) + - [@ohos.systemDateTime (System Time and Time Zone)](js-apis-system-date-time.md) - [@ohos.systemTimer (System Timer)](js-apis-system-timer.md) - [@ohos.wallpaper (Wallpaper)](js-apis-wallpaper.md) - [@ohos.web.webview (Webview)](js-apis-webview.md) @@ -369,6 +365,7 @@ - [@ohos.reminderAgent (Reminder Agent)](js-apis-reminderAgent.md) - [@ohos.statfs (statfs)](js-apis-statfs.md) - [@ohos.systemParameter (System Parameter)](js-apis-system-parameter.md) + - [@ohos.systemTime (System Time and Time Zone)](js-apis-system-time.md) - [@ohos.usb (USB Management)](js-apis-usb-deprecated.md) - [@ohos.usbV9 (USB Management)](js-apis-usb.md) - [@system.app (Application Context)](js-apis-system-app.md) diff --git a/en/application-dev/reference/apis/figures/Colorsucker.png b/en/application-dev/reference/apis/figures/Colorsucker.png new file mode 100644 index 0000000000000000000000000000000000000000..40e19e94e129682fdeb461cceef0f0a57c64d66d Binary files /dev/null and b/en/application-dev/reference/apis/figures/Colorsucker.png differ diff --git a/en/application-dev/reference/apis/figures/Copy.png b/en/application-dev/reference/apis/figures/Copy.png new file mode 100644 index 0000000000000000000000000000000000000000..212517131bf176661ae85c7513def022dbb50559 Binary files /dev/null and b/en/application-dev/reference/apis/figures/Copy.png differ diff --git a/en/application-dev/reference/apis/figures/Cross.png b/en/application-dev/reference/apis/figures/Cross.png new file mode 100644 index 0000000000000000000000000000000000000000..58625855d1cd96ea8a29ab9c3c201d90ac717e83 Binary files /dev/null and b/en/application-dev/reference/apis/figures/Cross.png differ diff --git a/en/application-dev/reference/apis/figures/Default.png b/en/application-dev/reference/apis/figures/Default.png new file mode 100644 index 0000000000000000000000000000000000000000..6308171fe9d612050376f6a5dfdc870e51bc92db Binary files /dev/null and b/en/application-dev/reference/apis/figures/Default.png differ diff --git a/en/application-dev/reference/apis/figures/East.png b/en/application-dev/reference/apis/figures/East.png new file mode 100644 index 0000000000000000000000000000000000000000..4942bc948a17e78c68538ccc3ae886bc0a548737 Binary files /dev/null and b/en/application-dev/reference/apis/figures/East.png differ diff --git a/en/application-dev/reference/apis/figures/Forbid.png b/en/application-dev/reference/apis/figures/Forbid.png new file mode 100644 index 0000000000000000000000000000000000000000..c5c43d4b4b8aaf6d53931586e519a583d064fec7 Binary files /dev/null and b/en/application-dev/reference/apis/figures/Forbid.png differ diff --git a/en/application-dev/reference/apis/figures/Hand_Grabbing.png b/en/application-dev/reference/apis/figures/Hand_Grabbing.png new file mode 100644 index 0000000000000000000000000000000000000000..09ab3121d15e27a975fbaa228aadb2399e4492b9 Binary files /dev/null and b/en/application-dev/reference/apis/figures/Hand_Grabbing.png differ diff --git a/en/application-dev/reference/apis/figures/Hand_Open.png b/en/application-dev/reference/apis/figures/Hand_Open.png new file mode 100644 index 0000000000000000000000000000000000000000..e1cb7a972ec2d372f0d75cbe80159c4a66e74e10 Binary files /dev/null and b/en/application-dev/reference/apis/figures/Hand_Open.png differ diff --git a/en/application-dev/reference/apis/figures/Hand_Pointing.png b/en/application-dev/reference/apis/figures/Hand_Pointing.png new file mode 100644 index 0000000000000000000000000000000000000000..f0daa0dad6154a1846fb9fe4b7f441b3ab6f8b5b Binary files /dev/null and b/en/application-dev/reference/apis/figures/Hand_Pointing.png differ diff --git a/en/application-dev/reference/apis/figures/Help.png b/en/application-dev/reference/apis/figures/Help.png new file mode 100644 index 0000000000000000000000000000000000000000..ffea2f1c072f1682ca8e837ddb947352a553917e Binary files /dev/null and b/en/application-dev/reference/apis/figures/Help.png differ diff --git a/en/application-dev/reference/apis/figures/MID_Btn_East.png b/en/application-dev/reference/apis/figures/MID_Btn_East.png new file mode 100644 index 0000000000000000000000000000000000000000..921cd4ceea8d97ffb6d4c45008d6428cda998cce Binary files /dev/null and b/en/application-dev/reference/apis/figures/MID_Btn_East.png differ diff --git a/en/application-dev/reference/apis/figures/MID_Btn_North.png b/en/application-dev/reference/apis/figures/MID_Btn_North.png new file mode 100644 index 0000000000000000000000000000000000000000..5769575ddb435f5e8f5f8993d9edc13749376293 Binary files /dev/null and b/en/application-dev/reference/apis/figures/MID_Btn_North.png differ diff --git a/en/application-dev/reference/apis/figures/MID_Btn_North_East.png b/en/application-dev/reference/apis/figures/MID_Btn_North_East.png new file mode 100644 index 0000000000000000000000000000000000000000..3daf141241dec309c98ae10266bb153af163f3d9 Binary files /dev/null and b/en/application-dev/reference/apis/figures/MID_Btn_North_East.png differ diff --git a/en/application-dev/reference/apis/figures/MID_Btn_North_South.png b/en/application-dev/reference/apis/figures/MID_Btn_North_South.png new file mode 100644 index 0000000000000000000000000000000000000000..1f56c4cd8f1498293f5fc4a5ab2c321159fb07dd Binary files /dev/null and b/en/application-dev/reference/apis/figures/MID_Btn_North_South.png differ diff --git a/en/application-dev/reference/apis/figures/MID_Btn_North_South_West_East.png b/en/application-dev/reference/apis/figures/MID_Btn_North_South_West_East.png new file mode 100644 index 0000000000000000000000000000000000000000..b45dbde27e59121bdfc4e1752759176fb835027c Binary files /dev/null and b/en/application-dev/reference/apis/figures/MID_Btn_North_South_West_East.png differ diff --git a/en/application-dev/reference/apis/figures/MID_Btn_North_West.png b/en/application-dev/reference/apis/figures/MID_Btn_North_West.png new file mode 100644 index 0000000000000000000000000000000000000000..bde82d08f7a098106b4f4c31d55a84a989e25a8d Binary files /dev/null and b/en/application-dev/reference/apis/figures/MID_Btn_North_West.png differ diff --git a/en/application-dev/reference/apis/figures/MID_Btn_South.png b/en/application-dev/reference/apis/figures/MID_Btn_South.png new file mode 100644 index 0000000000000000000000000000000000000000..e7d5afb6f8f8b1b2939b9e18bdb8b8b3d9729f4d Binary files /dev/null and b/en/application-dev/reference/apis/figures/MID_Btn_South.png differ diff --git a/en/application-dev/reference/apis/figures/MID_Btn_South_East.png b/en/application-dev/reference/apis/figures/MID_Btn_South_East.png new file mode 100644 index 0000000000000000000000000000000000000000..44284a6e04a19ca8453b46ea81db099ad84cfaa2 Binary files /dev/null and b/en/application-dev/reference/apis/figures/MID_Btn_South_East.png differ diff --git a/en/application-dev/reference/apis/figures/MID_Btn_South_West.png b/en/application-dev/reference/apis/figures/MID_Btn_South_West.png new file mode 100644 index 0000000000000000000000000000000000000000..c8632f09160c51ca573d58d3ffb1370058b880ce Binary files /dev/null and b/en/application-dev/reference/apis/figures/MID_Btn_South_West.png differ diff --git a/en/application-dev/reference/apis/figures/MID_Btn_West.png b/en/application-dev/reference/apis/figures/MID_Btn_West.png new file mode 100644 index 0000000000000000000000000000000000000000..7460bc18d63e000689755b39b8ead3c3609ee4f5 Binary files /dev/null and b/en/application-dev/reference/apis/figures/MID_Btn_West.png differ diff --git a/en/application-dev/reference/apis/figures/Move.png b/en/application-dev/reference/apis/figures/Move.png new file mode 100644 index 0000000000000000000000000000000000000000..00f64e54dca0d0731b595b4ddc9e0f7294c40c72 Binary files /dev/null and b/en/application-dev/reference/apis/figures/Move.png differ diff --git a/en/application-dev/reference/apis/figures/North.png b/en/application-dev/reference/apis/figures/North.png new file mode 100644 index 0000000000000000000000000000000000000000..b022ac2e92d4cfb07efde7f3bf4b7ada8454e594 Binary files /dev/null and b/en/application-dev/reference/apis/figures/North.png differ diff --git a/en/application-dev/reference/apis/figures/North_East.png b/en/application-dev/reference/apis/figures/North_East.png new file mode 100644 index 0000000000000000000000000000000000000000..f6134237f38cd681b319c95bf1b77017bc1524b4 Binary files /dev/null and b/en/application-dev/reference/apis/figures/North_East.png differ diff --git a/en/application-dev/reference/apis/figures/North_East_South_West.png b/en/application-dev/reference/apis/figures/North_East_South_West.png new file mode 100644 index 0000000000000000000000000000000000000000..908886aeb3f8df976bb67b2261e8e52e7222e622 Binary files /dev/null and b/en/application-dev/reference/apis/figures/North_East_South_West.png differ diff --git a/en/application-dev/reference/apis/figures/North_South.png b/en/application-dev/reference/apis/figures/North_South.png new file mode 100644 index 0000000000000000000000000000000000000000..b15678a6b178ca0d9b13f7c7f58d025ab7a1ce12 Binary files /dev/null and b/en/application-dev/reference/apis/figures/North_South.png differ diff --git a/en/application-dev/reference/apis/figures/North_West.png b/en/application-dev/reference/apis/figures/North_West.png new file mode 100644 index 0000000000000000000000000000000000000000..cfbe4c8910575c12afde4b5904d79b5beda0c162 Binary files /dev/null and b/en/application-dev/reference/apis/figures/North_West.png differ diff --git a/en/application-dev/reference/apis/figures/North_West_South_East.png b/en/application-dev/reference/apis/figures/North_West_South_East.png new file mode 100644 index 0000000000000000000000000000000000000000..09fa728fbb45082a0524c284b8906b91d7b3a6f7 Binary files /dev/null and b/en/application-dev/reference/apis/figures/North_West_South_East.png differ diff --git a/en/application-dev/reference/apis/figures/Resize_Left_Right.png b/en/application-dev/reference/apis/figures/Resize_Left_Right.png new file mode 100644 index 0000000000000000000000000000000000000000..83e7671e3ffea65260bdb36d8b392fa78d55cd4e Binary files /dev/null and b/en/application-dev/reference/apis/figures/Resize_Left_Right.png differ diff --git a/en/application-dev/reference/apis/figures/Resize_Up_Down.png b/en/application-dev/reference/apis/figures/Resize_Up_Down.png new file mode 100644 index 0000000000000000000000000000000000000000..db8bccf89b6e5260db3875a22b5200fabd30c23c Binary files /dev/null and b/en/application-dev/reference/apis/figures/Resize_Up_Down.png differ diff --git a/en/application-dev/reference/apis/figures/Screenshot_Cross.png b/en/application-dev/reference/apis/figures/Screenshot_Cross.png new file mode 100644 index 0000000000000000000000000000000000000000..27460c082507e71082d11cd8a20eee2fc24da28d Binary files /dev/null and b/en/application-dev/reference/apis/figures/Screenshot_Cross.png differ diff --git a/en/application-dev/reference/apis/figures/Screenshot_Cursor.png b/en/application-dev/reference/apis/figures/Screenshot_Cursor.png new file mode 100644 index 0000000000000000000000000000000000000000..71abea4ca351988a92b8a5b2b2228321df31aecc Binary files /dev/null and b/en/application-dev/reference/apis/figures/Screenshot_Cursor.png differ diff --git a/en/application-dev/reference/apis/figures/South.png b/en/application-dev/reference/apis/figures/South.png new file mode 100644 index 0000000000000000000000000000000000000000..205f5cf5f59ce8318357e168eee0d66c119c233d Binary files /dev/null and b/en/application-dev/reference/apis/figures/South.png differ diff --git a/en/application-dev/reference/apis/figures/South_East.png b/en/application-dev/reference/apis/figures/South_East.png new file mode 100644 index 0000000000000000000000000000000000000000..f4a70d2d068271bfe10e4ce724ae27e4e5ba96d9 Binary files /dev/null and b/en/application-dev/reference/apis/figures/South_East.png differ diff --git a/en/application-dev/reference/apis/figures/South_West.png b/en/application-dev/reference/apis/figures/South_West.png new file mode 100644 index 0000000000000000000000000000000000000000..2ae8e9a9fa396bb6ed0f385b7b99b66830357a40 Binary files /dev/null and b/en/application-dev/reference/apis/figures/South_West.png differ diff --git a/en/application-dev/reference/apis/figures/Text_Cursor.png b/en/application-dev/reference/apis/figures/Text_Cursor.png new file mode 100644 index 0000000000000000000000000000000000000000..7cd8d2200bc7455e562da003069702832db4eb20 Binary files /dev/null and b/en/application-dev/reference/apis/figures/Text_Cursor.png differ diff --git a/en/application-dev/reference/apis/figures/West.png b/en/application-dev/reference/apis/figures/West.png new file mode 100644 index 0000000000000000000000000000000000000000..2cad91aca31f2e2b257c523e80e6fc2d71fa2cee Binary files /dev/null and b/en/application-dev/reference/apis/figures/West.png differ diff --git a/en/application-dev/reference/apis/figures/West_East.png b/en/application-dev/reference/apis/figures/West_East.png new file mode 100644 index 0000000000000000000000000000000000000000..6be4aa9d05f22a10cd00fa6aec36f95aee2b332d Binary files /dev/null and b/en/application-dev/reference/apis/figures/West_East.png differ diff --git a/en/application-dev/reference/apis/figures/Zoom_In.png b/en/application-dev/reference/apis/figures/Zoom_In.png new file mode 100644 index 0000000000000000000000000000000000000000..2e928ec070fcd05a44cd9b1abd041128287b0528 Binary files /dev/null and b/en/application-dev/reference/apis/figures/Zoom_In.png differ diff --git a/en/application-dev/reference/apis/figures/Zoom_Out.png b/en/application-dev/reference/apis/figures/Zoom_Out.png new file mode 100644 index 0000000000000000000000000000000000000000..d675d0e517ba436724540a39f60dfa75c256f0d0 Binary files /dev/null and b/en/application-dev/reference/apis/figures/Zoom_Out.png differ diff --git a/en/application-dev/reference/apis/figures/en-us_image_0000001219864133.PNG b/en/application-dev/reference/apis/figures/en-us_image_0000001219864133.PNG index 14f81499ff0b1b8ef46257bc35a79e94775cd2ba..54be7ed38fa40349036e18b962ee52deb579a033 100644 Binary files a/en/application-dev/reference/apis/figures/en-us_image_0000001219864133.PNG and b/en/application-dev/reference/apis/figures/en-us_image_0000001219864133.PNG differ diff --git a/en/application-dev/reference/apis/js-apis-Bundle.md b/en/application-dev/reference/apis/js-apis-Bundle.md index 50434235f4adc01b997d0f990728e81512c3560e..8c9e825557ee1d899e7004fb9109ff7b7ea7a5da 100644 --- a/en/application-dev/reference/apis/js-apis-Bundle.md +++ b/en/application-dev/reference/apis/js-apis-Bundle.md @@ -156,7 +156,7 @@ bundle.getApplicationInfo(bundleName, bundleFlags, (err, data) => { > This API is deprecated since API version 9. You are advised to use [bundleManager.getAllBundleInfo](js-apis-bundleManager.md#bundlemanagergetallbundleinfo) instead. -getAllBundleInfo(bundleFlag: BundleFlag, userId?: number): Promise> +getAllBundleInfo(bundleFlag: BundleFlag, userId?: number): Promise\\> Obtains the information of all bundles of the specified user. This API uses a promise to return the result. @@ -199,7 +199,7 @@ bundle.getAllBundleInfo(bundleFlag, userId) > This API is deprecated since API version 9. You are advised to use [bundleManager.getAllBundleInfo](js-apis-bundleManager.md#bundlemanagergetallbundleinfo) instead. -getAllBundleInfo(bundleFlag: BundleFlag, callback: AsyncCallback>): void +getAllBundleInfo(bundleFlag: BundleFlag, callback: AsyncCallback\\>): void Obtains the information of all bundles of the current user. This API uses an asynchronous callback to return the result. @@ -236,7 +236,7 @@ bundle.getAllBundleInfo(bundleFlag, (err, data) => { > This API is deprecated since API version 9. You are advised to use [bundleManager.getAllBundleInfo](js-apis-bundleManager.md#bundlemanagergetallbundleinfo) instead. -getAllBundleInfo(bundleFlag: BundleFlag, userId: number, callback: AsyncCallback>): void +getAllBundleInfo(bundleFlag: BundleFlag, userId: number, callback: AsyncCallback\\>): void Obtains the information of all bundles of the specified user. This API uses an asynchronous callback to return the result. @@ -822,7 +822,7 @@ bundle.getPermissionDef(permissionName).then((data) => { > This API is deprecated since API version 9. You are advised to use [bundleManager.getAllApplicationInfo](js-apis-bundleManager.md#bundlemanagergetallapplicationinfo) instead. -getAllApplicationInfo(bundleFlags: number, userId?: number): Promise> +getAllApplicationInfo(bundleFlags: number, userId?: number): Promise\\> Obtains the information about all applications of the specified user. This API uses a promise to return the result. @@ -864,7 +864,7 @@ bundle.getAllApplicationInfo(bundleFlags, userId) > This API is deprecated since API version 9. You are advised to use [bundleManager.getAllApplicationInfo](js-apis-bundleManager.md#bundlemanagergetallapplicationinfo) instead. -getAllApplicationInfo(bundleFlags: number, userId: number, callback: AsyncCallback>): void +getAllApplicationInfo(bundleFlags: number, userId: number, callback: AsyncCallback\\>): void Obtains the information about all applications. This API uses an asynchronous callback to return the result. @@ -1230,7 +1230,7 @@ SystemCapability.BundleManager.BundleFramework | Name | Type | Mandatory| Description | | -------- | -------------------------------------------- | ---- | ----------------------- | | info | [AbilityInfo](js-apis-bundle-AbilityInfo.md) | Yes | Ability information. | -| callback | AsyncCallback\ | Yes | Callback used to return the result. The value **true** means that the ability is enabled, and **false** means the opposite.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. If the ability is enabled, **true** will be returned; otherwise, **false** will be returned.| **Example** @@ -1320,7 +1320,7 @@ bundle.isApplicationEnabled(bundleName, (err, data) => { > This API is deprecated since API version 9. You are advised to use [bundleManager.queryAbilityInfo](js-apis-bundleManager.md#bundlemanagerqueryabilityinfo) instead. -queryAbilityByWant(want: Want, bundleFlags: number, userId?: number): Promise> +queryAbilityByWant(want: Want, bundleFlags: number, userId?: number): Promise\\> Obtains the ability information based on given Want. This API uses a promise to return the result. @@ -1371,7 +1371,7 @@ bundle.queryAbilityByWant(want, bundleFlags, userId) > This API is deprecated since API version 9. You are advised to use [bundleManager.queryAbilityInfo](js-apis-bundleManager.md#bundlemanagerqueryabilityinfo) instead. -queryAbilityByWant(want: Want, bundleFlags: number, userId: number, callback: AsyncCallback>): void +queryAbilityByWant(want: Want, bundleFlags: number, userId: number, callback: AsyncCallback\\>): void Obtains the ability information of the specified user based on given Want. This API uses an asynchronous callback to return the result. @@ -1416,7 +1416,7 @@ bundle.queryAbilityByWant(want, bundleFlags, userId, (err, data) => { > This API is deprecated since API version 9. You are advised to use [bundleManager.queryAbilityInfo](js-apis-bundleManager.md#bundlemanagerqueryabilityinfo) instead. -queryAbilityByWant(want: Want, bundleFlags: number, callback: AsyncCallback>): void; +queryAbilityByWant(want: Want, bundleFlags: number, callback: AsyncCallback\\>): void; Obtains the ability information based on given Want. This API uses an asynchronous callback to return the result. @@ -1603,7 +1603,7 @@ bundle.getNameForUid(uid, (err, data) => { ## bundle.getAbilityIcon8+ deprecated -> This API is deprecated since API version 9. You are advised to use [bundleManager.getAbilityIcon](js-apis-bundleManager.md#bundlemanagergetabilityicon) instead. +> This API is deprecated since API version 9. You are advised to use [resourceManager.getMediaContent](js-apis-resource-manager.md#getmediacontent9) instead. getAbilityIcon(bundleName: string, abilityName: string): Promise\; @@ -1646,7 +1646,7 @@ bundle.getAbilityIcon(bundleName, abilityName) ## bundle.getAbilityIcon8+ deprecated -> This API is deprecated since API version 9. You are advised to use [bundleManager.getAbilityIcon](js-apis-bundleManager.md#bundlemanagergetabilityicon) instead. +> This API is deprecated since API version 9. You are advised to use [resourceManager.getMediaContent](js-apis-resource-manager.md#getmediacontent9) instead. getAbilityIcon(bundleName: string, abilityName: string, callback: AsyncCallback\): void; diff --git a/en/application-dev/reference/apis/js-apis-ability-ability.md b/en/application-dev/reference/apis/js-apis-ability-ability.md index 37bf04c704a91f0580fddf99b14f9f52fb94d683..fe5b7cfde18961802383469c3d2558f8c8381f67 100644 --- a/en/application-dev/reference/apis/js-apis-ability-ability.md +++ b/en/application-dev/reference/apis/js-apis-ability-ability.md @@ -10,7 +10,7 @@ The **Ability** module provides all level-2 module APIs for developers to export ## Modules to Import ```ts -import ability from '@ohos.ability.ability' +import ability from '@ohos.ability.ability'; ``` **System capability**: SystemCapability.Ability.AbilityBase diff --git a/en/application-dev/reference/apis/js-apis-ability-context.md b/en/application-dev/reference/apis/js-apis-ability-context.md deleted file mode 100644 index d345bbb9db0739da16156ecfc0bd4fe344989149..0000000000000000000000000000000000000000 --- a/en/application-dev/reference/apis/js-apis-ability-context.md +++ /dev/null @@ -1,1921 +0,0 @@ -# AbilityContext - -The **AbilityContext** module, inherited from **Context**, implements the context for abilities. - -This module provides APIs for accessing ability-specific resources. You can use the APIs to start and terminate an ability, obtain the caller interface, and request permissions from users by displaying a dialog box. - -> **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 of this module can be used only in the stage model. - -## Usage - -Before using the **AbilityContext** module, you must define a child class that inherits from **Ability**. - -```ts -import UIAbility from '@ohos.app.ability.UIAbility'; - -let context = undefined; -class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage) { - context = this.context; - } -} -``` - -## Attributes - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -| Name| Type| Readable| Writable| Description| -| -------- | -------- | -------- | -------- | -------- | -| abilityInfo | [AbilityInfo](js-apis-bundleManager-abilityInfo.md) | Yes| No| Ability information.| -| currentHapModuleInfo | [HapModuleInfo](js-apis-bundleManager-hapModuleInfo.md) | Yes| No| Information about the current HAP.| -| config | [Configuration](js-apis-application-configuration.md) | Yes| No| Configuration information.| - -## AbilityContext.startAbility - -startAbility(want: Want, callback: AsyncCallback<void>): void; - -Starts an ability. This API uses an asynchronous callback to return the result. - -Observe the following when using this API: - - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - - For details about the startup rules for the components in the stage model, see [Component Startup Rules (Stage Model)](../../application-models/component-startup-rules.md). - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| want | [Want](js-apis-application-want.md) | Yes| Want information about the target ability.| -| callback | AsyncCallback<void> | Yes| Callback used to return the result.| - -**Error codes** - -| ID| Error Message| -| ------- | -------------------------------- | -| 401 | If the input parameter is not valid parameter. | - -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). - -**Example** - - ```ts - var want = { - bundleName: "com.example.myapplication", - abilityName: "MyAbility" - }; - - try { - this.context.startAbility(want, (error) => { - if (error.code) { - // Process service logic errors. - console.log('startAbility failed, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); - return; - } - // Carry out normal service processing. - console.log('startAbility succeed'); - }); - } catch (paramError) { - // Process input parameter errors. - console.log('error.code: ' + JSON.stringify(paramError.code) + - ' error.message: ' + JSON.stringify(paramError.message)); - } - ``` - - -## AbilityContext.startAbility - -startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void>): void; - -Starts an ability with the start options specified. This API uses an asynchronous callback to return the result. - -Observe the following when using this API: - - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - - For details about the startup rules for the components in the stage model, see [Component Startup Rules (Stage Model)](../../application-models/component-startup-rules.md). - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| want | [Want](js-apis-application-want.md) | Yes| Want information about the target ability.| -| options | [StartOptions](js-apis-application-startOptions.md) | Yes| Parameters used for starting the ability.| -| callback | AsyncCallback<void> | Yes| Callback used to return the result.| - -**Error codes** - -| ID| Error Message| -| ------- | -------------------------------- | -| 401 | If the input parameter is not valid parameter. | - -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). - -**Example** - - ```ts - var want = { - deviceId: "", - bundleName: "com.example.myapplication", - abilityName: "EntryAbility" - }; - var options = { - windowMode: 0 - }; - - try { - this.context.startAbility(want, options, (error) => { - if (error.code) { - // Process service logic errors. - console.log('startAbility failed, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); - return; - } - // Carry out normal service processing. - console.log('startAbility succeed'); - }); - } catch (paramError) { - // Process input parameter errors. - console.log('error.code: ' + JSON.stringify(paramError.code) + - ' error.message: ' + JSON.stringify(paramError.message)); - } - ``` - -## AbilityContext.startAbility - -startAbility(want: Want, options?: StartOptions): Promise<void>; - -Starts an ability. This API uses a promise to return the result. - -Observe the following when using this API: - - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - - For details about the startup rules for the components in the stage model, see [Component Startup Rules (Stage Model)](../../application-models/component-startup-rules.md). - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| want | [Want](js-apis-application-want.md) | Yes| Want information about the target ability.| -| options | [StartOptions](js-apis-application-startOptions.md) | No| Parameters used for starting the ability.| - -**Return value** - -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise used to return the result.| - -**Error codes** - -| ID| Error Message| -| ------- | -------------------------------- | -| 401 | If the input parameter is not valid parameter. | - -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). - -**Example** - - ```ts - var want = { - bundleName: "com.example.myapplication", - abilityName: "MyAbility" - }; - var options = { - windowMode: 0, - }; - - try { - this.context.startAbility(want, options) - .then((data) => { - // Carry out normal service processing. - console.log('startAbility succeed'); - }) - .catch((error) => { - // Process service logic errors. - console.log('startAbility failed, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); - }); - } catch (paramError) { - // Process input parameter errors. - console.log('error.code: ' + JSON.stringify(paramError.code) + - ' error.message: ' + JSON.stringify(paramError.message)); - } - ``` - - -## AbilityContext.startAbilityForResult - -startAbilityForResult(want: Want, callback: AsyncCallback<AbilityResult>): void; - -Starts an ability. After the ability is started, you can call [terminateSelfWithResult](#abilitycontextterminateselfwithresult) to terminate the ability and return the result to the caller. If an exception occurs, for example, the ability is killed, exception information is returned to the caller. This API uses an asynchronous callback to return the result. - -Observe the following when using this API: - - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - - For details about the startup rules for the components in the stage model, see [Component Startup Rules (Stage Model)](../../application-models/component-startup-rules.md). - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| want |[Want](js-apis-application-want.md) | Yes| Want information about the target ability.| -| callback | AsyncCallback<[AbilityResult](js-apis-inner-ability-abilityResult.md)> | Yes| Callback used to return the result.| - -**Error codes** - -| ID| Error Message| -| ------- | -------------------------------- | -| 401 | If the input parameter is not valid parameter. | - -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). - -**Example** - - ```ts - var want = { - deviceId: "", - bundleName: "com.example.myapplication", - abilityName: "EntryAbility" - }; - - try { - this.context.startAbilityForResult(want, (error, result) => { - if (error.code) { - // Process service logic errors. - console.log('startAbilityForResult failed, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); - return; - } - // Carry out normal service processing. - console.log("startAbilityForResult succeed, result.resultCode = " + - result.resultCode) - }); - } catch (paramError) { - // Process input parameter errors. - console.log('error.code: ' + JSON.stringify(paramError.code) + - ' error.message: ' + JSON.stringify(paramError.message)); - } - ``` - -## AbilityContext.startAbilityForResult - -startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback<AbilityResult>): void; - -Starts an ability with the start options specified. After the ability is started, you can call [terminateSelfWithResult](#abilitycontextterminateselfwithresult) to terminate the ability and return the result to the caller. If an exception occurs, for example, the ability is killed, exception information is returned to the caller. This API uses an asynchronous callback to return the result. - -Observe the following when using this API: - - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - - For details about the startup rules for the components in the stage model, see [Component Startup Rules (Stage Model)](../../application-models/component-startup-rules.md). - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| want |[Want](js-apis-application-want.md) | Yes| Want information about the target ability.| -| options | [StartOptions](js-apis-application-startOptions.md) | Yes| Parameters used for starting the ability.| -| callback | AsyncCallback<[AbilityResult](js-apis-inner-ability-abilityResult.md)> | Yes| Callback used to return the result.| - -**Error codes** - -| ID| Error Message| -| ------- | -------------------------------- | -| 401 | If the input parameter is not valid parameter. | - -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). - -**Example** - - ```ts - var want = { - deviceId: "", - bundleName: "com.example.myapplication", - abilityName: "EntryAbility" - }; - var options = { - windowMode: 0, - }; - - try { - this.context.startAbilityForResult(want, options, (error, result) => { - if (error.code) { - // Process service logic errors. - console.log('startAbilityForResult failed, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); - return; - } - // Carry out normal service processing. - console.log("startAbilityForResult succeed, result.resultCode = " + - result.resultCode) - }); - } catch (paramError) { - // Process input parameter errors. - console.log('error.code: ' + JSON.stringify(paramError.code) + - ' error.message: ' + JSON.stringify(paramError.message)); - } - ``` - - -## AbilityContext.startAbilityForResult - -startAbilityForResult(want: Want, options?: StartOptions): Promise<AbilityResult>; - -Starts an ability. After the ability is started, you can call [terminateSelfWithResult](#abilitycontextterminateselfwithresult) to terminate the ability and return the result to the caller. If an exception occurs, for example, the ability is killed, exception information is returned to the caller. This API uses a promise to return the result. - -Observe the following when using this API: - - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - - For details about the startup rules for the components in the stage model, see [Component Startup Rules (Stage Model)](../../application-models/component-startup-rules.md). - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| want | [Want](js-apis-application-want.md) | Yes| Want information about the target ability.| -| options | [StartOptions](js-apis-application-startOptions.md) | No| Parameters used for starting the ability.| - - -**Return value** - -| Type| Description| -| -------- | -------- | -| Promise<[AbilityResult](js-apis-inner-ability-abilityResult.md)> | Promise used to return the result.| - -**Error codes** - -| ID| Error Message| -| ------- | -------------------------------- | -| 401 | If the input parameter is not valid parameter. | - -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). - -**Example** - - ```ts - var want = { - bundleName: "com.example.myapplication", - abilityName: "MyAbility" - }; - var options = { - windowMode: 0, - }; - - try { - this.context.startAbilityForResult(want, options) - .then((result) => { - // Carry out normal service processing. - console.log("startAbilityForResult succeed, result.resultCode = " + result.resultCode); - }) - .catch((error) => { - // Process service logic errors. - console.log('startAbilityForResult failed, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); - }); - } catch (paramError) { - // Process input parameter errors. - console.log('error.code: ' + JSON.stringify(paramError.code) + - ' error.message: ' + JSON.stringify(paramError.message)); - } - ``` - -## AbilityContext.startAbilityForResultWithAccount - -startAbilityForResultWithAccount(want: Want, accountId: number, callback: AsyncCallback\): void; - -Starts an ability with the account ID specified. This API uses an asynchronous callback to return the result when the ability is terminated. - -Observe the following when using this API: - - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - - For details about the startup rules for the components in the stage model, see [Component Startup Rules (Stage Model)](../../application-models/component-startup-rules.md). - -**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (required only when the account ID is not the current user) - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**System API**: This is a system API and cannot be called by third-party applications. - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| want | [Want](js-apis-application-want.md) | Yes| Want information about the target ability.| -| accountId | number | Yes| ID of a system account. For details, see [getCreatedOsAccountsCount](js-apis-osAccount.md#getosaccountlocalidfromprocess).| -| callback | AsyncCallback\<[AbilityResult](js-apis-inner-ability-abilityResult.md)\> | Yes| Callback used to return the result.| - -**Error codes** - -| ID| Error Message| -| ------- | -------------------------------- | -| 401 | If the input parameter is not valid parameter. | - -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). - -**Example** - - ```ts - var want = { - deviceId: "", - bundleName: "com.example.myapplication", - abilityName: "EntryAbility" - }; - var accountId = 100; - - try { - this.context.startAbilityForResultWithAccount(want, accountId, (error, result) => { - if (error.code) { - // Process service logic errors. - console.log('startAbilityForResultWithAccount failed, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); - return; - } - // Carry out normal service processing. - console.log("startAbilityForResultWithAccount succeed, result.resultCode = " + - result.resultCode) - }); - } catch (paramError) { - // Process input parameter errors. - console.log('error.code: ' + JSON.stringify(paramError.code) + - ' error.message: ' + JSON.stringify(paramError.message)); - } - ``` - - -## AbilityContext.startAbilityForResultWithAccount - -startAbilityForResultWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback\): void; - -Starts an ability with the start options and account ID specified. This API uses an asynchronous callback to return the result when the ability is terminated. - -Observe the following when using this API: - - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - - For details about the startup rules for the components in the stage model, see [Component Startup Rules (Stage Model)](../../application-models/component-startup-rules.md). - -**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (required only when the account ID is not the current user) - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**System API**: This is a system API and cannot be called by third-party applications. - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| want | [Want](js-apis-application-want.md) | Yes| Want information about the target ability.| -| accountId | number | Yes| ID of a system account. For details, see [getCreatedOsAccountsCount](js-apis-osAccount.md#getosaccountlocalidfromprocess).| -| options | [StartOptions](js-apis-application-startOptions.md) | Yes| Parameters used for starting the ability.| -| callback | AsyncCallback\ | Yes| Callback used to return the result.| - -**Error codes** - -| ID| Error Message| -| ------- | -------------------------------- | -| 401 | If the input parameter is not valid parameter. | - -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). - -**Example** - - ```ts - var want = { - deviceId: "", - bundleName: "com.example.myapplication", - abilityName: "EntryAbility" - }; - var accountId = 100; - var options = { - windowMode: 0 - }; - - try { - this.context.startAbilityForResultWithAccount(want, accountId, options, (error, result) => { - if (error.code) { - // Process service logic errors. - console.log('startAbilityForResultWithAccount failed, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); - return; - } - // Carry out normal service processing. - console.log("startAbilityForResultWithAccount succeed, result.resultCode = " + - result.resultCode) - }); - } catch (paramError) { - // Process input parameter errors. - console.log('error.code: ' + JSON.stringify(paramError.code) + - ' error.message: ' + JSON.stringify(paramError.message)); - } - ``` - - -## AbilityContext.startAbilityForResultWithAccount - -startAbilityForResultWithAccount(want: Want, accountId: number, options?: StartOptions): Promise\; - -Starts an ability with the account ID specified. This API uses a promise to return the result when the ability is terminated. - -Observe the following when using this API: - - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - - For details about the startup rules for the components in the stage model, see [Component Startup Rules (Stage Model)](../../application-models/component-startup-rules.md). - -**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (required only when the account ID is not the current user) - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**System API**: This is a system API and cannot be called by third-party applications. - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| want | [Want](js-apis-application-want.md) | Yes| Want information about the target ability.| -| accountId | number | Yes| ID of a system account. For details, see [getCreatedOsAccountsCount](js-apis-osAccount.md#getosaccountlocalidfromprocess).| -| options | [StartOptions](js-apis-application-startOptions.md) | No| Parameters used for starting the ability.| - -**Return value** - -| Type| Description| -| -------- | -------- | -| Promise<[AbilityResult](js-apis-inner-ability-abilityResult.md)> | Promise used to return the result.| - -**Error codes** - -| ID| Error Message| -| ------- | -------------------------------- | -| 401 | If the input parameter is not valid parameter. | - -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). - -**Example** - - ```ts - var want = { - deviceId: "", - bundleName: "com.example.myapplication", - abilityName: "EntryAbility" - }; - var accountId = 100; - var options = { - windowMode: 0 - }; - - try { - this.context.startAbilityForResultWithAccount(want, accountId, options) - .then((result) => { - // Carry out normal service processing. - console.log("startAbilityForResultWithAccount succeed, result.resultCode = " + - result.resultCode) - }) - .catch((error) => { - // Process service logic errors. - console.log('startAbilityForResultWithAccount failed, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); - }); - } catch (paramError) { - // Process input parameter errors. - console.log('error.code: ' + JSON.stringify(paramError.code) + - ' error.message: ' + JSON.stringify(paramError.message)); - } - ``` -## AbilityContext.startServiceExtensionAbility - -startServiceExtensionAbility(want: Want, callback: AsyncCallback\): void; - -Starts a ServiceExtensionAbility. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**System API**: This is a system API and cannot be called by third-party applications. - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| want | [Want](js-apis-application-want.md) | Yes| Want information about the target ability.| -| callback | AsyncCallback\ | Yes| Callback used to return the result.| - -**Error codes** - -| ID| Error Message| -| ------- | -------------------------------- | -| 401 | If the input parameter is not valid parameter. | - -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). - -**Example** - - ```ts - var want = { - deviceId: "", - bundleName: "com.example.myapplication", - abilityName: "EntryAbility" - }; - - try { - this.context.startServiceExtensionAbility(want, (error) => { - if (error.code) { - // Process service logic errors. - console.log('startServiceExtensionAbility failed, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); - return; - } - // Carry out normal service processing. - console.log('startServiceExtensionAbility succeed'); - }); - } catch (paramError) { - // Process input parameter errors. - console.log('error.code: ' + JSON.stringify(paramError.code) + - ' error.message: ' + JSON.stringify(paramError.message)); - } - ``` - -## AbilityContext.startServiceExtensionAbility - -startServiceExtensionAbility(want: Want): Promise\; - -Starts a ServiceExtensionAbility. This API uses a promise to return the result. - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**System API**: This is a system API and cannot be called by third-party applications. - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| want | [Want](js-apis-application-want.md) | Yes| Want information about the target ability.| - -**Error codes** - -| ID| Error Message| -| ------- | -------------------------------- | -| 401 | If the input parameter is not valid parameter. | - -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). - -**Example** - - ```ts - var want = { - deviceId: "", - bundleName: "com.example.myapplication", - abilityName: "EntryAbility" - }; - - try { - this.context.startServiceExtensionAbility(want) - .then((data) => { - // Carry out normal service processing. - console.log('startServiceExtensionAbility succeed'); - }) - .catch((error) => { - // Process service logic errors. - console.log('startServiceExtensionAbility failed, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); - }); - } catch (paramError) { - // Process input parameter errors. - console.log('error.code: ' + JSON.stringify(paramError.code) + - ' error.message: ' + JSON.stringify(paramError.message)); - } - ``` - -## AbilityContext.startServiceExtensionAbilityWithAccount - -startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\): void; - -Starts a ServiceExtensionAbility with the account ID specified. This API uses an asynchronous callback to return the result. - -**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (required only when the account ID is not the current user) - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**System API**: This is a system API and cannot be called by third-party applications. - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| want | [Want](js-apis-application-want.md) | Yes| Want information about the target ability.| -| accountId | number | Yes| ID of a system account. For details, see [getCreatedOsAccountsCount](js-apis-osAccount.md#getosaccountlocalidfromprocess).| -| callback | AsyncCallback\ | Yes| Callback used to return the result.| - -**Error codes** - -| ID| Error Message| -| ------- | -------------------------------- | -| 401 | If the input parameter is not valid parameter. | - -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). - -**Example** - - ```ts - var want = { - deviceId: "", - bundleName: "com.example.myapplication", - abilityName: "EntryAbility" - }; - var accountId = 100; - - try { - this.context.startServiceExtensionAbilityWithAccount(want, accountId, (error) => { - if (error.code) { - // Process service logic errors. - console.log('startServiceExtensionAbilityWithAccount failed, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); - return; - } - // Carry out normal service processing. - console.log('startServiceExtensionAbilityWithAccount succeed'); - }); - } catch (paramError) { - // Process input parameter errors. - console.log('error.code: ' + JSON.stringify(paramError.code) + - ' error.message: ' + JSON.stringify(paramError.message)); - } - ``` - -## AbilityContext.startServiceExtensionAbilityWithAccount - -startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise\; - -Starts a ServiceExtensionAbility with the account ID specified. This API uses a promise to return the result. - -**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (required only when the account ID is not the current user) - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**System API**: This is a system API and cannot be called by third-party applications. - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| want | [Want](js-apis-application-want.md) | Yes| Want information about the target ability.| -| accountId | number | Yes| ID of a system account. For details, see [getCreatedOsAccountsCount](js-apis-osAccount.md#getosaccountlocalidfromprocess).| - -**Error codes** - -| ID| Error Message| -| ------- | -------------------------------- | -| 401 | If the input parameter is not valid parameter. | - -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). - -**Example** - - ```ts - var want = { - deviceId: "", - bundleName: "com.example.myapplication", - abilityName: "EntryAbility" - }; - var accountId = 100; - - try { - this.context.startServiceExtensionAbilityWithAccount(want, accountId) - .then((data) => { - // Carry out normal service processing. - console.log('startServiceExtensionAbilityWithAccount succeed'); - }) - .catch((error) => { - // Process service logic errors. - console.log('startServiceExtensionAbilityWithAccount failed, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); - }); - } catch (paramError) { - // Process input parameter errors. - console.log('error.code: ' + JSON.stringify(paramError.code) + - ' error.message: ' + JSON.stringify(paramError.message)); - } - ``` -## AbilityContext.stopServiceExtensionAbility - -stopServiceExtensionAbility(want: Want, callback: AsyncCallback\): void; - -Stops a ServiceExtensionAbility in the same application. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**System API**: This is a system API and cannot be called by third-party applications. - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| want | [Want](js-apis-application-want.md) | Yes| Want information about the target ability.| -| callback | AsyncCallback\ | Yes| Callback used to return the result.| - -**Error codes** - -| ID| Error Message| -| ------- | -------------------------------- | -| 401 | If the input parameter is not valid parameter. | - -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). - -**Example** - - ```ts - var want = { - deviceId: "", - bundleName: "com.example.myapplication", - abilityName: "EntryAbility" - }; - - try { - this.context.startAbility(want, (error) => { - if (error.code != 0) { - console.log("start ability fail, err: " + JSON.stringify(err)); - } - }) - - this.context.stopServiceExtensionAbility(want, (error) => { - if (error.code != 0) { - // Process service logic errors. - console.log('stopServiceExtensionAbility failed, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); - return; - } - // Carry out normal service processing. - console.log('stopServiceExtensionAbility succeed'); - }); - } catch (paramError) { - // Process input parameter errors. - console.log('error.code: ' + JSON.stringify(paramError.code) + - ' error.message: ' + JSON.stringify(paramError.message)); - } - ``` - -## AbilityContext.stopServiceExtensionAbility - -stopServiceExtensionAbility(want: Want): Promise\; - -Stops a ServiceExtensionAbility in the same application. This API uses a promise to return the result. - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**System API**: This is a system API and cannot be called by third-party applications. - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| want | [Want](js-apis-application-want.md) | Yes| Want information about the target ability.| - -**Error codes** - -| ID| Error Message| -| ------- | -------------------------------- | -| 401 | If the input parameter is not valid parameter. | - -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). - -**Example** - - ```ts - var want = { - deviceId: "", - bundleName: "com.example.myapplication", - abilityName: "EntryAbility" - }; - - try { - this.context.startAbility(want, (error) => { - if (error.code != 0) { - console.log("start ability fail, err: " + JSON.stringify(err)); - } - }) - - this.context.stopServiceExtensionAbility(want) - .then((data) => { - // Carry out normal service processing. - console.log('stopServiceExtensionAbility succeed'); - }) - .catch((error) => { - // Process service logic errors. - console.log('stopServiceExtensionAbility failed, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); - }); - } catch (paramError) { - // Process input parameter errors. - console.log('error.code: ' + JSON.stringify(paramError.code) + - ' error.message: ' + JSON.stringify(paramError.message)); - } - ``` - -## AbilityContext.stopServiceExtensionAbilityWithAccount - -stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\): void; - -Stops a ServiceExtensionAbility in the same application with the account ID specified. This API uses an asynchronous callback to return the result. - -**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (required only when the account ID is not the current user) - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**System API**: This is a system API and cannot be called by third-party applications. - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| want | [Want](js-apis-application-want.md) | Yes| Want information about the target ability.| -| accountId | number | Yes| ID of a system account. For details, see [getCreatedOsAccountsCount](js-apis-osAccount.md#getosaccountlocalidfromprocess).| -| callback | AsyncCallback\ | Yes| Callback used to return the result.| - -**Error codes** - -| ID| Error Message| -| ------- | -------------------------------- | -| 401 | If the input parameter is not valid parameter. | - -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). - -**Example** - - ```ts - var want = { - deviceId: "", - bundleName: "com.example.myapplication", - abilityName: "EntryAbility" - }; - var accountId = 100; - - try { - this.context.startAbilityWithAccount(want, accountId, (error) => { - if (error.code != 0) { - console.log("start ability fail, err: " + JSON.stringify(err)); - } - }) - - this.context.stopServiceExtensionAbilityWithAccount(want, accountId, (error) => { - if (error.code) { - // Process service logic errors. - console.log('stopServiceExtensionAbilityWithAccount failed, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); - return; - } - // Carry out normal service processing. - console.log('stopServiceExtensionAbilityWithAccount succeed'); - }); - } catch (paramError) { - // Process input parameter errors. - console.log('error.code: ' + JSON.stringify(paramError.code) + - ' error.message: ' + JSON.stringify(paramError.message)); - } - ``` - -## AbilityContext.stopServiceExtensionAbilityWithAccount - -stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise\; - -Stops a ServiceExtensionAbility in the same application with the account ID specified. This API uses a promise to return the result. - -**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (required only when the account ID is not the current user) - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**System API**: This is a system API and cannot be called by third-party applications. - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| want | [Want](js-apis-application-want.md) | Yes| Want information about the target ability.| -| accountId | number | Yes| ID of a system account. For details, see [getCreatedOsAccountsCount](js-apis-osAccount.md#getosaccountlocalidfromprocess).| - -**Error codes** - -| ID| Error Message| -| ------- | -------------------------------- | -| 401 | If the input parameter is not valid parameter. | - -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). - -**Example** - - ```ts - var want = { - deviceId: "", - bundleName: "com.example.myapplication", - abilityName: "EntryAbility" - }; - var accountId = 100; - - try { - this.context.startAbilityWithAccount(want, accountId, (error) => { - if (error.code != 0) { - console.log("start ability fail, err: " + JSON.stringify(err)); - } - }) - - this.context.stopServiceExtensionAbilityWithAccount(want, accountId) - .then((data) => { - // Carry out normal service processing. - console.log('stopServiceExtensionAbilityWithAccount succeed'); - }) - .catch((error) => { - // Process service logic errors. - console.log('stopServiceExtensionAbilityWithAccount failed, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); - }); - } catch (paramError) { - // Process input parameter errors. - console.log('error.code: ' + JSON.stringify(paramError.code) + - ' error.message: ' + JSON.stringify(paramError.message)); - } - ``` - -## AbilityContext.terminateSelf - -terminateSelf(callback: AsyncCallback<void>): void; - -Terminates this ability. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<void> | Yes| Callback used to return the result.| - -**Error codes** - -| ID| Error Message| -| ------- | -------------------------------- | -| 401 | If the input parameter is not valid parameter. | - -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). - -**Example** - - ```ts - this.context.terminateSelf((error) => { - if (error.code) { - // Process service logic errors. - console.log('terminateSelf failed, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); - return; - } - // Carry out normal service processing. - console.log('terminateSelf succeed'); - }); - ``` - - -## AbilityContext.terminateSelf - -terminateSelf(): Promise<void>; - -Terminates this ability. This API uses a promise to return the result. - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**Return value** - -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise used to return the result.| - -**Error codes** - -| ID| Error Message| -| ------- | -------------------------------- | -| 401 | If the input parameter is not valid parameter. | - -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). - -**Example** - - ```ts - this.context.terminateSelf().then((data) => { - // Carry out normal service processing. - console.log('terminateSelf succeed'); - }).catch((error) => { - // Process service logic errors. - console.log('terminateSelf failed, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); - }); - ``` - - -## AbilityContext.terminateSelfWithResult - -terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback<void>): void; - -Terminates this ability. If the ability is started by calling [startAbilityForResult](#abilitycontextstartabilityforresult), the result is returned to the caller in the form of a callback when **terminateSelfWithResult** is called. Otherwise, no result is returned to the caller when **terminateSelfWithResult** is called. - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| parameter | [AbilityResult](js-apis-inner-ability-abilityResult.md) | Yes| Information returned to the caller.| -| callback | AsyncCallback<void> | Yes| Callback used to return the result.| - -**Error codes** - -| ID| Error Message| -| ------- | -------------------------------- | -| 401 | If the input parameter is not valid parameter. | - -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). - -**Example** - - ```ts - var want = { - bundleName: "com.extreme.myapplication", - abilityName: "SecondAbility" - } - var resultCode = 100; - // AbilityResult information returned to the caller. - var abilityResult = { - want, - resultCode - } - - try { - this.context.terminateSelfWithResult(abilityResult, (error) => { - if (error.code) { - // Process service logic errors. - console.log('terminateSelfWithResult failed, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); - return; - } - // Carry out normal service processing. - console.log('terminateSelfWithResult succeed'); - }); - } catch (paramError) { - // Process input parameter errors. - console.log('error.code: ' + JSON.stringify(paramError.code) + - ' error.message: ' + JSON.stringify(paramError.message)); - } - ``` - - -## AbilityContext.terminateSelfWithResult - -terminateSelfWithResult(parameter: AbilityResult): Promise<void>; -Terminates this ability. If the ability is started by calling [startAbilityForResult](#abilitycontextstartabilityforresult), the result is returned to the caller in the form of a promise when **terminateSelfWithResult** is called. Otherwise, no result is returned to the caller when **terminateSelfWithResult** is called. - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| parameter | [AbilityResult](js-apis-inner-ability-abilityResult.md) | Yes| Information returned to the caller.| - -**Return value** - -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise used to return the result.| - -**Error codes** - -| ID| Error Message| -| ------- | -------------------------------- | -| 401 | If the input parameter is not valid parameter. | - -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). - - -**Example** - - ```ts - var want = { - bundleName: "com.extreme.myapplication", - abilityName: "SecondAbility" - } - var resultCode = 100; - // AbilityResult information returned to the caller. - var abilityResult = { - want, - resultCode - } - - try { - this.context.terminateSelfWithResult(abilityResult) - .then((data) => { - // Carry out normal service processing. - console.log('terminateSelfWithResult succeed'); - }) - .catch((error) => { - // Process service logic errors. - console.log('terminateSelfWithResult failed, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); - }); - } catch (paramError) { - // Process input parameter errors. - console.log('error.code: ' + JSON.stringify(paramError.code) + - ' error.message: ' + JSON.stringify(paramError.message)); - } - ``` - -## AbilityContext.connectServiceExtensionAbility - -connectServiceExtensionAbility(want: Want, options: ConnectOptions): number; - -Uses the **AbilityInfo.AbilityType.SERVICE** template to connect this ability to another ability. - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**System API**: This is a system API and cannot be called by third-party applications. - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| want | [Want](js-apis-application-want.md) | Yes| Want information about the target ability.| -| options | [ConnectOptions](js-apis-inner-ability-connectOptions.md) | Yes| Parameters for the connection.| - -**Return value** - -| Type| Description| -| -------- | -------- | -| number | Result code of the ability connection.| - -**Error codes** - -| ID| Error Message| -| ------- | -------------------------------- | -| 401 | If the input parameter is not valid parameter. | - -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). - -**Example** - - ```ts - var want = { - deviceId: "", - bundleName: "com.example.myapplication", - abilityName: "EntryAbility" - }; - var options = { - onConnect(elementName, remote) { console.log('----------- onConnect -----------') }, - onDisconnect(elementName) { console.log('----------- onDisconnect -----------') }, - onFailed(code) { console.log('----------- onFailed -----------') } - } - - var connection = null; - try { - connection = this.context.connectServiceExtensionAbility(want, options); - } catch (paramError) { - // Process input parameter errors. - console.log('error.code: ' + JSON.stringify(paramError.code) + - ' error.message: ' + JSON.stringify(paramError.message)); - } - ``` - - -## AbilityContext.connectServiceExtensionAbilityWithAccount - -connectServiceExtensionAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number; - -Uses the **AbilityInfo.AbilityType.SERVICE** template to connect this ability to another ability with the account ID specified. - -**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (required only when the account ID is not the current user) - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**System API**: This is a system API and cannot be called by third-party applications. - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| want | [Want](js-apis-application-want.md) | Yes| Want information about the target ability.| -| accountId | number | Yes| ID of a system account. For details, see [getCreatedOsAccountsCount](js-apis-osAccount.md#getosaccountlocalidfromprocess).| -| options | [ConnectOptions](js-apis-inner-ability-connectOptions.md) | Yes| Parameters for the connection.| - -**Return value** - -| Type| Description| -| -------- | -------- | -| number | Result code of the ability connection.| - -**Error codes** - -| ID| Error Message| -| ------- | -------------------------------- | -| 401 | If the input parameter is not valid parameter. | - -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). - -**Example** - - ```ts - var want = { - deviceId: "", - bundleName: "com.example.myapplication", - abilityName: "EntryAbility" - }; - var accountId = 100; - var options = { - onConnect(elementName, remote) { console.log('----------- onConnect -----------') }, - onDisconnect(elementName) { console.log('----------- onDisconnect -----------') }, - onFailed(code) { console.log('----------- onFailed -----------') } - } - - var connection = null; - try { - connection = this.context.connectServiceExtensionAbilityWithAccount(want, accountId, options); - } catch (paramError) { - // Process input parameter errors. - console.log('error.code: ' + JSON.stringify(paramError.code) + - ' error.message: ' + JSON.stringify(paramError.message)); - } - ``` - -## AbilityContext.disconnectServiceExtensionAbility - -disconnectServiceExtensionAbility(connection: number): Promise\; - -Disconnects a connection. This API uses a promise to return the result. - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| connection | number | Yes| Result code of the ability connection.| - -**Return value** - -| Type| Description| -| -------- | -------- | -| Promise\ | Promise used to return the result.| - -**Error codes** - -| ID| Error Message| -| ------- | -------------------------------- | -| 401 | If the input parameter is not valid parameter. | - -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). - -**Example** - - ```ts - // connection is the return value of connectServiceExtensionAbility. - var connection = 1; - - try { - this.context.disconnectServiceExtensionAbility(connection) - .then((data) => { - // Carry out normal service processing. - console.log('disconnectServiceExtensionAbility succeed'); - }) - .catch((error) => { - // Process service logic errors. - console.log('disconnectServiceExtensionAbility failed, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); - }); - } catch (paramError) { - // Process input parameter errors. - console.log('error.code: ' + JSON.stringify(paramError.code) + - ' error.message: ' + JSON.stringify(paramError.message)); - } - ``` - -## AbilityContext.disconnectServiceExtensionAbility - -disconnectServiceExtensionAbility(connection: number, callback:AsyncCallback\): void; - -Disconnects a connection. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| connection | number | Yes| Result code of the ability connection.| -| callback | AsyncCallback\ | Yes| Callback used to return the result.| - -**Error codes** - -| ID| Error Message| -| ------- | -------------------------------- | -| 401 | If the input parameter is not valid parameter. | - -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). - -**Example** - - ```ts - // connection is the return value of connectServiceExtensionAbility. - var connection = 1; - - try { - this.context.disconnectServiceExtensionAbility(connection, (error) => { - if (error.code) { - // Process service logic errors. - console.log('disconnectServiceExtensionAbility failed, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); - return; - } - // Carry out normal service processing. - console.log('disconnectServiceExtensionAbility succeed'); - }); - } catch (paramError) { - // Process input parameter errors. - console.log('error.code: ' + JSON.stringify(paramError.code) + - ' error.message: ' + JSON.stringify(paramError.message)); - } - ``` - -## AbilityContext.startAbilityByCall - -startAbilityByCall(want: Want): Promise<Caller>; - -Starts an ability in the foreground or background and obtains the caller object for communicating with the ability. - -Observe the following when using this API: - - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - - The rules for using this API in the same-device and cross-device scenarios are different. For details, see [Component Startup Rules (Stage Model)](../../application-models/component-startup-rules.md). - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**System API**: This is a system API and cannot be called by third-party applications. - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| want | [Want](js-apis-application-want.md) | Yes| Information about the ability to start, including **abilityName**, **moduleName**, **bundleName**, **deviceId** (optional), and **parameters** (optional). If **deviceId** is left blank or null, the local ability is started. If **parameters** is left blank or null, the ability is started in the background.| - -**Return value** - -| Type| Description| -| -------- | -------- | -| Promise<Caller> | Promise used to return the caller object to communicate with.| - -**Example** - - Start an ability in the background. - - ```ts - var caller = undefined; - - // Start an ability in the background by not passing parameters. - var wantBackground = { - bundleName: "com.example.myservice", - moduleName: "entry", - abilityName: "EntryAbility", - deviceId: "" - }; - - try { - this.context.startAbilityByCall(wantBackground) - .then((obj) => { - // Carry out normal service processing. - caller = obj; - console.log('startAbilityByCall succeed'); - }).catch((error) => { - // Process service logic errors. - console.log('startAbilityByCall failed, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); - }); - } catch (paramError) { - // Process input parameter errors. - console.log('error.code: ' + JSON.stringify(paramError.code) + - ' error.message: ' + JSON.stringify(paramError.message)); - } - ``` - - Start an ability in the foreground. - - ```ts - var caller = undefined; - - // Start an ability in the foreground with ohos.aafwk.param.callAbilityToForeground in parameters set to true. - var wantForeground = { - bundleName: "com.example.myservice", - moduleName: "entry", - abilityName: "EntryAbility", - deviceId: "", - parameters: { - "ohos.aafwk.param.callAbilityToForeground": true - } - }; - - try { - this.context.startAbilityByCall(wantForeground) - .then((obj) => { - // Carry out normal service processing. - caller = obj; - console.log('startAbilityByCall succeed'); - }).catch((error) => { - // Process service logic errors. - console.log('startAbilityByCall failed, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); - }); - } catch (paramError) { - // Process input parameter errors. - console.log('error.code: ' + JSON.stringify(paramError.code) + - ' error.message: ' + JSON.stringify(paramError.message)); - } - ``` - -## AbilityContext.startAbilityWithAccount - -startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\): void; - -Starts an ability with the account ID specified. This API uses an asynchronous callback to return the result. - -Observe the following when using this API: - - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - - For details about the startup rules for the components in the stage model, see [Component Startup Rules (Stage Model)](../../application-models/component-startup-rules.md). - -**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (required only when the account ID is not the current user) - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**System API**: This is a system API and cannot be called by third-party applications. - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| want | [Want](js-apis-application-want.md) | Yes| Want information about the target ability.| -| accountId | number | Yes| ID of a system account. For details, see [getCreatedOsAccountsCount](js-apis-osAccount.md#getosaccountlocalidfromprocess).| -| callback | AsyncCallback\ | Yes| Callback used to return the result.| - -**Error codes** - -| ID| Error Message| -| ------- | -------------------------------- | -| 401 | If the input parameter is not valid parameter. | - -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). - -**Example** - - ```ts - var want = { - deviceId: "", - bundleName: "com.example.myapplication", - abilityName: "EntryAbility" - }; - var accountId = 100; - - try { - this.context.startAbilityWithAccount(want, accountId, (error) => { - if (error.code) { - // Process service logic errors. - console.log('startAbilityWithAccount failed, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); - return; - } - // Carry out normal service processing. - console.log('startAbilityWithAccount succeed'); - }); - } catch (paramError) { - // Process input parameter errors. - console.log('error.code: ' + JSON.stringify(paramError.code) + - ' error.message: ' + JSON.stringify(paramError.message)); - } - ``` - - -## AbilityContext.startAbilityWithAccount - -startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback\): void; - -Starts an ability with the account ID and start options specified. This API uses an asynchronous callback to return the result. - -Observe the following when using this API: - - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - - For details about the startup rules for the components in the stage model, see [Component Startup Rules (Stage Model)](../../application-models/component-startup-rules.md). - -**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (required only when the account ID is not the current user) - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**System API**: This is a system API and cannot be called by third-party applications. - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| want | [Want](js-apis-application-want.md) | Yes| Want information about the target ability.| -| accountId | number | Yes| ID of a system account. For details, see [getCreatedOsAccountsCount](js-apis-osAccount.md#getosaccountlocalidfromprocess).| -| options | [StartOptions](js-apis-application-startOptions.md) | Yes| Parameters used for starting the ability.| -| callback | AsyncCallback\ | Yes| Callback used to return the result.| - -**Error codes** - -| ID| Error Message| -| ------- | -------------------------------- | -| 401 | If the input parameter is not valid parameter. | - -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). - -**Example** - - ```ts - var want = { - deviceId: "", - bundleName: "com.example.myapplication", - abilityName: "EntryAbility" - }; - var accountId = 100; - var options = { - windowMode: 0 - }; - - try { - this.context.startAbilityWithAccount(want, accountId, options, (error) => { - if (error.code) { - // Process service logic errors. - console.log('startAbilityWithAccount failed, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); - return; - } - // Carry out normal service processing. - console.log('startAbilityWithAccount succeed'); - }); - } catch (paramError) { - // Process input parameter errors. - console.log('error.code: ' + JSON.stringify(paramError.code) + - ' error.message: ' + JSON.stringify(paramError.message)); - } - ``` - - -## AbilityContext.startAbilityWithAccount - -startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): Promise\; - -Starts an ability with the account ID specified. This API uses a promise to return the result. - -Observe the following when using this API: - - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - - For details about the startup rules for the components in the stage model, see [Component Startup Rules (Stage Model)](../../application-models/component-startup-rules.md). - -**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (required only when the account ID is not the current user) - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**System API**: This is a system API and cannot be called by third-party applications. - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| want | [Want](js-apis-application-want.md) | Yes| Want information about the target ability.| -| accountId | number | Yes| ID of a system account. For details, see [getCreatedOsAccountsCount](js-apis-osAccount.md#getosaccountlocalidfromprocess).| -| options | [StartOptions](js-apis-application-startOptions.md) | No| Parameters used for starting the ability.| - -**Error codes** - -| ID| Error Message| -| ------- | -------------------------------- | -| 401 | If the input parameter is not valid parameter. | - -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). - -**Example** - - ```ts - var want = { - deviceId: "", - bundleName: "com.example.myapplication", - abilityName: "EntryAbility" - }; - var accountId = 100; - var options = { - windowMode: 0 - }; - - try { - this.context.startAbilityWithAccount(want, accountId, options) - .then((data) => { - // Carry out normal service processing. - console.log('startAbilityWithAccount succeed'); - }) - .catch((error) => { - // Process service logic errors. - console.log('startAbilityWithAccount failed, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); - }); - } catch (paramError) { - // Process input parameter errors. - console.log('error.code: ' + JSON.stringify(paramError.code) + - ' error.message: ' + JSON.stringify(paramError.message)); - } - ``` - -## AbilityContext.setMissionLabel - -setMissionLabel(label: string, callback:AsyncCallback<void>): void; - -Sets a label for this ability in the mission. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| label | string | Yes| Label of the ability to set.| -| callback | AsyncCallback<void> | Yes| Callback used to return the result.| - -**Example** - - ```ts - this.context.setMissionLabel("test",(result) => { - console.log('setMissionLabel result:' + JSON.stringify(result)); - }); - ``` - - -## AbilityContext.setMissionLabel - -setMissionLabel(label: string): Promise<void>; - -Sets a label for this ability in the mission. This API uses a promise to return the result. - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| label | string | Yes| Label of the ability to set.| - -**Return value** - -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise used to return the result.| - -**Example** - - ```ts - this.context.setMissionLabel("test").then(() => { - console.log('success'); - }).catch((error) => { - console.log('failed:' + JSON.stringify(error)); - }); - ``` -## AbilityContext.setMissionIcon - -setMissionIcon(icon: image.PixelMap, callback:AsyncCallback\): void; - -Sets an icon for this ability in the mission. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**System API**: This is a system API and cannot be called by third-party applications. - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| icon | [image.PixelMap](js-apis-image.md#pixelmap7) | Yes| Icon of the ability to set.| -| callback | AsyncCallback\ | Yes| Callback used to return the result.| - -**Example** - - ```ts - import image from '@ohos.multimedia.image'; - var imagePixelMap; - var color = new ArrayBuffer(0); - var initializationOptions = { - size: { - height: 100, - width: 100 - } - }; - image.createPixelMap(color, initializationOptions) - .then((data) => { - imagePixelMap = data; - }) - .catch((err) => { - console.log('--------- createPixelMap fail, err: ---------', err) - }); - this.context.setMissionIcon(imagePixelMap, (err) => { - console.log('---------- setMissionIcon fail, err: -----------', err); - }) - ``` - - -## AbilityContext.setMissionIcon - -setMissionIcon(icon: image.PixelMap): Promise\; - -Sets an icon for this ability in the mission. This API uses a promise to return the result. - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**System API**: This is a system API and cannot be called by third-party applications. - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| icon | [image.PixelMap](js-apis-image.md#pixelmap7) | Yes| Icon of the ability to set.| - -**Return value** - -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise used to return the result.| - -**Example** - - ```ts - import image from '@ohos.multimedia.image'; - var imagePixelMap; - var color = new ArrayBuffer(0); - var initializationOptions = { - size: { - height: 100, - width: 100 - } - }; - image.createPixelMap(color, initializationOptions) - .then((data) => { - imagePixelMap = data; - }) - .catch((err) => { - console.log('--------- createPixelMap fail, err: ---------', err) - }); - this.context.setMissionIcon(imagePixelMap) - .then(() => { - console.log('-------------- setMissionIcon success -------------'); - }) - .catch((err) => { - console.log('-------------- setMissionIcon fail, err: -------------', err); - }); - ``` -## AbilityContext.restoreWindowStage - -restoreWindowStage(localStorage: LocalStorage) : void; - -Restores the window stage data for this ability. - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| localStorage | LocalStorage | Yes| Storage used to store the restored window stage.| - -**Example** - - ```ts - var storage = new LocalStorage(); - this.context.restoreWindowStage(storage); - ``` - -## AbilityContext.isTerminating - -isTerminating(): boolean; - -Checks whether this ability is in the terminating state. - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**Return value** - -| Type| Description| -| -------- | -------- | -| boolean| The value **true** means that the ability is in the terminating state, and **false** means the opposite.| - -**Example** - - ```ts - var isTerminating = this.context.isTerminating(); - console.log('ability state :' + isTerminating); - ``` diff --git a/en/application-dev/reference/apis/js-apis-ability-dataUriUtils.md b/en/application-dev/reference/apis/js-apis-ability-dataUriUtils.md index f1301ad877dcf5a0bd2fec5ad5be10452ee88716..0f098c2398a1a3559f3a25873a8fe2cc81c3a898 100644 --- a/en/application-dev/reference/apis/js-apis-ability-dataUriUtils.md +++ b/en/application-dev/reference/apis/js-apis-ability-dataUriUtils.md @@ -35,7 +35,7 @@ Obtains the ID attached to the end of a given URI. **Example** ```ts -let id = dataUriUtils.getId("com.example.dataUriUtils/1221"); +let id = dataUriUtils.getId('com.example.dataUriUtils/1221'); ``` @@ -66,9 +66,9 @@ Attaches an ID to the end of a given URI. ```ts let id = 1122; let uri = dataUriUtils.attachId( - "com.example.dataUriUtils", + 'com.example.dataUriUtils', id, -) +); ``` @@ -96,7 +96,7 @@ Deletes the ID from the end of a given URI. **Example** ```ts -let uri = dataUriUtils.deleteId("com.example.dataUriUtils/1221") +let uri = dataUriUtils.deleteId('com.example.dataUriUtils/1221'); ``` @@ -127,7 +127,7 @@ Updates the ID in a given URI. ```ts let id = 1122; let uri = dataUriUtils.updateId( - "com.example.dataUriUtils/1221", + 'com.example.dataUriUtils/1221', id -) +); ``` diff --git a/en/application-dev/reference/apis/js-apis-ability-errorCode.md b/en/application-dev/reference/apis/js-apis-ability-errorCode.md index dc0e8ae8928a9191f70b555e84a3f58b09e4b876..143a2344a935a013e664bde170ef615e0f6acfba 100644 --- a/en/application-dev/reference/apis/js-apis-ability-errorCode.md +++ b/en/application-dev/reference/apis/js-apis-ability-errorCode.md @@ -9,7 +9,7 @@ The **ErrorCode** module defines the error codes that may be returned when an ab ## Modules to Import ```ts -import errorCode from '@ohos.ability.errorCode' +import errorCode from '@ohos.ability.errorCode'; ``` ## ErrorCode diff --git a/en/application-dev/reference/apis/js-apis-ability-wantConstant.md b/en/application-dev/reference/apis/js-apis-ability-wantConstant.md index 87b52688c5bec0a80bc44d9c8dcba63fe00283f2..776faa162b5178cec3bf003aedc018c17ab17084 100644 --- a/en/application-dev/reference/apis/js-apis-ability-wantConstant.md +++ b/en/application-dev/reference/apis/js-apis-ability-wantConstant.md @@ -44,7 +44,7 @@ Enumerates the action constants of the **Want** object. **action** specifies the | INTENT_PARAMS_INTENT | ability.want.params.INTENT | Action of displaying selection options with an action selector. | | INTENT_PARAMS_TITLE | ability.want.params.TITLE | Title of the character sequence dialog box used with the action selector. | | ACTION_FILE_SELECT7+ | ohos.action.fileSelect | Action of selecting a file. | -| PARAMS_STREAM7+ | ability.params.stream | URI of the data stream associated with the target when the data is sent. | +| PARAMS_STREAM7+ | ability.params.stream | URI of the data stream associated with the target when the data is sent. The value must be an array of the string type. | | ACTION_APP_ACCOUNT_OAUTH 8+ | ohos.account.appAccount.action.oauth | Action of providing the OAuth service. | | ACTION_APP_ACCOUNT_AUTH 9+ | account.appAccount.action.auth | Action of providing the authentication service. | | ACTION_MARKET_DOWNLOAD 9+ | ohos.want.action.marketDownload | Action of downloading an application from the application market.
**System API**: This is a system API and cannot be called by third-party applications. | diff --git a/en/application-dev/reference/apis/js-apis-app-ability-abilityManager.md b/en/application-dev/reference/apis/js-apis-app-ability-abilityManager.md index 4f755c8fe2814c4b95e26e106712abc73845fb7d..e508a036945ffac70fd08862585a3d0ea5731aab 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-abilityManager.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-abilityManager.md @@ -21,14 +21,14 @@ Enumerates the ability states. This enum can be used together with [AbilityRunni **System API**: This enum is an internal definition of a system API and cannot be called by third-party applications. -| Name| Value| Description| +| Name| Value| Description| | -------- | -------- | -------- | -| INITIAL | 0 | The ability is in the initial state.| -| FOCUS | 2 | The ability has the focus.| -| FOREGROUND | 9 | The ability is in the foreground state. | -| BACKGROUND | 10 | The ability is in the background state. | -| FOREGROUNDING | 11 | The ability is in the state of being switched to the foreground. | -| BACKGROUNDING | 12 | The ability is in the state of being switched to the background. | +| INITIAL | 0 | The ability is in the initial state.| +| FOCUS | 2 | The ability has the focus. | +| FOREGROUND | 9 | The ability is in the foreground state. | +| BACKGROUND | 10 | The ability is in the background state. | +| FOREGROUNDING | 11 | The ability is in the state of being switched to the foreground. | +| BACKGROUNDING | 12 | The ability is in the state of being switched to the background. | ## updateConfiguration @@ -39,7 +39,7 @@ Updates the configuration. This API uses an asynchronous callback to return the **Permission required**: ohos.permission.UPDATE_CONFIGURATION **System capability**: SystemCapability.Ability.AbilityRuntime.Core - + **Parameters** | Name | Type | Mandatory | Description | @@ -64,7 +64,7 @@ const config = { language: 'Zh-Hans', // Simplified Chinese. colorMode: COLOR_MODE_LIGHT, // Light theme. direction: DIRECTION_VERTICAL, // Vertical direction. - screenDensity: SCREEN_DENSITY_SDPI, // The screen resolution is SDPI. + screenDensity: SCREEN_DENSITY_SDPI, // The screen pixel density is 'sdpi'. displayId: 1, // The application is displayed on the display with ID 1. hasPointerDevice: true, // A pointer device is connected. }; @@ -76,7 +76,7 @@ try { } else { console.log('updateConfiguration success.'); } - }) + }); } catch (paramError) { console.log('error.code: ' + JSON.stringify(paramError.code) + ' error.message: ' + JSON.stringify(paramError.message)); @@ -122,7 +122,7 @@ const config = { language: 'Zh-Hans', // Simplified Chinese. colorMode: COLOR_MODE_LIGHT, // Light theme. direction: DIRECTION_VERTICAL, // Vertical direction. - screenDensity: SCREEN_DENSITY_SDPI, // The screen resolution is SDPI. + screenDensity: SCREEN_DENSITY_SDPI, // The screen pixel density is 'sdpi'. displayId: 1, // The application is displayed on the display with ID 1. hasPointerDevice: true, // A pointer device is connected. }; @@ -132,7 +132,7 @@ try { console.log('updateConfiguration success.'); }).catch((err) => { console.log('updateConfiguration fail, err: ' + JSON.stringify(err)); - }) + }); } catch (paramError) { console.log('error.code: ' + JSON.stringify(paramError.code) + ' error.message: ' + JSON.stringify(paramError.message)); @@ -153,7 +153,7 @@ Obtains the UIAbility running information. This API uses an asynchronous callbac | Name | Type | Mandatory | Description | | --------- | ---------------------------------------- | ---- | -------------- | -| callback | AsyncCallback\> | Yes | Callback used to return the API call result and the UIAbility running information. You can perform error handling or custom processing in this callback. | +| callback | AsyncCallback\> | Yes | Callback used to return the API call result and the UIAbility running information. You can perform error handling or custom processing in this callback. | **Error codes** @@ -274,7 +274,7 @@ try { getExtensionRunningInfos(upperLimit: number): Promise\> Obtains the ExtensionAbility running information. This API uses a promise to return the result. - + **Required permissions**: ohos.permission.GET_RUNNING_INFO **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -311,7 +311,7 @@ try { console.log('getExtensionRunningInfos success, data: ' + JSON.stringify(data)); }).catch((err) => { console.log('getExtensionRunningInfos fail, err: ' + JSON.stringify(err)); - }) + }); } catch (paramError) { console.log('error.code: ' + JSON.stringify(paramError.code) + ' error.message: ' + JSON.stringify(paramError.message)); @@ -359,7 +359,7 @@ abilityManager.getTopAbility((err, data) => { getTopAbility(): Promise\; Obtains the top ability, which is the ability that has the window focus. This API uses a promise to return the result. - + **System capability**: SystemCapability.Ability.AbilityRuntime.Core **Return value** @@ -385,5 +385,5 @@ abilityManager.getTopAbility().then((data) => { console.log('getTopAbility success, data: ' + JSON.stringify(data)); }).catch((err) => { console.log('getTopAbility fail, err: ' + JSON.stringify(err)); -}) +}); ``` diff --git a/en/application-dev/reference/apis/js-apis-app-ability-appManager.md b/en/application-dev/reference/apis/js-apis-app-ability-appManager.md index 760fb188206cca471e89af5f9788a23e6e32c9a2..26873cfe82321bbb781672e0aac103d1adc328b8 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-appManager.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-appManager.md @@ -45,7 +45,7 @@ appManager.isRunningInStabilityTest((err, flag) => { } else { console.log('The result of isRunningInStabilityTest is:' + JSON.stringify(flag)); } -}) +}); ``` @@ -151,7 +151,7 @@ appManager.isRamConstrainedDevice((err, data) => { } else { console.log('The result of isRamConstrainedDevice is:' + JSON.stringify(data)); } -}) +}); ``` ## appManager.getAppMemorySize @@ -221,7 +221,7 @@ appManager.getAppMemorySize((err, data) => { } else { console.log('The size of app memory is:' + JSON.stringify(data)); } -}) +}); ``` ## appManager.getRunningProcessInformation @@ -295,7 +295,7 @@ appManager.getRunningProcessInformation((err, data) => { } else { console.log('The process running information is:' + JSON.stringify(data)); } -}) +}); ``` ## appManager.on @@ -352,7 +352,7 @@ let applicationStateObserver = { onProcessStateChanged(processData) { console.log(`[appManager] onProcessStateChanged: ${JSON.stringify(processData)}`); } -} +}; try { const observerId = appManager.on('applicationState', applicationStateObserver); console.log(`[appManager] observerCode: ${observerId}`); @@ -416,7 +416,7 @@ let applicationStateObserver = { onProcessStateChanged(processData) { console.log(`[appManager] onProcessStateChanged: ${JSON.stringify(processData)}`); } -} +}; let bundleNameList = ['bundleName1', 'bundleName2']; try { const observerId = appManager.on('applicationState', applicationStateObserver, bundleNameList); @@ -478,7 +478,7 @@ let applicationStateObserver = { onProcessStateChanged(processData) { console.log(`[appManager] onProcessStateChanged: ${JSON.stringify(processData)}`); } -} +}; let bundleNameList = ['bundleName1', 'bundleName2']; try { observerId = appManager.on('applicationState', applicationStateObserver, bundleNameList); @@ -559,7 +559,7 @@ let applicationStateObserver = { onProcessStateChanged(processData) { console.log(`[appManager] onProcessStateChanged: ${JSON.stringify(processData)}`); } -} +}; let bundleNameList = ['bundleName1', 'bundleName2']; try { observerId = appManager.on('applicationState', applicationStateObserver, bundleNameList); @@ -574,7 +574,7 @@ try { console.log('unregisterApplicationStateObserver success, data: ' + JSON.stringify(data)); }).catch((err) => { console.log('unregisterApplicationStateObserver faile, err: ' + JSON.stringify(err)); - }) + }); } catch (paramError) { console.log('error: ' + paramError.code + ', ' + paramError.message); } @@ -660,7 +660,7 @@ appManager.getForegroundApplications().then((data) => { console.log('getForegroundApplications success, data: ' + JSON.stringify(data)); }).catch((err) => { console.log('getForegroundApplications fail, err: ' + JSON.stringify(err)); -}) +}); ``` ## appManager.killProcessWithAccount @@ -702,7 +702,7 @@ try { console.log('killProcessWithAccount success'); }).catch((err) => { console.error('killProcessWithAccount fail, err: ' + JSON.stringify(err)); - }) + }); } catch (paramError) { console.error('error: ' + paramError.code + ', ' + paramError.message); } @@ -844,7 +844,7 @@ try { console.log('killProcessesByBundleName success.'); }).catch((err) => { console.log('killProcessesByBundleName fail, err: ' + JSON.stringify(err)); - }) + }); } catch (paramError) { console.log('error: ' + paramError.code + ', ' + paramError.message); } @@ -940,7 +940,7 @@ try { console.log('clearUpApplicationData success.'); }).catch((err) => { console.log('clearUpApplicationData fail, err: ' + JSON.stringify(err)); - }) + }); } catch (paramError) { console.log('error: ' + paramError.code + ', ' + paramError.message); } diff --git a/en/application-dev/reference/apis/js-apis-app-ability-appRecovery.md b/en/application-dev/reference/apis/js-apis-app-ability-appRecovery.md index 8a5a840b0c6d9723c03ccdb988927f0f296e2971..49a0eb729af46a8426737d868e6138ffd42355ad 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-appRecovery.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-appRecovery.md @@ -21,8 +21,8 @@ Enumerates the application restart flags. This enum is used as an input paramete | Name | Value | Description | | ---------- | ---- | ---------- | | ALWAYS_RESTART | 0 | The application is restarted in all cases.| -| RESTART_WHEN_JS_CRASH | 0x0001 | The application is restarted in the case of JS_CRASH.| -| RESTART_WHEN_APP_FREEZE | 0x0002 | The application is restarted in the case of APP_FREEZE.| +| RESTART_WHEN_JS_CRASH | 0x0001 | The application is restarted in the case of JS_CRASH. | +| RESTART_WHEN_APP_FREEZE | 0x0002 | The application is restarted in the case of APP_FREEZE. | | NO_RESTART | 0xFFFF | The application is not restarted in any case.| ## appRecovery.SaveOccasionFlag diff --git a/en/application-dev/reference/apis/js-apis-app-ability-common.md b/en/application-dev/reference/apis/js-apis-app-ability-common.md index 5cc9b61b90fb3072aacf530fdaee0ae2633f7ac0..deb8b546e79c77d02785bed821691602098f2280 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-common.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-common.md @@ -10,7 +10,7 @@ The **Common** module provides all level-2 module APIs for developers to export. ## Modules to Import ```ts -import common from '@ohos.app.ability.common' +import common from '@ohos.app.ability.common'; ``` **System capability**: SystemCapability.Ability.AbilityBase @@ -33,7 +33,7 @@ import common from '@ohos.app.ability.common' **Example** ```ts -import common from '@ohos.app.ability.common' +import common from '@ohos.app.ability.common'; let uiAbilityContext: common.UIAbilityContext; let abilityStageContext: common.AbilityStageContext; diff --git a/en/application-dev/reference/apis/js-apis-app-ability-configuration.md b/en/application-dev/reference/apis/js-apis-app-ability-configuration.md index 88aab2d4026afac5edaf8c3c7ff58033976e3e66..8680cc4af5ec2f603ff15d6c6452a01d47d058f3 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-configuration.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-configuration.md @@ -1,25 +1,19 @@ # @ohos.app.ability.Configuration (Configuration) -The **Configuration** module defines environment change information. +The **Configuration** module defines environment change information. **Configuration** is an interface definition and is used only for field declaration. > **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. -## Modules to Import - -```ts -import Configuration from '@ohos.app.ability.Configuration' -``` - **System capability**: SystemCapability.Ability.AbilityBase - | Name| Type| Readable| Writable| Description| +| Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | | language | string | Yes| Yes| Language of the application, for example, **zh**.| -| colorMode | [ColorMode](js-apis-app-ability-configurationConstant.md#configurationconstantcolormode) | Yes| Yes| Color mode, which can be **COLOR_MODE_LIGHT** or **COLOR_MODE_DARK**. The default value is **COLOR_MODE_LIGHT**.| -| direction | [Direction](js-apis-app-ability-configurationConstant.md#configurationconstantdirection) | Yes| No| Screen orientation, which can be **DIRECTION_HORIZONTAL** or **DIRECTION_VERTICAL**.| -| screenDensity | [ScreenDensity](js-apis-app-ability-configurationConstant.md#configurationconstantscreendensity) | Yes| No| Screen resolution, which can be **SCREEN_DENSITY_SDPI** (120), **SCREEN_DENSITY_MDPI** (160), **SCREEN_DENSITY_LDPI** (240), **SCREEN_DENSITY_XLDPI** (320), **SCREEN_DENSITY_XXLDPI** (480), or **SCREEN_DENSITY_XXXLDPI** (640).| +| colorMode | [ColorMode](js-apis-app-ability-configurationConstant.md#configurationconstantcolormode) | Yes| Yes| Color mode. The default value is **COLOR_MODE_LIGHT**. The options are as follows:
- **COLOR_MODE_NOT_SET**: The color mode is not set.
- **COLOR_MODE_LIGHT**: light mode.
- **COLOR_MODE_DARK**: dark mode.| +| direction | [Direction](js-apis-app-ability-configurationConstant.md#configurationconstantdirection) | Yes| No| Screen orientation. The options are as follows:
- **DIRECTION_NOT_SET**: The screen orientation is not set.
- **DIRECTION_HORIZONTAL**: horizontal direction.
- **DIRECTION_VERTICAL**: vertical direction.| +| screenDensity | [ScreenDensity](js-apis-app-ability-configurationConstant.md#configurationconstantscreendensity) | Yes| No| Pixel density of the screen. The options are as follows:
- **SCREEN_DENSITY_NOT_SET**: The pixel density is not set.
- **SCREEN_DENSITY_SDPI**: 120.
- **SCREEN_DENSITY_MDPI**: 160.
- **SCREEN_DENSITY_LDPI**: 240.
- **SCREEN_DENSITY_XLDPI**: 320.
- **SCREEN_DENSITY_XXLDPI**: 480.
- **SCREEN_DENSITY_XXXLDPI**: 640.| | displayId | number | Yes| No| ID of the display where the application is located.| | hasPointerDevice | boolean | Yes| No| Whether a pointer device, such as a keyboard, mouse, or touchpad, is connected.| @@ -34,7 +28,7 @@ For details about the fields, see the **ohos.app.ability.Configuration.d.ts** fi onCreate(want, launchParam) { let envCallback = { onConfigurationUpdated(config) { - console.info(`envCallback onConfigurationUpdated success: ${JSON.stringify(config)}`) + console.info(`envCallback onConfigurationUpdated success: ${JSON.stringify(config)}`); let language = config.language; let colorMode = config.colorMode; let direction = config.direction; @@ -45,10 +39,10 @@ For details about the fields, see the **ohos.app.ability.Configuration.d.ts** fi }; try { let applicationContext = this.context.getApplicationContext(); - let callbackId = applicationContext.on("environment", envCallback); - console.log("callbackId: " + callbackId); + let callbackId = applicationContext.on('environment', envCallback); + console.log('callbackId: ' + callbackId); } catch (paramError) { - console.log("error: " + paramError.code + ", " + paramError.message); + console.log('error: ' + paramError.code + ', ' + paramError.message); } } } diff --git a/en/application-dev/reference/apis/js-apis-app-ability-configurationConstant.md b/en/application-dev/reference/apis/js-apis-app-ability-configurationConstant.md index bd56e256603930f874c9ba2c064462c8fad594a8..7f7fd36c946eb19e33d5fb3649f105aafaae8d23 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-configurationConstant.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-configurationConstant.md @@ -25,7 +25,7 @@ You can obtain the value of this constant by calling the **ConfigurationConstant | COLOR_MODE_LIGHT | 1 | Light mode.| -## ConfigurationConstant.Direction +## ConfigurationConstant.Direction9+ You can obtain the value of this constant by calling the **ConfigurationConstant.Direction** API. @@ -38,7 +38,7 @@ You can obtain the value of this constant by calling the **ConfigurationConstant | DIRECTION_HORIZONTAL | 1 | Horizontal direction.| -## ConfigurationConstant.ScreenDensity +## ConfigurationConstant.ScreenDensity9+ You can obtain the value of this constant by calling the **ConfigurationConstant.ScreenDensity** API. @@ -46,10 +46,10 @@ You can obtain the value of this constant by calling the **ConfigurationConstant | Name| Value| Description| | -------- | -------- | -------- | -| SCREEN_DENSITY_NOT_SET | 0 | Unspecified screen resolution.| -| SCREEN_DENSITY_SDPI | 120 | The screen resolution is sdpi.| -| SCREEN_DENSITY_MDPI | 160 | The screen resolution is mdpi.| -| SCREEN_DENSITY_LDPI | 240 | The screen resolution is ldpi.| -| SCREEN_DENSITY_XLDPI | 320 | The screen resolution is xldpi.| -| SCREEN_DENSITY_XXLDPI | 480 | The screen resolution is xxldpi.| -| SCREEN_DENSITY_XXXLDPI | 640 | The screen resolution is xxxldpi.| +| SCREEN_DENSITY_NOT_SET | 0 | The screen pixel density is not set.| +| SCREEN_DENSITY_SDPI | 120 | The pixel density of the screen is 'sdpi'.| +| SCREEN_DENSITY_MDPI | 160 | The pixel density of the screen is 'mdpi'.| +| SCREEN_DENSITY_LDPI | 240 | The pixel density of the screen is 'ldpi'.| +| SCREEN_DENSITY_XLDPI | 320 | The pixel density of the screen is 'xldpi'.| +| SCREEN_DENSITY_XXLDPI | 480 | The pixel density of the screen is 'xxldpi'.| +| SCREEN_DENSITY_XXXLDPI | 640 | The pixel density of the screen is 'xxxldpi'.| diff --git a/en/application-dev/reference/apis/js-apis-app-ability-environmentCallback.md b/en/application-dev/reference/apis/js-apis-app-ability-environmentCallback.md index 0cb95a9abfd6b90f1efacc431070ef6b3397e1e6..e20f8ac51c0e12e56bc31a7f21ee76a763e0fc6a 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-environmentCallback.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-environmentCallback.md @@ -11,7 +11,7 @@ The **EnvironmentCallback** module provides the **onConfigurationUpdated** API f ## Modules to Import ```ts -import EnvironmentCallback from "@ohos.app.ability.EnvironmentCallback"; +import EnvironmentCallback from '@ohos.app.ability.EnvironmentCallback'; ``` @@ -29,33 +29,50 @@ Called when the system environment changes. | -------- | -------- | -------- | -------- | | config | [Configuration](js-apis-app-ability-configuration.md) | Yes| **Configuration** object after the change.| +## EnvironmentCallback.onMemoryLevel + +onMemoryLevel(level: AbilityConstant.MemoryLevel): void; + +Called when the system memory level changes. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | level | [AbilityConstant.MemoryLevel](js-apis-app-ability-abilityConstant.md#abilityconstantmemorylevel) | Yes| Memory level that indicates the memory usage status. When the specified memory level is reached, a callback will be invoked and the system will start adjustment.| + **Example** ```ts -import UIAbility from "@ohos.app.ability.Ability"; +import Ability from '@ohos.application.Ability'; -var callbackId; +let callbackId; -export default class MyAbility extends UIAbility { +export default class MyAbility extends Ability { onCreate() { - console.log("MyAbility onCreate") + console.log('MyAbility onCreate'); globalThis.applicationContext = this.context.getApplicationContext(); let EnvironmentCallback = { onConfigurationUpdated(config){ - console.log("onConfigurationUpdated config:" + JSON.stringify(config)); + console.log('onConfigurationUpdated config:' + JSON.stringify(config)); + }, + onMemoryLevel(level){ + console.log('onMemoryLevel level: ${JSON.stringify(level)}'); } - } + }; // 1. Obtain an applicationContext object. let applicationContext = globalThis.applicationContext; // 2. Register a listener for the environment changes through the applicationContext object. callbackId = applicationContext.registerEnvironmentCallback(EnvironmentCallback); - console.log("registerEnvironmentCallback number: " + JSON.stringify(callbackId)); + console.log('registerEnvironmentCallback number: ' + JSON.stringify(callbackId)); } onDestroy() { let applicationContext = globalThis.applicationContext; applicationContext.unregisterEnvironmentCallback(callbackId, (error, data) => { - console.log("unregisterEnvironmentCallback success, err: " + JSON.stringify(error)); + console.log('unregisterEnvironmentCallback success, err: ' + JSON.stringify(error)); }); } } diff --git a/en/application-dev/reference/apis/js-apis-app-ability-errorManager.md b/en/application-dev/reference/apis/js-apis-app-ability-errorManager.md index e543a93e9ceb5af52f3cdb939a0cfd5d24145968..3cb86447fa75d12370004a0393521cc0f53aa755 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-errorManager.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-errorManager.md @@ -1,19 +1,19 @@ # @ohos.app.ability.errorManager (ErrorManager) -The **ErrorManager** module provides APIs for registering and deregistering error observers. For example, you can use the APIs to register an observer when your application wants to capture JS crashes. +The **ErrorManager** module provides APIs for registering and deregistering error observers. > **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. ## Modules to Import -```ts +``` import errorManager from '@ohos.app.ability.errorManager' ``` ## ErrorManager.on -on(type: "error", observer: ErrorObserver): number; +on(type: 'error', observer: ErrorObserver): number; Registers an error observer. @@ -23,34 +23,27 @@ Registers an error observer. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| type | string | Yes| Type of the API to call. It is fixed at **"error"**.| +| type | string | Yes| Type of the API to call.| | observer | [ErrorObserver](./js-apis-inner-application-errorObserver.md) | Yes| Digital code of the observer.| -**Return value** - - | Type| Description| - | -------- | -------- | - | number | Index of the observer.| - **Example** -```ts -var observer = { +```js +let observer = { onUnhandledException(errorMsg) { console.log('onUnhandledException, errorMsg: ', errorMsg) } -} -var observerId = -1; +}; try { - observerId = errorManager.on("error", observer); + errorManager.on('error', observer); } catch (paramError) { - console.log("error: " + paramError.code + ", " + paramError.message); + console.log('error: ' + paramError.code + ', ' + paramError.message); } ``` ## ErrorManager.off -off(type: "error", observerId: number, callback: AsyncCallback\): void; +off(type: 'error', observerId: number, callback: AsyncCallback\): void; Deregisters an error observer. This API uses an asynchronous callback to return the result. @@ -60,14 +53,14 @@ Deregisters an error observer. This API uses an asynchronous callback to return | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| type | string | Yes| Type of the API to call. It is fixed at **"error"**.| -| observerId | number | Yes| Index of the observer returned by **on()**.| +| type | string | Yes| Type of the API to call.| +| observerId | number | Yes| Digital code of the observer.| | callback | AsyncCallback\ | Yes| Callback used to return the result.| **Example** -```ts -var observerId = 100; +```js +let observerId = 100; function unregisterErrorObserverCallback(err) { if (err) { @@ -75,15 +68,15 @@ function unregisterErrorObserverCallback(err) { } } try { - errorManager.off("error", observerId, unregisterErrorObserverCallback); + errorManager.off('error', observerId, unregisterErrorObserverCallback); } catch (paramError) { - console.log("error: " + paramError.code + ", " + paramError.message); + console.log('error: ' + paramError.code + ', ' + paramError.message); } ``` ## ErrorManager.off -off(type: "error", observerId: number): Promise\; +off(type: 'error', observerId: number): Promise\; Deregisters an error observer. This API uses a promise to return the result. @@ -93,8 +86,8 @@ Deregisters an error observer. This API uses a promise to return the result. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| type | string | Yes| Type of the API to call. It is fixed at **"error"**.| -| observerId | number | Yes| Index of the observer returned by **on()**.| +| type | string | Yes| Type of the API to call.| +| observerId | number | Yes| Digital code of the observer.| **Return value** @@ -104,18 +97,18 @@ Deregisters an error observer. This API uses a promise to return the result. **Example** -```ts -var observerId = 100; +```js +let observerId = 100; try { - errorManager.off("error", observerId) + errorManager.off('error', observerId) .then((data) => { console.log('----------- unregisterErrorObserver success ----------', data); }) .catch((err) => { console.log('----------- unregisterErrorObserver fail ----------', err); - }) + }); } catch (paramError) { - console.log("error: " + paramError.code + ", " + paramError.message); + console.log('error: ' + paramError.code + ', ' + paramError.message); } ``` diff --git a/en/application-dev/reference/apis/js-apis-app-ability-missionManager.md b/en/application-dev/reference/apis/js-apis-app-ability-missionManager.md index 434fb19383e072a36352012300c2a755769d6c1f..4448d79d41f3721b0d218a749757494bb65deb2f 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-missionManager.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-missionManager.md @@ -18,7 +18,7 @@ ohos.permission.MANAGE_MISSIONS ## missionManager.on -on(type:"mission", listener: MissionListener): number; +on(type:'mission', listener: MissionListener): number; Registers a listener to observe the mission status. @@ -43,69 +43,26 @@ Registers a listener to observe the mission status. **Example** ```ts -import missionManager from '@ohos.app.ability.missionManager'; -import UIAbility from '@ohos.app.ability.UIAbility'; - -var listener = { - onMissionCreated: function (mission) {console.log("--------onMissionCreated-------")}, - onMissionDestroyed: function (mission) {console.log("--------onMissionDestroyed-------")}, - onMissionSnapshotChanged: function (mission) {console.log("--------onMissionSnapshotChanged-------")}, - onMissionMovedToFront: function (mission) {console.log("--------onMissionMovedToFront-------")}, - onMissionIconUpdated: function (mission, icon) {console.log("--------onMissionIconUpdated-------")}, - onMissionClosed: function (mission) {console.log("--------onMissionClosed-------")}, - onMissionLabelUpdated: function (mission) {console.log("--------onMissionLabelUpdated-------")} -}; - -var listenerId = -1; - -export default class EntryAbility extends UIAbility { - onCreate(want, launchParam) { - console.log("[Demo] EntryAbility onCreate"); - globalThis.abilityWant = want; - globalThis.context = this.context; - } - - onDestroy() { - try { - if (listenerId != -1) { - missionManager.off("mission", listenerId).catch(function (err) { - console.log(err); - }); - } - } catch (paramError) { - console.log("error: " + paramError.code + ", " + paramError.message); - } - console.log("[Demo] EntryAbility onDestroy") - } - - onWindowStageCreate(windowStage) { - // The main window is created. Set a main page for this ability. - console.log("[Demo] EntryAbility onWindowStageCreate") - try { - listenerId = missionManager.on("mission", listener); - } catch (paramError) { - console.log("error: " + paramError.code + ", " + paramError.message); - } - - windowStage.loadContent("pages/index", (err, data) => { - if (err.code) { - console.error('Failed to load the content. Cause:' + JSON.stringify(err)); - return; - } - console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data)) - }); - - if (globalThis.flag) { - return; - } - } -}; + let listener = { + onMissionCreated: function (mission) {console.log('--------onMissionCreated-------');}, + onMissionDestroyed: function (mission) {console.log('--------onMissionDestroyed-------');}, + onMissionSnapshotChanged: function (mission) {console.log('--------onMissionSnapshotChanged-------');}, + onMissionMovedToFront: function (mission) {console.log('--------onMissionMovedToFront-------');}, + onMissionIconUpdated: function (mission, icon) {console.log('--------onMissionIconUpdated-------');}, + onMissionClosed: function (mission) {console.log('--------onMissionClosed-------');} + }; + console.log('registerMissionListener'); + try { + let listenerid = missionManager.on('mission', listener); + } catch (paramError) { + console.log('error: ' + paramError.code + ', ' + paramError.message); + } ``` ## missionManager.off -off(type: "mission", listenerId: number, callback: AsyncCallback<void>): void; +off(type: 'mission', listenerId: number, callback: AsyncCallback<void>): void; Deregisters a mission status listener. @@ -119,75 +76,36 @@ Deregisters a mission status listener. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | listenerId | number | Yes| Index of the mission status listener to deregister. It is returned by **on()**.| + | listenerId | number | Yes| Index of the mission status listener to deregister. It is returned by **registerMissionListener()**.| | callback | AsyncCallback<void> | Yes| Callback used to return the result.| **Example** ```ts -import missionManager from '@ohos.app.ability.missionManager'; -import UIAbility from '@ohos.app.ability.UIAbility'; - -var listener = { - onMissionCreated: function (mission) {console.log("--------onMissionCreated-------")}, - onMissionDestroyed: function (mission) {console.log("--------onMissionDestroyed-------")}, - onMissionSnapshotChanged: function (mission) {console.log("--------onMissionSnapshotChanged-------")}, - onMissionMovedToFront: function (mission) {console.log("--------onMissionMovedToFront-------")}, - onMissionIconUpdated: function (mission, icon) {console.log("--------onMissionIconUpdated-------")}, - onMissionClosed: function (mission) {console.log("--------onMissionClosed-------")}, - onMissionLabelUpdated: function (mission) {console.log("--------onMissionLabelUpdated-------")} -}; - -var listenerId = -1; - -export default class EntryAbility extends UIAbility { - onCreate(want, launchParam) { - console.log("[Demo] EntryAbility onCreate") - globalThis.abilityWant = want; - globalThis.context = this.context; - } - - onDestroy() { - try { - if (listenerId != -1) { - missionManager.off("mission", listenerId, (err) => { - console.log(err); - }); - } - } catch (paramError) { - console.log("error: " + paramError.code + ", " + paramError.message); - } - console.log("[Demo] EntryAbility onDestroy") - } - - onWindowStageCreate(windowStage) { - // The main window is created. Set a main page for this ability. - console.log("[Demo] EntryAbility onWindowStageCreate") - try { - listenerId = missionManager.on("mission", listener); - } catch (paramError) { - console.log("error: " + paramError.code + ", " + paramError.message); - } - - windowStage.loadContent("pages/index", (err, data) => { - if (err.code) { - console.error('Failed to load the content. Cause:' + JSON.stringify(err)); - return; - } - console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data)) - }); - - if (globalThis.flag) { - return; - } - } -}; + let listener = { + onMissionCreated: function (mission) {console.log('--------onMissionCreated-------');}, + onMissionDestroyed: function (mission) {console.log('--------onMissionDestroyed-------');}, + onMissionSnapshotChanged: function (mission) {console.log('--------onMissionSnapshotChanged-------');}, + onMissionMovedToFront: function (mission) {console.log('--------onMissionMovedToFront-------');}, + onMissionIconUpdated: function (mission, icon) {console.log('--------onMissionIconUpdated-------');}, + onMissionClosed: function (mission) {console.log('--------onMissionClosed-------');} + }; + console.log('registerMissionListener'); + try { + let listenerid = missionManager.registerMissionListener(listener); + + missionManager.unregisterMissionListener(listenerid, (error) => { + console.log('unregisterMissionListener'); + }); + } catch (paramError) { + console.log('error: ' + paramError.code + ', ' + paramError.message); + } ``` ## missionManager.off -off(type: "mission", listenerId: number): Promise<void>; +off(type: 'mission', listenerId: number): Promise<void>; Deregisters a mission status listener. This API uses a promise to return the result. @@ -201,7 +119,7 @@ Deregisters a mission status listener. This API uses a promise to return the res | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | listenerId | number | Yes| Index of the mission status listener to deregister. It is returned by **on()**.| + | listenerId | number | Yes| Index of the mission status listener to deregister. It is returned by **registerMissionListener()**.| **Return value** @@ -212,63 +130,24 @@ Deregisters a mission status listener. This API uses a promise to return the res **Example** ```ts -import missionManager from '@ohos.app.ability.missionManager'; -import UIAbility from '@ohos.app.ability.UIAbility'; - -var listener = { - onMissionCreated: function (mission) {console.log("--------onMissionCreated-------")}, - onMissionDestroyed: function (mission) {console.log("--------onMissionDestroyed-------")}, - onMissionSnapshotChanged: function (mission) {console.log("--------onMissionSnapshotChanged-------")}, - onMissionMovedToFront: function (mission) {console.log("--------onMissionMovedToFront-------")}, - onMissionIconUpdated: function (mission, icon) {console.log("--------onMissionIconUpdated-------")}, - onMissionClosed: function (mission) {console.log("--------onMissionClosed-------")}, - onMissionLabelUpdated: function (mission) {console.log("--------onMissionLabelUpdated-------")} -}; - -var listenerId = -1; - -export default class EntryAbility extends UIAbility { - onCreate(want, launchParam) { - console.log("[Demo] EntryAbility onCreate") - globalThis.abilityWant = want; - globalThis.context = this.context; - } - - onDestroy() { - try { - if (listenerId != -1) { - missionManager.off("mission", listenerId).catch(function (err) { - console.log(err); - }); - } - } catch (paramError) { - console.log("error: " + paramError.code + ", " + paramError.message); - } - console.log("[Demo] EntryAbility onDestroy") - } - - onWindowStageCreate(windowStage) { - // The main window is created. Set a main page for this ability. - console.log("[Demo] EntryAbility onWindowStageCreate") - try { - listenerId = missionManager.on("mission", listener); - } catch (paramError) { - console.log("error: " + paramError.code + ", " + paramError.message); - } - - windowStage.loadContent("pages/index", (err, data) => { - if (err.code) { - console.error('Failed to load the content. Cause:' + JSON.stringify(err)); - return; - } - console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data)) - }); - - if (globalThis.flag) { - return; - } - } -}; + let listener = { + onMissionCreated: function (mission) {console.log('--------onMissionCreated-------');}, + onMissionDestroyed: function (mission) {console.log('--------onMissionDestroyed-------');}, + onMissionSnapshotChanged: function (mission) {console.log('--------onMissionSnapshotChanged-------');}, + onMissionMovedToFront: function (mission) {console.log('--------onMissionMovedToFront-------');}, + onMissionIconUpdated: function (mission, icon) {console.log('--------onMissionIconUpdated-------');}, + onMissionClosed: function (mission) {console.log('--------onMissionClosed-------');} + }; + console.log('registerMissionListener'); + try { + let listenerid = missionManager.registerMissionListener(listener); + + missionManager.unregisterMissionListener(listenerid).catch(function (err) { + console.log(err); + }); + } catch (paramError) { + console.log('error: ' + paramError.code + ', ' + paramError.message); + } ``` @@ -297,28 +176,19 @@ Obtains the information about a given mission. This API uses an asynchronous cal ```ts import missionManager from '@ohos.app.ability.missionManager'; - let testMissionId = 1; try { - var allMissions=await missionManager.getMissionInfos("",10).catch(function(err){console.log(err);}); - if (allMissions && allMissions.length > 0) { - testMissionId = allMissions[0].missionId; - } - - missionManager.getMissionInfo("", testMissionId, (error, mission) => { - if (error) { - console.log("getMissionInfo failed, error.code:" + JSON.stringify(error.code) + - "error.message:" + JSON.stringify(error.message)); - } else { - console.log("mission.missionId = " + mission.missionId); - console.log("mission.runningState = " + mission.runningState); - console.log("mission.lockedState = " + mission.lockedState); - console.log("mission.timestamp = " + mission.timestamp); - console.log("mission.label = " + mission.label); - console.log("mission.iconPath = " + mission.iconPath); - } - }); + let allMissions=missionManager.getMissionInfos('',10).catch(function(err){console.log(err);}); + missionManager.getMissionInfo('', allMissions[0].missionId, (error, mission) => { + console.log('getMissionInfo is called, error.code = ' + error.code); + console.log('mission.missionId = ' + mission.missionId); + console.log('mission.runningState = ' + mission.runningState); + console.log('mission.lockedState = ' + mission.lockedState); + console.log('mission.timestamp = ' + mission.timestamp); + console.log('mission.label = ' + mission.label); + console.log('mission.iconPath = ' + mission.iconPath); + }); } catch (paramError) { - console.log("error: " + paramError.code + ", " + paramError.message); + console.log('error: ' + paramError.code + ', ' + paramError.message); } ``` @@ -350,20 +220,18 @@ Obtains the information about a given mission. This API uses a promise to return **Example** -```ts -import missionManager from '@ohos.app.ability.missionManager'; + ```ts + import missionManager from '@ohos.app.ability.missionManager'; -let testMissionId = 1; -try { - missionManager.getMissionInfo("", testMissionId).then((data) => { - console.info('getMissionInfo successfully. Data: ' + JSON.stringify(data)); - }).catch(error => { - console.error('getMissionInfo failed. Cause: ' + error.message); + try { + let mission = missionManager.getMissionInfo('', 10).catch(function (err){ + console.log(err); }); -} catch (error) { - console.error('getMissionInfo failed. Cause: ' + error.message); -} -``` + } catch (paramError) { + console.log('error: ' + paramError.code + ', ' + paramError.message); + } + ``` + ## missionManager.getMissionInfos @@ -391,17 +259,13 @@ Obtains information about all missions. This API uses an asynchronous callback t import missionManager from '@ohos.app.ability.missionManager'; try { - missionManager.getMissionInfos("", 10, (error, missions) => { - if (error) { - console.log("getMissionInfos failed, error.code:" + JSON.stringify(error.code) + - "error.message:" + JSON.stringify(error.message)); - } else { - console.log("size = " + missions.length); - console.log("missions = " + JSON.stringify(missions)); - } - }) + missionManager.getMissionInfos('', 10, (error, missions) => { + console.log('getMissionInfos is called, error.code = ' + error.code); + console.log('size = ' + missions.length); + console.log('missions = ' + JSON.stringify(missions)); + }); } catch (paramError) { - console.log("error: " + paramError.code + ", " + paramError.message); + console.log('error: ' + paramError.code + ', ' + paramError.message); } ``` @@ -433,19 +297,18 @@ Obtains information about all missions. This API uses a promise to return the re **Example** -```ts -import missionManager from '@ohos.app.ability.missionManager'; + ```ts + import missionManager from '@ohos.app.ability.missionManager'; -try { - missionManager.getMissionInfos("", 10).then((data) => { - console.info('getMissionInfos successfully. Data: ' + JSON.stringify(data)); - }).catch(error => { - console.error('getMissionInfos failed. Cause: ' + error.message); + try { + let allMissions = missionManager.getMissionInfos('', 10).catch(function (err){ + console.log(err); }); -} catch (error) { - console.error('getMissionInfos failed. Cause: ' + error.message); -} -``` + } catch (paramError) { + console.log('error: ' + paramError.code + ', ' + paramError.message); + } + ``` + ## missionManager.getMissionSnapShot @@ -468,22 +331,27 @@ Obtains the snapshot of a given mission. This API uses an asynchronous callback | callback | AsyncCallback<[MissionSnapshot](js-apis-inner-application-missionSnapshot.md)> | Yes| Callback used to return the snapshot information obtained.| **Example** -```ts -import missionManager from '@ohos.app.ability.missionManager'; -let testMissionId = 2; -try { - missionManager.getMissionSnapShot("", testMissionId, (err, data) => { - if (err) { - console.error('getMissionSnapShot failed:' + err.message); - } else { - console.info('getMissionSnapShot successfully:' + JSON.stringify(data)); - } + ```ts + import missionManager from '@ohos.app.ability.missionManager'; + + try { + missionManager.getMissionInfos('', 10, (error, missions) => { + console.log('getMissionInfos is called, error.code = ' + error.code); + console.log('size = ' + missions.length); + console.log('missions = ' + JSON.stringify(missions)); + let id = missions[0].missionId; + + missionManager.getMissionSnapShot('', id, (error, snapshot) => { + console.log('getMissionSnapShot is called, error.code = ' + error.code); + console.log('bundleName = ' + snapshot.ability.bundleName); + }); }); -} catch (err) { - console.error('getMissionSnapShot failed:' + err.message); -} -``` + } catch (paramError) { + console.log('error: ' + paramError.code + ', ' + paramError.message); + } + ``` + ## missionManager.getMissionSnapShot @@ -511,20 +379,26 @@ Obtains the snapshot of a given mission. This API uses a promise to return the r | Promise<[MissionSnapshot](js-apis-inner-application-missionSnapshot.md)> | Promise used to return the snapshot information obtained.| **Example** -```ts -import missionManager from '@ohos.app.ability.missionManager'; -let testMissionId = 2; -try { - missionManager.getMissionSnapShot("", testMissionId).then((data) => { - console.info('getMissionSnapShot successfully. Data: ' + JSON.stringify(data)); - }).catch(error => { - console.error('getMissionSnapShot failed. Cause: ' + error.message); - }); -} catch (error) { - console.error('getMissionSnapShot failed. Cause: ' + error.message); -} -``` + ```ts + import missionManager from '@ohos.app.ability.missionManager'; + + try { + let allMissions; + missionManager.getMissionInfos('',10).then(function(res){ + allMissions=res; + }).catch(function(err){console.log(err);}); + console.log('size = ' + allMissions.length); + console.log('missions = ' + JSON.stringify(allMissions)); + let id = allMissions[0].missionId; + + let snapshot = missionManager.getMissionSnapShot('', id).catch(function (err){ + console.log(err); + }); + } catch (paramError) { + console.log('error: ' + paramError.code + ', ' + paramError.message); + } + ``` ## missionManager.getLowResolutionMissionSnapShot @@ -547,22 +421,27 @@ Obtains the low-resolution snapshot of a given mission. This API uses an asynchr | callback | AsyncCallback<[MissionSnapshot](js-apis-inner-application-missionSnapshot.md)> | Yes| Callback used to return the snapshot information obtained.| **Example** -```ts -import missionManager from '@ohos.app.ability.missionManager'; -let testMissionId = 2; -try { - missionManager.getLowResolutionMissionSnapShot("", testMissionId, (err, data) => { - if (err) { - console.error('getLowResolutionMissionSnapShot failed:' + err.message); - } else { - console.info('getLowResolutionMissionSnapShot successfully:' + JSON.stringify(data)); - } + ```ts + import missionManager from '@ohos.app.ability.missionManager'; + + try { + missionManager.getMissionInfos('', 10, (error, missions) => { + console.log('getMissionInfos is called, error.code = ' + error.code); + console.log('size = ' + missions.length); + console.log('missions = ' + JSON.stringify(missions)); + let id = missions[0].missionId; + + missionManager.getLowResolutionMissionSnapShot('', id, (error, snapshot) => { + console.log('getLowResolutionMissionSnapShot is called, error.code = ' + error.code); + console.log('bundleName = ' + snapshot.ability.bundleName); + }); }); -} catch (err) { - console.error('getLowResolutionMissionSnapShot failed:' + err.message); -} -``` + } catch (paramError) { + console.log('error: ' + paramError.code + ', ' + paramError.message); + } + ``` + ## missionManager.getLowResolutionMissionSnapShot @@ -591,20 +470,25 @@ Obtains the low-resolution snapshot of a given mission. This API uses a promise **Example** -```ts -import missionManager from '@ohos.app.ability.missionManager'; + ```ts + import missionManager from '@ohos.app.ability.missionManager'; -let testMissionId = 2; -try { - missionManager.getLowResolutionMissionSnapShot("", testMissionId).then((data) => { - console.info('getLowResolutionMissionSnapShot successfully. Data: ' + JSON.stringify(data)); - }).catch(error => { - console.error('getLowResolutionMissionSnapShot failed. Cause: ' + error.message); - }); -} catch (error) { - console.error('getLowResolutionMissionSnapShot failed. Cause: ' + error.message); -} -``` + try { + let allMissions; + missionManager.getMissionInfos('',10).then(function(res){ + allMissions=res; + }).catch(function(err){console.log(err);}); + console.log('size = ' + allMissions.length); + console.log('missions = ' + JSON.stringify(allMissions)); + let id = allMissions[0].missionId; + + let snapshot = missionManager.getLowResolutionMissionSnapShot('', id).catch(function (err){ + console.log(err); + }); + } catch (paramError) { + console.log('error: ' + paramError.code + ', ' + paramError.message); + } + ``` ## missionManager.lockMission @@ -628,22 +512,25 @@ Locks a given mission. This API uses an asynchronous callback to return the resu **Example** -```ts -import missionManager from '@ohos.app.ability.missionManager'; + ```ts + import missionManager from '@ohos.app.ability.missionManager'; -let testMissionId = 2; -try { - missionManager.lockMission(testMissionId, (err, data) => { - if (err) { - console.error('lockMission failed:' + err.message); - } else { - console.info('lockMission successfully:' + JSON.stringify(data)); - } + try { + missionManager.getMissionInfos('', 10, (error, missions) => { + console.log('getMissionInfos is called, error.code = ' + error.code); + console.log('size = ' + missions.length); + console.log('missions = ' + JSON.stringify(missions)); + let id = missions[0].missionId; + + missionManager.lockMission(id).then(() => { + console.log('lockMission is called '); + }); }); -} catch (err) { - console.error('lockMission failed:' + err.message); -} -``` + } catch (paramError) { + console.log('error: ' + paramError.code + ', ' + paramError.message); + } + ``` + ## missionManager.lockMission @@ -670,20 +557,27 @@ Locks a given mission. This API uses a promise to return the result. | Promise<void> | Promise used to return the result.| **Example** -```ts -import missionManager from '@ohos.app.ability.missionManager'; -let testMissionId = 2; -try { - missionManager.lockMission(testMissionId).then((data) => { - console.info('lockMission successfully. Data: ' + JSON.stringify(data)); - }).catch(error => { - console.error('lockMission failed. Cause: ' + error.message); + ```ts + import missionManager from '@ohos.app.ability.missionManager'; + + try { + let allMissions; + missionManager.getMissionInfos('',10).then(function(res){ + allMissions=res; + }).catch(function(err){console.log(err);}); + console.log('size = ' + allMissions.length); + console.log('missions = ' + JSON.stringify(allMissions)); + let id = allMissions[0].missionId; + + missionManager.lockMission(id).catch(function (err){ + console.log(err); }); -} catch (error) { - console.error('lockMission failed. Cause: ' + error.message); -} -``` + } catch (paramError) { + console.log('error: ' + paramError.code + ', ' + paramError.message); + } + ``` + ## missionManager.unlockMission @@ -705,22 +599,26 @@ Unlocks a given mission. This API uses an asynchronous callback to return the re | callback | AsyncCallback<void> | Yes| Callback used to return the result.| **Example** -```ts -import missionManager from '@ohos.app.ability.missionManager'; -let testMissionId = 2; -try { - missionManager.unlockMission(testMissionId, (err, data) => { - if (err) { - console.error('unlockMission failed:' + err.message); - } else { - console.info('unlockMission successfully:' + JSON.stringify(data)); - } + ```ts + import missionManager from '@ohos.app.ability.missionManager'; + + try { + missionManager.getMissionInfos('', 10, (error, missions) => { + console.log('getMissionInfos is called, error.code = ' + error.code); + console.log('size = ' + missions.length); + console.log('missions = ' + JSON.stringify(missions)); + let id = missions[0].missionId; + + missionManager.unlockMission(id).then(() => { + console.log('unlockMission is called '); + }); }); -} catch (err) { - console.error('unlockMission failed:' + err.message); -} -``` + } catch (paramError) { + console.log('error: ' + paramError.code + ', ' + paramError.message); + } + ``` + ## missionManager.unlockMission @@ -748,20 +646,29 @@ Unlocks a given mission. This API uses a promise to return the result. **Example** -```ts -import missionManager from '@ohos.app.ability.missionManager'; + ```ts + import missionManager from '@ohos.app.ability.missionManager'; -let testMissionId = 2; -try { - missionManager.unlockMission(testMissionId).then((data) => { - console.info('unlockMission successfully. Data: ' + JSON.stringify(data)); - }).catch(error => { - console.error('unlockMission failed. Cause: ' + error.message); + try { + let allMissions; + missionManager.getMissionInfos('',10).then(function(res){ + allMissions=res; + }).catch(function(err){console.log(err);}); + console.log('size = ' + allMissions.length); + console.log('missions = ' + JSON.stringify(allMissions)); + let id = allMissions[0].missionId; + + missionManager.lockMission(id).catch(function (err){ + console.log(err); }); -} catch (error) { - console.error('unlockMission failed. Cause: ' + error.message); -} -``` + missionManager.unlockMission(id).catch(function (err){ + console.log(err); + }); + } catch (paramError) { + console.log('error: ' + paramError.code + ', ' + paramError.message); + } + ``` + ## missionManager.clearMission @@ -784,22 +691,24 @@ Clears a given mission, regardless of whether it is locked. This API uses an asy **Example** -```ts -import missionManager from '@ohos.app.ability.missionManager'; + ```ts + import missionManager from '@ohos.app.ability.missionManager'; -let testMissionId = 2; -try { - missionManager.clearMission(testMissionId, (err, data) => { - if (err) { - console.error('clearMission failed:' + err.message); - } else { - console.info('clearMission successfully:' + JSON.stringify(data)); - } + try { + missionManager.getMissionInfos('', 10, (error, missions) => { + console.log('getMissionInfos is called, error.code = ' + error.code); + console.log('size = ' + missions.length); + console.log('missions = ' + JSON.stringify(missions)); + let id = missions[0].missionId; + + missionManager.clearMission(id).then(() => { + console.log('clearMission is called '); + }); }); -} catch (err) { - console.error('clearMission failed:' + err.message); -} -``` + } catch (paramError) { + console.log('error: ' + paramError.code + ', ' + paramError.message); + } + ``` ## missionManager.clearMission @@ -828,20 +737,26 @@ Clears a given mission, regardless of whether it is locked. This API uses a prom **Example** -```ts -import missionManager from '@ohos.app.ability.missionManager'; + ```ts + import missionManager from '@ohos.app.ability.missionManager'; -let testMissionId = 2; -try { - missionManager.clearMission(testMissionId).then((data) => { - console.info('clearMission successfully. Data: ' + JSON.stringify(data)); - }).catch(error => { - console.error('clearMission failed. Cause: ' + error.message); + try { + let allMissions; + missionManager.getMissionInfos('',10).then(function(res){ + allMissions=res; + }).catch(function(err){console.log(err);}); + console.log('size = ' + allMissions.length); + console.log('missions = ' + JSON.stringify(allMissions)); + let id = allMissions[0].missionId; + + missionManager.clearMission(id).catch(function (err){ + console.log(err); }); -} catch (error) { - console.error('clearMission failed. Cause: ' + error.message); -} -``` + } catch (paramError) { + console.log('error: ' + paramError.code + ', ' + paramError.message); + } + ``` + ## missionManager.clearAllMissions @@ -857,21 +772,14 @@ Clears all unlocked missions. This API uses an asynchronous callback to return t **Example** -```ts -import missionManager from '@ohos.app.ability.missionManager'; + ```ts + import missionManager from '@ohos.app.ability.missionManager'; + + missionManager.clearAllMissions().then(() => { + console.log('clearAllMissions is called '); + }); + ``` -try { - missionManager.clearAllMissions(err => { - if (err) { - console.error('clearAllMissions failed:' + err.message); - } else { - console.info('clearAllMissions successfully.'); - } - }); -} catch (err) { - console.error('clearAllMissions failed:' + err.message); -} -``` ## missionManager.clearAllMissions @@ -893,19 +801,13 @@ Clears all unlocked missions. This API uses a promise to return the result. **Example** -```ts -import missionManager from '@ohos.app.ability.missionManager'; + ```ts + import missionManager from '@ohos.app.ability.missionManager'; + missionManager.clearAllMissions().catch(function (err){ + console.log(err); + }); + ``` -try { - missionManager.clearAllMissions(bundleName).then(() => { - console.info('clearAllMissions successfully.'); - }).catch(err => { - console.error('clearAllMissions failed:' + err.message); - }); -} catch (err) { - console.error('clearAllMissions failed:' + err.message); -} -``` ## missionManager.moveMissionToFront @@ -928,22 +830,25 @@ Switches a given mission to the foreground. This API uses an asynchronous callba **Example** -```ts -import missionManager from '@ohos.app.ability.missionManager'; + ```ts + import missionManager from '@ohos.app.ability.missionManager'; -let testMissionId = 2; -try { - missionManager.moveMissionToFront(testMissionId, (err, data) => { - if (err) { - console.error('moveMissionToFront failed:' + err.message); - } else { - console.info('moveMissionToFront successfully:' + JSON.stringify(data)); - } + try { + missionManager.getMissionInfos('', 10, (error, missions) => { + console.log('getMissionInfos is called, error.code = ' + error.code); + console.log('size = ' + missions.length); + console.log('missions = ' + JSON.stringify(missions)); + let id = missions[0].missionId; + + missionManager.moveMissionToFront(id).then(() => { + console.log('moveMissionToFront is called '); + }); }); -} catch (err) { - console.error('moveMissionToFront failed:' + err.message); -} -``` + } catch (paramError) { + console.log('error: ' + paramError.code + ', ' + paramError.message); + } + ``` + ## missionManager.moveMissionToFront @@ -967,22 +872,25 @@ Switches a given mission to the foreground, with the startup parameters for the **Example** -```ts -import missionManager from '@ohos.app.ability.missionManager'; + ```ts + import missionManager from '@ohos.app.ability.missionManager'; -let testMissionId = 2; -try { - missionManager.moveMissionToFront(testMissionId, {windowMode : 101}, (err, data) => { - if (err) { - console.error('moveMissionToFront failed:' + err.message); - } else { - console.info('moveMissionToFront successfully:' + JSON.stringify(data)); - } + try { + missionManager.getMissionInfos('', 10, (error, missions) => { + console.log('getMissionInfos is called, error.code = ' + error.code); + console.log('size = ' + missions.length); + console.log('missions = ' + JSON.stringify(missions)); + let id = missions[0].missionId; + + missionManager.moveMissionToFront(id,{windowMode : 101}).then(() => { + console.log('moveMissionToFront is called '); + }); }); -} catch (err) { - console.error('moveMissionToFront failed:' + err.message); -} -``` + } catch (paramError) { + console.log('error: ' + paramError.code + ', ' + paramError.message); + } + ``` + ## missionManager.moveMissionToFront @@ -1011,17 +919,22 @@ Switches a given mission to the foreground, with the startup parameters for the **Example** -```ts -import missionManager from '@ohos.app.ability.missionManager'; + ```ts + import missionManager from '@ohos.app.ability.missionManager'; -let testMissionId = 2; -try { - missionManager.moveMissionToFront(testMissionId).then((data) => { - console.info('moveMissionToFront successfully. Data: ' + JSON.stringify(data)); - }).catch(error => { - console.error('moveMissionToFront failed. Cause: ' + error.message); + try { + let allMissions; + missionManager.getMissionInfos('',10).then(function(res){ + allMissions=res; + }).catch(function(err){console.log(err);}); + console.log('size = ' + allMissions.length); + console.log('missions = ' + JSON.stringify(allMissions)); + let id = allMissions[0].missionId; + + missionManager.moveMissionToFront(id).catch(function (err){ + console.log(err); }); -} catch (error) { - console.error('moveMissionToFront failed. Cause: ' + error.message); -} -``` + } catch (paramError) { + console.log('error: ' + paramError.code + ', ' + paramError.message); + } + ``` diff --git a/en/application-dev/reference/apis/js-apis-app-ability-quickFixManager.md b/en/application-dev/reference/apis/js-apis-app-ability-quickFixManager.md index a2090ed00e60cac1b5452bf6357f47cfb3c7be2e..ac26642228b5cdc386b65d8c9e2e1c429fdb9819 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-quickFixManager.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-quickFixManager.md @@ -3,7 +3,7 @@ The **quickFixManager** module provides APIs for quick fix. With quick fix, you can fix bugs in your application by applying patches, which is more efficient than by updating the entire application. > **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. ## Modules to Import @@ -24,7 +24,7 @@ Defines the quick fix information at the HAP file level. | ----------- | -------------------- | ---- | ------------------------------------------------------------ | | moduleName | string | Yes | Name of the HAP file. | | originHapHash | string | Yes | Hash value of the HAP file. | -| quickFixFilePath | string | Yes | Installation path of the quick fix file. | +| quickFixFilePath | string | Yes | Installation path of the quick fix patch file. | ## ApplicationQuickFixInfo @@ -57,25 +57,31 @@ Applies a quick fix patch. This API uses an asynchronous callback to return the **Parameters** - | Parameter| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | hapModuleQuickFixFiles | Array\ | Yes| Quick fix files, each of which must contain a valid file path.| - | callback | AsyncCallback\ | Yes| Callback used to return the result.| +| Parameter| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| hapModuleQuickFixFiles | Array\ | Yes| Quick fix patch files, each of which must contain a valid file path.| +| callback | AsyncCallback\ | Yes| Callback used to return the result.| + +> **NOTE** +> +> The file path passed in the API must be an application sandbox path. For details about how to obtain the sandbox path, see [Obtaining the Sandbox Path](js-apis-bundle-BundleInstaller.md#obtaining-the-sandbox-path). The path mapped to the device is **/proc/<*applicationProcessId*>/root/*sandboxPath***. **Example** - + ```ts + import quickFixManager from '@ohos.app.ability.quickFixManager'; + try { - let hapModuleQuickFixFiles = ["/data/storage/el2/base/entry.hqf"] + let hapModuleQuickFixFiles = ['/data/storage/el2/base/entry.hqf']; quickFixManager.applyQuickFix(hapModuleQuickFixFiles, (error) => { if (error) { - console.info( `applyQuickFix failed with error + ${error}`) + console.info( `applyQuickFix failed with error + ${error}`); } else { - console.info( 'applyQuickFix success') + console.info( 'applyQuickFix success'); } - }) + }); } catch (paramError) { - console.log("error: " + paramError.code + ", " + paramError.message); + console.log('error: ' + paramError.code + ', ' + paramError.message); } ``` @@ -93,28 +99,30 @@ Applies a quick fix patch. This API uses a promise to return the result. **Parameters** - | Parameter| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | hapModuleQuickFixFiles | Array\ | Yes| Quick fix files, each of which must contain a valid file path.| +| Parameter| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| hapModuleQuickFixFiles | Array\ | Yes| Quick fix patch files, each of which must contain a valid file path.| **Return value** - | Type| Description| - | -------- | -------- | - | Promise\ | Promise used to return the result.| +| Type| Description| +| -------- | -------- | +| Promise\ | Promise used to return the result.| **Example** - + ```ts - let hapModuleQuickFixFiles = ["/data/storage/el2/base/entry.hqf"] + import quickFixManager from '@ohos.app.ability.quickFixManager'; + + let hapModuleQuickFixFiles = ['/data/storage/el2/base/entry.hqf']; try { quickFixManager.applyQuickFix(hapModuleQuickFixFiles).then(() => { - console.info('applyQuickFix success') + console.info('applyQuickFix success'); }).catch((error) => { - console.info(`applyQuickFix err: + ${error}`) - }) + console.info(`applyQuickFix err: + ${error}`); + }); } catch (paramError) { - console.log("error: " + paramError.code + ", " + paramError.message); + console.log('error: ' + paramError.code + ', ' + paramError.message); } ``` @@ -138,20 +146,22 @@ Obtains the quick fix information of the application. This API uses an asynchron | callback | AsyncCallback\<[ApplicationQuickFixInfo](#applicationquickfixinfo)> | Yes| Callback used to return the quick fix information.| **Example** - + ```ts + import quickFixManager from '@ohos.app.ability.quickFixManager'; + try { - let bundleName = "bundleName" + let bundleName = 'bundleName' quickFixManager.getApplicationQuickFixInfo(bundleName, (error, data) => { if (error) { - console.info(`getApplicationQuickFixInfo error: + ${error}`) + console.info(`getApplicationQuickFixInfo error: + ${error}`); } else { - console.info(`getApplicationQuickFixInfo success: + ${data}`) + console.info(`getApplicationQuickFixInfo success: + ${data}`); } - }) + }); } catch (paramError) { - console.log("error: " + paramError.code + ", " + paramError.message); - } + console.log('error: ' + paramError.code + ', ' + paramError.message); + } ``` ## quickFixManager.getApplicationQuickFixInfo @@ -174,21 +184,23 @@ Obtains the quick fix information of the application. This API uses a promise to **Return value** - | Type| Description| - | -------- | -------- | - | Promise\<[ApplicationQuickFixInfo](#applicationquickfixinfo)> | Promise used to return the quick fix information.| +| Type| Description| +| -------- | -------- | +| Promise\<[ApplicationQuickFixInfo](#applicationquickfixinfo)> | Promise used to return the quick fix information.| **Example** ```ts + import quickFixManager from '@ohos.app.ability.quickFixManager'; + try { - let bundleName = "bundleName" + let bundleName = 'bundleName'; quickFixManager.getApplicationQuickFixInfo(bundleName).then((data) => { - console.info(`getApplicationQuickFixInfo success: + ${data}`) + console.info(`getApplicationQuickFixInfo success: + ${data}`); }).catch((error) => { - console.info(`getApplicationQuickFixInfo err: + ${error}`) - }) + console.info(`getApplicationQuickFixInfo err: + ${error}`); + }); } catch (paramError) { - console.log("error: " + paramError.code + ", " + paramError.message); + console.log('error: ' + paramError.code + ', ' + paramError.message); } - ``` +``` diff --git a/en/application-dev/reference/apis/js-apis-app-ability-serviceExtensionAbility.md b/en/application-dev/reference/apis/js-apis-app-ability-serviceExtensionAbility.md index 0efdb59d5eaed4c2b70e5ff666b0c9d63b11212f..effff8a5277344b18c274847808dae7897c85866 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-serviceExtensionAbility.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-serviceExtensionAbility.md @@ -1,10 +1,10 @@ # @ohos.app.ability.ServiceExtensionAbility (ServiceExtensionAbility) -The **ServiceExtensionAbility** module provides lifecycle callbacks when a ServiceExtensionAbility (background service) is created, destroyed, connected, or disconnected. +The **ServiceExtensionAbility** module provides APIs for ServiceExtensionAbilities. > **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 of this module are supported since API version 9 and are deprecated in versions later than API version 9. You are advised to use [@ohos.app.ability.ServiceExtensionAbility](js-apis-app-ability-serviceExtensionAbility.md) instead. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The APIs of this module can be used only in the stage model. ## Modules to Import @@ -80,7 +80,7 @@ Called when this ServiceExtensionAbility is destroyed to clear resources. onRequest(want: Want, startId: number): void; -Called following **onCreate()** when a ServiceExtensionAbility is started by calling **startAbility()**. The value of **startId** is incremented for each ability that is started. +Called following **onCreate()** when a ServiceExtensionAbility is started by calling **startAbility()** or **startServiceExtensionAbility()**. The value of **startId** is incremented for each ability that is started. **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -129,7 +129,7 @@ Called following **onCreate()** when a ServiceExtensionAbility is started by cal **Example** ```ts - import rpc from '@ohos.rpc' + import rpc from '@ohos.rpc'; class StubTest extends rpc.RemoteObject{ constructor(des) { super(des); @@ -140,7 +140,7 @@ Called following **onCreate()** when a ServiceExtensionAbility is started by cal class ServiceExt extends ServiceExtension { onConnect(want) { console.log('onConnect , want:' + want.abilityName); - return new StubTest("test"); + return new StubTest('test'); } } ``` @@ -150,7 +150,7 @@ Called following **onCreate()** when a ServiceExtensionAbility is started by cal onDisconnect(want: Want): void; -Called when a client is disconnected from this ServiceExtensionAbility. +Called when this ServiceExtensionAbility is disconnected. **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -176,7 +176,7 @@ Called when a client is disconnected from this ServiceExtensionAbility. onReconnect(want: Want): void; -Called when a new client attempts to connect to this ServiceExtensionAbility after all previous clients are disconnected. This capability is reserved. +Called when this ServiceExtensionAbility is reconnected. **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -246,7 +246,8 @@ Dumps the client information. class ServiceExt extends ServiceExtension { onDump(params) { console.log('dump, params:' + JSON.stringify(params)); - return ["params"] + return ['params']; } } ``` + diff --git a/en/application-dev/reference/apis/js-apis-app-ability-uiAbility.md b/en/application-dev/reference/apis/js-apis-app-ability-uiAbility.md index 38d9f5428c37873ae9f786ed0f391142f30a011b..127add25d18fbeda45b6bd44bd82f3dd74a5540b 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-uiAbility.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-uiAbility.md @@ -1,9 +1,10 @@ # @ohos.app.ability.UIAbility (UIAbility) -UIAbility is an application component that has the UI. The **UIAbility** module provides lifecycle callback such as component creation, destruction, and foreground/background switching. It also provides the following capabilities related to component collaboration: +The **Ability** module manages the ability lifecycle and context, such as creating and destroying an ability, and dumping client information. -- [Caller](#caller): an object returned by [startAbilityByCall](js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartabilitybycall). The CallerAbility (caller) uses this object to communicate with the CalleeAbility (callee). -- [Callee](#callee): an internal object of UIAbility. The CalleeAbility (callee) uses this object to communicate with the CallerAbility (caller). +This module provides the following common ability-related functions: +- [Caller](#caller): implements sending of sequenceable data to the target ability when an ability (caller ability) invokes the target ability (callee ability). +- [Callee](#callee): implements callbacks for registration and deregistration of caller notifications. > **NOTE** > @@ -13,7 +14,7 @@ UIAbility is an application component that has the UI. The **UIAbility** module ## Modules to Import ```ts -import UIAbility from '@ohos.app.ability.UIAbility'; +import Ability from '@ohos.app.ability.UIAbility'; ``` ## Attributes @@ -22,16 +23,16 @@ import UIAbility from '@ohos.app.ability.UIAbility'; | Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | -| context | [UIAbilityContext](js-apis-inner-application-uiAbilityContext.md) | Yes| No| Context of the UIAbility.| -| launchWant | [Want](js-apis-app-ability-want.md) | Yes| No| Parameters for starting the UIAbility.| -| lastRequestWant | [Want](js-apis-app-ability-want.md) | Yes| No| Parameters used when the UIAbility was started last time.| +| context | [UIAbilityContext](js-apis-inner-application-uiAbilityContext.md) | Yes| No| Context of the ability.| +| launchWant | [Want](js-apis-app-ability-want.md) | Yes| No| Parameters for starting the ability.| +| lastRequestWant | [Want](js-apis-app-ability-want.md) | Yes| No| Parameters used when the ability was started last time.| | callee | [Callee](#callee) | Yes| No| Object that invokes the stub service.| -## UIAbility.onCreate +## Ability.onCreate onCreate(want: Want, param: AbilityConstant.LaunchParam): void; -Called to initialize the service logic when a UIAbility is created. +Called to initialize the service logic when an ability is created. **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore @@ -39,13 +40,13 @@ Called to initialize the service logic when a UIAbility is created. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| want | [Want](js-apis-app-ability-want.md) | Yes| Information related to this UIAbility, including the ability name and bundle name.| -| param | [AbilityConstant.LaunchParam](js-apis-app-ability-abilityConstant.md#abilityconstantlaunchparam) | Yes| Parameters for starting the UIAbility, and the reason for the last abnormal exit.| +| want | [Want](js-apis-app-ability-want.md) | Yes| Information related to this ability, including the ability name and bundle name.| +| param | [AbilityConstant.LaunchParam](js-apis-app-ability-abilityConstant.md#abilityconstantlaunchparam) | Yes| Parameters for starting the ability, and the reason for the last abnormal exit.| **Example** ```ts - class MyUIAbility extends UIAbility { + class myAbility extends Ability { onCreate(want, param) { console.log('onCreate, want:' + want.abilityName); } @@ -53,11 +54,11 @@ Called to initialize the service logic when a UIAbility is created. ``` -## UIAbility.onWindowStageCreate +## Ability.onWindowStageCreate onWindowStageCreate(windowStage: window.WindowStage): void -Called when a **WindowStage** is created for this UIAbility. +Called when a **WindowStage** is created for this ability. **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore @@ -70,7 +71,7 @@ Called when a **WindowStage** is created for this UIAbility. **Example** ```ts - class MyUIAbility extends UIAbility { + class myAbility extends Ability { onWindowStageCreate(windowStage) { console.log('onWindowStageCreate'); } @@ -78,18 +79,18 @@ Called when a **WindowStage** is created for this UIAbility. ``` -## UIAbility.onWindowStageDestroy +## Ability.onWindowStageDestroy onWindowStageDestroy(): void -Called when the **WindowStage** is destroyed for this UIAbility. +Called when the **WindowStage** is destroyed for this ability. **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore **Example** ```ts - class MyUIAbility extends UIAbility { + class myAbility extends Ability { onWindowStageDestroy() { console.log('onWindowStageDestroy'); } @@ -97,11 +98,11 @@ Called when the **WindowStage** is destroyed for this UIAbility. ``` -## UIAbility.onWindowStageRestore +## Ability.onWindowStageRestore onWindowStageRestore(windowStage: window.WindowStage): void -Called when the **WindowStage** is restored during the migration of this UIAbility, which is a multi-instance ability. +Called when the **WindowStage** is restored during the migration of this ability, which is a multi-instance ability. **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore @@ -114,7 +115,7 @@ Called when the **WindowStage** is restored during the migration of this UIAbili **Example** ```ts - class MyUIAbility extends UIAbility { + class myAbility extends Ability { onWindowStageRestore(windowStage) { console.log('onWindowStageRestore'); } @@ -122,18 +123,18 @@ Called when the **WindowStage** is restored during the migration of this UIAbili ``` -## UIAbility.onDestroy +## Ability.onDestroy onDestroy(): void; -Called when this UIAbility is destroyed to clear resources. +Called when this ability is destroyed to clear resources. **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore **Example** ```ts - class MyUIAbility extends UIAbility { + class myAbility extends Ability { onDestroy() { console.log('onDestroy'); } @@ -141,18 +142,18 @@ Called when this UIAbility is destroyed to clear resources. ``` -## UIAbility.onForeground +## Ability.onForeground onForeground(): void; -Called when this UIAbility is switched from the background to the foreground. +Called when this ability is switched from the background to the foreground. **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore **Example** ```ts - class MyUIAbility extends UIAbility { + class myAbility extends Ability { onForeground() { console.log('onForeground'); } @@ -160,18 +161,18 @@ Called when this UIAbility is switched from the background to the foreground. ``` -## UIAbility.onBackground +## Ability.onBackground onBackground(): void; -Called when this UIAbility is switched from the foreground to the background. +Called when this ability is switched from the foreground to the background. **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore **Example** ```ts - class MyUIAbility extends UIAbility { + class myAbility extends Ability { onBackground() { console.log('onBackground'); } @@ -179,7 +180,7 @@ Called when this UIAbility is switched from the foreground to the background. ``` -## UIAbility.onContinue +## Ability.onContinue onContinue(wantParam : {[key: string]: any}): AbilityConstant.OnContinueResult; @@ -202,22 +203,22 @@ Called to save data during the ability migration preparation process. **Example** ```ts - import AbilityConstant from "@ohos.app.ability.AbilityConstant" + import AbilityConstant from '@ohos.app.ability.AbilityConstant'; class MyUIAbility extends UIAbility { onContinue(wantParams) { console.log('onContinue'); - wantParams["myData"] = "my1234567"; + wantParams['myData'] = 'my1234567'; return AbilityConstant.OnContinueResult.AGREE; } } ``` -## UIAbility.onNewWant +## Ability.onNewWant onNewWant(want: Want, launchParams: AbilityConstant.LaunchParam): void; -Called when a new Want is passed in and this UIAbility is started again. +Called when a new Want is passed in and this ability is started again. **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore @@ -226,20 +227,20 @@ Called when a new Want is passed in and this UIAbility is started again. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | want | [Want](js-apis-app-ability-want.md) | Yes| Want information, such as the ability name and bundle name.| -| launchParams | [AbilityConstant.LaunchParam](js-apis-app-ability-abilityConstant.md#abilityconstantlaunchparam) | Yes| Reason for the UIAbility startup and the last abnormal exit.| +| launchParams | [AbilityConstant.LaunchParam](js-apis-app-ability-abilityConstant.md#abilityconstantlaunchparam) | Yes| Reason for the ability startup and the last abnormal exit.| **Example** ```ts - class MyUIAbility extends UIAbility { + class MyUIAbility extends UIAbility { onNewWant(want, launchParams) { console.log('onNewWant, want:' + want.abilityName); console.log('onNewWant, launchParams:' + JSON.stringify(launchParams)); - } - } + } + } ``` -## UIAbility.onDump +## Ability.onDump onDump(params: Array\): Array\; @@ -256,20 +257,20 @@ Dumps client information. **Example** ```ts - class MyUIAbility extends UIAbility { + class myAbility extends Ability { onDump(params) { console.log('dump, params:' + JSON.stringify(params)); - return ["params"] + return ['params']; } } ``` -## UIAbility.onSaveState +## Ability.onSaveState onSaveState(reason: AbilityConstant.StateType, wantParam : {[key: string]: any}): AbilityConstant.OnSaveResult; -Called when the framework automatically saves the UIAbility state in the case of an application fault. This API is used together with [appRecovery](js-apis-app-ability-appRecovery.md). If automatic state saving is enabled, **onSaveState** is called to save the state of this UIAbility. +Called when the framework automatically saves the ability state in the case of an application fault. This API is used together with [appRecovery](js-apis-app-ability-appRecovery.md). If automatic state saving is enabled, **onSaveState** is called to save the state of this ability. **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore @@ -277,24 +278,24 @@ Called when the framework automatically saves the UIAbility state in the case of | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| reason | [AbilityConstant.StateType](js-apis-app-ability-abilityConstant.md#abilityconstantstatetype) | Yes| Reason for triggering the callback to save the UIAbility state.| +| reason | [AbilityConstant.StateType](js-apis-application-abilityConstant.md#abilityconstantstatetype) | Yes| Reason for triggering the callback to save the ability state.| | wantParam | {[key: string]: any} | Yes| **want** parameter.| **Return value** | Type| Description| | -------- | -------- | -| [AbilityConstant.OnSaveResult](js-apis-app-ability-abilityConstant.md#abilityconstantonsaveresult) | Whether the UIAbility state is saved.| +| AbilityConstant.OnSaveResult | Whether the ability state is saved.| **Example** ```ts -import AbilityConstant from '@ohos.app.ability.AbilityConstant' +import AbilityConstant from '@ohos.app.ability.AbilityConstant'; class MyUIAbility extends UIAbility { onSaveState(reason, wantParam) { console.log('onSaveState'); - wantParam["myData"] = "my1234567"; + wantParam['myData'] = 'my1234567'; return AbilityConstant.OnSaveResult.RECOVERY_AGREE; } } @@ -338,9 +339,10 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error **Example** ```ts - class MyMessageAble{ // Custom sequenceable data structure. - name:"" - str:"" + import Ability from '@ohos.app.ability.UIAbility'; + class MyMessageAble{ // ԶSequenceableݽṹ + name:'' + str:'' num: 1 constructor(name, str) { this.name = name; @@ -359,17 +361,18 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error return true; } }; - var method = 'call_Function'; // Notification message string negotiated by the two abilities. - var caller; - export default class MainUIAbility extends UIAbility { + let method = 'call_Function'; // Notification message string negotiated by the two abilities. + let caller; + export default class MainAbility extends Ability { onWindowStageCreate(windowStage) { - this.context.startUIAbilityByCall({ - bundleName: "com.example.myservice", - abilityName: "MainUIAbility", - deviceId: "" + this.context.startAbilityByCall({ + bundleName: 'com.example.myservice', + abilityName: 'MainAbility', + deviceId: '' }).then((obj) => { caller = obj; - let msg = new MyMessageAble("msg", "world"); // See the definition of Sequenceable. + let msg = new MyMessageAble('msg', 'world'); // See the definition of Sequenceable. + caller.call(method, msg) .then(() => { console.log('Caller call() called'); @@ -419,9 +422,10 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error **Example** ```ts + import Ability from '@ohos.app.ability.UIAbility'; class MyMessageAble{ - name:"" - str:"" + name:'' + str:'' num: 1 constructor(name, str) { this.name = name; @@ -440,21 +444,21 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error return true; } }; - var method = 'call_Function'; - var caller; - export default class MainUIAbility extends UIAbility { + let method = 'call_Function'; + let caller; + export default class MainAbility extends Ability { onWindowStageCreate(windowStage) { - this.context.startUIAbilityByCall({ - bundleName: "com.example.myservice", - abilityName: "MainUIAbility", - deviceId: "" + this.context.startAbilityByCall({ + bundleName: 'com.example.myservice', + abilityName: 'MainAbility', + deviceId: '' }).then((obj) => { caller = obj; - let msg = new MyMessageAble(1, "world"); + let msg = new MyMessageAble(1, 'world'); caller.callWithResult(method, msg) .then((data) => { console.log('Caller callWithResult() called'); - let retmsg = new MyMessageAble(0, ""); + let retmsg = new MyMessageAble(0, ''); data.readSequenceable(retmsg); }) .catch((callErr) => { @@ -490,13 +494,14 @@ Releases the caller interface of the target ability. **Example** ```ts - var caller; - export default class MainUIAbility extends UIAbility { + import Ability from '@ohos.app.ability.UIAbility'; + let caller; + export default class MainAbility extends Ability { onWindowStageCreate(windowStage) { - this.context.startUIAbilityByCall({ - bundleName: "com.example.myservice", - abilityName: "MainUIAbility", - deviceId: "" + this.context.startAbilityByCall({ + bundleName: 'com.example.myservice', + abilityName: 'MainAbility', + deviceId: '' }).then((obj) => { caller = obj; try { @@ -525,18 +530,19 @@ Registers a callback that is invoked when the stub on the target ability is disc | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| callback | [OnReleaseCallBack](#onreleasecallback) | Yes| Callback used for the **onRelease** API.| +| callback | [OnReleaseCallBack](#onreleasecallback) | Yes| Callback used to return the result.| **Example** ```ts - var caller; - export default class MainUIAbility extends UIAbility { + import Ability from '@ohos.application.Ability'; + let caller; + export default class MainAbility extends Ability { onWindowStageCreate(windowStage) { - this.context.startUIAbilityByCall({ - bundleName: "com.example.myservice", - abilityName: "MainUIAbility", - deviceId: "" + this.context.startAbilityByCall({ + bundleName: 'com.example.myservice', + abilityName: 'MainAbility', + deviceId: '' }).then((obj) => { caller = obj; try { @@ -544,7 +550,7 @@ Registers a callback that is invoked when the stub on the target ability is disc console.log(' Caller OnRelease CallBack is called ' + str); }); } catch (error) { - console.log('Caller.on catch error, error.code: ' + JSON.stringify(error.code) + + console.log('Caller.onRelease catch error, error.code: ' + JSON.stringify(error.code) + ' error.message: ' + JSON.stringify(error.message)); } }).catch((err) => { @@ -557,7 +563,7 @@ Registers a callback that is invoked when the stub on the target ability is disc ## Caller.on - on(type: "release", callback: OnReleaseCallback): void; + on(type: 'release', callback: OnReleaseCallback): void; Registers a callback that is invoked when the stub on the target ability is disconnected. @@ -568,7 +574,7 @@ Registers a callback that is invoked when the stub on the target ability is disc | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | type | string | Yes| Event type. The value is fixed at **release**.| -| callback | [OnReleaseCallBack](#onreleasecallback) | Yes| Callback used for the **onRelease** API.| +| callback | [OnReleaseCallBack](#onreleasecallback) | Yes| Callback used to return the result.| **Error codes** @@ -581,17 +587,18 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error **Example** ```ts - var caller; - export default class MainUIAbility extends UIAbility { + import Ability from '@ohos.app.ability.UIAbility'; + let caller; + export default class MainAbility extends Ability { onWindowStageCreate(windowStage) { - this.context.startUIAbilityByCall({ - bundleName: "com.example.myservice", - abilityName: "MainUIAbility", - deviceId: "" + this.context.startAbilityByCall({ + bundleName: 'com.example.myservice', + abilityName: 'MainAbility', + deviceId: '' }).then((obj) => { caller = obj; try { - caller.on("release", (str) => { + caller.on('release', (str) => { console.log(' Caller OnRelease CallBack is called ' + str); }); } catch (error) { @@ -606,6 +613,108 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error } ``` +## Caller.off + +off(type: 'release', callback: OnReleaseCallback): void; + +Deregisters a callback that is invoked when the stub on the target ability is disconnected. This capability is reserved. + +**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore + +**Parameters** + +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| type | string | Yes| Event type. The value is fixed at **release**.| +| callback | [OnReleaseCallBack](#onreleasecallback) | Yes| Callback used to return the result.| + +**Error codes** + +| ID| Error Message| +| ------- | -------------------------------- | +| 401 | If the input parameter is not valid parameter. | +For other IDs, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + +**Example** + + ```ts + let caller; + export default class MainUIAbility extends UIAbility { + onWindowStageCreate(windowStage) { + this.context.startAbilityByCall({ + bundleName: 'com.example.myservice', + abilityName: 'MainUIAbility', + deviceId: '' + }).then((obj) => { + caller = obj; + try { + let onReleaseCallBack = (str) => { + console.log(' Caller OnRelease CallBack is called ' + str); + }; + caller.on('release', onReleaseCallBack); + caller.off('release', onReleaseCallBack); + } catch (error) { + console.log('Caller.on or Caller.off catch error, error.code: ' + JSON.stringify(error.code) + + ' error.message: ' + JSON.stringify(error.message)); + } + }).catch((err) => { + console.log('Caller GetCaller error, error.code: ' + JSON.stringify(err.code) + + ' error.message: ' + JSON.stringify(err.message)); + }); + } + } + ``` + +## Caller.off + +off(type: 'release'): void; + +Deregisters a callback that is invoked when the stub on the target ability is disconnected. This capability is reserved. + +**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore + +**Parameters** + +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| type | string | Yes| Event type. The value is fixed at **release**.| + +**Error codes** + +| ID| Error Message| +| ------- | -------------------------------- | +| 401 | If the input parameter is not valid parameter. | +For other IDs, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + +**Example** + + ```ts + let caller; + export default class MainUIAbility extends UIAbility { + onWindowStageCreate(windowStage) { + this.context.startAbilityByCall({ + bundleName: 'com.example.myservice', + abilityName: 'MainUIAbility', + deviceId: '' + }).then((obj) => { + caller = obj; + try { + let onReleaseCallBack = (str) => { + console.log(' Caller OnRelease CallBack is called ' + str); + }; + caller.on('release', onReleaseCallBack); + caller.off('release'); + } catch (error) { + console.error('Caller.on or Caller.off catch error, error.code: ' + JSON.stringify(error.code) + + ' error.message: ' + JSON.stringify(error.message)); + } + }).catch((err) => { + console.error('Caller GetCaller error, error.code: ' + JSON.stringify(err.code) + + ' error.message: ' + JSON.stringify(err.message)); + }); + } + } + ``` ## Callee @@ -624,7 +733,7 @@ Registers a caller notification callback, which is invoked when the target abili | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | method | string | Yes| Notification message string negotiated between the two abilities.| -| callback | [CalleeCallback](#calleecallback) | Yes| JS notification synchronization callback of the [rpc.MessageParcel](js-apis-rpc.md#messageparceldeprecated) type. The callback must return at least one empty [rpc.Sequenceable](js-apis-rpc.md#sequenceabledeprecated) object. Otherwise, the function execution fails.| +| callback | [CalleeCallback](#calleecallback) | Yes| JS notification synchronization callback of the [rpc.MessageParcel](js-apis-rpc.md#sequenceabledeprecated) type. The callback must return at least one empty [rpc.Sequenceable](js-apis-rpc.md#sequenceabledeprecated) object. Otherwise, the function execution fails.| **Error codes** @@ -637,9 +746,10 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error **Example** ```ts + import Ability from '@ohos.app.ability.UIAbility'; class MyMessageAble{ - name:"" - str:"" + name:'' + str:'' num: 1 constructor(name, str) { this.name = name; @@ -658,14 +768,14 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error return true; } }; - var method = 'call_Function'; + let method = 'call_Function'; function funcCallBack(pdata) { console.log('Callee funcCallBack is called ' + pdata); - let msg = new MyMessageAble("test", ""); + let msg = new MyMessageAble('test', ''); pdata.readSequenceable(msg); - return new MyMessageAble("test1", "Callee test"); + return new MyMessageAble('test1', 'Callee test'); } - export default class MainUIAbility extends UIAbility { + export default class MainAbility extends Ability { onCreate(want, launchParam) { console.log('Callee onCreate is called'); try { @@ -704,8 +814,9 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error **Example** ```ts - var method = 'call_Function'; - export default class MainUIAbility extends UIAbility { + import Ability from '@ohos.app.ability.UIAbility'; + let method = 'call_Function'; + export default class MainAbility extends Ability { onCreate(want, launchParam) { console.log('Callee onCreate is called'); try { @@ -736,4 +847,4 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error | Name| Readable| Writable| Type| Description| | -------- | -------- | -------- | -------- | -------- | -| (indata: [rpc.MessageParcel](js-apis-rpc.md#messageparceldeprecated)) | Yes| No| [rpc.Sequenceable](js-apis-rpc.md#sequenceabledeprecated) | Prototype of the listener function registered by the callee.| +| (indata: [rpc.MessageParcel](js-apis-rpc.md#sequenceabledeprecated)) | Yes| No| [rpc.Sequenceable](js-apis-rpc.md#sequenceabledeprecated) | Prototype of the listener function registered by the callee.| diff --git a/en/application-dev/reference/apis/js-apis-app-ability-want.md b/en/application-dev/reference/apis/js-apis-app-ability-want.md index c96e29d90f3a10a563df41bc8a545cb42dfdeba4..072650fbf9da660338776689f4db051d2e417af0 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-want.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-want.md @@ -18,119 +18,118 @@ import Want from '@ohos.app.ability.Want'; | Name | Type | Mandatory| Description | | ----------- | -------------------- | ---- | ------------------------------------------------------------ | -| deviceId | string | No | ID of the device running the ability. If this field is unspecified, the local device is used. | -| bundleName | string | No | Bundle name of the ability.| -| moduleName | string | No| Name of the module to which the ability belongs.| +| deviceId | string | No | ID of the device running the ability. | +| bundleName | string | No | Bundle name of the ability. If both **bundleName** and **abilityName** are specified in a **Want** object, the **Want** object can match a specific ability. | | abilityName | string | No | Name of the ability. If both **bundleName** and **abilityName** are specified in a **Want** object, the **Want** object can match a specific ability. The value of **abilityName** must be unique in an application.| -| [action](js-apis-app-ability-wantConstant.md#wantconstantaction) | string | No | Action to take, such as viewing and sharing application details. In implicit Want, you can define this field and use it together with **uri** or **parameters** to specify the operation to be performed on the data. For details about the definition and matching rules of implicit Want, see [Matching Rules of Explicit Want and Implicit Want](../../application-models/explicit-implicit-want-mappings.md). | -| [entities](js-apis-app-ability-wantConstant.md#wantconstantentity) | Array\ | No| Additional category information (such as browser and video player) of the ability. It is a supplement to the **action** field for implicit Want. and is used to filter ability types.| -| uri | string | No| Data carried. This field is used together with **type** to specify the data type. If **uri** is specified in a Want, the Want will match the specified URI information, including **scheme**, **schemeSpecificPart**, **authority**, and **path**.| -| type | string | No| MIME type, that is, the type of the file to open, for example, **text/xml** and **image/***. For details about the MIME type definition, see https://www.iana.org/assignments/media-types/media-types.xhtml?utm_source=ld246.com.| -| parameters | {[key: string]: any} | No | Want parameters in the form of custom key-value (KV) pairs. By default, the following keys are carried:
- **ohos.aafwk.callerPid**: PID of the caller.
- **ohos.aafwk.param.callerToken**: token of the caller.
- **ohos.aafwk.param.callerUid**: UID in [BundleInfo](js-apis-bundleManager-bundleInfo.md#bundleinfo-1), that is, the application UID in the bundle information. | -| [flags](js-apis-ability-wantConstant.md#wantconstantflags) | number | No| How the **Want** object will be handled. By default, a number is passed in.
For example, **wantConstant.Flags.FLAG_ABILITY_CONTINUATION** specifies whether to start the ability in cross-device migration scenarios.| +| uri | string | No| If **uri** is specified in a **Want**, the **Want** will match the specified URI information, including **scheme**, **schemeSpecificPart**, **authority**, and **path** components.| +| type | string | No| MIME type, that is, the type of the file to open, for example, **'text/xml'** and **'image/*'**. For details about the MIME type definition, see https://www.iana.org/assignments/media-types/media-types.xhtml?utm_source=ld246.com.| +| flags | number | No| How the **Want** object will be handled. By default, a number is passed in. For details, see [flags](js-apis-ability-wantConstant.md#wantConstant.Flags). | +| action | string | No | Action to take, such as viewing and sharing application details. In implicit Want, you can define this field and use it together with **uri** or **parameters** to specify the operation to be performed on the data. | +| parameters | {[key: string]: any} | No | Want parameters in the form of custom key-value (KV) pairs. By default, the following keys are carried:
- **ohos.aafwk.callerPid**: PID of the caller.
- **ohos.aafwk.param.callerToken**: token of the caller.
- **ohos.aafwk.param.callerUid**: UID in [BundleInfo](js-apis-bundleManager-bundleInfo.md#bundleinfo-1), that is, the application UID in the bundle information.
- **component.startup.newRules**: whether to enable the new control rule.
- **moduleName**: module name of the caller. No matter what this field is set to, the correct module name will be sent to the peer.
- **ohos.dlp.params.sandbox**: available only for DLP files. | +| entities | Array\ | No| Additional category information (such as browser and video player) of the ability. It is a supplement to the **action** field for implicit Want. and is used to filter ability types.| +| moduleName | string | | Module to which the ability belongs. | **Example** -- Basic usage (called in a UIAbility object, where context in the example is the context object of the UIAbility). +- Basic usage ```ts let want = { - "deviceId": "", // An empty deviceId indicates the local device. - "bundleName": "com.example.myapplication", - "abilityName": "FuncAbility", - "moduleName": "entry" // moduleName is optional. + 'deviceId': '', // An empty deviceId indicates the local device. + 'bundleName': 'com.extreme.test', + 'abilityName': 'MainAbility', + 'moduleName': 'entry' // moduleName is optional }; this.context.startAbility(want, (error) => { // Start an ability explicitly. The bundleName, abilityName, and moduleName parameters work together to uniquely identify an ability. - console.log("error.code = " + error.code) + console.log('error.code = ' + error.code); }) ``` -- Data is transferred through user-defined fields. The following data types are supported (called in a UIAbility object, where context in the example is the context object of the UIAbility): +- Data is transferred through user-defined fields. The following data types are supported: * String ```ts let want = { - bundleName: "com.example.myapplication", - abilityName: "FuncAbility", + bundleName: 'com.example.demo', + abilityName: 'com.example.demo.MainAbility', parameters: { - keyForString: "str", + keyForString: 'str', }, - } + }; ``` * Number ```ts let want = { - bundleName: "com.example.myapplication", - abilityName: "FuncAbility", + bundleName: 'com.example.demo', + abilityName: 'com.example.demo.MainAbility', parameters: { keyForInt: 100, keyForDouble: 99.99, }, - } + }; ``` * Boolean ```ts let want = { - bundleName: "com.example.myapplication", - abilityName: "FuncAbility", + bundleName: 'com.example.demo', + abilityName: 'com.example.demo.MainAbility', parameters: { keyForBool: true, }, - } + }; ``` * Object ```ts let want = { - bundleName: "com.example.myapplication", - abilityName: "FuncAbility", + bundleName: 'com.example.demo', + abilityName: 'com.example.demo.MainAbility', parameters: { keyForObject: { - keyForObjectString: "str", + keyForObjectString: 'str', keyForObjectInt: -200, keyForObjectDouble: 35.5, keyForObjectBool: false, }, }, - } + }; ``` * Array ```ts let want = { - bundleName: "com.example.myapplication", - abilityName: "FuncAbility", + bundleName: 'com.example.demo', + abilityName: 'com.example.demo.MainAbility', parameters: { - keyForArrayString: ["str1", "str2", "str3"], + keyForArrayString: ['str1', 'str2', 'str3'], keyForArrayInt: [100, 200, 300, 400], keyForArrayDouble: [0.1, 0.2], - keyForArrayObject: [{obj1: "aaa"}, {obj2: 100}], + keyForArrayObject: [{obj1: 'aaa'}, {obj2: 100}], }, - } + }; ``` * File descriptor (FD) ```ts - import fileio from '@ohos.fileio'; - let fd; - try { - fd = fileio.openSync("/data/storage/el2/base/haps/pic.png"); - } catch(e) { - console.log("openSync fail:" + JSON.stringify(e)); - } - let want = { - "deviceId": "", // An empty deviceId indicates the local device. - "bundleName": "com.example.myapplication", - "abilityName": "FuncAbility", - "moduleName": "entry", // moduleName is optional. - "parameters": { - "keyFd":{"type":"FD", "value":fd} + import fileio from '@ohos.fileio'; + let fd; + try { + fd = fileio.openSync('/data/storage/el2/base/haps/pic.png'); + } catch(e) { + console.log('openSync fail:' + JSON.stringify(e)); } - }; - this.context.startAbility(want, (error) => { + let want = { + 'deviceId': '', // An empty deviceId indicates the local device. + 'bundleName': 'com.extreme.test', + 'abilityName': 'MainAbility', + 'moduleName': 'entry', // moduleName is optional. + 'parameters': { + 'keyFd':{'type':'FD', 'value':fd} // {'type':'FD', 'value':fd} is a fixed usage, indicating that the data is a file descriptor. + } + }; + this.context.startAbility(want, (error) => { // Start an ability explicitly. The bundleName, abilityName, and moduleName parameters work together to uniquely identify an ability. - console.log("error.code = " + error.code) - }) + console.log('error.code = ' + error.code); + }); ``` -- For more details and examples, see [Want](../../application-models/want-overview.md). - + diff --git a/en/application-dev/reference/apis/js-apis-app-ability-wantAgent.md b/en/application-dev/reference/apis/js-apis-app-ability-wantAgent.md index 43b95743b25c34bdae9457c1e1ed1cf01f8e986e..f65d9971dc55689ee2df76bdc32cf80ffb1e010d 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-wantAgent.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-wantAgent.md @@ -1,6 +1,6 @@ # @ohos.app.ability.wantAgent (WantAgent) -The **app.ability.WantAgent** module provides APIs for creating and comparing **WantAgent** objects, and obtaining the user ID and bundle name of a **WantAgent** object. You are advised to use this module, since it will replace the [@ohos.wantAgent](js-apis-wantAgent.md) module in the near future. +The **WantAgent** module provides APIs for creating and comparing **WantAgent** objects, and obtaining the user ID and bundle name of a **WantAgent** object. You are advised to use this module, since it will replace the [@ohos.wantAgent](js-apis-wantAgent.md) module in the near future. > **NOTE** > @@ -8,7 +8,7 @@ The **app.ability.WantAgent** module provides APIs for creating and comparing ** ## Modules to Import -```ts +```js import WantAgent from '@ohos.app.ability.wantAgent'; ``` @@ -16,7 +16,7 @@ import WantAgent from '@ohos.app.ability.wantAgent'; getWantAgent(info: WantAgentInfo, callback: AsyncCallback\): void -Obtains a **WantAgent** object. This API uses an asynchronous callback to return the result. +Obtains a **WantAgent** object. This API uses an asynchronous callback to return the result. If the creation fails, a null **WantAgent** object is returned. **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -27,45 +27,22 @@ Obtains a **WantAgent** object. This API uses an asynchronous callback to return | info | [WantAgentInfo](js-apis-inner-wantAgent-wantAgentInfo.md) | Yes | Information about the **WantAgent** object to obtain. | | callback | AsyncCallback\ | Yes | Callback used to return the **WantAgent** object.| -**Error codes** -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). -| ID | Error Message | -|-----------|--------------------| -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong.| -| 16000003 | Input error. The specified id does not exist.| -| 16000004 | Visibility verification failed.| -| 16000006 | Can not cross user operations.| -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| -| 16000008 | Crowdtest App Expiration.| -| 16000009 | Can not start ability in wukong mode.| -| 16000010 | Can not operation with continue flag.| -| 16000011 | Context does not exist.| -| 16000050 | Internal Error.| -| 16000051 | Network error. The network is abnormal.| -| 16000052 | Free install not support. The application does not support free install.| -| 16000053 | Not top ability. The application is not top ability.| -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.| -| 16000055 | Free install timeout.| -| 16000056 | Can not free install other ability.| -| 16000057 | Not support cross device free install.| -| 16000101 | execute shell command failed.| -| 16000151 | Invalid wantagent object.| -| 16000152 | wantAgent object not found.| -| 16000153 | wangAgent object canceled.| - **Example** -```ts -// WantAgent object -let wantAgent; +```js +import WantAgent from '@ohos.app.ability.wantAgent'; + +// getWantAgent callback +function getWantAgentCallback(err, data) { + console.info('==========================>getWantAgentCallback=======================>'); +} // WantAgentInfo object let wantAgentInfo = { wants: [ { deviceId: 'deviceId', - bundleName: 'com.example.myapplication', - abilityName: 'EntryAbility', + bundleName: 'com.neu.setResultOnAbilityResultTest1', + abilityName: 'com.example.test.MainAbility', action: 'action1', entities: ['entity1'], type: 'MIMETYPE', @@ -85,20 +62,12 @@ let wantAgentInfo = { operationType: WantAgent.OperationType.START_ABILITIES, requestCode: 0, wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] -} +}; -// getWantAgent callback -function getWantAgentCallback(err, data) { - if (err === undefined) { - wantAgent = data; - } else { - console.info('getWantAgent failed' + JSON.stringify(err)); - } -} try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); -} catch(err) { - console.info('getWantAgent failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); +} catch (paramError) { + console.log('error: ' + paramError.code + ', ' + paramError.message); } ``` @@ -108,7 +77,7 @@ try { getWantAgent(info: WantAgentInfo): Promise\ -Obtains a **WantAgent** object. This API uses a promise to return the result. +Obtains a **WantAgent** object. This API uses a promise to return the result. If the creation fails, a null **WantAgent** object is returned. **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -124,43 +93,19 @@ Obtains a **WantAgent** object. This API uses a promise to return the result. | ----------------------------------------------------------- | ------------------------------------------------------------ | | Promise\ | Promise used to return the **WantAgent** object.| -**Error codes** -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). -| ID | Error Message | -|-----------|--------------------| -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong.| -| 16000003 | Input error. The specified id does not exist.| -| 16000004 | Visibility verification failed.| -| 16000006 | Can not cross user operations.| -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| -| 16000008 | Crowdtest App Expiration.| -| 16000009 | Can not start ability in wukong mode.| -| 16000010 | Can not operation with continue flag.| -| 16000011 | Context does not exist.| -| 16000050 | Internal Error.| -| 16000051 | Network error. The network is abnormal.| -| 16000052 | Free install not support. The application does not support free install.| -| 16000053 | Not top ability. The application is not top ability.| -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.| -| 16000055 | Free install timeout.| -| 16000056 | Can not free install other ability.| -| 16000057 | Not support cross device free install.| -| 16000101 | execute shell command failed.| -| 16000151 | Invalid wantagent object.| -| 16000152 | wantAgent object not found.| -| 16000153 | wangAgent object canceled.| - **Example** -```ts +```js +import WantAgent from '@ohos.app.ability.wantAgent'; + + // WantAgentInfo object let wantAgentInfo = { wants: [ { deviceId: 'deviceId', - bundleName: 'com.example.myapplication', - abilityName: 'EntryAbility', + bundleName: 'com.neu.setResultOnAbilityResultTest1', + abilityName: 'com.example.test.MainAbility', action: 'action1', entities: ['entity1'], type: 'MIMETYPE', @@ -180,16 +125,14 @@ let wantAgentInfo = { operationType: WantAgent.OperationType.START_ABILITIES, requestCode: 0, wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] -} +}; try { WantAgent.getWantAgent(wantAgentInfo).then((data) => { - wantAgent = data; -}).catch((err) => { - console.info('getWantAgent failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); -}); -} catch (err) { - console.info('getWantAgent failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); + console.info('==========================>getWantAgentCallback=======================>'); + }); +} catch (paramError) { + console.log('error: ' + paramError.code + ', ' + paramError.message); } ``` @@ -210,45 +153,31 @@ Obtains the bundle name of a **WantAgent** object. This API uses an asynchronous | agent | WantAgent | Yes | Target **WantAgent** object. | | callback | AsyncCallback\ | Yes | Callback used to return the bundle name.| -**Error codes** -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). -| ID | Error Message | -|-----------|--------------------| -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong.| -| 16000003 | Input error. The specified id does not exist.| -| 16000004 | Visibility verification failed.| -| 16000006 | Can not cross user operations.| -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| -| 16000008 | Crowdtest App Expiration.| -| 16000009 | Can not start ability in wukong mode.| -| 16000010 | Can not operation with continue flag.| -| 16000011 | Context does not exist.| -| 16000050 | Internal Error.| -| 16000051 | Network error. The network is abnormal.| -| 16000052 | Free install not support. The application does not support free install.| -| 16000053 | Not top ability. The application is not top ability.| -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.| -| 16000055 | Free install timeout.| -| 16000056 | Can not free install other ability.| -| 16000057 | Not support cross device free install.| -| 16000101 | execute shell command failed.| -| 16000151 | Invalid wantagent object.| -| 16000152 | wantAgent object not found.| -| 16000153 | wangAgent object canceled.| - **Example** -```ts -// WantAgent object +```js +import WantAgent from '@ohos.app.ability.wantAgent'; + + +// wantAgent object let wantAgent; + +//getWantAgent callback +function getWantAgentCallback(err, data) { + console.info('==========================>getWantAgentCallback=======================>'); + if (err.code == 0) { + wantAgent = data; + } else { + console.info('----getWantAgent failed!----'); + } +} // WantAgentInfo object let wantAgentInfo = { wants: [ { deviceId: 'deviceId', - bundleName: 'com.example.myapplication', - abilityName: 'EntryAbility', + bundleName: 'com.neu.setResultOnAbilityResultTest1', + abilityName: 'com.example.test.MainAbility', action: 'action1', entities: ['entity1'], type: 'MIMETYPE', @@ -268,33 +197,18 @@ let wantAgentInfo = { operationType: WantAgent.OperationType.START_ABILITIES, requestCode: 0, wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] -} +}; + +try { + WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); -// getWantAgent callback -function getWantAgentCallback(err, data) { - if (err === undefined) { - wantAgent = data; - } else { - console.info('getWantAgent failed' + JSON.stringify(wantAgent)); - } // getBundleName callback function getBundleNameCallback(err, data) { - if(err) { - console.info('getBundleName failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); - } else { - console.info('getBundleName ok!' + JSON.stringify(data)); - } - } - try { - WantAgent.getBundleName(wantAgent, getBundleNameCallback); - } catch(err) { - console.info('getBundleName failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); + console.info('==========================>getBundleNameCallback=======================>'); } -} -try { - WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); -} catch(err) { - console.info('getWantAgent failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); + WantAgent.getBundleName(wantAgent, getBundleNameCallback); +} catch (paramError) { + console.log('error: ' + paramError.code + ', ' + paramError.message); } ``` @@ -320,45 +234,22 @@ Obtains the bundle name of a **WantAgent** object. This API uses a promise to re | ----------------------------------------------------------- | ------------------------------------------------------------ | | Promise\ | Promise used to return the bundle name.| -**Error codes** -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). -| ID | Error Message | -|-----------|--------------------| -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong.| -| 16000003 | Input error. The specified id does not exist.| -| 16000004 | Visibility verification failed.| -| 16000006 | Can not cross user operations.| -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| -| 16000008 | Crowdtest App Expiration.| -| 16000009 | Can not start ability in wukong mode.| -| 16000010 | Can not operation with continue flag.| -| 16000011 | Context does not exist.| -| 16000050 | Internal Error.| -| 16000051 | Network error. The network is abnormal.| -| 16000052 | Free install not support. The application does not support free install.| -| 16000053 | Not top ability. The application is not top ability.| -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.| -| 16000055 | Free install timeout.| -| 16000056 | Can not free install other ability.| -| 16000057 | Not support cross device free install.| -| 16000101 | execute shell command failed.| -| 16000151 | Invalid wantagent object.| -| 16000152 | wantAgent object not found.| -| 16000153 | wangAgent object canceled.| - **Example** -```ts - // WantAgent object +```js +import WantAgent from '@ohos.app.ability.wantAgent'; + + +// wantAgent object let wantAgent; -// WantAgentInfo object + +//WantAgentInfo object let wantAgentInfo = { wants: [ { deviceId: 'deviceId', - bundleName: 'com.example.myapplication', - abilityName: 'EntryAbility', + bundleName: 'com.neu.setResultOnAbilityResultTest1', + abilityName: 'com.example.test.MainAbility', action: 'action1', entities: ['entity1'], type: 'MIMETYPE', @@ -378,29 +269,19 @@ let wantAgentInfo = { operationType: WantAgent.OperationType.START_ABILITIES, requestCode: 0, wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] -} +}; -// getWantAgent callback -function getWantAgentCallback(err, data) { - if (err === undefined) { - wantAgent = data; - } else { - console.info('getWantAgent failed!' + JSON.stringify(wantAgent)); - } - try { - WantAgent.getBundleName(wantAgent).then((data)=>{ - console.info('getBundleName ok!' + JSON.stringify(data)); - }).catch((err)=>{ - console.info('getBundleName failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); - }) - } catch(err){ - console.info('getBundleName failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); - } -} try { - WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); -} catch(err) { - console.info('getWantAgent failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); + WantAgent.getWantAgent(wantAgentInfo).then((data) => { + console.info('==========================>getWantAgentCallback=======================>'); + wantAgent = data; + }); + + WantAgent.getBundleName(wantAgent).then((data) => { + console.info('==========================>getBundleNameCallback=======================>'); + }); +} catch (paramError) { + console.log('error: ' + paramError.code + ', ' + paramError.message); } ``` @@ -421,46 +302,31 @@ Obtains the user ID of a **WantAgent** object. This API uses an asynchronous cal | agent | WantAgent | Yes | Target **WantAgent** object. | | callback | AsyncCallback\ | Yes | Callback used to return the user ID.| -**Error codes** -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). -| ID | Error Message | -|-----------|--------------------| -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong.| -| 16000003 | Input error. The specified id does not exist.| -| 16000004 | Visibility verification failed.| -| 16000006 | Can not cross user operations.| -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| -| 16000008 | Crowdtest App Expiration.| -| 16000009 | Can not start ability in wukong mode.| -| 16000010 | Can not operation with continue flag.| -| 16000011 | Context does not exist.| -| 16000050 | Internal Error.| -| 16000051 | Network error. The network is abnormal.| -| 16000052 | Free install not support. The application does not support free install.| -| 16000053 | Not top ability. The application is not top ability.| -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.| -| 16000055 | Free install timeout.| -| 16000056 | Can not free install other ability.| -| 16000057 | Not support cross device free install.| -| 16000101 | execute shell command failed.| -| 16000151 | Invalid wantagent object.| -| 16000152 | wantAgent object not found.| -| 16000153 | wangAgent object canceled.| - **Example** -```ts +```js import WantAgent from '@ohos.app.ability.wantAgent'; -// WantAgent object + + +// wantAgent object let wantAgent; + +// getWantAgent callback +function getWantAgentCallback(err, data) { + console.info('==========================>getWantAgentCallback=======================>'); + if (err.code == 0) { + wantAgent = data; + } else { + console.info('----getWantAgent failed!----'); + } +} // WantAgentInfo object let wantAgentInfo = { wants: [ { deviceId: 'deviceId', - bundleName: 'com.example.myapplication', - abilityName: 'EntryAbility', + bundleName: 'com.neu.setResultOnAbilityResultTest1', + abilityName: 'com.example.test.MainAbility', action: 'action1', entities: ['entity1'], type: 'MIMETYPE', @@ -480,33 +346,18 @@ let wantAgentInfo = { operationType: WantAgent.OperationType.START_ABILITIES, requestCode: 0, wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] -} +}; + +try { + WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); -// getWantAgent callback -function getWantAgentCallback(err, data) { - if (err === undefined) { - wantAgent = data; - } else { - console.info('getWantAgent failed' + JSON.stringify(err)); - } // getUid callback function getUidCallback(err, data) { - if(err) { - console.info('getUid failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); - } else { - console.info('getUid ok!' + JSON.stringify(data)); - } - } - try { - WantAgent.getUid(wantAgent, getUidCallback); - } catch(err) { - console.info('getUid failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); + console.info('==========================>getUidCallback=======================>'); } -} -try { - WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); -} catch(err) { - console.info('getWantAgent failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); + WantAgent.getUid(wantAgent, getUidCallback); +} catch (paramError) { + console.log('error: ' + paramError.code + ', ' + paramError.message); } ``` @@ -532,45 +383,22 @@ Obtains the user ID of a **WantAgent** object. This API uses a promise to return | ----------------------------------------------------------- | ------------------------------------------------------------ | | Promise\ | Promise used to return the user ID.| -**Error codes** -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). -| ID | Error Message | -|-----------|--------------------| -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong.| -| 16000003 | Input error. The specified id does not exist.| -| 16000004 | Visibility verification failed.| -| 16000006 | Can not cross user operations.| -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| -| 16000008 | Crowdtest App Expiration.| -| 16000009 | Can not start ability in wukong mode.| -| 16000010 | Can not operation with continue flag.| -| 16000011 | Context does not exist.| -| 16000050 | Internal Error.| -| 16000051 | Network error. The network is abnormal.| -| 16000052 | Free install not support. The application does not support free install.| -| 16000053 | Not top ability. The application is not top ability.| -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.| -| 16000055 | Free install timeout.| -| 16000056 | Can not free install other ability.| -| 16000057 | Not support cross device free install.| -| 16000101 | execute shell command failed.| -| 16000151 | Invalid wantagent object.| -| 16000152 | wantAgent object not found.| -| 16000153 | wangAgent object canceled.| - **Example** -```ts -// WantAgent object +```js +import WantAgent from '@ohos.app.ability.wantAgent'; + + +// wantAgent object let wantAgent; + // WantAgentInfo object let wantAgentInfo = { wants: [ { deviceId: 'deviceId', - bundleName: 'com.example.myapplication', - abilityName: 'EntryAbility', + bundleName: 'com.neu.setResultOnAbilityResultTest1', + abilityName: 'com.example.test.MainAbility', action: 'action1', entities: ['entity1'], type: 'MIMETYPE', @@ -590,33 +418,24 @@ let wantAgentInfo = { operationType: WantAgent.OperationType.START_ABILITIES, requestCode: 0, wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] -} +}; -// getWantAgent callback -function getWantAgentCallback(err, data) { - if (err === undefined) { - wantAgent = data; - } else { - console.info('getWantAgent failed!' + JSON.stringify(wantAgent)); - } - try { - WantAgent.getUid(wantAgent).then((data)=>{ - console.info('getUid ok!' + JSON.stringify(data)); - }).catch((err)=>{ - console.info('getUid failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); - }) - } catch(err){ - console.info('getUid failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); - } -} try { - WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); -} catch(err) { - console.info('getWantAgent failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); + WantAgent.getWantAgent(wantAgentInfo).then((data) => { + console.info('==========================>getWantAgentCallback=======================>'); + wantAgent = data; + }); + + WantAgent.getUid(wantAgent).then((data) => { + console.info('==========================>getUidCallback=======================>'); + }); +} catch (paramError) { + console.log('error: ' + paramError.code + ', ' + paramError.message); } ``` + ## WantAgent.getWant getWant(agent: WantAgent, callback: AsyncCallback\): void @@ -634,45 +453,31 @@ Obtains the want in a **WantAgent** object. This API uses an asynchronous callba | agent | WantAgent | Yes | Target **WantAgent** object. | | callback | AsyncCallback\<[Want](js-apis-app-ability-want.md)\> | Yes | Callback used to return the want.| -**Error codes** -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). -| ID | Error Message | -|-----------|--------------------| -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong.| -| 16000003 | Input error. The specified id does not exist.| -| 16000004 | Visibility verification failed.| -| 16000006 | Can not cross user operations.| -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| -| 16000008 | Crowdtest App Expiration.| -| 16000009 | Can not start ability in wukong mode.| -| 16000010 | Can not operation with continue flag.| -| 16000011 | Context does not exist.| -| 16000050 | Internal Error.| -| 16000051 | Network error. The network is abnormal.| -| 16000052 | Free install not support. The application does not support free install.| -| 16000053 | Not top ability. The application is not top ability.| -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.| -| 16000055 | Free install timeout.| -| 16000056 | Can not free install other ability.| -| 16000057 | Not support cross device free install.| -| 16000101 | execute shell command failed.| -| 16000151 | Invalid wantagent object.| -| 16000152 | wantAgent object not found.| -| 16000153 | wangAgent object canceled.| - **Example** -```ts -// WantAgent object +```js +import WantAgent from '@ohos.app.ability.wantAgent'; + + +// wantAgent object let wantAgent; + +// getWantAgent callback +function getWantAgentCallback(err, data) { + console.info('==========================>getWantAgentCallback=======================>'); + if (err.code == 0) { + wantAgent = data; + } else { + console.info('----getWantAgent failed!----'); + } +} // WantAgentInfo object let wantAgentInfo = { wants: [ { deviceId: 'deviceId', - bundleName: 'com.example.myapplication', - abilityName: 'EntryAbility', + bundleName: 'com.neu.setResultOnAbilityResultTest1', + abilityName: 'com.example.test.MainAbility', action: 'action1', entities: ['entity1'], type: 'MIMETYPE', @@ -692,33 +497,18 @@ let wantAgentInfo = { operationType: WantAgent.OperationType.START_ABILITIES, requestCode: 0, wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] -} +}; -// getWantAgent callback -function getWantAgentCallback(err, data) { - if (err === undefined) { - wantAgent = data; - } else { - console.info('getWantAgent failed' + JSON.stringify(wantAgent)); - } - // getUid callback - function getWantCallback(err, data) { - if(err) { - console.info('getWant failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); - } else { - console.info('getWant ok!' + JSON.stringify(data)); - } - } - try { - WantAgent.getWant(wantAgent, getBundleNameCallback); - } catch(err) { - console.info('getWant failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); - } -} try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); -} catch(err) { - console.info('getWantAgent failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); + + // getWant callback + function getWantCallback(err, data) { + console.info('==========================>getWantCallback=======================>'); + } + WantAgent.getWant(wantAgent, getWantCallback); +} catch (paramError) { + console.log('error: ' + paramError.code + ', ' + paramError.message); } ``` @@ -746,45 +536,22 @@ Obtains the want in a **WantAgent** object. This API uses a promise to return th | ----------------------------------------------------------- | ------------------------------------------------------------ | | Promise\ | Promise used to return the want.| -**Error codes** -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). -| ID | Error Message | -|-----------|--------------------| -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong.| -| 16000003 | Input error. The specified id does not exist.| -| 16000004 | Visibility verification failed.| -| 16000006 | Can not cross user operations.| -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| -| 16000008 | Crowdtest App Expiration.| -| 16000009 | Can not start ability in wukong mode.| -| 16000010 | Can not operation with continue flag.| -| 16000011 | Context does not exist.| -| 16000050 | Internal Error.| -| 16000051 | Network error. The network is abnormal.| -| 16000052 | Free install not support. The application does not support free install.| -| 16000053 | Not top ability. The application is not top ability.| -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.| -| 16000055 | Free install timeout.| -| 16000056 | Can not free install other ability.| -| 16000057 | Not support cross device free install.| -| 16000101 | execute shell command failed.| -| 16000151 | Invalid wantagent object.| -| 16000152 | wantAgent object not found.| -| 16000153 | wangAgent object canceled.| - **Example** -```ts -// WantAgent object +```js +import WantAgent from '@ohos.app.ability.wantAgent'; + + +// wantAgent object let wantAgent; + // WantAgentInfo object let wantAgentInfo = { wants: [ { deviceId: 'deviceId', - bundleName: 'com.example.myapplication', - abilityName: 'EntryAbility', + bundleName: 'com.neu.setResultOnAbilityResultTest1', + abilityName: 'com.example.test.MainAbility', action: 'action1', entities: ['entity1'], type: 'MIMETYPE', @@ -804,29 +571,19 @@ let wantAgentInfo = { operationType: WantAgent.OperationType.START_ABILITIES, requestCode: 0, wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] -} +}; -// getWantAgent callback -function getWantAgentCallback(err, data) { - if (err === undefined) { - wantAgent = data; - } else { - console.info('getWantAgent failed!' + JSON.stringify(wantAgent)); - } - try { - WantAgent.getUid(wantAgent).then((data)=>{ - console.info('getUid ok!' + JSON.stringify(data)); - }).catch((err)=>{ - console.info('getUid failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); - }) - } catch(err){ - console.info('getUid failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); - } -} try { - WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); -} catch(err) { - console.info('getWantAgent failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); + WantAgent.getWantAgent(wantAgentInfo).then((data) => { + console.info('==========================>getWantAgentCallback=======================>'); + wantAgent = data; + }); + + WantAgent.getWant(wantAgent).then((data) => { + console.info('==========================>getWantCallback=======================>'); + }); +} catch (paramError) { + console.log('error: ' + paramError.code + ', ' + paramError.message); } ``` @@ -847,45 +604,31 @@ Cancels a **WantAgent** object. This API uses an asynchronous callback to return | agent | WantAgent | Yes | Target **WantAgent** object. | | callback | AsyncCallback\ | Yes | Callback used to return the result.| -**Error codes** -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). -| ID | Error Message | -|-----------|--------------------| -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong.| -| 16000003 | Input error. The specified id does not exist.| -| 16000004 | Visibility verification failed.| -| 16000006 | Can not cross user operations.| -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| -| 16000008 | Crowdtest App Expiration.| -| 16000009 | Can not start ability in wukong mode.| -| 16000010 | Can not operation with continue flag.| -| 16000011 | Context does not exist.| -| 16000050 | Internal Error.| -| 16000051 | Network error. The network is abnormal.| -| 16000052 | Free install not support. The application does not support free install.| -| 16000053 | Not top ability. The application is not top ability.| -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.| -| 16000055 | Free install timeout.| -| 16000056 | Can not free install other ability.| -| 16000057 | Not support cross device free install.| -| 16000101 | execute shell command failed.| -| 16000151 | Invalid wantagent object.| -| 16000152 | wantAgent object not found.| -| 16000153 | wangAgent object canceled.| - **Example** -```ts -// WantAgent object +```js +import WantAgent from '@ohos.app.ability.wantAgent'; + + +// wantAgent object let wantAgent; + +// getWantAgent callback +function getWantAgentCallback(err, data) { + console.info('==========================>getWantAgentCallback=======================>'); + if (err.code == 0) { + wantAgent = data; + } else { + console.info('----getWantAgent failed!----'); + } +} // WantAgentInfo object let wantAgentInfo = { wants: [ { deviceId: 'deviceId', - bundleName: 'com.example.myapplication', - abilityName: 'EntryAbility', + bundleName: 'com.neu.setResultOnAbilityResultTest1', + abilityName: 'com.example.test.MainAbility', action: 'action1', entities: ['entity1'], type: 'MIMETYPE', @@ -905,33 +648,18 @@ let wantAgentInfo = { operationType: WantAgent.OperationType.START_ABILITIES, requestCode: 0, wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] -} +}; -// getWantAgent callback -function getWantAgentCallback(err, data) { - if (err === undefined) { - wantAgent = data; - } else { - console.info('getWantAgent failed' + JSON.stringify(wantAgent)); - } - // getUid callback - function cancelCallback(err, data) { - if(err) { - console.info('cancel failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); - } else { - console.info('cancel ok!'); - } - } - try { - WantAgent.cancel(wantAgent, getBundleNameCallback); - } catch(err) { - console.info('cancel failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); - } -} try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); -} catch(err) { - console.info('getWantAgent failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); + + // cancel callback + function cancelCallback(err, data) { + console.info('==========================>cancelCallback=======================>'); + } + WantAgent.cancel(wantAgent, cancelCallback); +} catch (paramError) { + console.log('error: ' + paramError.code + ', ' + paramError.message); } ``` @@ -957,45 +685,22 @@ Cancels a **WantAgent** object. This API uses a promise to return the result. | --------------- | ------------------------------- | | Promise\ | Promise used to return the result.| -**Error codes** -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). -| ID | Error Message | -|-----------|--------------------| -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong.| -| 16000003 | Input error. The specified id does not exist.| -| 16000004 | Visibility verification failed.| -| 16000006 | Can not cross user operations.| -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| -| 16000008 | Crowdtest App Expiration.| -| 16000009 | Can not start ability in wukong mode.| -| 16000010 | Can not operation with continue flag.| -| 16000011 | Context does not exist.| -| 16000050 | Internal Error.| -| 16000051 | Network error. The network is abnormal.| -| 16000052 | Free install not support. The application does not support free install.| -| 16000053 | Not top ability. The application is not top ability.| -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.| -| 16000055 | Free install timeout.| -| 16000056 | Can not free install other ability.| -| 16000057 | Not support cross device free install.| -| 16000101 | execute shell command failed.| -| 16000151 | Invalid wantagent object.| -| 16000152 | wantAgent object not found.| -| 16000153 | wangAgent object canceled.| - **Example** -```ts -// WantAgent object +```js +import WantAgent from '@ohos.app.ability.wantAgent'; + + +// wantAgent object let wantAgent; + // WantAgentInfo object let wantAgentInfo = { wants: [ { deviceId: 'deviceId', - bundleName: 'com.example.myapplication', - abilityName: 'EntryAbility', + bundleName: 'com.neu.setResultOnAbilityResultTest1', + abilityName: 'com.example.test.MainAbility', action: 'action1', entities: ['entity1'], type: 'MIMETYPE', @@ -1015,32 +720,24 @@ let wantAgentInfo = { operationType: WantAgent.OperationType.START_ABILITIES, requestCode: 0, wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] -} +}; -// getWantAgent callback -function getWantAgentCallback(err, data) { - if (err === undefined) { - wantAgent = data; - } else { - console.info('getWantAgent failed!' + JSON.stringify(wantAgent)); - } - try { - WantAgent.cancel(wantAgent).then((data)=>{ - console.info('cancel ok!'); - }).catch((err)=>{ - console.info('cancel failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); - }) - } catch(err){ - console.info('cancel failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); - } -} try { - WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); -} catch(err) { - console.info('getWantAgent failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); + WantAgent.getWantAgent(wantAgentInfo).then((data) => { + console.info('==========================>getWantAgentCallback=======================>'); + wantAgent = data; + }); + + WantAgent.cancel(wantAgent).then((data) => { + console.info('==========================>cancelCallback=======================>'); + }); +} catch (paramError) { + console.log('error: ' + paramError.code + ', ' + paramError.message); } ``` + + ## WantAgent.trigger trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: AsyncCallback\): void @@ -1054,52 +751,33 @@ Triggers a **WantAgent** object. This API uses an asynchronous callback to retur | Name | Type | Mandatory| Description | | ----------- | ----------------------------- | ---- | ------------------------------- | | agent | WantAgent | Yes | Target **WantAgent** object. | -| triggerInfo | [TriggerInfo](js-apis-inner-wantAgent-triggerInfo.md) | Yes | **TriggerInfo** object. | +| triggerInfo | TriggerInfo | Yes | **TriggerInfo** object. | | callback | AsyncCallback\<[CompleteData](#completedata)\> | No | Callback used to return the result.| -**Error codes** -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). -| ID | Error Message | -|-----------|--------------------| -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong.| -| 16000003 | Input error. The specified id does not exist.| -| 16000004 | Visibility verification failed.| -| 16000006 | Can not cross user operations.| -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| -| 16000008 | Crowdtest App Expiration.| -| 16000009 | Can not start ability in wukong mode.| -| 16000010 | Can not operation with continue flag.| -| 16000011 | Context does not exist.| -| 16000050 | Internal Error.| -| 16000051 | Network error. The network is abnormal.| -| 16000052 | Free install not support. The application does not support free install.| -| 16000053 | Not top ability. The application is not top ability.| -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.| -| 16000055 | Free install timeout.| -| 16000056 | Can not free install other ability.| -| 16000057 | Not support cross device free install.| -| 16000101 | execute shell command failed.| -| 16000151 | Invalid wantagent object.| -| 16000152 | wantAgent object not found.| -| 16000153 | wangAgent object canceled.| -**Example** +```js +import WantAgent from '@ohos.app.ability.wantAgent'; + -```ts -// WantAgent object +// wantAgent object let wantAgent; -// triggerInfo -let triggerInfo = { - code: 0 // Custom result code. + +// getWantAgent callback +function getWantAgentCallback(err, data) { + console.info('==========================>getWantAgentCallback=======================>'); + if (err.code == 0) { + wantAgent = data; + } else { + console.info('----getWantAgent failed!----'); } +} // WantAgentInfo object let wantAgentInfo = { wants: [ { deviceId: 'deviceId', - bundleName: 'com.example.myapplication', - abilityName: 'EntryAbility', + bundleName: 'com.neu.setResultOnAbilityResultTest1', + abilityName: 'com.example.test.MainAbility', action: 'action1', entities: ['entity1'], type: 'MIMETYPE', @@ -1119,33 +797,23 @@ let wantAgentInfo = { operationType: WantAgent.OperationType.START_ABILITIES, requestCode: 0, wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] -} +}; -// getWantAgent callback -function getWantAgentCallback(err, data) { - if (err === undefined) { - wantAgent = data; - } else { - console.info('getWantAgent failed' + JSON.stringify(wantAgent)); - } - // getUid callback - function triggerCallback(err, data) { - if(err) { - console.info('getUid failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); - } else { - console.info('getUid ok!' + JSON.stringify(data)); - } - } - try { - WantAgent.trigger(wantAgent, triggerInfo, triggerCallback); - } catch(err) { - console.info('getUid failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); - } -} try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); -} catch(err) { - console.info('getWantAgent failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); + + // trigger callback + function triggerCallback(data) { + console.info('==========================>triggerCallback=======================>'); + } + + + let triggerInfo = { + code:0 + }; + WantAgent.trigger(wantAgent, triggerInfo, triggerCallback); +} catch (paramError) { + console.log('error: ' + paramError.code + ', ' + paramError.message); } ``` @@ -1167,46 +835,33 @@ Checks whether two **WantAgent** objects are equal to determine whether the same | otherAgent | WantAgent | Yes | The second **WantAgent** object. | | callback | AsyncCallback\ | Yes | Callback used to return the result.| -**Error codes** -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). -| ID | Error Message | -|-----------|--------------------| -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong.| -| 16000003 | Input error. The specified id does not exist.| -| 16000004 | Visibility verification failed.| -| 16000006 | Can not cross user operations.| -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| -| 16000008 | Crowdtest App Expiration.| -| 16000009 | Can not start ability in wukong mode.| -| 16000010 | Can not operation with continue flag.| -| 16000011 | Context does not exist.| -| 16000050 | Internal Error.| -| 16000051 | Network error. The network is abnormal.| -| 16000052 | Free install not support. The application does not support free install.| -| 16000053 | Not top ability. The application is not top ability.| -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.| -| 16000055 | Free install timeout.| -| 16000056 | Can not free install other ability.| -| 16000057 | Not support cross device free install.| -| 16000101 | execute shell command failed.| -| 16000151 | Invalid wantagent object.| -| 16000152 | wantAgent object not found.| -| 16000153 | wangAgent object canceled.| - **Example** -```ts -// WantAgent object +```js +import WantAgent from '@ohos.app.ability.wantAgent'; + + +// wantAgent object let wantAgent1; let wantAgent2; + +// getWantAgent callback +function getWantAgentCallback(err, data) { + console.info('==========================>getWantAgentCallback=======================>'); + if (err.code == 0) { + wantAgent1 = data; + wantAgent2 = data; + } else { + console.info('----getWantAgent failed!----'); + } +} // WantAgentInfo object let wantAgentInfo = { wants: [ { deviceId: 'deviceId', - bundleName: 'com.example.myapplication', - abilityName: 'EntryAbility', + bundleName: 'com.neu.setResultOnAbilityResultTest1', + abilityName: 'com.example.test.MainAbility', action: 'action1', entities: ['entity1'], type: 'MIMETYPE', @@ -1226,34 +881,18 @@ let wantAgentInfo = { operationType: WantAgent.OperationType.START_ABILITIES, requestCode: 0, wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] -} +}; -// getWantAgent callback -function getWantAgentCallback(err, data) { - if (err === undefined) { - wantAgent1 = data; - wantAgent2 = data; - } else { - console.info('getWantAgent failed' + JSON.stringify(wantAgent)); - } - // getUid callback - function equalCallback(err, data) { - if(err) { - console.info('equal failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); - } else { - console.info('equal ok!' + JSON.stringify(data)); - } - } - try { - WantAgent.equal(wantAgent1,wantAgent2,equalCallback); - } catch(err) { - console.info('equal failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); - } -} try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); -} catch(err) { - console.info('getWantAgent failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); + + // equal callback + function equalCallback(err, data) { + console.info('==========================>equalCallback=======================>'); + } + WantAgent.equal(wantAgent1, wantAgent2, equalCallback); +} catch (paramError) { + console.log('error: ' + paramError.code + ', ' + paramError.message); } ``` @@ -1280,46 +919,23 @@ Checks whether two **WantAgent** objects are equal to determine whether the same | ----------------------------------------------------------- | ------------------------------------------------------------ | | Promise\ | Promise used to return the result.| -**Error codes** -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). -| ID | Error Message | -|-----------|--------------------| -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong.| -| 16000003 | Input error. The specified id does not exist.| -| 16000004 | Visibility verification failed.| -| 16000006 | Can not cross user operations.| -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| -| 16000008 | Crowdtest App Expiration.| -| 16000009 | Can not start ability in wukong mode.| -| 16000010 | Can not operation with continue flag.| -| 16000011 | Context does not exist.| -| 16000050 | Internal Error.| -| 16000051 | Network error. The network is abnormal.| -| 16000052 | Free install not support. The application does not support free install.| -| 16000053 | Not top ability. The application is not top ability.| -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.| -| 16000055 | Free install timeout.| -| 16000056 | Can not free install other ability.| -| 16000057 | Not support cross device free install.| -| 16000101 | execute shell command failed.| -| 16000151 | Invalid wantagent object.| -| 16000152 | wantAgent object not found.| -| 16000153 | wangAgent object canceled.| - **Example** -```ts -// WantAgent object +```js +import WantAgent from '@ohos.app.ability.wantAgent'; + + +// wantAgent object let wantAgent1; let wantAgent2; + // WantAgentInfo object let wantAgentInfo = { wants: [ { deviceId: 'deviceId', - bundleName: 'com.example.myapplication', - abilityName: 'EntryAbility', + bundleName: 'com.neu.setResultOnAbilityResultTest1', + abilityName: 'com.example.test.MainAbility', action: 'action1', entities: ['entity1'], type: 'MIMETYPE', @@ -1339,30 +955,20 @@ let wantAgentInfo = { operationType: WantAgent.OperationType.START_ABILITIES, requestCode: 0, wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] -} +}; -// getWantAgent callback -function getWantAgentCallback(err, data) { - if (err === undefined) { +try { + WantAgent.getWantAgent(wantAgentInfo).then((data) => { + console.info('==========================>getWantAgentCallback=======================>'); wantAgent1 = data; wantAgent2 = data; - } else { - console.info('getWantAgent failed!' + JSON.stringify(wantAgent)); - } - try { - WantAgent.equal(wantAgent1,wantAgent2).then((data)=>{ - console.info('equal ok!' + JSON.stringify(data)); - }).catch((err)=>{ - console.info('equal failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); - }) - } catch(err){ - console.info('equal failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); - } -} -try { - WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); -} catch(err) { - console.info('getWantAgent failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); + }); + + WantAgent.equal(wantAgent1, wantAgent2).then((data) => { + console.info('==========================>equalCallback=======================>'); + }); +} catch (paramError) { + console.log('error: ' + paramError.code + ', ' + paramError.message); } ``` @@ -1381,45 +987,21 @@ Obtains the operation type of a **WantAgent** object. This API uses an asynchron | agent | WantAgent | Yes | Target **WantAgent** object. | | callback | AsyncCallback\ | Yes | Callback used to return the operation type.| -**Error codes** -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). -| ID | Error Message | -|-----------|--------------------| -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong.| -| 16000003 | Input error. The specified id does not exist.| -| 16000004 | Visibility verification failed.| -| 16000006 | Can not cross user operations.| -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| -| 16000008 | Crowdtest App Expiration.| -| 16000009 | Can not start ability in wukong mode.| -| 16000010 | Can not operation with continue flag.| -| 16000011 | Context does not exist.| -| 16000050 | Internal Error.| -| 16000051 | Network error. The network is abnormal.| -| 16000052 | Free install not support. The application does not support free install.| -| 16000053 | Not top ability. The application is not top ability.| -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.| -| 16000055 | Free install timeout.| -| 16000056 | Can not free install other ability.| -| 16000057 | Not support cross device free install.| -| 16000101 | execute shell command failed.| -| 16000151 | Invalid wantagent object.| -| 16000152 | wantAgent object not found.| -| 16000153 | wangAgent object canceled.| - **Example** -```ts -// WantAgent object +```js +import WantAgent from '@ohos.app.ability.wantAgent'; + +// wantAgent object let wantAgent; + // WantAgentInfo object let wantAgentInfo = { wants: [ { deviceId: 'deviceId', - bundleName: 'com.example.myapplication', - abilityName: 'EntryAbility', + bundleName: 'com.neu.setResultOnAbilityResultTest1', + abilityName: 'com.example.test.MainAbility', action: 'action1', entities: ['entity1'], type: 'MIMETYPE', @@ -1439,33 +1021,19 @@ let wantAgentInfo = { operationType: WantAgent.OperationType.START_ABILITIES, requestCode: 0, wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] -} +}; -// getWantAgent callback -function getWantAgentCallback(err, data) { - if (err === undefined) { - wantAgent = data; - } else { - console.info('getWantAgent failed' + JSON.stringify(wantAgent)); - } - // getUid callback - function getOperationTypeCallback(err, data) { - if(err) { - console.info('getOperationType failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); - } else { - console.info('getOperationType ok!' + JSON.stringify(data)); - } - } - try { - WantAgent.getOperationTypeCallback(wantAgent, getBundleNameCallback); - } catch(err) { - console.info('getOperationTypeCallback failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); - } -} try { - WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); -} catch(err) { - console.info('getWantAgent failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); + WantAgent.getWantAgent(wantAgentInfo).then((data) => { + console.info('==========================>getWantAgentCallback=======================>'); + wantAgent = data; + }); + + WantAgent.getOperationType(wantAgent, (OperationType) => { + console.log('----------- getOperationType ----------, OperationType: ' + OperationType); + }) +} catch (paramError) { + console.log('error: ' + paramError.code + ', ' + paramError.message); } ``` @@ -1489,45 +1057,21 @@ Obtains the operation type of a **WantAgent** object. This API uses a promise to | ----------------------------------------------------------- | ------------------------------------------------------------ | | Promise\ | Promise used to return the operation type.| -**Error codes** -For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). -| ID | Error Message | -|-----------|--------------------| -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong.| -| 16000003 | Input error. The specified id does not exist.| -| 16000004 | Visibility verification failed.| -| 16000006 | Can not cross user operations.| -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| -| 16000008 | Crowdtest App Expiration.| -| 16000009 | Can not start ability in wukong mode.| -| 16000010 | Can not operation with continue flag.| -| 16000011 | Context does not exist.| -| 16000050 | Internal Error.| -| 16000051 | Network error. The network is abnormal.| -| 16000052 | Free install not support. The application does not support free install.| -| 16000053 | Not top ability. The application is not top ability.| -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.| -| 16000055 | Free install timeout.| -| 16000056 | Can not free install other ability.| -| 16000057 | Not support cross device free install.| -| 16000101 | execute shell command failed.| -| 16000151 | Invalid wantagent object.| -| 16000152 | wantAgent object not found.| -| 16000153 | wangAgent object canceled.| - **Example** -```ts -// WantAgent object +```js +import WantAgent from '@ohos.app.ability.wantAgent'; + +// wantAgent object let wantAgent; + // WantAgentInfo object let wantAgentInfo = { wants: [ { deviceId: 'deviceId', - bundleName: 'com.example.myapplication', - abilityName: 'EntryAbility', + bundleName: 'com.neu.setResultOnAbilityResultTest1', + abilityName: 'com.example.test.MainAbility', action: 'action1', entities: ['entity1'], type: 'MIMETYPE', @@ -1547,29 +1091,21 @@ let wantAgentInfo = { operationType: WantAgent.OperationType.START_ABILITIES, requestCode: 0, wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] -} +}; -// getWantAgent callback -function getWantAgentCallback(err, data) { - if (err === undefined) { - wantAgent = data; - } else { - console.info('getWantAgent failed!' + JSON.stringify(wantAgent)); - } - try { - WantAgent.getOperationType(wantAgent).then((data)=>{ - console.info('getOperationType ok!' + JSON.stringify(data)); - }).catch((err)=>{ - console.info('getOperationType failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); - }) - } catch(err){ - console.info('getOperationType failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); - } -} try { - WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); -} catch(err) { - console.info('getWantAgent failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); + WantAgent.getWantAgent(wantAgentInfo).then((data) => { + console.info('==========================>getWantAgentCallback=======================>'); + wantAgent = data; + }); + + WantAgent.getOperationType(wantAgent).then((OperationType) => { + console.log('getOperationType success, OperationType: ' + OperationType); + }).catch((err) => { + console.log('getOperationType fail, err: ' + err); + }) +} catch (paramError) { + console.log('error: ' + paramError.code + ', ' + paramError.message); } ``` @@ -1615,5 +1151,6 @@ try { | info | WantAgent | Yes | A triggered **WantAgent** object. | | want | Want | Yes | An existing triggered **want**. | | finalCode | number | Yes | Request code that triggers the **WantAgent** object.| -| finalData | string | No | Final data collected by the common event. | +| finalData | string | Yes | Final data collected by the common event. | | extraInfo | {[key: string]: any} | No | Extra information. | + diff --git a/en/application-dev/reference/apis/js-apis-app-ability-wantConstant.md b/en/application-dev/reference/apis/js-apis-app-ability-wantConstant.md index 4d7a483eab8a55c91d4dbb89287fa611f980ef34..4503f37fa5dd7950c2090a8d452d8d52eb22dcc1 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-wantConstant.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-wantConstant.md @@ -8,7 +8,7 @@ The **wantConstant** module provides the actions, entities, and flags used in ** ## Modules to Import -```js +```ts import wantConstant from '@ohos.app.ability.wantConstant'; ``` @@ -79,4 +79,4 @@ Enumerates the entity constants of the **Want** object. **entity** specifies add | ------------------------------------ | ---------- | ------------------------------------------------------------ | | FLAG_AUTH_READ_URI_PERMISSION | 0x00000001 | Indicates the permission to read the URI. | | FLAG_AUTH_WRITE_URI_PERMISSION | 0x00000002 | Indicates the permission to write data to the URI. | -| FLAG_INSTALL_ON_DEMAND | 0x00000800 | Indicates that the specific ability will be installed if it has not been installed. | +| FLAG_INSTALL_ON_DEMAND | 0x00000800 | Indicates that the specific ability will be installed if it has not been installed. | diff --git a/en/application-dev/reference/apis/js-apis-app-form-formBindingData.md b/en/application-dev/reference/apis/js-apis-app-form-formBindingData.md index 51637975d72ea807f428f235aec90310f69b197f..39cfb8e3349b07ee745c1756cefb4ea66f189b39 100644 --- a/en/application-dev/reference/apis/js-apis-app-form-formBindingData.md +++ b/en/application-dev/reference/apis/js-apis-app-form-formBindingData.md @@ -35,7 +35,7 @@ Creates a **FormBindingData** object. | Name| Type | Mandatory| Description | | ------ | -------------- | ---- | ------------------------------------------------------------ | -| obj | Object\|string | No | Data to be displayed on the JS widget. The value can be an object containing multiple key-value pairs or a string in JSON format. The image data is identified by "formImages", and the content is multiple key-value pairs, each of which consists of an image identifier and image file descriptor. The final format is {"formImages": {"key1": fd1, "key2": fd2}}.| +| obj | Object\|string | No | Data to be displayed on the JS widget. The value can be an object containing multiple key-value pairs or a string in JSON format. The image data is identified by **'formImages'**, and the content is multiple key-value pairs, each of which consists of an image identifier and image file descriptor. The final format is {'formImages': {'key1': fd1, 'key2': fd2}}.| **Return value** @@ -48,17 +48,20 @@ Creates a **FormBindingData** object. **Example** ```ts -import fs from '@ohos.file.fs'; -import formBindingData from '@ohos.app.form.formBindingData'; - -try { - let fd = fs.openSync('/path/to/form.png') +import featureAbility from '@ohos.ability.featureAbility'; +import fileio from '@ohos.fileio'; +let context=featureAbility.getContext(); +context.getOrCreateLocalDir((err,data)=>{ + let path=data+'/xxx.jpg'; + let fd = fileio.openSync(path); let obj = { - "temperature": "21°", - "formImages": { "image": fd } + 'temperature': '21°', + 'formImages': {'image': fd} }; - formBindingData.createFormBindingData(obj); -} catch (error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); -} + try { + formBindingData.createFormBindingData(obj); + } catch (error) { + console.log(`catch err->${JSON.stringify(err)}`); + } +}) ``` diff --git a/en/application-dev/reference/apis/js-apis-app-form-formHost.md b/en/application-dev/reference/apis/js-apis-app-form-formHost.md index e78cf3647a1298ed77b4993d811393ede4e2e5b6..c8c8ca6389aa86a7f2a065c98e125c5b1faaca29 100644 --- a/en/application-dev/reference/apis/js-apis-app-form-formHost.md +++ b/en/application-dev/reference/apis/js-apis-app-form-formHost.md @@ -1,6 +1,6 @@ -# @ohos.app.form.formHost (formHost) +# @ohos.app.form.formHost (FormHost) -The **formHost** module provides APIs related to the widget host, which is an application that displays the widget content and controls the position where the widget is displayed. You can use the APIs to delete, release, and update widgets installed by the same user, and obtain widget information and status. +The **FormHost** module provides APIs related to the widget host, which is an application that displays the widget content and controls the position where the widget is displayed. You can use the APIs to delete, release, and update widgets installed by the same user, and obtain widget information and status. > **NOTE** > @@ -34,26 +34,25 @@ Deletes a widget. After this API is called, the application can no longer use th | Error Code ID| Error Message| | -------- | -------- | -| 401 | Incorrect input parameter.| +| 401 | If the input parameter is not valid parameter. | |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| **Example** ```ts -import formHost from '@ohos.app.form.formHost'; - try { - let formId = "12400633174999288"; - formHost.deleteForm(formId, (error) => { + var formId = '12400633174999288'; + formHost.deleteForm(formId, (error, data) => { if (error) { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.log('formHost deleteForm, error:' + JSON.stringify(error)); } else { console.log('formHost deleteForm success'); } }); } catch (error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.log(`catch err->${JSON.stringify(error)}`); } + ``` ## deleteForm @@ -83,23 +82,21 @@ Deletes a widget. After this API is called, the application can no longer use th | Error Code ID| Error Message| | -------- | -------- | -| 401 | Incorrect input parameter.| +| 401 | If the input parameter is not valid parameter. | |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| **Parameters** ```ts -import formHost from '@ohos.app.form.formHost'; - try { - let formId = "12400633174999288"; + var formId = '12400633174999288'; formHost.deleteForm(formId).then(() => { console.log('formHost deleteForm success'); }).catch((error) => { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.log('formHost deleteForm, error:' + JSON.stringify(error)); }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` @@ -124,23 +121,21 @@ Releases a widget. After this API is called, the application can no longer use t | Error Code ID| Error Message| | -------- | -------- | -| 401 | Incorrect input parameter.| +| 401 | If the input parameter is not valid parameter. | |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| **Example** ```ts -import formHost from '@ohos.app.form.formHost'; - try { - let formId = "12400633174999288"; - formHost.releaseForm(formId, (error) => { + var formId = '12400633174999288'; + formHost.releaseForm(formId, (error, data) => { if (error) { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.log('formHost releaseForm, error:' + JSON.stringify(error)); } }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` @@ -166,23 +161,21 @@ Releases a widget. After this API is called, the application can no longer use t | Error Code ID| Error Message| | -------- | -------- | -| 401 | Incorrect input parameter.| +| 401 | If the input parameter is not valid parameter. | |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| **Example** ```ts -import formHost from '@ohos.app.form.formHost'; - try { - let formId = "12400633174999288"; - formHost.releaseForm(formId, true, (error) => { + var formId = '12400633174999288'; + formHost.releaseForm(formId, true, (error, data) => { if (error) { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.log('formHost releaseForm, error:' + JSON.stringify(error)); } }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` @@ -213,23 +206,21 @@ Releases a widget. After this API is called, the application can no longer use t | Error Code ID| Error Message| | -------- | -------- | -| 401 | Incorrect input parameter.| +| 401 | If the input parameter is not valid parameter. | |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| **Example** ```ts -import formHost from '@ohos.app.form.formHost'; - try { - let formId = "12400633174999288"; + var formId = '12400633174999288'; formHost.releaseForm(formId, true).then(() => { console.log('formHost releaseForm success'); }).catch((error) => { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.log('formHost releaseForm, error:' + JSON.stringify(error)); }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` @@ -254,23 +245,21 @@ Requests a widget update. This API uses an asynchronous callback to return the r | Error Code ID| Error Message| | -------- | -------- | -| 401 | Incorrect input parameter.| +| 401 | If the input parameter is not valid parameter. | |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| **Example** ```ts -import formHost from '@ohos.app.form.formHost'; - try { - let formId = "12400633174999288"; - formHost.requestForm(formId, (error) => { + var formId = '12400633174999288'; + formHost.requestForm(formId, (error, data) => { if (error) { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.log('formHost requestForm, error:' + JSON.stringify(error)); } }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` @@ -300,23 +289,21 @@ Requests a widget update. This API uses a promise to return the result. | Error Code ID| Error Message| | -------- | -------- | -| 401 | Incorrect input parameter.| +| 401 | If the input parameter is not valid parameter. | |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| **Example** ```ts -import formHost from '@ohos.app.form.formHost'; - try { - let formId = "12400633174999288"; + var formId = '12400633174999288'; formHost.requestForm(formId).then(() => { console.log('formHost requestForm success'); }).catch((error) => { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.log('formHost requestForm, error:' + JSON.stringify(error)); }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` @@ -342,23 +329,21 @@ Converts a temporary widget to a normal one. This API uses an asynchronous callb | Error Code ID| Error Message| | -------- | -------- | -| 401 | Incorrect input parameter.| +| 401 | If the input parameter is not valid parameter. | |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| **Example** ```ts -import formHost from '@ohos.app.form.formHost'; - try { - let formId = "12400633174999288"; - formHost.castToNormalForm(formId, (error) => { + var formId = '12400633174999288'; + formHost.castToNormalForm(formId, (error, data) => { if (error) { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.log('formHost castTempForm, error:' + JSON.stringify(error)); } }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` @@ -388,23 +373,21 @@ Converts a temporary widget to a normal one. This API uses a promise to return t | Error Code ID| Error Message| | -------- | -------- | -| 401 | Incorrect input parameter.| +| 401 | If the input parameter is not valid parameter. | |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| **Example** ```ts -import formHost from '@ohos.app.form.formHost'; - try { - let formId = "12400633174999288"; + var formId = '12400633174999288'; formHost.castToNormalForm(formId).then(() => { console.log('formHost castTempForm success'); }).catch((error) => { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.log('formHost castTempForm, error:' + JSON.stringify(error)); }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` @@ -429,23 +412,21 @@ Instructs the widget framework to make a widget visible. After this API is calle | Error Code ID| Error Message| | -------- | -------- | -| 401 | Incorrect input parameter.| +| 401 | If the input parameter is not valid parameter. | |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| **Example** ```ts -import formHost from '@ohos.app.form.formHost'; - try { - let formId = ["12400633174999288"]; - formHost.notifyVisibleForms(formId, (error) => { + var formId = ['12400633174999288']; + formHost.notifyVisibleForms(formId, (error, data) => { if (error) { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.log('formHost notifyVisibleForms, error:' + JSON.stringify(error)); } }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` @@ -475,23 +456,21 @@ Instructs the widget framework to make a widget visible. After this API is calle | Error Code ID| Error Message| | -------- | -------- | -| 401 | Incorrect input parameter.| +| 401 | If the input parameter is not valid parameter. | |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| **Example** ```ts -import formHost from '@ohos.app.form.formHost'; - try { - let formId = ["12400633174999288"]; + var formId = ['12400633174999288']; formHost.notifyVisibleForms(formId).then(() => { console.log('formHost notifyVisibleForms success'); }).catch((error) => { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.log('formHost notifyVisibleForms, error:' + JSON.stringify(error)); }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` @@ -516,23 +495,21 @@ Instructs the widget framework to make a widget invisible. After this API is cal | Error Code ID| Error Message| | -------- | -------- | -| 401 | Incorrect input parameter.| +| 401 | If the input parameter is not valid parameter. | |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| **Example** ```ts -import formHost from '@ohos.app.form.formHost'; - try { - let formId = ["12400633174999288"]; - formHost.notifyInvisibleForms(formId, (error) => { + var formId = ['12400633174999288']; + formHost.notifyInvisibleForms(formId, (error, data) => { if (error) { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.log('formHost notifyInvisibleForms, error:' + JSON.stringify(error)); } }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` @@ -562,23 +539,21 @@ Instructs the widget framework to make a widget invisible. After this API is cal | Error Code ID| Error Message| | -------- | -------- | -| 401 | Incorrect input parameter.| +| 401 | If the input parameter is not valid parameter. | |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| **Example** ```ts -import formHost from '@ohos.app.form.formHost'; - try { - let formId = ["12400633174999288"]; + var formId = ['12400633174999288']; formHost.notifyInvisibleForms(formId).then(() => { console.log('formHost notifyInvisibleForms success'); }).catch((error) => { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.log('formHost notifyInvisibleForms, error:' + JSON.stringify(error)); }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` @@ -603,23 +578,21 @@ Instructs the widget framework to make a widget updatable. After this API is cal | Error Code ID| Error Message| | -------- | -------- | -| 401 | Incorrect input parameter.| +| 401 | If the input parameter is not valid parameter. | |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| **Example** ```ts -import formHost from '@ohos.app.form.formHost'; - try { - let formId = ["12400633174999288"]; - formHost.enableFormsUpdate(formId, (error) => { + var formId = ['12400633174999288']; + formHost.enableFormsUpdate(formId, (error, data) => { if (error) { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.log('formHost enableFormsUpdate, error:' + JSON.stringify(error)); } }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` @@ -649,23 +622,21 @@ Instructs the widget framework to make a widget updatable. After this API is cal | Error Code ID| Error Message| | -------- | -------- | -| 401 | Incorrect input parameter.| +| 401 | If the input parameter is not valid parameter. | |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| **Example** ```ts -import formHost from '@ohos.app.form.formHost'; - try { - let formId = ["12400633174999288"]; + var formId = ['12400633174999288']; formHost.enableFormsUpdate(formId).then(() => { console.log('formHost enableFormsUpdate success'); }).catch((error) => { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.log('formHost enableFormsUpdate, error:' + JSON.stringify(error)); }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` @@ -690,23 +661,21 @@ Instructs the widget framework to make a widget not updatable. After this API is | Error Code ID| Error Message| | -------- | -------- | -| 401 | Incorrect input parameter.| +| 401 | If the input parameter is not valid parameter. | |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| **Example** ```ts -import formHost from '@ohos.app.form.formHost'; - try { - let formId = ["12400633174999288"]; - formHost.disableFormsUpdate(formId, (error) => { + var formId = ['12400633174999288']; + formHost.disableFormsUpdate(formId, (error, data) => { if (error) { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.log('formHost disableFormsUpdate, error:' + JSON.stringify(error)); } }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` @@ -736,23 +705,21 @@ Instructs the widget framework to make a widget not updatable. After this API is | Error Code ID| Error Message| | -------- | -------- | -| 401 | Incorrect input parameter.| +| 401 | If the input parameter is not valid parameter. | |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| **Example** ```ts -import formHost from '@ohos.app.form.formHost'; - try { - let formId = ["12400633174999288"]; + var formId = ['12400633174999288']; formHost.disableFormsUpdate(formId).then(() => { console.log('formHost disableFormsUpdate success'); }).catch((error) => { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.log('formHost disableFormsUpdate, error:' + JSON.stringify(error)); }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` @@ -773,16 +740,15 @@ Checks whether the system is ready. This API uses an asynchronous callback to re **Example** ```ts -import formHost from '@ohos.app.form.formHost'; - try { + var formId = '12400633174999288'; formHost.isSystemReady((error, data) => { if (error) { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.log('formHost isSystemReady, error:' + JSON.stringify(error)); } }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` @@ -803,16 +769,15 @@ Checks whether the system is ready. This API uses a promise to return the result **Example** ```ts -import formHost from '@ohos.app.form.formHost'; - try { + var formId = '12400633174999288'; formHost.isSystemReady().then(() => { console.log('formHost isSystemReady success'); }).catch((error) => { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.log('formHost isSystemReady, error:' + JSON.stringify(error)); }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` @@ -830,23 +795,21 @@ Obtains the widget information provided by all applications on the device. This | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------- | -| callback | AsyncCallback<Array<[formInfo.FormInfo](js-apis-app-form-formInfo.md)>> | Yes| Callback used to return the result. If the widget information is obtained, **error** is undefined and **data** is the information obtained; otherwise, **error** is an error object.| +| callback | AsyncCallback<Array<[FormInfo](js-apis-app-form-formInfo.md)>> | Yes| Callback used to return the result. If the widget information is obtained, **error** is undefined and **data** is the information obtained; otherwise, **error** is an error object.| **Example** ```ts -import formHost from '@ohos.app.form.formHost'; - try { formHost.getAllFormsInfo((error, data) => { if (error) { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.log('formHost getAllFormsInfo, error:' + JSON.stringify(error)); } else { console.log('formHost getAllFormsInfo, data:' + JSON.stringify(data)); } }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` @@ -864,21 +827,19 @@ Obtains the widget information provided by all applications on the device. This | Type | Description | | :----------------------------------------------------------- | :---------------------------------- | -| Promise<Array<[formInfo.FormInfo](js-apis-app-form-formInfo.md)>> | Promise used to return the information obtained.| +| Promise<Array<[FormInfo](js-apis-app-form-formInfo.md)>> | Promise used to return the information obtained.| **Example** ```ts -import formHost from '@ohos.app.form.formHost'; - try { formHost.getAllFormsInfo().then((data) => { - console.log('formHost getAllFormsInfo data:' + JSON.stringify(data)); + console.log('formHost getAllFormsInfo data:' + JSON.stringify(data)); }).catch((error) => { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.log('formHost getAllFormsInfo, error:' + JSON.stringify(error)); }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` @@ -903,24 +864,22 @@ Obtains the widget information provided by a given application on the device. Th | Error Code ID| Error Message| | -------- | -------- | -| 401 | Incorrect input parameter.| +| 401 | If the input parameter is not valid parameter. | |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| **Example** ```ts -import formHost from '@ohos.app.form.formHost'; - try { - formHost.getFormsInfo("com.example.ohos.formjsdemo", (error, data) => { + formHost.getFormsInfo('com.example.ohos.formjsdemo', (error, data) => { if (error) { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.log('formHost getFormsInfo, error:' + JSON.stringify(error)); } else { console.log('formHost getFormsInfo, data:' + JSON.stringify(data)); } }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` @@ -946,24 +905,22 @@ Obtains the widget information provided by a given application on the device. Th | Error Code ID| Error Message| | -------- | -------- | -| 401 | Incorrect input parameter.| +| 401 | If the input parameter is not valid parameter. | |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| **Example** ```ts -import formHost from '@ohos.app.form.formHost'; - try { - formHost.getFormsInfo("com.example.ohos.formjsdemo", "entry", (error, data) => { + formHost.getFormsInfo('com.example.ohos.formjsdemo', 'entry', (error, data) => { if (error) { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.log('formHost getFormsInfo, error:' + JSON.stringify(error)); } else { - console.log('formHost getFormsInfo, data:' + JSON.stringify(data)); + console.log('formHost getFormsInfo, data:' + JSON.stringify(data)); } }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` @@ -988,28 +945,26 @@ Obtains the widget information provided by a given application on the device. Th | Type | Description | | :----------------------------------------------------------- | :---------------------------------- | -| Promise<Array<[formInfo.FormInfo](js-apis-app-form-formInfo.md)>> | Promise used to return the information obtained.| +| Promise<Array<[FormInfo](js-apis-app-form-formInfo.md)>> | Promise used to return the information obtained.| **Error codes** | Error Code ID| Error Message| | -------- | -------- | -| 401 | Incorrect input parameter.| +| 401 | If the input parameter is not valid parameter. | |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| **Example** ```ts -import formHost from '@ohos.app.form.formHost'; - try { - formHost.getFormsInfo("com.example.ohos.formjsdemo", "entry").then((data) => { + formHost.getFormsInfo('com.example.ohos.formjsdemo', 'entry').then((data) => { console.log('formHost getFormsInfo, data:' + JSON.stringify(data)); }).catch((error) => { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.log('formHost getFormsInfo, error:' + JSON.stringify(error)); }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` @@ -1033,19 +988,17 @@ Deletes invalid widgets from the list. This API uses an asynchronous callback to **Example** ```ts -import formHost from '@ohos.app.form.formHost'; - try { - let formIds = new Array("12400633174999288", "12400633174999289"); + var formIds = new Array('12400633174999288', '12400633174999289'); formHost.deleteInvalidForms(formIds, (error, data) => { if (error) { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.log('formHost deleteInvalidForms, error:' + JSON.stringify(error)); } else { console.log('formHost deleteInvalidForms, data:' + JSON.stringify(data)); } }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` @@ -1074,17 +1027,15 @@ Deletes invalid widgets from the list. This API uses a promise to return the res **Example** ```ts -import formHost from '@ohos.app.form.formHost'; - try { - let formIds = new Array("12400633174999288", "12400633174999289"); + var formIds = new Array('12400633174999288', '12400633174999289'); formHost.deleteInvalidForms(formIds).then((data) => { console.log('formHost deleteInvalidForms, data:' + JSON.stringify(data)); }).catch((error) => { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.log('formHost deleteInvalidForms, error:' + JSON.stringify(error)); }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` @@ -1103,40 +1054,38 @@ Obtains the widget state. This API uses an asynchronous callback to return the r | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------- | | want | [Want](js-apis-application-want.md) | Yes | **Want** information carried to query the widget state. The information must contain the bundle name, ability name, module name, widget name, and widget dimensions.| -| callback | AsyncCallback<[formInfo.FormStateInfo](js-apis-app-form-formInfo.md#formstateinfo)> | Yes| Callback used to return the result. If the widget state is obtained, **error** is undefined and **data** is the widget state obtained; otherwise, **error** is an error object.| +| callback | AsyncCallback<[FormInfo](js-apis-app-form-formInfo.md#formstateinfo)> | Yes| Callback used to return the result. If the widget state is obtained, **error** is undefined and **data** is the widget state obtained; otherwise, **error** is an error object.| **Error codes** | Error Code ID| Error Message| | -------- | -------- | -| 401 | Incorrect input parameter.| +| 401 | If the input parameter is not valid parameter. | |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| **Example** ```ts -import formHost from '@ohos.app.form.formHost'; - -let want = { - "deviceId": "", - "bundleName": "ohos.samples.FormApplication", - "abilityName": "FormAbility", - "parameters": { - "ohos.extra.param.key.module_name": "entry", - "ohos.extra.param.key.form_name": "widget", - "ohos.extra.param.key.form_dimension": 2 +var want = { + 'deviceId': '', + 'bundleName': 'ohos.samples.FormApplication', + 'abilityName': 'FormAbility', + 'parameters': { + 'ohos.extra.param.key.module_name': 'entry', + 'ohos.extra.param.key.form_name': 'widget', + 'ohos.extra.param.key.form_dimension': 2 } }; try { formHost.acquireFormState(want, (error, data) => { if (error) { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.log('formHost acquireFormState, error:' + JSON.stringify(error)); } else { console.log('formHost acquireFormState, data:' + JSON.stringify(data)); } }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` @@ -1160,44 +1109,42 @@ Obtains the widget state. This API uses a promise to return the result. | Type | Description | | :------------ | :---------------------------------- | -| Promise<[formInfo.FormStateInfo](js-apis-app-form-formInfo.md#formstateinfo)> | Promise used to return the widget state obtained.| +| Promise<[FormStateInfo](js-apis-app-form-formInfo.md#formstateinfo)> | Promise used to return the widget state obtained.| **Error codes** | Error Code ID| Error Message| | -------- | -------- | -| 401 | Incorrect input parameter.| +| 401 | If the input parameter is not valid parameter. | |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| **Example** ```ts -import formHost from '@ohos.app.form.formHost'; - -let want = { - "deviceId": "", - "bundleName": "ohos.samples.FormApplication", - "abilityName": "FormAbility", - "parameters": { - "ohos.extra.param.key.module_name": "entry", - "ohos.extra.param.key.form_name": "widget", - "ohos.extra.param.key.form_dimension": 2 +var want = { + 'deviceId': '', + 'bundleName': 'ohos.samples.FormApplication', + 'abilityName': 'FormAbility', + 'parameters': { + 'ohos.extra.param.key.module_name': 'entry', + 'ohos.extra.param.key.form_name': 'widget', + 'ohos.extra.param.key.form_dimension': 2 } }; try { formHost.acquireFormState(want).then((data) => { console.log('formHost acquireFormState, data:' + JSON.stringify(data)); }).catch((error) => { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.log('formHost acquireFormState, error:' + JSON.stringify(error)); }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` -## on("formUninstall") +## on('formUninstall') -on(type: "formUninstall", callback: Callback<string>): void +on(type: 'formUninstall', callback: Callback<string>): void Subscribes to widget uninstall events. This API uses an asynchronous callback to return the result. @@ -1207,23 +1154,21 @@ Subscribes to widget uninstall events. This API uses an asynchronous callback to | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------- | -| type | string | Yes | Event type. The value **formUninstall** indicates a widget uninstallation event.| +| type | string | Yes | Event type. The value **'formUninstall'** indicates a widget uninstallation event.| | callback | Callback<string> | Yes| Callback used to return the widget ID.| **Example** ```ts -import formHost from '@ohos.app.form.formHost'; - let callback = function(formId) { console.log('formHost on formUninstall, formId:' + formId); } -formHost.on("formUninstall", callback); +formHost.on('formUninstall', callback); ``` -## off("formUninstall") +## off('formUninstall') -off(type: "formUninstall", callback?: Callback<string>): void +off(type: 'formUninstall', callback?: Callback<string>): void Unsubscribes from widget uninstall events. This API uses an asynchronous callback to return the result. @@ -1233,18 +1178,16 @@ Unsubscribes from widget uninstall events. This API uses an asynchronous callbac | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------- | -| type | string | Yes | Event type. The value **formUninstall** indicates a widget uninstallation event.| -| callback | Callback<string> | No| Callback used to return the widget ID. If it is left unspecified, it indicates the callback for all the events that have been subscribed.
The value must be the same as that in **on("formUninstall")**.| +| type | string | Yes | Event type. The value **'formUninstall'** indicates a widget uninstallation event.| +| callback | Callback<string> | No| Callback used to return the widget ID. If it is left unspecified, it indicates the callback for all the events that have been subscribed.
The value must be the same as that in **on('formUninstall')**.| **Example** ```ts -import formHost from '@ohos.app.form.formHost'; - let callback = function(formId) { console.log('formHost on formUninstall, formId:' + formId); } -formHost.off("formUninstall", callback); +formHost.off('formUninstall', callback); ``` ## notifyFormsVisible @@ -1269,23 +1212,21 @@ Instructs the widgets to make themselves visible. This API uses an asynchronous | Error Code ID| Error Message| | -------- | -------- | -| 401 | Incorrect input parameter.| +| 401 | If the input parameter is not valid parameter. | |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| **Example** ```ts -import formHost from '@ohos.app.form.formHost'; - -let formIds = new Array("12400633174999288", "12400633174999289"); +var formIds = new Array('12400633174999288', '12400633174999289'); try { - formHost.notifyFormsVisible(formIds, true, (error) => { + formHost.notifyFormsVisible(formIds, true, (error, data) => { if (error) { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.log('formHost notifyFormsVisible, error:' + JSON.stringify(error)); } }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` @@ -1316,23 +1257,21 @@ Instructs the widgets to make themselves visible. This API uses a promise to ret | Error Code ID| Error Message| | -------- | -------- | -| 401 | Incorrect input parameter.| +| 401 | If the input parameter is not valid parameter. | |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| **Example** ```ts -import formHost from '@ohos.app.form.formHost'; - -let formIds = new Array("12400633174999288", "12400633174999289"); +var formIds = new Array('12400633174999288', '12400633174999289'); try { formHost.notifyFormsVisible(formIds, true).then(() => { console.log('formHost notifyFormsVisible success'); }).catch((error) => { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.log('formHost notifyFormsVisible, error:' + JSON.stringify(error)); }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` @@ -1358,23 +1297,21 @@ Instructs the widgets to enable or disable updates. This API uses an asynchronou | Error Code ID| Error Message| | -------- | -------- | -| 401 | Incorrect input parameter.| +| 401 | If the input parameter is not valid parameter. | |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| **Example** ```ts -import formHost from '@ohos.app.form.formHost'; - -let formIds = new Array("12400633174999288", "12400633174999289"); +var formIds = new Array('12400633174999288', '12400633174999289'); try { - formHost.notifyFormsEnableUpdate(formIds, true, (error) => { + formHost.notifyFormsEnableUpdate(formIds, true, (error, data) => { if (error) { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.log('formHost notifyFormsEnableUpdate, error:' + JSON.stringify(error)); } }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` @@ -1405,23 +1342,21 @@ Instructs the widgets to enable or disable updates. This API uses a promise to r | Error Code ID| Error Message| | -------- | -------- | -| 401 | Incorrect input parameter.| +| 401 | If the input parameter is not valid parameter. | |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| **Example** ```ts -import formHost from '@ohos.app.form.formHost'; - -let formIds = new Array("12400633174999288", "12400633174999289"); +var formIds = new Array('12400633174999288', '12400633174999289'); try { formHost.notifyFormsEnableUpdate(formIds, true).then(() => { console.log('formHost notifyFormsEnableUpdate success'); }).catch((error) => { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.log('formHost notifyFormsEnableUpdate, error:' + JSON.stringify(error)); }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` ## shareForm @@ -1446,24 +1381,23 @@ Shares a specified widget with a remote device. This API uses an asynchronous ca | Error Code ID| Error Message| | -------- | -------- | -| 401 | Incorrect input parameter.| +| 401 | If the input parameter is not valid parameter. | |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| + **Example** ```ts -import formHost from '@ohos.app.form.formHost'; - -let formId = "12400633174999288"; -let deviceId = "EFC11C0C53628D8CC2F8CB5052477E130D075917034613B9884C55CD22B3DEF2"; +var formId = '12400633174999288'; +var deviceId = 'EFC11C0C53628D8CC2F8CB5052477E130D075917034613B9884C55CD22B3DEF2'; try { - formHost.shareForm(formId, deviceId, (error) => { + formHost.shareForm(formId, deviceId, (error, data) => { if (error) { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.log('formHost shareForm, error:' + JSON.stringify(error)); } }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` @@ -1494,24 +1428,22 @@ Shares a specified widget with a remote device. This API uses a promise to retur | Error Code ID| Error Message| | -------- | -------- | -| 401 | Incorrect input parameter.| +| 401 | If the input parameter is not valid parameter. | |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| **Example** ```ts -import formHost from '@ohos.app.form.formHost'; - -let formId = "12400633174999288"; -let deviceId = "EFC11C0C53628D8CC2F8CB5052477E130D075917034613B9884C55CD22B3DEF2"; +var formId = '12400633174999288'; +var deviceId = 'EFC11C0C53628D8CC2F8CB5052477E130D075917034613B9884C55CD22B3DEF2'; try { formHost.shareForm(formId, deviceId).then(() => { console.log('formHost shareForm success'); }).catch((error) => { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.log('formHost shareForm, error:' + JSON.stringify(error)); }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` @@ -1529,75 +1461,18 @@ Notifies that the privacy protection status of the specified widgets changes. Th | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------- | -| formIds | Array\ | Yes | ID of the widgets.| -| isProtected | boolean | Yes | Whether privacy protection is enabled.| -| callback | AsyncCallback\ | Yes| Callback used to return the result. If privacy protection is set successfully, **error** is undefined; otherwise, **error** is an error object.| - -**Error codes** - -| Error Code ID | Error Message | -| ------------------------------------------------------------ | ------------------ | -| 401 | Incorrect input parameter.| -| For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| | - -**Example** - -```ts -import formHost from '@ohos.app.form.formHost'; - -let formIds = new Array("12400633174999288", "12400633174999289"); -try { - formHost.notifyFormsPrivacyProtected(formIds, true, (error) => { - if (error) { - console.log(`error, code: ${error.code}, message: ${error.message}`); - } - }); -} catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); -} -``` - -## notifyFormsPrivacyProtected - -function notifyFormsPrivacyProtected(formIds: Array\, isProtected: boolean): Promise\; - -Notifies that the privacy protection status of the specified widgets changes. This API uses a promise to return the result. - -**Required permissions**: ohos.permission.REQUIRE_FORM - -**System capability**: SystemCapability.Ability.Form - -**Parameters** - -| Name | Type | Mandatory| Description | -| ----------- | --------------- | ---- | -------------------------------- | -| formIds | Array\ | Yes | ID of the widgets.| -| isProtected | boolean | Yes | Whether privacy protection is enabled. | - -**Return value** - -| Type | Description | -| ------------------- | ------------------------- | -| Promise<void> | Promise that returns no value.| - -**Error codes** - -| Error Code ID | Error Message | -| ------------------------------------------------------------ | ------------------ | -| 401 | Incorrect input parameter.| -| For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| | +| formId | string | Yes | Widget ID.| +| deviceId | string | Yes | Remote device ID. | ```ts -import formHost from '@ohos.app.form.formHost'; - -let formIds = new Array("12400633174999288", "12400633174999289"); +var formIds = new Array('12400633174999288', '12400633174999289'); try { formHost.notifyFormsPrivacyProtected(formIds, true).then(() => { - console.log('formHost notifyFormsPrivacyProtected success'); + console.log('formHost shareForm success'); }).catch((error) => { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.log('formHost shareForm, error:' + JSON.stringify(error)); }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` diff --git a/en/application-dev/reference/apis/js-apis-app-form-formProvider.md b/en/application-dev/reference/apis/js-apis-app-form-formProvider.md index d61484f86b36bafd74ded1860272ac1a4b86089a..51b4fa42a1704ed9cf451daff6e2416a491db4a9 100644 --- a/en/application-dev/reference/apis/js-apis-app-form-formProvider.md +++ b/en/application-dev/reference/apis/js-apis-app-form-formProvider.md @@ -1,4 +1,4 @@ -# @ohos.app.form.formProvider (formProvider) +# @ohos.app.form.formProvider (FormProvider) The **FormProvider** module provides APIs related to the widget provider. You can use the APIs to update a widget, set the next refresh time for a widget, obtain widget information, and request a widget release. @@ -31,25 +31,23 @@ Sets the next refresh time for a widget. This API uses an asynchronous callback | Error Code ID| Error Message| | -------- | -------- | -| 401 | Incorrect input parameter.| +| 401 | If the input parameter is not valid parameter. | |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| **Example** ```ts -import formProvider from '@ohos.app.form.formProvider'; - -let formId = "12400633174999288"; +var formId = '12400633174999288'; try { formProvider.setFormNextRefreshTime(formId, 5, (error, data) => { if (error) { - console.log(`callback error, code: ${error.code}, message: ${error.message})`); + console.log('formProvider setFormNextRefreshTime, error:' + JSON.stringify(error)); } else { console.log(`formProvider setFormNextRefreshTime success`); } }); } catch (error) { - console.log(`catch error, code: ${error.code}, message: ${error.message})`); + console.log('error' + JSON.stringify(error)) } ``` @@ -78,23 +76,21 @@ Sets the next refresh time for a widget. This API uses a promise to return the r | Error Code ID| Error Message| | -------- | -------- | -| 401 | Incorrect input parameter.| +| 401 | If the input parameter is not valid parameter. | |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| **Example** ```ts -import formProvider from '@ohos.app.form.formProvider'; - -let formId = "12400633174999288"; +var formId = '12400633174999288'; try { formProvider.setFormNextRefreshTime(formId, 5).then(() => { - console.log(`formProvider setFormNextRefreshTime success`); + console.log('formProvider setFormNextRefreshTime success'); }).catch((error) => { - console.log(`promise error, code: ${error.code}, message: ${error.message})`); + console.log('formProvider setFormNextRefreshTime, error:' + JSON.stringify(error)); }); } catch (error) { - console.log(`catch error, code: ${error.code}, message: ${error.message})`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` @@ -118,27 +114,25 @@ Updates a widget. This API uses an asynchronous callback to return the result. | Error Code ID| Error Message| | -------- | -------- | -| 401 | Incorrect input parameter.| +| 401 | If the input parameter is not valid parameter. | |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| **Example** ```ts import formBindingData from '@ohos.application.formBindingData'; -import formProvider from '@ohos.app.form.formProvider'; - -let formId = "12400633174999288"; +var formId = '12400633174999288'; try { - let obj = formBindingData.createFormBindingData({temperature:"22c", time:"22:00"}); + let obj = formBindingData.createFormBindingData({temperature:'22c', time:'22:00'}); formProvider.updateForm(formId, obj, (error, data) => { if (error) { - console.log(`callback error, code: ${error.code}, message: ${error.message})`); + console.log('formProvider updateForm, error:' + JSON.stringify(error)); } else { console.log(`formProvider updateForm success`); } }); } catch (error) { - console.log(`catch error, code: ${error.code}, message: ${error.message})`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` @@ -167,25 +161,23 @@ Updates a widget. This API uses a promise to return the result. | Error Code ID| Error Message| | -------- | -------- | -| 401 | Incorrect input parameter.| +| 401 | If the input parameter is not valid parameter. | |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| **Example** ```ts import formBindingData from '@ohos.application.formBindingData'; -import formProvider from '@ohos.app.form.formProvider'; - -let formId = "12400633174999288"; -let obj = formBindingData.createFormBindingData({ temperature: "22c", time: "22:00" }); +var formId = '12400633174999288'; +let obj = formBindingData.createFormBindingData({temperature:'22c', time:'22:00'}); try { formProvider.updateForm(formId, obj).then(() => { - console.log(`formProvider updateForm success`); + console.log('formProvider updateForm success'); }).catch((error) => { - console.log(`promise error, code: ${error.code}, message: ${error.message})`); + console.log('formProvider updateForm, error:' + JSON.stringify(error)); }); } catch (error) { - console.log(`catch error, code: ${error.code}, message: ${error.message})`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` @@ -201,31 +193,29 @@ Obtains the application's widget information on the device. This API uses an asy | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------- | -| callback | AsyncCallback<Array<[formInfo.FormInfo](js-apis-app-form-formInfo.md)>> | Yes| Callback used to return the information obtained.| +| callback | AsyncCallback<Array<[FormInfo](js-apis-app-form-formInfo.md)>> | Yes| Callback used to return the information obtained.| **Error codes** | Error Code ID| Error Message| | -------- | -------- | -| 401 | Incorrect input parameter.| +| 401 | If the input parameter is not valid parameter. | |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| **Example** ```ts -import formProvider from '@ohos.app.form.formProvider'; - try { formProvider.getFormsInfo((error, data) => { if (error) { - console.log(`callback error, code: ${error.code}, message: ${error.message})`); + console.log('formProvider getFormsInfo, error:' + JSON.stringify(error)); } else { - console.log('formProvider getFormsInfo, data: ' + JSON.stringify(data)); + console.log('formProvider getFormsInfo, data:' + JSON.stringify(data)); } }); } catch (error) { - console.log(`catch error, code: ${error.code}, message: ${error.message})`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` ## getFormsInfo @@ -241,35 +231,33 @@ Obtains the application's widget information that meets a filter criterion on th | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------- | | filter | [formInfo.FormInfoFilter](js-apis-app-form-formInfo.md#forminfofilter) | Yes| Filter criterion.| -| callback | AsyncCallback<Array<[formInfo.FormInfo](js-apis-app-form-formInfo.md)>> | Yes| Callback used to return the information obtained.| +| callback | AsyncCallback<Array<[FormInfo](js-apis-app-form-formInfo.md)>> | Yes| Callback used to return the information obtained.| **Error codes** | Error Code ID| Error Message| | -------- | -------- | -| 401 | Incorrect input parameter.| +| 401 | If the input parameter is not valid parameter. | |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| **Example** ```ts -import formInfo from '@ohos.app.form.formInfo'; -import formProvider from '@ohos.app.form.formProvider'; - -const filter: formInfo.FormInfoFilter = { - // get info of forms belong to module entry. - moduleName: "entry" +import formInfo from '@ohos.application.formInfo'; +const filter : formInfo.FormInfoFilter = { + // get info of forms belong to module entry. + moduleName : 'entry' }; try { formProvider.getFormsInfo(filter, (error, data) => { if (error) { - console.log(`callback error, code: ${error.code}, message: ${error.message})`); + console.log('formProvider getFormsInfo, error:' + JSON.stringify(error)); } else { - console.log('formProvider getFormsInfo, data: ' + JSON.stringify(data)); + console.log('formProvider getFormsInfo, data:' + JSON.stringify(data)); } }); -} catch (error) { - console.log(`catch error, code: ${error.code}, message: ${error.message})`); +} catch(error) { + console.log(`catch err->${JSON.stringify(error)}`); } ``` @@ -291,33 +279,31 @@ Obtains the application's widget information on the device. This API uses a prom | Type | Description | | :------------ | :---------------------------------- | -| Promise<Array<[formInfo.FormInfo](js-apis-app-form-formInfo.md)>> | Promise used to return the information obtained.| +| Promise<Array<[FormInfo](js-apis-app-form-formInfo.md)>> | Promise used to return the information obtained.| **Error codes** | Error Code ID| Error Message| | -------- | -------- | -| 401 | Incorrect input parameter.| +| 401 | If the input parameter is not valid parameter. | |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| **Example** ```ts -import formInfo from '@ohos.app.form.formInfo'; -import formProvider from '@ohos.app.form.formProvider'; - -const filter: formInfo.FormInfoFilter = { - // get info of forms belong to module entry. - moduleName: "entry" +import formInfo from '@ohos.application.formInfo'; +const filter : formInfo.FormInfoFilter = { + // get info of forms belong to module entry. + moduleName : 'entry' }; try { formProvider.getFormsInfo(filter).then((data) => { console.log('formProvider getFormsInfo, data:' + JSON.stringify(data)); }).catch((error) => { - console.log(`promise error, code: ${error.code}, message: ${error.message})`); + console.log('formProvider getFormsInfo, error:' + JSON.stringify(error)); }); } catch (error) { - console.log(`catch error, code: ${error.code}, message: ${error.message})`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` @@ -335,42 +321,40 @@ Requests to publish a widget carrying data to the widget host. This API uses an | Name| Type | Mandatory| Description | | ------ | ---------------------------------------------------------------------- | ---- | ---------------- | -| want | [Want](js-apis-application-want.md) | Yes | Request used for publishing. The following fields must be included:
Information about the target widget.
**abilityName**: ability of the target widget.
**parameters**:
"ohos.extra.param.key.form_dimension"
"ohos.extra.param.key.form_name"
"ohos.extra.param.key.module_name" | -| formBindingData | [formBindingData.FormBindingData](js-apis-app-form-formBindingData.md#formbindingdata) | Yes | Data used for creating the widget.| +| want | [Want](js-apis-application-want.md) | Yes | Request used for publishing. The following fields must be included:
Information about the target widget.
**abilityName**: ability of the target widget.
**parameters**:
'ohos.extra.param.key.form_dimension'
'ohos.extra.param.key.form_name'
'ohos.extra.param.key.module_name' | +| formBindingData.FormBindingData | [FormBindingData](js-apis-app-form-formBindingData.md#formbindingdata) | Yes | Data used for creating the widget.| | callback | AsyncCallback<string> | Yes| Callback used to return the widget ID.| **Error codes** | Error Code ID| Error Message| | -------- | -------- | -| 401 | Incorrect input parameter.| +| 401 | If the input parameter is not valid parameter. | |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| **Example** ```ts import formBindingData from '@ohos.application.formBindingData'; -import formProvider from '@ohos.app.form.formProvider'; - -let want = { - abilityName: "FormAbility", +var want = { + abilityName: 'FormAbility', parameters: { - "ohos.extra.param.key.form_dimension": 2, - "ohos.extra.param.key.form_name": "widget", - "ohos.extra.param.key.module_name": "entry" + 'ohos.extra.param.key.form_dimension': 2, + 'ohos.extra.param.key.form_name': 'widget', + 'ohos.extra.param.key.module_name': 'entry' } }; try { - let obj = formBindingData.createFormBindingData({ temperature: "22c", time: "22:00" }); + let obj = formBindingData.createFormBindingData({temperature:'22c', time:'22:00'}); formProvider.requestPublishForm(want, obj, (error, data) => { if (error) { - console.log(`callback error, code: ${error.code}, message: ${error.message})`); + console.log('formProvider requestPublishForm, error: ' + JSON.stringify(error)); } else { console.log('formProvider requestPublishForm, form ID is: ' + JSON.stringify(data)); } }); } catch (error) { - console.log(`catch error, code: ${error.code}, message: ${error.message})`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` @@ -388,40 +372,39 @@ Requests to publish a widget to the widget host. This API uses an asynchronous c | Name | Type | Mandatory| Description | | -------- | ----------------------------------- | ---- | ------------------------------------------------------------ | -| want | [Want](js-apis-application-want.md) | Yes | Request used for publishing. The following fields must be included:
Information about the target widget.
**abilityName**: ability of the target widget.
**parameters**:
"ohos.extra.param.key.form_dimension"
"ohos.extra.param.key.form_name"
"ohos.extra.param.key.module_name" | +| want | [Want](js-apis-application-want.md) | Yes | Request used for publishing. The following fields must be included:
Information about the target widget.
**abilityName**: ability of the target widget.
**parameters**:
'ohos.extra.param.key.form_dimension'
'ohos.extra.param.key.form_name'
'ohos.extra.param.key.module_name' | | callback | AsyncCallback<string> | Yes | Callback used to return the widget ID.| **Error codes** | Error Code ID| Error Message| | -------- | -------- | -| 401 | Incorrect input parameter.| +| 401 | If the input parameter is not valid parameter. | |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| **Example** ```ts -import formProvider from '@ohos.app.form.formProvider'; - -let want = { - abilityName: "FormAbility", +var want = { + abilityName: 'FormAbility', parameters: { - "ohos.extra.param.key.form_dimension": 2, - "ohos.extra.param.key.form_name": "widget", - "ohos.extra.param.key.module_name": "entry" + 'ohos.extra.param.key.form_dimension': 2, + 'ohos.extra.param.key.form_name': 'widget', + 'ohos.extra.param.key.module_name': 'entry' } }; try { formProvider.requestPublishForm(want, (error, data) => { if (error) { - console.log(`callback error, code: ${error.code}, message: ${error.message})`); + console.log('formProvider requestPublishForm, error: ' + JSON.stringify(error)); } else { console.log('formProvider requestPublishForm, form ID is: ' + JSON.stringify(data)); } }); } catch (error) { - console.log(`catch error, code: ${error.code}, message: ${error.message})`); + console.log(`catch err->${JSON.stringify(error)}`); } + ``` ## requestPublishForm @@ -438,8 +421,8 @@ Requests to publish a widget to the widget host. This API uses a promise to retu | Name | Type | Mandatory| Description | | --------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| want | [Want](js-apis-application-want.md) | Yes | Request used for publishing. The following fields must be included:
Information about the target widget.
**abilityName**: ability of the target widget.
**parameters**:
"ohos.extra.param.key.form_dimension"
"ohos.extra.param.key.form_name"
"ohos.extra.param.key.module_name" | -| formBindingData | [formBindingData.FormBindingData](js-apis-app-form-formBindingData.md#formbindingdata) | No | Data used for creating the widget. | +| want | [Want](js-apis-application-want.md) | Yes | Request used for publishing. The following fields must be included:
Information about the target widget.
**abilityName**: ability of the target widget.
**parameters**:
'ohos.extra.param.key.form_dimension'
'ohos.extra.param.key.form_name'
'ohos.extra.param.key.module_name' | +| formBindingData.FormBindingData | [FormBindingData](js-apis-app-form-formBindingData.md#formbindingdata) | No | Data used for creating the widget. | **Return value** @@ -451,30 +434,28 @@ Requests to publish a widget to the widget host. This API uses a promise to retu | Error Code ID| Error Message| | -------- | -------- | -| 401 | Incorrect input parameter.| +| 401 | If the input parameter is not valid parameter. | |For details about the error codes, see [Form Error Codes](../errorcodes/errorcode-form.md).| **Example** ```ts -import formProvider from '@ohos.app.form.formProvider'; - -let want = { - abilityName: "FormAbility", +var want = { + abilityName: 'FormAbility', parameters: { - "ohos.extra.param.key.form_dimension": 2, - "ohos.extra.param.key.form_name": "widget", - "ohos.extra.param.key.module_name": "entry" + 'ohos.extra.param.key.form_dimension': 2, + 'ohos.extra.param.key.form_name': 'widget', + 'ohos.extra.param.key.module_name': 'entry' } }; try { formProvider.requestPublishForm(want).then((data) => { console.log('formProvider requestPublishForm success, form ID is :' + JSON.stringify(data)); }).catch((error) => { - console.log(`promise error, code: ${error.code}, message: ${error.message})`); + console.log('formProvider requestPublishForm, error: ' + JSON.stringify(error)); }); } catch (error) { - console.log(`catch error, code: ${error.code}, message: ${error.message})`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` @@ -497,38 +478,37 @@ Checks whether a widget can be published to the widget host. This API uses an as **Example** ```ts -import formProvider from '@ohos.app.form.formProvider'; - try { formProvider.isRequestPublishFormSupported((error, isSupported) => { - if (error) { - console.log(`callback error, code: ${error.code}, message: ${error.message})`); - } else { - if (isSupported) { - var want = { - abilityName: "FormAbility", - parameters: { - "ohos.extra.param.key.form_dimension": 2, - "ohos.extra.param.key.form_name": "widget", - "ohos.extra.param.key.module_name": "entry" + if (error) { + console.log('formProvider isRequestPublishFormSupported, error:' + JSON.stringify(error)); + } else { + if (isSupported) { + var want = { + abilityName: 'FormAbility', + parameters: { + 'ohos.extra.param.key.form_dimension': 2, + 'ohos.extra.param.key.form_name': 'widget', + 'ohos.extra.param.key.module_name': 'entry' + } + }; + try { + formProvider.requestPublishForm(want, (error, data) => { + if (error) { + console.log('formProvider requestPublishForm, error: ' + JSON.stringify(error)); + } else { + console.log('formProvider requestPublishForm, form ID is: ' + JSON.stringify(data)); } - }; - try { - formProvider.requestPublishForm(want, (error, data) => { - if (error) { - console.log(`callback error, code: ${error.code}, message: ${error.message})`); - } else { - console.log('formProvider requestPublishForm, form ID is: ' + JSON.stringify(data)); - } - }); - } catch (error) { - console.log(`catch error, code: ${error.code}, message: ${error.message})`); - } + }); + } catch (error) { + console.log(`catch err->${JSON.stringify(error)}`); } + } - }); + } +}); } catch (error) { - console.log(`catch error, code: ${error.code}, message: ${error.message})`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` @@ -551,33 +531,32 @@ Checks whether a widget can be published to the widget host. This API uses a pro **Example** ```ts -import formProvider from '@ohos.app.form.formProvider'; - try { formProvider.isRequestPublishFormSupported().then((isSupported) => { if (isSupported) { var want = { - abilityName: "FormAbility", - parameters: { - "ohos.extra.param.key.form_dimension": 2, - "ohos.extra.param.key.form_name": "widget", - "ohos.extra.param.key.module_name": "entry" - } + abilityName: 'FormAbility', + parameters: { + 'ohos.extra.param.key.form_dimension': 2, + 'ohos.extra.param.key.form_name': 'widget', + 'ohos.extra.param.key.module_name': 'entry' + } }; try { formProvider.requestPublishForm(want).then((data) => { console.log('formProvider requestPublishForm success, form ID is :' + JSON.stringify(data)); }).catch((error) => { - console.log(`promise error, code: ${error.code}, message: ${error.message})`); + console.log('formProvider requestPublishForm, error: ' + JSON.stringify(error)); }); } catch (error) { - console.log(`catch error, code: ${error.code}, message: ${error.message})`); + console.log(`catch err->${JSON.stringify(error)}`); } + } }).catch((error) => { - console.log(`promise error, code: ${error.code}, message: ${error.message})`); + console.log('formProvider isRequestPublishFormSupported, error:' + JSON.stringify(error)); }); } catch (error) { - console.log(`catch error, code: ${error.code}, message: ${error.message})`); + console.log(`catch err->${JSON.stringify(error)}`); } ``` diff --git a/en/application-dev/reference/apis/js-apis-appAccount.md b/en/application-dev/reference/apis/js-apis-appAccount.md index 7c2974d0c8fc4eef7a911523fdeb96c596304c94..31760e1af22ae08fca02d78213a2703389c66ae3 100644 --- a/en/application-dev/reference/apis/js-apis-appAccount.md +++ b/en/application-dev/reference/apis/js-apis-appAccount.md @@ -1,4 +1,4 @@ -# @ohos.account.appAccount (App Account Management) +# @ohos.account.appAccount (App Account Management) The **appAccount** module provides APIs for adding, deleting, modifying, and querying app account information, and supports inter-app authentication and distributed data synchronization. @@ -198,18 +198,23 @@ Creates an app account implicitly based on the specified account owner. This API **Example** ```js - import featureAbility from '@ohos.ability.featureAbility'; - function onResultCallback(code, result) { console.log("resultCode: " + code); console.log("result: " + JSON.stringify(result)); } function onRequestRedirectedCallback(request) { - let abilityStartSetting = {want: request}; - featureAbility.startAbility(abilityStartSetting, (err) => { + let wantInfo = { + deviceId: '', + bundleName: 'com.example.accountjsdemo', + action: 'ohos.want.action.viewData', + entities: ['entity.system.default'], + } + this.context.startAbility(wantInfo).then(() => { + console.log("startAbility successfully"); + }).catch((err) => { console.log("startAbility err: " + JSON.stringify(err)); - }); + }) } try { @@ -252,18 +257,23 @@ Creates an app account implicitly based on the specified account owner and optio **Example** ```js - import featureAbility from '@ohos.ability.featureAbility'; - function onResultCallback(code, result) { console.log("resultCode: " + code); console.log("result: " + JSON.stringify(result)); } function onRequestRedirectedCallback(request) { - let abilityStartSetting = {want: request}; - featureAbility.startAbility(abilityStartSetting, (err) => { + let wantInfo = { + deviceId: '', + bundleName: 'com.example.accountjsdemo', + action: 'ohos.want.action.viewData', + entities: ['entity.system.default'], + } + this.context.startAbility(wantInfo).then(() => { + console.log("startAbility successfully"); + }).catch((err) => { console.log("startAbility err: " + JSON.stringify(err)); - }); + }) } let options = { @@ -1090,7 +1100,8 @@ getAllAccounts(callback: AsyncCallback<Array<AppAccountInfo>>): void Obtains information about all accessible app accounts. This API uses an asynchronous callback to return the result. -**Required Permissions**: ohos.permission.GET_ALL_APP_ACCOUNTS +**Required permissions**: ohos.permission.GET_ALL_APP_ACCOUNTS + **System capability**: SystemCapability.Account.AppAccount **Parameters** @@ -1127,7 +1138,8 @@ getAllAccounts(): Promise<Array<AppAccountInfo>> Obtains information about all accessible app accounts. This API uses a promise to return the result. -**Required Permissions**: ohos.permission.GET_ALL_APP_ACCOUNTS +**Required permissions**: ohos.permission.GET_ALL_APP_ACCOUNTS + **System capability**: SystemCapability.Account.AppAccount **Return value** @@ -1162,7 +1174,8 @@ getAccountsByOwner(owner: string, callback: AsyncCallback<Array<AppAccount Obtains the app accounts that can be accessed by the invoker based on the app account owner. This API uses an asynchronous callback to return the result. -**Required Permissions**: ohos.permission.GET_ALL_APP_ACCOUNTS +**Required permissions**: ohos.permission.GET_ALL_APP_ACCOUNTS + **System capability**: SystemCapability.Account.AppAccount **Parameters** @@ -1201,8 +1214,8 @@ Obtains the app accounts that can be accessed by the invoker based on the app ac getAccountsByOwner(owner: string): Promise<Array<AppAccountInfo>> Obtains the app accounts that can be accessed by the invoker based on the app account owner. This API uses a promise to return the result. +**Required permissions**: ohos.permission.GET_ALL_APP_ACCOUNTS -**Required Permissions**: ohos.permission.GET_ALL_APP_ACCOUNTS **System capability**: SystemCapability.Account.AppAccount **Parameters** @@ -1303,7 +1316,7 @@ Unsubscribes from account information changes. **Example** ```js - function changeOnCallback(data) { + function changeOnCallback(data){ console.log("receive change data:" + JSON.stringify(data)); } try{ @@ -1350,7 +1363,7 @@ Authenticates an app account. This API uses an asynchronous callback to return t **Example** ```js - import featureAbility from '@ohos.ability.featureAbility'; + function onResultCallback(code, authResult) { console.log("resultCode: " + code); @@ -1358,10 +1371,17 @@ Authenticates an app account. This API uses an asynchronous callback to return t } function onRequestRedirectedCallback(request) { - let abilityStartSetting = {want: request}; - featureAbility.startAbility(abilityStartSetting, (err) => { - console.log("startAbility err: " + JSON.stringify(err)); - }); + let wantInfo = { + deviceId: '', + bundleName: 'com.example.accountjsdemo', + action: 'ohos.want.action.viewData', + entities: ['entity.system.default'], + } + this.context.startAbility(wantInfo).then(() => { + console.log("startAbility successfully"); + }).catch((err) => { + console.log("startAbility err: " + JSON.stringify(err)); + }) } try { @@ -1406,7 +1426,7 @@ Authenticates an app account with customized options. This API uses an asynchron **Example** ```js - import featureAbility from '@ohos.ability.featureAbility'; + function onResultCallback(code, authResult) { console.log("resultCode: " + code); @@ -1414,10 +1434,17 @@ Authenticates an app account with customized options. This API uses an asynchron } function onRequestRedirectedCallback(request) { - let abilityStartSetting = {want: request}; - featureAbility.startAbility(abilityStartSetting, (err) => { - console.log("startAbility err: " + JSON.stringify(err)); - }); + let wantInfo = { + deviceId: '', + bundleName: 'com.example.accountjsdemo', + action: 'ohos.want.action.viewData', + entities: ['entity.system.default'], + } + this.context.startAbility(wantInfo).then(() => { + console.log("startAbility successfully"); + }).catch((err) => { + console.log("startAbility err: " + JSON.stringify(err)); + }) } let options = { @@ -1622,7 +1649,7 @@ Deletes the authorization token of the specified authentication type for an app | name | string | Yes | Name of the target app account. | | owner | string | Yes | Owner of the app account. The value is the bundle name of the app. | | authType | string | Yes | Authentication type. | -| token | string | Yes | Token to delete.| +| token | string | Yes | Authorization token to delete.| | callback | AsyncCallback<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object. | **Error codes** @@ -1665,7 +1692,7 @@ Deletes the authorization token of the specified authentication type for an app | name | string | Yes | Name of the target app account. | | owner | string | Yes | Owner of the app account. The value is the bundle name of the app. | | authType | string | Yes | Authentication type. | -| token | string | Yes | Token to delete.| +| token | string | Yes | Authorization token to delete.| **Return value** @@ -2710,7 +2737,7 @@ Adds an app account. This API uses an asynchronous callback to return the result | Name | Type | Mandatory | Description | | -------- | ------------------------- | ---- | -------------------- | -| name | string | Yes | Name of the target app account. | +| name | string | Yes | Name of the app account to add. | | callback | AsyncCallback<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.| **Example** @@ -2755,8 +2782,7 @@ addAccount(name: string, extraInfo?: string): Promise<void> Adds an app account name and additional information. This API uses an asynchronous callback to return the result. This API uses a promise to return the result. -> **NOTE** -> +> **NOTE**
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [createAccount](#createaccount9-2). **System capability**: SystemCapability.Account.AppAccount @@ -2808,7 +2834,7 @@ Adds an app account implicitly based on the specified owner. This API uses an as **Example** ```js - import featureAbility from '@ohos.ability.featureAbility'; + function onResultCallback(code, result) { console.log("resultCode: " + code); @@ -2816,10 +2842,17 @@ Adds an app account implicitly based on the specified owner. This API uses an as } function onRequestRedirectedCallback(request) { - let abilityStartSetting = {want: request}; - featureAbility.startAbility(abilityStartSetting, (err)=>{ + let wantInfo = { + deviceId: '', + bundleName: 'com.example.accountjsdemo', + action: 'ohos.want.action.viewData', + entities: ['entity.system.default'], + } + this.context.startAbility(wantInfo).then(() => { + console.log("startAbility successfully"); + }).catch((err) => { console.log("startAbility err: " + JSON.stringify(err)); - }); + }) } appAccountManager.addAccountImplicitly("com.example.accountjsdemo", "getSocialData", {}, { @@ -2844,7 +2877,7 @@ Deletes an app account. This API uses an asynchronous callback to return the res | Name | Type | Mandatory | Description | | -------- | ------------------------- | ---- | ---------------- | -| name | string | Yes | Name of the target app account. | +| name | string | Yes | Name of the app account to delete. | | callback | AsyncCallback<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.| **Example** @@ -2871,7 +2904,7 @@ Deletes an app account. This API uses a promise to return the result. | Name | Type | Mandatory | Description | | ---- | ------ | ---- | ----------- | -| name | string | Yes | Name of the target app account.| +| name | string | Yes | Name of the app account to delete.| **Return value** @@ -3756,18 +3789,23 @@ Authenticates an app account with customized options. This API uses an asynchron **Example** ```js - import featureAbility from '@ohos.ability.featureAbility'; - function onResultCallback(code, result) { console.log("resultCode: " + code); console.log("result: " + JSON.stringify(result)); } function onRequestRedirectedCallback(request) { - let abilityStartSetting = {want: request}; - featureAbility.startAbility(abilityStartSetting, (err)=>{ - console.log("startAbility err: " + JSON.stringify(err)); - }); + let wantInfo = { + deviceId: '', + bundleName: 'com.example.accountjsdemo', + action: 'ohos.want.action.viewData', + entities: ['entity.system.default'], + } + this.context.startAbility(wantInfo).then(() => { + console.log("startAbility successfully"); + }).catch((err) => { + console.log("startAbility err: " + JSON.stringify(err)); + }) } appAccountManager.authenticate("LiSi", "com.example.accountjsdemo", "getSocialData", {}, { @@ -4526,10 +4564,13 @@ Enumerates the constants. | KEY_REQUIRED_LABELS9+ | "requiredLabels" | Required labels. | | KEY_BOOLEAN_RESULT9+ | "booleanResult" | Return value of the Boolean type. | -## ResultCode8+ +## ResultCode(deprecated) Enumerates the result codes. +> **NOTE**
+> This enum is supported since API version 8 and deprecated since API version 9. Error codes are used from API version 9. For details, see [Account Management Error Codes](../errorcodes/errorcode-account.md). + **System capability**: SystemCapability.Account.AppAccount | Name | Value | Description | @@ -4765,7 +4806,7 @@ Creates an app account implicitly based on the specified account owner. This API | Name | Type | Mandatory | Description | | ---------------- | --------------------- | ---- | --------------- | -| options | [CreateAccountImplicitlyOptions](#createaccountimplicitlyoptions9) | Yes | Options for implicitly creating the account. | +| options | [CreateAccountImplicitlyOptions](#createaccountimplicitlyoptions9) | Yes | Options for implicitly creating an account. | | callback | [AuthCallback](#authcallback9) | Yes | Authenticator callback invoked to return the result.| ### addAccountImplicitly(deprecated) @@ -4876,9 +4917,9 @@ Checks the account labels. This API uses an asynchronous callback to return the | labels | Array<string> | Yes | Labels to check. | | callback | [AuthCallback](#authcallback9) | Yes | Authenticator callback invoked to return the check result.| -### isAccountRemovable9+ +### checkAccountRemovable9+ -isAccountRemovable(name: string, callback: AuthCallback): void; +checkAccountRemovable(name: string, callback: AuthCallback): void; Checks whether an app account can be deleted. This API uses an asynchronous callback to return the result. @@ -4936,7 +4977,7 @@ Obtains the remote object of an authenticator. This API cannot be overloaded. callback.onResult(account_appAccount.ResultCode.SUCCESS, result); } - isAccountRemovable(name, callback) { + checkAccountRemovable(name, callback) { var result = {[account_appAccount.Constants.KEY_BOOLEAN_RESULT]: true}; callback.onResult(account_appAccount.ResultCode.SUCCESS, result); } diff --git a/en/application-dev/reference/apis/js-apis-application-ability.md b/en/application-dev/reference/apis/js-apis-application-ability.md deleted file mode 100644 index efba928564b2c9aa34e35b2af7485674ea99274d..0000000000000000000000000000000000000000 --- a/en/application-dev/reference/apis/js-apis-application-ability.md +++ /dev/null @@ -1,756 +0,0 @@ -# @ohos.application.Ability (Ability) - -The **Ability** module manages the ability lifecycle and context, such as creating and destroying an ability, and dumping client information. - -This module provides the following common ability-related functions: - -- [Caller](#caller): implements sending of sequenceable data to the target ability when an ability (caller ability) invokes the target ability (callee ability). -- [Callee](#callee): implements callbacks for registration and deregistration of caller notifications. - -> **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 of this module can be used only in the stage model. - -## Modules to Import - -```ts -import UIAbility from '@ohos.app.ability.UIAbility'; -``` - -## Attributes - -**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore - -| Name| Type| Readable| Writable| Description| -| -------- | -------- | -------- | -------- | -------- | -| context | [UIAbilityContext](js-apis-inner-application-uiAbilityContext.md) | Yes| No| Context of an ability.| -| launchWant | [Want](js-apis-app-ability-want.md) | Yes| No| Parameters for starting the ability.| -| lastRequestWant | [Want](js-apis-app-ability-want.md) | Yes| No| Parameters used when the ability was started last time.| -| callee | [Callee](#callee) | Yes| No| Object that invokes the stub service.| - -## Ability.onCreate - -onCreate(want: Want, param: AbilityConstant.LaunchParam): void; - -Called to initialize the service logic when an ability is created. - -**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore - -**Parameters** - - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | want | [Want](js-apis-app-ability-want.md) | Yes| Information related to this ability, including the ability name and bundle name.| - | param | AbilityConstant.LaunchParam | Yes| Parameters for starting the ability, and the reason for the last abnormal exit.| - -**Example** - - ```ts - export default class EntryAbility extends UIAbility { - onCreate(want, param) { - console.log('onCreate, want:' + want.abilityName); - } - } - ``` - - -## Ability.onWindowStageCreate - -onWindowStageCreate(windowStage: window.WindowStage): void - -Called when a **WindowStage** is created for this ability. - -**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore - -**Parameters** - - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | windowStage | [window.WindowStage](js-apis-window.md#windowstage9) | Yes| **WindowStage** information.| - -**Example** - - ```ts - class myAbility extends Ability { - onWindowStageCreate(windowStage) { - console.log('onWindowStageCreate'); - } - } - ``` - - -## Ability.onWindowStageDestroy - -onWindowStageDestroy(): void - -Called when the **WindowStage** is destroyed for this ability. - -**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore - -**Example** - - ```ts - class myAbility extends Ability { - onWindowStageDestroy() { - console.log('onWindowStageDestroy'); - } - } - ``` - - -## Ability.onWindowStageRestore - -onWindowStageRestore(windowStage: window.WindowStage): void - -Called when the **WindowStage** is restored during the migration of this ability, which is a multi-instance ability. - -**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore - -**Parameters** - - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | windowStage | [window.WindowStage](js-apis-window.md#windowstage9) | Yes| **WindowStage** information.| - -**Example** - - ```ts - class myAbility extends Ability { - onWindowStageRestore(windowStage) { - console.log('onWindowStageRestore'); - } - } - ``` - - -## Ability.onDestroy - -onDestroy(): void; - -Called when this ability is destroyed to clear resources. - -**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore - -**Example** - - ```ts - class myAbility extends Ability { - onDestroy() { - console.log('onDestroy'); - } - } - ``` - - -## Ability.onForeground - -onForeground(): void; - -Called when this ability is switched from the background to the foreground. - -**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore - -**Example** - - ```ts - class myAbility extends Ability { - onForeground() { - console.log('onForeground'); - } - } - ``` - - -## Ability.onBackground - -onBackground(): void; - -Called when this ability is switched from the foreground to the background. - -**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore - -**Example** - - ```ts - class myAbility extends Ability { - onBackground() { - console.log('onBackground'); - } - } - ``` - - -## Ability.onContinue - -onContinue(wantParam : {[key: string]: any}): AbilityConstant.OnContinueResult; - -Called to save data during the ability migration preparation process. - -**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore - -**Parameters** - - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | wantParam | {[key: string]: any} | Yes| **want** parameter.| - -**Return value** - - | Type| Description| - | -------- | -------- | - | AbilityConstant.OnContinueResult | Continuation result.| - -**Example** - - ```ts - import AbilityConstant from "@ohos.application.AbilityConstant" - class myAbility extends Ability { - onContinue(wantParams) { - console.log('onContinue'); - wantParams["myData"] = "my1234567"; - return AbilityConstant.OnContinueResult.AGREE; - } - } - ``` - - -## Ability.onNewWant - -onNewWant(want: Want, launchParams: AbilityConstant.LaunchParam): void; - -Called when a new Want is passed in and this UIAbility is started again. - -**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| want | [Want](js-apis-application-want.md) | Yes| Want information, such as the ability name and bundle name.| -| launchParams | AbilityConstant.LaunchParam | Yes| Reason for the ability startup and the last abnormal exit.| - -**Example** - - ```ts - class myAbility extends Ability { - onNewWant(want, launchParams) { - console.log('onNewWant, want:' + want.abilityName); - console.log('onNewWant, launchParams:' + JSON.stringify(launchParams)); - } - } - ``` - -## Ability.onConfigurationUpdated - -onConfigurationUpdated(config: Configuration): void; - -Called when the global configuration is updated. - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**Parameters** - - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | config | [Configuration](js-apis-application-configuration.md) | Yes| Callback invoked when the global configuration is updated. The global configuration indicates the configuration of the environment where the application is running and includes the language and color mode.| - -**Example** - - ```ts - class myAbility extends Ability { - onConfigurationUpdated(config) { - console.log('onConfigurationUpdated, language:' + config.language); - } - } - ``` - -## Ability.dump - -dump(params: Array\): Array\; - -Dumps client information. - -**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore - -**Parameters** - - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | params | Array\ | Yes| Parameters in the form of a command.| - -**Example** - - ```ts - class myAbility extends Ability { - dump(params) { - console.log('dump, params:' + JSON.stringify(params)); - return ["params"] - } - } - ``` - -## Ability.onMemoryLevel - -onMemoryLevel(level: AbilityConstant.MemoryLevel): void; - -Called when the system has decided to adjust the memory level. For example, this API can be used when there is not enough memory to run as many background processes as possible. - -**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore - -**Parameters** - - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | level | [AbilityConstant.MemoryLevel](js-apis-application-abilityConstant.md#abilityconstantmemorylevel) | Yes| Memory level that indicates the memory usage status. When the specified memory level is reached, a callback will be invoked and the system will start adjustment.| - -**Example** - - ```ts - class myAbility extends Ability { - onMemoryLevel(level) { - console.log('onMemoryLevel, level:' + JSON.stringify(level)); - } - } - ``` - -## Ability.onSaveState - -onSaveState(reason: AbilityConstant.StateType, wantParam : {[key: string]: any}): AbilityConstant.OnSaveResult; - -Called when the framework automatically saves the ability state in the case of an application fault. This API is used together with [appRecovery](js-apis-app-ability-appRecovery.md). - -**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore - -**Parameters** - - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | reason | [AbilityConstant.StateType](js-apis-application-abilityConstant.md#abilityconstantstatetype) | Yes| Reason for triggering the callback to save the ability state.| - | wantParam | {[key: string]: any} | Yes| **want** parameter.| - -**Return value** - - | Type| Description| - | -------- | -------- | - | AbilityConstant.OnSaveResult | Whether the ability state is saved.| - -**Example** - - ```ts -import AbilityConstant from '@ohos.application.AbilityConstant' - -class myAbility extends Ability { - onSaveState(reason, wantParam) { - console.log('onSaveState'); - wantParam["myData"] = "my1234567"; - return AbilityConstant.OnSaveResult.RECOVERY_AGREE; - } -} - ``` - - - -## Caller - -Implements sending of sequenceable data to the target ability when an ability (caller ability) invokes the target ability (callee ability). - -## Caller.call - -call(method: string, data: rpc.Sequenceable): Promise<void>; - -Sends sequenceable data to the target ability. - -**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore - -**Parameters** - - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | method | string | Yes| Notification message string negotiated between the two abilities. The message is used to instruct the callee to register a function to receive the sequenceable data.| - | data | rpc.Sequenceable | Yes| Sequenceable data. You need to customize the data.| - -**Return value** - - | Type| Description| - | -------- | -------- | - | Promise<void> | Promise used to return a response.| - -**Error codes** - -| ID| Error Message| -| ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | -| 16200001 | Caller released. The caller has been released. | -| 16200002 | Callee invalid. The callee does not exist. | -| 16000050 | Internal Error. | - -**Example** - - ```ts - import UIAbility from '@ohos.app.ability.UIAbility'; - - class MyMessageAble{ // Custom sequenceable data structure. - name:"" - str:"" - num: 1 - constructor(name, str) { - this.name = name; - this.str = str; - } - marshalling(messageParcel) { - messageParcel.writeInt(this.num); - messageParcel.writeString(this.str); - console.log('MyMessageAble marshalling num[' + this.num + '] str[' + this.str + ']'); - return true; - } - unmarshalling(messageParcel) { - this.num = messageParcel.readInt(); - this.str = messageParcel.readString(); - console.log('MyMessageAble unmarshalling num[' + this.num + '] str[' + this.str + ']'); - return true; - } - }; - var method = 'call_Function'; // Notification message string negotiated by the two abilities - var caller; - export default class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage) { - this.context.startAbilityByCall({ - bundleName: "com.example.myservice", - abilityName: "EntryAbility", - deviceId: "" - }).then((obj) => { - caller = obj; - let msg = new MyMessageAble("msg", "world"); // See the definition of Sequenceable. - caller.call(method, msg) - .then(() => { - console.log('Caller call() called'); - }) - .catch((callErr) => { - console.log('Caller.call catch error, error.code: ' + JSON.stringify(callErr.code) + - ' error.message: ' + JSON.stringify(callErr.message)); - }); - }).catch((err) => { - console.log('Caller GetCaller error, error.code: ' + JSON.stringify(err.code) + - ' error.message: ' + JSON.stringify(err.message)); - }); - } - } - ``` - - -## Caller.callWithResult - -callWithResult(method: string, data: rpc.Sequenceable): Promise<rpc.MessageParcel>; - -Sends sequenceable data to the target ability and obtains the sequenceable data returned by the target ability. - -**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore - -**Parameters** - - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | method | string | Yes| Notification message string negotiated between the two abilities. The message is used to instruct the callee to register a function to receive the sequenceable data.| - | data | rpc.Sequenceable | Yes| Sequenceable data. You need to customize the data.| - -**Return value** - - | Type| Description| - | -------- | -------- | - | Promise<rpc.MessageParcel> | Promise used to return the sequenceable data from the target ability.| - -**Error codes** - -| ID| Error Message| -| ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | -| 16200001 | Caller released. The caller has been released. | -| 16200002 | Callee invalid. The callee does not exist. | -| 16000050 | Internal Error. | - -**Example** - - ```ts - import UIAbility from '@ohos.app.ability.UIAbility'; - - class MyMessageAble{ - name:"" - str:"" - num: 1 - constructor(name, str) { - this.name = name; - this.str = str; - } - marshalling(messageParcel) { - messageParcel.writeInt(this.num); - messageParcel.writeString(this.str); - console.log('MyMessageAble marshalling num[' + this.num + '] str[' + this.str + ']'); - return true; - } - unmarshalling(messageParcel) { - this.num = messageParcel.readInt(); - this.str = messageParcel.readString(); - console.log('MyMessageAble unmarshalling num[' + this.num + '] str[' + this.str + ']'); - return true; - } - }; - var method = 'call_Function'; - var caller; - export default class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage) { - this.context.startAbilityByCall({ - bundleName: "com.example.myservice", - abilityName: "EntryAbility", - deviceId: "" - }).then((obj) => { - caller = obj; - let msg = new MyMessageAble(1, "world"); - caller.callWithResult(method, msg) - .then((data) => { - console.log('Caller callWithResult() called'); - let retmsg = new MyMessageAble(0, ""); - data.readSequenceable(retmsg); - }) - .catch((callErr) => { - console.log('Caller.callWithResult catch error, error.code: ' + JSON.stringify(callErr.code) + - ' error.message: ' + JSON.stringify(callErr.message)); - }); - }).catch((err) => { - console.log('Caller GetCaller error, error.code: ' + JSON.stringify(err.code) + - ' error.message: ' + JSON.stringify(err.message)); - }); - } - } - ``` - - -## Caller.release - -release(): void; - -Releases the caller interface of the target ability. - -**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore - -**Error codes** - -| ID| Error Message| -| ------- | -------------------------------- | -| 401 | Invalid input parameter. | -| 16200001 | Caller released. The caller has been released. | -| 16200002 | Callee invalid. The callee does not exist. | -| 16000050 | Internal Error. | - -**Example** - - - ```ts - import UIAbility from '@ohos.app.ability.UIAbility'; - - var caller; - - export default class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage) { - this.context.startAbilityByCall({ - bundleName: "com.example.myservice", - abilityName: "EntryAbility", - deviceId: "" - }).then((obj) => { - caller = obj; - try { - caller.release(); - } catch (releaseErr) { - console.log('Caller.release catch error, error.code: ' + JSON.stringify(releaseErr.code) + - ' error.message: ' + JSON.stringify(releaseErr.message)); - } - }).catch((err) => { - console.log('Caller GetCaller error, error.code: ' + JSON.stringify(err.code) + - ' error.message: ' + JSON.stringify(err.message)); - }); - } - } - ``` - -## Caller.onRelease - - onRelease(callback: OnReleaseCallBack): void; - -Registers a callback that is invoked when the stub on the target ability is disconnected. - -**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore - -**Parameters** - - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | callback | OnReleaseCallBack | Yes| Callback used for the **onRelease** API.| - -**Example** - - ```ts - import UIAbility from '@ohos.app.ability.UIAbility'; - - var caller; - - export default class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage) { - this.context.startAbilityByCall({ - bundleName: "com.example.myservice", - abilityName: "EntryAbility", - deviceId: "" - }).then((obj) => { - caller = obj; - try { - caller.onRelease((str) => { - console.log(' Caller OnRelease CallBack is called ' + str); - }); - } catch (error) { - console.log('Caller.on catch error, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); - } - }).catch((err) => { - console.log('Caller GetCaller error, error.code: ' + JSON.stringify(err.code) + - ' error.message: ' + JSON.stringify(err.message)); - }); - } - } - ``` - - -## Callee - -Implements callbacks for caller notification registration and deregistration. - -## Callee.on - -on(method: string, callback: CalleeCallBack): void; - -Registers a caller notification callback, which is invoked when the target ability registers a function. - -**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore - -**Parameters** - - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | method | string | Yes| Notification message string negotiated between the two abilities.| - | callback | CalleeCallBack | Yes| JS notification synchronization callback of the **rpc.MessageParcel** type. The callback must return at least one empty **rpc.Sequenceable** object. Otherwise, the function execution fails.| - -**Error codes** - -| ID| Error Message| -| ------- | -------------------------------- | -| 401 | Invalid input parameter. | -| 16200004 | Method registered. The method has registered. | -| 16000050 | Internal Error. | - -**Example** - - ```ts - import UIAbility from '@ohos.app.ability.UIAbility'; - class MyMessageAble{ - name:"" - str:"" - num: 1 - constructor(name, str) { - this.name = name; - this.str = str; - } - marshalling(messageParcel) { - messageParcel.writeInt(this.num); - messageParcel.writeString(this.str); - console.log('MyMessageAble marshalling num[' + this.num + '] str[' + this.str + ']'); - return true; - } - unmarshalling(messageParcel) { - this.num = messageParcel.readInt(); - this.str = messageParcel.readString(); - console.log('MyMessageAble unmarshalling num[' + this.num + '] str[' + this.str + ']'); - return true; - } - }; - var method = 'call_Function'; - function funcCallBack(pdata) { - console.log('Callee funcCallBack is called ' + pdata); - let msg = new MyMessageAble("test", ""); - pdata.readSequenceable(msg); - return new MyMessageAble("test1", "Callee test"); - } - export default class EntryAbility extends UIAbility { - onCreate(want, launchParam) { - console.log('Callee onCreate is called'); - try { - this.callee.on(method, funcCallBack); - } catch (error) { - console.log('Callee.on catch error, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); - } - } - } - ``` - -## Callee.off - -off(method: string): void; - -Deregisters a caller notification callback, which is invoked when the target ability registers a function. - -**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore - -**Parameters** - - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | method | string | Yes| Registered notification message string.| - -**Error codes** - -| ID| Error Message| -| ------- | -------------------------------- | -| 401 | Invalid input parameter. | -| 16200005 | Method not registered. The method has not registered. | -| 16000050 | Internal Error. | - - -**Example** - - ```ts - import UIAbility from '@ohos.app.ability.UIAbility'; - - var method = 'call_Function'; - - export default class EntryAbility extends UIAbility { - onCreate(want, launchParam) { - console.log('Callee onCreate is called'); - try { - this.callee.off(method); - } catch (error) { - console.log('Callee.off catch error, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); - } - } - } - ``` - -## OnReleaseCallBack - -(msg: string): void; - -**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore - -| Name| Type| Readable| Writable| Description| -| -------- | -------- | -------- | -------- | -------- | -| (msg: string) | function | Yes| No| Prototype of the listener function registered by the caller.| - -## CalleeCallBack - -(indata: rpc.MessageParcel): rpc.Sequenceable; - -**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore - -| Name| Type| Readable| Writable| Description| -| -------- | -------- | -------- | -------- | -------- | -| (indata: rpc.MessageParcel) | rpc.Sequenceable | Yes| No| Prototype of the listener function registered by the callee.| diff --git a/en/application-dev/reference/apis/js-apis-application-abilityDelegatorRegistry.md b/en/application-dev/reference/apis/js-apis-application-abilityDelegatorRegistry.md index ae72afeca2e3214d00a785c0639793e8df47d715..d022dd0177356fbbcd1d81031f1b505d009136c6 100644 --- a/en/application-dev/reference/apis/js-apis-application-abilityDelegatorRegistry.md +++ b/en/application-dev/reference/apis/js-apis-application-abilityDelegatorRegistry.md @@ -1,10 +1,10 @@ # @ohos.application.abilityDelegatorRegistry (AbilityDelegatorRegistry) -The **AbilityDelegatorRegistry** module provides APIs for storing the global registers of the registered **AbilityDelegator** and **AbilityDelegatorArgs** objects. You can use the APIs to obtain the **AbilityDelegator** and **AbilityDelegatorArgs** objects of an application. +The **AbilityDelegatorRegistry** module provides APIs for storing the global registers of the registered **AbilityDelegator** and **AbilityDelegatorArgs** objects. You can use the APIs to obtain the **AbilityDelegator** and **AbilityDelegatorArgs** objects of an application. The APIs can be used only in the test framework. > **NOTE** > -> The APIs of this module are supported since API version 8 and deprecated since API version 9. You are advised to use [@ohos.app.ability.abilityDelegatorRegistry](js-apis-app-ability-abilityDelegatorRegistry.md) instead. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> The APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. ## Modules to Import @@ -43,7 +43,7 @@ Obtains the **AbilityDelegator** object of the application. **Example** ```ts -var abilityDelegator; +let abilityDelegator; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); ``` @@ -65,8 +65,8 @@ Obtains the **AbilityDelegatorArgs** object of the application. **Example** ```ts -var args = AbilityDelegatorRegistry.getArguments(); -console.info("getArguments bundleName:" + args.bundleName); -console.info("getArguments testCaseNames:" + args.testCaseNames); -console.info("getArguments testRunnerClassName:" + args.testRunnerClassName); +let args = AbilityDelegatorRegistry.getArguments(); +console.info('getArguments bundleName:' + args.bundleName); +console.info('getArguments testCaseNames:' + args.testCaseNames); +console.info('getArguments testRunnerClassName:' + args.testRunnerClassName); ``` diff --git a/en/application-dev/reference/apis/js-apis-application-abilityLifecycleCallback.md b/en/application-dev/reference/apis/js-apis-application-abilityLifecycleCallback.md deleted file mode 100644 index 040448220bb9da59779f0d449c43a59d8ab920bd..0000000000000000000000000000000000000000 --- a/en/application-dev/reference/apis/js-apis-application-abilityLifecycleCallback.md +++ /dev/null @@ -1,213 +0,0 @@ -# @ohos.application.AbilityLifecycleCallback (AbilityLifecycleCallback) - -The **AbilityLifecycleCallback** module provides callbacks, such as **onAbilityCreate**, **onWindowStageCreate**, and **onWindowStageDestroy**, to receive lifecycle state changes in the application context. These callbacks can be used as an input parameter of [registerAbilityLifecycleCallback](js-apis-inner-application-applicationContext.md#applicationcontextregisterabilitylifecyclecallback). - -> **NOTE** -> -> The APIs of this module are supported since API version 9 and are deprecated in versions later than API version 9. You are advised to use [@ohos.app.ability.AbilityLifecycleCallback](js-apis-app-ability-abilityLifecycleCallback.md) instead. Newly added APIs will be marked with a superscript to indicate their earliest API version. -> The APIs of this module can be used only in the stage model. - - -## Modules to Import - -```ts -import AbilityLifecycleCallback from "@ohos.application.AbilityLifecycleCallback"; -``` - - -## AbilityLifecycleCallback.onAbilityCreate - -onAbilityCreate(ability: Ability): void; - -Called when an ability is created. - -**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| ability | [Ability](js-apis-application-ability.md#Ability) | Yes| **Ability** object.| - - -## AbilityLifecycleCallback.onWindowStageCreate - -onWindowStageCreate(ability: Ability, windowStage: window.WindowStage): void; - -Called when the window stage of an ability is created. - -**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| ability | [Ability](js-apis-application-ability.md#Ability) | Yes| **Ability** object.| -| windowStage | [window.WindowStage](js-apis-window.md#windowstage9) | Yes| **WindowStage** object.| - - -## AbilityLifecycleCallback.onWindowStageActive - -onWindowStageActive(ability: Ability, windowStage: window.WindowStage): void; - -Called when the window stage of an ability gains focus. - -**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| ability | [Ability](js-apis-application-ability.md#Ability) | Yes| **Ability** object.| -| windowStage | [window.WindowStage](js-apis-window.md#windowstage9) | Yes| **WindowStage** object.| - - -## AbilityLifecycleCallback.onWindowStageInactive - -onWindowStageInactive(ability: Ability, windowStage: window.WindowStage): void; - -Called when the window stage of an ability loses focus. - -**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| ability | [Ability](js-apis-application-ability.md#Ability) | Yes| **Ability** object.| -| windowStage | [window.WindowStage](js-apis-window.md#windowstage9) | Yes| **WindowStage** object.| - - -## AbilityLifecycleCallback.onWindowStageDestroy - -onWindowStageDestroy(ability: Ability, windowStage: window.WindowStage): void; - -Called when the window stage of an ability is destroyed. - -**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| ability | [Ability](js-apis-application-ability.md#Ability) | Yes| **Ability** object.| -| windowStage | [window.WindowStage](js-apis-window.md#windowstage9) | Yes| **WindowStage** object.| - - -## AbilityLifecycleCallback.onAbilityDestroy - -onAbilityDestroy(ability: Ability): void; - -Called when an ability is destroyed. - -**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| ability | [Ability](js-apis-application-ability.md#Ability) | Yes| **Ability** object.| - - -## AbilityLifecycleCallback.onAbilityForeground - -onAbilityForeground(ability: Ability): void; - -Called when an ability is switched from the background to the foreground. - -**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| ability | [Ability](js-apis-application-ability.md#Ability) | Yes| **Ability** object.| - - -## AbilityLifecycleCallback.onAbilityBackground - -onAbilityBackground(ability: Ability): void; - -Called when an ability is switched from the foreground to the background. - -**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| ability | [Ability](js-apis-application-ability.md#Ability) | Yes| **Ability** object.| - - -## AbilityLifecycleCallback.onAbilityContinue - -onAbilityContinue(ability: Ability): void; - -Called when an ability is continued on another device. - -**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| ability | [Ability](js-apis-application-ability.md#Ability) | Yes| **Ability** object.| - -**Example** - -```ts -import AbilityStage from "@ohos.application.AbilityStage"; - -var lifecycleId; - -export default class MyAbilityStage extends AbilityStage { - onCreate() { - console.log("MyAbilityStage onCreate") - let AbilityLifecycleCallback = { - onAbilityCreate(ability) { - console.log("onAbilityCreate ability:" + JSON.stringify(ability)); - }, - onWindowStageCreate(ability, windowStage) { - console.log("onWindowStageCreate ability:" + JSON.stringify(ability)); - console.log("onWindowStageCreate windowStage:" + JSON.stringify(windowStage)); - }, - onWindowStageActive(ability, windowStage) { - console.log("onWindowStageActive ability:" + JSON.stringify(ability)); - console.log("onWindowStageActive windowStage:" + JSON.stringify(windowStage)); - }, - onWindowStageInactive(ability, windowStage) { - console.log("onWindowStageInactive ability:" + JSON.stringify(ability)); - console.log("onWindowStageInactive windowStage:" + JSON.stringify(windowStage)); - }, - onWindowStageDestroy(ability, windowStage) { - console.log("onWindowStageDestroy ability:" + JSON.stringify(ability)); - console.log("onWindowStageDestroy windowStage:" + JSON.stringify(windowStage)); - }, - onAbilityDestroy(ability) { - console.log("onAbilityDestroy ability:" + JSON.stringify(ability)); - }, - onAbilityForeground(ability) { - console.log("onAbilityForeground ability:" + JSON.stringify(ability)); - }, - onAbilityBackground(ability) { - console.log("onAbilityBackground ability:" + JSON.stringify(ability)); - }, - onAbilityContinue(ability) { - console.log("onAbilityContinue ability:" + JSON.stringify(ability)); - } - } - // 1. Obtain applicationContext through the context attribute. - let applicationContext = this.context.getApplicationContext(); - // 2. Use applicationContext to register a listener for the ability lifecycle in the application. - lifecycleId = applicationContext.registerAbilityLifecycleCallback(AbilityLifecycleCallback); - console.log("registerAbilityLifecycleCallback number: " + JSON.stringify(lifecycleId)); - } - - onDestroy() { - let applicationContext = this.context.getApplicationContext(); - applicationContext.unregisterAbilityLifecycleCallback(lifecycleId, (error, data) => { - console.log("unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error)); - }); - } -} -``` diff --git a/en/application-dev/reference/apis/js-apis-application-abilityManager.md b/en/application-dev/reference/apis/js-apis-application-abilityManager.md index e509a1b5d13a2d0d20b8d6dee4efee9487c5ee92..677884b754c5896b1a6af853d8a4df54355bbb85 100644 --- a/en/application-dev/reference/apis/js-apis-application-abilityManager.md +++ b/en/application-dev/reference/apis/js-apis-application-abilityManager.md @@ -4,13 +4,13 @@ The **AbilityManager** module provides APIs for obtaining, adding, and modifying > **NOTE** > -> The APIs of this module are supported since API version 8 and deprecated since API version 9. You are advised to use [@ohos.app.ability.abilityManager](js-apis-app-ability-abilityManager.md) instead. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> The APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The APIs of this module are system APIs and cannot be called by third-party applications. ## Modules to Import ```ts -import abilityManager from '@ohos.application.abilityManager' +import AbilityManager from '@ohos.application.abilityManager'; ``` ## AbilityState @@ -38,7 +38,7 @@ Updates the configuration. This API uses an asynchronous callback to return the **Permission required**: ohos.permission.UPDATE_CONFIGURATION **System capability**: SystemCapability.Ability.AbilityRuntime.Core - + **Parameters** | Name | Type | Mandatory | Description | @@ -49,11 +49,13 @@ Updates the configuration. This API uses an asynchronous callback to return the **Example** ```ts -var config = { +import abilitymanager from '@ohos.application.abilityManager'; + +let config = { language: 'chinese' -} +}; -abilityManager.updateConfiguration(config, () => { +abilitymanager.updateConfiguration(config, () => { console.log('------------ updateConfiguration -----------'); }) ``` @@ -83,11 +85,13 @@ Updates the configuration. This API uses a promise to return the result. **Example** ```ts -var config = { +import abilitymanager from '@ohos.application.abilityManager'; + +let config = { language: 'chinese' -} +}; -abilityManager.updateConfiguration(config).then(() => { +abilitymanager.updateConfiguration(config).then(() => { console.log('updateConfiguration success'); }).catch((err) => { console.log('updateConfiguration fail'); @@ -113,7 +117,9 @@ Obtains the ability running information. This API uses an asynchronous callback **Example** ```ts -abilityManager.getAbilityRunningInfos((err,data) => { +import abilitymanager from '@ohos.application.abilityManager'; + +abilitymanager.getAbilityRunningInfos((err,data) => { console.log("getAbilityRunningInfos err: " + err + " data: " + JSON.stringify(data)); }); ``` @@ -137,116 +143,11 @@ Obtains the ability running information. This API uses a promise to return the r **Example** ```ts -abilityManager.getAbilityRunningInfos().then((data) => { - console.log("getAbilityRunningInfos data: " + JSON.stringify(data)) -}).catch((err) => { - console.log("getAbilityRunningInfos err: " + err) -}); -``` - -## getExtensionRunningInfos9+ - -getExtensionRunningInfos(upperLimit: number, callback: AsyncCallback\>): void - -Obtains the extension running information. This API uses an asynchronous callback to return the result. - -**Required permissions**: ohos.permission.GET_RUNNING_INFO - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**Parameters** - -| Name | Type | Mandatory | Description | -| --------- | ---------------------------------------- | ---- | -------------- | -| upperLimit | number | Yes| Maximum number of messages that can be obtained.| -| callback | AsyncCallback\> | Yes | Callback used to return the result. | - -**Example** - -```ts -var upperLimit = 0; - -abilityManager.getExtensionRunningInfos(upperLimit, (err,data) => { - console.log("getExtensionRunningInfos err: " + err + " data: " + JSON.stringify(data)); -}); -``` - -## getExtensionRunningInfos9+ - -getExtensionRunningInfos(upperLimit: number): Promise\> - -Obtains the extension running information. This API uses a promise to return the result. +import abilitymanager from '@ohos.application.abilityManager'; -**Required permissions**: ohos.permission.GET_RUNNING_INFO - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**Parameters** - -| Name | Type | Mandatory | Description | -| --------- | ---------------------------------------- | ---- | -------------- | -| upperLimit | number | Yes| Maximum number of messages that can be obtained.| - -**Return value** - -| Type | Description | -| ---------------------------------------- | ------- | -| Promise\> | Promise used to return the result.| - -**Example** - -```ts -var upperLimit = 0; - -abilityManager.getExtensionRunningInfos(upperLimit).then((data) => { - console.log("getAbilityRunningInfos data: " + JSON.stringify(data)); +abilitymanager.getAbilityRunningInfos().then((data) => { + console.log("getAbilityRunningInfos data: " + JSON.stringify(data)); }).catch((err) => { console.log("getAbilityRunningInfos err: " + err); -}) -``` - -## getTopAbility9+ - -getTopAbility(callback: AsyncCallback\): void; - -Obtains the top ability, which is the ability that has the window focus. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**Parameters** - -| Name | Type | Mandatory | Description | -| --------- | ---------------------------------------- | ---- | -------------- | -| callback | AsyncCallback\<[ElementName](js-apis-bundleManager-elementName.md)> | Yes | Callback used to return the result. | - -**Example** - -```ts -abilityManager.getTopAbility((err,data) => { - console.log("getTopAbility err: " + err + " data: " + JSON.stringify(data)); }); ``` - -## getTopAbility9+ - -getTopAbility(): Promise\; - -Obtains the top ability, which is the ability that has the window focus. This API uses a promise to return the result. - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**Return value** - -| Type | Description | -| ---------------------------------------- | ------- | -| Promise\<[ElementName](js-apis-bundleManager-elementName.md)>| Promise used to return the result.| - -**Example** - -```ts -abilityManager.getTopAbility().then((data) => { - console.log("getTopAbility data: " + JSON.stringify(data)); -}).catch((err) => { - console.log("getTopAbility err: " + err); -}) -``` diff --git a/en/application-dev/reference/apis/js-apis-application-abilityMonitor.md b/en/application-dev/reference/apis/js-apis-application-abilityMonitor.md index 33feda3afdd757e91ed7b7f682dca1ef597a7847..e857972a4d075fa6161a082fd46e8f308aff9464 100644 --- a/en/application-dev/reference/apis/js-apis-application-abilityMonitor.md +++ b/en/application-dev/reference/apis/js-apis-application-abilityMonitor.md @@ -3,25 +3,25 @@ The **AbilityMonitor** module provides monitors for abilities that meet specified conditions. The latest matched abilities are stored in an **AbilityMonitor** object. > **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 of this module are supported and deprecated since API version 9. You are advised to use [abilityMonitor (AbilityMonitor)](js-apis-inner-application-abilityMonitor.md) instead. ## Usage -The ability monitor is set by calling **addAbilityMonitor** in **abilityDelegator**. +The ability monitor can be set by calling **addAbilityMonitor** in **abilityDelegator**. ```js -import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' -var abilityDelegator; +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'; +let abilityDelegator; function onAbilityCreateCallback(data) { console.info("onAbilityCreateCallback"); } -var monitor = { +let monitor = { abilityName: "abilityname", onAbilityCreate: onAbilityCreateCallback -} +}; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.addAbilityMonitor(monitor, (err : any) => { @@ -37,11 +37,13 @@ Describes an ability monitor. | Name | Type | Readable| Writable| Description | | ------------------------------------------------------------ | -------- | ---- | ---- | ------------------------------------------------------------ | -| abilityName | string | Yes | Yes | Name of the ability bound to the ability monitor. | -| onAbilityCreate?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes | Yes | Called when the ability is created.
If this attribute is not set, the corresponding lifecycle callback cannot be received. | -| onAbilityForeground?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes | Yes | Called when the ability starts to run in the foreground.
If this attribute is not set, the corresponding lifecycle callback cannot be received. | -| onAbilityBackground?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes | Yes | Called when the ability starts to run in the background.
If this attribute is not set, the corresponding lifecycle callback cannot be received. | -| onAbilityDestroy?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes | Yes | Called when the ability is destroyed.
If this attribute is not set, the corresponding lifecycle callback cannot be received. | -| onWindowStageCreate?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes | Yes | Called when the window stage is created.
If this attribute is not set, the corresponding lifecycle callback cannot be received. | -| onWindowStageRestore?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes | Yes | Called when the window stage is restored.
If this attribute is not set, the corresponding lifecycle callback cannot be received. | -| onWindowStageDestroy?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes | Yes | Called when the window stage is destroyed.
If this attribute is not set, the corresponding lifecycle callback cannot be received. | +| abilityName | string | Yes | Yes | Name of the ability bound to the ability monitor.| +| moduleName? | string | Yes | Yes | Name of the module bound to the ability monitor.| +| onAbilityCreate?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes | Yes | Called when the ability is created.
If this attribute is not set, the corresponding lifecycle callback cannot be received.| +| onAbilityForeground?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes | Yes | Called when the ability starts to run in the foreground.
If this attribute is not set, the corresponding lifecycle callback cannot be received.| +| onAbilityBackground?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes | Yes | Called when the ability starts to run in the background.
If this attribute is not set, the corresponding lifecycle callback cannot be received.| +| onAbilityDestroy?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes | Yes | Called when the ability is destroyed.
If this attribute is not set, the corresponding lifecycle callback cannot be received.
| +| onWindowStageCreate?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes | Yes | Called when the window stage is created.
If this attribute is not set, the corresponding lifecycle callback cannot be received.
| +| onWindowStageRestore?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes | Yes | Called when the window stage is restored.
If this attribute is not set, the corresponding lifecycle callback cannot be received.
| +| onWindowStageDestroy?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes | Yes | Called when the window stage is destroyed.
If this attribute is not set, the corresponding lifecycle callback cannot be received.
| + diff --git a/en/application-dev/reference/apis/js-apis-application-accessibilityExtensionAbility.md b/en/application-dev/reference/apis/js-apis-application-accessibilityExtensionAbility.md index a3bf30002a2377ca6deb995a5bb3c120b59f7991..e9327b99666d40cb367e54ec351048af3d384cd3 100644 --- a/en/application-dev/reference/apis/js-apis-application-accessibilityExtensionAbility.md +++ b/en/application-dev/reference/apis/js-apis-application-accessibilityExtensionAbility.md @@ -9,7 +9,7 @@ The **AccessibilityExtensionAbility** module provides accessibility extension ca ## Modules to Import ```ts -import AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtensionAbility' +import AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtensionAbility'; ``` ## Attributes @@ -137,7 +137,7 @@ Called when an event that matches the specified bundle and event type occurs. In class MyAccessibilityExtensionAbility extends AccessibilityExtensionAbility { onAccessibilityEvent(event) { console.log('AxExtensionAbility onAccessibilityEvent'); - if (event.eventType == 'click') { + if (event.eventType === 'click') { console.log('AxExtensionAbility onAccessibilityEvent: click'); } } @@ -164,7 +164,7 @@ Called when a physical key is pressed. In this API, you can determine whether to class MyAccessibilityExtensionAbility extends AccessibilityExtensionAbility { onKeyEvent(keyEvent) { console.log('AxExtensionAbility onKeyEvent'); - if (keyEvent.keyCode == 22) { + if (keyEvent.keyCode === 22) { console.log('AxExtensionAbility onKeyEvent: intercept 22'); return true; } diff --git a/en/application-dev/reference/apis/js-apis-application-appManager.md b/en/application-dev/reference/apis/js-apis-application-appManager.md index 8e8547985ddc883c7643eab6f3f3e25412eebf4a..5c42a550ea14ed421d195772ee2f143265d7ef8d 100644 --- a/en/application-dev/reference/apis/js-apis-application-appManager.md +++ b/en/application-dev/reference/apis/js-apis-application-appManager.md @@ -22,9 +22,9 @@ Checks whether this application is undergoing a stability test. This API uses an **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<boolean> | Yes| Callback used to return the result. If the application is undergoing a stability test, **true** will be returned; otherwise, **false** will be returned.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback<boolean> | Yes| Callback used to return the result. If the application is undergoing a stability test, **true** will be returned; otherwise, **false** will be returned.| **Example** @@ -46,9 +46,9 @@ Checks whether this application is undergoing a stability test. This API uses a **Return value** -| Type| Description| -| -------- | -------- | -| Promise<boolean> | Promise used to return the result. If the application is undergoing a stability test, **true** will be returned; otherwise, **false** will be returned.| + | Type| Description| + | -------- | -------- | + | Promise<boolean> | Promise used to return the result. If the application is undergoing a stability test, **true** will be returned; otherwise, **false** will be returned.| **Example** @@ -72,9 +72,9 @@ Checks whether this application is running on a RAM constrained device. This API **Return value** -| Type| Description| -| -------- | -------- | -| Promise<boolean> | Promise used to return whether the application is running on a RAM constrained device. If the application is running on a RAM constrained device, **true** will be returned; otherwise, **false** will be returned.| + | Type| Description| + | -------- | -------- | + | Promise<boolean> | Promise used to return whether the application is running on a RAM constrained device. If the application is running on a RAM constrained device, **true** will be returned; otherwise, **false** will be returned.| **Example** @@ -96,9 +96,9 @@ Checks whether this application is running on a RAM constrained device. This API **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<boolean> | Yes| Callback used to return whether the application is running on a RAM constrained device. If the application is running on a RAM constrained device, **true** will be returned; otherwise, **false** will be returned.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback<boolean> | Yes| Callback used to return whether the application is running on a RAM constrained device. If the application is running on a RAM constrained device, **true** will be returned; otherwise, **false** will be returned.| **Example** @@ -119,9 +119,9 @@ Obtains the memory size of this application. This API uses a promise to return t **Return value** -| Type| Description| -| -------- | -------- | -| Promise<number> | Promise used to return the memory size, in MB.| + | Type| Description| + | -------- | -------- | + | Promise<number> | Promise used to return the memory size, in MB.| **Example** @@ -143,9 +143,9 @@ Obtains the memory size of this application. This API uses an asynchronous callb **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<number> | Yes| Callback used to return the memory size, in MB.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback<number> | Yes| Callback used to return the memory size, in MB.| **Example** @@ -199,7 +199,7 @@ Obtains information about the running processes. This API uses an asynchronous c | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| callback | AsyncCallback\> | Yes| Obtains information about the running processes. This API uses a promise to return the result.| +| callback | AsyncCallback\> | Yes| Callback used to return the running processes. | **Example** diff --git a/en/application-dev/reference/apis/js-apis-application-configuration.md b/en/application-dev/reference/apis/js-apis-application-configuration.md index 81870036a845c61f852f671616f63c12f92851b8..0d7b8756ca0bc611d2c5c92bfb12c5764b8e9569 100644 --- a/en/application-dev/reference/apis/js-apis-application-configuration.md +++ b/en/application-dev/reference/apis/js-apis-application-configuration.md @@ -1,38 +1,27 @@ # @ohos.application.Configuration (Configuration) -The **Configuration** module defines environment change information. +The **Configuration** module defines environment change information. **Configuration** is an interface definition and is used only for field declaration. > **NOTE** > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. > This module is deprecated since API version 9. You are advised to use [@ohos.app.ability.Configuration](js-apis-app-ability-configuration.md) instead. -## Modules to Import - -```ts -import Configuration from '@ohos.application.Configuration' -``` - **System capability**: SystemCapability.Ability.AbilityBase | Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | -| language8+ | string | Yes| Yes| Language of the application, for example, **zh**.| +| language8+ | string | Yes| Yes| Language of the application.| | colorMode8+ | [ColorMode](js-apis-application-configurationConstant.md#configurationconstantcolormode) | Yes| Yes| Color mode, which can be **COLOR_MODE_LIGHT** or **COLOR_MODE_DARK**. The default value is **COLOR_MODE_LIGHT**.| -| direction9+ | [Direction](js-apis-application-configurationConstant.md#configurationconstantdirection9) | Yes| No| Screen orientation, which can be **DIRECTION_HORIZONTAL** or **DIRECTION_VERTICAL**.| -| screenDensity9+ | [ScreenDensity](js-apis-application-configurationConstant.md#configurationconstantscreendensity9) | Yes| No| Screen resolution, which can be **SCREEN_DENSITY_SDPI** (120), **SCREEN_DENSITY_MDPI** (160), **SCREEN_DENSITY_LDPI** (240), **SCREEN_DENSITY_XLDPI** (320), **SCREEN_DENSITY_XXLDPI** (480), or **SCREEN_DENSITY_XXXLDPI** (640).| -| displayId9+ | number | Yes| No| ID of the display where the application is located.| -| hasPointerDevice9+ | boolean | Yes| No| Whether a pointer device, such as a keyboard, mouse, or touchpad, is connected.| For details about the fields, see the **ohos.application.Configuration.d.ts** file. **Example** ```ts -import hilog from '@ohos.hilog'; -import UIAbility from '@ohos.app.ability.UIAbility'; -import Window from '@ohos.window'; +import Ability from '@ohos.application.Ability' +import Window from '@ohos.window' -export default class EntryAbility extends UIAbility { +export default class MainAbility extends Ability { onCreate(want, launchParam) { } @@ -42,13 +31,9 @@ export default class EntryAbility extends UIAbility { onWindowStageCreate(windowStage: Window.WindowStage) { let envCallback = { onConfigurationUpdated(config) { - console.info(`envCallback onConfigurationUpdated success: ${JSON.stringify(config)}`) + console.info(`envCallback onConfigurationUpdated success: ${JSON.stringify(config)}`); let language = config.language; let colorMode = config.colorMode; - let direction = config.direction; - let screenDensity = config.screenDensity; - let displayId = config.displayId; - let hasPointerDevice = config.hasPointerDevice; } }; @@ -57,12 +42,10 @@ export default class EntryAbility extends UIAbility { windowStage.loadContent('pages/index', (err, data) => { if (err.code) { - hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.ERROR); - hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + console.error('failed to load the content, error: + ${JSON.stringify(err)}'); return; } - hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); - hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); + console.info('Succeeded in loading the content, data: + ${JSON.stringify(data)}'); }); } } diff --git a/en/application-dev/reference/apis/js-apis-application-configurationConstant.md b/en/application-dev/reference/apis/js-apis-application-configurationConstant.md index dabe32b2f9d166dbce68b94c204b82f78b0090de..b1017a036bdb9f02a656c1890310cd3e029337f5 100644 --- a/en/application-dev/reference/apis/js-apis-application-configurationConstant.md +++ b/en/application-dev/reference/apis/js-apis-application-configurationConstant.md @@ -23,33 +23,3 @@ You can obtain the value of this constant by calling the **ConfigurationConstant | COLOR_MODE_NOT_SET | -1 | Unspecified color mode.| | COLOR_MODE_DARK | 0 | Dark mode.| | COLOR_MODE_LIGHT | 1 | Light mode.| - - -## ConfigurationConstant.Direction9+ - -You can obtain the value of this constant by calling the **ConfigurationConstant.Direction** API. - -**System capability**: SystemCapability.Ability.AbilityBase - -| Name| Value| Description| -| -------- | -------- | -------- | -| DIRECTION_NOT_SET | -1 | Unspecified direction.| -| DIRECTION_VERTICAL | 0 | Vertical direction.| -| DIRECTION_HORIZONTAL | 1 | Horizontal direction.| - - -## ConfigurationConstant.ScreenDensity9+ - -You can obtain the value of this constant by calling the **ConfigurationConstant.ScreenDensity** API. - -**System capability**: SystemCapability.Ability.AbilityBase - -| Name| Value| Description| -| -------- | -------- | -------- | -| SCREEN_DENSITY_NOT_SET | 0 | Unspecified screen resolution.| -| SCREEN_DENSITY_SDPI | 120 | The screen resolution is sdpi.| -| SCREEN_DENSITY_MDPI | 160 | The screen resolution is mdpi.| -| SCREEN_DENSITY_LDPI | 240 | The screen resolution is ldpi.| -| SCREEN_DENSITY_XLDPI | 320 | The screen resolution is xldpi.| -| SCREEN_DENSITY_XXLDPI | 480 | The screen resolution is xxldpi.| -| SCREEN_DENSITY_XXXLDPI | 640 | The screen resolution is xxxldpi.| diff --git a/en/application-dev/reference/apis/js-apis-application-dataShareExtensionAbility.md b/en/application-dev/reference/apis/js-apis-application-dataShareExtensionAbility.md index 2b868190b0b901638830d8051a2d973188c43d41..822b524809931cae4853d069606c77b1a1e5af26 100644 --- a/en/application-dev/reference/apis/js-apis-application-dataShareExtensionAbility.md +++ b/en/application-dev/reference/apis/js-apis-application-dataShareExtensionAbility.md @@ -14,7 +14,7 @@ The **DataShareExtensionAbility** module provides data share services based on t ## Modules to Import ```ts -import DataShareExtensionAbility from '@ohos.application.DataShareExtensionAbility' +import DataShareExtensionAbility from '@ohos.application.DataShareExtensionAbility'; ``` ## URI Naming Rule @@ -43,7 +43,7 @@ Example: | Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | -| context | [ExtensionContext](js-apis-inner-application-extensionContext.md) | Yes| No|Context of the DataShare Extension ability.| +| context | [ExtensionContext](js-apis-inner-application-extensionContext.md) | Yes| No|Context of the DataShare Extension ability.| ## onCreate @@ -65,11 +65,11 @@ Called by the server to initialize service logic when the DataShare client conne ```ts import rdb from '@ohos.data.relationalStore'; -let DB_NAME = "DB00.db"; -let TBL_NAME = "TBL00"; -let DDL_TBL_CREATE = "CREATE TABLE IF NOT EXISTS " +let DB_NAME = 'DB00.db'; +let TBL_NAME = 'TBL00'; +let DDL_TBL_CREATE = 'CREATE TABLE IF NOT EXISTS ' + TBL_NAME - + " (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, age INTEGER, phoneNumber DOUBLE, isStudent BOOLEAN, Binary BINARY)"; + + ' (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, age INTEGER, phoneNumber DOUBLE, isStudent BOOLEAN, Binary BINARY)'; let rdbStore; export default class DataShareExtAbility extends DataShareExtensionAbility { @@ -112,22 +112,22 @@ Inserts data into the database. This API can be overridden as required. ```ts import rdb from '@ohos.data.relationalStore'; -let DB_NAME = "DB00.db"; -let TBL_NAME = "TBL00"; -let DDL_TBL_CREATE = "CREATE TABLE IF NOT EXISTS " +let DB_NAME = 'DB00.db'; +let TBL_NAME = 'TBL00'; +let DDL_TBL_CREATE = 'CREATE TABLE IF NOT EXISTS ' + TBL_NAME - + " (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, age INTEGER, phoneNumber DOUBLE, isStudent BOOLEAN, Binary BINARY)"; + + ' (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, age INTEGER, phoneNumber DOUBLE, isStudent BOOLEAN, Binary BINARY)'; let rdbStore; export default class DataShareExtAbility extends DataShareExtensionAbility { insert(uri, valueBucket, callback) { - if (valueBucket == null) { + if (valueBucket === null) { console.info('invalid valueBuckets'); return; } rdbStore.insert(TBL_NAME, valueBucket, function (err, ret) { console.info('callback ret:' + ret); - if (callback != undefined) { + if (callback !== undefined) { callback(err, ret); } }); @@ -157,20 +157,20 @@ Updates data in the database. This API can be overridden as required. ```ts import rdb from '@ohos.data.relationalStore'; -let DB_NAME = "DB00.db"; -let TBL_NAME = "TBL00"; -let DDL_TBL_CREATE = "CREATE TABLE IF NOT EXISTS " +let DB_NAME = 'DB00.db'; +let TBL_NAME = 'TBL00'; +let DDL_TBL_CREATE = 'CREATE TABLE IF NOT EXISTS ' + TBL_NAME - + " (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, age INTEGER, phoneNumber DOUBLE, isStudent BOOLEAN, Binary BINARY)"; + + ' (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, age INTEGER, phoneNumber DOUBLE, isStudent BOOLEAN, Binary BINARY)'; let rdbStore; export default class DataShareExtAbility extends DataShareExtensionAbility { update(uri, predicates, valueBucket, callback) { - if (predicates == null || predicates == undefined) { + if (predicates === null || predicates === undefined) { return; } rdbStore.update(TBL_NAME, valueBucket, predicates, function (err, ret) { - if (callback != undefined) { + if (callback !== undefined) { callback(err, ret); } }); @@ -199,20 +199,20 @@ Deletes data from the database. This API can be overridden as required. ```ts import rdb from '@ohos.data.relationalStore'; -let DB_NAME = "DB00.db"; -let TBL_NAME = "TBL00"; -let DDL_TBL_CREATE = "CREATE TABLE IF NOT EXISTS " +let DB_NAME = 'DB00.db'; +let TBL_NAME = 'TBL00'; +let DDL_TBL_CREATE = 'CREATE TABLE IF NOT EXISTS ' + TBL_NAME - + " (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, age INTEGER, phoneNumber DOUBLE, isStudent BOOLEAN, Binary BINARY)"; + + ' (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, age INTEGER, phoneNumber DOUBLE, isStudent BOOLEAN, Binary BINARY)'; let rdbStore; export default class DataShareExtAbility extends DataShareExtensionAbility { delete(uri, predicates, callback) { - if (predicates == null || predicates == undefined) { + if (predicates === null || predicates === undefined) { return; } rdbStore.delete(TBL_NAME, predicates, function (err, ret) { - if (callback != undefined) { + if (callback !== undefined) { callback(err, ret); } }); @@ -235,30 +235,30 @@ Queries data from the database. This API can be overridden as required. | uri | string | Yes | URI of the data to query.| | predicates | [dataSharePredicates.DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | Yes | Filter criteria for querying data.| | columns | Array<string> | Yes| Columns to query. If this parameter is empty, all columns will be queried.| -| callback | AsyncCallback<Object> | Yes| Callback invoked to return the result set.| +| callback | AsyncCallback<Object> | Yes| Callback invoked to return the result set obtained.| **Example** ```ts import rdb from '@ohos.data.relationalStore'; -let DB_NAME = "DB00.db"; -let TBL_NAME = "TBL00"; -let DDL_TBL_CREATE = "CREATE TABLE IF NOT EXISTS " +let DB_NAME = 'DB00.db'; +let TBL_NAME = 'TBL00'; +let DDL_TBL_CREATE = 'CREATE TABLE IF NOT EXISTS ' + TBL_NAME - + " (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, age INTEGER, phoneNumber DOUBLE, isStudent BOOLEAN, Binary BINARY)"; + + ' (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, age INTEGER, phoneNumber DOUBLE, isStudent BOOLEAN, Binary BINARY)'; let rdbStore; export default class DataShareExtAbility extends DataShareExtensionAbility { query(uri, predicates, columns, callback) { - if (predicates == null || predicates == undefined) { + if (predicates === null || predicates === undefined) { return; } rdbStore.query(TBL_NAME, predicates, columns, function (err, resultSet) { - if (resultSet != undefined) { + if (resultSet !== undefined) { console.info('resultSet.rowCount: ' + resultSet.rowCount); } - if (callback != undefined) { + if (callback !== undefined) { callback(err, resultSet); } }); @@ -287,23 +287,23 @@ Batch inserts data into the database. This API is called by the server and can b ```ts import rdb from '@ohos.data.relationalStore'; -let DB_NAME = "DB00.db"; -let TBL_NAME = "TBL00"; -let DDL_TBL_CREATE = "CREATE TABLE IF NOT EXISTS " +let DB_NAME = 'DB00.db'; +let TBL_NAME = 'TBL00'; +let DDL_TBL_CREATE = 'CREATE TABLE IF NOT EXISTS ' + TBL_NAME - + " (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, age INTEGER, phoneNumber DOUBLE, isStudent BOOLEAN, Binary BINARY)"; + + ' (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, age INTEGER, phoneNumber DOUBLE, isStudent BOOLEAN, Binary BINARY)'; let rdbStore; export default class DataShareExtAbility extends DataShareExtensionAbility { batchInsert(uri, valueBuckets, callback) { - if (valueBuckets == null || valueBuckets.length == undefined) { + if (valueBuckets === null || valueBuckets.length === undefined) { console.info('invalid valueBuckets'); return; } - let resultNum = valueBuckets.length + let resultNum = valueBuckets.length; valueBuckets.forEach(vb => { rdbStore.insert(TBL_NAME, vb, function (err, ret) { - if (callback != undefined) { + if (callback !== undefined) { callback(err, resultNum); } }); @@ -332,8 +332,8 @@ Normalizes a URI. This API can be overridden as required. ```ts export default class DataShareExtAbility extends DataShareExtensionAbility { normalizeUri(uri, callback) { - let err = {"code":0}; - let ret = "normalize+" + uri; + let err = {'code':0}; + let ret = 'normalize+' + uri; callback(err, ret); } }; @@ -359,8 +359,8 @@ Denormalizes a URI. This API can be overridden as required. ```ts export default class DataShareExtAbility extends DataShareExtensionAbility { denormalizeUri(uri, callback) { - let err = {"code":0}; - let ret = "denormalize+" + uri; + let err = {'code':0}; + let ret = 'denormalize+' + uri; callback(err, ret); } }; diff --git a/en/application-dev/reference/apis/js-apis-application-environmentCallback.md b/en/application-dev/reference/apis/js-apis-application-environmentCallback.md index d4c25269235da3b95e4f230c084d92c1df047269..b6fdcadbee8d1518fb830f46db13270c82a77d11 100644 --- a/en/application-dev/reference/apis/js-apis-application-environmentCallback.md +++ b/en/application-dev/reference/apis/js-apis-application-environmentCallback.md @@ -1,17 +1,17 @@ # @ohos.application.EnvironmentCallback (EnvironmentCallback) -The **EnvironmentCallback** module provides APIs, such as **onConfigurationUpdated** and **onMemoryLevel**, for the application context to listen for system environment changes. +The **EnvironmentCallback** module provides APIs, such as **onConfigurationUpdated**, for the application context to listen for system environment changes. > **NOTE** > -> The APIs of this module are supported since API version 9 and are deprecated in versions later than API version 9. You are advised to use [@ohos.app.ability.EnvironmentCallback](js-apis-app-ability-environmentCallback.md) instead. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> The APIs of this module are supported and deprecated in API version 9. You are advised to use [@ohos.app.ability.EnvironmentCallback](js-apis-app-ability-environmentCallback.md) instead. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The APIs of this module can be used only in the stage model. ## Modules to Import ```ts -import EnvironmentCallback from "@ohos.application.EnvironmentCallback"; +import EnvironmentCallback from '@ohos.application.EnvironmentCallback'; ``` @@ -30,48 +30,32 @@ Called when the system environment changes. | config | [Configuration](js-apis-application-configuration.md) | Yes| **Configuration** object after the change.| ## EnvironmentCallback.onMemoryLevel - -onMemoryLevel(level: number): void; - -Called when the system memory level changes. - -**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore - -**Parameters** - - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | level | [MemoryLevel](js-apis-application-abilityConstant.md#abilityconstantmemorylevel) | Yes| New memory level.| - -**Example** + ```ts -import UIAbility from '@ohos.app.ability.UIAbility'; +import Ability from '@ohos.application.Ability'; -var callbackId; +let callbackId; -export default class EntryAbility extends UIAbility { +export default class MyAbility extends Ability { onCreate() { - console.log("MyAbility onCreate") + console.log('MyAbility onCreate'); globalThis.applicationContext = this.context.getApplicationContext(); let EnvironmentCallback = { onConfigurationUpdated(config){ - console.log("onConfigurationUpdated config:" + JSON.stringify(config)); + console.log('onConfigurationUpdated config:' + JSON.stringify(config)); }, - onMemoryLevel(level){ - console.log("onMemoryLevel level:" + level); - } - } + }; // 1. Obtain an applicationContext object. let applicationContext = globalThis.applicationContext; // 2. Register a listener for the environment changes through the applicationContext object. callbackId = applicationContext.registerEnvironmentCallback(EnvironmentCallback); - console.log("registerEnvironmentCallback number: " + JSON.stringify(callbackId)); + console.log('registerEnvironmentCallback number: ' + JSON.stringify(callbackId)); } onDestroy() { let applicationContext = globalThis.applicationContext; applicationContext.unregisterEnvironmentCallback(callbackId, (error, data) => { - console.log("unregisterEnvironmentCallback success, err: " + JSON.stringify(error)); + console.log('unregisterEnvironmentCallback success, err: ' + JSON.stringify(error)); }); } } diff --git a/en/application-dev/reference/apis/js-apis-application-errorManager.md b/en/application-dev/reference/apis/js-apis-application-errorManager.md deleted file mode 100644 index c1eaa2d35e90966795e4b98f4b75cffc0570e855..0000000000000000000000000000000000000000 --- a/en/application-dev/reference/apis/js-apis-application-errorManager.md +++ /dev/null @@ -1,100 +0,0 @@ -# @ohos.application.errorManager (ErrorManager) - -The **ErrorManager** module provides APIs for registering and deregistering error observers. - -> **NOTE** -> -> The APIs of this module are supported since API version 9 and are deprecated in versions later than API version 9. You are advised to use [@ohos.app.ability.errorManager](js-apis-app-ability-errorManager.md) instead. Newly added APIs will be marked with a superscript to indicate their earliest API version. - -## Modules to Import -```ts -import errorManager from '@ohos.application.errorManager' -``` - -## ErrorManager.registerErrorObserver - -registerErrorObserver(observer: ErrorObserver): number; - -Registers an error observer. - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| observer | [ErrorObserver](js-apis-inner-application-errorObserver.md) | Yes| Numeric code of the observer.| - -**Example** - -```ts -var observer = { - onUnhandledException(errorMsg) { - console.log('onUnhandledException, errorMsg: ', errorMsg) - } -} -errorManager.registerErrorObserver(observer) -``` - -## ErrorManager.unregisterErrorObserver - -unregisterErrorObserver(observerId: number, callback: AsyncCallback\): void; - -Deregisters an error observer. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| observerId | number | Yes| Numeric code of the observer.| -| callback | AsyncCallback\ | Yes| Callback used to return the result.| - -**Example** - -```ts -var observerId = 100; - -function unregisterErrorObserverCallback(err) { - if (err) { - console.log('------------ unregisterErrorObserverCallback ------------', err); - } -} -errorManager.unregisterErrorObserver(observerId, unregisterErrorObserverCallback); - -``` - -## ErrorManager.unregisterErrorObserver - -unregisterErrorObserver(observerId: number): Promise\; - -Deregisters an error observer. This API uses a promise to return the result. - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| observerId | number | Yes| Numeric code of the observer.| - -**Return value** - -| Type| Description| -| -------- | -------- | -| Promise\ | Promise used to return the result.| - -**Example** - -```ts -var observerId = 100; -errorManager.unregisterErrorObserver(observerId) -.then((data) => { - console.log('----------- unregisterErrorObserver success ----------', data); -}) -.catch((err) => { - console.log('----------- unregisterErrorObserver fail ----------', err); -}) - -``` diff --git a/en/application-dev/reference/apis/js-apis-application-formBindingData.md b/en/application-dev/reference/apis/js-apis-application-formBindingData.md index 5fbc52c95dc9e573947fb9820f00100a76a06f22..57e978adfb5fe88a505d99aa9175905cf3c1d1c4 100644 --- a/en/application-dev/reference/apis/js-apis-application-formBindingData.md +++ b/en/application-dev/reference/apis/js-apis-application-formBindingData.md @@ -35,7 +35,7 @@ Creates a **FormBindingData** object. | Name| Type | Mandatory| Description | | ------ | -------------- | ---- | ------------------------------------------------------------ | -| obj | Object\|string | No | Data to be displayed on the JS widget. The value can be an object containing multiple key-value pairs or a string in JSON format. The image data is identified by "formImages", and the content is multiple key-value pairs, each of which consists of an image identifier and image file descriptor. The final format is {"formImages": {"key1": fd1, "key2": fd2}}.| +| obj | Object\|string | No | Data to be displayed on the JS widget. The value can be an object containing multiple key-value pairs or a string in JSON format. The image data is identified by **'formImages'**, and the content is multiple key-value pairs, each of which consists of an image identifier and image file descriptor. The final format is {'formImages': {'key1': fd1, 'key2': fd2}}.| **Return value** @@ -48,17 +48,16 @@ Creates a **FormBindingData** object. **Example** ```ts -import formBindingData from @ohos.application.formBindingData; -import fs from '@ohos.file.fs'; - -try { - let fd = fs.openSync('/path/to/form.png') +import featureAbility from '@ohos.ability.featureAbility'; +import fileio from '@ohos.fileio'; +let context=featureAbility.getContext(); +context.getOrCreateLocalDir((err,data)=>{ + let path=data+'/xxx.jpg'; + let fd = fileio.openSync(path); let obj = { - "temperature": "21°", - "formImages": { "image": fd } + 'temperature': '21°', + 'formImages': {'image': fd} }; - formBindingData.createFormBindingData(obj); -} catch (error.code) { - console.log('catch error, error:' + JSON.stringify(error)); -} + let formBindingDataObj = formBindingData.createFormBindingData(obj); +}); ``` diff --git a/en/application-dev/reference/apis/js-apis-application-formHost.md b/en/application-dev/reference/apis/js-apis-application-formHost.md index 11da810effa714b8aaf37e35d3c0566556281ebf..67891daa343ff73efce912c073b9fe946947c739 100644 --- a/en/application-dev/reference/apis/js-apis-application-formHost.md +++ b/en/application-dev/reference/apis/js-apis-application-formHost.md @@ -1,6 +1,6 @@ -# @ohos.application.formHost (formHost) +# @ohos.application.formHost (FormHost) -The **formHost** module provides APIs related to the widget host, which is an application that displays the widget content and controls the position where the widget is displayed. You can use the APIs to delete, release, and update widgets installed by the same user, and obtain widget information and status. +The **FormHost** module provides APIs related to the widget host, which is an application that displays the widget content and controls the position where the widget is displayed. You can use the APIs to delete, release, and update widgets installed by the same user, and obtain widget information and status. > **NOTE** > @@ -34,12 +34,10 @@ Deletes a widget. After this API is called, the application can no longer use th **Example** ```ts -import formHost from '@ohos.application.formHost'; - -let formId = "12400633174999288"; +let formId = '12400633174999288'; formHost.deleteForm(formId, (error, data) => { if (error.code) { - console.error('formHost deleteForm, error:' + JSON.stringify(error)); + console.log('formHost deleteForm, error:' + JSON.stringify(error)); } }); ``` @@ -66,16 +64,14 @@ Deletes a widget. After this API is called, the application can no longer use th | -------- | -------- | | Promise<void> | Promise that returns no value.| -**Parameters** +**Example** ```ts -import formHost from '@ohos.application.formHost'; - -let formId = "12400633174999288"; +let formId = '12400633174999288'; formHost.deleteForm(formId).then(() => { console.log('formHost deleteForm success'); }).catch((error) => { - console.error('formHost deleteForm, error:' + JSON.stringify(error)); + console.log('formHost deleteForm, error:' + JSON.stringify(error)); }); ``` @@ -99,14 +95,10 @@ Releases a widget. After this API is called, the application can no longer use t **Example** ```ts -import formHost from '@ohos.application.formHost'; - -let formId = "12400633174999288"; +let formId = '12400633174999288'; formHost.releaseForm(formId, (error, data) => { if (error.code) { - console.error('formHost releaseForm, error:' + JSON.stringify(error)); - } else { - console.log('formHost releaseForm success'); + console.log('formHost releaseForm, error:' + JSON.stringify(error)); } }); ``` @@ -132,14 +124,10 @@ Releases a widget. After this API is called, the application can no longer use t **Example** ```ts -import formHost from '@ohos.application.formHost'; - -let formId = "12400633174999288"; +let formId = '12400633174999288'; formHost.releaseForm(formId, true, (error, data) => { if (error.code) { - console.error('formHost releaseForm, error:' + JSON.stringify(error)); - } else { - console.log('formHost releaseForm success'); + console.log('formHost releaseForm, error:' + JSON.stringify(error)); } }); ``` @@ -170,13 +158,11 @@ Releases a widget. After this API is called, the application can no longer use t **Example** ```ts -import formHost from '@ohos.application.formHost'; - -let formId = "12400633174999288"; +let formId = '12400633174999288'; formHost.releaseForm(formId, true).then(() => { console.log('formHost releaseForm success'); }).catch((error) => { - console.error('formHost releaseForm, error:' + JSON.stringify(error)); + console.log('formHost releaseForm, error:' + JSON.stringify(error)); }); ``` @@ -200,12 +186,10 @@ Requests a widget update. This API uses an asynchronous callback to return the r **Example** ```ts -import formHost from '@ohos.application.formHost'; - -let formId = "12400633174999288"; +let formId = '12400633174999288'; formHost.requestForm(formId, (error, data) => { if (error.code) { - console.error('formHost requestForm, error:' + JSON.stringify(error)); + console.log('formHost requestForm, error:' + JSON.stringify(error)); } }); ``` @@ -235,13 +219,11 @@ Requests a widget update. This API uses a promise to return the result. **Example** ```ts -import formHost from '@ohos.application.formHost'; - -let formId = "12400633174999288"; +let formId = '12400633174999288'; formHost.requestForm(formId).then(() => { console.log('formHost requestForm success'); }).catch((error) => { - console.error('formHost requestForm, error:' + JSON.stringify(error)); + console.log('formHost requestForm, error:' + JSON.stringify(error)); }); ``` @@ -265,12 +247,10 @@ Converts a temporary widget to a normal one. This API uses an asynchronous callb **Example** ```ts -import formHost from '@ohos.application.formHost'; - -let formId = "12400633174999288"; +let formId = '12400633174999288'; formHost.castTempForm(formId, (error, data) => { if (error.code) { - console.error('formHost castTempForm, error:' + JSON.stringify(error)); + console.log('formHost castTempForm, error:' + JSON.stringify(error)); } }); ``` @@ -300,13 +280,11 @@ Converts a temporary widget to a normal one. This API uses a promise to return t **Example** ```ts -import formHost from '@ohos.application.formHost'; - -let formId = "12400633174999288"; +let formId = '12400633174999288'; formHost.castTempForm(formId).then(() => { console.log('formHost castTempForm success'); }).catch((error) => { - console.error('formHost castTempForm, error:' + JSON.stringify(error)); + console.log('formHost castTempForm, error:' + JSON.stringify(error)); }); ``` @@ -330,12 +308,10 @@ Instructs the widget framework to make a widget visible. After this API is calle **Example** ```ts -import formHost from '@ohos.application.formHost'; - -let formId = ["12400633174999288"]; +let formId = ['12400633174999288']; formHost.notifyVisibleForms(formId, (error, data) => { if (error.code) { - console.error('formHost notifyVisibleForms, error:' + JSON.stringify(error)); + console.log('formHost notifyVisibleForms, error:' + JSON.stringify(error)); } }); ``` @@ -365,13 +341,11 @@ Instructs the widget framework to make a widget visible. After this API is calle **Example** ```ts -import formHost from '@ohos.application.formHost'; - -let formId = ["12400633174999288"]; +let formId = ['12400633174999288']; formHost.notifyVisibleForms(formId).then(() => { console.log('formHost notifyVisibleForms success'); }).catch((error) => { - console.error('formHost notifyVisibleForms, error:' + JSON.stringify(error)); + console.log('formHost notifyVisibleForms, error:' + JSON.stringify(error)); }); ``` @@ -395,12 +369,10 @@ Instructs the widget framework to make a widget invisible. After this API is cal **Example** ```ts -import formHost from '@ohos.application.formHost'; - -let formId = ["12400633174999288"]; +let formId = ['12400633174999288']; formHost.notifyInvisibleForms(formId, (error, data) => { if (error.code) { - console.error('formHost notifyInvisibleForms, error:' + JSON.stringify(error)); + console.log('formHost notifyInvisibleForms, error:' + JSON.stringify(error)); } }); ``` @@ -430,13 +402,11 @@ Instructs the widget framework to make a widget invisible. After this API is cal **Example** ```ts -import formHost from '@ohos.application.formHost'; - -let formId = ["12400633174999288"]; +let formId = ['12400633174999288']; formHost.notifyInvisibleForms(formId).then(() => { console.log('formHost notifyInvisibleForms success'); }).catch((error) => { - console.error('formHost notifyInvisibleForms, error:' + JSON.stringify(error)); + console.log('formHost notifyInvisibleForms, error:' + JSON.stringify(error)); }); ``` @@ -460,12 +430,10 @@ Instructs the widget framework to make a widget updatable. After this API is cal **Example** ```ts -import formHost from '@ohos.application.formHost'; - -let formId = ["12400633174999288"]; +let formId = ['12400633174999288']; formHost.enableFormsUpdate(formId, (error, data) => { if (error.code) { - console.error('formHost enableFormsUpdate, error:' + JSON.stringify(error)); + console.log('formHost enableFormsUpdate, error:' + JSON.stringify(error)); } }); ``` @@ -495,13 +463,11 @@ Instructs the widget framework to make a widget updatable. After this API is cal **Example** ```ts -import formHost from '@ohos.application.formHost'; - -let formId = ["12400633174999288"]; +let formId = ['12400633174999288']; formHost.enableFormsUpdate(formId).then(() => { console.log('formHost enableFormsUpdate success'); }).catch((error) => { - console.error('formHost enableFormsUpdate, error:' + JSON.stringify(error)); + console.log('formHost enableFormsUpdate, error:' + JSON.stringify(error)); }); ``` @@ -525,12 +491,10 @@ Instructs the widget framework to make a widget not updatable. After this API is **Example** ```ts -import formHost from '@ohos.application.formHost'; - -let formId = ["12400633174999288"]; +let formId = ['12400633174999288']; formHost.disableFormsUpdate(formId, (error, data) => { if (error.code) { - console.error('formHost disableFormsUpdate, error:' + JSON.stringify(error)); + console.log('formHost disableFormsUpdate, error:' + JSON.stringify(error)); } }); ``` @@ -560,13 +524,11 @@ Instructs the widget framework to make a widget not updatable. After this API is **Example** ```ts -import formHost from '@ohos.application.formHost'; - -let formId = ["12400633174999288"]; +let formId = ['12400633174999288']; formHost.disableFormsUpdate(formId).then(() => { console.log('formHost disableFormsUpdate success'); }).catch((error) => { - console.error('formHost disableFormsUpdate, error:' + JSON.stringify(error)); + console.log('formHost disableFormsUpdate, error:' + JSON.stringify(error)); }); ``` @@ -587,12 +549,10 @@ Checks whether the system is ready. This API uses an asynchronous callback to re **Example** ```ts -import formHost from '@ohos.application.formHost'; - -let formId = "12400633174999288"; +let formId = '12400633174999288'; formHost.isSystemReady((error, data) => { if (error.code) { - console.error('formHost isSystemReady, error:' + JSON.stringify(error)); + console.log('formHost isSystemReady, error:' + JSON.stringify(error)); } }); ``` @@ -614,13 +574,11 @@ Checks whether the system is ready. This API uses a promise to return the result **Example** ```ts -import formHost from '@ohos.application.formHost'; - -let formId = "12400633174999288"; +let formId = '12400633174999288'; formHost.isSystemReady().then(() => { console.log('formHost isSystemReady success'); }).catch((error) => { - console.error('formHost isSystemReady, error:' + JSON.stringify(error)); + console.log('formHost isSystemReady, error:' + JSON.stringify(error)); }); ``` @@ -638,16 +596,14 @@ Obtains the widget information provided by all applications on the device. This | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------- | -| callback | AsyncCallback<Array<[formInfo.FormInfo](js-apis-application-formInfo.md)>> | Yes| Callback used to return the result. If the widget information is obtained, **error** is undefined and **data** is the information obtained; otherwise, **error** is an error object.| +| callback | AsyncCallback<Array<[FormInfo](js-apis-application-formInfo.md)>> | Yes| Callback used to return the result. If the widget information is obtained, **error** is undefined and **data** is the information obtained; otherwise, **error** is an error object.| **Example** ```ts -import formHost from '@ohos.application.formHost'; - formHost.getAllFormsInfo((error, data) => { if (error.code) { - console.error('formHost getAllFormsInfo, error:' + JSON.stringify(error)); + console.log('formHost getAllFormsInfo, error:' + JSON.stringify(error)); } else { console.log('formHost getAllFormsInfo, data:' + JSON.stringify(data)); } @@ -668,17 +624,15 @@ Obtains the widget information provided by all applications on the device. This | Type | Description | | :------------ | :---------------------------------- | -| Promise<Array<[formInfo.FormInfo](js-apis-application-formInfo.md)>> | Promise used to return the information obtained.| +| Promise<Array<[FormInfo](js-apis-application-formInfo.md)>> | Promise used to return the information obtained.| **Example** ```ts - import formHost from '@ohos.application.formHost'; - formHost.getAllFormsInfo().then((data) => { - console.log('formHost getAllFormsInfo data:' + JSON.stringify(data)); + console.log('formHost getAllFormsInfo data:' + JSON.stringify(data)); }).catch((error) => { - console.error('formHost getAllFormsInfo, error:' + JSON.stringify(error)); + console.log('formHost getAllFormsInfo, error:' + JSON.stringify(error)); }); ``` @@ -697,16 +651,14 @@ Obtains the widget information provided by a given application on the device. Th | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------- | | bundleName | string | Yes| Bundle name of the application.| -| callback | AsyncCallback<Array<[formInfo.FormInfo](js-apis-application-formInfo.md)>> | Yes| Callback used to return the result. If the widget information is obtained, **error** is undefined and **data** is the information obtained; otherwise, **error** is an error object.| +| callback | AsyncCallback<Array<[FormInfo](js-apis-application-formInfo.md)>> | Yes| Callback used to return the result. If the widget information is obtained, **error** is undefined and **data** is the information obtained; otherwise, **error** is an error object.| **Example** ```ts -import formHost from '@ohos.application.formHost'; - -formHost.getFormsInfo("com.example.ohos.formjsdemo", (error, data) => { +formHost.getFormsInfo('com.example.ohos.formjsdemo', (error, data) => { if (error.code) { - console.error('formHost getFormsInfo, error:' + JSON.stringify(error)); + console.log('formHost getFormsInfo, error:' + JSON.stringify(error)); } else { console.log('formHost getFormsInfo, data:' + JSON.stringify(data)); } @@ -729,18 +681,16 @@ Obtains the widget information provided by a given application on the device. Th | ------ | ------ | ---- | ------- | | bundleName | string | Yes| Bundle name of the application.| | moduleName | string | Yes| Module name.| -| callback | AsyncCallback<Array<[formInfo.FormInfo](js-apis-application-formInfo.md)>> | Yes| Callback used to return the result. If the widget information is obtained, **error** is undefined and **data** is the information obtained; otherwise, **error** is an error object.| +| callback | AsyncCallback<Array<[FormInfo](js-apis-application-formInfo.md)>> | Yes| Callback used to return the result. If the widget information is obtained, **error** is undefined and **data** is the information obtained; otherwise, **error** is an error object.| **Example** ```ts -import formHost from '@ohos.application.formHost'; - -formHost.getFormsInfo("com.example.ohos.formjsdemo", "entry", (error, data) => { +formHost.getFormsInfo('com.example.ohos.formjsdemo', 'entry', (error, data) => { if (error.code) { - console.error('formHost getFormsInfo, error:' + JSON.stringify(error)); + console.log('formHost getFormsInfo, error:' + JSON.stringify(error)); } else { - console.log('formHost getFormsInfo, data:' + JSON.stringify(data)); + console.log('formHost getFormsInfo, data:' + JSON.stringify(data)); } }); ``` @@ -766,17 +716,15 @@ Obtains the widget information provided by a given application on the device. Th | Type | Description | | :------------ | :---------------------------------- | -| Promise<Array<[formInfo.FormInfo](js-apis-application-formInfo.md)>> | Promise used to return the information obtained.| +| Promise<Array<[FormInfo](js-apis-application-formInfo.md)>> | Promise used to return the information obtained.| **Example** ```ts - import formHost from '@ohos.application.formHost'; - - formHost.getFormsInfo("com.example.ohos.formjsdemo", "entry").then((data) => { + formHost.getFormsInfo('com.example.ohos.formjsdemo', 'entry').then((data) => { console.log('formHost getFormsInfo, data:' + JSON.stringify(data)); }).catch((error) => { - console.error('formHost getFormsInfo, error:' + JSON.stringify(error)); + console.log('formHost getFormsInfo, error:' + JSON.stringify(error)); }); ``` @@ -800,12 +748,10 @@ Deletes invalid widgets from the list. This API uses an asynchronous callback to **Example** ```ts -import formHost from '@ohos.application.formHost'; - -let formIds = new Array("12400633174999288", "12400633174999289"); +let formIds = new Array('12400633174999288', '12400633174999289'); formHost.deleteInvalidForms(formIds, (error, data) => { if (error.code) { - console.error('formHost deleteInvalidForms, error:' + JSON.stringify(error)); + console.log('formHost deleteInvalidForms, error:' + JSON.stringify(error)); } else { console.log('formHost deleteInvalidForms, data:' + JSON.stringify(data)); } @@ -837,13 +783,11 @@ Deletes invalid widgets from the list. This API uses a promise to return the res **Example** ```ts -import formHost from '@ohos.application.formHost'; - -let formIds = new Array("12400633174999288", "12400633174999289"); +let formIds = new Array('12400633174999288', '12400633174999289'); formHost.deleteInvalidForms(formIds).then((data) => { console.log('formHost deleteInvalidForms, data:' + JSON.stringify(data)); }).catch((error) => { - console.error('formHost deleteInvalidForms, error:' + JSON.stringify(error)); + console.log('formHost deleteInvalidForms, error:' + JSON.stringify(error)); }); ``` @@ -862,26 +806,24 @@ Obtains the widget state. This API uses an asynchronous callback to return the r | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------- | | want | [Want](js-apis-application-want.md) | Yes | **Want** information carried to query the widget state. The information must contain the bundle name, ability name, module name, widget name, and widget dimensions.| -| callback | AsyncCallback<[formInfo.FormStateInfo](js-apis-application-formInfo.md#formstateinfo)> | Yes| Callback used to return the result. If the widget state is obtained, **error** is undefined and **data** is the widget state obtained; otherwise, **error** is an error object.| +| callback | AsyncCallback<[FormStateInfo](js-apis-application-formInfo.md#formstateinfo)> | Yes| Callback used to return the result. If the widget state is obtained, **error** is undefined and **data** is the widget state obtained; otherwise, **error** is an error object.| **Example** ```ts -import formHost from '@ohos.application.formHost'; - let want = { - "deviceId": "", - "bundleName": "ohos.samples.FormApplication", - "abilityName": "FormAbility", - "parameters": { - "ohos.extra.param.key.module_name": "entry", - "ohos.extra.param.key.form_name": "widget", - "ohos.extra.param.key.form_dimension": 2 + 'deviceId': '', + 'bundleName': 'ohos.samples.FormApplication', + 'abilityName': 'FormAbility', + 'parameters': { + 'ohos.extra.param.key.module_name': 'entry', + 'ohos.extra.param.key.form_name': 'widget', + 'ohos.extra.param.key.form_dimension': 2 } }; formHost.acquireFormState(want, (error, data) => { if (error.code) { - console.error('formHost acquireFormState, error:' + JSON.stringify(error)); + console.log('formHost acquireFormState, error:' + JSON.stringify(error)); } else { console.log('formHost acquireFormState, data:' + JSON.stringify(data)); } @@ -913,28 +855,26 @@ Obtains the widget state. This API uses a promise to return the result. **Example** ```ts -import formHost from '@ohos.application.formHost'; - let want = { - "deviceId": "", - "bundleName": "ohos.samples.FormApplication", - "abilityName": "FormAbility", - "parameters": { - "ohos.extra.param.key.module_name": "entry", - "ohos.extra.param.key.form_name": "widget", - "ohos.extra.param.key.form_dimension": 2 + 'deviceId': '', + 'bundleName': 'ohos.samples.FormApplication', + 'abilityName': 'FormAbility', + 'parameters': { + 'ohos.extra.param.key.module_name': 'entry', + 'ohos.extra.param.key.form_name': 'widget', + 'ohos.extra.param.key.form_dimension': 2 } }; formHost.acquireFormState(want).then((data) => { console.log('formHost acquireFormState, data:' + JSON.stringify(data)); }).catch((error) => { - console.error('formHost acquireFormState, error:' + JSON.stringify(error)); + console.log('formHost acquireFormState, error:' + JSON.stringify(error)); }); ``` -## on("formUninstall") +## on('formUninstall') -on(type: "formUninstall", callback: Callback<string>): void +on(type: 'formUninstall', callback: Callback<string>): void Subscribes to widget uninstall events. This API uses an asynchronous callback to return the result. @@ -944,23 +884,21 @@ Subscribes to widget uninstall events. This API uses an asynchronous callback to | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------- | -| type | string | Yes | Event type. The value **formUninstall** indicates a widget uninstallation event.| +| type | string | Yes | Event type. The value **'formUninstall'** indicates a widget uninstallation event.| | callback | Callback<string> | Yes| Callback used to return the widget ID.| **Example** ```ts -import formHost from '@ohos.application.formHost'; - let callback = function(formId) { console.log('formHost on formUninstall, formId:' + formId); } -formHost.on("formUninstall", callback); +formHost.on('formUninstall', callback); ``` -## off("formUninstall") +## off('formUninstall') -off(type: "formUninstall", callback?: Callback<string>): void +off(type: 'formUninstall', callback?: Callback<string>): void Unsubscribes from widget uninstall events. This API uses an asynchronous callback to return the result. @@ -970,18 +908,16 @@ Unsubscribes from widget uninstall events. This API uses an asynchronous callbac | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------- | -| type | string | Yes | Event type. The value **formUninstall** indicates a widget uninstallation event.| -| callback | Callback<string> | No| Callback used to return the widget ID. If it is left unspecified, it indicates the callback for all the events that have been subscribed.
The value must be the same as that in **on("formUninstall")**.| +| type | string | Yes | Event type. The value **'formUninstall'** indicates a widget uninstallation event.| +| callback | Callback<string> | No| Callback used to return the widget ID. If it is left unspecified, it indicates the callback for all the events that have been subscribed.
The value must be the same as that in **on('formUninstall')**.| **Example** ```ts -import formHost from '@ohos.application.formHost'; - let callback = function(formId) { console.log('formHost on formUninstall, formId:' + formId); } -formHost.off("formUninstall", callback); +formHost.off('formUninstall', callback); ``` ## notifyFormsVisible @@ -1005,12 +941,10 @@ Instructs the widgets to make themselves visible. This API uses an asynchronous **Example** ```ts -import formHost from '@ohos.application.formHost'; - -let formIds = new Array("12400633174999288", "12400633174999289"); +let formIds = new Array('12400633174999288', '12400633174999289'); formHost.notifyFormsVisible(formIds, true, (error, data) => { if (error.code) { - console.error('formHost notifyFormsVisible, error:' + JSON.stringify(error)); + console.log('formHost notifyFormsVisible, error:' + JSON.stringify(error)); } }); ``` @@ -1041,13 +975,11 @@ Instructs the widgets to make themselves visible. This API uses a promise to ret **Example** ```ts -import formHost from '@ohos.application.formHost'; - -let formIds = new Array("12400633174999288", "12400633174999289"); +let formIds = new Array('12400633174999288', '12400633174999289'); formHost.notifyFormsVisible(formIds, true).then(() => { console.log('formHost notifyFormsVisible success'); }).catch((error) => { - console.error('formHost notifyFormsVisible, error:' + JSON.stringify(error)); + console.log('formHost notifyFormsVisible, error:' + JSON.stringify(error)); }); ``` @@ -1072,12 +1004,10 @@ Instructs the widgets to enable or disable updates. This API uses an asynchronou **Example** ```ts -import formHost from '@ohos.application.formHost'; - -let formIds = new Array("12400633174999288", "12400633174999289"); +let formIds = new Array('12400633174999288', '12400633174999289'); formHost.notifyFormsEnableUpdate(formIds, true, (error, data) => { if (error.code) { - console.error('formHost notifyFormsEnableUpdate, error:' + JSON.stringify(error)); + console.log('formHost notifyFormsEnableUpdate, error:' + JSON.stringify(error)); } }); ``` @@ -1108,13 +1038,11 @@ Instructs the widgets to enable or disable updates. This API uses a promise to r **Example** ```ts -import formHost from '@ohos.application.formHost'; - -let formIds = new Array("12400633174999288", "12400633174999289"); +let formIds = new Array('12400633174999288', '12400633174999289'); formHost.notifyFormsEnableUpdate(formIds, true).then(() => { console.log('formHost notifyFormsEnableUpdate success'); }).catch((error) => { - console.error('formHost notifyFormsEnableUpdate, error:' + JSON.stringify(error)); + console.log('formHost notifyFormsEnableUpdate, error:' + JSON.stringify(error)); }); ``` ## shareForm9+ @@ -1123,7 +1051,7 @@ shareForm(formId: string, deviceId: string, callback: AsyncCallback<void>) Shares a specified widget with a remote device. This API uses an asynchronous callback to return the result. -**Required permissions**: ohos.permission.REQUIRE_FORM and ohos.permission.DISTRIBUTED_DATASYNC +**Required permissions**: ohos.permission.REQUIRE_FORM **System capability**: SystemCapability.Ability.Form @@ -1138,13 +1066,11 @@ Shares a specified widget with a remote device. This API uses an asynchronous ca **Example** ```ts -import formHost from '@ohos.application.formHost'; - -let formId = "12400633174999288"; -let deviceId = "EFC11C0C53628D8CC2F8CB5052477E130D075917034613B9884C55CD22B3DEF2"; +let formId = '12400633174999288'; +let deviceId = 'EFC11C0C53628D8CC2F8CB5052477E130D075917034613B9884C55CD22B3DEF2'; formHost.shareForm(formId, deviceId, (error, data) => { if (error.code) { - console.error('formHost shareForm, error:' + JSON.stringify(error)); + console.log('formHost shareForm, error:' + JSON.stringify(error)); } }); ``` @@ -1172,23 +1098,21 @@ Shares a specified widget with a remote device. This API uses a promise to retur | -------- | -------- | | Promise<void> | Promise that returns no value.| -**Parameters** +**Example** ```ts -import formHost from '@ohos.application.formHost'; - -let formId = "12400633174999288"; -let deviceId = "EFC11C0C53628D8CC2F8CB5052477E130D075917034613B9884C55CD22B3DEF2"; +let formId = '12400633174999288'; +let deviceId = 'EFC11C0C53628D8CC2F8CB5052477E130D075917034613B9884C55CD22B3DEF2'; formHost.shareForm(formId, deviceId).then(() => { console.log('formHost shareForm success'); }).catch((error) => { - console.error('formHost shareForm, error:' + JSON.stringify(error)); + console.log('formHost shareForm, error:' + JSON.stringify(error)); }); ``` ## notifyFormsPrivacyProtected9+ -notifyFormsPrivacyProtected(formIds: Array<string>, isProtected: boolean, callback: AsyncCallback<void>): void +notifyFormsPrivacyProtected(formIds: Array\, isProtected: boolean, callback: AsyncCallback\): void Notifies that the privacy protection status of the specified widgets changes. This API uses an asynchronous callback to return the result. @@ -1204,51 +1128,10 @@ Notifies that the privacy protection status of the specified widgets changes. Th | deviceId | string | Yes | Remote device ID.| ```ts -import formHost from '@ohos.application.formHost'; - -let formIds = new Array("12400633174999288", "12400633174999289"); +let formIds = new Array('12400633174999288', '12400633174999289'); formHost.notifyFormsPrivacyProtected(formIds, true).then(() => { console.log('formHost shareForm success'); }).catch((error) => { - console.error('formHost shareForm, error:' + JSON.stringify(error)); + console.log('formHost shareForm, error:' + JSON.stringify(error)); }); ``` - -## notifyFormsPrivacyProtected - -function notifyFormsPrivacyProtected(formIds: Array<string>, isProtected: boolean): Promise<void>; - -Notifies that the privacy protection status of the specified widgets changes. This API uses a promise to return the result. - -**Required permissions**: ohos.permission.REQUIRE_FORM - -**System capability**: SystemCapability.Ability.Form - -**Parameters** - -| Name | Type | Mandatory| Description | -| ----------- | --------------- | ---- | -------------------------------- | -| formIds | Array<string> | Yes | ID of the widgets.| -| isProtected | boolean | Yes | Whether privacy protection is enabled. | - -**Return value** - -| Type | Description | -| ------------------- | ------------------------- | -| Promise<void> | Promise that returns no value.| - - -```ts -import formHost from '@ohos.application.formHost'; - -let formIds = new Array("12400633174999288", "12400633174999289"); -try { - formHost.notifyFormsPrivacyProtected(formIds, true).then(() => { - console.log('formHost notifyFormsPrivacyProtected success'); - }).catch((error) => { - console.log('formHost notifyFormsPrivacyProtected, error:' + JSON.stringify(error)); - }); -} catch(error) { - console.log('formHost notifyFormsPrivacyProtected, error:' + JSON.stringify(error)); -} -``` diff --git a/en/application-dev/reference/apis/js-apis-application-formProvider.md b/en/application-dev/reference/apis/js-apis-application-formProvider.md index 4d604ff7295eb9903d450bc96f9c00fde253ee11..d23e6e15e21e68017f0c305427ad095446ca54cf 100644 --- a/en/application-dev/reference/apis/js-apis-application-formProvider.md +++ b/en/application-dev/reference/apis/js-apis-application-formProvider.md @@ -1,10 +1,10 @@ -# @ohos.application.formProvider (formProvider) +# @ohos.application.formProvider (FormProvider) The **FormProvider** module provides APIs related to the widget provider. You can use the APIs to update a widget, set the next refresh time for a widget, obtain widget information, and request a widget release. > **NOTE** > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. -> This module is deprecated since API version 9. You are advised to use [formProvider](js-apis-app-form-formProvider.md) instead. +> This module is deprecated since API version 9. You are advised to use [FormProvider](js-apis-app-form-formProvider.md) instead. ## Modules to Import @@ -31,13 +31,11 @@ Sets the next refresh time for a widget. This API uses an asynchronous callback **Example** ```ts - import formProvider from '@ohos.app.form.formProvider'; - - let formId = "12400633174999288"; + let formId = '12400633174999288'; formProvider.setFormNextRefreshTime(formId, 5, (error, data) => { - if (error.code) { - console.log('formProvider setFormNextRefreshTime, error:' + JSON.stringify(error)); - } + if (error.code) { + console.log('formProvider setFormNextRefreshTime, error:' + JSON.stringify(error)); + } }); ``` @@ -65,13 +63,11 @@ Sets the next refresh time for a widget. This API uses a promise to return the r **Example** ```ts - import formProvider from '@ohos.app.form.formProvider'; - - let formId = "12400633174999288"; + let formId = '12400633174999288'; formProvider.setFormNextRefreshTime(formId, 5).then(() => { - console.log('formProvider setFormNextRefreshTime success'); + console.log('formProvider setFormNextRefreshTime success'); }).catch((error) => { - console.log('formProvider setFormNextRefreshTime, error:' + JSON.stringify(error)); + console.log('formProvider setFormNextRefreshTime, error:' + JSON.stringify(error)); }); ``` @@ -88,21 +84,19 @@ Updates a widget. This API uses an asynchronous callback to return the result. | Name| Type | Mandatory| Description | | ------ | ---------------------------------------------------------------------- | ---- | ---------------- | | formId | string | Yes | ID of the widget to update.| - | formBindingData | [formBindingData.FormBindingData](js-apis-application-formBindingData.md#formbindingdata) | Yes | Data to be used for the update. | + | formBindingData.FormBindingData | [FormBindingData](js-apis-application-formBindingData.md#formbindingdata) | Yes | Data to be used for the update. | | callback | AsyncCallback<void> | Yes| Callback used to return the result.| **Example** ```ts import formBindingData from '@ohos.application.formBindingData'; - import formProvider from '@ohos.app.form.formProvider'; - - let formId = "12400633174999288"; - let obj = formBindingData.createFormBindingData({temperature:"22c", time:"22:00"}); + let formId = '12400633174999288'; + let obj = formBindingData.createFormBindingData({temperature:'22c', time:'22:00'}); formProvider.updateForm(formId, obj, (error, data) => { - if (error.code) { - console.log('formProvider updateForm, error:' + JSON.stringify(error)); - } + if (error.code) { + console.log('formProvider updateForm, error:' + JSON.stringify(error)); + } }); ``` @@ -119,7 +113,7 @@ Updates a widget. This API uses a promise to return the result. | Name| Type | Mandatory| Description | | ------ | ---------------------------------------------------------------------- | ---- | ---------------- | | formId | string | Yes | ID of the widget to update.| - | formBindingData | [formBindingData.FormBindingData](js-apis-application-formBindingData.md#formbindingdata) | Yes | Data to be used for the update. | + | formBindingData.FormBindingData | [FormBindingData](js-apis-application-formBindingData.md#formbindingdat) | Yes | Data to be used for the update. | **Return value** @@ -131,14 +125,12 @@ Updates a widget. This API uses a promise to return the result. ```ts import formBindingData from '@ohos.application.formBindingData'; - import formProvider from '@ohos.app.form.formProvider'; - - let formId = "12400633174999288"; - let obj = formBindingData.createFormBindingData({temperature:"22c", time:"22:00"}); + let formId = '12400633174999288'; + let obj = formBindingData.createFormBindingData({temperature:'22c', time:'22:00'}); formProvider.updateForm(formId, obj).then(() => { - console.log('formProvider updateForm success'); + console.log('formProvider updateForm success'); }).catch((error) => { - console.log('formProvider updateForm, error:' + JSON.stringify(error)); + console.log('formProvider updateForm, error:' + JSON.stringify(error)); }); ``` @@ -154,19 +146,17 @@ Obtains the application's widget information on the device. This API uses an asy | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------- | -| callback | AsyncCallback<Array<[formInfo.FormInfo](./js-apis-application-formInfo.md#forminfo-1)>> | Yes| Callback used to return the information obtained.| +| callback | AsyncCallback<Array<[FormInfo](./js-apis-application-formInfo.md#forminfo-1)>> | Yes| Callback used to return the information obtained.| **Example** ```ts -import formProvider from '@ohos.app.form.formProvider'; - formProvider.getFormsInfo((error, data) => { - if (error.code) { - console.log('formProvider getFormsInfo, error:' + JSON.stringify(error)); - } else { - console.log('formProvider getFormsInfo, data:' + JSON.stringify(data)); - } + if (error.code) { + console.log('formProvider getFormsInfo, error:' + JSON.stringify(error)); + } else { + console.log('formProvider getFormsInfo, data:' + JSON.stringify(data)); + } }); ``` ## getFormsInfo9+ @@ -182,24 +172,22 @@ Obtains the application's widget information that meets a filter criterion on th | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------- | | filter | [formInfo.FormInfoFilter](./js-apis-application-formInfo.md#forminfofilter) | Yes| Filter criterion.| -| callback | AsyncCallback<Array<[formInfo.FormInfo](./js-apis-application-formInfo.md#forminfo-1)>> | Yes| Callback used to return the information obtained.| +| callback | AsyncCallback<Array<[FormInfo](./js-apis-application-formInfo.md#forminfo-1)>> | Yes| Callback used to return the information obtained.| **Example** ```ts import formInfo from '@ohos.application.formInfo'; -import formProvider from '@ohos.app.form.formProvider'; - const filter : formInfo.FormInfoFilter = { - // get info of forms belong to module entry. - moduleName : "entry" + // get info of forms belong to module entry. + moduleName : 'entry' }; formProvider.getFormsInfo(filter, (error, data) => { - if (error.code) { - console.log('formProvider getFormsInfo, error:' + JSON.stringify(error)); - } else { - console.log('formProvider getFormsInfo, data:' + JSON.stringify(data)); - } + if (error.code) { + console.log('formProvider getFormsInfo, error:' + JSON.stringify(error)); + } else { + console.log('formProvider getFormsInfo, data:' + JSON.stringify(data)); + } }); ``` @@ -221,22 +209,20 @@ Obtains the application's widget information on the device. This API uses a prom | Type | Description | | :------------ | :---------------------------------- | -| Promise<Array<[formInfo.FormInfo](./js-apis-application-formInfo.md#forminfo-1)>> | Promise used to return the information obtained.| +| Promise<Array<[FormInfo](./js-apis-application-formInfo.md#forminfo-1)>> | Promise used to return the information obtained.| **Example** ```ts import formInfo from '@ohos.application.formInfo'; -import formProvider from '@ohos.app.form.formProvider'; - const filter : formInfo.FormInfoFilter = { - // get info of forms belong to module entry. - moduleName : "entry" + // get info of forms belong to module entry. + moduleName : 'entry' }; formProvider.getFormsInfo(filter).then((data) => { - console.log('formProvider getFormsInfo, data:' + JSON.stringify(data)); + console.log('formProvider getFormsInfo, data:' + JSON.stringify(data)); }).catch((error) => { - console.log('formProvider getFormsInfo, error:' + JSON.stringify(error)); + console.log('formProvider getFormsInfo, error:' + JSON.stringify(error)); }); ``` @@ -255,29 +241,28 @@ Requests to publish a widget carrying data to the widget host. This API uses an | Name| Type | Mandatory| Description | | ------ | ---------------------------------------------------------------------- | ---- | ---------------- | | want | [Want](js-apis-application-want.md) | Yes | Request used for publishing. The following fields must be included:
Information about the target widget.
**abilityName**: ability of the target widget.
**parameters**:
"ohos.extra.param.key.form_dimension"
"ohos.extra.param.key.form_name"
"ohos.extra.param.key.module_name" | -| formBindingData | [formBindingData.FormBindingData](js-apis-application-formBindingData.md#formbindingdata) | Yes | Data used for creating the widget.| +| formBindingData.FormBindingData | [FormBindingData](js-apis-application-formBindingData.md#formbindingdata) | Yes | Data used for creating the widget.| | callback | AsyncCallback<string> | Yes| Callback used to return the widget ID.| **Example** ```ts import formBindingData from '@ohos.application.formBindingData'; - import formProvider from '@ohos.app.form.formProvider'; let want = { - abilityName: "FormAbility", - parameters: { - "ohos.extra.param.key.form_dimension": 2, - "ohos.extra.param.key.form_name": "widget", - "ohos.extra.param.key.module_name": "entry" - } + abilityName: 'FormAbility', + parameters: { + 'ohos.extra.param.key.form_dimension': 2, + 'ohos.extra.param.key.form_name': 'widget', + 'ohos.extra.param.key.module_name': 'entry' + } }; - let obj = formBindingData.createFormBindingData({temperature:"22c", time:"22:00"}); + let obj = formBindingData.createFormBindingData({temperature:'22c', time:'22:00'}); formProvider.requestPublishForm(want, obj, (error, data) => { - if (error.code) { - console.log('formProvider requestPublishForm, error: ' + JSON.stringify(error)); - } else { - console.log('formProvider requestPublishForm, form ID is: ' + JSON.stringify(data)); - } + if (error.code) { + console.log('formProvider requestPublishForm, error: ' + JSON.stringify(error)); + } else { + console.log('formProvider requestPublishForm, form ID is: ' + JSON.stringify(data)); + } }); ``` @@ -301,22 +286,20 @@ Requests to publish a widget to the widget host. This API uses an asynchronous c **Example** ```ts - import formProvider from '@ohos.app.form.formProvider'; - let want = { - abilityName: "FormAbility", - parameters: { - "ohos.extra.param.key.form_dimension": 2, - "ohos.extra.param.key.form_name": "widget", - "ohos.extra.param.key.module_name": "entry" - } + abilityName: 'FormAbility', + parameters: { + 'ohos.extra.param.key.form_dimension': 2, + 'ohos.extra.param.key.form_name': 'widget', + 'ohos.extra.param.key.module_name': 'entry' + } }; formProvider.requestPublishForm(want, (error, data) => { - if (error.code) { - console.log('formProvider requestPublishForm, error: ' + JSON.stringify(error)); - } else { - console.log('formProvider requestPublishForm, form ID is: ' + JSON.stringify(data)); - } + if (error.code) { + console.log('formProvider requestPublishForm, error: ' + JSON.stringify(error)); + } else { + console.log('formProvider requestPublishForm, form ID is: ' + JSON.stringify(data)); + } }); ``` @@ -335,7 +318,7 @@ Requests to publish a widget to the widget host. This API uses a promise to retu | Name | Type | Mandatory| Description | | --------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | want | [Want](js-apis-application-want.md) | Yes | Request used for publishing. The following fields must be included:
Information about the target widget.
**abilityName**: ability of the target widget.
**parameters**:
"ohos.extra.param.key.form_dimension"
"ohos.extra.param.key.form_name"
"ohos.extra.param.key.module_name" | -| formBindingData | [formBindingData.FormBindingData](js-apis-application-formBindingData.md#formbindingdata) | Yes | Data used for creating the widget.| +| formBindingData.FormBindingData | [FormBindingData](js-apis-application-formBindingData.md#formbindingdata) | Yes | Data used for creating the widget.| **Return value** @@ -346,20 +329,18 @@ Requests to publish a widget to the widget host. This API uses a promise to retu **Example** ```ts - import formProvider from '@ohos.app.form.formProvider'; - let want = { - abilityName: "FormAbility", - parameters: { - "ohos.extra.param.key.form_dimension": 2, - "ohos.extra.param.key.form_name": "widget", - "ohos.extra.param.key.module_name": "entry" - } + abilityName: 'FormAbility', + parameters: { + 'ohos.extra.param.key.form_dimension': 2, + 'ohos.extra.param.key.form_name': 'widget', + 'ohos.extra.param.key.module_name': 'entry' + } }; formProvider.requestPublishForm(want).then((data) => { - console.log('formProvider requestPublishForm success, form ID is :' + JSON.stringify(data)); + console.log('formProvider requestPublishForm success, form ID is :' + JSON.stringify(data)); }).catch((error) => { - console.log('formProvider requestPublishForm, error: ' + JSON.stringify(error)); + console.log('formProvider requestPublishForm, error: ' + JSON.stringify(error)); }); ``` @@ -388,12 +369,12 @@ formProvider.isRequestPublishFormSupported((error, isSupported) => { } else { if (isSupported) { let want = { - abilityName: "FormAbility", - parameters: { - "ohos.extra.param.key.form_dimension": 2, - "ohos.extra.param.key.form_name": "widget", - "ohos.extra.param.key.module_name": "entry" - } + abilityName: 'FormAbility', + parameters: { + 'ohos.extra.param.key.form_dimension': 2, + 'ohos.extra.param.key.form_name': 'widget', + 'ohos.extra.param.key.module_name': 'entry' + } }; formProvider.requestPublishForm(want, (error, data) => { if (error.code) { @@ -429,12 +410,12 @@ Checks whether a widget can be published to the widget host. This API uses a pro formProvider.isRequestPublishFormSupported().then((isSupported) => { if (isSupported) { let want = { - abilityName: "FormAbility", - parameters: { - "ohos.extra.param.key.form_dimension": 2, - "ohos.extra.param.key.form_name": "widget", - "ohos.extra.param.key.module_name": "entry" - } + abilityName: 'FormAbility', + parameters: { + 'ohos.extra.param.key.form_dimension': 2, + 'ohos.extra.param.key.form_name': 'widget', + 'ohos.extra.param.key.module_name': 'entry' + } }; formProvider.requestPublishForm(want).then((data) => { console.log('formProvider requestPublishForm success, form ID is :' + JSON.stringify(data)); @@ -445,4 +426,4 @@ formProvider.isRequestPublishFormSupported().then((isSupported) => { }).catch((error) => { console.log('formProvider isRequestPublishFormSupported, error:' + JSON.stringify(error)); }); -``` +``` \ No newline at end of file diff --git a/en/application-dev/reference/apis/js-apis-application-missionManager.md b/en/application-dev/reference/apis/js-apis-application-missionManager.md index 17de66e19334dce9663017c3df9c18b575e14bd7..21501d5710ad7435acafbe8d66892d04b2f45da9 100644 --- a/en/application-dev/reference/apis/js-apis-application-missionManager.md +++ b/en/application-dev/reference/apis/js-apis-application-missionManager.md @@ -4,12 +4,12 @@ The **missionManager** module provides APIs to lock, unlock, and clear missions, > **NOTE** > -> The APIs of this module are supported since API version 8 and deprecated since API version 9. You are advised to use [@ohos.app.ability.missionManager](js-apis-app-ability-missionManager.md) instead. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> The APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. ## Modules to Import ```ts -import missionManager from '@ohos.application.missionManager' +import missionManager from '@ohos.application.missionManager'; ``` ## Required Permissions @@ -43,17 +43,17 @@ Registers a listener to observe the mission status. **Example** ```ts -var listener = { - onMissionCreated: function (mission) {console.log("--------onMissionCreated-------")}, - onMissionDestroyed: function (mission) {console.log("--------onMissionDestroyed-------")}, - onMissionSnapshotChanged: function (mission) {console.log("--------onMissionSnapshotChanged-------")}, - onMissionMovedToFront: function (mission) {console.log("--------onMissionMovedToFront-------")}, - onMissionIconUpdated: function (mission, icon) {console.log("--------onMissionIconUpdated-------")}, - onMissionClosed: function (mission) {console.log("--------onMissionClosed-------")}, - onMissionLabelUpdated: function (mission) {console.log("--------onMissionLabelUpdated-------")} +let listener = { + onMissionCreated: function (mission) {console.log('--------onMissionCreated-------');}, + onMissionDestroyed: function (mission) {console.log('--------onMissionDestroyed-------');}, + onMissionSnapshotChanged: function (mission) {console.log('--------onMissionSnapshotChanged-------');}, + onMissionMovedToFront: function (mission) {console.log('--------onMissionMovedToFront-------');}, + onMissionIconUpdated: function (mission, icon) {console.log('--------onMissionIconUpdated-------');}, + onMissionClosed: function (mission) {console.log('--------onMissionClosed-------');}, + onMissionLabelUpdated: function (mission) {console.log('--------onMissionLabelUpdated-------');} }; -console.log("registerMissionListener") -var listenerid = missionManager.registerMissionListener(listener); +console.log('registerMissionListener'); +let listenerid = missionManager.registerMissionListener(listener); ``` @@ -79,21 +79,21 @@ Deregisters a mission status listener. This API uses an asynchronous callback to **Example** ```ts - var listener = { - onMissionCreated: function (mission) {console.log("--------onMissionCreated-------")}, - onMissionDestroyed: function (mission) {console.log("--------onMissionDestroyed-------")}, - onMissionSnapshotChanged: function (mission) {console.log("--------onMissionSnapshotChanged-------")}, - onMissionMovedToFront: function (mission) {console.log("--------onMissionMovedToFront-------")}, - onMissionIconUpdated: function (mission, icon) {console.log("--------onMissionIconUpdated-------")}, - onMissionClosed: function (mission) {console.log("--------onMissionClosed-------")}, - onMissionLabelUpdated: function (mission) {console.log("--------onMissionLabelUpdated-------")} + let listener = { + onMissionCreated: function (mission) {console.log('--------onMissionCreated-------');}, + onMissionDestroyed: function (mission) {console.log('--------onMissionDestroyed-------');}, + onMissionSnapshotChanged: function (mission) {console.log('--------onMissionSnapshotChanged-------');}, + onMissionMovedToFront: function (mission) {console.log('--------onMissionMovedToFront-------');}, + onMissionIconUpdated: function (mission, icon) {console.log('--------onMissionIconUpdated-------');}, + onMissionClosed: function (mission) {console.log('--------onMissionClosed-------');}, + onMissionLabelUpdated: function (mission) {console.log('--------onMissionLabelUpdated-------');} }; - console.log("registerMissionListener") - var listenerid = missionManager.registerMissionListener(listener); + console.log('registerMissionListener'); + let listenerid = missionManager.registerMissionListener(listener); missionManager.unregisterMissionListener(listenerid, (error) => { - console.log("unregisterMissionListener"); - }) + console.log('unregisterMissionListener'); + }); ``` @@ -124,17 +124,17 @@ Deregisters a mission status listener. This API uses a promise to return the res **Example** ```ts - var listener = { - onMissionCreated: function (mission) {console.log("--------onMissionCreated-------")}, - onMissionDestroyed: function (mission) {console.log("--------onMissionDestroyed-------")}, - onMissionSnapshotChanged: function (mission) {console.log("--------onMissionSnapshotChanged-------")}, - onMissionMovedToFront: function (mission) {console.log("--------onMissionMovedToFront-------")}, - onMissionIconUpdated: function (mission, icon) {console.log("--------onMissionIconUpdated-------")}, - onMissionClosed: function (mission) {console.log("--------onMissionClosed-------")}, - onMissionLabelUpdated: function (mission) {console.log("--------onMissionLabelUpdated-------")} + let listener = { + onMissionCreated: function (mission) {console.log('--------onMissionCreated-------');}, + onMissionDestroyed: function (mission) {console.log('--------onMissionDestroyed-------');}, + onMissionSnapshotChanged: function (mission) {console.log('--------onMissionSnapshotChanged-------');}, + onMissionMovedToFront: function (mission) {console.log('--------onMissionMovedToFront-------');}, + onMissionIconUpdated: function (mission, icon) {console.log('--------onMissionIconUpdated-------');}, + onMissionClosed: function (mission) {console.log('--------onMissionClosed-------');}, + onMissionLabelUpdated: function (mission) {console.log('--------onMissionLabelUpdated-------');} }; - console.log("registerMissionListener") - var listenerid = missionManager.registerMissionListener(listener); + console.log('registerMissionListener'); + let listenerid = missionManager.registerMissionListener(listener); missionManager.unregisterMissionListener(listenerid).catch(function (err) { console.log(err); @@ -167,20 +167,15 @@ Obtains the information about a given mission. This API uses an asynchronous cal ```ts import missionManager from '@ohos.application.missionManager' - var allMissions=missionManager.getMissionInfos("",10).catch(function(err){console.log(err);}); - missionManager.getMissionInfo("", allMissions[0].missionId, (error, mission) => { - if (error.code) { - console.log("getMissionInfo failed, error.code:" + JSON.stringify(error.code) + - "error.message:" + JSON.stringify(error.message)); - return; - } - - console.log("mission.missionId = " + mission.missionId); - console.log("mission.runningState = " + mission.runningState); - console.log("mission.lockedState = " + mission.lockedState); - console.log("mission.timestamp = " + mission.timestamp); - console.log("mission.label = " + mission.label); - console.log("mission.iconPath = " + mission.iconPath); + let allMissions=missionManager.getMissionInfos('',10).catch(function(err){console.log(err);}); + missionManager.getMissionInfo('', allMissions[0].missionId, (error, mission) => { + console.log('getMissionInfo is called, error.code = ' + error.code) + console.log('mission.missionId = ' + mission.missionId); + console.log('mission.runningState = ' + mission.runningState); + console.log('mission.lockedState = ' + mission.lockedState); + console.log('mission.timestamp = ' + mission.timestamp); + console.log('mission.label = ' + mission.label); + console.log('mission.iconPath = ' + mission.iconPath); }); ``` @@ -213,9 +208,9 @@ Obtains the information about a given mission. This API uses a promise to return **Example** ```ts - import missionManager from '@ohos.application.missionManager' + import missionManager from '@ohos.application.missionManager'; - var mission = missionManager.getMissionInfo("", 10).catch(function (err){ + let mission = missionManager.getMissionInfo('', 10).catch(function (err){ console.log(err); }); ``` @@ -244,17 +239,13 @@ Obtains information about all missions. This API uses an asynchronous callback t **Example** ```ts - import missionManager from '@ohos.application.missionManager' + import missionManager from '@ohos.application.missionManager'; - missionManager.getMissionInfos("", 10, (error, missions) => { - if (error.code) { - console.log("getMissionInfos failed, error.code:" + JSON.stringify(error.code) + - "error.message:" + JSON.stringify(error.message)); - return; - } - console.log("size = " + missions.length); - console.log("missions = " + JSON.stringify(missions)); - }) + missionManager.getMissionInfos('', 10, (error, missions) => { + console.log('getMissionInfos is called, error.code = ' + error.code); + console.log('size = ' + missions.length); + console.log('missions = ' + JSON.stringify(missions)); + }); ``` @@ -286,9 +277,9 @@ Obtains information about all missions. This API uses a promise to return the re **Example** ```ts - import missionManager from '@ohos.application.missionManager' + import missionManager from '@ohos.application.missionManager'; - var allMissions = missionManager.getMissionInfos("", 10).catch(function (err){ + let allMissions = missionManager.getMissionInfos('', 10).catch(function (err){ console.log(err); }); ``` @@ -317,27 +308,19 @@ Obtains the snapshot of a given mission. This API uses an asynchronous callback **Example** ```ts - import missionManager from '@ohos.application.missionManager' + import missionManager from '@ohos.application.missionManager'; + + missionManager.getMissionInfos('', 10, (error, missions) => { + console.log('getMissionInfos is called, error.code = ' + error.code); + console.log('size = ' + missions.length); + console.log('missions = ' + JSON.stringify(missions)); + let id = missions[0].missionId; - missionManager.getMissionInfos("", 10, (error, missions) => { - if (error.code) { - console.log("getMissionInfos failed, error.code:" + JSON.stringify(error.code) + - "error.message:" + JSON.stringify(error.message)); - return; - } - console.log("size = " + missions.length); - console.log("missions = " + JSON.stringify(missions)); - var id = missions[0].missionId; - - missionManager.getMissionSnapShot("", id, (error, snapshot) => { - if (error.code) { - console.log("getMissionSnapShot failed, error.code:" + JSON.stringify(error.code) + - "error.message:" + JSON.stringify(error.message)); - return; - } - console.log("bundleName = " + snapshot.ability.bundleName); - }) - }) + missionManager.getMissionSnapShot('', id, (error, snapshot) => { + console.log('getMissionSnapShot is called, error.code = ' + error.code); + console.log('bundleName = ' + snapshot.ability.bundleName); + }); + }); ``` @@ -369,17 +352,17 @@ Obtains the snapshot of a given mission. This API uses a promise to return the r **Example** ```ts - import missionManager from '@ohos.application.missionManager' + import missionManager from '@ohos.application.missionManager'; - var allMissions; - missionManager.getMissionInfos("",10).then(function(res){ + let allMissions; + missionManager.getMissionInfos('',10).then(function(res){ allMissions=res; }).catch(function(err){console.log(err);}); - console.log("size = " + allMissions.length); - console.log("missions = " + JSON.stringify(allMissions)); - var id = allMissions[0].missionId; + console.log('size = ' + allMissions.length); + console.log('missions = ' + JSON.stringify(allMissions)); + let id = allMissions[0].missionId; - var snapshot = missionManager.getMissionSnapShot("", id).catch(function (err){ + let snapshot = missionManager.getMissionSnapShot('', id).catch(function (err){ console.log(err); }); ``` @@ -407,27 +390,19 @@ Obtains the low-resolution snapshot of a given mission. This API uses an asynchr **Example** ```ts - import missionManager from '@ohos.application.missionManager' + import missionManager from '@ohos.application.missionManager'; + + missionManager.getMissionInfos('', 10, (error, missions) => { + console.log('getMissionInfos is called, error.code = ' + error.code); + console.log('size = ' + missions.length); + console.log('missions = ' + JSON.stringify(missions)); + let id = missions[0].missionId; - missionManager.getMissionInfos("", 10, (error, missions) => { - if (error.code) { - console.log("getMissionInfos failed, error.code:" + JSON.stringify(error.code) + - "error.message:" + JSON.stringify(error.message)); - return; - } - console.log("size = " + missions.length); - console.log("missions = " + JSON.stringify(missions)); - var id = missions[0].missionId; - - missionManager.getLowResolutionMissionSnapShot("", id, (error, snapshot) => { - if (error.code) { - console.log("getLowResolutionMissionSnapShot failed, error.code:" + JSON.stringify(error.code) + - "error.message:" + JSON.stringify(error.message)); - return; - } - console.log("bundleName = " + snapshot.ability.bundleName); - }) - }) + missionManager.getLowResolutionMissionSnapShot('', id, (error, snapshot) => { + console.log('getLowResolutionMissionSnapShot is called, error.code = ' + error.code); + console.log('bundleName = ' + snapshot.ability.bundleName); + }); + }); ``` @@ -459,17 +434,17 @@ Obtains the low-resolution snapshot of a given mission. This API uses a promise **Example** ```ts - import missionManager from '@ohos.application.missionManager' + import missionManager from '@ohos.application.missionManager'; - var allMissions; - missionManager.getMissionInfos("",10).then(function(res){ + let allMissions; + missionManager.getMissionInfos('',10).then(function(res){ allMissions=res; }).catch(function(err){console.log(err);}); - console.log("size = " + allMissions.length); - console.log("missions = " + JSON.stringify(allMissions)); - var id = allMissions[0].missionId; + console.log('size = ' + allMissions.length); + console.log('missions = ' + JSON.stringify(allMissions)); + let id = allMissions[0].missionId; - var snapshot = missionManager.getLowResolutionMissionSnapShot("", id).catch(function (err){ + let snapshot = missionManager.getLowResolutionMissionSnapShot('', id).catch(function (err){ console.log(err); }); ``` @@ -497,20 +472,16 @@ Locks a given mission. This API uses an asynchronous callback to return the resu **Example** ```ts - import missionManager from '@ohos.application.missionManager' + import missionManager from '@ohos.application.missionManager'; - missionManager.getMissionInfos("", 10, (error, missions) => { - if (error.code) { - console.log("getMissionInfos failed, error.code:" + JSON.stringify(error.code) + - "error.message:" + JSON.stringify(error.message)); - return; - } - console.log("size = " + missions.length); - console.log("missions = " + JSON.stringify(missions)); - var id = missions[0].missionId; + missionManager.getMissionInfos('', 10, (error, missions) => { + console.log('getMissionInfos is called, error.code = ' + error.code); + console.log('size = ' + missions.length); + console.log('missions = ' + JSON.stringify(missions)); + let id = missions[0].missionId; missionManager.lockMission(id).then(() => { - console.log("lockMission is called "); + console.log('lockMission is called '); }); }); ``` @@ -543,14 +514,14 @@ Locks a given mission. This API uses a promise to return the result. **Example** ```ts - import missionManager from '@ohos.application.missionManager' - var allMissions; - missionManager.getMissionInfos("",10).then(function(res){ + import missionManager from '@ohos.application.missionManager'; + let allMissions; + missionManager.getMissionInfos('',10).then(function(res){ allMissions=res; }).catch(function(err){console.log(err);}); - console.log("size = " + allMissions.length); - console.log("missions = " + JSON.stringify(allMissions)); - var id = allMissions[0].missionId; + console.log('size = ' + allMissions.length); + console.log('missions = ' + JSON.stringify(allMissions)); + let id = allMissions[0].missionId; missionManager.lockMission(id).catch(function (err){ console.log(err); @@ -580,20 +551,16 @@ Unlocks a given mission. This API uses an asynchronous callback to return the re **Example** ```ts - import missionManager from '@ohos.application.missionManager' + import missionManager from '@ohos.application.missionManager'; - missionManager.getMissionInfos("", 10, (error, missions) => { - if (error.code) { - console.log("getMissionInfos failed, error.code:" + JSON.stringify(error.code) + - "error.message:" + JSON.stringify(error.message)); - return; - } - console.log("size = " + missions.length); - console.log("missions = " + JSON.stringify(missions)); - var id = missions[0].missionId; + missionManager.getMissionInfos('', 10, (error, missions) => { + console.log('getMissionInfos is called, error.code = ' + error.code); + console.log('size = ' + missions.length); + console.log('missions = ' + JSON.stringify(missions)); + let id = missions[0].missionId; missionManager.unlockMission(id).then(() => { - console.log("unlockMission is called "); + console.log('unlockMission is called '); }); }); ``` @@ -626,15 +593,15 @@ Unlocks a given mission. This API uses a promise to return the result. **Example** ```ts - import missionManager from '@ohos.application.missionManager' + import missionManager from '@ohos.application.missionManager'; - var allMissions; - missionManager.getMissionInfos("",10).then(function(res){ + let allMissions; + missionManager.getMissionInfos('',10).then(function(res){ allMissions=res; }).catch(function(err){console.log(err);}); - console.log("size = " + allMissions.length); - console.log("missions = " + JSON.stringify(allMissions)); - var id = allMissions[0].missionId; + console.log('size = ' + allMissions.length); + console.log('missions = ' + JSON.stringify(allMissions)); + let id = allMissions[0].missionId; missionManager.lockMission(id).catch(function (err){ console.log(err); @@ -667,20 +634,16 @@ Clears a given mission, regardless of whether it is locked. This API uses an asy **Example** ```ts - import missionManager from '@ohos.application.missionManager' + import missionManager from '@ohos.application.missionManager'; - missionManager.getMissionInfos("", 10, (error, missions) => { - if (error.code) { - console.log("getMissionInfos failed, error.code:" + JSON.stringify(error.code) + - "error.message:" + JSON.stringify(error.message)); - return; - } - console.log("size = " + missions.length); - console.log("missions = " + JSON.stringify(missions)); - var id = missions[0].missionId; + missionManager.getMissionInfos('', 10, (error, missions) => { + console.log('getMissionInfos is called, error.code = ' + error.code); + console.log('size = ' + missions.length); + console.log('missions = ' + JSON.stringify(missions)); + let id = missions[0].missionId; missionManager.clearMission(id).then(() => { - console.log("clearMission is called "); + console.log('clearMission is called '); }); }); ``` @@ -713,15 +676,15 @@ Clears a given mission, regardless of whether it is locked. This API uses a prom **Example** ```ts - import missionManager from '@ohos.application.missionManager' + import missionManager from '@ohos.application.missionManager'; - var allMissions; - missionManager.getMissionInfos("",10).then(function(res){ + let allMissions; + missionManager.getMissionInfos('',10).then(function(res){ allMissions=res; }).catch(function(err){console.log(err);}); - console.log("size = " + allMissions.length); - console.log("missions = " + JSON.stringify(allMissions)); - var id = allMissions[0].missionId; + console.log('size = ' + allMissions.length); + console.log('missions = ' + JSON.stringify(allMissions)); + let id = allMissions[0].missionId; missionManager.clearMission(id).catch(function (err){ console.log(err); @@ -744,10 +707,10 @@ Clears all unlocked missions. This API uses an asynchronous callback to return t **Example** ```ts - import missionManager from '@ohos.application.missionManager' + import missionManager from '@ohos.application.missionManager'; missionManager.clearAllMissions().then(() => { - console.log("clearAllMissions is called "); + console.log('clearAllMissions is called '); }); ``` @@ -773,7 +736,7 @@ Clears all unlocked missions. This API uses a promise to return the result. **Example** ```ts - import missionManager from '@ohos.application.missionManager' + import missionManager from '@ohos.application.missionManager'; missionManager.clearAllMissions().catch(function (err){ console.log(err); }); @@ -802,20 +765,16 @@ Switches a given mission to the foreground. This API uses an asynchronous callba **Example** ```ts - import missionManager from '@ohos.application.missionManager' + import missionManager from '@ohos.application.missionManager'; - missionManager.getMissionInfos("", 10, (error, missions) => { - if (error.code) { - console.log("getMissionInfos failed, error.code:" + JSON.stringify(error.code) + - "error.message:" + JSON.stringify(error.message)); - return; - } - console.log("size = " + missions.length); - console.log("missions = " + JSON.stringify(missions)); - var id = missions[0].missionId; + missionManager.getMissionInfos('', 10, (error, missions) => { + console.log('getMissionInfos is called, error.code = ' + error.code); + console.log('size = ' + missions.length); + console.log('missions = ' + JSON.stringify(missions)); + let id = missions[0].missionId; missionManager.moveMissionToFront(id).then(() => { - console.log("moveMissionToFront is called "); + console.log('moveMissionToFront is called '); }); }); ``` @@ -838,26 +797,22 @@ Switches a given mission to the foreground, with the startup parameters for the | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | missionId | number | Yes| Mission ID.| - | options | [StartOptions](js-apis-application-startOptions.md) | Yes| Startup parameters, which are used to specify the window mode and device ID for switching the mission to the foreground.| + | options | [StartOptions](js-apis-app-ability-startOptions.md) | Yes| Startup parameters, which are used to specify the window mode and device ID for switching the mission to the foreground.| | callback | AsyncCallback<void> | Yes| Callback used to return the result.| **Example** ```ts - import missionManager from '@ohos.application.missionManager' + import missionManager from '@ohos.application.missionManager'; - missionManager.getMissionInfos("", 10, (error, missions) => { - if (error.code) { - console.log("getMissionInfos failed, error.code:" + JSON.stringify(error.code) + - "error.message:" + JSON.stringify(error.message)); - return; - } - console.log("size = " + missions.length); - console.log("missions = " + JSON.stringify(missions)); - var id = missions[0].missionId; + missionManager.getMissionInfos('', 10, (error, missions) => { + console.log('getMissionInfos is called, error.code = ' + error.code); + console.log('size = ' + missions.length); + console.log('missions = ' + JSON.stringify(missions)); + let id = missions[0].missionId; missionManager.moveMissionToFront(id,{windowMode : 101}).then(() => { - console.log("moveMissionToFront is called "); + console.log('moveMissionToFront is called '); }); }); ``` @@ -880,7 +835,7 @@ Switches a given mission to the foreground, with the startup parameters for the | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | missionId | number | Yes| Mission ID.| - | options | [StartOptions](js-apis-application-startOptions.md) | No| Startup parameters, which are used to specify the window mode and device ID for switching the mission to the foreground.| + | options | [StartOptions](js-apis-app-ability-startOptions.md) | No| Startup parameters, which are used to specify the window mode and device ID for switching the mission to the foreground.| **Return value** @@ -891,15 +846,15 @@ Switches a given mission to the foreground, with the startup parameters for the **Example** ```ts - import missionManager from '@ohos.application.missionManager' + import missionManager from '@ohos.application.missionManager'; - var allMissions; - missionManager.getMissionInfos("",10).then(function(res){ + let allMissions; + missionManager.getMissionInfos('',10).then(function(res){ allMissions=res; }).catch(function(err){console.log(err);}); - console.log("size = " + allMissions.length); - console.log("missions = " + JSON.stringify(allMissions)); - var id = allMissions[0].missionId; + console.log('size = ' + allMissions.length); + console.log('missions = ' + JSON.stringify(allMissions)); + let id = allMissions[0].missionId; missionManager.moveMissionToFront(id).catch(function (err){ console.log(err); diff --git a/en/application-dev/reference/apis/js-apis-application-staticSubscriberExtensionAbility.md b/en/application-dev/reference/apis/js-apis-application-staticSubscriberExtensionAbility.md index 5fc9b0999940310b10bf7b4e7227d5651153eb50..d83e3e55f645b38303b2d4252e60ce2181f54099 100644 --- a/en/application-dev/reference/apis/js-apis-application-staticSubscriberExtensionAbility.md +++ b/en/application-dev/reference/apis/js-apis-application-staticSubscriberExtensionAbility.md @@ -10,7 +10,7 @@ The **StaticSubscriberExtensionAbility** module provides Extension abilities for ## Modules to Import ```ts -import StaticSubscriberExtensionAbility from '@ohos.application.StaticSubscriberExtensionAbility' +import StaticSubscriberExtensionAbility from '@ohos.application.StaticSubscriberExtensionAbility'; ``` ## StaticSubscriberExtensionAbility.onReceiveEvent @@ -27,17 +27,14 @@ Callback of the common event of a static subscriber. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| event | [CommonEventData](js-apis-commonEventManager.md#commoneventdata) | Yes| Common event of a static subscriber.| +| event | [CommonEventData](js-apis-commonEvent.md#commoneventdata) | Yes| Common event of a static subscriber.| **Example** ```ts - var StaticSubscriberExtensionAbility = requireNapi("application.StaticSubscriberExtensionAbility") - { - onReceiveEvent(event){ - console.log('onReceiveEvent,event:' + event.code); - } - } - export default MyStaticSubscriberExtensionAbility - + class MyStaticSubscriberExtensionAbility extends StaticSubscriberExtensionAbility { + onReceiveEvent(event) { + console.log('onReceiveEvent, event: ' + JSON.stringify(event)); + } + } ``` diff --git a/en/application-dev/reference/apis/js-apis-application-testRunner.md b/en/application-dev/reference/apis/js-apis-application-testRunner.md index d2146524c0c5249374e21c95762438d35dc48c35..34d272091725be3a4086b6df466f02f4aff38e7c 100644 --- a/en/application-dev/reference/apis/js-apis-application-testRunner.md +++ b/en/application-dev/reference/apis/js-apis-application-testRunner.md @@ -11,7 +11,7 @@ To implement your own unit test framework, extend this class and override its AP ## Modules to Import ```ts -import TestRunner from '@ohos.application.testRunner' +import TestRunner from '@ohos.application.testRunner'; ``` ## TestRunner.onPrepare @@ -27,7 +27,7 @@ Prepares the unit test environment to run test cases. ```ts export default class UserTestRunner implements TestRunner { onPrepare() { - console.log("Trigger onPrepare") + console.log('Trigger onPrepare'); } onRun() {} }; @@ -49,7 +49,7 @@ Runs test cases. export default class UserTestRunner implements TestRunner { onPrepare() {} onRun() { - console.log("Trigger onRun") + console.log('Trigger onRun'); } }; ``` diff --git a/en/application-dev/reference/apis/js-apis-application-want.md b/en/application-dev/reference/apis/js-apis-application-want.md index 44cc01a00c5057488b45a5a6a38cc02adbf1cbc2..bb546edc8038717b5f2f29208f5e864cbac7f338 100644 --- a/en/application-dev/reference/apis/js-apis-application-want.md +++ b/en/application-dev/reference/apis/js-apis-application-want.md @@ -4,7 +4,7 @@ Want is a carrier for information transfer between objects (application componen > **NOTE** > -> The APIs of this module are supported since API version 8 and deprecated since API version 9. You are advised to use [Want](js-apis-app-ability-want.md) instead. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> The APIs of this module are supported since API version 8 and deprecated since API version 9. You are advised to use [@ohos.app.ability.Want](js-apis-app-ability-want.md) instead. Newly added APIs will be marked with a superscript to indicate their earliest API version. ## Modules to Import @@ -18,119 +18,117 @@ import Want from '@ohos.application.Want'; | Name | Type | Mandatory| Description | | ----------- | -------------------- | ---- | ------------------------------------------------------------ | -| deviceId | string | No | ID of the device running the ability. If this field is unspecified, the local device is used. | -| bundleName | string | No | Bundle name.| +| deviceId | string | No | ID of the device running the ability. | +| bundleName | string | No | Bundle name. If both **bundleName** and **abilityName** are specified in a bWantb, the **Want** can directly match the specified ability.| | abilityName | string | No | Name of the ability. If both **bundleName** and **abilityName** are specified in a **Want** object, the **Want** object can match a specific ability. The value of **abilityName** must be unique in an application.| | uri | string | No | URI information to match. If **uri** is specified in a **Want** object, the **Want** object will match the specified URI information, including **scheme**, **schemeSpecificPart**, **authority**, and **path**.| -| type | string | No | MIME type, that is, the type of the file to open, for example, **text/xml** and **image/***. For details about the MIME type definition, see https://www.iana.org/assignments/media-types/media-types.xhtml?utm_source=ld246.com. | +| type | string | No | MIME type, that is, the type of the file to open, for example, **'text/xml'** and **'image/*'**. For details about the MIME type definition, see https://www.iana.org/assignments/media-types/media-types.xhtml?utm_source=ld246.com. | | flags | number | No | How the **Want** object will be handled. By default, numbers are passed in. For details, see [flags](js-apis-ability-wantConstant.md#wantConstant.Flags).| -| action | string | No | Action to take, such as viewing and sharing application details. In implicit **Want**, you can define this attribute and use it together with **uri** or **parameters** to specify the operation to be performed on the data. For details, see [action](js-apis-app-ability-wantConstant.md#wantConstant.Action). For details about the definition and matching rules of implicit Want, see [Matching Rules of Explicit Want and Implicit Want](application-models/explicit-implicit-want-mappings.md). | -| parameters | {[key: string]: any} | No | Want parameters in the form of custom key-value (KV) pairs. By default, the following keys are carried:
**ohos.aafwk.callerPid**: PID of the caller.
**ohos.aafwk.param.callerToken**: token of the caller.
**ohos.aafwk.param.callerUid**: UID in [bundleInfo](js-apis-bundle-BundleInfo.md#bundleinfo-1), that is, the application UID in the bundle information. | -| entities | Array\ | No | Additional category information (such as browser and video player) of the ability. It is a supplement to the **action** field for implicit Want. and is used to filter ability types. For details, see [entity](js-apis-app-ability-wantConstant.md#wantConstant.Entity). | +| action | string | No | Action to take, such as viewing and sharing application details. In implicit **Want**, you can define this attribute and use it together with **uri** or **parameters** to specify the operation to be performed on the data. | +| parameters | {[key: string]: any} | No | Want parameters in the form of custom key-value (KV) pairs. By default, the following keys are carried:
- **ohos.aafwk.callerPid**: PID of the caller.
- **ohos.aafwk.param.callerToken**: token of the caller.
- **ohos.aafwk.param.callerUid**: UID in [bundleInfo](js-apis-bundle-BundleInfo.md#bundleinfo-1), that is, the application UID in the bundle information.
- **component.startup.newRules**: whether to enable the new control rule.
- **moduleName**: module name of the caller. No matter what this field is set to, the correct module name will be sent to the peer.
- **ohos.dlp.params.sandbox**: available only for DLP files. | +| entities | Array\ | No | Additional category information (such as browser and video player) of the ability. It is a supplement to the **action** field for implicit Want. and is used to filter ability types. | | moduleName9+ | string | No | Module to which the ability belongs.| **Example** -- Basic usage (called in a UIAbility object, where context in the example is the context object of the UIAbility). +- Basic usage ```ts let want = { - "deviceId": "", // An empty deviceId indicates the local device. - "bundleName": "com.example.myapplication", - "abilityName": "EntryAbility", - "moduleName": "entry" // moduleName is optional. + 'deviceId': '', // An empty deviceId indicates the local device. + 'bundleName': 'com.extreme.test', + 'abilityName': 'MainAbility', + 'moduleName': 'entry' // moduleName is optional. }; this.context.startAbility(want, (error) => { // Start an ability explicitly. The bundleName, abilityName, and moduleName parameters work together to uniquely identify an ability. - console.log("error.code = " + error.code) - }) + console.log('error.code = ' + error.code) + }); ``` -- Data is transferred through user-defined fields. The following data types are supported (called in a UIAbility object, where context in the example is the context object of the UIAbility): +- Data is transferred through user-defined fields. The following data types are supported: * String ```ts let want = { - bundleName: "com.example.myapplication", - abilityName: "EntryAbility", + bundleName: 'com.example.demo', + abilityName: 'com.example.demo.MainAbility', parameters: { - keyForString: "str", + keyForString: 'str', }, - } + }; ``` * Number ```ts let want = { - bundleName: "com.example.myapplication", - abilityName: "EntryAbility", + bundleName: 'com.example.demo', + abilityName: 'com.example.demo.MainAbility', parameters: { keyForInt: 100, keyForDouble: 99.99, }, - } + }; ``` * Boolean ```ts let want = { - bundleName: "com.example.myapplication", - abilityName: "EntryAbility", + bundleName: 'com.example.demo', + abilityName: 'com.example.demo.MainAbility', parameters: { keyForBool: true, }, - } + }; ``` * Object ```ts let want = { - bundleName: "com.example.myapplication", - abilityName: "EntryAbility", + bundleName: 'com.example.demo', + abilityName: 'com.example.demo.MainAbility', parameters: { keyForObject: { - keyForObjectString: "str", + keyForObjectString: 'str', keyForObjectInt: -200, keyForObjectDouble: 35.5, keyForObjectBool: false, }, }, - } + }; ``` * Array ```ts let want = { - bundleName: "com.example.myapplication", - abilityName: "EntryAbility", + bundleName: 'com.example.demo', + abilityName: 'com.example.demo.MainAbility', parameters: { - keyForArrayString: ["str1", "str2", "str3"], + keyForArrayString: ['str1', 'str2', 'str3'], keyForArrayInt: [100, 200, 300, 400], keyForArrayDouble: [0.1, 0.2], - keyForArrayObject: [{obj1: "aaa"}, {obj2: 100}], + keyForArrayObject: [{obj1: 'aaa'}, {obj2: 100}], }, - } + }; ``` * File descriptor (FD) ```ts import fileio from '@ohos.fileio'; let fd; try { - fd = fileio.openSync("/data/storage/el2/base/haps/pic.png"); + fd = fileio.openSync('/data/storage/el2/base/haps/pic.png'); } catch(e) { - console.log("openSync fail:" + JSON.stringify(e)); + console.log('openSync fail:' + JSON.stringify(e)); } let want = { - "deviceId": "", // An empty deviceId indicates the local device. - "bundleName": "com.example.myapplication", - "abilityName": "EntryAbility", - "moduleName": "entry", // moduleName is optional. - "parameters": { - "keyFd":{"type":"FD", "value":fd} + 'deviceId': '', // An empty deviceId indicates the local device. + 'bundleName': 'com.extreme.test', + 'abilityName': 'MainAbility', + 'moduleName': 'entry', // moduleName is optional. + 'parameters': { + 'keyFd':{'type':'FD', 'value':fd} } }; this.context.startAbility(want, (error) => { // Start an ability explicitly. The bundleName, abilityName, and moduleName parameters work together to uniquely identify an ability. - console.log("error.code = " + error.code) - }) + console.log('error.code = ' + error.code) + }); ``` -- For more details and examples, see [Want](../../application-models/want-overview.md). - diff --git a/en/application-dev/reference/apis/js-apis-application-windowExtensionAbility.md b/en/application-dev/reference/apis/js-apis-application-windowExtensionAbility.md index bd6d74bbcbbdb4b0d29ccad209b012a11f44c9af..535de4e3f89582b94b486e65aac69e301524d285 100644 --- a/en/application-dev/reference/apis/js-apis-application-windowExtensionAbility.md +++ b/en/application-dev/reference/apis/js-apis-application-windowExtensionAbility.md @@ -5,7 +5,7 @@ > **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. > > The APIs of this module can be used only in the stage model. @@ -22,7 +22,7 @@ import WindowExtensionAbility from '@ohos.application.WindowExtensionAbility'; | Name | Type| Readable| Writable| Description | | --------- | -------- | ---- | ---- | ------------------------- | -| context | [ExtensionContext](js-apis-inner-application-extensionContext.md) | Yes | No | Context of an Extension ability. | +| context | [WindowExtensionContext](js-apis-inner-application-windowExtensionContext.md) | Yes | No | Context of an Extension ability. | ## WindowExtensionAbility.onConnect @@ -101,9 +101,9 @@ export default class MyWindowExtensionAbility extends WindowExtensionAbility { window.loadContent('WindowExtAbility/pages/index1').then(() => { window.getProperties().then((pro) => { console.log('WindowExtension ' + JSON.stringify(pro)); - }) + }); window.show(); - }) + }); } } diff --git a/en/application-dev/reference/apis/js-apis-arraylist.md b/en/application-dev/reference/apis/js-apis-arraylist.md index ebf538d3b5508c1ee26aa77d4db01aa995239c3b..283786a82fd1ce50d7632b9354b99f32ff4419fb 100644 --- a/en/application-dev/reference/apis/js-apis-arraylist.md +++ b/en/application-dev/reference/apis/js-apis-arraylist.md @@ -404,11 +404,9 @@ arrayList.add(2); arrayList.add(4); arrayList.add(5); arrayList.add(4); -arrayList.replaceAllElements((value: number, index: number)=> { - return value = 2 * value; -}); -arrayList.replaceAllElements((value: number, index: number) => { - return value = value - 2; +arrayList.replaceAllElements((value) => { + // Add the user operation logic based on the actual scenario. + return value; }); ``` @@ -453,7 +451,7 @@ arrayList.add(4); arrayList.add(5); arrayList.add(4); arrayList.forEach((value, index) => { - console.log(`value:${value}`, index); + console.log("value:" + value, "index:" + index); }); ``` @@ -796,14 +794,14 @@ arrayList.add(4); // Method 1: for (let item of arrayList) { - console.log(`value:${item}`); + console.log(`value:${item}`); } // Method 2: let iter = arrayList[Symbol.iterator](); let temp = iter.next().value; while(temp != undefined) { - console.log(`value:${temp}`); - temp = iter.next().value; + console.log(`value:${temp}`); + temp = iter.next().value; } ``` diff --git a/en/application-dev/reference/apis/js-apis-audio.md b/en/application-dev/reference/apis/js-apis-audio.md index a992de969d6b6e673b89eff8f14f28f5328ce017..0f4e0f79339043054cd47b5e76e58752012fd48f 100644 --- a/en/application-dev/reference/apis/js-apis-audio.md +++ b/en/application-dev/reference/apis/js-apis-audio.md @@ -75,7 +75,7 @@ Creates an **AudioRenderer** instance. This API uses an asynchronous callback to ```js import featureAbility from '@ohos.ability.featureAbility'; -import fileio from '@ohos.fileio'; +import fs from '@ohos.file.fs'; import audio from '@ohos.multimedia.audio'; let audioStreamInfo = { @@ -130,7 +130,7 @@ Creates an **AudioRenderer** instance. This API uses a promise to return the res ```js import featureAbility from '@ohos.ability.featureAbility'; -import fileio from '@ohos.fileio'; +import fs from '@ohos.file.fs'; import audio from '@ohos.multimedia.audio'; let audioStreamInfo = { @@ -457,7 +457,7 @@ Enumerates the audio sample formats. | SAMPLE_FORMAT_S16LE | 1 | Signed 16-bit integer, little endian.| | SAMPLE_FORMAT_S24LE | 2 | Signed 24-bit integer, little endian.
Due to system restrictions, only some devices support this sampling format.| | SAMPLE_FORMAT_S32LE | 3 | Signed 32-bit integer, little endian.
Due to system restrictions, only some devices support this sampling format.| -| SAMPLE_FORMAT_F32LE9+ | 4 | Signed 32-bit integer, little endian.
Due to system restrictions, only some devices support this sampling format.| +| SAMPLE_FORMAT_F32LE9+ | 4 | Signed 32-bit floating point number, little endian.
Due to system restrictions, only some devices support this sampling format.| ## AudioErrors9+ @@ -529,7 +529,7 @@ Enumerates the audio content types. | CONTENT_TYPE_SPEECH | 1 | Speech. | | CONTENT_TYPE_MUSIC | 2 | Music. | | CONTENT_TYPE_MOVIE | 3 | Movie. | -| CONTENT_TYPE_SONIFICATION | 4 | Sonification content.| +| CONTENT_TYPE_SONIFICATION | 4 | Notification tone. | | CONTENT_TYPE_RINGTONE8+ | 5 | Ringtone. | ## StreamUsage @@ -1757,7 +1757,7 @@ Sets a device to the active state. This API uses an asynchronous callback to ret | Name | Type | Mandatory| Description | | ---------- | ------------------------------------- | ---- | ------------------------ | -| deviceType | [ActiveDeviceType](#activedevicetypedeprecated) | Yes | Audio device type. | +| deviceType | [ActiveDeviceType](#activedevicetypedeprecated) | Yes | Active audio device type. | | active | boolean | Yes | Active state to set. The value **true** means to set the device to the active state, and **false** means the opposite. | | callback | AsyncCallback<void> | Yes | Callback used to return the result.| @@ -1789,7 +1789,7 @@ Sets a device to the active state. This API uses a promise to return the result. | Name | Type | Mandatory| Description | | ---------- | ------------------------------------- | ---- | ------------------ | -| deviceType | [ActiveDeviceType](#activedevicetypedeprecated) | Yes | Audio device type.| +| deviceType | [ActiveDeviceType](#activedevicetypedeprecated) | Yes | Active audio device type. | | active | boolean | Yes | Active state to set. The value **true** means to set the device to the active state, and **false** means the opposite. | **Return value** @@ -1823,7 +1823,7 @@ Checks whether a device is active. This API uses an asynchronous callback to ret | Name | Type | Mandatory| Description | | ---------- | ------------------------------------- | ---- | ------------------------ | -| deviceType | [ActiveDeviceType](#activedevicetypedeprecated) | Yes | Audio device type. | +| deviceType | [ActiveDeviceType](#activedevicetypedeprecated) | Yes | Active audio device type. | | callback | AsyncCallback<boolean> | Yes | Callback used to return the active state of the device.| **Example** @@ -1854,7 +1854,7 @@ Checks whether a device is active. This API uses a promise to return the result. | Name | Type | Mandatory| Description | | ---------- | ------------------------------------- | ---- | ------------------ | -| deviceType | [ActiveDeviceType](#activedevicetypedeprecated) | Yes | Audio device type.| +| deviceType | [ActiveDeviceType](#activedevicetypedeprecated) | Yes | Active audio device type. | **Return value** @@ -3950,6 +3950,7 @@ Describes the audio renderer change event. **Example** ```js + import audio from '@ohos.multimedia.audio'; const audioManager = audio.getAudioManager(); @@ -4054,7 +4055,7 @@ Describes an audio device. | ----------------------------- | ------------------------- | -------- | -------- | ------------------------------------------------------------ | | deviceRole | [DeviceRole](#devicerole) | Yes | No | Device role. | | deviceType | [DeviceType](#devicetype) | Yes | No | Device type. | -| id9+ | number | Yes | No | Device ID. | +| id9+ | number | Yes | No | Device ID, which is unique. | | name9+ | string | Yes | No | Device name. | | address9+ | string | Yes | No | Device address. | | sampleRates9+ | Array<number> | Yes | No | Supported sampling rates. | @@ -4234,7 +4235,6 @@ audioRenderer.getStreamInfo().then((streamInfo) => { }).catch((err) => { console.error(`ERROR: ${err}`); }); - ``` ### getAudioStreamId9+ @@ -4257,7 +4257,6 @@ Obtains the stream ID of this **AudioRenderer** instance. This API uses an async audioRenderer.getAudioStreamId((err, streamid) => { console.info(`Renderer GetStreamId: ${streamid}`); }); - ``` ### getAudioStreamId9+ @@ -4282,7 +4281,6 @@ audioRenderer.getAudioStreamId().then((streamid) => { }).catch((err) => { console.error(`ERROR: ${err}`); }); - ``` ### start8+ @@ -4309,7 +4307,6 @@ audioRenderer.start((err) => { console.info('Renderer start success.'); } }); - ``` ### start8+ @@ -4334,7 +4331,6 @@ audioRenderer.start().then(() => { }).catch((err) => { console.error(`ERROR: ${err}`); }); - ``` ### pause8+ @@ -4361,7 +4357,6 @@ audioRenderer.pause((err) => { console.info('Renderer paused.'); } }); - ``` ### pause8+ @@ -4386,7 +4381,6 @@ audioRenderer.pause().then(() => { }).catch((err) => { console.error(`ERROR: ${err}`); }); - ``` ### drain8+ @@ -4413,7 +4407,6 @@ audioRenderer.drain((err) => { console.info('Renderer drained.'); } }); - ``` ### drain8+ @@ -4438,7 +4431,6 @@ audioRenderer.drain().then(() => { }).catch((err) => { console.error(`ERROR: ${err}`); }); - ``` ### stop8+ @@ -4465,7 +4457,6 @@ audioRenderer.stop((err) => { console.info('Renderer stopped.'); } }); - ``` ### stop8+ @@ -4490,7 +4481,6 @@ audioRenderer.stop().then(() => { }).catch((err) => { console.error(`ERROR: ${err}`); }); - ``` ### release8+ @@ -4517,7 +4507,6 @@ audioRenderer.release((err) => { console.info('Renderer released.'); } }); - ``` ### release8+ @@ -4542,7 +4531,6 @@ audioRenderer.release().then(() => { }).catch((err) => { console.error(`ERROR: ${err}`); }); - ``` ### write8+ @@ -4577,17 +4565,26 @@ async function getCacheDir(){ path = await context.getCacheDir(); } let filePath = path + '/StarWars10s-2C-48000-4SW.wav'; -let ss = fileio.createStreamSync(filePath, 'r'); +let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY); +let stat = await fs.stat(path); let buf = new ArrayBuffer(bufferSize); -ss.readSync(buf); -audioRenderer.write(buf, (err, writtenbytes) => { - if (writtenbytes < 0) { - console.error('write failed.'); - } else { - console.info(`Actual written bytes: ${writtenbytes}`); - } -}); - +let len = stat.size % this.bufferSize == 0 ? Math.floor(stat.size / this.bufferSize) : Math.floor(stat.size / this.bufferSize + 1); +for (let i = 0;i < len; i++) { + let options = { + offset: i * this.bufferSize, + length: this.bufferSize + } + let readsize = await fs.read(file.fd, buf, options) + let writeSize = await new Promise((resolve,reject)=>{ + this.audioRenderer.write(buf,(err,writeSize)=>{ + if(err){ + reject(err) + }else{ + resolve(writeSize) + } + }) + }) +} ``` ### write8+ @@ -4621,19 +4618,22 @@ async function getCacheDir(){ path = await context.getCacheDir(); } let filePath = path + '/StarWars10s-2C-48000-4SW.wav'; -let ss = fileio.createStreamSync(filePath, 'r'); +let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY); +let stat = await fs.stat(path); let buf = new ArrayBuffer(bufferSize); -ss.readSync(buf); -audioRenderer.write(buf).then((writtenbytes) => { - if (writtenbytes < 0) { - console.error('write failed.'); - } else { - console.info(`Actual written bytes: ${writtenbytes}`); - } -}).catch((err) => { - console.error(`ERROR: ${err}`); -}); - +let len = stat.size % this.bufferSize == 0 ? Math.floor(stat.size / this.bufferSize) : Math.floor(stat.size / this.bufferSize + 1); +for (let i = 0;i < len; i++) { + let options = { + offset: i * this.bufferSize, + length: this.bufferSize + } + let readsize = await fs.read(file.fd, buf, options) + try{ + let writeSize = await this.audioRenderer.write(buf); + } catch(err) { + console.error(`audioRenderer.write err: ${err}`); + } +} ``` ### getAudioTime8+ @@ -4656,7 +4656,6 @@ Obtains the number of nanoseconds elapsed from the Unix epoch (January 1, 1970). audioRenderer.getAudioTime((err, timestamp) => { console.info(`Current timestamp: ${timestamp}`); }); - ``` ### getAudioTime8+ @@ -4681,7 +4680,6 @@ audioRenderer.getAudioTime().then((timestamp) => { }).catch((err) => { console.error(`ERROR: ${err}`); }); - ``` ### getBufferSize8+ @@ -4706,7 +4704,6 @@ let bufferSize = audioRenderer.getBufferSize(async(err, bufferSize) => { console.error('getBufferSize error'); } }); - ``` ### getBufferSize8+ @@ -4733,7 +4730,6 @@ audioRenderer.getBufferSize().then((data) => { }).catch((err) => { console.error(`AudioFrameworkRenderLog: getBufferSize: ERROR: ${err}`); }); - ``` ### setRenderRate8+ @@ -4761,7 +4757,6 @@ audioRenderer.setRenderRate(audio.AudioRendererRate.RENDER_RATE_NORMAL, (err) => console.info('Callback invoked to indicate a successful render rate setting.'); } }); - ``` ### setRenderRate8+ @@ -4792,7 +4787,6 @@ audioRenderer.setRenderRate(audio.AudioRendererRate.RENDER_RATE_NORMAL).then(() }).catch((err) => { console.error(`ERROR: ${err}`); }); - ``` ### getRenderRate8+ @@ -4815,7 +4809,6 @@ Obtains the current render rate. This API uses an asynchronous callback to retur audioRenderer.getRenderRate((err, renderrate) => { console.info(`getRenderRate: ${renderrate}`); }); - ``` ### getRenderRate8+ @@ -4840,9 +4833,7 @@ audioRenderer.getRenderRate().then((renderRate) => { }).catch((err) => { console.error(`ERROR: ${err}`); }); - ``` - ### setInterruptMode9+ setInterruptMode(mode: InterruptMode): Promise<void> @@ -4872,9 +4863,7 @@ audioRenderer.setInterruptMode(mode).then(data=>{ }).catch((err) => { console.error(`setInterruptMode Fail: ${err}`); }); - ``` - ### setInterruptMode9+ setInterruptMode(mode: InterruptMode, callback: AsyncCallback\): void @@ -4900,7 +4889,6 @@ audioRenderer.setInterruptMode(mode, (err, data)=>{ } console.info('setInterruptMode Success!'); }); - ``` ### setVolume9+ @@ -4931,9 +4919,7 @@ audioRenderer.setVolume(0.5).then(data=>{ }).catch((err) => { console.error(`setVolume Fail: ${err}`); }); - ``` - ### setVolume9+ setVolume(volume: number, callback: AsyncCallback\): void @@ -4958,7 +4944,6 @@ audioRenderer.setVolume(0.5, (err, data)=>{ } console.info('setVolume Success!'); }); - ``` ### on('audioInterrupt')9+ @@ -5038,7 +5023,6 @@ async function onAudioInterrupt(){ } }); } - ``` ### on('markReach')8+ @@ -5065,7 +5049,6 @@ audioRenderer.on('markReach', 1000, (position) => { console.info('ON Triggered successfully'); } }); - ``` @@ -5087,7 +5070,6 @@ Unsubscribes from mark reached events. ```js audioRenderer.off('markReach'); - ``` ### on('periodReach') 8+ @@ -5114,7 +5096,6 @@ audioRenderer.on('periodReach', 1000, (position) => { console.info('ON Triggered successfully'); } }); - ``` ### off('periodReach') 8+ @@ -5135,10 +5116,9 @@ Unsubscribes from period reached events. ```js audioRenderer.off('periodReach') - ``` -### on('stateChange')8+ +### on('stateChange') 8+ on(type: 'stateChange', callback: Callback): void @@ -5164,7 +5144,6 @@ audioRenderer.on('stateChange', (state) => { console.info('audio renderer state is: STATE_RUNNING'); } }); - ``` ## AudioCapturer8+ @@ -5183,7 +5162,6 @@ Provides APIs for audio capture. Before calling any API in **AudioCapturer**, yo ```js let state = audioCapturer.state; - ``` ### getCapturerInfo8+ @@ -5212,7 +5190,6 @@ audioCapturer.getCapturerInfo((err, capturerInfo) => { console.info(`Capturer flags: ${capturerInfo.capturerFlags}`); } }); - ``` @@ -5245,7 +5222,6 @@ audioCapturer.getCapturerInfo().then((audioParamsGet) => { }).catch((err) => { console.error(`AudioFrameworkRecLog: CapturerInfo :ERROR: ${err}`); }); - ``` ### getStreamInfo8+ @@ -5276,7 +5252,6 @@ audioCapturer.getStreamInfo((err, streamInfo) => { console.info(`Capturer encoding type: ${streamInfo.encodingType}`); } }); - ``` ### getStreamInfo8+ @@ -5305,7 +5280,6 @@ audioCapturer.getStreamInfo().then((audioParamsGet) => { }).catch((err) => { console.error(`getStreamInfo :ERROR: ${err}`); }); - ``` ### getAudioStreamId9+ @@ -5328,7 +5302,6 @@ Obtains the stream ID of this **AudioCapturer** instance. This API uses an async audioCapturer.getAudioStreamId((err, streamid) => { console.info(`audioCapturer GetStreamId: ${streamid}`); }); - ``` ### getAudioStreamId9+ @@ -5353,7 +5326,6 @@ audioCapturer.getAudioStreamId().then((streamid) => { }).catch((err) => { console.error(`ERROR: ${err}`); }); - ``` ### start8+ @@ -5380,7 +5352,6 @@ audioCapturer.start((err) => { console.info('Capturer start success.'); } }); - ``` @@ -5412,7 +5383,6 @@ audioCapturer.start().then(() => { }).catch((err) => { console.info(`AudioFrameworkRecLog: Capturer start :ERROR : ${err}`); }); - ``` ### stop8+ @@ -5439,7 +5409,6 @@ audioCapturer.stop((err) => { console.info('Capturer stopped.'); } }); - ``` @@ -5469,7 +5438,6 @@ audioCapturer.stop().then(() => { }).catch((err) => { console.info(`AudioFrameworkRecLog: Capturer stop: ERROR: ${err}`); }); - ``` ### release8+ @@ -5496,7 +5464,6 @@ audioCapturer.release((err) => { console.info('capturer released.'); } }); - ``` @@ -5526,7 +5493,6 @@ audioCapturer.release().then(() => { }).catch((err) => { console.info(`AudioFrameworkRecLog: Capturer stop: ERROR: ${err}`); }); - ``` ### read8+ @@ -5560,7 +5526,6 @@ audioCapturer.read(bufferSize, true, async(err, buffer) => { console.info('Success in reading the buffer data'); } }); - ``` ### read8+ @@ -5600,7 +5565,6 @@ audioCapturer.read(bufferSize, true).then((buffer) => { }).catch((err) => { console.info(`ERROR : ${err}`); }); - ``` ### getAudioTime8+ @@ -5623,7 +5587,6 @@ Obtains the number of nanoseconds elapsed from the Unix epoch (January 1, 1970). audioCapturer.getAudioTime((err, timestamp) => { console.info(`Current timestamp: ${timestamp}`); }); - ``` ### getAudioTime8+ @@ -5648,7 +5611,6 @@ audioCapturer.getAudioTime().then((audioTime) => { }).catch((err) => { console.info(`AudioFrameworkRecLog: AudioCapturer Created : ERROR : ${err}`); }); - ``` ### getBufferSize8+ @@ -5678,7 +5640,6 @@ audioCapturer.getBufferSize((err, bufferSize) => { }); } }); - ``` ### getBufferSize8+ @@ -5705,7 +5666,6 @@ audioCapturer.getBufferSize().then((data) => { }).catch((err) => { console.info(`AudioFrameworkRecLog: getBufferSize :ERROR : ${err}`); }); - ``` ### on('markReach')8+ @@ -5732,7 +5692,6 @@ audioCapturer.on('markReach', 1000, (position) => { console.info('ON Triggered successfully'); } }); - ``` ### off('markReach')8+ @@ -5753,7 +5712,6 @@ Unsubscribes from mark reached events. ```js audioCapturer.off('markReach'); - ``` ### on('periodReach')8+ @@ -5780,7 +5738,6 @@ audioCapturer.on('periodReach', 1000, (position) => { console.info('ON Triggered successfully'); } }); - ``` ### off('periodReach')8+ @@ -5801,10 +5758,9 @@ Unsubscribes from period reached events. ```js audioCapturer.off('periodReach') - ``` -### on('stateChange')8+ +### on('stateChange') 8+ on(type: 'stateChange', callback: Callback): void @@ -5830,7 +5786,6 @@ audioCapturer.on('stateChange', (state) => { console.info('audio capturer state is: STATE_RUNNING'); } }); - ``` ## ToneType9+ @@ -5905,7 +5860,6 @@ tonePlayer.load(audio.ToneType.TONE_TYPE_DIAL_5, (err) => { console.info('callback call load success'); } }); - ``` ### load9+ @@ -5938,7 +5892,6 @@ tonePlayer.load(audio.ToneType.TONE_TYPE_DIAL_1).then(() => { }).catch(() => { console.error('promise call load fail'); }); - ``` ### start9+ @@ -5968,7 +5921,6 @@ tonePlayer.start((err) => { console.info('callback call start success'); } }); - ``` ### start9+ @@ -5995,7 +5947,6 @@ tonePlayer.start().then(() => { }).catch(() => { console.error('promise call start fail'); }); - ``` ### stop9+ @@ -6025,7 +5976,6 @@ tonePlayer.stop((err) => { console.error('callback call stop success '); } }); - ``` ### stop9+ @@ -6052,7 +6002,6 @@ tonePlayer.stop().then(() => { }).catch(() => { console.error('promise call stop fail'); }); - ``` ### release9+ @@ -6082,7 +6031,6 @@ tonePlayer.release((err) => { console.info('callback call release success '); } }); - ``` ### release9+ @@ -6109,7 +6057,6 @@ tonePlayer.release().then(() => { }).catch(() => { console.error('promise call release fail'); }); - ``` ## ActiveDeviceType(deprecated) diff --git a/en/application-dev/reference/apis/js-apis-bundleManager-BundlePackInfo.md b/en/application-dev/reference/apis/js-apis-bundleManager-BundlePackInfo.md new file mode 100644 index 0000000000000000000000000000000000000000..e6fd8bd2c8cd018a0ed0fe0d5cfdb226f542b438 --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-bundleManager-BundlePackInfo.md @@ -0,0 +1,146 @@ +# BundlePackInfo + +The **BundlePackInfo** module provides information in the **pack.info** file. The information can be obtained using [freeInstall.getBundlePackInfo](js-apis-freeInstall.md). + +> **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. + +## BundlePackInfo + +**System API**: This is a system API. + +**System capability**: SystemCapability.BundleManager.BundleFrameWork.FreeInstall + + +| Name | Type | Readable| Writable| Description | +| -------- | --------------------------------------- | ---- | ---- | ------------------------- | +| packages | Array\<[PackageConfig](#packageconfig)> | Yes | No | Package configuration information in the **pack.info** file. | +| summary | [PackageSummary](#packagesummary) | Yes | No | Package summary information in the **pack.info** file.| + +## PackageConfig + +**System API**: This is a system API. + +**System capability**: SystemCapability.BundleManager.BundleFrameWork.FreeInstall + +| Name | Type | Readable| Writable| Description | +| ------------------- | -------------- | ---- | ---- | ------------------------------------------------------------ | +| deviceTypes | Array\ | Yes | No | Device types supported by the bundle. | +| name | string | Yes | No | Bundle name. | +| moduleType | string | Yes | No | Module type of the bundle. | +| deliveryWithInstall | boolean | Yes | No | Whether the HAP file will be installed when the user installs the bundle. The value **true** means that the HAP file will be automatically installed when the user installs the bundle, and **false** means the opposite.| + +## PackageSummary + +**System API**: This is a system API. + +**System capability**: SystemCapability.BundleManager.BundleFrameWork.FreeInstall + +| Name | Type | Readable| Writable| Description | +| ------- | --------------------------------------------- | ---- | ---- | -------------------- | +| app | [BundleConfigInfo](#bundleconfiginfo) | Yes | No | Bundle configuration information. | +| modules | Array\<[ModuleConfigInfo](#moduleconfiginfo)> | Yes | No | Module configuration information of the bundle.| + +## BundleConfigInfo + +**System API**: This is a system API. + +**System capability**: SystemCapability.BundleManager.BundleFrameWork.FreeInstall + +| Name | Type | Readable| Writable| Description | +| ---------- | ------------------- | ---- | ---- | -------------------------------------- | +| bundleName | string | Yes | No | Bundle name. It uniquely identifies an application.| +| version | [Version](#version) | Yes | No | Bundle version. | + +## ModuleConfigInfo + +**System API**: This is a system API. + +**System capability**: SystemCapability.BundleManager.BundleFrameWork.FreeInstall + +| Name | Type | Readable| Writable| Description | +| ------------------ | ------------------------------------------------- | ---- | ---- | ---------------------------------- | +| mainAbility | string | Yes| No| Name of the main ability.| +| apiVersion | [ApiVersion](#apiversion) | Yes | No | API version of the module. | +| deviceType | Array\ | Yes | No | Device types supported by the module. | +| distro | [ModuleDistroInfo](#moduledistroinfo) | Yes | No | Distribution information of the module. | +| abilities | Array\<[ModuleAbilityInfo](#moduleabilityinfo)> | Yes | No | Ability information of the module. | +| extensionAbilities | Array\<[ExtensionAbilities](#extensionability)> | Yes | No | ExtensionAbility information of the module.| + +## ModuleDistroInfo + +**System API**: This is a system API. + +**System capability**: SystemCapability.BundleManager.BundleFrameWork.FreeInstall + +| Name | Type | Readable| Writable| Description | +| ------------------- | ------- | ---- | ---- | ------------------------------------------------------------ | +| deliveryWithInstall | boolean | Yes | No | Whether the HAP file will be installed when the user installs the bundle. The value **true** means that the HAP file will be automatically installed when the user installs the bundle, and **false** means the opposite.| +| installationFree | boolean | Yes | No | Whether the HAP file supports the installation-free feature. The value **true** means that the HAP file supports the installation-free feature and meets installation-free constraints, and **false** means the opposite.| +| moduleName | string | Yes | No | Module name. | +| moduleType | string | Yes | No | Module type. | + +## ModuleAbilityInfo + +**System API**: This is a system API. + +**System capability**: SystemCapability.BundleManager.BundleFrameWork.FreeInstall + +| Name | Type | Readable| Writable| Description | +| ------- | ------------------------------------------- | ---- | ---- | ------------------------------------------------------------ | +| name | string | Yes | No | Name of the ability. The name must be unique in the bundle. | +| label | string | Yes | No | Name of the ability displayed to users. The value is a resource index to names in multiple languages.| +| exported | boolean | Yes | No | Whether the ability can be called by other bundles. The value **true** means that the ability can be called by other bundles, and **false** means the opposite.| +| forms | Array\<[AbilityFormInfo](#abilityforminfo)> | Yes | No | Widget information. | + +## ExtensionAbility + +**System API**: This is a system API. + +**System capability**: SystemCapability.BundleManager.BundleFrameWork.FreeInstall + +| Name | Type | Readable| Writable| Description | +| ----- | ------------------------------------------- | ---- | ---- | ------------------------------------------------------------ | +| name | string | Yes| No| Name of the ExtensionAbility.| +| forms | Array\<[AbilityFormInfo](#abilityforminfo)> | Yes | No | Widget information.| + +## AbilityFormInfo + +**System API**: This is a system API. + +**System capability**: SystemCapability.BundleManager.BundleFrameWork.FreeInstall + +| Name | Type | Readable| Writable| Description | +| ------------------- | -------------- | ---- | ---- | ------------------------------------------------------------ | +| name | string | Yes | No | Widget name. | +| type | string | Yes | No | Widget type. | +| updateEnabled | boolean | Yes | No | Whether the widget supports periodic update. The value **true** means that the widget supports periodic update, and **false** means the opposite.| +| scheduledUpdateTime | string | Yes | No | Scheduled time to update the widget. The value is in 24-hour format and accurate to the minute. | +| updateDuration | number | Yes | No | Interval to update the widget. The unit is 30 minutes. The value is a multiple of 30. A widget can be updated at a specified interval (**updateDuration**) or at the scheduled time (**scheduledUpdateTime**). If both are configured, **updateDuration** takes precedence.| +| supportDimensions | Array\ | Yes | No | Dimensions of the widget. The value can be **1\*2**, **2\*2**, **2\*4**, **4\*4**, or a combination of these options. At least one option must be specified when defining the widget.| +| defaultDimension | string | Yes | No | Default dimensions of the widget. The value must be available in the **supportDimensions** array of the widget.| + +## ApiVersion + +**System API**: This is a system API and cannot be called by third-party applications. + +**System capability**: SystemCapability.BundleManager.BundleFrameWork.FreeInstall + +| Name | Type | Readable| Writable| Description | +| ----------- | ------ | ---- | ---- | -------------------- | +| releaseType | string | Yes | No | Name of the API version. | +| compatible | number | Yes | No | Minimum API version.| +| target | number | Yes | No | Target API version. | + +## Version + +**System API**: This is a system API. + +**System capability**: SystemCapability.BundleManager.BundleFrameWork.FreeInstall + +| Name | Type | Readable| Writable| Description | +| ------------------------ | ------ | ---- | ---- | ------------------------------------------------------------ | +| minCompatibleVersionCode | number | Yes | No | Minimum compatible version of the bundle. It is used to check whether the bundle is compatible with a version on other devices in the cross-device scenario. The value is a 32-bit non-negative integer.| +| name | string | Yes | No | Version number of the bundle visible to users. | +| code | number | Yes | No | Version number of the bundle used only for bundle management. The value is a 32-bit non-negative integer. It is used only to determine whether a version is later than another version. A larger value indicates a later version.| diff --git a/en/application-dev/reference/apis/js-apis-bundleManager-abilityInfo.md b/en/application-dev/reference/apis/js-apis-bundleManager-abilityInfo.md index cacab28b20157441ee4f64bc69261c7f37f0809f..b15708816fdcaf8293209bcb008e2119979817f3 100644 --- a/en/application-dev/reference/apis/js-apis-bundleManager-abilityInfo.md +++ b/en/application-dev/reference/apis/js-apis-bundleManager-abilityInfo.md @@ -22,7 +22,7 @@ The **AbilityInfo** module defines the ability information. A system application | icon | string | Yes | No | Index of the ability icon resource file. | | iconId | number | Yes | No | ID of the ability icon. | | process | string | Yes | No | Process in which the ability runs. If this parameter is not set, the bundle name is used.| -| isVisible | boolean | Yes | No | Whether the ability can be called by other bundles. | +| exported | boolean | Yes | No | Whether the ability can be called by other bundles. | | type | [AbilityType](js-apis-bundleManager.md#abilitytype) | Yes | No | Ability type.
This attribute can be used only in the FA model.| | orientation | [DisplayOrientation](js-apis-bundleManager.md#displayorientation) | Yes | No | Ability display orientation. | | launchType | [LaunchType](js-apis-bundleManager.md#launchtype) | Yes | No | Ability launch mode. | diff --git a/en/application-dev/reference/apis/js-apis-bundleManager-applicationInfo.md b/en/application-dev/reference/apis/js-apis-bundleManager-applicationInfo.md index d87ee5597f2535ec83113f16775dbd33a7a623ba..8997e94099071ce9b4e806f06b008477352af187 100644 --- a/en/application-dev/reference/apis/js-apis-bundleManager-applicationInfo.md +++ b/en/application-dev/reference/apis/js-apis-bundleManager-applicationInfo.md @@ -9,27 +9,26 @@ The **ApplicationInfo** module defines the application information. A system app ## ApplicationInfo **System capability**: SystemCapability.BundleManager.BundleFramework.Core - | Name | Type | Readable| Writable| Description | | -------------------------- | ------------------------------------------------------------ | ---- | ---- | ------------------------------------------------------------ | | name | string | Yes | No | Application name. | -| description | string | Yes | No | Application description. | +| description | string | Yes | No | Description of the application, for example, "description": $string: mainability_description". | | descriptionId | number | Yes | No | ID of the application description. | | enabled | boolean | Yes | No | Whether the application is enabled. The default value is **true**. | -| label | string | Yes | No | Application label. | +| label | string | Yes | No | Application name, for example, "label": "$string: mainability_description".| | labelId | number | Yes | No | ID of the application label. | -| icon | string | Yes | No | Application icon. | +| icon | string | Yes | No | Application icon, for example, "icon": "$media:icon". | | iconId | number | Yes | No | ID of the application icon. | | process | string | Yes | No | Process in which the application runs. If this parameter is not set, the bundle name is used. | -| permissions | Array\ | Yes | No | Permissions required for accessing the application. The permissions can be obtained by passing in **GET_APPLICATION_INFO_WITH_PERMISSION** to [bundleManager.getApplicationInfo](js-apis-bundleManager.md#bundlemanagergetapplicationinfo).| +| permissions | Array\ | Yes | No | Permissions required for accessing the application. The permissions can be obtained by passing in **GET_APPLICATION_INFO_WITH_PERMISSION** to the **appFlags** parameter of [bundleManager.getApplicationInfo](js-apis-bundleManager.md#bundlemanagergetapplicationinfo).| | codePath | string | Yes | No | Installation directory of the application. | -| metadata | Map\> | Yes | No | Metadata of the application. The information can be obtained by passing in **GET_APPLICATION_INFO_WITH_METADATA** to [bundleManager.getApplicationInfo](js-apis-bundleManager.md#bundlemanagergetapplicationinfo).| +| metadata | Map\> | Yes | No | Metadata of the application. The information can be obtained by passing in **GET_APPLICATION_INFO_WITH_METADATA** to the **appFlags** parameter of [bundleManager.getApplicationInfo](js-apis-bundleManager.md#bundlemanagergetapplicationinfo).| | removable | boolean | Yes | No | Whether the application is removable. | | accessTokenId | number | Yes | No | Access token ID of the application. | | uid | number | Yes | No | UID of the application. | -| iconResource | [Resource](js-apis-resource-manager.md#resource9) | Yes| No| Icon resource of the application. | -| labelResource | [Resource](js-apis-resource-manager.md#resource9) | Yes| No| Label resource of the application. | -| descriptionResource | [Resource](js-apis-resource-manager.md#resource9) | Yes| No| Description resource of the application. | +| iconResource | [Resource](js-apis-resource-manager.md#resource9) | Yes| No| Resource information of the application icon. The resource information obtained contains the bundle name, module name, and ID of the resource. You can call **getMediaContent** in [@ohos.resourceManager.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.resourceManager.d.ts) to obtain the resource details. | +| labelResource | [Resource](js-apis-resource-manager.md#resource9) | Yes| No| Resource information of the application label. The resource information obtained contains the bundle name, module name, and ID of the resource. You can call **getMediaContent** in [@ohos.resourceManager.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.resourceManager.d.ts) to obtain the resource details. | +| descriptionResource | [Resource](js-apis-resource-manager.md#resource9) | Yes| No| Resource information of the application description. The resource information obtained contains the bundle name, module name, and ID of the resource. You can call **getMediaContent** in [@ohos.resourceManager.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.resourceManager.d.ts) to obtain the resource details.| | appDistributionType | string | Yes | No | Distribution type of the application signing certificate. The options are **app_gallery**, **enterprise**, **os_integration**, and **crowdtesting**. | | appProvisionType | string | Yes | No | Type of the application signing certificate file. The options are **debug** and **release**. | | systemApp | boolean | Yes | No | Whether the application is a system application. | diff --git a/en/application-dev/reference/apis/js-apis-bundleManager.md b/en/application-dev/reference/apis/js-apis-bundleManager.md index cac8e51923b2baf6f18f409f3538199b0bbef86d..1cef53613b8993c775bcaa6f7cef1c927bd43ee3 100644 --- a/en/application-dev/reference/apis/js-apis-bundleManager.md +++ b/en/application-dev/reference/apis/js-apis-bundleManager.md @@ -2215,7 +2215,7 @@ try { ### bundleManager.getProfileByAbility -getProfileByAbility(moduleName: string, abilityName: string, metadataName: string, callback: AsyncCallback>): void; +getProfileByAbility(moduleName: string, abilityName: string, metadataName: string, callback: AsyncCallback\\>): void; Obtains the JSON strings of the configuration file based on the given module ame, ability name, and metadata name. This API uses an asynchronous callback to return the result. @@ -2266,7 +2266,7 @@ try { ### bundleManager.getProfileByAbility -getProfileByAbility(moduleName: string, abilityName: string, metadataName?: string): Promise>; +getProfileByAbility(moduleName: string, abilityName: string, metadataName?: string): Promise\\>; Obtains the JSON strings of the configuration file based on the given module ame, ability name, and metadata name. This API uses a promise to return the result. @@ -2336,7 +2336,7 @@ try { ### bundleManager.getProfileByExtensionAbility -getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName: string, callback: AsyncCallback>): void; +getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName: string, callback: AsyncCallback\\>): void; Obtains the JSON strings of the configuration file based on the given module ame, Extension ability name, and metadata name. This API uses an asynchronous callback to return the result. @@ -2386,7 +2386,7 @@ try { ### bundleManager.getProfileByExtensionAbility -getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName?: string): Promise>; +getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName?: string): Promise\\>; Obtains the JSON strings of the configuration file based on the given module ame, Extension ability name, and metadata name. This API uses a promise to return the result. @@ -2658,7 +2658,6 @@ try { ### bundleManager.getApplicationInfoSync getApplicationInfoSync(bundleName: string, applicationFlags: number, userId: number) : [ApplicationInfo](js-apis-bundleManager-applicationInfo.md); -getApplicationInfoSync(bundleName: string, applicationFlags: number) : [ApplicationInfo](js-apis-bundleManager-applicationInfo.md); Synchronously obtains the application information based on the given bundle name, application flags, and user ID. @@ -2709,6 +2708,42 @@ try { } ``` +### bundleManager.getApplicationInfoSync + +getApplicationInfoSync(bundleName: string, applicationFlags: number) : [ApplicationInfo](js-apis-bundleManager-applicationInfo.md); + +Synchronously obtains the application information based on the given bundle name and application flags. + +**System API**: This is a system API. + +**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + +**System capability**: SystemCapability.BundleManager.BundleFramework.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| ---------------- | -------------------------- | ---- | ----------------------------------------------------- | +| bundleName | string | Yes | Bundle name. | +| applicationFlags | [number](#applicationflag) | Yes | Type of the application information to obtain.| + +**Return value** + +| Type | Description | +| ----------------------------------------------------------- | ------------------------- | +| [ApplicationInfo](js-apis-bundleManager-applicationInfo.md) | Application information obtained.| + +**Error codes** + +For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md). + +| ID| Error Message | +| -------- | -------------------------------------- | +| 17700001 | The specified bundleName is not found. | +| 17700026 | The specified bundle is disabled. | + +**Example** + ```ts import bundleManager from '@ohos.bundle.bundleManager'; import hilog from '@ohos.hilog'; @@ -2726,7 +2761,6 @@ try { ### bundleManager.getBundleInfoSync getBundleInfoSync(bundleName: string, bundleFlags: [number](#bundleflag), userId: number): [BundleInfo](js-apis-bundleManager-bundleInfo.md); -getBundleInfoSync(bundleName: string, bundleFlags: [number](#bundleflag)): [BundleInfo](js-apis-bundleManager-bundleInfo.md); Synchronously obtains the bundle information based on the given bundle name, bundle flags, and user ID. @@ -2742,7 +2776,7 @@ Synchronously obtains the bundle information based on the given bundle name, bun | ----------- | ------ | ---- | -------------------------------------------------------- | | bundleName | string | Yes | Bundle name. | | bundleFlags | [number](#bundleflag) | Yes | Type of the bundle information to obtain.| -| userId | number | No | User ID. | +| userId | number | Yes | User ID. | **Return value** @@ -2777,6 +2811,42 @@ try { } ``` +### bundleManager.getBundleInfoSync + +getBundleInfoSync(bundleName: string, bundleFlags: [number](#bundleflag)): [BundleInfo](js-apis-bundleManager-bundleInfo.md); + +Synchronously obtains the bundle information based on the given bundle name and bundle flags. + +**System API**: This is a system API. + +**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + +**System capability**: SystemCapability.BundleManager.BundleFramework.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| ----------- | --------------------- | ---- | ------------------------------------------------------ | +| bundleName | string | Yes | Bundle name. | +| bundleFlags | [number](#bundleflag) | Yes | Type of the bundle information to obtain.| + +**Return value** + +| Type | Description | +| ------------------------------------------------- | -------------------- | +| [BundleInfo](js-apis-bundleManager-bundleInfo.md) | Bundle information obtained.| + +**Error codes** + +For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md). + +| ID| Error Message | +| -------- | -------------------------------------- | +| 17700001 | The specified bundleName is not found. | +| 17700026 | The specified bundle is disabled. | + +**Example** + ```ts import bundleManager from '@ohos.bundle.bundleManager'; import hilog from '@ohos.hilog'; @@ -2789,3 +2859,37 @@ try { hilog.error(0x0000, 'testTag', 'getBundleInfoSync failed: %{public}s', err.message); } ``` + +## ModuleType + +Enumerates the module types. + + **System capability**: SystemCapability.BundleManager.BundleFramework.Core + +| Name | Value | Description | +| ------- | ---- | -------------------- | +| ENTRY | 1 | Main module of the application. | +| FEATURE | 2 | Dynamic feature module of the application.| +| SHARED | 3 | Dynamic shared library module of the application. | + +## BundleType + +Enumerates the bundle types. + + **System capability**: SystemCapability.BundleManager.BundleFramework.Core + +| Name | Value | Description | +| -------------- | ---- | --------------- | +| APP | 0 | The bundle is a common application. | +| ATOMIC_SERVICE | 1 | The bundle is an atomic service.| + +## AtomicServiceModuleType + +Enumerates the module types of an atomic service. + + **System capability**: SystemCapability.BundleManager.BundleFramework.Core + +| Name | Value | Description | +| ------ | ---- | --------------------------- | +| NORMAL | 0 | Page package in the atomic service. | +| MAIN | 1 | Landing page package in the atomic service.| diff --git a/en/application-dev/reference/apis/js-apis-bundleMonitor.md b/en/application-dev/reference/apis/js-apis-bundleMonitor.md index 11f54832d6556e24f35cd1baedee0d9abfe39079..b1601cfc665bc6b96364d9c9508b197137e52746 100644 --- a/en/application-dev/reference/apis/js-apis-bundleMonitor.md +++ b/en/application-dev/reference/apis/js-apis-bundleMonitor.md @@ -33,7 +33,7 @@ For details, see [Permission Levels](../../security/accesstoken-overview.md). ## bundleMonitor.on -on(type: BundleChangedEvent, callback: callback\): void; +on(type: BundleChangedEvent, callback: Callback\): void; Subscribes to bundle installation, uninstall, and update events. @@ -66,7 +66,7 @@ try { ## bundleMonitor.off -off(type: BundleChangedEvent, callback?: callback\): void; +off(type: BundleChangedEvent, callback?: Callback\): void; Unsubscribes from bundle installation, uninstall, and update events. diff --git a/en/application-dev/reference/apis/js-apis-call.md b/en/application-dev/reference/apis/js-apis-call.md index 0ccd49a5dc2a8b8e3577b7614f8219573de7cf7d..6b6222abe96a415e28290892f8e6a215c1e98478 100644 --- a/en/application-dev/reference/apis/js-apis-call.md +++ b/en/application-dev/reference/apis/js-apis-call.md @@ -4,32 +4,32 @@ The **call** module provides call management functions, including making calls, To subscribe to the call status, use [`observer.on('callStateChange')`](js-apis-observer.md#observeroncallstatechange). ->**NOTE**
+>**NOTE** +> >The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. - ## Modules to Import ```js import call from '@ohos.telephony.call'; ``` -## call.dial +## call.dial(deprecated) dial\(phoneNumber: string, callback: AsyncCallback\): void Initiates a call. This API uses an asynchronous callback to return the result. -**Required permission**: ohos.permission.PLACE\_CALL (a system permission) +**Required Permissions**: ohos.permission.PLACE_CALL **System capability**: SystemCapability.Telephony.CallManager **Parameters** -| Name | Type | Mandatory | Description | -| ----------- | ---------------------------- | ---- | -------------------------------- | -| phoneNumber | string | Yes | Phone number. | -| callback | AsyncCallback<boolean> | Yes | Callback used to return the result.
- **true**: success
- **false**: failure | +| Name | Type | Mandatory| Description | +| ----------- | ---------------------------- | ---- | --------------------------------------- | +| phoneNumber | string | Yes | Phone number. | +| callback | AsyncCallback<boolean> | Yes | Callback used to return the result.
- **true**: success
- **false**: failure| **Example** @@ -40,23 +40,23 @@ call.dial("138xxxxxxxx", (err, data) => { ``` -## call.dial +## call.dial(deprecated) dial\(phoneNumber: string, options: DialOptions, callback: AsyncCallback\): void -Initiates a call based on the specified options. This API uses an asynchronous callback to return the result. +Initiates a call. You can set call options as needed. This API uses an asynchronous callback to return the result. -**Required permission**: ohos.permission.PLACE\_CALL (a system permission) +**Required Permissions**: ohos.permission.PLACE_CALL **System capability**: SystemCapability.Telephony.CallManager **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | ----------- | ---------------------------- | ---- | --------------------------------------- | -| phoneNumber | string | Yes | Phone number. | -| options | [DialOptions](#dialoptions) | No | Call option, which indicates whether the call is a voice call or video call. | -| callback | AsyncCallback<boolean> | Yes | Callback used to return the result.
- **true**: success
- **false**: failure | +| phoneNumber | string | Yes | Phone number. | +| options | [DialOptions](#dialoptions) | Yes | Call option, which indicates whether the call is a voice call or video call. | +| callback | AsyncCallback<boolean> | Yes | Callback used to return the result.
- **true**: success
- **false**: failure| **Example** @@ -69,28 +69,28 @@ call.dial("138xxxxxxxx", { ``` -## call.dial +## call.dial(deprecated) dial\(phoneNumber: string, options?: DialOptions\): Promise -Initiates a call based on the specified options. This API uses a promise to return the result. +Initiates a call. You can set call options as needed. This API uses a promise to return the result. -**Required permission**: ohos.permission.PLACE\_CALL (a system permission) +**Required Permissions**: ohos.permission.PLACE_CALL **System capability**: SystemCapability.Telephony.CallManager **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | ----------- | --------------------------- | ---- | -------------------------------------- | -| phoneNumber | string | Yes | Phone number. | -| options | [DialOptions](#dialoptions) | Yes | Call option, which indicates whether the call is a voice call or video call. | +| phoneNumber | string | Yes | Phone number. | +| options | [DialOptions](#dialoptions) | No | Call option, which indicates whether the call is a voice call or video call.| **Return value** -| Type | Description | -| ---------------------- | ---------------------------------------------------------------- | -| Promise<boolean> | Promise used to return the result.
- **true**: success
- **false**: failure | +| Type | Description | +| ---------------------- | ------------------------------------------------------------ | +| Promise<boolean> | Promise used to return the result.
- **true**: success
- **false**: failure| **Example** @@ -105,6 +105,142 @@ promise.then(data => { }); ``` + +## call.dialCall9+ + +dialCall\(phoneNumber: string, callback: AsyncCallback\): void + +Initiates a call. This API uses an asynchronous callback to return the result. + +**System API**: This is a system API. + +**Required Permissions**: ohos.permission.PLACE_CALL + +**System capability**: SystemCapability.Telephony.CallManager + +**Parameters** + +| Name | Type | Mandatory| Description | +| ----------- | ---------------------------- | ---- | --------------------------------------- | +| phoneNumber | string | Yes | Phone number. | +| callback | AsyncCallback<void> | Yes | Callback used to return the result. | + +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + +**Example** + +```js +call.dialCall("138xxxxxxxx", (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.dialCall9+ + +dialCall\(phoneNumber: string, options: DialCallOptions, callback: AsyncCallback\): void + +Initiates a call. You can set call options as needed. This API uses an asynchronous callback to return the result. + +**System API**: This is a system API. + +**Required Permissions**: ohos.permission.PLACE_CALL + +**System capability**: SystemCapability.Telephony.CallManager + +**Parameters** + +| Name | Type | Mandatory| Description | +| ----------- | ----------------------------------- | ---- | ------------------------------------ | +| phoneNumber | string | Yes | Phone number. | +| options | [DialCallOptions](#dialcalloptions9)| Yes | Call options, which carry other configuration information of the call. | +| callback | AsyncCallback<void> | Yes | Callback used to return the result. | + +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + +**Example** + +```js +call.dialCall("138xxxxxxxx", { + accountId: 0, + videoState: 0, + dialScene: 0, + dialType: 0, +}, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.dialCall9+ + +dialCall\(phoneNumber: string, options?: DialCallOptions\): Promise + +Initiates a call. You can set call options as needed. This API uses a promise to return the result. + +**System API**: This is a system API. + +**Required Permissions**: ohos.permission.PLACE_CALL + +**System capability**: SystemCapability.Telephony.CallManager + +**Parameters** + +| Name | Type | Mandatory| Description | +| ----------- | ----------------------------------- | ---- | -------------------------------------- | +| phoneNumber | string | Yes | Phone number. | +| options | [DialCallOptions](#dialcalloptions9)| No | Call option, which indicates whether the call is a voice call or video call.| + +**Return value** + +| Type | Description | +| ---------------------- | ------------------------------------------------------------ | +| Promise<void> | Promise used to return the result. | + +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + +**Example** + +```js +try { + call.dialCall('138xxxxxxxx'); + console.log(`dialCall success, promise: data->${JSON.stringify(data)}`); +} catch (error) { + console.log(`dialCall fail, promise: err->${JSON.stringify(error)}`); +} +``` + + ## call.makeCall7+ makeCall(phoneNumber: string, callback: AsyncCallback\): void @@ -115,16 +251,27 @@ Launches the call screen and displays the dialed number. This API uses an asynch **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | ----------- | ------------------------- | ---- | ------------------------------------------ | | phoneNumber | string | Yes | Phone number. | -| callback | AsyncCallback<void> | Yes | Callback used to return the result. | +| callback | AsyncCallback<void> | Yes | Callback used to return the result.| + +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | **Example** ```js -call.makeCall("138xxxxxxxx", err => { - console.log(`makeCall callback: err->${JSON.stringify(err)}`); +call.makeCall("138xxxxxxxx", err => { + console.log(`makeCall callback: err->${JSON.stringify(err)}`); }); ``` @@ -139,24 +286,35 @@ Launches the call screen and displays the dialed number. This API uses a promise **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | ----------- | ------ | ---- | ---------- | -| phoneNumber | string | Yes | Phone number. | +| phoneNumber | string | Yes | Phone number.| **Return value** | Type | Description | | ------------------- | --------------------------------- | -| Promise<void> | Promise used to return the result. | +| Promise<void> | Promise used to return the result.| + +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | **Example** ```js -let promise = call.makeCall("138xxxxxxxx"); -promise.then(() => { - console.log(`makeCall success`); -}).catch(err => { - console.error(`makeCall fail, promise: err->${JSON.stringify(err)}`); +let promise = call.makeCall("138xxxxxxxx"); +promise.then(() => { + console.log(`makeCall success`); +}).catch(err => { + console.error(`makeCall fail, promise: err->${JSON.stringify(err)}`); }); ``` @@ -170,9 +328,9 @@ Checks whether a call is in progress. This API uses an asynchronous callback to **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | -------- | ---------------------------- | ---- | ------------------------------------------------------------ | -| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. Callback used to return the result.
- **true**: A call is in progress.
- **false**: No call is in progress. | +| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. Callback used to return the result.
- **true**: A call is in progress.
- **false**: No call is in progress.| **Example** @@ -195,7 +353,7 @@ Checks whether a call is in progress. This API uses a promise to return the resu | Type | Description | | ---------------------- | --------------------------------------- | -| Promise<boolean> | Promise used to return the result. | +| Promise<boolean> | Promise used to return the result.| **Example** @@ -219,9 +377,9 @@ Obtains the call status. This API uses an asynchronous callback to return the re **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | -------- | -------------------------------------------- | ---- | ------------------------------------ | -| callback | AsyncCallback<[CallState](#callstate)> | Yes | Callback used to return the result. | +| callback | AsyncCallback<[CallState](#callstate)> | Yes | Callback used to return the result.| **Example** @@ -244,7 +402,7 @@ Obtains the call status. This API uses a promise to return the result. | Type | Description | | -------------------------------------- | --------------------------------------- | -| Promise<[CallState](#callstate)> | Promise used to return the result. | +| Promise<[CallState](#callstate)> | Promise used to return the result.| **Example** @@ -269,7 +427,7 @@ Checks whether a device supports voice calls. | Type | Description | | ------- | ------------------------------------------------------------ | -| boolean | - **true**: The device supports voice calls.
- **false**: The device does not support voice calls. | +| boolean | - **true**: The device supports voice calls.
- **false**: The device does not support voice calls.| ```js let result = call.hasVoiceCapability(); @@ -286,10 +444,21 @@ Checks whether the called number is an emergency number. This API uses an asynch **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | ----------- | ---------------------------- | ---- | ------------------------------------------------------------ | | phoneNumber | string | Yes | Phone number. | -| callback | AsyncCallback<boolean> | Yes | Callback used to return the result.
- **true**: The called number is an emergency number.
- **false**: The called number is not an emergency number. | +| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. - **true**: The called number is an emergency number.
- **false**: The called number is not an emergency number.| + +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | **Example** @@ -304,17 +473,28 @@ call.isEmergencyPhoneNumber("138xxxxxxxx", (err, data) => { isEmergencyPhoneNumber\(phoneNumber: string, options: EmergencyNumberOptions, callback: AsyncCallback\): void -Checks whether the called number is an emergency number based on the specified phone number options. This API uses an asynchronous callback to return the result. +Checks whether the called number is an emergency number based on the phone number. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Telephony.CallManager **Parameters** -| Name | Type | Mandatory | Description | -| ----------- | -------------------------------------------------- | ---- | -------------------------------------------- | -| phoneNumber | string | Yes | Phone number. | -| options | [EmergencyNumberOptions](#emergencynumberoptions7) | No | Phone number options. | -| callback | AsyncCallback<boolean> | Yes | Callback used to return the result.
- **true**: The called number is an emergency number.
- **false**: The called number is not an emergency number. | +| Name | Type | Mandatory| Description | +| ----------- | -------------------------------------------------- | ---- | ------------------------------------------------------------ | +| phoneNumber | string | Yes | Phone number. | +| options | [EmergencyNumberOptions](#emergencynumberoptions7) | Yes | Phone number. | +| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. - **true**: The called number is an emergency number.
- **false**: The called number is not an emergency number.| + +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | **Example** @@ -329,22 +509,33 @@ call.isEmergencyPhoneNumber("112", {slotId: 1}, (err, data) => { isEmergencyPhoneNumber\(phoneNumber: string, options?: EmergencyNumberOptions\): Promise -Checks whether the called number is an emergency number based on the specified phone number options. This API uses a promise to return the result. +Checks whether the called number is an emergency number based on the phone number. This API uses a promise to return the result. **System capability**: SystemCapability.Telephony.CallManager **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | ----------- | -------------------------------------------------- | ---- | -------------- | | phoneNumber | string | Yes | Phone number. | -| options | [EmergencyNumberOptions](#emergencynumberoptions7) | Yes | Phone number options. | +| options | [EmergencyNumberOptions](#emergencynumberoptions7) | No | Phone number.| **Return value** | Type | Description | | ---------------------- | --------------------------------------------------- | -| Promise<boolean> | Promise used to return the result. | +| Promise<boolean> | Promise used to return the result.| + +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | **Example** @@ -369,10 +560,21 @@ A formatted phone number is a standard numeric string, for example, 555 0100. **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | ----------- | --------------------------- | ---- | ------------------------------------ | | phoneNumber | string | Yes | Phone number. | -| callback | AsyncCallback<string> | Yes | Callback used to return the result. | +| callback | AsyncCallback<string> | Yes | Callback used to return the result.| + +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | **Example** @@ -386,7 +588,7 @@ call.formatPhoneNumber("138xxxxxxxx", (err, data) => { formatPhoneNumber\(phoneNumber: string, options: NumberFormatOptions, callback: AsyncCallback\): void -Formats a phone number based on the specified formatting options. This API uses an asynchronous callback to return the result. +Formats a phone number based on specified formatting options. This API uses an asynchronous callback to return the result. A formatted phone number is a standard numeric string, for example, 555 0100. @@ -394,11 +596,22 @@ A formatted phone number is a standard numeric string, for example, 555 0100. **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | ----------- | -------------------------------------------- | ---- | ------------------------------------ | | phoneNumber | string | Yes | Phone number. | -| options | [NumberFormatOptions](#numberformatoptions7) | No | Number formatting options, for example, country code. | -| callback | AsyncCallback<string> | Yes | Callback used to return the result. | +| options | [NumberFormatOptions](#numberformatoptions7) | Yes | Number formatting options, for example, country code. | +| callback | AsyncCallback<string> | Yes | Callback used to return the result.| + +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | **Example** @@ -415,7 +628,7 @@ call.formatPhoneNumber("138xxxxxxxx", { formatPhoneNumber\(phoneNumber: string, options?: NumberFormatOptions\): Promise -Formats a phone number based on the specified formatting options. This API uses a promise to return the result. +Formats a phone number based on specified formatting options. This API uses a promise to return the result. A formatted phone number is a standard numeric string, for example, 555 0100. @@ -423,16 +636,27 @@ A formatted phone number is a standard numeric string, for example, 555 0100. **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | ----------- | -------------------------------------------- | ---- | ---------------------- | | phoneNumber | string | Yes | Phone number. | -| options | [NumberFormatOptions](#numberformatoptions7) | Yes | Number formatting options, for example, country code. | +| options | [NumberFormatOptions](#numberformatoptions7) | No | Number formatting options, for example, country code.| **Return value** | Type | Description | | --------------------- | ------------------------------------------- | -| Promise<string> | Promise used to return the result. | +| Promise<string> | Promise used to return the result.| + +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | **Example** @@ -459,11 +683,22 @@ The phone number must match the specified country code. For example, for a China **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | ----------- | --------------------------- | ---- | ----------------------------------------------------- | | phoneNumber | string | Yes | Phone number. | | countryCode | string | Yes | Country code, for example, **CN** (China). All country codes are supported. | -| callback | AsyncCallback<string> | Yes | Callback used to return the result. | +| callback | AsyncCallback<string> | Yes | Callback used to return the result.| + +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | **Example** @@ -488,16 +723,27 @@ All country codes are supported. **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | ----------- | ------ | ---- | ---------------------------------------- | | phoneNumber | string | Yes | Phone number. | -| countryCode | string | Yes | Country code, for example, **CN** (China). All country codes are supported. | +| countryCode | string | Yes | Country code, for example, **CN** (China). All country codes are supported.| **Return value** | Type | Description | | --------------------- | ------------------------------------------------------------ | -| Promise<string> | Promise used to return the result. | +| Promise<string> | Promise used to return the result.| + +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | **Example** @@ -514,9 +760,9 @@ promise.then(data => { muteRinger\(callback: AsyncCallback\): void -Mutes the ringtone while it is playing. This API uses an asynchronous callback to return the result. +Mutes the ringtone while it is playing. It does not work if the ringtone has been muted. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -528,6 +774,17 @@ This is a system API. | ----------- | ------------------------- | ---- | ---------- | | callback | AsyncCallback<void> | Yes | Callback used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -541,9 +798,9 @@ call.muteRinger((err, data) => { muteRinger\(\): Promise -Mutes the ringtone while it is playing. This API uses a promise to return the result. +Mutes the ringtone while it is playing. It does not work if the ringtone has been muted. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -555,6 +812,18 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -566,13 +835,14 @@ promise.then(data => { }); ``` -## call.answer7+ -answer\(callId: number, callback: AsyncCallback\): void +## call.answerCall7+ + +answerCall\(callId: number, callback: AsyncCallback\): void -Answers a call based on the specified call ID. This API uses an asynchronous callback to return the result. +Answers a call. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -585,22 +855,34 @@ This is a system API. | callId | number | Yes | Call ID. You can obtain the value by subscribing to **callDetailsChange** events.| | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -call.answer(1, (err, data) => { +call.answerCall(1, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` -## call.answer7+ +## call.answerCall7+ -answer(callId?: number\): Promise +answerCall(callId?: number\): Promise -Answers a call based on the specified call ID. This API uses a promise to return the result. +Answers a call. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -618,24 +900,37 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -let promise = call.answer(1); +let promise = call.answerCall(1); promise.then(data => { - console.log(`answer success, promise: data->${JSON.stringify(data)}`); + console.log(`answerCall success, promise: data->${JSON.stringify(data)}`); }).catch(err => { - console.error(`answer fail, promise: err->${JSON.stringify(err)}`); + console.error(`answerCall fail, promise: err->${JSON.stringify(err)}`); }); ``` -## call.hangup7+ -hangup\(callId: number, callback: AsyncCallback\): void +## call.answerCall9+ -Ends a call. This API uses an asynchronous callback to return the result. +answerCall\(callback: AsyncCallback\): void + +Answers a call. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -645,25 +940,36 @@ This is a system API. | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | ---------- | -| callId | number | Yes | Call ID. You can obtain the value by subscribing to **callDetailsChange** events.| | callback | AsyncCallback<void> | Yes | Callback used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -call.hangup(1, (err, data) => { +call.answerCall((err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` -## call.answer9+ +## call.hangUpCall7+ -answer\(callback: AsyncCallback\): void +hangUpCall\(callId: number, callback: AsyncCallback\): void -Answers a call.This API uses an asynchronous callback to return the result. +Ends a call. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -673,24 +979,37 @@ This is a system API. | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | ----------------------------------------------- | +| callId | number | Yes | Call ID. You can obtain the value by subscribing to **callDetailsChange** events.| | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -call.answer((err, data) => { +call.hangUpCall(1, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` -## call.hangup7+ +## call.hangUpCall7+ -hangup\(callId?: number\): Promise +hangUpCall\(callId?: number\): Promise -Ends a call based on the specified call ID. This API uses a promise to return the result. +Ends a call. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -708,24 +1027,37 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -let promise = call.hangup(1); +let promise = call.hangUpCall(1); promise.then(data => { - console.log(`hangup success, promise: data->${JSON.stringify(data)}`); + console.log(`hangUpCall success, promise: data->${JSON.stringify(data)}`); }).catch(err => { - console.error(`hangup fail, promise: err->${JSON.stringify(err)}`); + console.error(`hangUpCall fail, promise: err->${JSON.stringify(err)}`); }); ``` -## call.hangup9+ -hangup\(callback: AsyncCallback\): void +## call.hangUpCall9+ + +hangUpCall\(callback: AsyncCallback\): void Ends a call. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -737,22 +1069,35 @@ This is a system API. | -------- | ------------------------- | ---- | ---------- | | callback | AsyncCallback<void> | Yes | Callback used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + + **Example** ```js -call.hangup((err, data) => { +call.hangUpCall((err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` -## call.reject7+ +## call.rejectCall7+ -reject(callId: number, callback: AsyncCallback\): void +rejectCall(callId: number, callback: AsyncCallback\): void -Rejects a call based on the specified call ID. This API uses an asynchronous callback to return the result. +Rejects a call. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -765,22 +1110,35 @@ This is a system API. | callId | number | Yes | Call ID. You can obtain the value by subscribing to **callDetailsChange** events.| | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -call.reject(1, (err, data) => { +call.rejectCall(1, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` -## call.reject7+ -reject\(callId: number, options: RejectMessageOptions, callback: AsyncCallback\): void +## call.rejectCall7+ + +rejectCall\(callId: number, options: RejectMessageOptions, callback: AsyncCallback\): void -Rejects a call based on the specified call ID and options. This API uses an asynchronous callback to return the result. +Rejects a call. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -794,25 +1152,37 @@ This is a system API. | options | [RejectMessageOptions](#rejectmessageoptions7) | Yes | Options for the call rejection message. | | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js let rejectMessageOptions={ messageContent: "Unknown number blocked" } -call.reject(1, rejectMessageOptions, (err, data) => { +call.rejectCall(1, rejectMessageOptions, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` -## call.reject7+ +## call.rejectCall7+ -reject(callId?: number, options?: RejectMessageOptions\): Promise +rejectCall(callId?: number, options?: RejectMessageOptions\): Promise -Rejects a call based on the specified call ID and options. This API uses a promise to return the result. +Rejects a call. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -831,28 +1201,40 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js let rejectMessageOptions={ messageContent: "Unknown number blocked" } -let promise = call.reject(1, rejectMessageOptions); +let promise = call.rejectCall(1, rejectMessageOptions); promise.then(data => { - console.log(`reject success, promise: data->${JSON.stringify(data)}`); + console.log(`rejectCall success, promise: data->${JSON.stringify(data)}`); }).catch(err => { - console.error(`reject fail, promise: err->${JSON.stringify(err)}`); + console.error(`rejectCall fail, promise: err->${JSON.stringify(err)}`); }); ``` -## call.reject9+ +## call.rejectCall9+ -reject\(callback: AsyncCallback\): void +rejectCall\(callback: AsyncCallback\): void Rejects a call. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -864,22 +1246,34 @@ This is a system API. | -------- | ------------------------- | ---- | ---------- | | callback | AsyncCallback<void> | Yes | Callback used to return the result.| -**Example:** +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + +**Example** ```js -call.reject((err, data) => { +call.rejectCall((err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` -## call.reject9+ +## call.rejectCall9+ -reject\(options: RejectMessageOptions, callback: AsyncCallback\): void +rejectCall\(options: RejectMessageOptions, callback: AsyncCallback\): void Rejects a call. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -892,13 +1286,25 @@ This is a system API. | options | [RejectMessageOptions](#rejectmessageoptions7) | Yes | Options for the call rejection message.| | callback | AsyncCallback<void> | Yes | Callback used to return the result. | -**Example:** +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + +**Example** ```js let rejectMessageOptions={ messageContent: "Unknown number blocked" } -call.reject(rejectMessageOptions, (err, data) => { +call.rejectCall(rejectMessageOptions, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -910,7 +1316,7 @@ holdCall\(callId: number, callback: AsyncCallback\): void Holds a call based on the specified call ID. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -923,6 +1329,18 @@ This is a system API. | callId | number | Yes | Call ID. | | callback | AsyncCallback<void> | Yes | Callback used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -938,7 +1356,7 @@ holdCall\(callId: number\): Promise Holds a call based on the specified call ID. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -956,6 +1374,18 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -973,7 +1403,7 @@ unHoldCall\(callId: number, callback: AsyncCallback\): void Unholds a call based on the specified call ID. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -986,6 +1416,18 @@ This is a system API. | callId | number | Yes | Call ID. | | callback | AsyncCallback<void> | Yes | Callback used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1001,7 +1443,7 @@ unHoldCall\(callId: number\): Promise Unholds a call based on the specified call ID. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -1019,6 +1461,18 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1036,7 +1490,7 @@ switchCall\(callId: number, callback: AsyncCallback\): void Switches a call. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -1049,6 +1503,18 @@ This is a system API. | callId | number | Yes | Call ID. | | callback | AsyncCallback<void> | Yes | Callback used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1064,7 +1530,7 @@ switchCall\(callId: number\): Promise Switches a call. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -1082,6 +1548,18 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1099,7 +1577,7 @@ combineConference\(callId: number, callback: AsyncCallback\): void Combines two calls into a conference call. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1110,6 +1588,17 @@ This is a system API. | callId | number | Yes | Call ID. | | callback | AsyncCallback<void> | Yes | Callback used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1125,7 +1614,7 @@ combineConference\(callId: number\): Promise Combines two calls into a conference call. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1141,6 +1630,17 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1158,7 +1658,7 @@ getMainCallId\(callId: number, callback: AsyncCallback\): void Obtains the main call ID. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1169,6 +1669,18 @@ This is a system API. | callId | number | Yes | Call ID. | | callback | AsyncCallback<number> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + + **Example** ```js @@ -1184,7 +1696,7 @@ getMainCallId\(callId: number\): Promise Obtains the main call ID. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1200,6 +1712,17 @@ This is a system API. | ------------------- | ------------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1217,7 +1740,7 @@ getSubCallIdList\(callId: number, callback: AsyncCallback\>\): vo Obtains the list of subcall IDs. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1228,6 +1751,17 @@ This is a system API. | callId | number | Yes | Call ID. | | callback | AsyncCallback\> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1243,7 +1777,7 @@ getSubCallIdList\(callId: number\): Promise\> Obtains the list of subcall IDs. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1259,6 +1793,17 @@ This is a system API. | ----------------------------- | ----------------------------------- | | Promise<Array> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1276,7 +1821,7 @@ getCallIdListForConference\(callId: number, callback: AsyncCallback> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1302,7 +1858,7 @@ getCallIdListForConference\(callId: number\): Promise\> Obtains the list of call IDs in a conference. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1318,6 +1874,17 @@ This is a system API. | ----------------------------- | --------------------------------------- | | Promise<Array> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1335,7 +1902,7 @@ getCallWaitingStatus\(slotId: number, callback: AsyncCallback- **0**: card slot 1
- **1**: card slot 2 | -| callback | AsyncCallback<[CallWaitingStatus](#callwaitingstatus7)\> | Yes | Callback used to return the result.
- **0**: Call waiting is disabled.
- **1**: Call waiting is enabled.| +| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | +| callback | AsyncCallback<[CallWaitingStatus](#callwaitingstatus7)\> | Yes | Callback used to return the result.

- **0**: Call waiting is disabled.
- **1**: Call waiting is enabled.| + +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | **Example** @@ -1363,7 +1942,7 @@ getCallWaitingStatus\(slotId: number\): Promise Obtains the call waiting status. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.GET_TELEPHONY_STATE @@ -1381,6 +1960,18 @@ This is a system API. | ------------------------------------------------------- | ------------------------------------------------------------ | | Promise<[CallWaitingStatus](#callwaitingstatus7)> | Promise used to return the result.
- **0**: Call waiting is disabled.
- **1**: Call waiting is enabled.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1398,7 +1989,7 @@ setCallWaiting\(slotId: number, activate: boolean, callback: AsyncCallback- **false**: Disable call waiting.
- **true**: Enable call waiting.| | callback | AsyncCallback | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1427,7 +2030,7 @@ setCallWaiting\(slotId: number, activate: boolean\): Promise Sets the call waiting switch. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -1446,6 +2049,18 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1461,9 +2076,9 @@ promise.then(data => { startDTMF\(callId: number, character: string, callback: AsyncCallback\): void -Enables dual-tone multifrequency (DTMF). This API uses an asynchronous callback to return the result. +Enables DTMF. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1475,6 +2090,17 @@ This is a system API. | character | string | Yes | DTMF code. | | callback | AsyncCallback | Yes | Callback used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1490,7 +2116,7 @@ startDTMF\(callId: number, character: string\): Promise Enables DTMF. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1507,6 +2133,17 @@ This is a system API. | ------------------- | ----------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1524,7 +2161,7 @@ stopDTMF\(callId: number, callback: AsyncCallback\): void Stops DTMF. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1535,6 +2172,17 @@ This is a system API. | callId | number | Yes | Call ID. | | callback | AsyncCallback<void> | Yes | Callback used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1550,7 +2198,7 @@ stopDTMF\(callId: number\): Promise Stops DTMF. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1566,6 +2214,17 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1583,7 +2242,7 @@ isInEmergencyCall\(callback: AsyncCallback\): void Checks whether a call is an emergency call. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -1595,6 +2254,18 @@ This is a system API. | -------- | ---------------------------- | ---- | ---------- | | callback | AsyncCallback<boolean> | Yes | Callback used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1610,7 +2281,7 @@ isInEmergencyCall\(\): Promise Checks whether a call is an emergency call. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -1622,6 +2293,18 @@ This is a system API. | ---------------------- | --------------------------- | | Promise<boolean> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1639,7 +2322,7 @@ on\(type: 'callDetailsChange', callback: Callback\): void Subscribes to **callDetailsChange** events. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -1652,6 +2335,18 @@ This is a system API. | type | string | Yes | Call details change during a call.| | callback | Callback<[CallAttributeOptions](#callattributeoptions7)> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1666,7 +2361,7 @@ on\(type: 'callEventChange', callback: Callback\): void Subscribes to **callEventChange** events. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -1679,6 +2374,18 @@ This is a system API. | type | string | Yes | Call event change during a call.| | callback | Callback<[CallEventOptions](#calleventoptions8)> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1693,7 +2400,7 @@ on\(type: 'callDisconnectedCause', callback: Callback): vo Subscribes to **callDisconnectedCause** events. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -1706,6 +2413,18 @@ This is a system API. | type | string | Yes | Cause of the call disconnection.| | callback | Callback<[DisconnectedDetails](#disconnecteddetails9)> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1720,7 +2439,7 @@ on\(type: 'mmiCodeResult', callback: Callback\): void Subscribes to **mmiCodeResult** events. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -1733,6 +2452,18 @@ This is a system API. | type | string | Yes | Man-machine interface (MMI) code result.| | callback | Callback<[MmiCodeResults](#mmicoderesults9)> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1747,7 +2478,7 @@ off\(type: 'callDetailsChange', callback?: Callback\): vo Unsubscribes from **callDetailsChange** events. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -1757,9 +2488,21 @@ This is a system API. | Name | Type | Mandatory| Description | | -------- | -------------------------------------------------------- | ---- | ---------------------------------- | -| type | string | Yes | Unsubscription from call details changes when a call ends.| +| type | string | Yes | IMS registration status changes.| | callback | Callback<[CallAttributeOptions](#callattributeoptions7)> | No | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1774,7 +2517,7 @@ off\(type: 'callEventChange', callback?: Callback\): void Unsubscribes from **callEventChange** events. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -1787,6 +2530,18 @@ This is a system API. | type | string | Yes | Unsubscription from call event changes when a call ends.| | callback | Callback<[CallEventOptions](#calleventoptions8)> | No | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1801,7 +2556,7 @@ off\(type: 'callDisconnectedCause', callback?: Callback\): Unsubscribes from **callDisconnectedCause** events. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -1814,6 +2569,18 @@ This is a system API. | type | 'callDisconnectedCause' | Yes | Unsubscription from the call disconnection cause when a call ends.| | callback | Callback**<**[DisconnectedDetails](#disconnecteddetails9)> | No | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1828,7 +2595,7 @@ off\(type: 'mmiCodeResult', callback?: Callback\): void Unsubscribes from **mmiCodeResult** events. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -1841,6 +2608,18 @@ This is a system API. | type | 'mmiCodeResult' | Yes | MMI code result.| | callback | Callback<[MmiCodeResults](#mmicoderesults9)> | No | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1855,7 +2634,7 @@ isNewCallAllowed\(callback: AsyncCallback\): void Checks whether a new call is allowed. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1865,6 +2644,17 @@ This is a system API. | -------- | ---------------------------- | ---- | ---------- | | callback | AsyncCallback<boolean> | Yes | Callback used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1880,7 +2670,7 @@ isNewCallAllowed\(\): Promise Checks whether a new call is allowed. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1890,6 +2680,17 @@ This is a system API. | ---------------------- | --------------------------- | | Promise<boolean> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1905,9 +2706,9 @@ promise.then(data => { separateConference\(callId: number, callback: AsyncCallback\): void -Separates a conference call. This API uses an asynchronous callback to return the result. +Separates calls from a conference call. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1918,6 +2719,17 @@ This is a system API. | callId | number | Yes | Call ID. | | callback | AsyncCallback<void> | Yes | Callback used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1931,9 +2743,9 @@ call.separateConference(1, (err, data) => { separateConference\(callId: number\): Promise -Separates a conference call. This API uses a promise to return the result. +Separates calls from a conference call. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1949,6 +2761,17 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1966,7 +2789,7 @@ getCallRestrictionStatus\(slotId: number, type: CallRestrictionType, callback: A Obtains the call restriction status. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.GET_TELEPHONY_STATE @@ -1980,6 +2803,18 @@ This is a system API. | type | [CallRestrictionType](#callrestrictiontype8) | Yes | Call restriction type. | | callback | AsyncCallback<[RestrictionStatus](#restrictionstatus8)> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1995,7 +2830,7 @@ getCallRestrictionStatus\(slotId: number, type: CallRestrictionType\): Promise Sets the call restriction status. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -2084,6 +2943,18 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2106,7 +2977,7 @@ getCallTransferInfo\(slotId: number, type: CallTransferType, callback: AsyncCall Obtains call transfer information. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.GET_TELEPHONY_STATE @@ -2120,10 +2991,22 @@ This is a system API. | type | [CallTransferType](#calltransfertype8) | Yes | Call transfer type. | | callback | AsyncCallback<[CallTransferResult](#calltransferresult8)> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -call.getCallTransferInfo(0, callTransferTyp, (err, data) => { +call.getCallTransferInfo(0, call.CallTransferType.TRANSFER_TYPE_BUSY, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -2135,7 +3018,7 @@ getCallTransferInfo\(slotId: number, type: CallTransferType): Promise Sets call transfer information. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -2224,6 +3131,18 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2246,7 +3165,7 @@ isRinging\(callback: AsyncCallback\): void Checks whether the ringtone is playing. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -2258,6 +3177,18 @@ This is a system API. | -------- | ---------------------------- | ---- | ---------- | | callback | AsyncCallback<boolean> | Yes | Callback used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2273,7 +3204,7 @@ isRinging\(\): Promise Checks whether the ringtone is playing. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -2285,6 +3216,18 @@ This is a system API. | ---------------------- | --------------------------- | | Promise<boolean> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2302,7 +3245,7 @@ setMuted\(callback: AsyncCallback\): void Sets call muting. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2312,6 +3255,17 @@ This is a system API. | -------- | ------------------------- | ---- | ---------- | | callback | AsyncCallback<void> | Yes | Callback used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2327,7 +3281,7 @@ setMuted\(\): Promise Sets call muting. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2337,6 +3291,17 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2354,7 +3319,7 @@ cancelMuted(callback: AsyncCallback): void Cancels call muting. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2364,6 +3329,17 @@ This is a system API. | -------- | ------------------------- | ---- | ---------- | | callback | AsyncCallback<void> | Yes | Callback used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2379,7 +3355,7 @@ cancelMuted(): Promise Cancels call muting. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2389,6 +3365,17 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2400,13 +3387,13 @@ promise.then(data => { }); ``` -## call.setAudioDevice9+ +## call.setAudioDevice8+ setAudioDevice\(device: AudioDevice, callback: AsyncCallback\): void Sets the audio device for a call. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2417,6 +3404,17 @@ This is a system API. | device | [AudioDevice](#audiodevice8) | Yes | Audio device.| | callback | AsyncCallback<void> | Yes | Callback used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2432,7 +3430,7 @@ setAudioDevice\(device: AudioDevice, options: AudioDeviceOptions, callback: Asyn Sets the audio device for a call based on the specified options. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2444,6 +3442,17 @@ This is a system API. | options | [AudioDeviceOptions](#audiodeviceoptions9) | Yes | Audio device parameters.| | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2456,13 +3465,13 @@ call.setAudioDevice(1, audioDeviceOptions, (err, data) => { ``` -## call.setAudioDevice8+ +## call.setAudioDevice9+ setAudioDevice(device: AudioDevice, options?: AudioDeviceOptions): Promise Sets the audio device for a call based on the specified options. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2479,6 +3488,17 @@ This is a system API. | ------------------- | ------------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2499,7 +3519,7 @@ joinConference(mainCallId: number, callNumberList: Array, callback: Asy Joins a conference call. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2511,6 +3531,17 @@ This is a system API. | callNumberList | Array | Yes | List of call numbers.| | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2528,7 +3559,7 @@ joinConference(mainCallId: number, callNumberList: Array): Promise Updates the IMS call mode. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2608,6 +3661,17 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2625,7 +3689,7 @@ enableImsSwitch(slotId: number, callback: AsyncCallback): void Enables the IMS switch. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -2638,6 +3702,18 @@ This is a system API. | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2652,7 +3728,7 @@ enableImsSwitch(slotId: number): Promise Enables the IMS switch. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -2670,6 +3746,18 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2687,7 +3775,7 @@ disableImsSwitch(slotId: number, callback: AsyncCallback): void Disables the IMS switch. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -2700,6 +3788,18 @@ This is a system API. | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2714,7 +3814,7 @@ disableImsSwitch(slotId: number): Promise Disables the IMS switch. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -2732,6 +3832,18 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2749,7 +3861,7 @@ isImsSwitchEnabled(slotId: number, callback: AsyncCallback): void Checks whether the IMS switch is enabled. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2760,6 +3872,17 @@ This is a system API. | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback<boolean> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2774,7 +3897,7 @@ isImsSwitchEnabled(slotId: number): Promise Checks whether the IMS switch is enabled. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2790,6 +3913,17 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2801,20 +3935,32 @@ promise.then(data => { }); ``` - ## DialOptions -Defines the dialup options. +Provides an option for determining whether a call is a video call. **System capability**: SystemCapability.Telephony.CallManager -| Name | Type | Mandatory| Description | -| ------------------------ | ---------------------------------- | ---- | ------------------------------------------------------------ | +| Name | Type | Mandatory| Description | +| ------------------------ | ---------------------------------- | ---- | ----------------------------------------------------------------------------------------------- | | extras | boolean | No | Indication of a video call.
- **true**: video call
- **false** (default): voice call| -| accountId 8+ | number | No | Account ID.
- **0**: card slot 1
- **1**: card slot 2
This is a system API. | -| videoState 8+ | [VideoStateType](#videostatetype7) | No | Video state type. This is a system API. | -| dialScene 8+ | [DialScene](#dialscene8) | No | Dialup scenario. This is a system API. | -| dialType 8+ | [DialType](#dialtype8) | No | Dialup type. This is a system API. | +| accountId 8+ | number | No | Account ID.
- **0**: card slot 1
- **1**: card slot 2
This is a system API. | +| videoState 8+ | [VideoStateType](#videostatetype7) | No | Video state type. This is a system API. | +| dialScene 8+ | [DialScene](#dialscene8) | No | Dialup scenario. This is a system API. | +| dialType 8+ | [DialType](#dialtype8) | No | Dialup type. This is a system API. | + +## DialCallOptions9+ + +Defines options for initiating a call. + +**System capability**: SystemCapability.Telephony.CallManager + +| Name | Type | Mandatory| Description | +| ------------------------ | ---------------------------------- | ---- | ------------------------------------------------------------ | +| accountId 9+ | number | No | Account ID.
- **0**: card slot 1
- **1**: card slot 2
This is a system API.| +| videoState 9+ | [VideoStateType](#videostatetype7) | No | Video state type. This is a system API. | +| dialScene 9+ | [DialScene](#dialscene8) | No | Dialup scenario. This is a system API. | +| dialType 9+ | [DialType](#dialtype8) | No | Dialup type. This is a system API. | ## CallState @@ -2827,33 +3973,33 @@ Enumerates call states. | CALL_STATE_UNKNOWN | -1 | The call status fails to be obtained and is unknown. | | CALL_STATE_IDLE | 0 | No call is in progress. | | CALL_STATE_RINGING | 1 | The call is in the ringing or waiting state. | -| CALL_STATE_OFFHOOK | 2 | At least one call is in dialing, active, or on hold, and no new incoming call is ringing or waiting. | +| CALL_STATE_OFFHOOK | 2 | At least one call is in dialing, active, or on hold, and no new incoming call is ringing or waiting.| ## EmergencyNumberOptions7+ -Defines options for determining whether a number is an emergency number. +Provides an option for determining whether a number is an emergency number for the SIM card in the specified slot. **System capability**: SystemCapability.Telephony.CallManager -| Name| Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | ------ | ------ | ---- | ---------------------------------------------- | | slotId | number | No | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| ## NumberFormatOptions7+ -Defines the number formatting options. +Provides an option for number formatting. **System capability**: SystemCapability.Telephony.CallManager -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | ----------- | ------ | ---- | ---------------------------------------------------------- | -| countryCode | string | No | Country code, for example, **CN** (China). All country codes are supported. The default value is **CN**. | +| countryCode | string | No | Country code, for example, **CN** (China). All country codes are supported. The default value is **CN**.| ## ImsCallMode8+ Enumerates IMS call modes. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2869,23 +4015,23 @@ This is a system API. Enumerates audio devices. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager | Name | Value | Description | | -------------------- | ---- | ------------ | -| DEVICE_EARPIECE | 0 | Earpiece. | -| DEVICE_SPEAKER | 1 | Speaker.| -| DEVICE_WIRED_HEADSET | 2 | Wired headset.| +| DEVICE_EARPIECE | 0 | Headset device. | +| DEVICE_SPEAKER | 1 | Speaker device.| +| DEVICE_WIRED_HEADSET | 2 | Wired headset device.| | DEVICE_BLUETOOTH_SCO | 3 | Bluetooth SCO device. | -| DEVICE_MIC | 4 | Microphone. | +| DEVICE_MIC | 4 | Microphone device| ## CallRestrictionType8+ Enumerates call restriction types. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2904,7 +4050,7 @@ This is a system API. Defines the call transfer information. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2915,14 +4061,14 @@ This is a system API. | settingType | [CallTransferSettingType](#calltransfersettingtype8) | Yes | Call transfer setting type.| | startHour9+ | number | No | Hour in the start time.| | startMinute9+ | number | No | Minute in the start time.| -| endHour9+ | number | No | Hour in the end time.| +| endHour9+ | number | No | Minute in the end time.| | endMinute9+ | number | No | Minute in the end time.| ## CallTransferType8+ Enumerates call transfer types. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2937,7 +4083,7 @@ This is a system API. Enumerates call transfer setting types. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2952,11 +4098,11 @@ This is a system API. Defines the call attribute options. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | --------------- | ---------------------------------------- | ---- | -------------- | | accountNumber | string | Yes | Account number. | | speakerphoneOn | boolean | Yes | Speakerphone on.| @@ -2973,7 +4119,7 @@ This is a system API. Enumerates conference states. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2988,7 +4134,7 @@ This is a system API. Enumerates call types. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3001,9 +4147,9 @@ This is a system API. ## VideoStateType7+ -Enumerates video state types. +Video state type. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3016,7 +4162,7 @@ This is a system API. Enumerates detailed call states. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3036,11 +4182,11 @@ This is a system API. Defines the call restriction information. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | -------- | -------------------------------------------- | ---- | ------------ | | type | [CallRestrictionType](#callrestrictiontype8) | Yes | Call restriction type.| | password | string | Yes | Password. | @@ -3050,7 +4196,7 @@ This is a system API. Enumerates call restriction modes. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3063,11 +4209,11 @@ This is a system API. Defines the call event options. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | ------- | ------------------------------------------ | ---- | -------------- | | eventId | [CallAbilityEventId](#callabilityeventid8) | Yes | Call ability event ID.| @@ -3075,7 +4221,7 @@ This is a system API. Enumerates call ability event IDs. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3088,7 +4234,7 @@ This is a system API. Enumerates dialup scenarios. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3102,7 +4248,7 @@ This is a system API. Enumerates dialup types. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3116,11 +4262,11 @@ This is a system API. Defines options for the call rejection message. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | -------------- | ------ | ---- | -------- | | messageContent | string | Yes | Message content.| @@ -3128,7 +4274,7 @@ This is a system API. Defines the call transfer result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3138,14 +4284,14 @@ This is a system API. | number | string | Yes | Call transfer number. | | startHour9+ | number | Yes | Hour in the start time.| | startMinute9+ | number | Yes | Minute in the start time.| -| endHour9+ | number | Yes | Hour in the end time.| +| endHour9+ | number | Yes | Minute in the end time.| | endMinute9+ | number | Yes | Minute in the end time.| ## CallWaitingStatus7+ Enumerates call waiting states. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3158,7 +4304,7 @@ This is a system API. Enumerates call restriction states. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3171,7 +4317,7 @@ This is a system API. Enumerates call transfer states. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3184,7 +4330,7 @@ This is a system API. Defines the cause of a call disconnection. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3197,7 +4343,7 @@ This is a system API. Enumerates causes of call disconnection. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3287,7 +4433,7 @@ This is a system API. Defines the MMI code result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3298,9 +4444,9 @@ This is a system API. ## MmiCodeResult9+ -Enumerates MMI code results. +Defines the MMI code result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3313,7 +4459,7 @@ This is a system API. Defines audio device options. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager diff --git a/en/application-dev/reference/apis/js-apis-camera.md b/en/application-dev/reference/apis/js-apis-camera.md index b30722bd2fddd6ef83914ffe6b8a3421831935ce..b2f7c32c5a1c513c7b910c3e61c612be7ea31731 100644 --- a/en/application-dev/reference/apis/js-apis-camera.md +++ b/en/application-dev/reference/apis/js-apis-camera.md @@ -2,7 +2,8 @@ > **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 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 @@ -476,10 +477,10 @@ Listens for camera status changes. This API uses an asynchronous callback to ret **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ----------------------------------------------------- | ---- | --------- | -| type | string | Yes | Event type. The value is fixed at **'cameraStatus'**. The callback function returns the camera information, including the device and device status (available or unavailable). The event can be listened for only when a **CameraManager** instance is obtained.| -| callback | AsyncCallback<[CameraStatusInfo](#camerastatusinfo)\> | Yes | Callback used to return the camera status change. | +| Name | Type | Mandatory| Description | +| -------- | -----------------| ---- | --------- | +| type | string | Yes | Event type. The value is fixed at **'cameraStatus'**. The event can be listened for when a **CameraManager** instance is obtained. This event is triggered and the corresponding information is returned only when the device is enabled or disabled.| +| callback | AsyncCallback<[CameraStatusInfo](#camerastatusinfo)\> | Yes | Callback used to return the camera status change.| | **Example** @@ -504,8 +505,8 @@ This is a system API. | Name | Type | Mandatory| Description | | -------- | --------------- | ---- | --------- | -| type | string | Yes | Event type. The value is fixed at **'cameraMute'**. The callback function returns the mute status changes. The event can be listened for only when a **CameraManager** instance is obtained.| -| callback | AsyncCallback\ | Yes | Callback used to return the camera mute status. | +| type | string | Yes | Event type. The value is fixed at **'cameraMute'**, indicating the camera mute status. The event can be listened for when a **CameraManager** instance is obtained. This event is triggered and the status is returned when the camera is enabled or disabled.| +| callback | AsyncCallback\ | Yes | Callback used to return the mute status. The value **true** means that the camera is enabled, and **false** means that the camera is disabled. | **Example** @@ -727,7 +728,7 @@ Listens for **CameraInput** errors. This API uses a callback to return the resul | Name | Type | Mandatory| Description | | -------- | -------------------------------- | --- | ------------------------------------------- | -| type | string | Yes | Event type. The value is fixed at **'error'**. The callback function returns an error code, for example, an error code indicating that the device is unavailable or a conflict occurs. The event can be listened for only when a **CameraInput** instance is obtained.| +| type | string | Yes | Event type. The value is fixed at **'error'**. The event can be listened for when a **CameraInput** instance is created. This event is triggered and the result is returned when an error occurs on the camera. For example, if the device is unavailable or a conflict occurs, the error information is returned.| | cameraDevice | [CameraDevice](#cameradevice) | Yes | **CameraDevice** object.| | callback | ErrorCallback | Yes | Callback used to return an error code defined in [CameraErrorCode](#cameraerrorcode). | @@ -1391,7 +1392,7 @@ try { setMeteringPoint(point: Point): void -Sets the metering point for the device. +Sets the metering point, which is the center point of the metering rectangle. **System capability**: SystemCapability.Multimedia.Camera.Core @@ -1448,7 +1449,7 @@ try { setExposureBias(exposureBias: number): void -Sets an exposure compensation value for the device. +Sets an exposure compensation value (EV). Before the setting, you are advised to use **[getExposureBiasRange](#getexposurebiasrange)** to obtain the supported values. @@ -1590,7 +1591,7 @@ try { setFocusPoint(point: Point): void -Sets a focal point for the device. +Sets the focal point. **System capability**: SystemCapability.Multimedia.Camera.Core @@ -1697,7 +1698,7 @@ try { setZoomRatio(zoomRatio: number): void -Sets a zoom ratio for the device. +Sets a zoom ratio. **System capability**: SystemCapability.Multimedia.Camera.Core @@ -1849,7 +1850,7 @@ Listens for focus state changes. This API uses an asynchronous callback to retur | Name | Type | Mandatory| Description | | -------- | ----------------------------------------- | ---- | ------------------------ | -| type | string | Yes | Event type. The value is fixed at **'focusStateChange'**. The callback function returns the focus state change. The event can be listened for only when the session is created.| +| type | string | Yes | Event type. The value is fixed at **'focusStateChange'**. The event can be listened for when a session is created. This event is triggered only when the camera focus state changes in auto focus mode.| | callback | AsyncCallback<[FocusState](#focusstate)\> | Yes | Callback used to return the focus state change. | **Example** @@ -1872,7 +1873,7 @@ Listens for **CaptureSession** errors. This API uses a callback to return the er | Name | Type | Mandatory| Description | | -------- | ----------------------------------------------------------- | ---- | ------------------------------ | -| type | string | Yes | Event type. The value is fixed at **'error'**. The callback function returns the error code corresponding to an error that occurs during the call of a **CaptureSession** API, for example, **beginConfig()**, **commitConfig()**, or **addInput()**.| +| type | string | Yes | Event type. The value is fixed at **'error'**. The event can be listened for when a session is created. This event is triggered and the error message is returned when an error occurs during the calling of a session-related API such as **beginConfig()**, **commitConfig()**, and **addInput**.| | callback | ErrorCallback | Yes | Callback used to return an error code defined in [CameraErrorCode](#cameraerrorcode). | **Example** @@ -2053,8 +2054,8 @@ Listens for preview frame start events. This API uses an asynchronous callback t | Name | Type | Mandatory| Description | | -------- | -------------------- | ---- | --------------------------------------- | -| type | string | Yes | Event type. The value is fixed at **'frameStart'**. The callback is invoked when the preview on the first frame starts. This event can be listened for only when a **previewOutput** instance is created.| -| callback | AsyncCallback | Yes | Callback used to return the result. | +| type | string | Yes | Event type. The value is fixed at **'frameStart'**. The event can be listened for when a **previewOutput** instance is created. This event is triggered and returned when the bottom layer starts exposure for the first time.| +| callback | AsyncCallback | Yes | Callback used to return the result. The preview starts as long as this event is returned. | **Example** @@ -2076,8 +2077,8 @@ Listens for preview frame end events. This API uses an asynchronous callback to | Name | Type | Mandatory| Description | | -------- | -------------------- | ---- | ------------------------------------- | -| type | string | Yes | Event type. The value is fixed at **'frameEnd'**. The callback is invoked when the preview on the last frame ends. This event can be listened for only when a **previewOutput** instance is created.| -| callback | AsyncCallback | Yes | Callback used to return the result. | +| type | string | Yes | Event type. The value is fixed at **'frameEnd'**. The event can be listened for when a **previewOutput** instance is created. This event is triggered and returned when the last frame of preview ends.| +| callback | AsyncCallback | Yes | Callback used to return the result. The preview ends as long as this event is returned. | **Example** @@ -2097,9 +2098,9 @@ Listens for **PreviewOutput** errors. This API uses a callback to return the err **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ----------------------------------------------------------------- | ---- | ------------------------ | -| type | string | Yes | Event type. The value is fixed at **'error'**. The callback function returns the error code corresponding to an error that occurs during the call of a **PreviewOutput** API, for example, **start()** or **release()**.| +| Name | Type | Mandatory| Description | +| -------- | --------------| ---- | ------------------------ | +| type | string | Yes | Event type. The value is fixed at **'error'**. The event can be listened for when a **previewOutput** instance is created. This event is triggered and the corresponding error message is returned when an error occurs during the use of a preview-related API such as **start()** or **release()**.| | callback | ErrorCallback | Yes | Callback used to return an error code defined in [CameraErrorCode](#cameraerrorcode). | **Example** @@ -2366,7 +2367,7 @@ Listens for shooting start events. This API uses an asynchronous callback to ret | Name | Type | Mandatory| Description | | -------- | ---------------------- | ---- | ------------------------------------------ | -| type | string | Yes | Event type. The value is fixed at **'captureStart'**. The callback function returns the shooting start event.| +| type | string | Yes | Event type. The value is fixed at **'captureStart'**. The event can be listened for when a **photoOutput** instance is created. This event is triggered and returned when the bottom layer starts exposure each time a photo is taken.| | callback | AsyncCallback | Yes | Callback used to return the capture ID. | **Example** @@ -2387,10 +2388,10 @@ Listens for frame shutter events. This API uses an asynchronous callback to retu **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ----------------------------------------------------- | --- | ------------------------------------ | -| type | string | Yes | Event type. The value is fixed at **'frameShutter'**. The callback function returns the captured frame information (captureId and time).| -| callback | AsyncCallback<[FrameShutterInfo](#frameshutterinfo)\> | Yes | Callback used to return the result. | +| Name | Type | Mandatory| Description | +| -------- | ---------- | --- | ------------------------------------ | +| type | string | Yes | Event type. The value is fixed at **'frameShutter'**. The event can be listened for when a **photoOutput** instance is created.| +| callback | AsyncCallback<[FrameShutterInfo](#frameshutterinfo)\> | Yes | Callback used to return the result. A new photographing request can be delivered as long as this event is returned. | **Example** @@ -2411,9 +2412,9 @@ Listens for shooting end events. This API uses an asynchronous callback to retur **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ------------------------------------------------- | ---- | ---------------------------------------- | -| type | string | Yes | Event type. The value is fixed at **'captureEnd'**. The callback function returns the shooting end event.| +| Name | Type | Mandatory| Description | +| -------- | --------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value is fixed at **'captureEnd'**. The event can be listened for when a **photoOutput** instance is created. This event is triggered and the corresponding information is returned when the photographing is complete.| | callback | AsyncCallback<[CaptureEndInfo](#captureendinfo)\> | Yes | Callback used to return the result. | **Example** @@ -2435,9 +2436,9 @@ Listens for **PhotoOutput** errors. This API uses a callback to return the error **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ----------------------------------------------------- | ---- | ----------------------------------- | -| type | string | Yes | Event type. The value is fixed at **'error'**. The callback function returns an error code when an API call fails.| +| Name | Type | Mandatory| Description | +| -------- | ------------- | ---- | ----------------------------------- | +| type | string | Yes | Event type. The value is fixed at **'error'**. The event can be listened for when a **photoOutput** instance is created. This event is triggered and the corresponding error message is returned when an error occurs during the calling of a photographing-related API.| | callback | ErrorCallback | Yes | Callback used to return an error code defined in [CameraErrorCode](#cameraerrorcode). | **Example** @@ -2637,8 +2638,8 @@ Listens for video recording start events. This API uses an asynchronous callback | Name | Type | Mandatory| Description | | -------- | -------------------- | ---- | ----------------------------------------- | -| type | string | Yes | Event type. The value is fixed at **'frameStart'**. The callback is invoked when the recording on the first frame of an image starts.| -| callback | AsyncCallback | Yes | Callback used to return the result. | +| type | string | Yes | Event type. The value is fixed at **'frameStart'**. The event can be listened for when a **videoOutput** instance is created. The event is triggered and the corresponding information is returned when the bottom layer starts exposure for the first time.| +| callback | AsyncCallback | Yes | Callback used to return the result. The recording starts as long as this event is returned. | **Example** @@ -2660,8 +2661,8 @@ Listens for video recording stop events. This API uses an asynchronous callback | Name | Type | Mandatory| Description | | -------- | -------------------- | ---- | ------------------------------------------ | -| type | string | Yes | Event type. The value is fixed at **'frameEnd'**. The callback is invoked when the recording on the last frame of an image stops.| -| callback | AsyncCallback | Yes | Callback used to return the result. | +| type | string | Yes | Event type. The value is fixed at **'frameEnd'**. The event can be listened for when a **videoOutput** instance is created. This event is triggered and returned when the last frame of recording is complete.| +| callback | AsyncCallback | Yes | Callback used to return the result. The recording ends as long as this event is returned. | **Example** @@ -2681,9 +2682,9 @@ Listens for errors that occur during video recording. This API uses a callback t **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ------------------------------------------------ | ---- | -------------------------------------- | -| type | string | Yes | Event type. The value is fixed at **'error'**. The callback function returns the error code corresponding to an error that occurs during the call of a **VideoOutput** API, for example, **start()** or **release()**.| +| Name | Type | Mandatory| Description | +| -------- | ----------- | ---- | -------------------------------------- | +| type | string | Yes | Event type. The value is fixed at **'error'**. The event can be listened for when a **videoOutput** instance is created. This event is triggered and the corresponding error message is returned when an error occurs during the calling of a recording-related API such as **start()** and **release()**.| | callback | Callback | Yes | Callback used to return an error code defined in [CameraErrorCode](#cameraerrorcode). | **Example** @@ -2808,9 +2809,9 @@ Listens for metadata objects. This API uses an asynchronous callback to return t **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ------------------------------------------------ | ---- | ------------------------------------ | -| type | string | Yes | Event type. The value is fixed at **'metadataObjectsAvailable'**. The callback function returns the valid metadata. This event can be listened for only when a **MetadataOutput** instance is created.| +| Name | Type | Mandatory| Description | +| -------- | -------------- | ---- | ------------------------------------ | +| type | string | Yes | Event type. The value is fixed at **'metadataObjectsAvailable'**. The event can be listened for when a **metadataOutput** instance is created. This event is triggered and the corresponding metadata is returned when valid metadata is detected.| | callback | Callback\> | Yes | Callback used to return the metadata.| **Example** @@ -2831,9 +2832,9 @@ Listens for metadata errors. This API uses an asynchronous callback to return th **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ------------------------------------------------ | ---- | --------------------------------------- | -| type | string | Yes | Event type. The value is fixed at **'error'**. The callback function returns the error code corresponding to an error that occurs during the call of a **MetadataOutput** instance API, for example, **start()** or **release()**.| +| Name | Type | Mandatory| Description | +| -------- | ------------- | ---- | --------------------------------------- | +| type | string | Yes | Event type. The value is fixed at **'error'**. The event can be listened for when a **metadataOutput** instance is created. This event is triggered and the corresponding error message is returned when an error occurs during the calling of a metadata-related API such as **start()** and **release()**.| | callback | Callback | Yes | Callback used to return an error code defined in [CameraErrorCode](#cameraerrorcode). | **Example** diff --git a/en/application-dev/reference/apis/js-apis-configuration.md b/en/application-dev/reference/apis/js-apis-configuration.md deleted file mode 100644 index 25c57c7d5f0a6b7a1e8073fc9313bb92562b8576..0000000000000000000000000000000000000000 --- a/en/application-dev/reference/apis/js-apis-configuration.md +++ /dev/null @@ -1,26 +0,0 @@ -# Configuration - -The **Configuration** module provides environment configuration information. - -> **NOTE** -> -> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. - -## Modules to Import - -```js -import Configuration from '@ohos.application.Configuration'; -``` - -## Attributes - -**System capability**: SystemCapability.Ability.AbilityBase - - | Name| Type| Readable| Writable| Description| -| -------- | -------- | -------- | -------- | -------- | -| language | string | Yes| Yes| Language of the application.| -| colorMode | [ColorMode](js-apis-configurationconstant.md) | Yes| Yes| Color mode, which can be **COLOR_MODE_LIGHT** or **COLOR_MODE_DARK**. The default value is **COLOR_MODE_LIGHT**.| -| direction9+ | Direction | Yes| No| Screen orientation, which can be **DIRECTION_HORIZONTAL** or **DIRECTION_VERTICAL**.| -| screenDensity9+ | ScreenDensity | Yes| No| Screen resolution, which can be **SCREEN_DENSITY_SDPI** (120), **SCREEN_DENSITY_MDPI** (160), **SCREEN_DENSITY_LDPI** (240), **SCREEN_DENSITY_XLDPI** (320), **SCREEN_DENSITY_XXLDPI** (480), or **SCREEN_DENSITY_XXXLDPI** (640).| -| displayId9+ | number | Yes| No| ID of the display where the application is located.| -| hasPointerDevice9+ | boolean | Yes| No| Whether a pointer device, such as a keyboard, mouse, or touchpad, is connected.| diff --git a/en/application-dev/reference/apis/js-apis-contact.md b/en/application-dev/reference/apis/js-apis-contact.md index 2778a143c65125eca650324e67a220ab60f64ead..bcc8b36fc9a93191258ed78edb68df61ccce4c28 100644 --- a/en/application-dev/reference/apis/js-apis-contact.md +++ b/en/application-dev/reference/apis/js-apis-contact.md @@ -166,6 +166,7 @@ Updates a contact based on the specified contact information. This API uses an a ```js contact.updateContact({ + id: 1, name: {fullName: 'xxx'}, phoneNumbers: [{phoneNumber: '138xxxxxxxx'}] }, (err) => { @@ -200,6 +201,7 @@ Updates a contact based on the specified contact information and attributes. Thi ```js contact.updateContact({ + id: 1, name: {fullName: 'xxx'}, phoneNumbers: [{phoneNumber: '138xxxxxxxx'}] }, { @@ -241,6 +243,7 @@ Updates a contact based on the specified contact information and attributes. Thi ```js let promise = contact.updateContact({ + id: 1, name: {fullName: 'xxx'}, phoneNumbers: [{phoneNumber: '138xxxxxxxx'}] }, { diff --git a/en/application-dev/reference/apis/js-apis-continuation-continuationManager.md b/en/application-dev/reference/apis/js-apis-continuation-continuationManager.md index 5ffc47acf97498d254f58b5b4ea8d540631083d2..05f490c454f7e7133bfc5977d1bdc2d180462a7c 100644 --- a/en/application-dev/reference/apis/js-apis-continuation-continuationManager.md +++ b/en/application-dev/reference/apis/js-apis-continuation-continuationManager.md @@ -155,6 +155,8 @@ registerContinuation(callback: AsyncCallback\): void; Registers the continuation management service and obtains a token. This API does not involve any filter parameters and uses an asynchronous callback to return the result. +**Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC + **System capability**: SystemCapability.Ability.DistributedAbilityManager **Parameters** @@ -196,6 +198,8 @@ registerContinuation(options: ContinuationExtraParams, callback: AsyncCallback\< Registers the continuation management service and obtains a token. This API uses an asynchronous callback to return the result. +**Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC + **System capability**: SystemCapability.Ability.DistributedAbilityManager **Parameters** @@ -241,6 +245,8 @@ registerContinuation(options?: ContinuationExtraParams): Promise\; Registers the continuation management service and obtains a token. This API uses a promise to return the result. +**Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC + **System capability**: SystemCapability.Ability.DistributedAbilityManager **Parameters** @@ -292,7 +298,7 @@ on(type: "deviceConnect", callback: Callback\): void; Subscribes to device connection events. This API uses an asynchronous callback to return the result. -> This API is deprecated since API version 9. You are advised to use [on](#continuationmanagerondeviceconnect9) instead. +> This API is deprecated since API version 9. You are advised to use [on](#continuationmanagerondeviceselected9) instead. **System capability**: SystemCapability.Ability.DistributedAbilityManager @@ -331,7 +337,7 @@ on(type: "deviceDisconnect", callback: Callback\): void; Subscribes to device disconnection events. This API uses an asynchronous callback to return the result. -> This API is deprecated since API version 9. You are advised to use [on](#continuationmanagerondevicedisconnect9) instead. +> This API is deprecated since API version 9. You are advised to use [on](#continuationmanagerondeviceunselected9) instead. **System capability**: SystemCapability.Ability.DistributedAbilityManager @@ -368,7 +374,7 @@ off(type: "deviceConnect", callback?: Callback\): void; Unsubscribes from device connection events. This API uses an asynchronous callback to return the result. -> This API is deprecated since API version 9. You are advised to use [off](#continuationmanageroffdeviceconnect9) instead. +> This API is deprecated since API version 9. You are advised to use [off](#continuationmanageroffdeviceselected9) instead. **System capability**: SystemCapability.Ability.DistributedAbilityManager @@ -407,7 +413,7 @@ off(type: "deviceDisconnect", callback?: Callback\): void; Unsubscribes from device disconnection events. This API uses an asynchronous callback to return the result. -> This API is deprecated since API version 9. You are advised to use [off](#continuationmanageroffdevicedisconnect9) instead. +> This API is deprecated since API version 9. You are advised to use [off](#continuationmanageroffdeviceunselected9) instead. **System capability**: SystemCapability.Ability.DistributedAbilityManager @@ -438,19 +444,21 @@ For details about the error codes, see [Distributed Scheduler Error Codes](../er }); ``` -## continuationManager.on("deviceConnect")9+ +## continuationManager.on("deviceSelected")9+ -on(type: "deviceConnect", token: number, callback: Callback\>): void; +on(type: "deviceSelected", token: number, callback: Callback\>): void; Subscribes to device connection events. This API uses an asynchronous callback to return the result. +**Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC + **System capability**: SystemCapability.Ability.DistributedAbilityManager **Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | type | string | Yes| Event type. The value is fixed at **deviceConnect**.| + | type | string | Yes| Event type. The value is fixed at **deviceSelected**.| | token | number | Yes| Token obtained after the registration of the continuation management service.| | callback | Callback\> | Yes| Callback invoked when a device is selected from the device list provided by the device selection module. This callback returns the device ID, type, and name.| @@ -469,12 +477,12 @@ For details about the error codes, see [Distributed Scheduler Error Codes](../er ```ts let token = 1; try { - continuationManager.on("deviceConnect", token, (data) => { - console.info('onDeviceConnect len: ' + data.length); + continuationManager.on("deviceSelected", token, (data) => { + console.info('onDeviceSelected len: ' + data.length); for (let i = 0; i < data.length; i++) { - console.info('onDeviceConnect deviceId: ' + JSON.stringify(data[i].id)); - console.info('onDeviceConnect deviceType: ' + JSON.stringify(data[i].type)); - console.info('onDeviceConnect deviceName: ' + JSON.stringify(data[i].name)); + console.info('onDeviceSelected deviceId: ' + JSON.stringify(data[i].id)); + console.info('onDeviceSelected deviceType: ' + JSON.stringify(data[i].type)); + console.info('onDeviceSelected deviceName: ' + JSON.stringify(data[i].name)); } }); } catch (err) { @@ -482,21 +490,23 @@ For details about the error codes, see [Distributed Scheduler Error Codes](../er } ``` -## continuationManager.on("deviceDisconnect")9+ +## continuationManager.on("deviceUnselected")9+ -on(type: "deviceDisconnect", token: number, callback: Callback\>): void; +on(type: "deviceUnselected", token: number, callback: Callback\>): void; Subscribes to device disconnection events. This API uses an asynchronous callback to return the result. +**Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC + **System capability**: SystemCapability.Ability.DistributedAbilityManager **Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | type | string | Yes| Event type. The value is fixed at **deviceDisconnect**.| + | type | string | Yes| Event type. The value is fixed at **deviceUnselected**.| | token | number | Yes| Token obtained after the registration of the continuation management service.| - | callback | Callback\> | Yes| Callback invoked when a device is unselected from the device list provided by the device selection module. This callback returns the device ID, type, and name.| + | callback | Callback\> | Yes| Callback invoked when a device is unselected from the device list provided by the device selection module. This callback returns the device ID, type, and name.| **Error codes** @@ -513,31 +523,35 @@ For details about the error codes, see [Distributed Scheduler Error Codes](../er ```ts let token = 1; try { - continuationManager.on("deviceDisconnect", token, (data) => { - console.info('onDeviceDisconnect len: ' + data.length); + continuationManager.on("deviceUnselected", token, (data) => { + console.info('onDeviceUnselected len: ' + data.length); for (let i = 0; i < data.length; i++) { - console.info('onDeviceDisconnect deviceId: ' + JSON.stringify(data[i])); + console.info('onDeviceUnselected deviceId: ' + JSON.stringify(data[i].id)); + console.info('onDeviceUnselected deviceType: ' + JSON.stringify(data[i].type)); + console.info('onDeviceUnselected deviceName: ' + JSON.stringify(data[i].name)); } - console.info('onDeviceDisconnect finished.'); + console.info('onDeviceUnselected finished.'); }); } catch (err) { console.error('on failed, cause: ' + JSON.stringify(err)); } ``` -## continuationManager.off("deviceConnect")9+ +## continuationManager.off("deviceSelected")9+ -off(type: "deviceConnect", token: number): void; +off(type: "deviceSelected", token: number): void; Unsubscribes from device connection events. +**Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC + **System capability**: SystemCapability.Ability.DistributedAbilityManager **Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | type | string | Yes| Event type. The value is fixed at **deviceConnect**.| + | type | string | Yes| Event type. The value is fixed at **deviceSelected**.| | token | number | Yes| Token obtained after the registration of the continuation management service.| **Error codes** @@ -555,25 +569,27 @@ For details about the error codes, see [Distributed Scheduler Error Codes](../er ```ts let token = 1; try { - continuationManager.off("deviceConnect", token); + continuationManager.off("deviceSelected", token); } catch (err) { console.error('off failed, cause: ' + JSON.stringify(err)); } ``` -## continuationManager.off("deviceDisconnect")9+ +## continuationManager.off("deviceUnselected")9+ -off(type: "deviceDisconnect", token: number): void; +off(type: "deviceUnselected", token: number): void; Unsubscribes from device disconnection events. +**Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC + **System capability**: SystemCapability.Ability.DistributedAbilityManager **Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | type | string | Yes| Event type. The value is fixed at **deviceDisconnect**.| + | type | string | Yes| Event type. The value is fixed at **deviceUnselected**.| | token | number | Yes| Token obtained after the registration of the continuation management service.| **Error codes** @@ -591,7 +607,7 @@ For details about the error codes, see [Distributed Scheduler Error Codes](../er ```ts let token = 1; try { - continuationManager.off("deviceDisconnect", token); + continuationManager.off("deviceUnselected", token); } catch (err) { console.error('off failed, cause: ' + JSON.stringify(err)); } @@ -745,6 +761,8 @@ startContinuationDeviceManager(token: number, callback: AsyncCallback\): v Starts the device selection module to show the list of available devices on the network. This API does not involve any filter parameters and uses an asynchronous callback to return the result. +**Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC + **System capability**: SystemCapability.Ability.DistributedAbilityManager **Parameters** @@ -786,6 +804,8 @@ startContinuationDeviceManager(token: number, options: ContinuationExtraParams, Starts the device selection module to show the list of available devices on the network. This API uses an asynchronous callback to return the result. +**Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC + **System capability**: SystemCapability.Ability.DistributedAbilityManager **Parameters** @@ -831,6 +851,8 @@ startContinuationDeviceManager(token: number, options?: ContinuationExtraParams) Starts the device selection module to show the list of available devices on the network. This API uses a promise to return the result. +**Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC + **System capability**: SystemCapability.Ability.DistributedAbilityManager **Parameters** @@ -978,6 +1000,8 @@ updateContinuationState(token: number, deviceId: string, status: DeviceConnectSt Instructs the device selection module to update the device connection state. This API uses an asynchronous callback to return the result. +**Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC + **System capability**: SystemCapability.Ability.DistributedAbilityManager **Parameters** @@ -1022,6 +1046,8 @@ updateContinuationState(token: number, deviceId: string, status: DeviceConnectSt Instructs the device selection module to update the device connection state. This API uses a promise to return the result. +**Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC + **System capability**: SystemCapability.Ability.DistributedAbilityManager **Parameters** @@ -1157,6 +1183,8 @@ unregisterContinuation(token: number, callback: AsyncCallback\): void; Deregisters the continuation management service. This API uses an asynchronous callback to return the result. +**Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC + **System capability**: SystemCapability.Ability.DistributedAbilityManager **Parameters** @@ -1198,6 +1226,8 @@ unregisterContinuation(token: number): Promise\; Deregisters the continuation management service. This API uses a promise to return the result. +**Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC + **System capability**: SystemCapability.Ability.DistributedAbilityManager **Parameters** diff --git a/en/application-dev/reference/apis/js-apis-convertxml.md b/en/application-dev/reference/apis/js-apis-convertxml.md index 70d35b6cb168e6f10b847a42bdefa8fd53eb3d40..4c66c928fb7ee6c5482d39db7b39acaa6793691e 100644 --- a/en/application-dev/reference/apis/js-apis-convertxml.md +++ b/en/application-dev/reference/apis/js-apis-convertxml.md @@ -47,21 +47,27 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** ```js -let xml = - '' + - '' + - ' Happy' + - ' Work' + - ' Play' + - ''; -let conv = new convertxml.ConvertXML() -let options = {trim : false, declarationKey:"_declaration", - instructionKey : "_instruction", attributesKey : "_attributes", - textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype", - commentKey : "_comment", parentKey : "_parent", typeKey : "_type", - nameKey : "_name", elementsKey : "_elements"} -let result = JSON.stringify(conv.convertToJSObject(xml, options)); -console.log(result); +try { + let xml = + '' + + '' + + ' Happy' + + ' Work' + + ' Play' + + ''; + let conv = new convertxml.ConvertXML() + let options = { + trim: false, declarationKey: "_declaration", + instructionKey: "_instruction", attributesKey: "_attributes", + textKey: "_text", cdataKey: "_cdata", doctypeKey: "_doctype", + commentKey: "_comment", parentKey: "_parent", typeKey: "_type", + nameKey: "_name", elementsKey: "_elements" + } + let result = JSON.stringify(conv.convertToJSObject(xml, options)); + console.log(result); +} catch (e) { + console.log(e.toString()); +} // Output (non-compact) // {"_declaration":{"_attributes":{"version":"1.0","encoding":"utf-8"}},"_elements":[{"_type":"element","_name":"note","_attributes":{"importance":"high","logged":"true"},"_elements":[{"_type":"element","_name":"title","_elements":[{"_type":"text","_text":"Happy"}]},{"_type":"element","_name":"todo","_elements":[{"_type":"text","_text":"Work"}]},{"_type":"element","_name":"todo","_elements":[{"_type":"text","_text":"Play"}]}]}]} ``` diff --git a/en/application-dev/reference/apis/js-apis-data-distributedobject.md b/en/application-dev/reference/apis/js-apis-data-distributedobject.md index 18b94e97c13d6191b5eb49de8254c9189ef3acbc..5c27d183e38680ec392471f55e374a5127714e82 100644 --- a/en/application-dev/reference/apis/js-apis-data-distributedobject.md +++ b/en/application-dev/reference/apis/js-apis-data-distributedobject.md @@ -2,7 +2,7 @@ The **distributedDataObject** module provides basic data object management, including creating, querying, deleting, modifying, and subscribing to data objects, and distributed data object collaboration for the same application among multiple devices. -> **NOTE**
+> **NOTE** > > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. @@ -15,7 +15,7 @@ import distributedObject from '@ohos.data.distributedDataObject'; ## distributedObject.create9+ -create(context: Context, source: object): DistributedObjectV9 +create(context: Context, source: object): DataObject Creates a distributed data object. @@ -25,14 +25,14 @@ Creates a distributed data object. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| context | Context | Yes| Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).| +| context | Context | Yes| Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-uiAbilityContext.md).| | source | object | Yes| Attributes of the distributed data object.| **Return value** | Type| Description| | -------- | -------- | -| [DistributedObjectV9](#distributedobjectv9) | Distributed data object created.| +| [DataObject](#dataobject) | Distributed data object created.| **Example** @@ -54,15 +54,15 @@ Stage model: // Import the module. import distributedObject from '@ohos.data.distributedDataObject'; import UIAbility from '@ohos.app.ability.UIAbility'; -// Obtain the context. -let context; + +let g_object = null; + class EntryAbility extends UIAbility { onWindowStageCreate(windowStage){ - context = this.context + // Create a distributed data object, which has attributes of the string, number, boolean, and object types. + g_object = distributedObject.create(this.context, {name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); } } -// Create a distributed data object, which contains attributes of the string, number, boolean, and object types. -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); ``` ## distributedObject.genSessionId @@ -108,9 +108,9 @@ Called when the **revokeSave()** API is successfully called. | -------- | -------- | -------- | -------- | | sessionId | string | Yes| Unique ID for multi-device collaboration.| -## DistributedObjectV9 +## DataObject -Represents a distributed data object. +Provides APIs for managing a distributed data object. Before using any API of this class, use [create()](#distributedobjectcreate9) to create a **DataObject** object. ### setSessionId9+ @@ -131,7 +131,7 @@ Sets a session ID for synchronization. Automatic synchronization is performed fo **Error codes** - For details about the error codes, see [Distributed Data Object Error Codes] (../errorcodes/errorcode-distributed-dataObject.md). +For details about the error codes, see [Distributed Data Object Error Codes](../errorcodes/errorcode-distributed-dataObject.md). | ID| Error Message| | -------- | -------- | @@ -139,35 +139,10 @@ Sets a session ID for synchronization. Automatic synchronization is performed fo **Example** -FA model: - ```js -import distributedObject from '@ohos.data.distributedDataObject'; -import featureAbility from '@ohos.ability.featureAbility'; -// Obtain the context. -let context = featureAbility.getContext(); -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); // Add g_object to the distributed network. g_object.setSessionId(distributedObject.genSessionId(), ()=>{ - console.log("join session"); -}); -``` -Stage model: - -```ts -import distributedObject from '@ohos.data.distributedDataObject'; -import UIAbility from '@ohos.app.ability.UIAbility'; -// Obtain the context. -let context; -class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage){ - context = this.context - } -} -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); -// Add g_object to the distributed network. -g_object.setSessionId(distributedObject.genSessionId(), ()=>{ - console.log("join session"); + console.info("join session"); }); ``` @@ -189,7 +164,7 @@ Exits all joined sessions. **Error codes** - For details about the error codes, see [Distributed Data Object Error Codes] (../errorcodes/errorcode-distributed-dataObject.md). + For details about the error codes, see [Distributed Data Object Error Codes](../errorcodes/errorcode-distributed-dataObject.md). | ID| Error Message| | -------- | -------- | @@ -197,43 +172,14 @@ Exits all joined sessions. **Example** -FA model: - ```js -import distributedObject from '@ohos.data.distributedDataObject'; -import featureAbility from '@ohos.ability.featureAbility'; -// Obtain the context. -let context = featureAbility.getContext(); -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); -// Add g_object to the distributed network. -g_object.setSessionId(distributedObject.genSessionId(), ()=>{ - console.log("join session"); -}); -// Exit the distributed network. -g_object.setSessionId(() => { - console.log("leave all lession."); -}); -``` -Stage model: - -```ts -import distributedObject from '@ohos.data.distributedDataObject'; -import UIAbility from '@ohos.app.ability.UIAbility'; -// Obtain the context. -let context; -class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage){ - context = this.context - } -} -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); // Add g_object to the distributed network. g_object.setSessionId(distributedObject.genSessionId(), ()=>{ - console.log("join session"); + console.info("join session"); }); // Exit the distributed network. g_object.setSessionId(() => { - console.log("leave all lession."); + console.info("leave all lession."); }); ``` @@ -261,7 +207,7 @@ Sets a session ID for synchronization. Automatic synchronization is performed fo **Error codes** - For details about the error codes, see [Distributed Data Object Error Codes] (../errorcodes/errorcode-distributed-dataObject.md). + For details about the error codes, see [Distributed Data Object Error Codes](../errorcodes/errorcode-distributed-dataObject.md). | ID| Error Message| | -------- | -------- | @@ -269,40 +215,7 @@ Sets a session ID for synchronization. Automatic synchronization is performed fo **Example** -FA model: - ```js -import distributedObject from '@ohos.data.distributedDataObject'; -import featureAbility from '@ohos.ability.featureAbility'; -// Obtain the context. -let context = featureAbility.getContext(); -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); -// Add g_object to the distributed network. -g_object.setSessionId(distributedObject.genSessionId()).then (()=>{ - console.log("join session."); - }).catch((error)=>{ - console.info("error:" + error.code + error.message); -}); -// Exit the distributed network. -g_object.setSessionId().then (()=>{ - console.log("leave all lession."); - }).catch((error)=>{ - console.info("error:" + error.code + error.message); -}); -``` -Stage model: - -```ts -import distributedObject from '@ohos.data.distributedDataObject'; -import UIAbility from '@ohos.app.ability.UIAbility'; -// Obtain the context. -let context; -class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage){ - context = this.context - } -} -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); // Add g_object to the distributed network. g_object.setSessionId(distributedObject.genSessionId()).then (()=>{ console.info("join session."); @@ -311,7 +224,7 @@ g_object.setSessionId(distributedObject.genSessionId()).then (()=>{ }); // Exit the distributed network. g_object.setSessionId().then (()=>{ - console.log("leave all lession."); + console.info("leave all lession."); }).catch((error)=>{ console.info("error:" + error.code + error.message); }); @@ -321,7 +234,7 @@ g_object.setSessionId().then (()=>{ on(type: 'change', callback: Callback<{ sessionId: string, fields: Array<string> }>): void -Subscribes to the data change of this distributed data object. +Subscribes to data changes of this distributed data object. **System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject @@ -334,38 +247,7 @@ Subscribes to the data change of this distributed data object. **Example** -FA model: - ```js -import distributedObject from '@ohos.data.distributedDataObject'; -import featureAbility from '@ohos.ability.featureAbility'; -// Obtain the context. -let context = featureAbility.getContext(); -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); -globalThis.changeCallback = (sessionId, changeData) => { - console.info("change" + sessionId); - if (changeData != null && changeData != undefined) { - changeData.forEach(element => { - console.info("changed !" + element + " " + g_object[element]); - }); - } -} -g_object.on("change", globalThis.changeCallback); -``` - -Stage model: - -```ts -import distributedObject from '@ohos.data.distributedDataObject'; -import UIAbility from '@ohos.app.ability.UIAbility'; -// Obtain the context. -let context; -class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage){ - context = this.context - } -} -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); globalThis.changeCallback = (sessionId, changeData) => { console.info("change" + sessionId); if (changeData != null && changeData != undefined) { @@ -381,7 +263,7 @@ g_object.on("change", globalThis.changeCallback); off(type: 'change', callback?: Callback<{ sessionId: string, fields: Array<string> }>): void -Unsubscribes from the data change of this distributed data object. +Unsubscribes from the data changes of this distributed data object. **System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject @@ -395,33 +277,7 @@ Unsubscribes from the data change of this distributed data object. **Example** -FA model: - ```js -import distributedObject from '@ohos.data.distributedDataObject'; -import featureAbility from '@ohos.ability.featureAbility'; -// Obtain the context. -let context = featureAbility.getContext(); -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); -// Unregister the specified data change callback. -g_object.off("change", globalThis.changeCallback); -// Unregister all data change callbacks. -g_object.off("change"); -``` - -Stage model: - -```ts -import distributedObject from '@ohos.data.distributedDataObject'; -import UIAbility from '@ohos.app.ability.UIAbility'; -// Obtain the context. -let context; -class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage){ - context = this.context - } -} -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); // Unregister the specified data change callback. g_object.off("change", globalThis.changeCallback); // Unregister all data change callbacks. @@ -432,7 +288,7 @@ g_object.off("change"); on(type: 'status', callback: Callback<{ sessionId: string, networkId: string, status: 'online' | 'offline' }>): void -Subscribes to the status change of this distributed data object. +Subscribes to statue changes of this distributed data object. **System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject @@ -445,36 +301,10 @@ Subscribes to the status change of this distributed data object. **Example** -FA model: - ```js -import distributedObject from '@ohos.data.distributedDataObject'; -import featureAbility from '@ohos.ability.featureAbility'; -// Obtain the context. -let context = featureAbility.getContext(); globalThis.statusCallback = (sessionId, networkId, status) => { globalThis.response += "status changed " + sessionId + " " + status + " " + networkId; } -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); -g_object.on("status", globalThis.statusCallback); -``` - -Stage model: - -```ts -import distributedObject from '@ohos.data.distributedDataObject'; -import UIAbility from '@ohos.app.ability.UIAbility'; -// Obtain the context. -let context; -class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage){ - context = this.context - } -} -globalThis.statusCallback = (sessionId, networkId, status) => { - globalThis.response += "status changed " + sessionId + " " + status + " " + networkId; -} -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); g_object.on("status", globalThis.statusCallback); ``` @@ -496,40 +326,11 @@ Unsubscribes from the status change of this distributed data object. **Example** -FA model: - ```js -import distributedObject from '@ohos.data.distributedDataObject'; -import featureAbility from '@ohos.ability.featureAbility'; -// Obtain the context. -let context = featureAbility.getContext(); -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); globalThis.statusCallback = (sessionId, networkId, status) => { globalThis.response += "status changed " + sessionId + " " + status + " " + networkId; } -// Unsubscribe from the specified status change callback for the distributed data object. -g_object.off("status",globalThis.statusCallback); -// Unregister all status change callbacks. -g_object.off("status"); -``` - -Stage model: - -```ts -import distributedObject from '@ohos.data.distributedDataObject'; -import UIAbility from '@ohos.app.ability.UIAbility'; -// Obtain the context. -let context; -class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage){ - context = this.context - } -} -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); -globalThis.statusCallback = (sessionId, networkId, status) => { - globalThis.response += "status changed " + sessionId + " " + status + " " + networkId; -} -// Unsubscribe from all status change callbacks for the distributed data object. +// Unregister the specified status change callback. g_object.off("status",globalThis.statusCallback); // Unregister all status change callbacks. g_object.off("status"); @@ -560,37 +361,10 @@ The saved data will be released in the following cases: **Example** -FA model: -```ts -import distributedObject from '@ohos.data.distributedDataObject'; -import featureAbility from '@ohos.ability.featureAbility'; -// Obtain the context. -let context = featureAbility.getContext(); -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false}); -g_object.setSessionId("123456"); -g_object.save("local", (result) => { - console.log("save callback"); - console.info("save sessionId: " + result.sessionId); - console.info("save version: " + result.version); - console.info("save deviceId: " + result.deviceId); -}); -``` - -Stage model: ```ts -import distributedObject from '@ohos.data.distributedDataObject'; -import UIAbility from '@ohos.app.ability.UIAbility'; -// Obtain the context. -let context; -class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage){ - context = this.context - } -} -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false}); g_object.setSessionId("123456"); g_object.save("local", (result) => { - console.log("save callback"); + console.info("save callback"); console.info("save sessionId: " + result.sessionId); console.info("save version: " + result.version); console.info("save deviceId: " + result.deviceId); @@ -627,40 +401,10 @@ The saved data will be released in the following cases: **Example** -FA model: - -```js -import distributedObject from '@ohos.data.distributedDataObject'; -import featureAbility from '@ohos.ability.featureAbility'; -// Obtain the context. -let context = featureAbility.getContext(); -let g_object = distributedObject.create(context,{name:"Amy", age:18, isVis:false}); -g_object.setSessionId("123456"); -g_object.save("local").then((result) => { - console.log("save callback"); - console.info("save sessionId " + result.sessionId); - console.info("save version " + result.version); - console.info("save deviceId " + result.deviceId); -}, () => { - console.error("save failed"); -}); -``` -Stage model: - ```js -import distributedObject from '@ohos.data.distributedDataObject'; -import UIAbility from '@ohos.app.ability.UIAbility'; -// Obtain the context. -let context; -class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage){ - context = this.context - } -} -let g_object = distributedObject.create(context,{name:"Amy", age:18, isVis:false}); g_object.setSessionId("123456"); g_object.save("local").then((result) => { - console.log("save callback"); + console.info("save callback"); console.info("save sessionId " + result.sessionId); console.info("save version " + result.version); console.info("save deviceId " + result.deviceId); @@ -673,7 +417,7 @@ g_object.save("local").then((result) => { revokeSave(callback: AsyncCallback<RevokeSaveSuccessResponse>): void -Revokes the saving operation of a distributed data object. This API uses an asynchronous callback to return the result. +Revokes the saving operation of this distributed data object. This API uses an asynchronous callback to return the result. If the object is saved on the local device, the data saved on all trusted devices will be deleted. If the object is stored on another device, the data on the local device will be deleted. @@ -688,54 +432,19 @@ If the object is stored on another device, the data on the local device will be **Example** -FA model: - ```js -import distributedObject from '@ohos.data.distributedDataObject'; -import featureAbility from '@ohos.ability.featureAbility'; -// Obtain the context. -let context = featureAbility.getContext(); -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false}); g_object.setSessionId("123456"); // Save data for persistence. g_object.save("local", (result) => { - console.log("save callback"); + console.info("save callback"); console.info("save sessionId " + result.sessionId); console.info("save version " + result.version); console.info("save deviceId " + result.deviceId); }); // Delete the persistence data. g_object.revokeSave((result) => { - console.log("revokeSave callback"); - console.log("revokeSave sessionId " + result.sessionId); -}); -``` - -Stage model: - -```ts -import distributedObject from '@ohos.data.distributedDataObject'; -import UIAbility from '@ohos.app.ability.UIAbility'; -// Obtain the context. -let context; -class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage) { - context = this.context - } -} -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false}); -g_object.setSessionId("123456"); -// Save data for persistence. -g_object.save("local", (result) => { - console.log("save callback"); - console.info("save sessionId " + result.sessionId); - console.info("save version " + result.version); - console.info("save deviceId " + result.deviceId); -}); -// Delete the persistence data. -g_object.revokeSave((result) => { - console.log("revokeSave callback"); - console.log("revokeSave sessionId " + result.sessionId); + console.info("revokeSave callback"); + console.info("revokeSave sessionId " + result.sessionId); }); ``` @@ -743,7 +452,7 @@ g_object.revokeSave((result) => { revokeSave(): Promise<RevokeSaveSuccessResponse> -Revokes the saving operation of a distributed data object. This API uses a promise to return the result. +Revokes the saving operation of this distributed data object. This API uses a promise to return the result. If the object is saved on the local device, the data saved on all trusted devices will be deleted. If the object is stored on another device, the data on the local device will be deleted. @@ -758,60 +467,21 @@ If the object is stored on another device, the data on the local device will be **Example** -FA model: - ```ts -import distributedObject from '@ohos.data.distributedDataObject'; -import featureAbility from '@ohos.ability.featureAbility'; -// Obtain the context. -let context = featureAbility.getContext(); -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false}); g_object.setSessionId("123456"); // Save data for persistence. g_object.save("local").then((result) => { - console.log("save callback"); - console.info("save sessionId " + result.sessionId); - console.info("save version " + result.version); - console.info("save deviceId " + result.deviceId); -}, () => { - console.error("save failed"); -}); -// Delete the persistence data. -g_object.revokeSave().then((result) => { - console.log("revokeSave callback"); - console.log("sessionId" + result.sessionId); -}, () => { - console.error("revokeSave failed"); -}); -``` - -Stage model: - -```ts -import distributedObject from '@ohos.data.distributedDataObject'; -import UIAbility from '@ohos.app.ability.UIAbility'; -// Obtain the context. -let context; -class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage) { - context = this.context - } -} -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false}); -g_object.setSessionId("123456"); -g_object.save("local").then((result) => { - console.log("save callback"); + console.info("save callback"); console.info("save sessionId " + result.sessionId); console.info("save version " + result.version); console.info("save deviceId " + result.deviceId); }, () => { console.error("save failed"); }); - // Delete the persistence data. g_object.revokeSave().then((result) => { - console.log("revokeSave callback"); - console.log("sessionId" + result.sessionId); + console.info("revokeSave callback"); + console.info("sessionId" + result.sessionId); }, () => { console.error("revokeSave failed"); }); @@ -824,7 +494,7 @@ createDistributedObject(source: object): DistributedObject Creates a distributed data object. -> **NOTE**
+> **NOTE** > > This API is supported since API version 8 and deprecated since API version 9. You are advised to use **distributedObject.create**. @@ -852,7 +522,7 @@ let g_object = distributedObject.createDistributedObject({name:"Amy", age:18, is ## DistributedObject(deprecated) -Provides APIs for managing a distributed data object. +Provides APIs for managing a distributed data object. Before using any API of this class, use [createDistributedObject()](#distributedobjectcreatedistributedobjectdeprecated) to create a **DistributedObject** object. ### setSessionId(deprecated) @@ -860,7 +530,7 @@ setSessionId(sessionId?: string): boolean Sets a session ID for synchronization. Automatic synchronization is performed for multiple devices with the same session ID on a trusted network. -> **NOTE**
+> **NOTE** > > This API is supported since API version 8 and deprecated since API version 9. You are advised to use [setSessionId](#setsessionid9). @@ -897,7 +567,7 @@ on(type: 'change', callback: Callback<{ sessionId: string, fields: Array<stri Subscribes to data changes of this distributed data object. -> **NOTE**
+> **NOTE** > > This API is supported since API version 8 and deprecated since API version 9. You are advised to use [on('change')](#onchange9). @@ -932,7 +602,7 @@ off(type: 'change', callback?: Callback<{ sessionId: string, fields: Array<st Unsubscribes from the data changes of this distributed data object. -> **NOTE**
+> **NOTE** > > This API is supported since API version 8 and deprecated since API version 9. You are advised to use [off('change')](#offchange9). @@ -963,7 +633,7 @@ on(type: 'status', callback: Callback<{ sessionId: string, networkId: string, st Subscribes to status changes of this distributed data object. -> **NOTE**
+> **NOTE** > > This API is supported since API version 8 and deprecated since API version 9. You are advised to use [on('status')](#onstatus9). @@ -993,9 +663,9 @@ off(type: 'status', callback?: Callback<{ sessionId: string, deviceId: string, s Unsubscribes from the status change of this distributed data object. -> **NOTE**
+> **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [off('status')](#offstatus9) instead. +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [off('status')](#offstatus9). **System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject @@ -1004,7 +674,7 @@ Unsubscribes from the status change of this distributed data object. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | type | string | Yes| Event type to unsubscribe from. The value is **status**, which indicates the status change (online or offline) of the distributed data object. | -| callback | Callback<{ sessionId: string, deviceId: string, status: 'online' \| 'offline' }> | No| Callback for status changes. If this parameter is not specified, all status change callbacks of this distributed data object will be unsubscribed from.
**sessionId** indicates the session ID of the distributed data object.
**deviceId** indicates the device ID of the distributed data object.
**status** indicates the object status, which can be online or offline.| +| callback | Callback<{ sessionId: string, deviceId: string, status: 'online' \| 'offline' }> | No| Callback for status changes. If this parameter is not specified, all status change callbacks of this distributed data object will be unregistered.
**sessionId** indicates the session ID of the distributed data object.
**deviceId** indicates the device ID of the distributed data object.
**status** indicates the object status, which can be online or offline.| **Example** diff --git a/en/application-dev/reference/apis/js-apis-data-preferences.md b/en/application-dev/reference/apis/js-apis-data-preferences.md index b51525e00e7711641c1cc048bdce31565a5b81c4..b14256c20d12c8fedd2bb6d8f0b7f38091bbc8d5 100644 --- a/en/application-dev/reference/apis/js-apis-data-preferences.md +++ b/en/application-dev/reference/apis/js-apis-data-preferences.md @@ -22,8 +22,8 @@ import data_preferences from '@ohos.data.preferences'; | Name | Type| Readable| Writable| Description | | ---------------- | -------- | ---- | ---- | --------------------------------------- | -| MAX_KEY_LENGTH | number | Yes | No | Maximum length of a key. The key must be less than 80 bytes. | -| MAX_VALUE_LENGTH | number | Yes | No | Maximum length of a value. The value must be less than 8192 bytes.| +| MAX_KEY_LENGTH | number | Yes | No | Maximum length of a key. The maximum key length is 80 bytes. | +| MAX_VALUE_LENGTH | number | Yes | No | Maximum length of a value. The maximum value length is 8192 bytes.| ## data_preferences.getPreferences @@ -38,7 +38,7 @@ Obtains a **Preferences** instance. This API uses an asynchronous callback to re | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------ | ---- | ------------------------------------------------------------ | -| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md). | +| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-uiAbilityContext.md). | | name | string | Yes | Name of the **Preferences** instance.| | callback | AsyncCallback<[Preferences](#preferences)> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **object** is the **Preferences** instance obtained. Otherwise, **err** is an error code.| @@ -55,39 +55,39 @@ let preferences = null; try { data_preferences.getPreferences(context, 'mystore', function (err, val) { if (err) { - console.info("Failed to get the preferences. code =" + err.code + ", message =" + err.message); + console.info("Failed to obtain the preferences. code =" + err.code + ", message =" + err.message); return; } - console.info("Got the preferences successfully."); + preferences = val; + console.info("Obtained the preferences successfully."); }) } catch (err) { - console.info("Failed to get the preferences. code =" + err.code + ", message =" + err.message); + console.info("Failed to obtain the preferences. code =" + err.code + ", message =" + err.message); } ``` Stage model: ```ts -// Obtain the context. import UIAbility from '@ohos.app.ability.UIAbility'; -let context = null; -class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage){ - context = this.context; - } -} let preferences = null; -try { - data_preferences.getPreferences(context, 'mystore', function (err, val) { - if (err) { - console.info("Failed to get the preferences. code =" + err.code + ", message =" + err.message); - return; - } - console.info("Got the preferences successfully."); - }) -} catch (err) { - console.info("Failed to get the preferences. code =" + err.code + ", message =" + err.message); + +class EntryAbility extends UIAbility { + onWindowStageCreate(windowStage) { + try { + data_preferences.getPreferences(this.context, 'mystore', function (err, val) { + if (err) { + console.info("Failed to obtain the preferences. code =" + err.code + ", message =" + err.message); + return; + } + preferences = val; + console.info("Obtained the preferences successfully."); + }) + } catch (err) { + console.info("Failed to obtain the preferences. code =" + err.code + ", message =" + err.message); + } + } } ``` @@ -103,7 +103,7 @@ Obtains a **Preferences** instance. This API uses a promise to return the result | Name | Type | Mandatory| Description | | ------- | ------------------------------------- | ---- | ----------------------- | -| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md). | +| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-uiAbilityContext.md). | | name | string | Yes | Name of the **Preferences** instance.| **Return value** @@ -126,38 +126,36 @@ try { let promise = data_preferences.getPreferences(context, 'mystore'); promise.then((object) => { preferences = object; - console.info("Got the preferences successfully."); + console.info("Obtained the preferences successfully."); }).catch((err) => { - console.log("Failed to get the preferences. code =" + err.code + ", message =" + err.message); + console.info("Failed to obtain the preferences. code =" + err.code + ", message =" + err.message); }) } catch(err) { - console.log("Failed to get the preferences. code =" + err.code + ", message =" + err.message); + console.info("Failed to obtain the preferences. code =" + err.code + ", message =" + err.message); } ``` Stage model: ```ts -// Obtain the context. import UIAbility from '@ohos.app.ability.UIAbility'; -let context = null; -class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage){ - context = this.context; - } -} let preferences = null; -try { - let promise = data_preferences.getPreferences(context, 'mystore'); - promise.then((object) => { - preferences = object; - console.info("Got the preferences successfully."); - }).catch((err) => { - console.log("Failed to get the preferences. code =" + err.code + ", message =" + err.message); - }) -} catch(err) { - console.log("Failed to get the preferences. code =" + err.code + ", message =" + err.message); + +class EntryAbility extends UIAbility { + onWindowStageCreate(windowStage) { + try { + let promise = data_preferences.getPreferences(this.context, 'mystore'); + promise.then((object) => { + preferences = object; + console.info("Obtained the preferences successfully."); + }).catch((err) => { + console.info("Failed to obtain the preferences. code =" + err.code + ", message =" + err.message); + }) + } catch(err) { + console.info("Failed to obtain the preferences. code =" + err.code + ", message =" + err.message); + } + } } ``` @@ -177,7 +175,7 @@ The deleted **Preferences** instance cannot be used for data operations. Otherwi | Name | Type | Mandatory| Description | | -------- | ------------------------------------- | ---- | ---------------------------------------------------- | -| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md). | +| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-uiAbilityContext.md). | | name | string | Yes | Name of the **Preferences** instance to delete. | | callback | AsyncCallback<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error code.| @@ -214,25 +212,22 @@ try { Stage model: ```ts -// Obtain the context. import UIAbility from '@ohos.app.ability.UIAbility'; -let context = null; -class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage){ - context = this.context; - } -} -try { - data_preferences.deletePreferences(context, 'mystore', function (err, val) { - if (err) { +class EntryAbility extends UIAbility { + onWindowStageCreate(windowStage) { + try { + data_preferences.deletePreferences(this.context, 'mystore', function (err, val) { + if (err) { + console.info("Failed to delete the preferences. code =" + err.code + ", message =" + err.message); + return; + } + console.info("Deleted the preferences successfully." ); + }) + } catch (err) { console.info("Failed to delete the preferences. code =" + err.code + ", message =" + err.message); - return; } - console.info("Deleted the preferences successfully." ); - }) -} catch (err) { - console.info("Failed to delete the preferences. code =" + err.code + ", message =" + err.message); + } } ``` @@ -252,7 +247,7 @@ The deleted **Preferences** instance cannot be used for data operations. Otherwi | Name | Type | Mandatory| Description | | ------- | ------------------------------------- | ---- | ----------------------- | -| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md). | +| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-uiAbilityContext.md). | | name | string | Yes | Name of the **Preferences** instance to delete.| **Return value** @@ -293,25 +288,22 @@ try { Stage model: ```ts -// Obtain the context. import UIAbility from '@ohos.app.ability.UIAbility'; -let context = null; + class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage){ - context = this.context; + onWindowStageCreate(windowStage) { + try{ + let promise = data_preferences.deletePreferences(this.context, 'mystore'); + promise.then(() => { + console.info("Deleted the preferences successfully."); + }).catch((err) => { + console.info("Failed to delete the preferences. code =" + err.code + ", message =" + err.message); + }) + } catch(err) { + console.info("Failed to delete the preferences. code =" + err.code + ", message =" + err.message); + } } } - -try{ - let promise = data_preferences.deletePreferences(context, 'mystore'); - promise.then(() => { - console.info("Deleted the preferences successfully."); - }).catch((err) => { - console.info("Failed to delete the preferences. code =" + err.code + ", message =" + err.message); - }) -} catch(err) { - console.info("Failed to delete the preferences. code =" + err.code + ", message =" + err.message); -} ``` ## data_preferences.removePreferencesFromCache @@ -328,7 +320,7 @@ The removed **Preferences** instance cannot be used for data operations. Otherwi | Name | Type | Mandatory| Description | | -------- | ------------------------------------- | ---- | ---------------------------------------------------- | -| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md). | +| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-uiAbilityContext.md). | | name | string | Yes | Name of the **Preferences** instance to remove. | | callback | AsyncCallback<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error code.| @@ -357,25 +349,22 @@ try { Stage model: ```ts -// Obtain the context. import UIAbility from '@ohos.app.ability.UIAbility'; -let context = null; -class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage){ - context = this.context; - } -} -try { - data_preferences.removePreferencesFromCache(context, 'mystore', function (err, val) { - if (err) { +class EntryAbility extends UIAbility { + onWindowStageCreate(windowStage) { + try { + data_preferences.removePreferencesFromCache(this.context, 'mystore', function (err, val) { + if (err) { + console.info("Failed to remove the preferences. code =" + err.code + ", message =" + err.message); + return; + } + console.info("Removed the preferences successfully."); + }) + } catch (err) { console.info("Failed to remove the preferences. code =" + err.code + ", message =" + err.message); - return; } - console.info("Removed the preferences successfully."); - }) -} catch (err) { - console.info("Failed to remove the preferences. code =" + err.code + ", message =" + err.message); + } } ``` @@ -394,7 +383,7 @@ The removed **Preferences** instance cannot be used for data operations. Otherwi | Name | Type | Mandatory| Description | | ------- | ------------------------------------- | ---- | ----------------------- | -| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md). | +| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-uiAbilityContext.md). | | name | string | Yes | Name of the **Preferences** instance to remove.| **Return value** @@ -427,25 +416,22 @@ try { Stage model: ```ts -// Obtain the context. import UIAbility from '@ohos.app.ability.UIAbility'; -let context = null; + class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage){ - context = this.context; + onWindowStageCreate(windowStage) { + try { + let promise = data_preferences.removePreferencesFromCache(this.context, 'mystore'); + promise.then(() => { + console.info("Removed the preferences successfully."); + }).catch((err) => { + console.info("Failed to remove the preferences. code =" + err.code + ", message =" + err.message); + }) + } catch(err) { + console.info("Failed to remove the preferences. code =" + err.code + ", message =" + err.message); + } } } - -try { - let promise = data_preferences.removePreferencesFromCache(context, 'mystore'); - promise.then(() => { - console.info("Removed the preferences successfully."); - }).catch((err) => { - console.info("Failed to remove the preferences. code =" + err.code + ", message =" + err.message); - }) -} catch(err) { - console.info("Failed to remove the preferences. code =" + err.code + ", message =" + err.message); -} ``` ## Preferences @@ -459,7 +445,7 @@ Before calling any method of **Preferences**, you must obtain a **Preferences** get(key: string, defValue: ValueType, callback: AsyncCallback<ValueType>): void -Obtains the value of a key. This API uses an asynchronous callback to return the result. If the value is **null** or is not the type of the default value, the default value is returned. +Obtains the value of a key. This API uses an asynchronous callback to return the result. If the value is **null** or is not of the default value type, **defValue** is returned. **System capability**: SystemCapability.DistributedDataManager.Preferences.Core @@ -477,13 +463,13 @@ Obtains the value of a key. This API uses an asynchronous callback to return the try { preferences.get('startup', 'default', function (err, val) { if (err) { - console.info("Failed to get the value of 'startup'. code =" + err.code + ", message =" + err.message); + console.info("Failed to obtain the value of 'startup'. code =" + err.code + ", message =" + err.message); return; } console.info("Obtained the value of 'startup' successfully. val: " + val); }) } catch (err) { - console.info("Failed to get the value of 'startup'. code =" + err.code + ", message =" + err.message); + console.info("Failed to obtain the value of 'startup'. code =" + err.code + ", message =" + err.message); } ``` @@ -492,7 +478,7 @@ try { get(key: string, defValue: ValueType): Promise<ValueType> -Obtains the value of a key. This API uses a promise to return the result. If the value is **null** or is not the type of the default value, the default value is returned. +Obtains the value of a key. This API uses a promise to return the result. If the value is **null** or is not of the default value type, **defValue** is returned. **System capability**: SystemCapability.DistributedDataManager.Preferences.Core @@ -520,7 +506,7 @@ try { console.info("Failed to get value of 'startup'. code =" + err.code + ", message =" + err.message); }) } catch(err) { - console.info("Failed to get the value of 'startup'. code =" + err.code + ", message =" + err.message); + console.info("Failed to obtain the value of 'startup'. code =" + err.code + ", message =" + err.message); } ``` @@ -794,10 +780,10 @@ try { promise.then(() => { console.info("Deleted the key 'startup'."); }).catch((err) => { - console.log("Failed to delete the key 'startup'. code =" + err.code +", message =" + err.message); + console.info("Failed to delete the key 'startup'. code =" + err.code +", message =" + err.message); }) } catch(err) { - console.log("Failed to delete the key 'startup'. code =" + err.code +", message =" + err.message); + console.info("Failed to delete the key 'startup'. code =" + err.code +", message =" + err.message); } ``` @@ -945,7 +931,7 @@ Subscribes to data changes. A callback will be triggered to return the new value try { data_preferences.getPreferences(this.context, 'mystore', function (err, preferences) { if (err) { - console.info("Failed to get the preferences."); + console.info("Failed to obtain the preferences."); return; } let observer = function (key) { @@ -987,7 +973,7 @@ Unsubscribes from data changes. | Name | Type | Mandatory| Description | | -------- | -------------------------------- | ---- | ------------------------------------------ | | type | string | Yes | Event type to unsubscribe from. The value **change** indicates data change events. | -| callback | Callback<{ key : string }> | No | Callback to unregister. If this parameter is left blank, all callbacks for data changes will be unregistered. | +| callback | Callback<{ key : string }> | No | Callback to unregister. If this parameter is left blank, the callbacks used to subscribing to all data changes will be unregistered.| **Example** @@ -995,7 +981,7 @@ Unsubscribes from data changes. try { data_preferences.getPreferences(this.context, 'mystore', function (err, preferences) { if (err) { - console.info("Failed to get the preferences."); + console.info("Failed to obtain the preferences."); return; } let observer = function (key) { diff --git a/en/application-dev/reference/apis/js-apis-data-rdb.md b/en/application-dev/reference/apis/js-apis-data-rdb.md index 8938704647ca8ba7b72770da67da996fd1b2ad5e..44af42decf27264828ef50e8925a8fd598527251 100644 --- a/en/application-dev/reference/apis/js-apis-data-rdb.md +++ b/en/application-dev/reference/apis/js-apis-data-rdb.md @@ -1,2677 +1,267 @@ # @ohos.data.rdb -The relational database (RDB) manages data based on relational models. With the underlying SQLite database, the RDB provides a complete mechanism for managing local databases. To satisfy different needs in complicated scenarios, the RDB offers a series of methods for performing operations such as adding, deleting, modifying, and querying data, and supports direct execution of SQL statements. After an application is deleted, the related RDB store will be automatically deleted. +The relational database (RDB) manages data based on relational models. With the underlying SQLite database, the RDB provides a complete mechanism for managing local databases. To satisfy different needs in complicated scenarios, the RDB offers a series of methods for performing operations such as adding, deleting, modifying, and querying data, and supports direct execution of SQL statements. This module provides the following RDB-related functions: - [RdbPredicates](#rdbpredicates): provides predicates indicating the nature, feature, or relationship of a data entity in an RDB store. It is used to define the operation conditions for an RDB store. - [RdbStore](#rdbstore): provides APIs for managing an RDB store. -> **NOTE**
+> **NOTE** > > The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. > > The APIs of this module are no longer maintained since API version 9. You are advised to use [@ohos.data.relationalStore](js-apis-data-relationalStore.md). -## Modules to Import - -```js -import data_rdb from '@ohos.data.rdb'; -``` - -## data_rdb.getRdbStoreV99+ - -getRdbStoreV9(context: Context, config: StoreConfigV9, version: number, callback: AsyncCallback<RdbStoreV9>): void - -Obtains an **RdbStoreV9** instance. This API uses an asynchronous callback to return the result. You can set parameters for the RDB store based on service requirements and call APIs to perform data operations. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | ---------------------------------------------- | ---- | ------------------------------------------------------------ | -| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).| -| config | [StoreConfigV9](#storeconfigv99) | Yes | Configuration of the RDB store. | -| version | number | Yes | RDB store version.
Currently, automatic RDB upgrades and downgrades performed based on **version** is not supported. | -| callback | AsyncCallback<[RdbStoreV9](#rdbstorev99)> | Yes | Callback invoked to return the **RdbStoreV9** instance obtained. | - -**Error codes** - -For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). - -| **ID**| **Error Message** | -| ------------ | ----------------------- | -| 14800010 | Invalid database name. | -| 14800011 | Database corrupted. | - -**Example** - -FA model: - -```js -// Obtain the context. -import featureAbility from '@ohos.ability.featureAbility' -let context = featureAbility.getContext() - -// Call getRdbStoreV9 after obtaining the context. -const STORE_CONFIGV9 = { name: "RdbTest.db", - securityLevel: data_rdb.SecurityLevel.S1} -data_rdb.getRdbStoreV9(context, STORE_CONFIGV9, 1, function (err, rdbStoreV9) { - if (err) { - console.info("Get RdbStoreV9 failed, err: " + err) - return - } - console.log("Get RdbStoreV9 successfully.") -}) -``` - -Stage model: - -```ts -// Obtain the context. -import Ability from '@ohos.application.Ability' -let context -class MainAbility extends Ability{ - onWindowStageCreate(windowStage){ - context = this.context - } -} - -// Call getRdbStoreV9 after obtaining the context. -const STORE_CONFIGV9 = { name: "RdbTest.db", - securityLevel: data_rdb.SecurityLevel.S1} -data_rdb.getRdbStoreV9(context, STORE_CONFIGV9, 1, function (err, rdbStoreV9) { - if (err) { - console.info("Get RdbStoreV9 failed, err: " + err) - return - } - console.log("Get RdbStoreV9 successfully.") -}) -``` - -## data_rdb.getRdbStoreV99+ - -getRdbStoreV9(context: Context, config: StoreConfigV9, version: number): Promise<RdbStoreV9> - -Obtains an **RdbStoreV9** instance. This API uses a promise to return the result. You can set parameters for the RDB store based on service requirements and call APIs to perform data operations. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| ------- | -------------------------------- | ---- | ------------------------------------------------------------ | -| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).| -| config | [StoreConfigV9](#storeconfigv99) | Yes | Configuration of the RDB store. | -| version | number | Yes | RDB store version.
Currently, automatic RDB upgrades and downgrades performed based on **version** is not supported. | - -**Return value** - -| Type | Description | -| ----------------------------------------- | --------------------------------- | -| Promise<[RdbStoreV9](#rdbstorev999)> | Promise used to return the **RdbStoreV9** instance obtained.| - -**Error codes** - -For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). - -| **ID**| **Error Message** | -| ------------ | ----------------------- | -| 14800010 | Invalid database name. | -| 14800011 | Database corrupted. | - -**Example** - -FA model: - -```js -// Obtain the context. -import featureAbility from '@ohos.ability.featureAbility' -let context = featureAbility.getContext() - -// Call getRdbStoreV9 after obtaining the context. -const STORE_CONFIGV9 = { name: "RdbTest.db", - securityLevel: data_rdb.SecurityLevel.S1} -let promise = data_rdb.getRdbStoreV9(context, STORE_CONFIGV9, 1); -promise.then(async (rdbStoreV9) => { - console.log("Get RdbStoreV9 successfully.") -}).catch((err) => { - console.log("Get RdbStoreV9 failed, err: " + err) -}) -``` - -Stage model: - -```ts -// Obtain the context. -import Ability from '@ohos.application.Ability' -let context -class MainAbility extends Ability{ - onWindowStageCreate(windowStage){ - context = this.context - } -} - -// Call getRdbStoreV9 after obtaining the context. -const STORE_CONFIGV9 = { name: "RdbTest.db", - securityLevel: data_rdb.SecurityLevel.S1} -let promise = data_rdb.getRdbStoreV9(context, STORE_CONFIGV9, 1); -promise.then(async (rdbStoreV9) => { - console.log("Get RdbStoreV9 successfully.") -}).catch((err) => { - console.log("Get RdbStoreV9 failed, err: " + err) -}) -``` - -## data_rdb.deleteRdbStoreV99+ - -deleteRdbStoreV9(context: Context, name: string, callback: AsyncCallback<void>): void - -Deletes an RDB store. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | ------------------------- | ---- | ------------------------------------------------------------ | -| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).| -| name | string | Yes | Name of the RDB store to delete. | -| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. | - -**Error codes** - -For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). - -| **ID**| **Error Message** | -| ------------ | ----------------------- | -| 14800010 | Invalid database name. | - -**Example** - -FA model: - -```js -// Obtain the context. -import featureAbility from '@ohos.ability.featureAbility' -let context = featureAbility.getContext() - -// Call deleteRdbStoreV9 after obtaining the context. -data_rdb.deleteRdbStoreV9(context, "RdbTest.db", function (err) { - if (err) { - console.info("Delete RdbStorev9 failed, err: " + err) - return - } - console.log("Delete RdbStorev9 successfully.") -}) -``` - -Stage model: - -```ts -// Obtain the context. -import Ability from '@ohos.application.Ability' -let context -class MainAbility extends Ability{ - onWindowStageCreate(windowStage){ - context = this.context - } -} - -// Call deleteRdbStoreV9 after obtaining the context. -data_rdb.deleteRdbStoreV9(context, "RdbTest.db", function (err) { - if (err) { - console.info("Delete RdbStoreV9 failed, err: " + err) - return - } - console.log("Delete RdbStoreV9 successfully.") -}) -``` - -## data_rdb.deleteRdbStoreV99+ - -deleteRdbStoreV9(context: Context, name: string): Promise<void> - -Deletes an RDB store. This API uses a promise to return the result. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| ------- | ------- | ---- | ------------------------------------------------------------ | -| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).| -| name | string | Yes | Name of the RDB store to delete. | - -**Return value** - -| Type | Description | -| ------------------- | ------------------------- | -| Promise<void> | Promise that returns no value.| - -**Error codes** - -For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). - -| **ID**| **Error Message** | -| ------------ | ----------------------- | -| 14800010 | Invalid database name. | - -**Example** - -FA model: - -```js -// Obtain the context. -import featureAbility from '@ohos.ability.featureAbility' -let context = featureAbility.getContext() - -// Call deleteRdbStoreV9 after obtaining the context. -let promise = data_rdb.deleteRdbStoreV9(context, "RdbTest.db") -promise.then(()=>{ - console.log("Delete RdbStoreV9 successfully.") -}).catch((err) => { - console.info("Delete RdbStoreV9 failed, err: " + err) -}) -``` - -Stage model: - -```ts -// Obtain the context. -import Ability from '@ohos.application.Ability' -let context -class MainAbility extends Ability{ - onWindowStageCreate(windowStage){ - context = this.context - } -} - -// Call deleteRdbStoreV9 after obtaining the context. -let promise = data_rdb.deleteRdbStoreV9(context, "RdbTest.db") -promise.then(()=>{ - console.log("Delete RdbStoreV9 successfully.") -}).catch((err) => { - console.info("Delete RdbStoreV9 failed, err: " + err) -}) -``` - -## data_rdb.getRdbStore - -getRdbStore(context: Context, config: StoreConfig, version: number, callback: AsyncCallback<RdbStore>): void - -Obtains an RDB store. This API uses an asynchronous callback to return the result. You can set parameters for the RDB store based on service requirements and call APIs to perform data operations. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | ------------------------------------------ | ---- | ------------------------------------------------------------ | -| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).| -| config | [StoreConfig](#storeconfig) | Yes | Configuration of the RDB store. | -| version | number | Yes | RDB store version.
Currently, automatic RDB upgrades and downgrades performed based on **version** is not supported. | -| callback | AsyncCallback<[RdbStore](#rdbstore)> | Yes | Callback invoked to return the RDB store obtained. | - -**Example** - -FA model: - -```js -// Obtain the context. -import featureAbility from '@ohos.ability.featureAbility' -let context = featureAbility.getContext() - -// Call getRdbStore. -const STORE_CONFIG = { name: "RdbTest.db"} -data_rdb.getRdbStore(context, STORE_CONFIG, 1, function (err, rdbStore) { - if (err) { - console.info("Failed to get RdbStore, err: " + err) - return - } - console.log("Got RdbStore successfully.") -}) -``` - -Stage model: - -```ts -// Obtain the context. -import Ability from '@ohos.application.Ability' -let context -class MainAbility extends Ability{ - onWindowStageCreate(windowStage){ - context = this.context - } -} - -// Call getRdbStore. -const STORE_CONFIG = { name: "RdbTest.db"} -data_rdb.getRdbStore(context, STORE_CONFIG, 1, function (err, rdbStore) { - if (err) { - console.info("Failed to get RdbStore, err: " + err) - return - } - console.log("Got RdbStore successfully.") -}) -``` - -## data_rdb.getRdbStore - -getRdbStore(context: Context, config: StoreConfig, version: number): Promise<RdbStore> - -Obtains an RDB store. This API uses a promise to return the result. You can set parameters for the RDB store based on service requirements and call APIs to perform data operations. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| ------- | --------------------------- | ---- | ------------------------------------------------------------ | -| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).| -| config | [StoreConfig](#storeconfig) | Yes | Configuration of the RDB store. | -| version | number | Yes | RDB store version.
Currently, automatic RDB upgrades and downgrades performed based on **version** is not supported. | - -**Return value** - -| Type | Description | -| ------------------------------------ | ------------------------------- | -| Promise<[RdbStore](#rdbstore)> | Promise used to return the RDB store obtained.| - -**Example** - -FA model: - -```js -// Obtain the context. -import featureAbility from '@ohos.ability.featureAbility' -let context = featureAbility.getContext() - -// Call getRdbStore. -const STORE_CONFIG = { name: "RdbTest.db" } -let promise = data_rdb.getRdbStore(context, STORE_CONFIG, 1); -promise.then(async (rdbStore) => { - console.log("Got RdbStore successfully.") -}).catch((err) => { - console.log("Failed to get RdbStore, err: " + err) -}) -``` - -Stage model: - -```ts -// Obtain the context. -import Ability from '@ohos.application.Ability' -let context -class MainAbility extends Ability{ - onWindowStageCreate(windowStage){ - context = this.context - } -} - -// Call getRdbStore. -const STORE_CONFIG = { name: "RdbTest.db" } -let promise = data_rdb.getRdbStore(context, STORE_CONFIG, 1); -promise.then(async (rdbStore) => { - console.log("Got RdbStore successfully.") -}).catch((err) => { - console.log("Failed to get RdbStore, err: " + err) -}) -``` - -## data_rdb.deleteRdbStore - -deleteRdbStore(context: Context, name: string, callback: AsyncCallback<void>): void - -Deletes an RDB store. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | ------------------------- | ---- | ------------------------------------------------------------ | -| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).| -| name | string | Yes | Name of the RDB store to delete. | -| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. | - -**Example** - -FA model: - -```js -// Obtain the context. -import featureAbility from '@ohos.ability.featureAbility' -let context = featureAbility.getContext() - -// Call deleteRdbStore. -data_rdb.deleteRdbStore(context, "RdbTest.db", function (err) { - if (err) { - console.info("Failed to delete RdbStore, err: " + err) - return - } - console.log("Deleted RdbStore successfully.") -}) -``` - -Stage model: - -```ts -// Obtain the context. -import Ability from '@ohos.application.Ability' -let context -class MainAbility extends Ability{ - onWindowStageCreate(windowStage){ - context = this.context - } -} - -// Call deleteRdbStore. -data_rdb.deleteRdbStore(context, "RdbTest.db", function (err) { - if (err) { - console.info("Failed to delete RdbStore, err: " + err) - return - } - console.log("Deleted RdbStore successfully.") -}) -``` - -## data_rdb.deleteRdbStore - -deleteRdbStore(context: Context, name: string): Promise<void> - -Deletes an RDB store. This API uses a promise to return the result. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| ------- | ------- | ---- | ------------------------------------------------------------ | -| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).| -| name | string | Yes | Name of the RDB store to delete. | - -**Return value** - -| Type | Description | -| ------------------- | ------------------------- | -| Promise<void> | Promise that returns no value.| - -**Example** - -FA model: - -```js -// Obtain the context. -import featureAbility from '@ohos.ability.featureAbility' -let context = featureAbility.getContext() - -// Call deleteRdbStore. -let promise = data_rdb.deleteRdbStore(context, "RdbTest.db") -promise.then(() => { - console.log("Deleted RdbStore successfully.") -}).catch((err) => { - console.info("Failed to delete RdbStore, err: " + err) -}) -``` - -Stage model: - -```ts -// Obtain the context. -import Ability from '@ohos.application.Ability' -let context -class MainAbility extends Ability{ - onWindowStageCreate(windowStage){ - context = this.context - } -} - -// Call deleteRdbStore. -let promise = data_rdb.deleteRdbStore(context, "RdbTest.db") -promise.then(()=>{ - console.log("Deleted RdbStore successfully.") -}).catch((err) => { - console.info("Failed to delete RdbStore, err: " + err) -}) -``` - -## RdbPredicatesV99+ - -Defines predicates for an RDB store. This class determines whether the conditional expression for the RDB store is true or false. - - -### constructor9+ - -constructor(name: string) - - -A constructor used to create an **RdbPredicates** object. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------ | -| name | string | Yes | Database table name.| - -**Example** - -```js -let predicatesV9 = new data_rdb.RdbPredicatesV9("EMPLOYEE") -``` - -### inDevices9+ - -inDevices(devices: Array<string>): RdbPredicatesV9 - - -Sets an **RdbPredicatesV9** to specify the remote devices to connect on the network during distributed database synchronization. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| ------- | ------------------- | ---- | -------------------------- | -| devices | Array<string> | Yes | IDs of the remote devices in the same network.| - -**Return value** - -| Type | Description | -| ------------------------------------ | -------------------------- | -| [RdbPredicatesV9](#rdbpredicatesv99) | **RdbPredicatesV9** object created.| - -**Example** - -```js -let predicatesV9 = new data_rdb.RdbPredicatesV9("EMPLOYEE") -predicatesV9.inDevices(['12345678abcde']) -``` - -### inAllDevices9+ - -inAllDevices(): RdbPredicatesV9 - - -Sets an **RdbPredicatesV9** to specify all remote devices on the network to connect during distributed database synchronization. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Return value** - -| Type | Description | -| ------------------------------------ | -------------------------- | -| [RdbPredicatesv9](#rdbpredicatesv99) | **RdbPredicatesV9** object created.| - -**Example** - -```js -let predicatesV9 = new data_rdb.RdbPredicatesV9("EMPLOYEE") -predicatesV9.inAllDevices() -``` - -### equalTo9+ - -equalTo(field: string, value: ValueType): RdbPredicatesV9 - - -Sets an **RdbPredicatesV9** to match the field with data type **ValueType** and value equal to the specified value. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ----------------------- | ---- | ---------------------- | -| field | string | Yes | Column name in the database table. | -| value | [ValueType](#valuetype) | Yes | Value to match the **RdbPredicatesV9**.| - -**Return value** - -| Type | Description | -| ------------------------------------ | -------------------------- | -| [RdbPredicatesV9](#rdbpredicatesv99) | **RdbPredicatesV9** object created.| - -**Example** - -```js -let predicatesV9 = new data_rdb.RdbPredicatesV9("EMPLOYEE") -predicatesV9.equalTo("NAME", "lisi") -``` - - -### notEqualTo9+ - -notEqualTo(field: string, value: ValueType): RdbPredicatesV9 - - -Sets an **RdbPredicatesV9** to match the field with data type **ValueType** and value not equal to the specified value. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ----------------------- | ---- | ---------------------- | -| field | string | Yes | Column name in the database table. | -| value | [ValueType](#valuetype) | Yes | Value to match the **RdbPredicatesV9**.| - -**Return value** - -| Type | Description | -| ------------------------------------ | -------------------------- | -| [RdbPredicatesV9](#rdbpredicatesv99) | **RdbPredicatesV9** object created.| - -**Example** - -```js -let predicatesV9 = new data_rdb.RdbPredicatesV9("EMPLOYEE") -predicatesV9.notEqualTo("NAME", "lisi") -``` - - -### beginWrap9+ - -beginWrap(): RdbPredicatesV9 - - -Adds a left parenthesis to the **RdbPredicatesV9**. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Return value** - -| Type | Description | -| ------------------------------------ | ------------------------- | -| [RdbPredicatesV9](#rdbpredicatesv99) | **RdbPredicatesV9** with a left parenthesis.| - -**Example** - -```js -let predicatesV9 = new data_rdb.RdbPredicatesV9("EMPLOYEE") -predicatesV9.equalTo("NAME", "lisi") - .beginWrap() - .equalTo("AGE", 18) - .or() - .equalTo("SALARY", 200.5) - .endWrap() -``` - -### endWrap9+ - -endWrap(): RdbPredicatesV9 - -Adds a right parenthesis to the **RdbPredicatesV9**. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Return value** - -| Type | Description | -| ------------------------------------ | ------------------------- | -| [RdbPredicatesV9](#rdbpredicatesv99) | **RdbPredicatesV9** with a right parenthesis.| - -**Example** - -```js -let predicatesV9 = new data_rdb.RdbPredicatesV9("EMPLOYEE") -predicatesV9.equalTo("NAME", "lisi") - .beginWrap() - .equalTo("AGE", 18) - .or() - .equalTo("SALARY", 200.5) - .endWrap() -``` - -### or9+ - -or(): RdbPredicatesV9 - -Adds the OR condition to the **RdbPredicatesV9**. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Return value** - -| Type | Description | -| ------------------------------------ | ------------------------- | -| [RdbPredicatesV9](#rdbpredicatesv99) | **RdbPredicatesV9** with the OR condition.| - -**Example** - -```js -let predicatesV9 = new data_rdb.RdbPredicatesV9("EMPLOYEE") -predicatesV9.equalTo("NAME", "Lisa") - .or() - .equalTo("NAME", "Rose") -``` - -### and9+ - -and(): RdbPredicatesV9 - -Adds the AND condition to the **RdbPredicatesV9**. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Return value** - -| Type | Description | -| ------------------------------------ | ------------------------- | -| [RdbPredicatesV9](#rdbpredicatesv99) | **RdbPredicatesV9** with the AND condition.| - -**Example** - -```js -let predicatesV9 = new data_rdb.RdbPredicatesV9("EMPLOYEE") -predicatesV9.equalTo("NAME", "Lisa") - .and() - .equalTo("SALARY", 200.5) -``` - -### contains9+ - -contains(field: string, value: string): RdbPredicatesV9 - -Sets an **RdbPredicatesV9** to match a string containing the specified value. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ---------------------- | -| field | string | Yes | Column name in the database table. | -| value | string | Yes | Value to match the **RdbPredicatesV9**.| - -**Return value** - -| Type | Description | -| ------------------------------------ | -------------------------- | -| [RdbPredicatesV9](#rdbpredicatesv99) | **RdbPredicatesV9** object created.| - -**Example** - -```js -let predicatesV9 = new data_rdb.RdbPredicatesV9("EMPLOYEE") -predicatesV9.contains("NAME", "os") -``` - -### beginsWith9+ - -beginsWith(field: string, value: string): RdbPredicatesV9 - -Sets an **RdbPredicatesV9** to match a string that starts with the specified value. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ---------------------- | -| field | string | Yes | Column name in the database table. | -| value | string | Yes | Value to match the **RdbPredicatesV9**.| - -**Return value** - -| Type | Description | -| ------------------------------------ | -------------------------- | -| [RdbPredicatesV9](#rdbpredicatesv99) | **RdbPredicatesV9** object created.| - -**Example** - -```js -let predicatesV9 = new data_rdb.RdbPredicatesV9("EMPLOYEE") -predicatesV9.beginsWith("NAME", "os") -``` - -### endsWith9+ - -endsWith(field: string, value: string): RdbPredicatesV9 - -Sets an **RdbPredicatesV9** to match a string that ends with the specified value. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ---------------------- | -| field | string | Yes | Column name in the database table. | -| value | string | Yes | Value to match the **RdbPredicatesV9**.| - -**Return value** - -| Type | Description | -| ------------------------------------ | -------------------------- | -| [RdbPredicatesV9](#rdbpredicatesv99) | **RdbPredicatesV9** object created.| - -**Example** - -```js -let predicatesV9 = new data_rdb.RdbPredicatesV9("EMPLOYEE") -predicatesV9.endsWith("NAME", "se") -``` - -### isNull9+ - -isNull(field: string): RdbPredicatesV9 - -Sets an **RdbPredicatesV9** to match the field whose value is null. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------ | -| field | string | Yes | Column name in the database table.| - -**Return value** - -| Type | Description | -| ------------------------------------ | -------------------------- | -| [RdbPredicatesV9](#rdbpredicatesv99) | **RdbPredicatesV9** object created.| - -**Example** - -```js -let predicatesV9 = new data_rdb.RdbPredicatesV9("EMPLOYEE") -predicatesV9.isNull("NAME") -``` - -### isNotNull9+ - -isNotNull(field: string): RdbPredicatesV9 - -Sets an **RdbPredicatesV9** to match the field whose value is not null. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------ | -| field | string | Yes | Column name in the database table.| - -**Return value** - -| Type | Description | -| ------------------------------------ | -------------------------- | -| [RdbPredicatesV9](#rdbpredicatesv99) | **RdbPredicatesV9** object created.| - -**Example** - -```js -let predicatesV9 = new data_rdb.RdbPredicatesV9("EMPLOYEE") -predicatesV9.isNotNull("NAME") -``` - -### like9+ - -like(field: string, value: string): RdbPredicatesV9 - -Sets an **RdbPredicatesV9** to match a string that is similar to the specified value. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ---------------------- | -| field | string | Yes | Column name in the database table. | -| value | string | Yes | Value to match the **RdbPredicatesV9**.| - -**Return value** - -| Type | Description | -| ------------------------------------ | -------------------------- | -| [RdbPredicatesV9](#rdbpredicatesv99) | **RdbPredicatesV9** object created.| - -**Example** - -```js -let predicatesV9 = new data_rdb.RdbPredicatesV9("EMPLOYEE") -predicatesV9.like("NAME", "%os%") -``` - -### glob9+ - -glob(field: string, value: string): RdbPredicatesV9 - -Sets an **RdbPredicatesV9** to match the specified string. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------------------------------------------------ | -| field | string | Yes | Column name in the database table. | -| value | string | Yes | Value to match the **RdbPredicatesV9**.

Wildcards are supported. * indicates zero, one, or multiple digits or characters. **?** indicates a single digit or character.| - -**Return value** - -| Type | Description | -| ------------------------------------ | -------------------------- | -| [RdbPredicatesV9](#rdbpredicatesv99) | **RdbPredicatesV9** object created.| - -**Example** - -```js -let predicatesV9 = new data_rdb.RdbPredicatesV9("EMPLOYEE") -predicatesV9.glob("NAME", "?h*g") -``` - -### between9+ - -between(field: string, low: ValueType, high: ValueType): RdbPredicatesV9 - -Sets an **RdbPredicatesV9** to match the field with data type **ValueType** and value within the specified range. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ----------------------- | ---- | -------------------------- | -| field | string | Yes | Column name in the database table. | -| low | [ValueType](#valuetype) | Yes | Minimum value to match the **RdbPredicatesV9**. | -| high | [ValueType](#valuetype) | Yes | Maximum value to match the **RdbPredicatesV9**.| - -**Return value** - -| Type | Description | -| ------------------------------------ | -------------------------- | -| [RdbPredicatesV9](#rdbpredicatesv99) | **RdbPredicatesV9** object created.| - -**Example** - -```js -let predicatesV9 = new data_rdb.RdbPredicatesV9("EMPLOYEE") -predicatesV9.between("AGE", 10, 50) -``` - -### notBetween9+ - -notBetween(field: string, low: ValueType, high: ValueType): RdbPredicatesV9 - -Sets an **RdbPredicatesV9** to match the field with data type **ValueType** and value out of the specified range. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ----------------------- | ---- | -------------------------- | -| field | string | Yes | Column name in the database table. | -| low | [ValueType](#valuetype) | Yes | Minimum value to match the **RdbPredicatesV9**. | -| high | [ValueType](#valuetype) | Yes | Maximum value to match the **RdbPredicatesV9**.| - -**Return value** - -| Type | Description | -| ------------------------------------ | -------------------------- | -| [RdbPredicatesV9](#rdbpredicatesv99) | **RdbPredicatesV9** object created.| - -**Example** - -```js -let predicatesV9 = new data_rdb.RdbPredicatesV9("EMPLOYEE") -predicatesV9.notBetween("AGE", 10, 50) -``` - -### greaterThan9+ - -greaterThan(field: string, value: ValueType): RdbPredicatesV9 - -Sets an **RdbPredicatesV9** to match the field with data type **ValueType** and value greater than the specified value. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ----------------------- | ---- | ---------------------- | -| field | string | Yes | Column name in the database table. | -| value | [ValueType](#valuetype) | Yes | Value to match the **RdbPredicatesV9**.| - -**Return value** - -| Type | Description | -| ------------------------------------ | -------------------------- | -| [RdbPredicatesV9](#rdbpredicatesv99) | **RdbPredicatesV9** object created.| - -**Example** - -```js -let predicatesV9 = new data_rdb.RdbPredicatesV9("EMPLOYEE") -predicatesV9.greaterThan("AGE", 18) -``` - -### lessThan9+ - -lessThan(field: string, value: ValueType): RdbPredicatesV9 - -Sets an **RdbPredicatesV9** to match the field with data type **ValueType** and value less than the specified value. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ----------------------- | ---- | ---------------------- | -| field | string | Yes | Column name in the database table. | -| value | [ValueType](#valuetype) | Yes | Value to match the **RdbPredicatesV9**.| - -**Return value** - -| Type | Description | -| ------------------------------------ | -------------------------- | -| [RdbPredicatesV9](#rdbpredicatesv99) | **RdbPredicatesV9** object created.| - -**Example** - -```js -let predicatesV9 = new data_rdb.RdbPredicatesV9("EMPLOYEE") -predicatesV9.lessThan("AGE", 20) -``` - -### greaterThanOrEqualTo9+ - -greaterThanOrEqualTo(field: string, value: ValueType): RdbPredicatesV9 - -Sets an **RdbPredicatesV9** to match the field with data type **ValueType** and value greater than or equal to the specified value. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ----------------------- | ---- | ---------------------- | -| field | string | Yes | Column name in the database table. | -| value | [ValueType](#valuetype) | Yes | Value to match the **RdbPredicatesV9**.| - -**Return value** - -| Type | Description | -| ------------------------------------ | -------------------------- | -| [RdbPredicatesV9](#rdbpredicatesv99) | **RdbPredicatesV9** object created.| - -**Example** - -```js -let predicatesV9 = new data_rdb.RdbPredicatesV9("EMPLOYEE") -predicatesV9.greaterThanOrEqualTo("AGE", 18) -``` - -### lessThanOrEqualTo9+ - -lessThanOrEqualTo(field: string, value: ValueType): RdbPredicatesV9 - -Sets an **RdbPredicatesV9** to match the field with data type **ValueType** and value less than or equal to the specified value. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ----------------------- | ---- | ---------------------- | -| field | string | Yes | Column name in the database table. | -| value | [ValueType](#valuetype) | Yes | Value to match the **RdbPredicatesV9**.| - -**Return value** - -| Type | Description | -| ------------------------------------ | -------------------------- | -| [RdbPredicatesV9](#rdbpredicatesv99) | **RdbPredicatesV9** object created.| - -**Example** - -```js -let predicatesV9 = new data_rdb.RdbPredicatesV9("EMPLOYEE") -predicatesV9.lessThanOrEqualTo("AGE", 20) -``` - -### orderByAsc9+ - -orderByAsc(field: string): RdbPredicatesV9 - -Sets an **RdbPredicatesV9** to match the column with values sorted in ascending order. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------ | -| field | string | Yes | Column name in the database table.| - -**Return value** - -| Type | Description | -| ------------------------------------ | -------------------------- | -| [RdbPredicatesV9](#rdbpredicatesv99) | **RdbPredicatesV9** object created.| - -**Example** - -```js -let predicatesV9 = new data_rdb.RdbPredicatesV9("EMPLOYEE") -predicatesV9.orderByAsc("NAME") -``` - -### orderByDesc9+ - -orderByDesc(field: string): RdbPredicatesV9 - -Sets an **RdbPredicatesV9** to match the column with values sorted in descending order. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------ | -| field | string | Yes | Column name in the database table.| - -**Return value** - -| Type | Description | -| ------------------------------------ | -------------------------- | -| [RdbPredicatesV9](#rdbpredicatesv99) | **RdbPredicatesV9** object created.| - -**Example** - -```js -let predicatesV9 = new data_rdb.RdbPredicatesV9("EMPLOYEE") -predicatesV9.orderByDesc("AGE") -``` - -### distinct9+ - -distinct(): RdbPredicatesV9 - -Sets an **RdbPredicatesV9** to filter out duplicate records. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Return value** - -| Type | Description | -| ------------------------------------ | ------------------------------ | -| [RdbPredicatesV9](#rdbpredicatesv99) | **RdbPredicatesV9** object that can filter out duplicate records.| - -**Example** - -```js -let predicatesV9 = new data_rdb.RdbPredicatesV9("EMPLOYEE") -predicatesV9.equalTo("NAME", "Rose").distinct() -``` - -### limitAs9+ - -limitAs(value: number): RdbPredicatesV9 - -Sets an **RdbPredicatesV9** to specify the maximum number of records. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ---------------- | -| value | number | Yes | Maximum number of records.| - -**Return value** - -| Type | Description | -| ------------------------------------ | ------------------------------------ | -| [RdbPredicatesV9](#rdbpredicatesv99) | **RdbPredicatesV9** object that specifies the maximum number of records.| - -**Example** - -```js -let predicatesV9 = new data_rdb.RdbPredicatesV9("EMPLOYEE") -predicatesV9.equalTo("NAME", "Rose").limitAs(3) -``` - -### offsetAs9+ - -offsetAs(rowOffset: number): RdbPredicatesV9 - -Sets an **RdbPredicatesV9** to specify the start position of the returned result. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| --------- | ------ | ---- | ---------------------------------- | -| rowOffset | number | Yes | Number of rows to offset from the beginning. The value is a positive integer.| - -**Return value** - -| Type | Description | -| ------------------------------------ | ------------------------------------ | -| [RdbPredicatesV9](#rdbpredicatesv99) | **RdbPredicatesV9** object that specifies the start position of the returned result.| - -**Example** - -```js -let predicatesV9 = new data_rdb.RdbPredicatesV9("EMPLOYEE") -predicatesV9.equalTo("NAME", "Rose").offsetAs(3) -``` - -### groupBy9+ - -groupBy(fields: Array<string>): RdbPredicatesV9 - -Sets an **RdbPredicatesV9** to group rows that have the same value into summary rows. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ------------------- | ---- | -------------------- | -| fields | Array<string> | Yes | Names of columns to group.| - -**Return value** - -| Type | Description | -| ------------------------------------ | ---------------------- | -| [RdbPredicatesV9](#rdbpredicatesv99) | **RdbPredicatesV9** object that groups rows with the same value.| - -**Example** - -```js -let predicatesV9 = new data_rdb.RdbPredicatesV9("EMPLOYEE") -predicatesV9.groupBy(["AGE", "NAME"]) -``` - -### indexedBy9+ - -indexedBy(field: string): RdbPredicatesV9 - -Sets an **RdbPredicatesV9** to specify the index column. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | -------------- | -| field | string | Yes | Name of the index column.| - -**Return value** - - -| Type | Description | -| ------------------------------------ | ------------------------------------- | -| [RdbPredicatesV9](#rdbpredicatesv99) | **RdbPredicatesV9** object that specifies the index column.| - -**Example** - -```js -let predicatesV9 = new data_rdb.RdbPredicatesV9("EMPLOYEE") -predicatesV9.indexedBy("SALARY_INDEX") -``` - -### in9+ - -in(field: string, value: Array<ValueType>): RdbPredicatesV9 - -Sets an **RdbPredicatesV9** to match the field with data type **Array<ValueType>** and value within the specified range. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ------------------------------------ | ---- | --------------------------------------- | -| field | string | Yes | Column name in the database table. | -| value | Array<[ValueType](#valuetype)> | Yes | Array of **ValueType**s to match.| - -**Return value** - -| Type | Description | -| ------------------------------------ | -------------------------- | -| [RdbPredicatesV9](#rdbpredicatesv99) | **RdbPredicatesV9** object created.| - -**Example** - -```js -let predicatesV9 = new data_rdb.RdbPredicatesV9("EMPLOYEE") -predicatesV9.in("AGE", [18, 20]) -``` - -### notIn9+ - -notIn(field: string, value: Array<ValueType>): RdbPredicatesV9 - -Sets an **RdbPredicatesV9** to match the field with data type **Array<ValueType>** and value out of the specified range. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ------------------------------------ | ---- | ------------------------------------- | -| field | string | Yes | Column name in the database table. | -| value | Array<[ValueType](#valuetype)> | Yes | Array of **ValueType**s to match.| - -**Return value** - -| Type | Description | -| ------------------------------------ | -------------------------- | -| [RdbPredicatesV9](#rdbpredicatesv99) | **RdbPredicatesV9** object created.| - -**Example** - -```js -let predicatesV9 = new data_rdb.RdbPredicatesV9("EMPLOYEE") -predicatesV9.notIn("NAME", ["Lisa", "Rose"]) -``` - -## RdbStoreV99+ - -Provides methods to manage an RDB store. - -Before using the following APIs, use [executeSql](#executesql) to initialize the database table structure and related data. For details, see [RDB Development](../../database/database-relational-guidelines.md). - -### insert9+ - -insert(table: string, values: ValuesBucket, callback: AsyncCallback<number>):void - -Inserts a row of data into a table. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | ----------------------------- | ---- | ---------------------------------------------------------- | -| table | string | Yes | Name of the target table. | -| values | [ValuesBucket](#valuesbucket) | Yes | Row of data to insert. | -| callback | AsyncCallback<number> | Yes | Callback invoked to return the result. If the operation is successful, the row ID will be returned. Otherwise, **-1** will be returned.| - -**Example** - -```js -const valueBucket = { - "NAME": "Lisa", - "AGE": 18, - "SALARY": 100.5, - "CODES": new Uint8Array([1, 2, 3, 4, 5]), -} -rdbStoreV9.insert("EMPLOYEE", valueBucket, function (status, rowId) { - if (status) { - console.log("Failed to insert data"); - return; - } - console.log("Inserted data successfully, rowId = " + rowId); -}) -``` - -### insert9+ - -insert(table: string, values: ValuesBucket):Promise<number> - -Inserts a row of data into a table. This API uses a promise to return the result. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ----------------------------- | ---- | -------------------------- | -| table | string | Yes | Name of the target table. | -| values | [ValuesBucket](#valuesbucket) | Yes | Row of data to insert.| - -**Return value** - -| Type | Description | -| --------------------- | ------------------------------------------------- | -| Promise<number> | Promise used to return the result. If the operation is successful, the row ID will be returned. Otherwise, **-1** will be returned.| - -**Example** - -```js -const valueBucket = { - "NAME": "Lisa", - "AGE": 18, - "SALARY": 100.5, - "CODES": new Uint8Array([1, 2, 3, 4, 5]), -} -let promise = rdbStoreV9.insert("EMPLOYEE", valueBucket) -promise.then((rowId) => { - console.log("Inserted data successfully, rowId = " + rowId); -}).catch((status) => { - console.log("Failed to insert data"); -}) -``` - -### batchInsert9+ - -batchInsert(table: string, values: Array<ValuesBucket>, callback: AsyncCallback<number>):void - -Batch inserts data into a table. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | ------------------------------------------ | ---- | ------------------------------------------------------------ | -| table | string | Yes | Name of the target table. | -| values | Array<[ValuesBucket](#valuesbucket)> | Yes | An array of data to insert. | -| callback | AsyncCallback<number> | Yes | Callback invoked to return the result. If the operation is successful, the number of inserted data records is returned. Otherwise, **-1** is returned.| - -**Example** - -```js -const valueBucket1 = { - "NAME": "Lisa", - "AGE": 18, - "SALARY": 100.5, - "CODES": new Uint8Array([1, 2, 3, 4, 5]) -} -const valueBucket2 = { - "NAME": "Jack", - "AGE": 19, - "SALARY": 101.5, - "CODES": new Uint8Array([6, 7, 8, 9, 10]) -} -const valueBucket3 = { - "NAME": "Tom", - "AGE": 20, - "SALARY": 102.5, - "CODES": new Uint8Array([11, 12, 13, 14, 15]) -} - -let valueBuckets = new Array(valueBucket1, valueBucket2, valueBucket3); -rdbStoreV9.batchInsert("EMPLOYEE", valueBuckets, function(status, insertNum) { - if (status) { - console.log("batchInsert is failed, status = " + status); - return; - } - console.log("batchInsert is successful, the number of values that were inserted = " + insertNum); -}) -``` - -### batchInsert9+ - -batchInsert(table: string, values: Array<ValuesBucket>):Promise<number> - -Batch inserts data into a table. This API uses a promise to return the result. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ------------------------------------------ | ---- | ---------------------------- | -| table | string | Yes | Name of the target table. | -| values | Array<[ValuesBucket](#valuesbucket)> | Yes | An array of data to insert.| - -**Return value** - -| Type | Description | -| --------------------- | ----------------------------------------------------------- | -| Promise<number> | Promise used to return the result. If the operation is successful, the number of inserted data records is returned. Otherwise, **-1** is returned.| - -**Example** - -```js -const valueBucket1 = { - "NAME": "Lisa", - "AGE": 18, - "SALARY": 100.5, - "CODES": new Uint8Array([1, 2, 3, 4, 5]) -} -const valueBucket2 = { - "NAME": "Jack", - "AGE": 19, - "SALARY": 101.5, - "CODES": new Uint8Array([6, 7, 8, 9, 10]) -} -const valueBucket3 = { - "NAME": "Tom", - "AGE": 20, - "SALARY": 102.5, - "CODES": new Uint8Array([11, 12, 13, 14, 15]) -} - -let valueBuckets = new Array(valueBucket1, valueBucket2, valueBucket3); -let promise = rdbStoreV9.batchInsert("EMPLOYEE", valueBuckets); -promise.then((insertNum) => { - console.log("batchInsert is successful, the number of values that were inserted = " + insertNum); -}).catch((status) => { - console.log("batchInsert is failed, status = " + status); -}) -``` - -### update9+ - -update(values: ValuesBucket, predicates: RdbPredicatesV9, callback: AsyncCallback<number>):void - -Updates data based on the specified **RdbPredicatesV9** object. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| ---------- | ------------------------------------ | ---- | ------------------------------------------------------------ | -| values | [ValuesBucket](#valuesbucket) | Yes | Rows of data to update in the RDB store. The key-value pair is associated with the column name in the target table.| -| predicates | [RdbPredicatesV9](#rdbpredicatesv99) | Yes | Update conditions specified by the **RdbPredicatesV9** object. | -| callback | AsyncCallback<number> | Yes | Callback invoked to return the number of rows updated. | - -**Example** - -```js -const valueBucket = { - "NAME": "Rose", - "AGE": 22, - "SALARY": 200.5, - "CODES": new Uint8Array([1, 2, 3, 4, 5]), -} -let predicatesV9 = new data_rdb.RdbPredicatesV9("EMPLOYEE") -predicatesV9.equalTo("NAME", "Lisa") -rdbStoreV9.update(valueBucket, predicatesV9, function (err, ret) { - if (err) { - console.info("Failed to update data, err: " + err) - return - } - console.log("Updated row count: " + ret) -}) -``` - -### update9+ - -update(values: ValuesBucket, predicates: RdbPredicatesV9):Promise<number> - -Updates data based on the specified **RdbPredicatesV9** object. This API uses a promise to return the result. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| ------------ | ------------------------------------ | ---- | ------------------------------------------------------------ | -| values | [ValuesBucket](#valuesbucket) | Yes | Rows of data to update in the RDB store. The key-value pair is associated with the column name in the target table.| -| predicatesV9 | [RdbPredicatesV9](#rdbpredicatesv99) | Yes | Update conditions specified by the **RdbPredicatesV9** object. | - -**Return value** - -| Type | Description | -| --------------------- | ----------------------------------------- | -| Promise<number> | Promise used to return the number of rows updated.| - -**Example** - -```js -const valueBucket = { - "NAME": "Rose", - "AGE": 22, - "SALARY": 200.5, - "CODES": new Uint8Array([1, 2, 3, 4, 5]), -} -let predicatesV9 = new data_rdb.RdbPredicatesV9("EMPLOYEE") -predicatesV9.equalTo("NAME", "Lisa") -let promise = rdbStoreV9.update(valueBucket, predicatesV9) -promise.then(async (ret) => { - console.log("Updated row count: " + ret) -}).catch((err) => { - console.info("Failed to update data, err: " + err) -}) -``` - -### update9+ - -update(table: string, values: ValuesBucket, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback<number>):void - -Updates data based on the specified **DataSharePredicates** object. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**System API**: This is a system API. - -**Parameters** - -| Name | Type | Mandatory| Description | -| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| table | string | Yes | Name of the target table. | -| values | [ValuesBucket](#valuesbucket) | Yes | Rows of data to update in the RDB store. The key-value pair is associated with the column name in the target table.| -| predicates | [dataSharePredicates.DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | Yes | Update conditions specified by the **DataSharePredicates** object. | -| callback | AsyncCallback<number> | Yes | Callback invoked to return the number of rows updated. | - -**Example** - -```js -import dataSharePredicates from '@ohos.data.dataSharePredicates' -const valueBucket = { - "NAME": "Rose", - "AGE": 22, - "SALARY": 200.5, - "CODES": new Uint8Array([1, 2, 3, 4, 5]), -} -let predicates = new dataSharePredicates.DataSharePredicates() -predicates.equalTo("NAME", "Lisa") -rdbStoreV9.update("EMPLOYEE", valueBucket, predicates, function (err, ret) { - if (err) { - console.info("Failed to update data, err: " + err) - return - } - console.log("Updated row count: " + ret) -}) -``` - -### update9+ - -update(table: string, values: ValuesBucket, predicates: dataSharePredicates.DataSharePredicates):Promise<number> - -Updates data based on the specified **DataSharePredicates** object. This API uses a promise to return the result. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**System API**: This is a system API. - -**Parameters** - -| Name | Type | Mandatory| Description | -| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| table | string | Yes | Name of the target table. | -| values | [ValuesBucket](#valuesbucket) | Yes | Rows of data to update in the RDB store. The key-value pair is associated with the column name in the target table.| -| predicates | [dataSharePredicates.DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | Yes | Update conditions specified by the **DataSharePredicates** object. | - -**Return value** - -| Type | Description | -| --------------------- | ----------------------------------------- | -| Promise<number> | Promise used to return the number of rows updated.| - -**Example** - -```js -import dataSharePredicates from '@ohos.data.dataSharePredicates' -const valueBucket = { - "NAME": "Rose", - "AGE": 22, - "SALARY": 200.5, - "CODES": new Uint8Array([1, 2, 3, 4, 5]), -} -let predicates = new dataSharePredicates.DataSharePredicates() -predicates.equalTo("NAME", "Lisa") -let promise = rdbStoreV9.update("EMPLOYEE", valueBucket, predicates) -promise.then(async (ret) => { - console.log("Updated row count: " + ret) -}).catch((err) => { - console.info("Failed to update data, err: " + err) -}) -``` - -### delete9+ - -delete(predicates: RdbPredicatesV9, callback: AsyncCallback<number>):void - -Deletes data from the RDB store based on the specified **RdbPredicatesV9** object. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| ---------- | ------------------------------------ | ---- | ----------------------------------------- | -| predicates | [RdbPredicatesV9](#rdbpredicatesv99) | Yes | Conditions specified by the **RdbPredicatesV9** object for deleting data.| -| callback | AsyncCallback<number> | Yes | Callback invoked to return the number of rows deleted. | - -**Example** - -```js -let predicatesV9 = new data_rdb.RdbPredicatesV9("EMPLOYEE") -predicatesV9.equalTo("NAME", "Lisa") -rdbStoreV9.delete(predicatesV9, function (err, rows) { - if (err) { - console.info("Failed to delete data, err: " + err) - return - } - console.log("Deleted rows: " + rows) -}) -``` - -### delete9+ - -delete(predicates: RdbPredicatesV9):Promise<number> - -Deletes data from the RDB store based on the specified **RdbPredicatesV9** object. This API uses a promise to return the result. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| ---------- | ------------------------------------ | ---- | ----------------------------------------- | -| predicates | [RdbPredicatesV9](#rdbpredicatesv99) | Yes | Conditions specified by the **RdbPredicatesV9** object for deleting data.| - -**Return value** - -| Type | Description | -| --------------------- | ------------------------------- | -| Promise<number> | Promise used to return the number of rows deleted.| - -**Example** - -```js -let predicatesV9 = new data_rdb.RdbPredicatesV9("EMPLOYEE") -predicatesV9.equalTo("NAME", "Lisa") -let promise = rdbStoreV9.delete(predicatesV9) -promise.then((rows) => { - console.log("Deleted rows: " + rows) -}).catch((err) => { - console.info("Failed to delete data, err: " + err) -}) -``` - -### delete9+ - -delete(table: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback<number>):void - -Deletes data from the RDB store based on the specified **DataSharePredicates** object. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**System API**: This is a system API. - -**Parameters** - -| Name | Type | Mandatory| Description | -| ---------- | ------------------------------------------------------------ | ---- | --------------------------------------------- | -| table | string | Yes | Name of the target table. | -| predicates | [dataSharePredicates.DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | Yes | Conditions specified by the **DataSharePredicates** object for deleting data.| -| callback | AsyncCallback<number> | Yes | Callback invoked to return the number of rows deleted. | - -**Example** - -```js -import dataSharePredicates from '@ohos.data.dataSharePredicates' -let predicates = new dataSharePredicates.DataSharePredicates() -predicates.equalTo("NAME", "Lisa") -rdbStoreV9.delete("EMPLOYEE", predicates, function (err, rows) { - if (err) { - console.info("Failed to delete data, err: " + err) - return - } - console.log("Deleted rows: " + rows) -}) -``` - -### delete9+ - -delete(table: string, predicates: dataSharePredicates.DataSharePredicates):Promise<number> - -Deletes data from the RDB store based on the specified **DataSharePredicates** object. This API uses a promise to return the result. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**System API**: This is a system API. - -**Parameters** - -| Name | Type | Mandatory| Description | -| ---------- | ------------------------------------------------------------ | ---- | --------------------------------------------- | -| table | string | Yes | Name of the target table. | -| predicates | [dataSharePredicates.DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | Yes | Conditions specified by the **DataSharePredicates** object for deleting data.| - -**Return value** - -| Type | Description | -| --------------------- | ------------------------------- | -| Promise<number> | Promise used to return the number of rows deleted.| - -**Example** - -```js -import dataSharePredicates from '@ohos.data.dataSharePredicates' -let predicates = new dataSharePredicates.DataSharePredicates() -predicates.equalTo("NAME", "Lisa") -let promise = rdbStoreV9.delete("EMPLOYEE", predicates) -promise.then((rows) => { - console.log("Deleted rows: " + rows) -}).catch((err) => { - console.info("Failed to delete data, err: " + err) -}) -``` - -### query9+ - -query(predicates: RdbPredicatesV9, columns: Array<string>, callback: AsyncCallback<ResultSetV9>):void - -Queries data from the RDB store based on specified conditions. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| ---------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- | -| predicates | [RdbPredicatesV9](#rdbpredicatesv99) | Yes | Query conditions specified by the **RdbPredicatesV9** object. | -| columns | Array<string> | Yes | Columns to query. If this parameter is not specified, the query applies to all columns. | -| callback | AsyncCallback<[ResultSetV9](js-apis-data-resultset.md)> | Yes | Callback invoked to return the result. If the operation is successful, a **ResultSetV9** object will be returned.| - -**Example** - -```js -let predicatesV9 = new data_rdb.RdbPredicatesV9("EMPLOYEE") -predicatesV9.equalTo("NAME", "Rose") -rdbStoreV9.query(predicatesV9, ["ID", "NAME", "AGE", "SALARY", "CODES"], function (err, resultSetV9) { - if (err) { - console.info("Failed to query data, err: " + err) - return - } - console.log("ResultSet column names: " + resultSetV9.columnNames) - console.log("ResultSet column count: " + resultSetV9.columnCount) -}) -``` - -### query9+ - -query(predicates: RdbPredicatesV9, columns?: Array<string>):Promise<ResultSetV9> - -Queries data from the RDB store based on specified conditions. This API uses a promise to return the result. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| ---------- | ------------------------------------ | ---- | ------------------------------------------------ | -| predicates | [RdbPredicatesV9](#rdbpredicatesv99) | Yes | Query conditions specified by the **RdbPredicatesV9** object. | -| columns | Array<string> | No | Columns to query. If this parameter is not specified, the query applies to all columns.| - -**Return value** - -| Type | Description | -| ------------------------------------------------------- | -------------------------------------------------- | -| Promise<[ResultSetV9](js-apis-data-resultset.md)> | Promise used to return the result. If the operation is successful, a **ResultSetV9** object will be returned.| - -**Example** - - ```js -let predicatesV9 = new data_rdb.RdbPredicatesV9("EMPLOYEE") -predicatesV9.equalTo("NAME", "Rose") -let promise = rdbStoreV9.query(predicatesV9, ["ID", "NAME", "AGE", "SALARY", "CODES"]) -promise.then((resultSetV9) => { - console.log("ResultSet column names: " + resultSetV9.columnNames) - console.log("ResultSet column count: " + resultSetV9.columnCount) -}).catch((err) => { - console.info("Failed to query data, err: " + err) -}) - ``` - -### query9+ - -query(table: string, predicates: dataSharePredicates.DataSharePredicates, columns: Array<string>, callback: AsyncCallback<ResultSetV9>):void - -Queries data from the RDB store based on specified conditions. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**System API**: This is a system API. - -**Parameters** - -| Name | Type | Mandatory| Description | -| ---------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- | -| table | string | Yes | Name of the target table. | -| predicates | [dataSharePredicates.DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | Yes | Query conditions specified by the **DataSharePredicates** object. | -| columns | Array<string> | Yes | Columns to query. If this parameter is not specified, the query applies to all columns. | -| callback | AsyncCallback<[ResultSetV9](js-apis-data-resultset.md)> | Yes | Callback invoked to return the result. If the operation is successful, a **ResultSetV9** object will be returned.| - -**Example** - -```js -import dataSharePredicates from '@ohos.data.dataSharePredicates' -let predicates = new dataSharePredicates.DataSharePredicates() -predicates.equalTo("NAME", "Rose") -rdbStoreV9.query("EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"], function (err, resultSetV9) { - if (err) { - console.info("Failed to query data, err: " + err) - return - } - console.log("ResultSet column names: " + resultSetV9.columnNames) - console.log("ResultSet column count: " + resultSetV9.columnCount) -}) -``` - -### query9+ - -query(table: string, predicates: dataSharePredicates.DataSharePredicates, columns?: Array<string>):Promise<ResultSetV9> - -Queries data from the RDB store based on specified conditions. This API uses a promise to return the result. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**System API**: This is a system API. - -**Parameters** - -| Name | Type | Mandatory| Description | -| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------ | -| table | string | Yes | Name of the target table. | -| predicates | [dataSharePredicates.DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | Yes | Query conditions specified by the **DataSharePredicates** object. | -| columns | Array<string> | No | Columns to query. If this parameter is not specified, the query applies to all columns.| - -**Return value** - -| Type | Description | -| ------------------------------------------------------- | -------------------------------------------------- | -| Promise<[ResultSetV9](js-apis-data-resultset.md)> | Promise used to return the result. If the operation is successful, a **ResultSetV9** object will be returned.| - -**Example** - -```js -import dataSharePredicates from '@ohos.data.dataSharePredicates' -let predicates = new dataSharePredicates.DataSharePredicates() -predicates.equalTo("NAME", "Rose") -let promise = rdbStoreV9.query("EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]) -promise.then((resultSetV9) => { - console.log("ResultSet column names: " + resultSetV9.columnNames) - console.log("ResultSet column count: " + resultSetV9.columnCount) -}).catch((err) => { - console.info("Failed to query data, err: " + err) -}) -``` - -### remoteQuery9+ - -remoteQuery(device: string, table: string, predicates: RdbPredicatesV9, columns: Array<string> , callback: AsyncCallback<ResultSetV9>): void - -Queries data from the RDB store of a remote device based on specified conditions. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| ---------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- | -| device | string | Yes | Network ID of the remote device. | -| table | string | Yes | Name of the target table. | -| predicates | [RdbPredicatesV9](#rdbpredicatesv99) | Yes | Query conditions specified by the **RdbPredicatesV9** object. | -| columns | Array<string> | Yes | Columns to query. If this parameter is not specified, the query applies to all columns. | -| callback | AsyncCallback<[ResultSetV9](js-apis-data-resultset.md#resultset)> | Yes | Callback invoked to return the result. If the operation is successful, a **ResultSetV9** object will be returned.| - -**Example** - -```js -let predicatesV9 = new data_rdb.RdbPredicatesV9('EMPLOYEE') -predicatesV9.greaterThan("id", 0) -rdbStoreV9.remoteQuery("deviceId", "EMPLOYEE", predicatesV9, ["ID", "NAME", "AGE", "SALARY", "CODES"], - function(err, resultSetV9){ - if (err) { - console.info("Failed to remoteQuery, err: " + err) - return - } - console.info("ResultSet column names: " + resultSetV9.columnNames) - console.info("ResultSet column count: " + resultSetV9.columnCount) -}) -``` - -### remoteQuery9+ - -remoteQuery(device: string, table: string, predicates: RdbPredicatesV9, columns: Array<string>): Promise<ResultSetV9> - -Queries data from the RDB store of a remote device based on specified conditions. This API uses a promise to return the result. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| ---------- | ------------------------------------ | ---- | ------------------------------------------------ | -| device | string | Yes | Network ID of the remote device. | -| table | string | Yes | Name of the target table. | -| predicates | [RdbPredicatesV9](#rdbpredicatesv99) | Yes | Query conditions specified by the **RdbPredicatesV9** object. | -| columns | Array<string> | Yes | Columns to query. If this parameter is not specified, the query applies to all columns.| - -**Return value** - -| Type | Description | -| ------------------------------------------------------------ | -------------------------------------------------- | -| Promise<[ResultSetV9](js-apis-data-resultset.md#resultset)> | Promise used to return the result. If the operation is successful, a **ResultSetV9** object will be returned.| - -**Example** - -```js -let predicatesV9 = new data_rdb.RdbPredicatesV9('EMPLOYEE') -predicatesV9.greaterThan("id", 0) -let promise = rdbStoreV9.remoteQuery("deviceId", "EMPLOYEE", predicatesV9, ["ID", "NAME", "AGE", "SALARY", "CODES"]) -promise.then((resultSetV9) => { - console.info("ResultSet column names: " + resultSetV9.columnNames) - console.info("ResultSet column count: " + resultSetV9.columnCount) -}).catch((err) => { - console.info("Failed to remoteQuery , err: " + err) -}) -``` - -### querySql9+ - -querySql(sql: string, bindArgs: Array<ValueType>, callback: AsyncCallback<ResultSetV9>):void - -Queries data using the specified SQL statement. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- | -| sql | string | Yes | SQL statement to run. | -| bindArgs | Array<[ValueType](#valuetype)> | Yes | Arguments in the SQL statement. | -| callback | AsyncCallback<[ResultSetV9](js-apis-data-resultset.md)> | Yes | Callback invoked to return the result. If the operation is successful, a **ResultSetV9** object will be returned.| - -**Example** - -```js -rdbStoreV9.querySql("SELECT * FROM EMPLOYEE CROSS JOIN BOOK WHERE BOOK.NAME = ?", ['sanguo'], function (err, resultSetV9) { - if (err) { - console.info("Failed to query data, err: " + err) - return - } - console.log("ResultSet column names: " + resultSetV9.columnNames) - console.log("ResultSet column count: " + resultSetV9.columnCount) -}) -``` - -### querySql9+ - -querySql(sql: string, bindArgs?: Array<ValueType>):Promise<ResultSetV9> - -Queries data using the specified SQL statement. This API uses a promise to return the result. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | ------------------------------------ | ---- | --------------------- | -| sql | string | Yes | SQL statement to run.| -| bindArgs | Array<[ValueType](#valuetype)> | No | Arguments in the SQL statement. | - -**Return value** - -| Type | Description | -| ------------------------------------------------------- | -------------------------------------------------- | -| Promise<[ResultSetV9](js-apis-data-resultset.md)> | Promise used to return the result. If the operation is successful, a **ResultSetV9** object will be returned.| - -**Example** - -```js -let promise = rdbStoreV9.querySql("SELECT * FROM EMPLOYEE CROSS JOIN BOOK WHERE BOOK.NAME = ?", ['sanguo']) -promise.then((resultSetV9) => { - console.log("ResultSet column names: " + resultSetV9.columnNames) - console.log("ResultSet column count: " + resultSetV9.columnCount) -}).catch((err) => { - console.info("Failed to query data, err: " + err) -}) -``` - -### executeSql9+ - -executeSql(sql: string, bindArgs: Array<ValueType>, callback: AsyncCallback<void>):void - -Executes an SQL statement that contains specified arguments but returns no value. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | ------------------------------------ | ---- | ---------------------- | -| sql | string | Yes | SQL statement to run. | -| bindArgs | Array<[ValueType](#valuetype)> | Yes | Arguments in the SQL statement. | -| callback | AsyncCallback<void> | Yes | Callback invoked to return the result.| - -**Example** - -```js -const SQL_CREATE_TABLE = "CREATE TABLE IF NOT EXISTS EMPLOYEE (ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT NOT NULL, AGE INTEGER, SALARY REAL, CODES BLOB)" -rdbStoreV9.executeSql(SQL_CREATE_TABLE, null, function(err) { - if (err) { - console.info("Failed to execute SQL, err: " + err) - return - } - console.info('Created table successfully.') -}) -``` - -### executeSql9+ - -executeSql(sql: string, bindArgs?: Array<ValueType>):Promise<void> - -Executes an SQL statement that contains specified arguments but returns no value. This API uses a promise to return the result. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | ------------------------------------ | ---- | --------------------- | -| sql | string | Yes | SQL statement to run.| -| bindArgs | Array<[ValueType](#valuetype)> | No | Arguments in the SQL statement. | - -**Return value** - -| Type | Description | -| ------------------- | ------------------------- | -| Promise<void> | Promise that returns no value.| - -**Example** - -```js -const SQL_CREATE_TABLE = "CREATE TABLE IF NOT EXISTS EMPLOYEE (ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT NOT NULL, AGE INTEGER, SALARY REAL, CODES BLOB)" -let promise = rdbStoreV9.executeSql(SQL_CREATE_TABLE) -promise.then(() => { - console.info('Created table successfully.') -}).catch((err) => { - console.info("Failed to execute SQL, err: " + err) -}) -``` - -### beginTransaction9+ - -beginTransaction():void - -Starts the transaction before executing an SQL statement. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Example** - -```js -import featureAbility from '@ohos.ability.featureAbility' -let context = featureAbility.getContext() -const STORE_CONFIG = { name: "RdbTest.db", - securityLevel: data_rdb.SecurityLevel.S1} -data_rdb.getRdbStoreV9(context, STORE_CONFIG, 1, async function (err, rdbStoreV9) { - rdbStoreV9.beginTransaction() - const valueBucket = { - "name": "lisi", - "age": 18, - "salary": 100.5, - "blobType": new Uint8Array([1, 2, 3]), - } - await rdbStoreV9.insert("test", valueBucket) - rdbStoreV9.commit() -}) -``` - -### commit9+ - -commit():void - -Commits the executed SQL statements. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Example** - -```js -import featureAbility from '@ohos.ability.featureAbility' -let context = featureAbility.getContext() -const STORE_CONFIG = { name: "RdbTest.db", - securityLevel: data_rdb.SecurityLevel.S1} -data_rdb.getRdbStoreV9(context, STORE_CONFIG, 1, async function (err, rdbStoreV9) { - rdbStoreV9.beginTransaction() - const valueBucket = { - "name": "lisi", - "age": 18, - "salary": 100.5, - "blobType": new Uint8Array([1, 2, 3]), - } - await rdbStoreV9.insert("test", valueBucket) - rdbStoreV9.commit() -}) -``` - -### rollBack9+ - -rollBack():void - -Rolls back the SQL statements that have been executed. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Example** - -```js -import featureAbility from '@ohos.ability.featureAbility' -let context = featureAbility.getContext() -const STORE_CONFIG = { name: "RdbTest.db", - securityLevel: data_rdb.SecurityLevel.S1} -data_rdb.getRdbStoreV9(context, STORE_CONFIG, 1, async function (err, rdbStoreV9) { - try { - rdbStoreV9.beginTransaction() - const valueBucket = { - "id": 1, - "name": "lisi", - "age": 18, - "salary": 100.5, - "blobType": new Uint8Array([1, 2, 3]), - } - await rdbStoreV9.insert("test", valueBucket) - rdbStoreV9.commit() - } catch (e) { - rdbStoreV9.rollBack() - } -}) -``` - -### backup9+ - -backup(destName:string, callback: AsyncCallback<void>):void - -Backs up an RDB store. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | ------------------------- | ---- | ------------------------ | -| destName | string | Yes | Name of the RDB store backup file.| -| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. | - -**Example** - -```js -rdbStoreV9.backup("dbBackup.db", function(err) { - if (err) { - console.info('Backup failed, err: ' + err) - return - } - console.info('Backup success.') -}) -``` - -### backup9+ - -backup(destName:string): Promise<void> - -Backs up an RDB store. This API uses a promise to return the result. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | ------ | ---- | ------------------------ | -| destName | string | Yes | Name of the RDB store backup file.| - -**Return value** - -| Type | Description | -| ------------------- | ------------------------- | -| Promise<void> | Promise that returns no value.| - -**Example** - -```js -let promiseBackup = rdbStoreV9.backup("dbBackup.db") -promiseBackup.then(()=>{ - console.info('Backup success.') -}).catch((err)=>{ - console.info('Backup failed, err: ' + err) -}) -``` - -### restore9+ - -restore(srcName:string, callback: AsyncCallback<void>):void - -Restores an RDB store from a backup file. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | ------------------------- | ---- | ------------------------ | -| srcName | string | Yes | Name of the RDB store backup file.| -| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. | - -**Example** - -```js -rdbStoreV9.restore("dbBackup.db", function(err) { - if (err) { - console.info('Restore failed, err: ' + err) - return - } - console.info('Restore success.') -}) -``` - -### restore9+ - -restore(srcName:string): Promise<void> - -Restores an RDB store from a backup file. This API uses a promise to return the result. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| ------- | ------ | ---- | ------------------------ | -| srcName | string | Yes | Name of the RDB store backup file.| - -**Return value** - -| Type | Description | -| ------------------- | ------------------------- | -| Promise<void> | Promise that returns no value.| - -**Example** - -```js -let promiseRestore = rdbStoreV9.restore("dbBackup.db") -promiseRestore.then(()=>{ - console.info('Restore success.') -}).catch((err)=>{ - console.info('Restore failed, err: ' + err) -}) -``` - -### setDistributedTables9+ - -setDistributedTables(tables: Array<string>, callback: AsyncCallback<void>): void - -Sets distributed tables. This API uses an asynchronous callback to return the result. - -**Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | ------------------------- | ---- | ---------------------- | -| tables | Array<string> | Yes | Names of the distributed tables to set.| -| callback | AsyncCallback<void> | Yes | Callback invoked to return the result.| - -**Example** - -```js -rdbStoreV9.setDistributedTables(["EMPLOYEE"], function (err) { - if (err) { - console.info('Failed to set distributed tables, err: ' + err) - return - } - console.info('Set distributed tables successfully.') -}) -``` - -### setDistributedTables9+ - - setDistributedTables(tables: Array<string>): Promise<void> - -Sets distributed tables. This API uses a promise to return the result. - -**Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ------------------- | ---- | ------------------------ | -| tables | Array<string> | Yes | Names of the distributed tables to set.| - -**Return value** - -| Type | Description | -| ------------------- | ------------------------- | -| Promise<void> | Promise that returns no value.| - -**Example** +## Modules to Import ```js -let promise = rdbStoreV9.setDistributedTables(["EMPLOYEE"]) -promise.then(() => { - console.info("Set distributed tables successfully.") -}).catch((err) => { - console.info("Failed to set distributed tables, err: " + err) -}) -``` - -### obtainDistributedTableName9+ - -obtainDistributedTableName(device: string, table: string, callback: AsyncCallback<string>): void +import data_rdb from '@ohos.data.rdb'; +``` +## data_rdb.getRdbStore -Obtains the distributed table name for a remote device based on the local table name. This API uses an asynchronous callback to return the result. The distributed table name is required when the RDB store of a remote device is queried. +getRdbStore(context: Context, config: StoreConfig, version: number, callback: AsyncCallback<RdbStore>): void -**Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC +Obtains an RDB store. This API uses an asynchronous callback to return the result. You can set parameters for the RDB store based on service requirements and call APIs to perform data operations. **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core **Parameters** -| Name | Type | Mandatory| Description | -| -------- | --------------------------- | ---- | ------------------------------------------------------------ | -| device | string | Yes | Remote device. | -| table | string | Yes | Local table name. | -| callback | AsyncCallback<string> | Yes | Callback invoked to return the result. If the operation succeeds, the distributed table name of the remote device is returned.| +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------------ | ---- | ------------------------------------------------------------ | +| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).| +| config | [StoreConfig](#storeconfig) | Yes | Configuration of the RDB store. | +| version | number | Yes | RDB store version.
Currently, automatic RDB upgrades and downgrades performed based on **version** is not supported. | +| callback | AsyncCallback<[RdbStore](#rdbstore)> | Yes | Callback invoked to return the RDB store obtained. | **Example** +FA model: + ```js -rdbStoreV9.obtainDistributedTableName("12345678abcde", "EMPLOYEE", function (err, tableName) { +// Obtain the context. +import featureAbility from '@ohos.ability.featureAbility' +let context = featureAbility.getContext() + +// Call getRdbStore. +const STORE_CONFIG = { name: "RdbTest.db"} +data_rdb.getRdbStore(context, STORE_CONFIG, 1, function (err, rdbStore) { if (err) { - console.info('Failed to obtain DistributedTableName, err: ' + err) + console.info("Failed to get RdbStore, err: " + err) return } - console.info('Obtained distributed table name successfully, tableName=.' + tableName) + console.log("Got RdbStore successfully.") }) ``` -### obtainDistributedTableName9+ +Stage model: - obtainDistributedTableName(device: string, table: string): Promise<string> +```ts +// Obtain the context. +import UIAbility from '@ohos.app.ability.UIAbility'; -Obtains the distributed table name for a remote device based on the local table name. This API uses a promise to return the result. The distributed table name is required when the RDB store of a remote device is queried. +let context; +class EntryAbility extends UIAbility { + onWindowStageCreate(windowStage){ + context = this.context + } +} -**Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC +// Call getRdbStore. +const STORE_CONFIG = { name: "RdbTest.db"} +data_rdb.getRdbStore(context, STORE_CONFIG, 1, function (err, rdbStore) { + if (err) { + console.info("Failed to get RdbStore, err: " + err) + return + } + console.log("Got RdbStore successfully.") +}) +``` + +## data_rdb.getRdbStore + +getRdbStore(context: Context, config: StoreConfig, version: number): Promise<RdbStore> + +Obtains an RDB store. This API uses a promise to return the result. You can set parameters for the RDB store based on service requirements and call APIs to perform data operations. **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ---------- | -| device | string | Yes | Remote device.| -| table | string | Yes | Local table name.| +| Name | Type | Mandatory| Description | +| ------- | --------------------------- | ---- | ------------------------------------------------------------ | +| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).| +| config | [StoreConfig](#storeconfig) | Yes | Configuration of the RDB store. | +| version | number | Yes | RDB store version.
Currently, automatic RDB upgrades and downgrades performed based on **version** is not supported. | **Return value** -| Type | Description | -| --------------------- | ----------------------------------------------------- | -| Promise<string> | Promise used to return the result. If the operation succeeds, the distributed table name of the remote device is returned.| +| Type | Description | +| ------------------------------------ | ------------------------------- | +| Promise<[RdbStore](#rdbstore)> | Promise used to return the RDB store obtained.| **Example** +FA model: + ```js -let promise = rdbStoreV9.obtainDistributedTableName("12345678abcde", "EMPLOYEE") -promise.then((tableName) => { - console.info('Obtained distributed table name successfully, tableName= ' + tableName) +// Obtain the context. +import featureAbility from '@ohos.ability.featureAbility' +let context = featureAbility.getContext() + +// Call getRdbStore. +const STORE_CONFIG = { name: "RdbTest.db" } +let promise = data_rdb.getRdbStore(context, STORE_CONFIG, 1); +promise.then(async (rdbStore) => { + console.log("Got RdbStore successfully.") }).catch((err) => { - console.info('Failed to obtain DistributedTableName, err: ' + err) + console.log("Failed to get RdbStore, err: " + err) }) ``` -### sync9+ - -sync(mode: SyncMode, predicates: RdbPredicatesV9, callback: AsyncCallback<Array<[string, number]>>): void - -Synchronizes data between devices. This API uses an asynchronous callback to return the result. - -**Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| ---------- | -------------------------------------------------- | ---- | ------------------------------------------------------------ | -| mode | [SyncMode](#syncmode8) | Yes | Data synchronization mode. The value can be **push** or **pull**. | -| predicates | [RdbPredicatesV9](#rdbpredicatesv99) | Yes | **RdbPredicates** object that specifies the data and devices to synchronize. | -| callback | AsyncCallback<Array<[string, number]>> | Yes | Callback invoked to send the synchronization result to the caller.
**string** indicates the device ID.
**number** indicates the synchronization status of that device. The value **0** indicates a successful synchronization. Other values indicate a synchronization failure. | +Stage model: -**Example** +```ts +// Obtain the context. +import UIAbility from '@ohos.app.ability.UIAbility'; -```js -let predicatesV9 = new data_rdb.RdbPredicatesV9('EMPLOYEE') -predicatesV9.inDevices(['12345678abcde']) -rdbStoreV9.sync(data_rdb.SyncMode.SYNC_MODE_PUSH, predicatesV9, function (err, result) { - if (err) { - console.log('Sync failed, err: ' + err) - return - } - console.log('Sync done.') - for (let i = 0; i < result.length; i++) { - console.log('device=' + result[i][0] + ' status=' + result[i][1]) +let context; +class EntryAbility extends UIAbility { + onWindowStageCreate(windowStage){ + context = this.context } +} + +// Call getRdbStore. +const STORE_CONFIG = { name: "RdbTest.db" } +let promise = data_rdb.getRdbStore(context, STORE_CONFIG, 1); +promise.then(async (rdbStore) => { + console.log("Got RdbStore successfully.") +}).catch((err) => { + console.log("Failed to get RdbStore, err: " + err) }) ``` -### sync9+ - - sync(mode: SyncMode, predicates: RdbPredicatesV9): Promise<Array<[string, number]>> +## data_rdb.deleteRdbStore -Synchronizes data between devices. This API uses a promise to return the result. +deleteRdbStore(context: Context, name: string, callback: AsyncCallback<void>): void -**Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC +Deletes an RDB store. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core **Parameters** -| Name | Type | Mandatory| Description | -| ---------- | ------------------------------------ | ---- | ------------------------------ | -| mode | [SyncMode](#syncmode8) | Yes | Data synchronization mode. The value can be **push** or **pull**.| -| predicates | [RdbPredicatesV9](#rdbpredicatesv99) | Yes | **RdbPredicates** object that specifies the data and devices to synchronize. | - -**Return value** - -| Type | Description | -| -------------------------------------------- | ------------------------------------------------------------ | -| Promise<Array<[string, number]>> | Promise used to send the synchronization result.
**string** indicates the device ID.
**number** indicates the synchronization status of that device. The value **0** indicates a successful synchronization. Other values indicate a synchronization failure. | +| Name | Type | Mandatory| Description | +| -------- | ------------------------- | ---- | ------------------------------------------------------------ | +| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).| +| name | string | Yes | Name of the RDB store to delete. | +| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. | **Example** +FA model: + ```js -let predicatesV9 = new data_rdb.RdbPredicatesV9('EMPLOYEE') -predicatesV9.inDevices(['12345678abcde']) -let promise = rdbStoreV9.sync(data_rdb.SyncMode.SYNC_MODE_PUSH, predicatesV9) -promise.then((resultSetV9) =>{ - console.log('Sync done.') - for (let i = 0; i < resultSetV9.length; i++) { - console.log('device=' + resultSetV9[i][0] + ' status=' + resultSetV9[i][1]) +// Obtain the context. +import featureAbility from '@ohos.ability.featureAbility' +let context = featureAbility.getContext() + +// Call deleteRdbStore. +data_rdb.deleteRdbStore(context, "RdbTest.db", function (err) { + if (err) { + console.info("Failed to delete RdbStore, err: " + err) + return } -}).catch((err) => { - console.log('Sync failed') + console.log("Deleted RdbStore successfully.") }) ``` -### on('dataChange')9+ - -on(event: 'dataChange', type: SubscribeType, observer: Callback<Array<string>>): void - -Registers an observer for this RDB store. When the data in the RDB store changes, a callback is invoked to return the data changes. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | ----------------------------------- | ---- | ------------------------------------------- | -| event | string | Yes | The value is'dataChange', which indicates a data change event. | -| type | [SubscribeType](#subscribetype8) | Yes| Subscription type to register.| -| observer | Callback<Array<string>> | Yes | Observer that listens for the data changes in the RDB store. | +Stage model: -**Example** +```ts +// Obtain the context. +import UIAbility from '@ohos.app.ability.UIAbility'; -```js -function storeObserver(devices) { - for (let i = 0; i < devices.length; i++) { - console.log('device=' + devices[i] + ' data changed') +let context; +class EntryAbility extends UIAbility { + onWindowStageCreate(windowStage){ + context = this.context } } -try { - rdbStoreV9.on('dataChange', data_rdb.SubscribeType.SUBSCRIBE_TYPE_REMOTE, storeObserver) -} catch (err) { - console.log('Failed to register observer') -} + +// Call deleteRdbStore. +data_rdb.deleteRdbStore(context, "RdbTest.db", function (err) { + if (err) { + console.info("Failed to delete RdbStore, err: " + err) + return + } + console.log("Deleted RdbStore successfully.") +}) ``` -### off('dataChange')9+ +## data_rdb.deleteRdbStore -off(event:'dataChange', type: SubscribeType, observer: Callback<Array<string>>): void +deleteRdbStore(context: Context, name: string): Promise<void> -Unregisters the observer of the specified type from the RDB store. This API uses a callback to return the result. +Deletes an RDB store. This API uses a promise to return the result. **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ----------------------------------- | ---- | ------------------------------------------- | -| event | string | Yes | The value is'dataChange', which indicates a data change event. | -| type | [SubscribeType](#subscribetype8) | Yes| Subscription type to unregister.| -| observer | Callback<Array<string>> | Yes | Data change observer registered. | +| Name | Type | Mandatory| Description | +| ------- | ------- | ---- | ------------------------------------------------------------ | +| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).| +| name | string | Yes | Name of the RDB store to delete. | -**Example** +**Return value** -```js -function storeObserver(devices) { - for (let i = 0; i < devices.length; i++) { - console.log('device=' + devices[i] + ' data changed') - } -} -try { - rdbStoreV9.off('dataChange', data_rdb.SubscribeType.SUBSCRIBE_TYPE_REMOTE, storeObserver) -} catch (err) { - console.log('Failed to unregister observer') -} -``` +| Type | Description | +| ------------------- | ------------------------- | +| Promise<void> | Promise that returns no value.| -## StoreConfigV99+ +**Example** -Defines the RDB store configuration. +FA model: -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core +```js +// Obtain the context. +import featureAbility from '@ohos.ability.featureAbility' +let context = featureAbility.getContext() -| Name | Type | Mandatory| Description | -| ------------- | ------------- | ---- | --------------------------------------------------------- | -| name | string | Yes | Database file name. | -| securityLevel | SecurityLevel | Yes | Security level of the RDB store. | -| encrypt | boolean | No | Whether to encrypt the RDB store.
The value **true** means to encrypt the RDB store;
the value **false** means the opposite.| +// Call deleteRdbStore. +let promise = data_rdb.deleteRdbStore(context, "RdbTest.db") +promise.then(() => { + console.log("Deleted RdbStore successfully.") +}).catch((err) => { + console.info("Failed to delete RdbStore, err: " + err) +}) +``` -## SecurityLevel9+ +Stage model: -Enumerates the RDB store security levels. +```ts +// Obtain the context. +import UIAbility from '@ohos.app.ability.UIAbility'; -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core +let context; +class EntryAbility extends UIAbility { + onWindowStageCreate(windowStage){ + context = this.context + } +} -| Name| Value | Description | -| ---- | ---- | ------------------------------------------------------------ | -| S1 | 1 | The RDB store security level is low. If data leakage occurs, minor impact will be caused on the database. For example, an RDB store that contains system data such as wallpapers.| -| S2 | 2 | The RDB store security level is medium. If data leakage occurs, moderate impact will be caused on the database. For example, an RDB store that contains information created by users or call records, such as audio or video clips.| -| S3 | 3 | The RDB store security level is high. If data leakage occurs, major impact will be caused on the database. For example, an RDB store that contains information such as user fitness, health, and location data.| -| S4 | 4 | The RDB store security level is critical. If data leakage occurs, severe impact will be caused on the database. For example, an RDB store that contains information such as authentication credentials and financial data.| +// Call deleteRdbStore. +let promise = data_rdb.deleteRdbStore(context, "RdbTest.db") +promise.then(()=>{ + console.log("Deleted RdbStore successfully.") +}).catch((err) => { + console.info("Failed to delete RdbStore, err: " + err) +}) +``` ## ValueType @@ -2711,12 +301,24 @@ Defines the database synchronization mode. Defines the subscription type. +**Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC + **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core | Name | Value | Description | | --------------------- | ---- | ------------------ | | SUBSCRIBE_TYPE_REMOTE | 0 | Subscribe to remote data changes.| +## StoreConfig + +Defines the RDB store configuration. + +**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core + +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| name | string | Yes| Database file name.| + ## RdbPredicates Defines predicates for an RDB store. This class determines whether the conditional expression for the RDB store is true or false. @@ -2802,7 +404,7 @@ Sets an **RdbPredicates** to match the field with data type **ValueType** and va | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | field | string | Yes| Column name in the database table.| -| value | [ValueType](#valuetype) | Yes| Value to match the **RdbPredicates**.| +| value | [ValueType](#valuetype) | Yes| Value to match the **RdbPredicates**. | **Return value** @@ -2831,7 +433,7 @@ Sets an **RdbPredicates** to match the field with data type **ValueType** and va | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | field | string | Yes| Column name in the database table.| -| value | [ValueType](#valuetype) | Yes| Value to match the **RdbPredicates**.| +| value | [ValueType](#valuetype) | Yes| Value to match the **RdbPredicates**. | **Return value** @@ -2958,7 +560,7 @@ Sets an **RdbPredicates** to match a string containing the specified value. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | field | string | Yes| Column name in the database table.| -| value | string | Yes| Value to match the **RdbPredicates**.| +| value | string | Yes| Value to match the **RdbPredicates**. | **Return value** @@ -2986,7 +588,7 @@ Sets an **RdbPredicates** to match a string that starts with the specified value | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | field | string | Yes| Column name in the database table.| -| value | string | Yes| Value to match the **RdbPredicates**.| +| value | string | Yes| Value to match the **RdbPredicates**. | **Return value** @@ -3014,7 +616,7 @@ Sets an **RdbPredicates** to match a string that ends with the specified value. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | field | string | Yes| Column name in the database table.| -| value | string | Yes| Value to match the **RdbPredicates**.| +| value | string | Yes| Value to match the **RdbPredicates**. | **Return value** @@ -3095,7 +697,7 @@ Sets an **RdbPredicates** to match a string that is similar to the specified val | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | field | string | Yes| Column name in the database table.| -| value | string | Yes| Value to match the **RdbPredicates**.| +| value | string | Yes| Value to match the **RdbPredicates**. | **Return value** @@ -3123,7 +725,7 @@ Sets an **RdbPredicates** to match the specified string. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | field | string | Yes| Column name in the database table.| -| value | string | Yes| Value to match the **RdbPredicates**.

Wildcards are supported. * indicates zero, one, or multiple digits or characters. **?** indicates a single digit or character.| +| value | string | Yes| Value to match the **RdbPredicates**.

Wildcards are supported. * indicates zero, one, or multiple digits or characters. **?** indicates a single digit or character. | **Return value** @@ -3151,8 +753,8 @@ Sets an **RdbPredicates** to match the field with data type **ValueType** and va | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | field | string | Yes| Column name in the database table.| -| low | [ValueType](#valuetype) | Yes| Minimum value to match the **RdbPredicates**.| -| high | [ValueType](#valuetype) | Yes| Maximum value to match the **RdbPredicates**.| +| low | [ValueType](#valuetype) | Yes| Minimum value to match the **RdbPredicates**. | +| high | [ValueType](#valuetype) | Yes| Maximum value to match the **RdbPredicates**. | **Return value** @@ -3180,8 +782,8 @@ Sets an **RdbPredicates** to match the field with data type **ValueType** and va | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | field | string | Yes| Column name in the database table.| -| low | [ValueType](#valuetype) | Yes| Minimum value to match the **RdbPredicates**.| -| high | [ValueType](#valuetype) | Yes| Maximum value to match the **RdbPredicates**.| +| low | [ValueType](#valuetype) | Yes| Minimum value to match the **RdbPredicates**. | +| high | [ValueType](#valuetype) | Yes| Maximum value to match the **RdbPredicates**. | **Return value** @@ -3209,7 +811,7 @@ Sets an **RdbPredicates** to match the field with data type **ValueType** and va | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | field | string | Yes| Column name in the database table.| -| value | [ValueType](#valuetype) | Yes| Value to match the **RdbPredicates**.| +| value | [ValueType](#valuetype) | Yes| Value to match the **RdbPredicates**. | **Return value** @@ -3237,7 +839,7 @@ Sets an **RdbPredicates** to match the field with data type **ValueType** and va | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | field | string | Yes| Column name in the database table.| -| value | [ValueType](#valuetype) | Yes| Value to match the **RdbPredicates**.| +| value | [ValueType](#valuetype) | Yes| Value to match the **RdbPredicates**. | **Return value** @@ -3265,7 +867,7 @@ Sets an **RdbPredicates** to match the field with data type **ValueType** and va | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | field | string | Yes| Column name in the database table.| -| value | [ValueType](#valuetype) | Yes| Value to match the **RdbPredicates**.| +| value | [ValueType](#valuetype) | Yes| Value to match the **RdbPredicates**. | **Return value** @@ -3293,7 +895,7 @@ Sets an **RdbPredicates** to match the field with data type **ValueType** and va | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | field | string | Yes| Column name in the database table.| -| value | [ValueType](#valuetype) | Yes| Value to match the **RdbPredicates**.| +| value | [ValueType](#valuetype) | Yes| Value to match the **RdbPredicates**. | **Return value** @@ -3552,7 +1154,7 @@ predicates.notIn("NAME", ["Lisa", "Rose"]) Provides methods to manage an RDB store. -Before using the following APIs, use [executeSql](#executesql) to initialize the database table structure and related data. For details, see [RDB Development](../../database/database-relational-guidelines.md). +Before using the following APIs, use [executeSql](#executesql8) to initialize the database table structure and related data. For details, see [RDB Development](../../database/database-relational-guidelines.md). ### insert @@ -3753,12 +1355,12 @@ const valueBucket = { } let predicates = new data_rdb.RdbPredicates("EMPLOYEE") predicates.equalTo("NAME", "Lisa") -rdbStore.update(valueBucket, predicates, function (err, ret) { +rdbStore.update(valueBucket, predicates, function (err, rows) { if (err) { console.info("Failed to update data, err: " + err) return } - console.log("Updated row count: " + ret) + console.log("Updated row count: " + rows) }) ``` @@ -3795,8 +1397,8 @@ const valueBucket = { let predicates = new data_rdb.RdbPredicates("EMPLOYEE") predicates.equalTo("NAME", "Lisa") let promise = rdbStore.update(valueBucket, predicates) -promise.then(async (ret) => { - console.log("Updated row count: " + ret) +promise.then(async (rows) => { + console.log("Updated row count: " + rows) }).catch((err) => { console.info("Failed to update data, err: " + err) }) @@ -4017,7 +1619,7 @@ rdbStore.executeSql(SQL_CREATE_TABLE, null, function(err) { console.info("Failed to execute SQL, err: " + err) return } - console.info('Create table done.') + console.info('Created table successfully.') }) ``` @@ -4048,7 +1650,7 @@ Executes an SQL statement that contains specified arguments but returns no value const SQL_CREATE_TABLE = "CREATE TABLE IF NOT EXISTS EMPLOYEE (ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT NOT NULL, AGE INTEGER, SALARY REAL, CODES BLOB)" let promise = rdbStore.executeSql(SQL_CREATE_TABLE) promise.then(() => { - console.info('Create table done.') + console.info('Created table successfully.') }).catch((err) => { console.info("Failed to execute SQL, err: " + err) }) @@ -4352,8 +1954,8 @@ Registers an observer for this RDB store. When the data in the RDB store changes | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| event | string | Yes| The value is **dataChange**, which indicates a data change event.| -| type | [SubscribeType](#subscribetype8) | Yes| Type defined in **SubscribeType**.| +| event | string | Yes| The value is'dataChange', which indicates a data change event.| +| type | [SubscribeType](#subscribetype8) | Yes| Subscription type to register.| | observer | Callback<Array<string>> | Yes| Observer that listens for the data changes in the RDB store.| **Example** @@ -4384,7 +1986,7 @@ Unregisters the observer of the specified type from the RDB store. This API uses | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | event | string | Yes| The value is'dataChange', which indicates a data change event.| -| type | [SubscribeType](#subscribetype8) | Yes| Type defined in **SubscribeType**.| +| type | [SubscribeType](#subscribetype8) | Yes| Subscription type to unregister.| | observer | Callback<Array<string>> | Yes| Data change observer registered.| **Example** @@ -4401,13 +2003,3 @@ try { console.log('Failed to unregister observer') } ``` - -## StoreConfig - -Defines the RDB store configuration. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| name | string | Yes| Database file name.| diff --git a/en/application-dev/reference/apis/js-apis-data-resultset.md b/en/application-dev/reference/apis/js-apis-data-resultset.md index 1e87e0a63436d7dbfb073ce0ac3b7ff3bffef1f2..559e6f04561b3d8bb22200236da730e1e081edc7 100644 --- a/en/application-dev/reference/apis/js-apis-data-resultset.md +++ b/en/application-dev/reference/apis/js-apis-data-resultset.md @@ -8,536 +8,6 @@ A result set is a set of results returned after the relational database (RDB) qu > > The APIs of this module are no longer maintained since API version 9. You are advised to use [@ohos.data.relationalStore#ResultSet](js-apis-data-relationalStore.md#resultset). -## ResultSetV99+ - -Provides APIs to access the result set, which is obtained by querying the RDB store. - -### Usage - -Use [RdbStoreV9.query()](js-apis-data-rdb.md#query) to obtain the **resultSetV9** instance. - -```js -import dataRdb from '@ohos.data.rdb'; -let predicatesV9 = new dataRdb.RdbPredicatesV9("EMPLOYEE"); -predicatesV9.equalTo("AGE", 18); -let promise = rdbStoreV9.query(predicatesV9, ["ID", "NAME", "AGE", "SALARY", "CODES"]); -promise.then((resultSetV9) => { - console.log(TAG + "resultSet columnNames:" + resultSetV9.columnNames); - console.log(TAG + "resultSet columnCount:" + resultSetV9.columnCount); -}); -``` - -### Attributes9+ - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -| Name | Type | Mandatory| Description | -| ------------ | ------------------- | ---- | -------------------------------- | -| columnNames | Array<string> | Yes | Names of all columns in the result set. | -| columnCount | number | Yes | Number of columns in the result set. | -| rowCount | number | Yes | Number of rows in the result set. | -| rowIndex | number | Yes | Index of the current row in the result set. | -| isAtFirstRow | boolean | Yes | Whether the cursor is in the first row of the result set. | -| isAtLastRow | boolean | Yes | Whether the cursor is in the last row of the result set. | -| isEnded | boolean | Yes | Whether the cursor is after the last row of the result set.| -| isStarted | boolean | Yes | Whether the cursor has been moved. | -| isClosed | boolean | Yes | Whether the result set is closed. | - -### getColumnIndex9+ - -getColumnIndex(columnName: string): number - -Obtains the column index based on the column name. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| ---------- | ------ | ---- | -------------------------- | -| columnName | string | Yes | Column name specified.| - -**Return value** - -| Type | Description | -| ------ | ------------------ | -| number | Index of the column obtained.| - -**Error codes** - -For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). - -| **ID**| **Error Message** | -| ------------ | ------------------------------------------------------------ | -| 14800013 | The column value is null or the column type is incompatible. | - -**Example** - - ```js -resultSetV9.goToFirstRow(); -const id = resultSetV9.getLong(resultSetV9.getColumnIndex("ID")); -const name = resultSetV9.getString(resultSetV9.getColumnIndex("NAME")); -const age = resultSetV9.getLong(resultSetV9.getColumnIndex("AGE")); -const salary = resultSetV9.getDouble(resultSetV9.getColumnIndex("SALARY")); - ``` - -### getColumnName9+ - -getColumnName(columnIndex: number): string - -Obtains the column name based on the column index. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| ----------- | ------ | ---- | -------------------------- | -| columnIndex | number | Yes | Column index specified.| - -**Return value** - -| Type | Description | -| ------ | ------------------ | -| string | Column name obtained.| - -**Error codes** - -For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). - -| **ID**| **Error Message** | -| ------------ | ------------------------------------------------------------ | -| 14800013 | The column value is null or the column type is incompatible. | - -**Example** - - ```js -const id = resultSetV9.getColumnName(0); -const name = resultSetV9.getColumnName(1); -const age = resultSetV9.getColumnName(2); - ``` - -### goTo9+ - -goTo(offset:number): boolean - -Moves the cursor to the row based on the specified offset. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ---------------------------- | -| offset | number | Yes | Offset relative to the current position.| - -**Return value** - -| Type | Description | -| ------- | --------------------------------------------- | -| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| - -**Error codes** - -For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). - -| **ID**| **Error Message** | -| ------------ | ------------------------------------------------------------ | -| 14800012 | The result set is empty or the specified location is invalid. | - -**Example** - - ```js -let predicatesV9goto = new dataRdb.RdbPredicatesV9("EMPLOYEE"); -let promisequerygoto = rdbStoreV9.query(predicatesV9goto, ["ID", "NAME", "AGE", "SALARY", "CODES"]); -promisequerygoto.then((resultSetV9) => { - resultSetV9.goTo(1); - resultSetV9.close(); -}).catch((err) => { - console.log('query failed'); -}); - ``` - -### goToRow9+ - -goToRow(position: number): boolean - -Moves the cursor to the specified row in the result set. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | ------ | ---- | ------------------------ | -| position | number | Yes | Position to which the cursor is to be moved.| - -**Return value** - -| Type | Description | -| ------- | --------------------------------------------- | -| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| - -**Error codes** - -For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). - -| **ID**| **Error Message** | -| ------------ | ------------------------------------------------------------ | -| 14800012 | The result set is empty or the specified location is invalid. | - -**Example** - - ```js -let predicatesV9gotorow = new dataRdb.RdbPredicatesV9("EMPLOYEE"); -let promisequerygotorow = rdbStoreV9.query(predicatesV9gotorow, ["ID", "NAME", "AGE", "SALARY", "CODES"]); -promisequerygotorow.then((resultSetV9) => { - resultSetV9.goToRow(5); - resultSetV9.close(); -}).catch((err) => { - console.log('query failed'); -}); - ``` - -### goToFirstRow9+ - -goToFirstRow(): boolean - - -Moves the cursor to the first row of the result set. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Return value** - -| Type | Description | -| ------- | --------------------------------------------- | -| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| - -**Error codes** - -For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). - -| **ID**| **Error Message** | -| ------------ | ------------------------------------------------------------ | -| 14800012 | The result set is empty or the specified location is invalid. | - -**Example** - - ```js -let predicatesV9goFirst = new dataRdb.RdbPredicatesV9("EMPLOYEE"); -let promisequerygoFirst = rdbStoreV9.query(predicatesV9goFirst, ["ID", "NAME", "AGE", "SALARY", "CODES"]); -promisequerygoFirst.then((resultSetV9) => { - resultSetV9.goToFirstRow(); - resultSetV9.close(); -}).catch((err) => { - console.log('query failed'); -}); - ``` - -### goToLastRow9+ - -goToLastRow(): boolean - -Moves the cursor to the last row of the result set. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Return value** - -| Type | Description | -| ------- | --------------------------------------------- | -| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| - -**Error codes** - -For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). - -| **ID**| **Error Message** | -| ------------ | ------------------------------------------------------------ | -| 14800012 | The result set is empty or the specified location is invalid. | - -**Example** - - ```js -let predicatesV9goLast = new dataRdb.RdbPredicatesV9("EMPLOYEE"); -let promisequerygoLast = rdbStoreV9.query(predicatesV9goLast, ["ID", "NAME", "AGE", "SALARY", "CODES"]); -promisequerygoLast.then((resultSetV9) => { - resultSetV9.goToLastRow(); - resultSetV9.close(); -}).catch((err) => { - console.log('query failed'); -}); - ``` - -### goToNextRow9+ - -goToNextRow(): boolean - -Moves the cursor to the next row in the result set. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Return value** - -| Type | Description | -| ------- | --------------------------------------------- | -| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| - -**Error codes** - -For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). - -| **ID**| **Error Message** | -| ------------ | ------------------------------------------------------------ | -| 14800012 | The result set is empty or the specified location is invalid. | - -**Example** - - ```js -let predicatesV9goNext = new dataRdb.RdbPredicatesV9("EMPLOYEE"); -let promisequerygoNext = rdbStoreV9.query(predicatesV9goNext, ["ID", "NAME", "AGE", "SALARY", "CODES"]); -promisequerygoNext.then((resultSetV9) => { - resultSetV9.goToNextRow(); - resultSetV9.close(); -}).catch((err) => { - console.log('query failed'); -}); - ``` - -### goToPreviousRow9+ - -goToPreviousRow(): boolean - -Moves the cursor to the previous row in the result set. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Return value** - -| Type | Description | -| ------- | --------------------------------------------- | -| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| - -**Error codes** - -For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). - -| **ID**| **Error Message** | -| ------------ | ------------------------------------------------------------ | -| 14800012 | The result set is empty or the specified location is invalid. | - -**Example** - - ```js -let predicatesV9goPrev = new dataRdb.RdbPredicatesV9("EMPLOYEE"); -let promisequerygoPrev = rdbStoreV9.query(predicatesV9goPrev, ["ID", "NAME", "AGE", "SALARY", "CODES"]); -promisequerygoPrev.then((resultSetV9) => { - resultSetV9.goToPreviousRow(); - resultSetV9.close(); -}).catch((err) => { - console.log('query failed'); -}); - ``` - -### getBlob9+ - -getBlob(columnIndex: number): Uint8Array - -Obtains the value in the specified column in the current row as a byte array. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| ----------- | ------ | ---- | ----------------------- | -| columnIndex | number | Yes | Index of the specified column, starting from 0.| - -**Return value** - -| Type | Description | -| ---------- | -------------------------------- | -| Uint8Array | Value in the specified column as a byte array.| - -**Error codes** - -For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). - -| **ID**| **Error Message** | -| ------------ | ------------------------------------------------------------ | -| 14800013 | The column value is null or the column type is incompatible. | - -**Example** - - ```js -const codes = resultSetV9.getBlob(resultSetV9.getColumnIndex("CODES")); - ``` - -### getString9+ - -getString(columnIndex: number): string - -Obtains the value in the specified column in the current row as a string. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| ----------- | ------ | ---- | ----------------------- | -| columnIndex | number | Yes | Index of the specified column, starting from 0.| - -**Return value** - -| Type | Description | -| ------ | ---------------------------- | -| string | Value in the specified column as a string.| - -**Error codes** - -For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). - -| **ID**| **Error Message** | -| ------------ | ------------------------------------------------------------ | -| 14800013 | The column value is null or the column type is incompatible. | - -**Example** - - ```js -const name = resultSetV9.getString(resultSetV9.getColumnIndex("NAME")); - ``` - -### getLong9+ - -getLong(columnIndex: number): number - -Obtains the value in the specified column in the current row as a Long. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| ----------- | ------ | ---- | ----------------------- | -| columnIndex | number | Yes | Index of the specified column, starting from 0.| - -**Return value** - -| Type | Description | -| ------ | -------------------------- | -| number | Value in the specified column as a Long.| - -**Error codes** - -For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). - -| **ID**| **Error Message** | -| ------------ | ------------------------------------------------------------ | -| 14800013 | The column value is null or the column type is incompatible. | - -**Example** - - ```js -const age = resultSetV9.getLong(resultSetV9.getColumnIndex("AGE")); - ``` - -### getDouble9+ - -getDouble(columnIndex: number): number - -Obtains the value in the specified column in the current row as a double. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| ----------- | ------ | ---- | ----------------------- | -| columnIndex | number | Yes | Index of the specified column, starting from 0.| - -**Return value** - -| Type | Description | -| ------ | ---------------------------- | -| number | Value in the specified column as a double.| - -**Error codes** - -For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). - -| **ID**| **Error Message** | -| ------------ | ------------------------------------------------------------ | -| 14800013 | The column value is null or the column type is incompatible. | - -**Example** - - ```js -const salary = resultSetV9.getDouble(resultSetV9.getColumnIndex("SALARY")); - ``` - -### isColumnNull9+ - -isColumnNull(columnIndex: number): boolean - -Checks whether the value in the specified column of the current row is null. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| ----------- | ------ | ---- | ----------------------- | -| columnIndex | number | Yes | Index of the specified column, starting from 0.| - -**Return value** - -| Type | Description | -| ------- | --------------------------------------------------------- | -| boolean | Returns **true** if the value is null; returns **false** otherwise.| - -**Error codes** - -For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). - -| **ID**| **Error Message** | -| ------------ | ------------------------------------------------------------ | -| 14800013 | The column value is null or the column type is incompatible. | - -**Example** - - ```js -const isColumnNull = resultSetV9.isColumnNull(resultSetV9.getColumnIndex("CODES")); - ``` - -### close9+ - -close(): void - -Closes this result set. - -**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core - -**Example** - - ```js -let predicatesV9Close = new dataRdb.RdbPredicatesV9("EMPLOYEE"); -let promiseClose = rdbStoreV9.query(predicatesV9Close, ["ID", "NAME", "AGE", "SALARY", "CODES"]); -promiseClose.then((resultSetV9) => { - resultSetV9.close(); -}).catch((err) => { - console.log('resultset close failed'); -}); - ``` - -**Error codes** - -For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). - -| **ID**| **Error Message** | -| ------------ | ------------------------------------------------------------ | -| 14800012 | The result set is empty or the specified location is invalid. | - ## ResultSet Provides methods to access the result set, which is obtained by querying the RDB store. @@ -861,7 +331,7 @@ Obtains the value in the specified column in the current row as a string. getLong(columnIndex: number): number -Obtains the value in the specified column in the current row as a Long integer. +Obtains the value in the specified column in the current row as a long integer. **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core @@ -875,7 +345,7 @@ Obtains the value in the specified column in the current row as a Long integer. | Type| Description| | -------- | -------- | -| number | Value in the specified column as a Long integer.
The value range supported by this API is **Number.MIN_SAFE_INTEGER** to **Number.MAX_SAFE_INTEGER**. If the value is out of this range, use [getDouble](#getdouble).| +| number | Value in the specified column as a long integer.
The value range supported by this API is **Number.MIN_SAFE_INTEGER** to **Number.MAX_SAFE_INTEGER**. If the value is out of this range, use [getDouble](#getdouble).| **Example** diff --git a/en/application-dev/reference/apis/js-apis-data-storage.md b/en/application-dev/reference/apis/js-apis-data-storage.md index 8df3ab1e84ff92e39f31566416a34c4ffb3afa9b..75e9293eadcd0a25fc923146b92246a885829df6 100644 --- a/en/application-dev/reference/apis/js-apis-data-storage.md +++ b/en/application-dev/reference/apis/js-apis-data-storage.md @@ -1,4 +1,4 @@ -# @ohos.data.storage +# @ohos.data.storage (Lightweight Data Storage) The **DataStorage** module provides applications with data processing capability and allows applications to perform lightweight data storage and query. Data is stored in key-value (KV) pairs. Keys are of the string type, and values can be of the number, string, or Boolean type. @@ -367,7 +367,7 @@ Provides APIs for obtaining and modifying storage data. getSync(key: string, defValue: ValueType): ValueType -Obtains the value corresponding to a key. If the value is null or not in the default value format, the default value is returned. +Obtains the value corresponding to a key. If the value is null or not of the default value type, **defValue** is returned. **System capability**: SystemCapability.DistributedDataManager.Preferences.Core @@ -396,7 +396,7 @@ console.info("The value of startup is " + value); get(key: string, defValue: ValueType, callback: AsyncCallback<ValueType>): void -Obtains the value corresponding to a key. If the value is null or not in the default value format, the default value is returned. This API uses an asynchronous callback to return the result. +Obtains the value corresponding to a key. If the value is null or not of the default value type, **defValue** is returned. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.DistributedDataManager.Preferences.Core @@ -425,7 +425,7 @@ storage.get('startup', 'default', function(err, value) { get(key: string, defValue: ValueType): Promise<ValueType> -Obtains the value corresponding to a key. If the value is null or not in the default value format, the default value is returned. This API uses a promise to return the result. +Obtains the value corresponding to a key. If the value is null or not of the default value type, **defValue** is returned. This API uses a promise to return the result. **System capability**: SystemCapability.DistributedDataManager.Preferences.Core diff --git a/en/application-dev/reference/apis/js-apis-deque.md b/en/application-dev/reference/apis/js-apis-deque.md index 274836333aa773d32a386ad22b03706e890859c7..46d97bd96c27c9d3f05d519ebde6ff1ed8d3e4c5 100644 --- a/en/application-dev/reference/apis/js-apis-deque.md +++ b/en/application-dev/reference/apis/js-apis-deque.md @@ -1,9 +1,5 @@ # @ohos.util.Deque (Linear Container Deque) -> **NOTE** -> -> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. - Double-ended queue (deque) is a sequence container implemented based on the queue data structure that follows the principles of First In First Out (FIFO) and Last In First Out (LIFO). It allows insertion and removal of elements at both the ends. **Deque** can dynamically adjust the capacity based on project requirements. It doubles the capacity each time. **Deque** differs from **[Queue](js-apis-queue.md)** and **[Vector](js-apis-vector.md)** mainly in the following aspects: **Queue** follows the principle of FIFO only and allows element removal at the front and insertion at the rear. @@ -15,6 +11,11 @@ Double-ended queue (deque) is a sequence container implemented based on the queu This topic uses the following to identify the use of generics: - T: Type +> **NOTE** +> +> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. + + ## Modules to Import ```ts @@ -269,7 +270,7 @@ deque.insertEnd(4); deque.insertFront(5); deque.insertEnd(4); deque.forEach((value, index) => { - console.log("value:" + value, index); + console.log("value:" + value, "index:" + index); }); ``` diff --git a/en/application-dev/reference/apis/js-apis-file-fs.md b/en/application-dev/reference/apis/js-apis-file-fs.md index 333b0621fd078620e501d90c2c93d908ae840479..706d98e0899f48095b30e456a8fa206dae997fb8 100644 --- a/en/application-dev/reference/apis/js-apis-file-fs.md +++ b/en/application-dev/reference/apis/js-apis-file-fs.md @@ -15,7 +15,7 @@ import fs from '@ohos.file.fs'; ## Guidelines -Before using the APIs provided by this module to perform operations on files or directories, obtain the path of the application sandbox as follows: +Before using the APIs provided by this module to perform operations on files or directories, obtain the path of the file or directory in the application sandbox as follows: **Stage Model** @@ -147,7 +147,7 @@ Checks whether a file exists. This API uses a promise to return the result. | Type | Description | | ------------------- | ---------------------------- | -| Promise<boolean> | Promise used to return a Boolean value. | +| Promise<boolean> | Promise used to return a Boolean value.| **Example** @@ -1079,7 +1079,7 @@ Reads the text content of a file. This API uses an asynchronous callback to retu | -------- | --------------------------- | ---- | ------------------------------------------------------------ | | filePath | string | Yes | Path of the file in the application sandbox. | | options | Object | No | The options are as follows:
- **offset** (number): position of the data to read in the file. This parameter is optional. By default, data is read from the current position.
- **length** (number): length of the data to read. This parameter is optional. The default value is the file length.
- **encoding** (string): format of the string to be encoded. The default value is **'utf-8'**, which is the only value supported.| -| callback | AsyncCallback<string> | Yes | Callback used to return the content read. | +| callback | AsyncCallback<string> | Yes | Callback invoked to return the content read. | **Example** @@ -1169,7 +1169,7 @@ Obtains information about a symbolic link. This API uses an asynchronous callbac | Name | Type | Mandatory| Description | | -------- | ---------------------------------- | ---- | -------------------------------------- | | path | string | Yes | Path of the symbolic link in the application sandbox.| -| callback | AsyncCallback<[Stat](#stat)> | Yes | Callback used to return the symbolic link information obtained. | +| callback | AsyncCallback<[Stat](#stat)> | Yes | Callback invoked to return the symbolic link information obtained. | **Example** @@ -1215,7 +1215,7 @@ Obtains information about a symbolic link synchronously. rename(oldPath: string, newPath: string): Promise<void> -Renames a file. This API uses a promise to return the result. +Renames a file or directory. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.File.FileIO @@ -1248,7 +1248,7 @@ Renames a file. This API uses a promise to return the result. rename(oldPath: string, newPath: string, callback: AsyncCallback<void>): void -Renames a file. This API uses an asynchronous callback to return the result. +Renames a file or directory. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.FileManagement.File.FileIO @@ -1278,7 +1278,7 @@ Renames a file. This API uses an asynchronous callback to return the result. renameSync(oldPath: string, newPath: string): void -Synchronously renames a file. +Renames a file or directory synchronously. **System capability**: SystemCapability.FileManagement.File.FileIO @@ -1366,7 +1366,7 @@ Flushes data of a file to disk. This API uses an asynchronous callback to return fsyncSync(fd: number): void -Flushes data of a file to disk in synchronous mode. +Flushes data of a file to disk synchronously. **System capability**: SystemCapability.FileManagement.File.FileIO @@ -1454,7 +1454,7 @@ Flushes data of a file to disk. This API uses an asynchronous callback to return fdatasyncSync(fd: number): void -Synchronizes data in a file in synchronous mode. +Synchronizes data in a file synchronously. **System capability**: SystemCapability.FileManagement.File.FileIO diff --git a/en/application-dev/reference/apis/js-apis-file-hash.md b/en/application-dev/reference/apis/js-apis-file-hash.md index fca5de996e882e8a568dd3851512ed5e8be18c9c..eb9247ab3ccc6ee628fbd12e8a8a51413abbda01 100644 --- a/en/application-dev/reference/apis/js-apis-file-hash.md +++ b/en/application-dev/reference/apis/js-apis-file-hash.md @@ -60,9 +60,9 @@ Calculates a hash value for a file. This API uses a promise to return the result **Return value** -| Type | Description | -| --------------------- | -------------------------- | -| Promise<string> | Promise used to return the hash value. The hash value is a hexadecimal string consisting of digits and uppercase letters.| + | Type | Description | + | --------------------- | -------------------------- | + | Promise<string> | Promise used to return the hash value. The hash value is a hexadecimal string consisting of digits and uppercase letters.| **Example** @@ -93,6 +93,7 @@ Calculates a hash value for a file. This API uses an asynchronous callback to re **Example** ```js + let filePath = pathDir + "/test.txt"; Hash.hash(filePath, "sha256", (err, str) => { if (err) { console.info("calculate file hash failed with error message: " + err.message + ", error code: " + err.code); diff --git a/en/application-dev/reference/apis/js-apis-file-statvfs.md b/en/application-dev/reference/apis/js-apis-file-statvfs.md index 8241f4734312251f1d4dce13888a2e8ce521ca90..f431f3cb17d8d82a88a0b9bde7e2a3e3d8e66c86 100644 --- a/en/application-dev/reference/apis/js-apis-file-statvfs.md +++ b/en/application-dev/reference/apis/js-apis-file-statvfs.md @@ -36,14 +36,14 @@ Obtains the number of free bytes of the specified file system in asynchronous mo ```js let path = "/dev"; - statfs.getFreeSize(path).then((number) => { + statvfs.getFreeSize(path).then((number) => { console.info("getFreeSize promise successfully, Size: " + number); }).catch((err) => { console.info("getFreeSize failed with error message: " + err.message + ", error code: " + err.code); }); ``` -## statfs.getFreeSize +## statvfs.getFreeSize getFreeSize(path:string, callback:AsyncCallback<number>): void @@ -62,7 +62,7 @@ Obtains the number of free bytes of the specified file system in asynchronous mo ```js let path = "/dev"; - statfs.getFreeSize(path, (err, number) => { + statvfs.getFreeSize(path, (err, number) => { if (err) { console.info("getFreeSize failed with error message: " + err.message + ", error code: " + err.code); } else { @@ -71,7 +71,7 @@ Obtains the number of free bytes of the specified file system in asynchronous mo }); ``` -## statfs.getTotalSize +## statvfs.getTotalSize getTotalSize(path: string): Promise<number> @@ -95,14 +95,14 @@ Obtains the total number of bytes of the specified file system in asynchronous m ```js let path = "/dev"; - statfs.getTotalSize(path).then((number) => { + statvfs.getTotalSize(path).then((number) => { console.info("getTotalSize promise successfully, Size: " + number); }).catch((err) => { console.info("getTotalSize with error message: " + err.message + ", error code: " + err.code); }); ``` -## statfs.getTotalSize +## statvfs.getTotalSize getTotalSize(path: string, callback: AsyncCallback<number>): void @@ -121,7 +121,7 @@ Obtains the total number of bytes of the specified file system in asynchronous m ```js let path = "/dev"; - statfs.getTotalSize(path, (err, number) => { + statvfs.getTotalSize(path, (err, number) => { if (err) { console.info("getTotalSize with error message: " + err.message + ", error code: " + err.code); } else { diff --git a/en/application-dev/reference/apis/js-apis-file-storage-statistics.md b/en/application-dev/reference/apis/js-apis-file-storage-statistics.md new file mode 100644 index 0000000000000000000000000000000000000000..834bf7bcbdd703786d9bb43db8fe0b61956fdd52 --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-file-storage-statistics.md @@ -0,0 +1,593 @@ +# @ohos.file.storageStatistics (Application Storage Statistics) + +The **storageStatistics** module provides APIs for obtaining storage space information, including the space of built-in and plug-in memory cards, space occupied by different types of data, and space of application data. + +> **NOTE** +> +> - The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> - The APIs of this module support processing of error codes. For details, see [File Management Error Codes](../errorcodes/errorcode-filemanagement.md). +## Modules to Import + +```js +import storageStatistics from "@ohos.file.storageStatistics"; +``` + +## storageStatistics.getTotalSizeOfVolume + +getTotalSizeOfVolume(volumeUuid: string): Promise<number> + +Obtains the total size (in bytes) of the specified volume in an external storage device. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.STORAGE_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics + + +This is a system API. + + +**Parameters** + + | Name | Type | Mandatory| Description| + | ---------- | ------ | ---- | ---- | + | volumeUuid | string | Yes | UUID of the volume.| + +**Return value** + + | Type | Description | + | --------------------- | ---------------- | + | Promise<number> | Promise used to return the total volume size obtained.| + +**Example** + + ```js + let uuid = ""; + storageStatistics.getTotalSizeOfVolume(uuid).then(function(number){ + console.info("getTotalSizeOfVolume successfully:"+ number); + }).catch(function(err){ + console.info("getTotalSizeOfVolume failed with error:"+ err); + }); + ``` + +## storageStatistics.getTotalSizeOfVolume + +getTotalSizeOfVolume(volumeUuid: string, callback: AsyncCallback<number>): void + +Obtains the total size (in bytes) of the specified volume in an external storage device. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.STORAGE_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics + + +This is a system API. + + +**Parameters** + + | Name | Type | Mandatory| Description | + | ---------- | ------------------------------------ | ---- | -------------------------- | + | volumeUuid | string | Yes | UUID of the volume. | + | callback | AsyncCallback<number> | Yes | Callback invoked to return the total volume size obtained.| + +**Example** + + ```js + let uuid = ""; + storageStatistics.getTotalSizeOfVolume(uuid, function(error, number){ + // Do something. + console.info("getTotalSizeOfVolume successfully:"+ number); + }); + ``` + +## storageStatistics.getFreeSizeOfVolume + +getFreeSizeOfVolume(volumeUuid: string): Promise<number> + +Obtains the available space (in bytes) of the specified volume in an external storage device. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.STORAGE_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics + + +This is a system API. + + +**Parameters** + + | Name | Type | Mandatory| Description| + | ---------- | ------ | ---- | ---- | + | volumeUuid | string | Yes | UUID of the volume.| + +**Return value** + + | Type | Description | + | --------------------- | ------------------ | + | Promise<number> | Promise used to return the available volume space obtained.| + +**Example** + + ```js + let uuid = ""; + storageStatistics.getFreeSizeOfVolume(uuid).then(function(number){ + console.info("getFreeSizeOfVolume successfully:"+ number); + }).catch(function(err){ + console.info("getFreeSizeOfVolume failed with error:"+ err); + }); + + ``` + +## storageStatistics.getFreeSizeOfVolume + +getFreeSizeOfVolume(volumeUuid: string, callback: AsyncCallback<number>): void + +Obtains the available space (in bytes) of the specified volume in an external storage device. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.STORAGE_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics + + +This is a system API. + + +**Parameters** + + | Name | Type | Mandatory| Description | + | ---------- | ------------------------------------ | ---- | ---------------------------- | + | volumeUuid | string | Yes | UUID of the volume. | + | callback | AsyncCallback<number> | Yes | Callback invoked to return the available volume space obtained.| + +**Example** + + ```js + let uuid = ""; + storageStatistics.getFreeSizeOfVolume(uuid, function(error, number){ + // Do something. + console.info("getFreeSizeOfVolume successfully:"+ number); + }); + ``` + +## storageStatistics.getBundleStats9+ + +getBundleStats(packageName: string): Promise<BundleStats> + +Obtains the space (in bytes) of an application. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.STORAGE_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics + + +This is a system API. + + +**Parameters** + + | Name | Type | Mandatory| Description | + | ----------- | ------ | ---- | -------- | + | packageName | string | Yes | Bundle name of the application.| + +**Return value** + + | Type | Description | + | ------------------------------------------ | -------------------------- | + | Promise<[Bundlestats](#bundlestats9)> | Promise used to return the application space obtained.| + +**Example** + + ```js + let packageName = ""; + storageStatistics.getBundleStats(packageName).then(function(BundleStats){ + console.info("getBundleStats successfully:"+ JSON.stringify(BundleStats)); + }).catch(function(err){ + console.info("getBundleStats failed with error:"+ err); + }); + ``` + +## storageStatistics.getBundleStats9+ + +getBundleStats(packageName: string, callback: AsyncCallback<BundleStats>): void + +Obtains the space (in bytes) of an application. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.STORAGE_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics + + +This is a system API. + + +**Parameters** + + | Name | Type | Mandatory| Description | + | -------- | --------------------------------------------------------- | ---- | ------------------------------------ | + | packageName | string | Yes | Bundle name of the application.| + | callback | AsyncCallback<[Bundlestats](#bundlestats9)> | Yes | Callback invoked to return the application space obtained.| + +**Example** + + ```js + let packageName = ""; + storageStatistics.getBundleStats(packageName, function(error, BundleStats){ + // Do something. + console.info("getBundleStats successfully:"+ JSON.stringify(BundleStats)); + }); + ``` + +## storageStatistics.getCurrentBundleStats9+ + +getCurrentBundleStats(): Promise<BundleStats> + +Obtains the space (in bytes) of this third-party application. This API uses a promise to return the result. + +**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics + +**Return value** + + | Type | Description | + | ------------------------------------------ | -------------------------- | + | Promise<[Bundlestats](#bundlestats9)> | Promise used to return the application space obtained. | + +**Example** + + ```js + let bundleStats = storageStatistics.getCurrentBundleStats(); + console.info("getCurrentBundleStats successfully:"+ JSON.stringify(bundleStats)); + ``` + +## storageStatistics.getCurrentBundleStats9+ + +getCurrentBundleStats(callback: AsyncCallback<BundleStats>): void + +Obtains the space (in bytes) of this third-party application. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics + +**Parameters** + + | Name | Type | Mandatory | Description | + | -------- | --------------------------------------------------------- | ---- | ------------------------------------ | + | callback | AsyncCallback<[BundleStats](#bundlestats9)> | Yes | Callback invoked to return the application space obtained. | + +**Example** + + ```js + storageStatistics.getCurrentBundleStats(function(error, bundleStats){ + // Do something. + console.info("getCurrentBundleStats successfully:"+ JSON.stringify(bundleStats)); + }); + ``` + +## BundleStats9+ + +### Attributes + +**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics + + + +| Name | Type | Readable| Writable| Description | +| --------- | ------ | --- | ---- | -------------- | +| appSize | number | Yes| No| Size of the application, in bytes. | +| cacheSize | number | Yes| No| Cache size of the application, in bytes. | +| dataSize | number | Yes| No| Total data size of the application, in bytes.| + + +## storageStatistics.getTotalSize9+ + +getTotalSize(): Promise<number> + +Obtains the total size (in bytes) of the built-in storage. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.STORAGE_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics + + +This is a system API. + + +**Return value** + + | Type | Description | + | --------------------- | ------------------ | + | Promise<number> | Promise used to return the built-in storage size obtained. | + +**Example** + + ```js + let number = storageStatistics.getTotalSize(); + console.info("getTotalSize successfully:"+ JSON.stringify(number)); + ``` + +## storageStatistics.getTotalSize9+ + +getTotalSize(callback: AsyncCallback<number>): void + +Obtains the total size (in bytes) of the built-in storage. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.STORAGE_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics + + +This is a system API. + + +**Parameters** + + | Name | Type | Mandatory | Description | + | -------- | ------------------------------------ | ---- | ------------------------ | + | callback | AsyncCallback<number> | Yes | Callback invoked to return the built-in storage size obtained.| + +**Example** + + ```js + storageStatistics.getTotalSize(function(error, number){ + // Do something. + console.info("getTotalSize successfully:"+ JSON.stringify(number)); + }); + ``` + + +## storageStatistics.getFreeSize9+ + +getFreeSize(): Promise<number> + +Obtains the available space (in bytes) of the built-in storage. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.STORAGE_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics + + +This is a system API. + + +**Return value** + + | Type | Description | + | --------------------- | ------------------ | + | Promise<number> | Promise used to return the available space of the built-in storage obtained.| + +**Example** + + ```js + let number = storageStatistics.getFreeSize(); + console.info("getFreeSize successfully:"+ JSON.stringify(number)); + ``` + + +## storageStatistics.getFreeSize9+ + +getFreeSize(callback: AsyncCallback<number>): void + +Obtains the available space (in bytes) of the built-in storage. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.STORAGE_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics + + +This is a system API. + + +**Parameters** + + | Name | Type | Mandatory| Description | + | -------- | ------------------------------------ | ---- | ------------------------- | + | callback | AsyncCallback<number> | Yes | Callback invoked to return the available space of the built-in storage obtained.| + +**Example** + + ```js + storageStatistics.getFreeSize(function(error, number){ + // Do something. + console.info("getFreeSize successfully:"+ JSON.stringify(number)); + }); + ``` + +## storageStatistics.getSystemSize9+ + +getSystemSize(): Promise<number> + +Obtains the system data space, in bytes. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.STORAGE_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics + + +This is a system API. + + +**Return value** + + | Type | Description | + | --------------------- | ---------------- | + | Promise<number> | Promise used to return the system data space obtained.| + +**Example** + + ```js + storageStatistics.getSystemSize().then(function(number){ + console.info("getSystemSize successfully:"+ number); + }).catch(function(err){ + console.info("getSystemSize failed with error:"+ err); + }); + ``` + +## storageStatistics.getSystemSize9+ + +getSystemSize(callback: AsyncCallback<number>): void + +Obtains the system data space, in bytes. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.STORAGE_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics + + +This is a system API. + + +**Parameters** + + | Name | Type | Mandatory| Description | + | ---------- | ------------------------------------ | ---- | -------------------------- | + | callback | AsyncCallback<number> | Yes | Callback invoked to return the system data space obtained.| + +**Example** + + ```js + storageStatistics.getSystemSize(function(error, number){ + // Do something. + console.info("getSystemSize successfully:"+ number); + }); + ``` + +## storageStatistics.getUserStorageStats9+ + +getUserStorageStats(): Promise<StorageStats> + +Obtains the storage statistics (in bytes) of this user. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.STORAGE_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics + + +This is a system API. + + +**Return value** + + | Type | Description | + | --------------------- | ---------------- | + | Promise<[StorageStats](#storagestats9)> | Promise used to return the information obtained.| + +**Example** + + ```js + storageStatistics.getUserStorageStats().then(function(StorageStats){ + console.info("getUserStorageStats successfully:"+ JSON.stringify(StorageStats)); + }).catch(function(err){ + console.info("getUserStorageStats failed with error:"+ err); + }); + ``` + +## storageStatistics.getUserStorageStats9+ + +getUserStorageStats(callback: AsyncCallback<StorageStats>): void + +Obtains the storage statistics (in bytes) of this user. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.STORAGE_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics + + +This is a system API. + + +**Parameters** + + | Name | Type | Mandatory| Description | + | ---------- | ------------------------------------ | ---- | -------------------------- | + | callback | AsyncCallback<[StorageStats](#storagestats9)> | Yes | Callback invoked to return the information obtained.| + +**Example** + + ```js + storageStatistics.getUserStorageStats(function(error, StorageStats){ + // Do something. + console.info("getUserStorageStats successfully:"+ JSON.stringify(StorageStats)); + }); + ``` +getUserStorageStats(userId: number): Promise<StorageStats> + +Obtains the storage statistics (in bytes) of the specified user. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.STORAGE_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics + + +This is a system API. + + +**Parameters** + + | Name | Type | Mandatory| Description| + | ---------- | ------ | ---- | ---- | + | userId | number | Yes | User ID.| + +**Return value** + + | Type | Description | + | --------------------- | ---------------- | + | Promise<[StorageStats](#storagestats9)> | Promise used to return the information obtained.| + +**Example** + + ```js + let userId = 100; + storageStatistics.getUserStorageStats(userId).then(function(StorageStats){ + console.info("getUserStorageStats successfully:"+ JSON.stringify(StorageStats)); + }).catch(function(err){ + console.info("getUserStorageStats failed with error:"+ err); + }); + ``` + +## storageStatistics.getUserStorageStats9+ + +getUserStorageStats(userId: number, callback: AsyncCallback<StorageStats>): void + +Obtains the storage statistics (in bytes) of the specified user. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.STORAGE_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics + + +This is a system API. + + +**Parameters** + + | Name | Type | Mandatory| Description | + | ---------- | ------------------------------------ | ---- | -------------------------- | + | userId | number | Yes | User ID.| + | callback | AsyncCallback<[StorageStats](#storagestats9)> | Yes | Callback invoked to return the information obtained.| + +**Example** + + ```js + let userId = 100; + storageStatistics.getUserStorageStats(userId, function(error, StorageStats){ + // Do something. + console.info("getUserStorageStats successfully:"+ JSON.stringify(StorageStats)); + }); + ``` + + +## StorageStats9+ + +### Attributes + +**System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics + + +This is a system API. + +| Name | Type | Readable | Writable | Description | +| --------- | ------ | ---- | ----- | -------------- | +| total | number | Yes| No| Total size of the built-in storage, in bytes. | +| audio | number |Yes| No| Space occupied by audio data, in bytes. | +| video | number | Yes| No| Space occupied by video data, in bytes.| +| image | number | Yes| No| Space occupied by image data, in bytes. | +| file | number | Yes| No| Space occupied by files, in bytes. | +| app | number | Yes| No| Space occupied by application data, in bytes.| diff --git a/en/application-dev/reference/apis/js-apis-file-volumemanager.md b/en/application-dev/reference/apis/js-apis-file-volumemanager.md new file mode 100644 index 0000000000000000000000000000000000000000..bf1e5c9c417ecc5940e75d4876def5ffd7b4b210 --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-file-volumemanager.md @@ -0,0 +1,502 @@ +# @ohos.file.volumeManager (Volument Management) + +The volumeManager module provides APIs for volume and disk management, including obtaining volume information, mounting or unmounting volumes, partitioning disks, and formatting volumes. + +> **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. +> - The APIs of this module support processing of error codes. For details, see [File Management Error Codes](../errorcodes/errorcode-filemanagement.md). + +## Modules to Import + +```js +import volumemanager from "@ohos.file.volumeManager"; +``` + +## volumemanager.getAllVolumes + +getAllVolumes(): Promise<Array<Volume>> + +Asynchronously obtains information about all available volumes. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.STORAGE_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.Volume + +**Return value** + + | Type | Description | + | ---------------------------------- | -------------------------- | + | Promise<[Volume](#volume)[]> | Promise used to return the execution result.| + +**Example** + + ```js + volumemanager.getAllVolumes().then(function(volumes){ + // Do something. + }); + ``` + +## volumemanager.getAllVolumes + +getAllVolumes(callback: AsyncCallback<Array<Volume>>): void + +Asynchronously obtains information about all available volumes. This API uses a callback to return the result. + +**Required permissions**: ohos.permission.STORAGE_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.Volume + +**Parameters** + + | Name | Type | Mandatory| Description | + | -------- | ------------------------------------------------- | ---- | ------------------------------------ | + | callback | AsyncCallback<[Volume](#volume)[]> | Yes | Callback invoked to return the volume information obtained.| + +**Example** + + ```js + let uuid = ""; + volumemanager.getAllVolumes(function(error, volumes){ + // Do something + }); + ``` + + +## volumemanager.mount + +mount(volumeId: string): Promise<void> + +Asynchronously mounts a volume. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.MOUNT_UNMOUNT_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.Volume + +**Parameters** + + | Name | Type | Mandatory| Description| + | -------- | ------ | ---- | ---- | + | volumeId | string | Yes | Volume ID.| + +**Return value** + + | Type | Description | + | ---------------------- | ---------- | + | Promise<void> | Promise used to return the result.| + +**Example** + + ```js + let volumeId = ""; + volumemanager.mount(volumeId).then(function(flag){ + // Do something + }); + ``` + +## volumemanager.mount + +mount(volumeId: string, callback:AsyncCallback<void>):void + +Asynchronously obtains the available space of the specified volume. This API uses a callback to return the result. + +**Required permissions**: ohos.permission.MOUNT_UNMOUNT_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.Volume + +**Parameters** + + | Name | Type | Mandatory| Description | + | -------- | ------------------------------------- | ---- | -------------------- | + | volumeId | string | Yes | Volume ID. | + | callback | AsyncCallback<void> | Yes | Callback invoked to return the result.| + +**Example** + + ```js + let volumeId = ""; + volumemanager.mount(volumeId, function(error, flag){ + // Do something + }); + ``` + +## volumemanager.unmount + +unmount(volumeId: string): Promise<void> + +Asynchronously unmounts a volume. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.MOUNT_UNMOUNT_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.Volume + +**Parameters** + + | Name | Type | Mandatory| Description| + | -------- | ------ | ---- | ---- | + | volumeId | string | Yes | Volume ID.| + +**Return value** + + | Type | Description | + | ---------------------- | ---------- | + | Promise<void> | Promise used to return the result.| + +**Example** + + ```js + let volumeId = ""; + volumemanager.unmount(volumeId).then(function(flag){ + // Do something + }); + ``` + +## volumemanager.unmount + +unmount(volumeId: string, callback: AsyncCallback<void>): void + +Asynchronously unmounts a volume. This API uses a callback to return the result. + +**Required permissions**: ohos.permission.MOUNT_UNMOUNT_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.Volume + +**Parameters** + + | Name | Type | Mandatory| Description | + | -------- | ------------------------------------- | ---- | -------------------- | + | volumeId | string | Yes | Volume ID. | + | callback | AsyncCallback<void> | Yes | Callback invoked to return the result.| + +**Example** + + ```js + let volumeId = ""; + volumemanager.unmount(volumeId, function(error, flag){ + // Do something + }); + ``` + +## volumemanager.getVolumeByUuid + +getVolumeByUuid(uuid: string): Promise<Volume> + +Asynchronously obtains volume information based on the universally unique identifier (UUID). This API uses a promise to return the result. + +**Required permissions**: ohos.permission.STORAGE_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.Volume + +**Parameters** + + | Name | Type | Mandatory| Description| + | -------- | ------ | ---- | ---- | + | uuid | string | Yes | UUID of the volume.| + +**Return value** + + | Type | Description | + | ---------------------------------- | -------------------------- | + | Promise<[Volume](#volume)> | Promise used to return the volume information obtained.| + +**Example** + + ```js + let uuid = ""; + volumemanager.getVolumeByUuid(uuid).then(function(volume) { + console.info("getVolumeByUuid successfully:" + JSON.stringify(volume)); + }).catch(function(error){ + console.info("getVolumeByUuid failed with error:"+ error); + }); + ``` + +## volumemanager.getVolumeByUuid + +getVolumeByUuid(uuid: string, callback: AsyncCallback<Volume>): void + +Asynchronously obtains volume information based on the UUID. This API uses a callback to return the result. + +**Required permissions**: ohos.permission.STORAGE_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.Volume + +**Parameters** + + | Name | Type | Mandatory| Description | + | -------- | ------------------------------------------------ | ---- | -------------------- | + | uuid | string | Yes | UUID of the volume. | + | callback | AsyncCallback<[Volume](#volume)> | Yes | Callback invoked to return the volume information obtained.| + +**Example** + + ```js + let uuid = ""; + volumemanager.getVolumeByUuid(uuid, (error, volume) => { + // Do something. + }); + ``` + +## volumemanager.getVolumeById + +getVolumeById(volumeId: string): Promise<Volume> + +Asynchronously obtains volume information based on the volume ID. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.STORAGE_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.Volume + +**Parameters** + + | Name | Type | Mandatory | Description| + | -------- | ------ | ---- | ---- | + | volumeId | string | Yes | Volume ID.| + +**Return value** + + | Type | Description | + | ---------------------------------- | -------------------------- | + | Promise<[Volume](#volume)> | Promise used to return the volume information obtained.| + +**Example** + + ```js + let volumeId = ""; + volumemanager.getVolumeById(volumeId).then(function(volume) { + console.info("getVolumeById successfully:" + JSON.stringify(volume)); + }).catch(function(error){ + console.info("getVolumeById failed with error:"+ error); + }); + ``` + +## volumemanager.getVolumeById + +getVolumeById(volumeId: string, callback: AsyncCallback<Volume>): void + +Asynchronously obtains volume information based on the volume ID. This API uses a callback to return the result. + +**Required permissions**: ohos.permission.STORAGE_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.Volume + +**Parameters** + + | Name | Type | Mandatory| Description | + | -------- | ------------------------- | ---- | ----------------------------- | + | volumeId | string | Yes | Volume ID. | + | callback | AsyncCallback<[Volume](#volume)> | Yes | Callback invoked to return the volume information obtained. | + +**Example** + + ```js + let volumeId = ""; + volumemanager.getVolumeById(volumeId, (error, volume) => { + // Do something. + }); + ``` + +## volumemanager.setVolumeDescription + +setVolumeDescription(uuid: string, description: string): Promise<void> + +Asynchronously sets the volume description based on the UUID. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.MOUNT_UNMOUNT_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.Volume + +**Parameters** + + | Name | Type | Mandatory| Description| + | --------- | ------ | ---- | ---- | + | uuid | string | Yes | UUID of the volume.| + | description | string | Yes | Volume description.| + +**Return value** + + | Type | Description | + | ---------------------- | -------------------------- | + | Promise<void> | Promise used to return the result. | + +**Example** + + ```js + let uuid = ""; + let description = ""; + volumemanager.setVolumeDescription(uuid, description).then(function() { + console.info("setVolumeDescription successfully"); + }).catch(function(error){ + console.info("setVolumeDescription failed with error:"+ error); + }); + ``` + +## volumemanager.setVolumeDescription + +setVolumeDescription(uuid: string, description: string, callback: AsyncCallback<void>): void + +Asynchronously sets the volume description based on the UUID. This API uses a callback to return the result. + +**Required permissions**: ohos.permission.MOUNT_UNMOUNT_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.Volume + +**Parameters** + + | Name | Type | Mandatory| Description | + | ---------- | --------------------------------------- | ---- | ---------------- | + | uuid | string | Yes | UUID of the volume. | + | description | string | Yes | Volume description. | + | callback | AsyncCallback<void> | Yes | Callback invoked to return the result.| + +**Example** + + ```js + let uuid = ""; + let description = ""; + volumemanager.setVolumeDescription(uuid, description, (error, bool) => { + // Do something. + }); + ``` + +## volumemanager.format + +format(volumeId: string, fsType: string): Promise<void> + +Asynchronously formats a volume. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.MOUNT_FORMAT_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.Volume + +**Parameters** + + | Name | Type | Mandatory| Description| + | ----------- | ------ | ---- | ---- | + | volumeId | string | Yes | Volume ID.| + | fsType | string | Yes | File system type.| + +**Return value** + + | Type | Description | + | ---------------------- | ---------- | + | Promise<void> | Promise used to return the result.| + +**Example** + + ```js + let volumeId = ""; + let fsType = ""; + volumemanager.format(volumeId, fsType).then(function() { + console.info("format successfully"); + }).catch(function(error){ + console.info("format failed with error:"+ error); + }); + ``` + +## volumemanager.format + +format(volumeId: string, fsType: string, callback: AsyncCallback<void>): void + +Asynchronously formats a volume. This API uses a callback to return the result. + +**Required permissions**: ohos.permission.MOUNT_FORMAT_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.Volume + +**Parameters** + + | Name | Type | Mandatory| Description | + | -------- | ------------------------- | ---- | ----------------------------- | + | volumeId | string | Yes | Volume ID. | + | fsType | string | Yes | File system type.| + | callback | AsyncCallback<void> | Yes | Called after the volume is formatted. | + +**Example** + + ```js + let volumeId = ""; + let fsType = ""; + volumemanager.format(volumeId, fsType, (error, bool) => { + // Do something. + }); + ``` + +## volumemanager.partition + +partition(diskId: string, type: number): Promise<void> + +Asynchronously partitions a disk. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.MOUNT_FORMAT_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.Volume + +**Parameters** + + | Name | Type | Mandatory| Description| + | ----------- | ------ | ---- | ---- | + | diskId | string | Yes | ID of the disk to which the volume belongs.| + | type | number | Yes | Partition type. | + +**Return value** + + | Type | Description | + | --------------------- | ----------------------- | + | Promise<void> | Promise used to return the result. | + +**Example** + + ```js + let diskId = ""; + let type = 0; + volumemanager.partition(diskId, type).then(function() { + console.info("partition successfully"); + }).catch(function(error){ + console.info("partition failed with error:"+ error); + }); + ``` + +## volumemanager.partition + +partition(diskId: string, type: number, callback: AsyncCallback<void>): void + +Asynchronously partitions a disk. This API uses a callback to return the result. + +**Required permissions**: ohos.permission.MOUNT_FORMAT_MANAGER + +**System capability**: SystemCapability.FileManagement.StorageService.Volume + +**Parameters** + + | Name | Type | Mandatory| Description | + | -------- | --------------------------------------- | ---- | ---------------- | + | diskId | string | Yes | ID of the disk to which the volume belongs. | + | type | number | Yes | Partition type. | + | callback | AsyncCallback<void> | Yes | Callback invoked to return the result. | + +**Example** + + ```js + let diskId = ""; + let type = 0; + volumemanager.partition(diskId, type, (error, bool) => { + // Do something. + }); + ``` + +## Volume + +**System capability**: SystemCapability.FileManagement.StorageService.Volume + +### Attributes + +| Name | Type | Readable | Writable | Description | +| ----------- | ------- | ------- | ----- | -------------------- | +| id | string | Yes| No| Volume ID. | +| uuid | string | Yes| No| UUID of the volume. | +| diskId | string | Yes| No| ID of the disk to which the volume belongs. | +| description | string | Yes| No| Description of the volume. | +| removable | boolean | Yes| No| Whether the volume is a removable storage device.| +| state | number | Yes| No| Volume state. | +| path | string | Yes| No| Mount address of the volume. | diff --git a/en/application-dev/reference/apis/js-apis-fileAccess.md b/en/application-dev/reference/apis/js-apis-fileAccess.md index 9d653bc4344c6f0262e55b557d72435620ba3d74..7cc6188dd1958ba7a158f7b06236206e8055fc9e 100644 --- a/en/application-dev/reference/apis/js-apis-fileAccess.md +++ b/en/application-dev/reference/apis/js-apis-fileAccess.md @@ -25,9 +25,9 @@ Obtains information about all wants with **extension** set to **fileAccess** in **Return value** -| Type| Description| -| --- | -- | -| Promise<Array<Want>> | Promise used to return the **want** information obtained.| + | Type| Description| + | --- | -- | + | Promise<Array<Want>> | Promise used to return the **want** information obtained.| **Example** @@ -55,9 +55,9 @@ Obtains information about all wants with **extension** set to **fileAccess** in **Parameters** -| Name| Type| Mandatory| Description| -| --- | --- | --- | -- | -| callback | AsyncCallback<Array<Want>> | Yes| Promise used to return the **want** information obtained.| + | Name| Type| Mandatory| Description| + | --- | --- | --- | -- | + | callback | AsyncCallback<Array<Want>> | Yes| Promise used to return the **want** information obtained.| **Example** @@ -89,16 +89,16 @@ Synchronously creates a **Helper** object to connect to the specified wants. The **Parameters** -| Name| Type| Mandatory| Description| -| --- | --- | --- | -- | -| context | Context | Yes| Context of the ability.| -| wants | Array<Want> | Yes| Wants to connect.| + | Name| Type| Mandatory| Description| + | --- | --- | --- | -- | + | context | Context | Yes| Context of the ability.| + | wants | Array<Want> | Yes| Wants to connect.| **Return value** -| Type| Description| -| --- | -- | -| FileAccessHelper | **Helper** object created.| + | Type| Description| + | --- | -- | + | FileAccessHelper | **Helper** object created.| **Example** @@ -136,26 +136,26 @@ Synchronously creates a **Helper** object to connect to all file management serv **Parameters** -| Name| Type| Mandatory| Description| -| --- | --- | --- | -- | -| context | Context | Yes| Context of the ability.| + | Name| Type| Mandatory| Description| + | --- | --- | --- | -- | + | context | Context | Yes| Context of the ability.| **Return value** -| Type| Description| -| --- | -- | -| FileAccessHelper | **Helper** object created.| + | Type| Description| + | --- | -- | + | FileAccessHelper | **Helper** object created.| **Example** ```js createFileAccessHelper() { - let fileAccesssHelperAllServer = null; + let fileAccessHelperAllServer = null; // Create a Helper object to interact with all file management services configured with fileAccess in the system. try { // this.context is passed by EntryAbility. - fileAccesssHelperAllServer = fileAccess.createFileAccessHelper(this.context); - if (!fileAccesssHelperAllServer) + fileAccessHelperAllServer = fileAccess.createFileAccessHelper(this.context); + if (!fileAccessHelperAllServer) console.error("createFileAccessHelper interface returns an undefined object"); } catch (error) { console.error("createFileAccessHelper failed, errCode:" + error.code + ", errMessage:" + error.message); @@ -175,9 +175,9 @@ Obtains information about the device root nodes of the file management service t **Return value** -| Type| Description| -| --- | -- | -| Promise<RootIterator> | Promise used to return the **RootIterator** object obtained.| + | Type| Description| + | --- | -- | + | Promise<RootIterator> | Promise used to return the **RootIterator** object obtained.| **Example** @@ -210,7 +210,9 @@ Obtains information about the device root nodes of the file management service t getRoots(callback:AsyncCallback<RootIterator>) : void; -Obtains information about the device root nodes of the file management service type connected to the **Helper** object. This API uses an asynchronous callback to return the result. The callback has a **RootIterator** object, which returns [RootInfo](#rootinfo) through [next()](#rootiteratornext). +Obtains information about the device root nodes of the file management service type connected to the **Helper** object. This API uses an asynchronous callback to return the result. + +The callback has a **RootIterator** object, which returns [RootInfo](#rootinfo) through [next()](#rootiteratornext). **System capability**: SystemCapability.FileManagement.UserFileService @@ -218,9 +220,9 @@ Obtains information about the device root nodes of the file management service t **Parameters** -| Name| Type| Mandatory| Description| -| --- | --- | --- | -- | -| callback | AsyncCallback<RootIterator> | Yes| Promise used to return the **RootIterator** object obtained.| + | Name| Type| Mandatory| Description| + | --- | --- | --- | -- | + | callback | AsyncCallback<RootIterator> | Yes| Promise used to return the **RootIterator** object obtained.| **Example** @@ -253,7 +255,7 @@ Obtains information about the device root nodes of the file management service t listFile(filter?: Filter) : FileIterator -Synchronously obtains the **FileIterator** object of the first-level files (file folder) matching the conditions of the filter from the device root node. The **FileIterator** object then returns [FileInfo](#fileinfo) by using [next()](#fileiteratornext). +Synchronously obtains the **FileIterator** object of the first-level files (directory) matching the conditions of the filter from the device root node. The **FileIterator** object then returns [FileInfo](#fileinfo) by using [next()](#fileiteratornext). **System capability**: SystemCapability.FileManagement.UserFileService @@ -261,16 +263,16 @@ Synchronously obtains the **FileIterator** object of the first-level files (file **Parameters** -| Name| Type| Mandatory| Description| -| --- | --- | -- | -- | -| filter | Filter | No| **Filter** object. | + | Name| Type| Mandatory| Description| + | --- | --- | -- | -- | + | filter | Filter | No| **Filter** object. | **Return value** -| Type| Description| -| --- | -- | -| FileIterator | **FileIterator** object obtained.| + | Type| Description| + | --- | -- | + | FileIterator | **FileIterator** object obtained.| **Example** @@ -312,15 +314,15 @@ Recursively obtains the **FileIterator** object of the files matching the condit **Parameters** -| Name| Type| Mandatory| Description| -| --- | --- | -- | -- | -| filter | Filter | No| **Filter** object. | + | Name| Type| Mandatory| Description| + | --- | --- | -- | -- | + | filter | Filter | No| **Filter** object. | **Return value** -| Type| Description| -| --- | -- | -| FileIterator | **FileIterator** object obtained.| + | Type| Description| + | --- | -- | + | FileIterator | **FileIterator** object obtained.| **Example** @@ -354,7 +356,7 @@ Recursively obtains the **FileIterator** object of the files matching the condit listFile(filter?: Filter) : FileIterator -Synchronously obtains the **FileIterator** object of the next-level files (file folders) matching the conditions of the filter from a directory. The **FileIterator** object then returns [FileInfo](#fileinfo) by using [next()](#fileiteratornext). +Synchronously obtains the **FileIterator** object of the next-level files (directories) matching the conditions of the filter from a directory. The **FileIterator** object then returns [FileInfo](#fileinfo) by using [next()](#fileiteratornext). **System capability**: SystemCapability.FileManagement.UserFileService @@ -362,15 +364,15 @@ Synchronously obtains the **FileIterator** object of the next-level files (file **Parameters** -| Name| Type| Mandatory| Description| -| --- | --- | -- | -- | -| filter | Filter | No| **Filter** object. | + | Name| Type| Mandatory| Description| + | --- | --- | -- | -- | + | filter | Filter | No| **Filter** object. | **Return value** -| Type| Description| -| --- | -- | -| FileIterator | **FileIterator** object obtained.| + | Type| Description| + | --- | -- | + | FileIterator | **FileIterator** object obtained.| **Example** @@ -412,16 +414,16 @@ Recursively obtains the **FileIterator** object of the files matching the condit **Parameters** -| Name| Type| Mandatory| Description| -| --- | --- | -- | -- | -| filter | Filter | No| **Filter** object. | + | Name| Type| Mandatory| Description| + | --- | --- | -- | -- | + | filter | Filter | No| **Filter** object. | **Return value** -| Type| Description| -| --- | -- | -| FileIterator | **FileIterator** object obtained.| + | Type| Description| + | --- | -- | + | FileIterator | **FileIterator** object obtained.| **Example** @@ -463,10 +465,10 @@ Creates a file in a directory. This API uses a promise to return the result. **Parameters** -| Name| Type| Mandatory| Description| -| --- | --- | --- | -- | -| uri | string | Yes| URI of the parent directory for the file to create.| -| displayName | string | Yes| Name of the file to create. By default, the name of a local file must contain the file name extension.| + | Name| Type| Mandatory| Description| + | --- | --- | --- | -- | + | uri | string | Yes| URI of the parent directory for the file to create.| + | displayName | string | Yes| Name of the file to create. By default, the name of a local file must contain the file name extension.| **Return value** @@ -508,11 +510,11 @@ Creates a file in a directory. This API uses an asynchronous callback to return **Parameters** -| Name| Type| Mandatory| Description| -| --- | --- | --- | -- | -| uri | string | Yes| URI of the parent directory for the file to create.| -| displayName | string | Yes| Name of the file to create. By default, the name of a local file must contain the file name extension.| -| callback | AsyncCallback<string> | Yes| Promise used to return the URI of the file created.| + | Name| Type| Mandatory| Description| + | --- | --- | --- | -- | + | uri | string | Yes| URI of the parent directory for the file to create.| + | displayName | string | Yes| Name of the file to create. By default, the name of a local file must contain the file name extension.| + | callback | AsyncCallback<string> | Yes| Promise used to return the URI of the file created.| **Example** @@ -540,7 +542,7 @@ Creates a file in a directory. This API uses an asynchronous callback to return mkDir(parentUri: string, displayName: string) : Promise<string> -Creates a folder in a directory. This API uses a promise to return the result. +Creates a directory. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.UserFileService @@ -548,16 +550,16 @@ Creates a folder in a directory. This API uses a promise to return the result. **Parameters** -| Name| Type| Mandatory| Description| -| --- | --- | --- | -- | -| parentUri | string | Yes| URI of the parent directory for the folder to create.| -| displayName | string | Yes| Name of the folder to create.| + | Name| Type| Mandatory| Description| + | --- | --- | --- | -- | + | parentUri | string | Yes| URI of the parent directory for the directory to create.| + | displayName | string | Yes| Name of the directory to create.| **Return value** | Type| Description| | --- | -- | -| Promise<string> | Promise used to return the URI of the folder created.| +| Promise<string> | Promise used to return the URI of the directory created.| **Example** @@ -585,7 +587,7 @@ Creates a folder in a directory. This API uses a promise to return the result. mkDir(parentUri: string, displayName: string, callback: AsyncCallback<string>) : void; -Creates a folder in a directory. This API uses an asynchronous callback to return the result. +Creates a directory. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.FileManagement.UserFileService @@ -593,11 +595,11 @@ Creates a folder in a directory. This API uses an asynchronous callback to retur **Parameters** -| Name| Type| Mandatory| Description| -| --- | --- | --- | -- | -| parentUri | string | Yes| URI of the parent directory for the folder to create.| -| displayName | string | Yes| Name of the folder to create.| -| callback | AsyncCallback<string> | Yes| Promise used to return the URI of the folder created.| + | Name| Type| Mandatory| Description| + | --- | --- | --- | -- | + | parentUri | string | Yes| URI of the parent directory for the directory to create.| + | displayName | string | Yes| Name of the directory to create.| + | callback | AsyncCallback<string> | Yes| Promise used to return the URI of the directory created.| **Example** @@ -633,10 +635,10 @@ Opens a file. This API uses a promise to return the result. **Parameters** -| Name| Type| Mandatory| Description| -| --- | --- | --- | -- | -| uri | string | Yes| URI of the file to open.| -| flags | [OPENFLAGS](#openflags) | Yes| File open mode.| + | Name| Type| Mandatory| Description| + | --- | --- | --- | -- | + | uri | string | Yes| URI of the file to open.| + | flags | [OPENFLAGS](#openflags) | Yes| File open mode.| **Return value** @@ -671,11 +673,11 @@ Opens a file. This API uses an asynchronous callback to return the result. **Parameters** -| Name| Type| Mandatory| Description| -| --- | --- | --- | -- | -| uri | string | Yes| URI of the file to open.| -| flags | [OPENFLAGS](#openflags) | Yes| File open mode.| -| callback | AsyncCallback<number> | Yes| Callback invoked to return the file descriptor of the file opened.| + | Name| Type| Mandatory| Description| + | --- | --- | --- | -- | + | uri | string | Yes| URI of the file to open.| + | flags | [OPENFLAGS](#openflags) | Yes| File open mode.| + | callback | AsyncCallback<number> | Yes| Callback invoked to return the file descriptor of the file opened.| **Example** @@ -702,7 +704,7 @@ Opens a file. This API uses an asynchronous callback to return the result. delete(uri: string) : Promise<number> -Deletes a file or folder. This API uses a promise to return the result. +Deletes a file or directory. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.UserFileService @@ -710,9 +712,9 @@ Deletes a file or folder. This API uses a promise to return the result. **Parameters** -| Name| Type| Mandatory| Description| -| --- | --- | --- | -- | -| uri | string | Yes| URI of the file or folder to delete.| + | Name| Type| Mandatory| Description| + | --- | --- | --- | -- | + | uri | string | Yes| URI of the file or directory to delete.| **Return value** @@ -741,7 +743,7 @@ Deletes a file or folder. This API uses a promise to return the result. delete(uri: string, callback: AsyncCallback<number>) : void; -Deletes a file or folder. This API uses an asynchronous callback to return the result. +Deletes a file or directory. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.FileManagement.UserFileService @@ -749,10 +751,10 @@ Deletes a file or folder. This API uses an asynchronous callback to return the r **Parameters** -| Name| Type| Mandatory| Description| -| --- | --- | --- | -- | -| uri | string | Yes| URI of the file or folder to delete.| -| callback | AsyncCallback<number> | Yes| Promise used to return the result.| + | Name| Type| Mandatory| Description| + | --- | --- | --- | -- | + | uri | string | Yes| URI of the file or directory to delete.| + | callback | AsyncCallback<number> | Yes| Promise used to return the result.| **Example** @@ -779,7 +781,7 @@ Deletes a file or folder. This API uses an asynchronous callback to return the r move(sourceFile: string, destFile: string) : Promise<string> -Moves a file or folder. This API uses a promise to return the result. +Moves a file or directory. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.UserFileService @@ -787,22 +789,22 @@ Moves a file or folder. This API uses a promise to return the result. **Parameters** -| Name| Type| Mandatory| Description| -| --- | --- | --- | -- | -| sourceFile | string | Yes| URI of the file or folder to move.| -| destFile | string | Yes| URI of the folder to which the file or folder will be moved.| + | Name| Type| Mandatory| Description| + | --- | --- | --- | -- | + | sourceFile | string | Yes| URI of the file or directory to move.| + | destFile | string | Yes| URI of the directory, to which the file or directory will be moved.| **Return value** | Type| Description| | ----- | ------ | -| Promise<string> | Promise used to return the URI of the file or folder in the destination directory.| +| Promise<string> | Promise used to return the URI of the file or directory in the destination directory.| **Example** ```js // The media library URI is used as an example. - //In the sample code, sourceFile destFile indicates the file or folder in the Download directory. The URI is the URI in fileInfo. + //In the sample code, sourceFile destFile indicates the file or directory in the Download directory. The URI is the URI in fileInfo. // You can use the URI obtained. let sourceFile = "datashare:///media/file/102"; let destFile = "datashare:///media/file/101"; @@ -819,7 +821,7 @@ Moves a file or folder. This API uses a promise to return the result. move(sourceFile: string, destFile: string, callback: AsyncCallback<string>) : void; -Moves a file or folder. This API uses an asynchronous callback to return the result. +Moves a file or directory. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.FileManagement.UserFileService @@ -827,17 +829,17 @@ Moves a file or folder. This API uses an asynchronous callback to return the res **Parameters** -| Name| Type| Mandatory| Description| -| --- | --- | --- | -- | -| sourceFile | string | Yes| URI of the file or folder to move.| -| destFile | string | Yes| URI of the folder to which the file or folder will be moved.| -| callback | AsyncCallback<string> | Yes| Promise used to return the URI of the file or folder in the destination directory.| + | Name| Type| Mandatory| Description| + | --- | --- | --- | -- | + | sourceFile | string | Yes| URI of the file or directory to move.| + | destFile | string | Yes| URI of the directory, to which the file or directory will be moved.| + | callback | AsyncCallback<string> | Yes| Promise used to return the URI of the file or directory in the destination directory.| **Example** ```js // The media library URI is used as an example. - //In the sample code, sourceFile destFile indicates the file or folder in the Download directory. The URI is the URI in fileInfo. + //In the sample code, sourceFile destFile indicates the file or directory in the Download directory. The URI is the URI in fileInfo. // You can use the URI obtained. let sourceFile = "datashare:///media/file/102"; let destFile = "datashare:///media/file/101"; @@ -859,7 +861,7 @@ Moves a file or folder. This API uses an asynchronous callback to return the res rename(uri: string, displayName: string) : Promise<string> -Renames a file or folder. This API uses a promise to return the result. +Renames a file or directory. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.UserFileService @@ -867,16 +869,16 @@ Renames a file or folder. This API uses a promise to return the result. **Parameters** -| Name| Type| Mandatory| Description| -| --- | --- | --- | -- | -| uri | string | Yes| URI of the file or folder to rename.| -| displayName | string | Yes| New name of the file or folder, which can contain the file name extension.| + | Name| Type| Mandatory| Description| + | --- | --- | --- | -- | + | uri | string | Yes| URI of the file or directory to rename.| + | displayName | string | Yes| New name of the file or directory, which can contain the file name extension.| **Return value** | Type| Description| | --- | -- | -| Promise<string> | Promise used to return the URI of the renamed file or folder.| +| Promise<string> | Promise used to return the URI of the renamed file or directory.| **Example** @@ -898,7 +900,7 @@ Renames a file or folder. This API uses a promise to return the result. rename(uri: string, displayName: string, callback: AsyncCallback<string>) : void; -Renames a file or folder. This API uses an asynchronous callback to return the result. +Renames a file or directory. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.FileManagement.UserFileService @@ -906,11 +908,11 @@ Renames a file or folder. This API uses an asynchronous callback to return the r **Parameters** -| Name| Type| Mandatory| Description| -| --- | --- | --- | -- | -| uri | string | Yes| URI of the file or folder to rename.| -| displayName | string | Yes| New name of the file or folder, which can contain the file name extension.| -| callback | AsyncCallback<string> | Yes| Promise used to return the URI of the renamed file or folder.| + | Name| Type| Mandatory| Description| + | --- | --- | --- | -- | + | uri | string | Yes| URI of the file or directory to rename.| + | displayName | string | Yes| New name of the file or directory, which can contain the file name extension.| + | callback | AsyncCallback<string> | Yes| Promise used to return the URI of the renamed file or directory.| **Example** @@ -937,7 +939,7 @@ Renames a file or folder. This API uses an asynchronous callback to return the r access(sourceFileUri: string) : Promise<boolean> -Checks whether a file or folder exists. This API uses a promise to return the result. +Checks whether a file or directory exists. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.UserFileService @@ -945,9 +947,9 @@ Checks whether a file or folder exists. This API uses a promise to return the re **Parameters** -| Name| Type| Mandatory| Description| -| --- | --- | --- | -- | -| sourceFileUri | string | Yes| URI of the file or folder.| + | Name| Type| Mandatory| Description| + | --- | --- | --- | -- | + | sourceFileUri | string | Yes| URI of the file or directory.| **Return value** @@ -978,7 +980,7 @@ Checks whether a file or folder exists. This API uses a promise to return the re access(sourceFileUri: string, callback: AsyncCallback<boolean>) : void; -Checks whether a file or folder exists. This API uses an asynchronous callback to return the result. +Checks whether a file or directory exists. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.FileManagement.UserFileService @@ -986,10 +988,10 @@ Checks whether a file or folder exists. This API uses an asynchronous callback t **Parameters** -| Name| Type| Mandatory| Description| -| --- | --- | --- | -- | -| sourceFileUri | string | Yes| URI of the file or folder.| -| callback | AsyncCallback<boolean> | Yes| Promise used to return the result.| + | Name| Type| Mandatory| Description| + | --- | --- | --- | -- | + | sourceFileUri | string | Yes| URI of the file or directory.| + | callback | AsyncCallback<boolean> | Yes| Promise used to return the result.| **Example** @@ -1029,13 +1031,13 @@ Obtains the next-level device root directory. **RootIterator** is an iterator ob | Type| Description| | --- | -- | -| {value: RootInfo, done: boolean} | Root directory information obtained. This API traverses the folder until **done** returns **true**. The **value** field contains the root directory information.| +| {value: RootInfo, done: boolean} | Root directory information obtained. This API traverses the directory until **done** returns **true**. The **value** field contains the root directory information.| ## FileIterator.next next( ) : { value: FileInfo, done: boolean } -Obtains the information about the next-level file or folder. **FileIterator** is an iterator object of a folder. +Obtains the information about the next-level file or directory. **FileIterator** is an iterator object of a directory. **System capability**: SystemCapability.FileManagement.UserFileService @@ -1045,7 +1047,7 @@ Obtains the information about the next-level file or folder. **FileIterator** is | Type| Description| | --- | -- | -| {value: FileInfo, done: boolean} | File or folder information obtained. This API traverses the specified folder until **done** returns **true**. The **value** field contains the file or folder information obtained.| +| {value: FileInfo, done: boolean} | File or directory information obtained. This API traverses the specified directory until **done** returns **true**. The **value** field contains the file or directory information obtained.| ## RootInfo @@ -1066,7 +1068,7 @@ Represents the root attribute information and interface capabilities of a device ## FileInfo -Represents the file or folder attribute information and interface capabilities. +Represents the file or directory attribute information and interface capabilities. **System capability**: SystemCapability.FileManagement.UserFileService @@ -1076,12 +1078,12 @@ Represents the file or folder attribute information and interface capabilities. | Name| Type | Readable| Writable| Description | | ------ | ------ | -------- | ------ | -------- | -| uri | string | Yes| No| URI of the file or folder.| -| fileName | string | Yes| No| Name of a file or folder.| -| mode | number | Yes| No| Permissions on the file or folder.| -| size | number | Yes| No| Size of the file or folder.| -| mtime | number | Yes| No| Time when the file or folder was last modified.| -| mimeType | string | Yes| No| MIME type of the file or folder.| +| uri | string | Yes| No| URI of the file or directory.| +| fileName | string | Yes| No| Name of a file or directory.| +| mode | number | Yes| No| Permissions on the file or directory.| +| size | number | Yes| No| Size of the file or directory.| +| mtime | number | Yes| No| Time when the file or directory was last modified.| +| mimeType | string | Yes| No| MIME type of the file or directory.| ## OPENFLAGS diff --git a/en/application-dev/reference/apis/js-apis-freeInstall.md b/en/application-dev/reference/apis/js-apis-freeInstall.md index 73d618e2f6eeed9df97b72dd4df8ba5839b1864c..937cc8437c21d80b54b241d746803e0aae9d4f18 100644 --- a/en/application-dev/reference/apis/js-apis-freeInstall.md +++ b/en/application-dev/reference/apis/js-apis-freeInstall.md @@ -267,7 +267,7 @@ Obtains **bundlePackInfo** based on **bundleName** and **bundlePackFlag**. This | -------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | bundleName | string | Yes | Bundle name. | | bundlePackFlag | [BundlePackFlag](#bundlepackflag) | Yes | Flag of the bundle package. | -| callback | AsyncCallback<[BundlePackInfo](js-apis-bundleManager-packInfo.md)> | Yes | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the **BundlePackInfo** object obtained; otherwise, **err** is an error object.| +| callback | AsyncCallback<[BundlePackInfo](js-apis-bundleManager-BundlePackInfo.md)> | Yes | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the **BundlePackInfo** object obtained; otherwise, **err** is an error object.| **Error codes** @@ -318,7 +318,7 @@ Obtains **bundlePackInfo** based on **bundleName** and **bundleFlag**. This API | Type | Description | | ---------------------------------------------------------- | ----------------------------------- | -| Promise<[BundlePackInfo](js-apis-bundleManager-packInfo.md)> | Promise used to return the **BundlePackInfo** object obtained.| +| Promise<[BundlePackInfo](js-apis-bundleManager-BundlePackInfo.md)> | Promise used to return the **BundlePackInfo** object obtained.| **Error codes** diff --git a/en/application-dev/reference/apis/js-apis-hashmap.md b/en/application-dev/reference/apis/js-apis-hashmap.md index d39dbd1e6649359d5e6433fe11b0a2d68febf953..807394ad4538e34997ac5b5eb917e47aad295161 100644 --- a/en/application-dev/reference/apis/js-apis-hashmap.md +++ b/en/application-dev/reference/apis/js-apis-hashmap.md @@ -1,8 +1,5 @@ # @ohos.util.HashMap (Nonlinear Container HashMap) -> **NOTE** -> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. - **HashMap** is a map implemented based on the array, linked list, and red-black tree. It provides efficient data query, insertion, and removal. The elements in a **HashMap** instance are mappings of key-value pairs. Each key must be unique and have only one value. **HashMap** is faster in accessing data than **[TreeMap](js-apis-treemap.md)**, because the former accesses the keys based on the hash codes, whereas the latter stores and accesses the keys in sorted order. @@ -15,6 +12,11 @@ This topic uses the following to identify the use of generics: - K: Key - V: Value +> **NOTE** +> +> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. + + ## Modules to Import ```ts @@ -482,7 +484,7 @@ let hashMap = new HashMap(); hashMap.set("sparrow", 123); hashMap.set("gull", 357); hashMap.forEach((value, key) => { - console.log("value:" + value, key); + console.log("value:" + value, "key:" + key); }); ``` diff --git a/en/application-dev/reference/apis/js-apis-hashset.md b/en/application-dev/reference/apis/js-apis-hashset.md index f2ece05248321395e2ca3f651ff32a462503d5c4..8d21ef6d1994144aeb89be8d226ef041bdbdb95a 100644 --- a/en/application-dev/reference/apis/js-apis-hashset.md +++ b/en/application-dev/reference/apis/js-apis-hashset.md @@ -305,7 +305,7 @@ let hashSet = new HashSet(); hashSet.add("sparrow"); hashSet.add("squirrel"); hashSet.forEach((value, key) => { - console.log("value:" + value, key); + console.log("value:" + value, "key:" + key); }); ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-ability-connectOptions.md b/en/application-dev/reference/apis/js-apis-inner-ability-connectOptions.md index db0814fa146e09114eeb4fa635dfa78564ee595e..126adb9256b7b2148c11c90e3301d1ada11c2fbc 100644 --- a/en/application-dev/reference/apis/js-apis-inner-ability-connectOptions.md +++ b/en/application-dev/reference/apis/js-apis-inner-ability-connectOptions.md @@ -1,6 +1,6 @@ # ConnectOptions -**ConnectOptions** can be used as an input parameter to receive status changes during the connection to a background service. For example, it is used as an input parameter of [connectServiceExtensionAbility](js-apis-inner-application-uiAbilityContext.md#uiabilitycontextconnectserviceextensionability) to connect to a ServiceExtensionAbility. +**ConnectOptions** can be used as an input parameter to receive status changes during the connection to a background service. For example, it is used as an input parameter of [connectServiceExtensionAbility](js-apis-inner-application-serviceExtensionContext.md#serviceextensioncontextconnectserviceextensionability) to connect to a ServiceExtensionAbility. **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -9,3 +9,26 @@ | onConnect7+ | function | Yes | Callback invoked when a connection is set up. | | onDisconnect7+ | function | Yes | Callback invoked when a connection is interrupted. | | onFailed7+ | function | Yes | Callback invoked when a connection fails.| + +**Example** + + ```ts + let want = { + bundleName: 'com.example.myapp', + abilityName: 'MyAbility' + }; + + let connectOptions = { + onConnect(elementName, remote) { + console.log('onConnect elementName: ' + elementName); + }, + onDisconnect(elementName) { + console.log('onDisconnect elementName: ' + elementName); + }, + onFailed(code) { + console.error('onFailed code: ' + code); + } + }; + + let connection = this.context.connectAbility(want, connectOptions); + ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-ability-dataAbilityHelper.md b/en/application-dev/reference/apis/js-apis-inner-ability-dataAbilityHelper.md index d6b0c51051feb92f30495bdc552f84cae5e06018..bed4cf0eeeb553d2e5674a53aa101f2cabef7c38 100644 --- a/en/application-dev/reference/apis/js-apis-inner-ability-dataAbilityHelper.md +++ b/en/application-dev/reference/apis/js-apis-inner-ability-dataAbilityHelper.md @@ -35,12 +35,12 @@ Opens a file with a specified URI. This API uses an asynchronous callback to ret ```ts import featureAbility from '@ohos.ability.featureAbility'; -var DAHelper = featureAbility.acquireDataAbilityHelper( - "dataability:///com.example.DataAbility" +let DAHelper = featureAbility.acquireDataAbilityHelper( + 'dataability:///com.example.DataAbility' ); -var mode = "rw"; -DAHelper.openFile("dataability:///com.example.DataAbility", mode, (err, data) => { - console.info("openFile err: " + JSON.stringify(err) + "data: " + JSON.stringify(data)); +let mode = 'rwt'; +DAHelper.openFile('dataability:///com.example.DataAbility', mode, (err) => { + console.info('==========================>Called=======================>'); }); ``` @@ -69,12 +69,12 @@ Opens a file with a specified URI. This API uses a promise to return a file desc ```ts import featureAbility from '@ohos.ability.featureAbility'; -var DAHelper = featureAbility.acquireDataAbilityHelper( - "dataability:///com.example.DataAbility" +let DAHelper = featureAbility.acquireDataAbilityHelper( + 'dataability:///com.example.DataAbility' ); -var mode = "rw"; -DAHelper.openFile("dataability:///com.example.DataAbility", mode).then((data) => { - console.info("openFile data: " + JSON.stringify(data)); +let mode = 'rwt'; +DAHelper.openFile('dataability:///com.example.DataAbility', mode).then((data) => { + console.info('==========================>openFileCallback=======================>'); }); ``` @@ -98,15 +98,15 @@ Registers an observer to listen for changes in the data specified by a given URI ```ts import featureAbility from '@ohos.ability.featureAbility'; -var DAHelper = featureAbility.acquireDataAbilityHelper( - "dataability:///com.example.DataAbility" +let helper = featureAbility.acquireDataAbilityHelper( + 'dataability:///com.example.DataAbility' ); function onChangeNotify() { - console.info("onChangeNotify call back"); + console.info('==========================>onChangeNotify=======================>'); }; -DAHelper.on( - "dataChange", - "dataability:///com.example.DataAbility", +helper.on( + 'dataChange', + 'dataability:///com.example.DataAbility', onChangeNotify ); ``` @@ -131,20 +131,20 @@ Deregisters the observer that listens for changes in the data specified by a giv ```ts import featureAbility from '@ohos.ability.featureAbility'; -var DAHelper = featureAbility.acquireDataAbilityHelper( - "dataability:///com.example.DataAbility" +let helper = featureAbility.acquireDataAbilityHelper( + 'dataability:///com.example.DataAbility' ); function onChangeNotify() { - console.info("onChangeNotify call back"); + console.info('==========================>onChangeNotify=======================>'); }; -DAHelper.off( - "dataChange", - "dataability:///com.example.DataAbility", - onChangeNotify +helper.off( + 'dataChange', + 'dataability:///com.example.DataAbility', ); -DAHelper.off( - "dataChange", - "dataability:///com.example.DataAbility", +helper.off( + 'dataChange', + 'dataability:///com.example.DataAbility', + onChangeNotify ); ``` @@ -167,11 +167,11 @@ Obtains the media resource type of the data specified by a given URI. This API u ```ts import featureAbility from '@ohos.ability.featureAbility'; -var DAHelper = featureAbility.acquireDataAbilityHelper( - "dataability:///com.example.DataAbility" +let DAHelper = featureAbility.acquireDataAbilityHelper( + 'dataability:///com.example.DataAbility' ); -DAHelper.getType("dataability:///com.example.DataAbility", (err, data) => { - console.info("getType err: " + JSON.stringify(err) + "data: " + JSON.stringify(data)); +DAHelper.getType('dataability:///com.example.DataAbility', (err, data) => { + console.info('==========================>Called=======================>'); }); ``` @@ -199,11 +199,11 @@ Obtains the media resource type of the data specified by a given URI. This API u ```ts import featureAbility from '@ohos.ability.featureAbility'; -var DAHelper = featureAbility.acquireDataAbilityHelper( - "dataability:///com.example.DataAbility" +let DAHelper = featureAbility.acquireDataAbilityHelper( + 'dataability:///com.example.DataAbility' ); -DAHelper.getType("dataability:///com.example.DataAbility").then((data) => { - console.info("getType data: " + JSON.stringify(data)); +DAHelper.getType('dataability:///com.example.DataAbility').then((data) => { + console.info('==========================>getTypeCallback=======================>'); }); ``` @@ -227,14 +227,17 @@ Obtains the supported media resource types of a specified file. This API uses an ```ts import featureAbility from '@ohos.ability.featureAbility'; -var DAHelper = featureAbility.acquireDataAbilityHelper( - "dataability:///com.example.DataAbility" +let DAHelper = featureAbility.acquireDataAbilityHelper( + 'dataability:///com.example.DataAbility' ); -DAHelper.getFileTypes( "dataability:///com.example.DataAbility", "image/*", (err, data) => { - console.info("getFileTypes err: " + JSON.stringify(err) + "data: " + JSON.stringify(data)); +DAHelper.getFileTypes( 'dataability:///com.example.DataAbility', + 'image/*', (err, data) => { + console.info('==========================>Called=======================>'); }); ``` + + ## DataAbilityHelper.getFileTypes getFileTypes(uri: string, mimeTypeFilter: string): Promise\> @@ -260,11 +263,12 @@ Obtains the supported media resource types of a specified file. This API uses a ```ts import featureAbility from '@ohos.ability.featureAbility'; -var DAHelper = featureAbility.acquireDataAbilityHelper( - "dataability:///com.example.DataAbility" +let DAHelper = featureAbility.acquireDataAbilityHelper( + 'dataability:///com.example.DataAbility' ); -DAHelper.getFileTypes("dataability:///com.example.DataAbility", "image/*").then((data) => { - console.info("getFileTypes data: " + JSON.stringify(data)); +DAHelper.getFileTypes('dataability:///com.example.DataAbility', + 'image/*').then((data) => { + console.info('===================>getFileTypesCallback================>'); }); ``` @@ -287,11 +291,11 @@ Converts the URI that refers to a Data ability into a normalized URI. This API u ```ts import featureAbility from '@ohos.ability.featureAbility'; -var DAHelper = featureAbility.acquireDataAbilityHelper( - "dataability:///com.example.DataAbility" +let DAHelper = featureAbility.acquireDataAbilityHelper( + 'dataability:///com.example.DataAbility' ); -DAHelper.normalizeUri("dataability:///com.example.DataAbility", (err, data) => { - console.info("normalizeUri err: " + JSON.stringify(err) + "data: " + JSON.stringify(data)); +DAHelper.normalizeUri('dataability:///com.example.DataAbility', (err, data) => { + console.info('==========================>Called=======================>'); }); ``` @@ -319,11 +323,11 @@ Converts the URI that refers to a Data ability into a normalized URI. This API u ```ts import featureAbility from '@ohos.ability.featureAbility'; -var DAHelper = featureAbility.acquireDataAbilityHelper( - "dataability:///com.example.DataAbility" +let DAHelper = featureAbility.acquireDataAbilityHelper( + 'dataability:///com.example.DataAbility' ); -DAHelper.normalizeUri("dataability:///com.example.DataAbility",).then((data) => { - console.info("normalizeUri data: " + JSON.stringify(data)); +DAHelper.normalizeUri('dataability:///com.example.DataAbility',).then((data) => { + console.info('=================>normalizeUriCallback=======================>'); }); ``` @@ -346,14 +350,16 @@ Converts a normalized URI generated by **DataAbilityHelper.normalizeUri(uri: str ```ts import featureAbility from '@ohos.ability.featureAbility'; -var DAHelper = featureAbility.acquireDataAbilityHelper( - "dataability:///com.example.DataAbility" +let DAHelper = featureAbility.acquireDataAbilityHelper( + 'dataability:///com.example.DataAbility' ); -DAHelper.denormalizeUri("dataability:///com.example.DataAbility", (err, data) => { - console.info("denormalizeUri err: " + JSON.stringify(err) + "data: " + JSON.stringify(data)); +DAHelper.denormalizeUri('dataability:///com.example.DataAbility', (err, data) => { + console.info('==========================>Called=======================>'); }); ``` + + ## DataAbilityHelper.denormalizeUri denormalizeUri(uri: string): Promise\ @@ -378,11 +384,11 @@ Converts a normalized URI generated by **DataAbilityHelper.normalizeUri(uri: str ```ts import featureAbility from '@ohos.ability.featureAbility'; -var DAHelper = featureAbility.acquireDataAbilityHelper( - "dataability:///com.example.DataAbility" +let DAHelper = featureAbility.acquireDataAbilityHelper( + 'dataability:///com.example.DataAbility' ); -DAHelper.denormalizeUri("dataability:///com.example.DataAbility",).then((data) => { - console.info("denormalizeUri data: " + JSON.stringify(data)); +DAHelper.denormalizeUri('dataability:///com.example.DataAbility',).then((data) => { + console.info('===============>denormalizeUriCallback=======================>'); }); ``` @@ -405,11 +411,11 @@ Notifies the registered observer of a change to the data specified by the URI. T ```ts import featureAbility from '@ohos.ability.featureAbility'; -var DAHelper = featureAbility.acquireDataAbilityHelper( - "dataability:///com.example.DataAbility" +let helper = featureAbility.acquireDataAbilityHelper( + 'dataability:///com.example.DataAbility' ); -DAHelper.notifyChange("dataability:///com.example.DataAbility", (err) => { - console.info("==========================>Called=======================>"); +helper.notifyChange('dataability:///com.example.DataAbility', (err) => { + console.info('==========================>Called=======================>'); }); ``` @@ -437,11 +443,11 @@ Notifies the registered observer of a change to the data specified by the URI. T ```ts import featureAbility from '@ohos.ability.featureAbility'; -var DAHelper = featureAbility.acquireDataAbilityHelper( - "dataability:///com.example.DataAbility" +let DAHelper = featureAbility.acquireDataAbilityHelper( + 'dataability:///com.example.DataAbility' ); -DAHelper.notifyChange("dataability:///com.example.DataAbility").then(() => { - console.info("================>notifyChangeCallback================>"); +DAHelper.notifyChange('dataability:///com.example.DataAbility').then(() => { + console.info('================>notifyChangeCallback================>'); }); ``` @@ -465,17 +471,18 @@ Inserts a single data record into the database. This API uses an asynchronous ca ```ts import featureAbility from '@ohos.ability.featureAbility'; -var DAHelper = featureAbility.acquireDataAbilityHelper( - "dataability:///com.example.DataAbility" +let DAHelper = featureAbility.acquireDataAbilityHelper( + 'dataability:///com.example.DataAbility' ); const valueBucket = { - "name": "rose", - "age": 22, - "salary": 200.5, - "blobType": "u8", + 'name': 'rose', + 'age': 22, + 'salary': 200.5, + 'blobType': 'u8', }; -DAHelper.insert("dataability:///com.example.DataAbility", valueBucket, (err, data) => { - console.info("insert err: " + JSON.stringify(err) + "data: " + JSON.stringify(data)); +DAHelper.insert('dataability:///com.example.DataAbility', valueBucket, + (err, data) => { + console.info('==========================>Called=======================>'); }); ``` @@ -504,17 +511,17 @@ Inserts a single data record into the database. This API uses a promise to retur ```ts import featureAbility from '@ohos.ability.featureAbility'; -var DAHelper = featureAbility.acquireDataAbilityHelper( - "dataability:///com.example.DataAbility" +let DAHelper = featureAbility.acquireDataAbilityHelper( + 'dataability:///com.example.DataAbility' ); const valueBucket = { - "name": "rose1", - "age": 221, - "salary": 20.5, - "blobType": "u8", + 'name': 'rose1', + 'age': 221, + 'salary': 20.5, + 'blobType': 'u8', }; -DAHelper.insert("dataability:///com.example.DataAbility", valueBucket).then((data) => { - console.info("insert data: " + JSON.stringify(data)); +DAHelper.insert('dataability:///com.example.DataAbility', valueBucket).then((data) => { + console.info('====================>insertCallback=======================>'); }); ``` @@ -538,14 +545,15 @@ Inserts multiple data records into the database. This API uses an asynchronous c ```ts import featureAbility from '@ohos.ability.featureAbility'; -var DAHelper = featureAbility.acquireDataAbilityHelper( - "dataability:///com.example.DataAbility" +let DAHelper = featureAbility.acquireDataAbilityHelper( + 'dataability:///com.example.DataAbility' ); -var cars = new Array({"name": "roe11", "age": 21, "salary": 20.5, "blobType": "u8",}, - {"name": "roe12", "age": 21, "salary": 20.5, "blobType": "u8",}, - {"name": "roe13", "age": 21, "salary": 20.5, "blobType": "u8",}); -DAHelper.batchInsert("dataability:///com.example.DataAbility", cars, (err, data) => { - console.info("batchInsert err: " + JSON.stringify(err) + "data: " + JSON.stringify(data)); +let cars = new Array({'name': 'roe11', 'age': 21, 'salary': 20.5, 'blobType': 'u8',}, + {'name': 'roe12', 'age': 21, 'salary': 20.5, 'blobType': 'u8',}, + {'name': 'roe13', 'age': 21, 'salary': 20.5, 'blobType': 'u8',}); +DAHelper.batchInsert('dataability:///com.example.DataAbility', cars, + (err, data) => { + console.info('==========================>Called=======================>'); }); ``` @@ -574,14 +582,14 @@ Inserts multiple data records into the database. This API uses a promise to retu ```ts import featureAbility from '@ohos.ability.featureAbility'; -var DAHelper = featureAbility.acquireDataAbilityHelper( - "dataability:///com.example.DataAbility" +let DAHelper = featureAbility.acquireDataAbilityHelper( + 'dataability:///com.example.DataAbility' ); -var cars = new Array({"name": "roe11", "age": 21, "salary": 20.5, "blobType": "u8",}, - {"name": "roe12", "age": 21, "salary": 20.5, "blobType": "u8",}, - {"name": "roe13", "age": 21, "salary": 20.5, "blobType": "u8",}); -DAHelper.batchInsert("dataability:///com.example.DataAbility", cars).then((data) => { - console.info("batchInsert data: " + JSON.stringify(data)); +let cars = new Array({'name': 'roe11', 'age': 21, 'salary': 20.5, 'blobType': 'u8',}, + {'name': 'roe12', 'age': 21, 'salary': 20.5, 'blobType': 'u8',}, + {'name': 'roe13', 'age': 21, 'salary': 20.5, 'blobType': 'u8',}); +DAHelper.batchInsert('dataability:///com.example.DataAbility', cars).then((data) => { + console.info('==================>batchInsertCallback=======================>'); }); ``` @@ -606,12 +614,13 @@ Deletes one or more data records from the database. This API uses an asynchronou ```ts import featureAbility from '@ohos.ability.featureAbility'; import ohos_data_ability from '@ohos.data.dataAbility'; -var DAHelper = featureAbility.acquireDataAbilityHelper( - "dataability:///com.example.DataAbility" +let DAHelper = featureAbility.acquireDataAbilityHelper( + 'dataability:///com.example.DataAbility' ); let da = new ohos_data_ability.DataAbilityPredicates(); -DAHelper.delete("dataability:///com.example.DataAbility", da, (err, data) => { - console.info("delete err: " + JSON.stringify(err) + "data: " + JSON.stringify(data)); +DAHelper.delete('dataability:///com.example.DataAbility', da, + (err, data) => { + console.info('==========================>Called=======================>'); }); ``` @@ -641,12 +650,12 @@ Deletes one or more data records from the database. This API uses a promise to r ```ts import featureAbility from '@ohos.ability.featureAbility'; import ohos_data_ability from '@ohos.data.dataAbility'; -var DAHelper = featureAbility.acquireDataAbilityHelper( - "dataability:///com.example.DataAbility" +let DAHelper = featureAbility.acquireDataAbilityHelper( + 'dataability:///com.example.DataAbility' ); let da = new ohos_data_ability.DataAbilityPredicates(); -DAHelper.delete("dataability:///com.example.DataAbility", da).then((data) => { - console.info("delete data: " + JSON.stringify(data)); +DAHelper.delete('dataability:///com.example.DataAbility', da).then((data) => { + console.info('==========================>deleteCallback=======================>'); }); ``` @@ -672,18 +681,18 @@ Updates data records in the database. This API uses an asynchronous callback to ```ts import featureAbility from '@ohos.ability.featureAbility'; import ohos_data_ability from '@ohos.data.dataAbility'; -var DAHelper = featureAbility.acquireDataAbilityHelper( - "dataability:///com.example.DataAbility" +let DAHelper = featureAbility.acquireDataAbilityHelper( + 'dataability:///com.example.DataAbility' ); const va = { - "name": "roe1", - "age": 21, - "salary": 20.5, - "blobType": "u8", + 'name': 'roe1', + 'age': 21, + 'salary': 20.5, + 'blobType': 'u8', }; let da = new ohos_data_ability.DataAbilityPredicates(); -DAHelper.update("dataability:///com.example.DataAbility", va, da, (err, data) => { - console.info("update err: " + JSON.stringify(err) + "data: " + JSON.stringify(data)); +DAHelper.update('dataability:///com.example.DataAbility', va, da, (err, data) => { + console.info('==========================>Called=======================>'); }); ``` @@ -714,18 +723,18 @@ Updates data records in the database. This API uses a promise to return the resu ```ts import featureAbility from '@ohos.ability.featureAbility'; import ohos_data_ability from '@ohos.data.dataAbility'; -var DAHelper = featureAbility.acquireDataAbilityHelper( - "dataability:///com.example.DataAbility" +let DAHelper = featureAbility.acquireDataAbilityHelper( + 'dataability:///com.example.DataAbility' ); const va = { - "name": "roe1", - "age": 21, - "salary": 20.5, - "blobType": "u8", + 'name': 'roe1', + 'age': 21, + 'salary': 20.5, + 'blobType': 'u8', }; let da = new ohos_data_ability.DataAbilityPredicates(); -DAHelper.update("dataability:///com.example.DataAbility", va, da).then((data) => { - console.info("update data: " + JSON.stringify(data)); +DAHelper.update('dataability:///com.example.DataAbility', va, da).then((data) => { + console.info('==========================>updateCallback=======================>'); }); ``` @@ -751,13 +760,13 @@ Queries data in the database. This API uses an asynchronous callback to return t ```ts import featureAbility from '@ohos.ability.featureAbility'; import ohos_data_ability from '@ohos.data.dataAbility'; -var DAHelper = featureAbility.acquireDataAbilityHelper( - "dataability:///com.example.DataAbility" +let DAHelper = featureAbility.acquireDataAbilityHelper( + 'dataability:///com.example.DataAbility' ); -var cars=new Array("value1", "value2", "value3", "value4"); +let cars=new Array('value1', 'value2', 'value3', 'value4'); let da = new ohos_data_ability.DataAbilityPredicates(); -DAHelper.query("dataability:///com.example.DataAbility", cars, da, (err, data) => { - console.info("query err: " + JSON.stringify(err) + "data: " + JSON.stringify(data)); +DAHelper.query('dataability:///com.example.DataAbility', cars, da, (err, data) => { + console.info('==========================>Called=======================>'); }); ``` @@ -790,21 +799,21 @@ Queries data in the database. This API uses a promise to return the result. ```ts import featureAbility from '@ohos.ability.featureAbility'; import ohos_data_ability from '@ohos.data.dataAbility'; -var DAHelper = featureAbility.acquireDataAbilityHelper( - "dataability:///com.example.DataAbility" +let DAHelper = featureAbility.acquireDataAbilityHelper( + 'dataability:///com.example.DataAbility' ); -var cars = new Array("value1", "value2", "value3", "value4"); +let cars = new Array('value1', 'value2', 'value3', 'value4'); let da = new ohos_data_ability.DataAbilityPredicates(); -DAHelper.query("dataability:///com.example.DataAbility", cars, da).then((data) => { - console.info("query data: " + JSON.stringify(data)); +DAHelper.query('dataability:///com.example.DataAbility', cars, da).then((data) => { + console.info('==========================>queryCallback=======================>'); }); ``` ## DataAbilityHelper.call -call(uri: string, method: string, arg: string, extras: PacMap, callback: AsyncCallback\): void +call(uri: string, method: string, arg: string, extras: PacMap): Promise\ -Calls an extended API of the DataAbility. This API uses an asynchronous callback to return the result. +Calls an extended API of the DataAbility. This API uses a promise to return the result. **System capability**: SystemCapability.Ability.AbilityRuntime.FAModel @@ -812,11 +821,16 @@ Calls an extended API of the DataAbility. This API uses an asynchronous callback | Name | Type | Mandatory| Description | | ---------- | --------------------------------- | ---- | ------------------------------------------------ | -| uri | string | Yes | URI of the DataAbility. Example: "dataability:///com.example.xxx.xxxx". | +| uri | string | Yes | URI of the DataAbility. Example: 'dataability:///com.example.xxx.xxxx'. | | method | string | Yes | Name of the API to call. | | arg | string | Yes | Parameter to pass in. | | extras | [PacMap](#pacmap) | Yes | Key-value pair parameter. | -| callback | AsyncCallback\<[PacMap](#pacmap)> | Yes| Callback used to return the result. | + +**Return value** + +| Type| Description| +|------ | ------- | +|Promise\<[PacMap](#pacmap)> | Promise used to return the result.| **Example** @@ -824,23 +838,20 @@ Calls an extended API of the DataAbility. This API uses an asynchronous callback import featureAbility from '@ohos.ability.featureAbility'; let dataAbilityHelper = featureAbility.acquireDataAbilityHelper( - "dataability:///com.example.jsapidemo.UserDataAbility" -); -dataAbilityHelper.call("dataability:///com.example.jsapidemo.UserDataAbility", - "method", "arg", {"key1":"value1"}, (err, data) => { - if (err) { - console.error('Operation failed. Cause: ' + err); - return; - } + 'dataability:///com.example.jsapidemo.UserDataAbility'); +dataAbilityHelper.call('dataability:///com.example.jsapidemo.UserDataAbility', + 'method', 'arg', {'key1':'value1'}).then((data) => { console.info('Operation succeeded: ' + data); +}).catch((error) => { + console.error('Operation failed. Cause: ' + error); }); ``` ## DataAbilityHelper.call -call(uri: string, method: string, arg: string, extras: PacMap): Promise\ +call(uri: string, method: string, arg: string, extras: PacMap, callback: AsyncCallback\): void -Calls an extended API of the DataAbility. This API uses a promise to return the result. +Calls an extended API of the DataAbility. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Ability.AbilityRuntime.FAModel @@ -848,16 +859,11 @@ Calls an extended API of the DataAbility. This API uses a promise to return the | Name | Type | Mandatory| Description | | ---------- | --------------------------------- | ---- | ------------------------------------------------ | -| uri | string | Yes | URI of the DataAbility. Example: "dataability:///com.example.xxx.xxxx". | +| uri | string | Yes | URI of the DataAbility. Example: 'dataability:///com.example.xxx.xxxx'. | | method | string | Yes | Name of the API to call. | | arg | string | Yes | Parameter to pass in. | | extras | [PacMap](#pacmap) | Yes | Key-value pair parameter. | - -**Return value** - -| Type| Description| -|------ | ------- | -|Promise\<[PacMap](#pacmap)> | Promise used to return the result.| +| callback | AsyncCallback\<[PacMap](#pacmap)> | Yes | Callback used to return the result. | **Example** @@ -865,13 +871,14 @@ Calls an extended API of the DataAbility. This API uses a promise to return the import featureAbility from '@ohos.ability.featureAbility'; let dataAbilityHelper = featureAbility.acquireDataAbilityHelper( - "dataability:///com.example.jsapidemo.UserDataAbility" -); -dataAbilityHelper.call("dataability:///com.example.jsapidemo.UserDataAbility", - "method", "arg", {"key1":"value1"}).then((data) => { + 'dataability:///com.example.jsapidemo.UserDataAbility'); +dataAbilityHelper.call('dataability:///com.example.jsapidemo.UserDataAbility', + 'method', 'arg', {'key1':'value1'}, (err, data) => { + if (err) { + console.error('Operation failed. Cause: ' + err); + return; + } console.info('Operation succeeded: ' + data); -}).catch((error) => { - console.error('Operation failed. Cause: ' + error); }); ``` @@ -887,7 +894,7 @@ Operates data in the database in batches. This API uses an asynchronous callback | Name | Type | Mandatory| Description | | ----------| ---------------------------------| ---- | ------------------------------------------------ | -| uri | string | Yes | URI of the DataAbility. Example: "dataability:///com.example.xxx.xxxx".| +| uri | string | Yes | URI of the DataAbility. Example: 'dataability:///com.example.xxx.xxxx'.| | operations | Array\<[DataAbilityOperation](js-apis-inner-ability-dataAbilityOperation.md)> | Yes | An array holding the data operations on the database. | | callback | AsyncCallback\> | Yes | Callback used to return the result of each operation in the **DataAbilityResult** array. | @@ -899,9 +906,9 @@ import featureAbility from '@ohos.ability.featureAbility'; // Select the operations to be performed on the database according to the DataAbilityOperation array. let op=new Array(); let dataAbilityHelper = featureAbility.acquireDataAbilityHelper( - "dataability:///com.example.jsapidemo.UserDataAbility" -); -dataAbilityHelper.executeBatch("dataability:///com.example.jsapidemo.UserDataAbility", op, (err, data) => { + 'dataability:///com.example.jsapidemo.UserDataAbility'); +dataAbilityHelper.executeBatch('dataability:///com.example.jsapidemo.UserDataAbility', + op, (err, data) => { if (err) { console.error('Operation failed. Cause: ' + err); return; @@ -922,7 +929,7 @@ Operates data in the database in batches. This API uses a promise to return the | Name | Type | Mandatory| Description | | ---------- | -------------------------------| ---- | ------------------------------------------------ | -| uri | string | Yes | URI of the DataAbility. Example: "dataability:///com.example.xxx.xxxx".| +| uri | string | Yes | URI of the DataAbility. Example: 'dataability:///com.example.xxx.xxxx'.| | operations | Array\<[DataAbilityOperation](js-apis-inner-ability-dataAbilityOperation.md)> | Yes | An array holding the data operations on the database. | **Return value** @@ -939,9 +946,9 @@ import featureAbility from '@ohos.ability.featureAbility'; // Select the operations to be performed on the database according to the DataAbilityOperation array. let op=new Array(); let dataAbilityHelper = featureAbility.acquireDataAbilityHelper( - "dataability:///com.example.jsapidemo.UserDataAbility" -); -dataAbilityHelper.executeBatch("dataability:///com.example.jsapidemo.UserDataAbility", op).then((data) => { + 'dataability:///com.example.jsapidemo.UserDataAbility'); +dataAbilityHelper.executeBatch('dataability:///com.example.jsapidemo.UserDataAbility', + op).then((data) => { console.info('Operation succeeded: ' + data); }).catch((error) => { console.error('Operation failed. Cause: ' + error); diff --git a/en/application-dev/reference/apis/js-apis-inner-ability-dataAbilityResult.md b/en/application-dev/reference/apis/js-apis-inner-ability-dataAbilityResult.md index 49b14bebedfaa76b495e8a127e3f4bd243c649b7..7f06d6f4a058efdf1be198126d5c9ef7f5e6f453 100644 --- a/en/application-dev/reference/apis/js-apis-inner-ability-dataAbilityResult.md +++ b/en/application-dev/reference/apis/js-apis-inner-ability-dataAbilityResult.md @@ -11,67 +11,64 @@ The **DataAbilityResult** module defines the operation result on DataAbilities. | Name | Type | Mandatory | Description | | -------- | -------- | -------- | -------- | -| uri? | string | No | URI of the DataAbility. Example: "dataability:///com.example.xxx.xxxx". | +| uri? | string | No | URI of the DataAbility. Example: 'dataability:///com.example.xxx.xxxx'. | | count? | number | No | Number of rows affected by the operation. | **Example** ```ts -import featureAbility from '@ohos.ability.featureAbility' +import featureAbility from '@ohos.ability.featureAbility'; -// Perform database operations in batches. -function executeBatchOperation() { - let dataAbilityUri = ("dataability:///com.example.myapplication.TestDataAbility"); - let DAHelper; - try { - DAHelper = featureAbility.acquireDataAbilityHelper(dataAbilityUri); - if (DAHelper == null) { - console.error('DAHelper is null'); - return; - } - } catch (err) { - console.error('acquireDataAbilityHelper fail, error:' + JSON.stringify(err)); +let dataAbilityUri = ('dataability:///com.example.myapplication.TestDataAbility'); +let DAHelper; +try { + DAHelper = featureAbility.acquireDataAbilityHelper(dataAbilityUri); + if (DAHelper == null) { + console.error('DAHelper is null'); return; } +} catch (err) { + console.error('acquireDataAbilityHelper fail, error:' + JSON.stringify(err)); + return; +} - let valueBucket = { - "name": "DataAbilityHelperTest", - "age": 24, - "salary": 2024.20, - }; - let operations = [ - { - uri: dataAbilityUri, - type: featureAbility.DataAbilityOperationType.TYPE_INSERT, - valuesBucket: valueBucket, - predicates: null, - expectedCount: 1, - PredicatesBackReferences: {}, - interrupted: true, - }, - { - uri: dataAbilityUri, - type: featureAbility.DataAbilityOperationType.TYPE_INSERT, - valuesBucket: valueBucket, - predicates: null, - expectedCount: 1, - PredicatesBackReferences: {}, - interrupted: true, - } - ]; +let valueBucket = { + 'name': 'DataAbilityHelperTest', + 'age': 24, + 'salary': 2024.20, +}; +let operations = [ +{ + uri: dataAbilityUri, + type: featureAbility.DataAbilityOperationType.TYPE_INSERT, + valuesBucket: valueBucket, + predicates: null, + expectedCount: 1, + PredicatesBackReferences: {}, + interrupted: true, +}, +{ + uri: dataAbilityUri, + type: featureAbility.DataAbilityOperationType.TYPE_INSERT, + valuesBucket: valueBucket, + predicates: null, + expectedCount: 1, + PredicatesBackReferences: {}, + interrupted: true, +} +]; - try { - DAHelper.executeBatch(dataAbilityUri, operations).then((data) => { - for (let i = 0; i < data.length; i++) { - let dataAbilityResult = data[i]; - console.log('dataAbilityResult.uri: ' + dataAbilityResult.uri); - console.log('dataAbilityResult.count: ' + dataAbilityResult.count); - } - }).catch(err => { - console.error('executeBatch error: ' + JSON.stringify(err)); - }); - } catch (err) { +try { + let promise = DAHelper.executeBatch(dataAbilityUri, operations).then((data) => { + for (let i = 0; i < data.length; i++) { + let dataAbilityResult = data[i]; + console.log('dataAbilityResult.uri: ' + dataAbilityResult.uri); + console.log('dataAbilityResult.count: ' + dataAbilityResult.count); + } + }).catch(err => { console.error('executeBatch error: ' + JSON.stringify(err)); - } + }); +} catch (err) { + console.error('executeBatch error: ' + JSON.stringify(err)); } ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-ability-startAbilityParameter.md b/en/application-dev/reference/apis/js-apis-inner-ability-startAbilityParameter.md index 71b8d529703d28e01072d8f18f92ebe30b82c556..b9101bf4c71f419096bf9031ab243824190dac66 100644 --- a/en/application-dev/reference/apis/js-apis-inner-ability-startAbilityParameter.md +++ b/en/application-dev/reference/apis/js-apis-inner-ability-startAbilityParameter.md @@ -16,31 +16,29 @@ The **StartAbilityParameter** module defines the parameters for starting an abil **Example** ```ts -import featureAbility from '@ohos.ability.featureAbility' +import featureAbility from '@ohos.ability.featureAbility'; let Want = { - bundleName: "com.example.abilityStartSettingApp2", - abilityName: "com.example.abilityStartSettingApp.EntryAbility", -} + bundleName: 'com.example.abilityStartSettingApp2', + abilityName: 'com.example.abilityStartSettingApp.MainAbility', +}; let abilityStartSetting ={ [featureAbility.AbilityStartSetting.BOUNDS_KEY] : [100,200,300,400], [featureAbility.AbilityStartSetting.WINDOW_MODE_KEY] : featureAbility.AbilityWindowConfiguration.WINDOW_MODE_UNDEFINED, [featureAbility.AbilityStartSetting.DISPLAY_ID_KEY] : 1, -} +}; let startAbilityParameter = { want : Want, abilityStartSetting : abilityStartSetting -} +}; -try { - featureAbility.startAbility(startAbilityParameter, (err, data) => { - console.log('errCode : ' + JSON.stringify(err)); - console.log('data : ' + JSON.stringify(data)); - }); +featureAbility.startAbility(startAbilityParameter, (err, data)=>{ + console.log('errCode : ' + JSON.stringify(err)); + console.log('data : ' + JSON.stringify(data)); } catch(error) { - console.log("startAbility error: " + JSON.stringify(error)); + console.log('startAbility error: ' + JSON.stringify(error)); } ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-ability-want.md b/en/application-dev/reference/apis/js-apis-inner-ability-want.md index afb331b3fc2cb610025dd741e94abe0392fe4a5b..10cb9e144dacdee13674168aad28eadabc63f635 100644 --- a/en/application-dev/reference/apis/js-apis-inner-ability-want.md +++ b/en/application-dev/reference/apis/js-apis-inner-ability-want.md @@ -4,21 +4,21 @@ Want is a carrier for information transfer between objects (application componen > **NOTE** > -> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> The APIs of this module are supported since API version 6 and deprecated since API version 9. You are advised to use [@ohos.app.ability.Want](js-apis-app-ability-want.md) instead. Newly added APIs will be marked with a superscript to indicate their earliest API version. **System capability**: SystemCapability.Ability.AbilityBase | Name | Type | Mandatory| Description | | ----------- | -------------------- | ---- | ------------------------------------------------------------ | -| deviceId | string | No | ID of the device running the ability. If this field is unspecified, the local device is used. | -| bundleName | string | No | Bundle name.| +| deviceId | string | No | ID of the device running the ability. | +| bundleName | string | No | Bundle name. If both **bundleName** and **abilityName** are specified in a **Want**, the **Want** can directly match the specified ability.| | abilityName | string | No | Name of the ability. If both **bundleName** and **abilityName** are specified in a **Want** object, the **Want** object can match a specific ability. The value of **abilityName** must be unique in an application.| | uri | string | No | URI. If **uri** is specified in a **Want** object, the **Want** object will match the specified URI information, including **scheme**, **schemeSpecificPart**, **authority**, and **path**.| -| type | string | No | MIME type, that is, the type of the file to open, for example, **text/xml** and **image/***. For details about the MIME type definition, see https://www.iana.org/assignments/media-types/media-types.xhtml?utm_source=ld246.com. | +| type | string | No | MIME type, that is, the type of the file to open, for example, **'text/xml'** and **'image/*'**. For details about the MIME type definition, see https://www.iana.org/assignments/media-types/media-types.xhtml?utm_source=ld246.com. | | flags | number | No | How the **Want** object will be handled. By default, numbers are passed in. For details, see [flags](js-apis-ability-wantConstant.md#wantconstantflags). | -| action | string | No | Action to take, such as viewing and sharing application details. In implicit Want, you can define this field and use it together with **uri** or **parameters** to specify the operation to be performed on the data. For details, see [action](js-apis-app-ability-wantConstant.md#wantconstantaction). For details about the definition and matching rules of implicit Want, see [Matching Rules of Explicit Want and Implicit Want](../../application-models/explicit-implicit-want-mappings.md). | -| parameters | {[key: string]: any} | No | Want parameters in the form of custom key-value (KV) pairs. By default, the following keys are carried:
**ohos.aafwk.callerPid**: PID of the caller.
**ohos.aafwk.param.callerToken**: token of the caller.
**ohos.aafwk.param.callerUid**: UID in [bundleInfo](js-apis-bundle-BundleInfo.md#bundleinfo-1), that is, the application UID in the bundle information. | -| entities | Array\ | No | Additional category information (such as browser and video player) of the target ability. It is a supplement to **action** in implicit Want and is used to filter ability types. For details, see [entity](js-apis-app-ability-wantConstant.md#wantconstantentity). | +| action | string | No | Action to take, such as viewing and sharing application details. In implicit Want, you can define this field and use it together with **uri** or **parameters** to specify the operation to be performed on the data. | +| parameters | {[key: string]: any} | No | Want parameters in the form of custom key-value (KV) pairs. By default, the following keys are carried:
**ohos.aafwk.callerPid**: PID of the caller.
**ohos.aafwk.param.callerToken**: token of the caller.
**ohos.aafwk.param.callerUid**: UID in [bundleInfo](js-apis-bundle-BundleInfo.md#bundleinfo-1), that is, the application UID in the bundle information.
- **component.startup.newRules**: whether to enable the new control rule.
- **moduleName**: module name of the caller. No matter what this field is set to, the correct module name will be sent to the peer.
- **ohos.dlp.params.sandbox**: available only for DLP files. | +| entities | Array\ | No | Additional category information (such as browser and video player) of the target ability. It is a supplement to **action** in implicit Want and is used to filter ability types. | | moduleName9+ | string | No | Module to which the ability belongs.| **Example** @@ -27,42 +27,42 @@ Want is a carrier for information transfer between objects (application componen ```ts let want = { - "deviceId": "", // An empty deviceId indicates the local device. - "bundleName": "com.example.myapplication", - "abilityName": "EntryAbility", - "moduleName": "entry" // moduleName is optional. + 'deviceId': '', // An empty deviceId indicates the local device. + 'bundleName': 'com.extreme.test', + 'abilityName': 'MainAbility', + 'moduleName': 'entry' // moduleName is optional. }; this.context.startAbility(want, (error) => { // Start an ability explicitly. The bundleName, abilityName, and moduleName parameters work together to uniquely identify an ability. - console.log("error.code = " + error.code) - }) + console.log('error.code = ' + error.code) + }); ``` - Passing a file descriptor (FD) (called in the UIAbility object, where context in the example is the context object of the UIAbility): ```ts - import fileio from '@ohos.fileio'; + import fileio from '@ohos.fileio';; // ... let fd; try { - fd = fileio.openSync("/data/storage/el2/base/haps/pic.png"); + fd = fileio.openSync('/data/storage/el2/base/haps/pic.png'); } catch(e) { - console.log("openSync fail:" + JSON.stringify(e)); + console.log('openSync fail:' + JSON.stringify(e)); } let want = { - "deviceId": "", // An empty deviceId indicates the local device. - "bundleName": "com.example.myapplication", - "abilityName": "EntryAbility", - "moduleName": "entry", // moduleName is optional. - "parameters": { - "keyFd":{"type":"FD", "value":fd} + 'deviceId': '', // An empty deviceId indicates the local device. + 'bundleName': 'com.extreme.test', + 'abilityName': 'MainAbility', + 'moduleName': 'entry', // moduleName is optional. + 'parameters': { + 'keyFd':{'type':'FD', 'value':fd} } }; this.context.startAbility(want, (error) => { // Start an ability explicitly. The bundleName, abilityName, and moduleName parameters work together to uniquely identify an ability. - console.log("error.code = " + error.code) - }) + console.log('error.code = ' + error.code) + }); // ... ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-app-context.md b/en/application-dev/reference/apis/js-apis-inner-app-context.md index ec729194807c24ea49b7b117cb308628c031a75a..22da49708e973f844aa7a5f206b88ceb9db9102a 100644 --- a/en/application-dev/reference/apis/js-apis-inner-app-context.md +++ b/en/application-dev/reference/apis/js-apis-inner-app-context.md @@ -14,9 +14,9 @@ The **Context** object is created in a **featureAbility** and returned through i ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); +let context = featureAbility.getContext(); context.getOrCreateLocalDir().then((data) => { - console.info("getOrCreateLocalDir data: " + JSON.stringify(data)); + console.info('getOrCreateLocalDir data: ' + JSON.stringify(data)); }); ``` @@ -40,9 +40,9 @@ If this API is called for the first time, a root directory will be created. ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); +let context = featureAbility.getContext(); context.getOrCreateLocalDir((err, data)=>{ - console.info("getOrCreateLocalDir err: " + JSON.stringify(err) + "data: " + JSON.stringify(data)); + console.info('getOrCreateLocalDir err: ' + JSON.stringify(err) + 'data: ' + JSON.stringify(data)); }); ``` @@ -68,9 +68,9 @@ If this API is called for the first time, a root directory will be created. ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); +let context = featureAbility.getContext(); context.getOrCreateLocalDir().then((data) => { - console.info("getOrCreateLocalDir data: " + JSON.stringify(data)); + console.info('getOrCreateLocalDir data: ' + JSON.stringify(data)); }); ``` @@ -94,15 +94,14 @@ Verifies whether a specific PID and UID have the given permission. This API uses ```ts import featureAbility from '@ohos.ability.featureAbility'; -import bundle from '@ohos.bundle.bundleManager'; -var context = featureAbility.getContext(); +import bundle from '@ohos.bundle'; +let context = featureAbility.getContext(); bundle.getBundleInfo('com.context.test', 1, (err, datainfo) =>{ - context.verifyPermission("com.example.permission", {uid:datainfo.appInfo.uid}, (err, data) =>{ - console.info("verifyPermission err: " + JSON.stringify(err) + "data: " + JSON.stringify(data)); + context.verifyPermission('com.example.permission', {uid:datainfo.uid}, (err, data) =>{ + console.info('verifyPermission err: ' + JSON.stringify(err) + 'data: ' + JSON.stringify(data)); }); }); ``` -For details about **getBundleInfo** in the sample code, see [bundleManager](js-apis-bundleManager.md). @@ -125,9 +124,9 @@ Verifies whether the current PID and UID have the given permission. This API use ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); -context.verifyPermission("com.example.permission", (err, data) =>{ - console.info("verifyPermission err: " + JSON.stringify(err) + "data: " + JSON.stringify(data)); +let context = featureAbility.getContext(); +context.verifyPermission('com.example.permission', (err, data) =>{ + console.info('verifyPermission err: ' + JSON.stringify(err) + 'data: ' + JSON.stringify(data)); }); ``` @@ -156,10 +155,10 @@ Verifies whether a specific PID and UID have the given permission. This API uses ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); -var Permission = {pid:1}; +let context = featureAbility.getContext(); +let Permission = {pid:1}; context.verifyPermission('com.context.permission',Permission).then((data) => { - console.info("verifyPermission data: " + JSON.stringify(data)); + console.info('verifyPermission data: ' + JSON.stringify(data)); }); ``` @@ -185,16 +184,16 @@ Requests certain permissions from the system. This API uses an asynchronous call ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); +let context = featureAbility.getContext(); context.requestPermissionsFromUser( - ["com.example.permission1", - "com.example.permission2", - "com.example.permission3", - "com.example.permission4", - "com.example.permission5"], + ['com.example.permission1', + 'com.example.permission2', + 'com.example.permission3', + 'com.example.permission4', + 'com.example.permission5'], 1, (err, data) => { - console.info("requestPermissionsFromUser err: " + JSON.stringify(err) + "data: " + JSON.stringify(data)); + console.info('requestPermissionsFromUser err: ' + JSON.stringify(err) + 'data: ' + JSON.stringify(data)); } ); ``` @@ -225,15 +224,15 @@ Requests certain permissions from the system. This API uses a promise to return ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); +let context = featureAbility.getContext(); context.requestPermissionsFromUser( - ["com.example.permission1", - "com.example.permission2", - "com.example.permission3", - "com.example.permission4", - "com.example.permission5"], + ['com.example.permission1', + 'com.example.permission2', + 'com.example.permission3', + 'com.example.permission4', + 'com.example.permission5'], 1).then((data)=>{ - console.info("requestPermissionsFromUser data: " + JSON.stringify(data)); + console.info('requestPermissionsFromUser data: ' + JSON.stringify(data)); } ); ``` @@ -252,15 +251,15 @@ Obtains information about the current application. This API uses an asynchronous | Name | Type | Mandatory | Description | | -------- | ------------------------------- | ---- | ------------ | -| callback | AsyncCallback\<[ApplicationInfo](js-apis-bundleManager-applicationInfo.md)> | Yes | Callback used to return the application information.| +| callback | AsyncCallback\<[ApplicationInfo](js-apis-bundle-ApplicationInfo.md)> | Yes | Callback used to return the application information.| **Example** ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); +let context = featureAbility.getContext(); context.getApplicationInfo((err, data) => { - console.info("getApplicationInfo err: " + JSON.stringify(err) + "data: " + JSON.stringify(data)); + console.info('getApplicationInfo err: ' + JSON.stringify(err) + 'data: ' + JSON.stringify(data)); }); ``` @@ -284,9 +283,9 @@ Obtains information about the current application. This API uses a promise to re ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); +let context = featureAbility.getContext(); context.getApplicationInfo().then((data) => { - console.info("getApplicationInfo data: " + JSON.stringify(data)); + console.info('getApplicationInfo data: ' + JSON.stringify(data)); }); ``` @@ -310,9 +309,9 @@ Obtains the bundle name of this ability. This API uses an asynchronous callback ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); +let context = featureAbility.getContext(); context.getBundleName((err, data) => { - console.info("getBundleName err: " + JSON.stringify(err) + "data: " + JSON.stringify(data)); + console.info('getBundleName err: ' + JSON.stringify(err) + 'data: ' + JSON.stringify(data)); }); ``` @@ -336,9 +335,9 @@ Obtains the bundle name of this ability. This API uses a promise to return the r ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); +let context = featureAbility.getContext(); context.getBundleName().then((data) => { - console.info("getBundleName data: " + JSON.stringify(data)); + console.info('getBundleName data: ' + JSON.stringify(data)); }); ``` @@ -354,15 +353,15 @@ Obtains the display orientation of this ability. This API uses an asynchronous c | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------ | -| callback | AsyncCallback\<[bundle.DisplayOrientation](js-apis-bundleManager.md#displayorientation)> | Yes | Callback used to return the display orientation.| +| callback | AsyncCallback\<[bundle.DisplayOrientation](js-apis-Bundle.md#displayorientation)> | Yes | Callback used to return the display orientation.| **Example** ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); +let context = featureAbility.getContext(); context.getDisplayOrientation((err, data) => { - console.info("getDisplayOrientation err: " + JSON.stringify(err) + "data: " + JSON.stringify(data)); + console.info('getDisplayOrientation err: ' + JSON.stringify(err) + 'data: ' + JSON.stringify(data)); }); ``` @@ -378,15 +377,15 @@ Obtains the display orientation of this ability. This API uses a promise to retu | Type | Description | | ---------------------------------------- | --------- | -| Promise\<[bundle.DisplayOrientation](js-apis-bundleManager.md#displayorientation)> | Promise used to return the display orientation.| +| Promise\<[bundle.DisplayOrientation](js-apis-Bundle.md#displayorientation)> | Promise used to return the display orientation.| **Example** ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); +let context = featureAbility.getContext(); context.getDisplayOrientation().then((data) => { - console.info("getDisplayOrientation data: " + JSON.stringify(data)); + console.info('getDisplayOrientation data: ' + JSON.stringify(data)); }); ``` @@ -408,9 +407,9 @@ Obtains the external cache directory of the application. This API uses an asynch ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); +let context = featureAbility.getContext(); context.getExternalCacheDir((err, data) => { - console.info("getExternalCacheDir err: " + JSON.stringify(err) + "data: " + JSON.stringify(data)); + console.info('getExternalCacheDir err: ' + JSON.stringify(err) + 'data: ' + JSON.stringify(data)); }); ``` @@ -432,9 +431,9 @@ Obtains the external cache directory of the application. This API uses a promise ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); +let context = featureAbility.getContext(); context.getExternalCacheDir().then((data) => { - console.info("getExternalCacheDir data: " + JSON.stringify(data)); + console.info('getExternalCacheDir data: ' + JSON.stringify(data)); }); ``` @@ -450,7 +449,7 @@ Sets the display orientation for this ability. This API uses an asynchronous cal | Name | Type | Mandatory | Description | | ----------- | ---------------------------------------- | ---- | ------------ | -| orientation | [bundle.DisplayOrientation](js-apis-bundleManager.md#displayorientation) | Yes | Display orientation to set.| +| orientation | [bundle.DisplayOrientation](js-apis-Bundle.md#displayorientation) | Yes | Display orientation to set.| | callback | AsyncCallback\ | Yes | Callback used to return the display orientation. | **Example** @@ -458,10 +457,10 @@ Sets the display orientation for this ability. This API uses an asynchronous cal ```ts import featureAbility from '@ohos.ability.featureAbility'; import bundle from '@ohos.bundle'; -var context = featureAbility.getContext(); -var orientation = bundle.DisplayOrientation.UNSPECIFIED; +let context = featureAbility.getContext(); +let orientation=bundle.DisplayOrientation.UNSPECIFIED context.setDisplayOrientation(orientation, (err) => { - console.info("setDisplayOrientation err: " + JSON.stringify(err)); + console.info('setDisplayOrientation err: ' + JSON.stringify(err)); }); ``` @@ -477,7 +476,7 @@ Sets the display orientation for this ability. This API uses a promise to return | Type | Description | | ---------------------------------------- | ---------------------------------------- | -| orientation | [bundle.DisplayOrientation](js-apis-bundleManager.md#displayorientation) | +| orientation | [bundle.DisplayOrientation](js-apis-Bundle.md#displayorientation) | | Promise\ | Promise used to return the display orientation. | **Example** @@ -485,10 +484,10 @@ Sets the display orientation for this ability. This API uses a promise to return ```ts import featureAbility from '@ohos.ability.featureAbility'; import bundle from '@ohos.bundle'; -var context = featureAbility.getContext(); -var orientation = bundle.DisplayOrientation.UNSPECIFIED; +let context = featureAbility.getContext(); +let orientation=bundle.DisplayOrientation.UNSPECIFIED context.setDisplayOrientation(orientation).then((data) => { - console.info("setDisplayOrientation data: " + JSON.stringify(data)); + console.info('setDisplayOrientation data: ' + JSON.stringify(data)); }); ``` @@ -511,10 +510,10 @@ Sets whether to show this feature at the top of the lock screen so that the feat ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); -var show = true; +let context = featureAbility.getContext(); +let show=true context.setShowOnLockScreen(show, (err) => { - console.info("setShowOnLockScreen err: " + JSON.stringify(err)); + console.info('setShowOnLockScreen err: ' + JSON.stringify(err)); }); ``` @@ -542,10 +541,10 @@ Sets whether to show this feature at the top of the lock screen so that the feat ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); -var show = true; +let context = featureAbility.getContext(); +let show=true context.setShowOnLockScreen(show).then((data) => { - console.info("setShowOnLockScreen data: " + JSON.stringify(data)); + console.info('setShowOnLockScreen data: ' + JSON.stringify(data)); }); ``` @@ -568,10 +567,10 @@ Sets whether to wake up the screen when this feature is restored. This API uses ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); -var wakeUp = true; +let context = featureAbility.getContext(); +let wakeUp=true context.setWakeUpScreen(wakeUp, (err) => { - console.info("setWakeUpScreen err: " + JSON.stringify(err)); + console.info('setWakeUpScreen err: ' + JSON.stringify(err)); }); ``` @@ -599,10 +598,10 @@ Sets whether to wake up the screen when this feature is restored. This API uses ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); -var wakeUp = true; +let context = featureAbility.getContext(); +let wakeUp=true context.setWakeUpScreen(wakeUp).then((data) => { - console.info("setWakeUpScreen data: " + JSON.stringify(data)); + console.info('setWakeUpScreen data: ' + JSON.stringify(data)); }); ``` @@ -627,9 +626,9 @@ Obtains information about the current process, including the PID and process nam ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); +let context = featureAbility.getContext(); context.getProcessInfo((err, data) => { - console.info("getProcessInfo err: " + JSON.stringify(err) + "data: " + JSON.stringify(data)); + console.info('getProcessInfo err: ' + JSON.stringify(err) + 'data: ' + JSON.stringify(data)); }); ``` @@ -653,9 +652,9 @@ Obtains information about the current process, including the PID and process nam ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); +let context = featureAbility.getContext(); context.getProcessInfo().then((data) => { - console.info("getProcessInfo data: " + JSON.stringify(data)); + console.info('getProcessInfo data: ' + JSON.stringify(data)); }); ``` @@ -675,15 +674,15 @@ This API is available only to Page abilities. | Name | Type | Mandatory | Description | | -------- | --------------------------- | ---- | -------------------------------------- | -| callback | AsyncCallback\<[ElementName](js-apis-bundleManager-elementName.md)> | Yes | Callback used to return the **ohos.bundle.ElementName** object.| +| callback | AsyncCallback\<[ElementName](js-apis-bundle-ElementName.md)> | Yes | Callback used to return the **ohos.bundle.ElementName** object.| **Example** ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); +let context = featureAbility.getContext(); context.getElementName((err, data) => { - console.info("getElementName err: " + JSON.stringify(err) + "data: " + JSON.stringify(data)); + console.info('getElementName err: ' + JSON.stringify(err) + 'data: ' + JSON.stringify(data)); }); ``` @@ -703,15 +702,15 @@ This API is available only to Page abilities. | Type | Description | | --------------------- | ------------------------------------ | -| Promise\<[ElementName](js-apis-bundleManager-elementName.md)> | Promise used to return the **ohos.bundle.ElementName** object.| +| Promise\<[ElementName](js-apis-bundle-ElementName.md)> | Promise used to return the **ohos.bundle.ElementName** object.| **Example** ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); +let context = featureAbility.getContext(); context.getElementName().then((data) => { - console.info("getElementName data: " + JSON.stringify(data)); + console.info('getElementName data: ' + JSON.stringify(data)); }); ``` @@ -733,9 +732,9 @@ Obtains the name of the current process. This API uses an asynchronous callback ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); +let context = featureAbility.getContext(); context.getProcessName((err, data) => { - console.info("getProcessName err: " + JSON.stringify(err) + "data: " + JSON.stringify(data)); + console.info('getProcessName err: ' + JSON.stringify(err) + 'data: ' + JSON.stringify(data)); }); ``` @@ -759,9 +758,9 @@ Obtains the name of the current process. This API uses a promise to return the r ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); +let context = featureAbility.getContext(); context.getProcessName().then((data) => { - console.info("getProcessName data: " + JSON.stringify(data)); + console.info('getProcessName data: ' + JSON.stringify(data)); }); ``` @@ -785,9 +784,9 @@ Obtains the bundle name of the caller ability. This API uses an asynchronous cal ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); +let context = featureAbility.getContext(); context.getCallingBundle((err, data) => { - console.info("getCallingBundle err: " + JSON.stringify(err) + "data: " + JSON.stringify(data)); + console.info('getCallingBundle err: ' + JSON.stringify(err) + 'data: ' + JSON.stringify(data)); }); ``` @@ -811,9 +810,9 @@ Obtains the bundle name of the caller ability. This API uses a promise to return ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); +let context = featureAbility.getContext(); context.getCallingBundle().then((data) => { - console.info("getCallingBundle data: " + JSON.stringify(data)); + console.info('getCallingBundle data: ' + JSON.stringify(data)); }); ``` @@ -835,9 +834,9 @@ Obtains the cache directory of the application in the internal storage. This API ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); +let context = featureAbility.getContext(); context.getCacheDir((err, data) => { - console.info("getCacheDir err: " + JSON.stringify(err) + "data: " + JSON.stringify(data)); + console.info('getCacheDir err: ' + JSON.stringify(err) + 'data: ' + JSON.stringify(data)); }); ``` @@ -859,9 +858,9 @@ Obtains the cache directory of the application in the internal storage. This API ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); +let context = featureAbility.getContext(); context.getCacheDir().then((data) => { - console.info("getCacheDir data: " + JSON.stringify(data)); + console.info('getCacheDir data: ' + JSON.stringify(data)); }); ``` @@ -883,9 +882,9 @@ Obtains the file directory of the application in the internal storage. This API ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); +let context = featureAbility.getContext(); context.getFilesDir((err, data) => { - console.info("getFilesDir err: " + JSON.stringify(err) + "data: " + JSON.stringify(data)); + console.info('getFilesDir err: ' + JSON.stringify(err) + 'data: ' + JSON.stringify(data)); }); ``` @@ -907,9 +906,9 @@ Obtains the file directory of the application in the internal storage. This API ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); +let context = featureAbility.getContext(); context.getFilesDir().then((data) => { - console.info("getFilesDir data: " + JSON.stringify(data)); + console.info('getFilesDir data: ' + JSON.stringify(data)); }); ``` @@ -933,9 +932,9 @@ If the distributed file path does not exist, the system will create one and retu ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); +let context = featureAbility.getContext(); context.getOrCreateDistributedDir((err, data) => { - console.info("getOrCreateDistributedDir err: " + JSON.stringify(err) + "data: " + JSON.stringify(data)); + console.info('getOrCreateDistributedDir err: ' + JSON.stringify(err) + 'data: ' + JSON.stringify(data)); }); ``` @@ -959,9 +958,9 @@ If the distributed file path does not exist, the system will create one and retu ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); +let context = featureAbility.getContext(); context.getOrCreateDistributedDir().then((data) => { - console.info("getOrCreateDistributedDir data: " + JSON.stringify(data)); + console.info('getOrCreateDistributedDir data: ' + JSON.stringify(data)); }); ``` @@ -983,9 +982,9 @@ Obtains the application type. This API uses an asynchronous callback to return t ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); +let context = featureAbility.getContext(); context.getAppType((err, data) => { - console.info("getAppType err: " + JSON.stringify(err) + "data: " + JSON.stringify(data)); + console.info('getAppType err: ' + JSON.stringify(err) + 'data: ' + JSON.stringify(data)); }); ``` @@ -1007,9 +1006,9 @@ Obtains the application type. This API uses a promise to return the result. ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); +let context = featureAbility.getContext(); context.getAppType().then((data) => { - console.info("getAppType data: " + JSON.stringify(data)); + console.info('getAppType data: ' + JSON.stringify(data)); }); ``` @@ -1025,15 +1024,15 @@ Obtains the **ModuleInfo** object of the application. This API uses an asynchron | Name | Type | Mandatory | Description | | -------- | ---------------------------------------- | ---- | --------------------------------------- | -| callback | AsyncCallback\<[HapModuleInfo](js-apis-bundleManager-hapModuleInfo.md)> | Yes | Callback used to return the **ModuleInfo** object.| +| callback | AsyncCallback\<[HapModuleInfo](js-apis-bundle-HapModuleInfo.md)> | Yes | Callback used to return the **ModuleInfo** object.| **Example** ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); +let context = featureAbility.getContext(); context.getHapModuleInfo((err, data) => { - console.info("getHapModuleInfo err: " + JSON.stringify(err) + "data: " + JSON.stringify(data)); + console.info('getHapModuleInfo err: ' + JSON.stringify(err) + 'data: ' + JSON.stringify(data)); }); ``` @@ -1049,15 +1048,15 @@ Obtains the **ModuleInfo** object of the application. This API uses a promise to | Type | Description | | ---------------------------------------- | ------------------ | -| Promise\<[HapModuleInfo](js-apis-bundleManager-hapModuleInfo.md)> | Promise used to return the **ModuleInfo** object.| +| Promise\<[HapModuleInfo](js-apis-bundle-HapModuleInfo.md)> | Promise used to return the **ModuleInfo** object.| **Example** ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); +let context = featureAbility.getContext(); context.getHapModuleInfo().then((data) => { - console.info("getHapModuleInfo data: " + JSON.stringify(data)); + console.info('getHapModuleInfo data: ' + JSON.stringify(data)); }); ``` @@ -1079,9 +1078,9 @@ Obtains the version information of the application. This API uses an asynchronou ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); +let context = featureAbility.getContext(); context.getAppVersionInfo((err, data) => { - console.info("getAppVersionInfo err: " + JSON.stringify(err) + "data: " + JSON.stringify(data)); + console.info('getAppVersionInfo err: ' + JSON.stringify(err) + 'data: ' + JSON.stringify(data)); }); ``` @@ -1103,9 +1102,9 @@ Obtains the version information of the application. This API uses a promise to r ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); +let context = featureAbility.getContext(); context.getAppVersionInfo().then((data) => { - console.info("getAppVersionInfo data: " + JSON.stringify(data)); + console.info('getAppVersionInfo data: ' + JSON.stringify(data)); }); ``` @@ -1121,15 +1120,15 @@ Obtains information about this ability. This API uses an asynchronous callback t | Name | Type | Mandatory | Description | | -------- | ---------------------------------------- | ---- | --------------------------------------- | -| callback | AsyncCallback\<[AbilityInfo](js-apis-bundleManager-abilityInfo.md)> | Yes | Callback used to return the ability information.| +| callback | AsyncCallback\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)> | Yes | Callback used to return the ability information.| **Example** ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); +let context = featureAbility.getContext(); context.getAbilityInfo((err, data) => { - console.info("getAbilityInfo err: " + JSON.stringify(err) + "data: " + JSON.stringify(data)); + console.info('getAbilityInfo err: ' + JSON.stringify(err) + 'data: ' + JSON.stringify(data)); }); ``` @@ -1145,15 +1144,15 @@ Obtains information about this ability. This API uses a promise to return the re | Type | Description | | ---------------------------------------- | ------------------ | -| Promise\<[AbilityInfo](js-apis-bundleManager-abilityInfo.md)> | Promise used to return the ability information.| +| Promise\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)> | Promise used to return the ability information.| **Example** ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); +let context = featureAbility.getContext(); context.getAbilityInfo().then((data) => { - console.info("getAbilityInfo data: " + JSON.stringify(data)); + console.info('getAbilityInfo data: ' + JSON.stringify(data)); }); ``` @@ -1175,7 +1174,7 @@ Obtains the context of the application. ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext().getApplicationContext(); +let context = featureAbility.getContext().getApplicationContext(); ``` ## Context.isUpdatingConfigurations7+ @@ -1196,9 +1195,9 @@ Checks whether the configuration of this ability is being updated. This API uses ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); +let context = featureAbility.getContext(); context.isUpdatingConfigurations((err, data) => { - console.info("isUpdatingConfigurations err: " + JSON.stringify(err) + "data: " + JSON.stringify(data)); + console.info('isUpdatingConfigurations err: ' + JSON.stringify(err) + 'data: ' + JSON.stringify(data)); }); ``` @@ -1220,9 +1219,9 @@ Checks whether the configuration of this ability is being updated. This API uses ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); +let context = featureAbility.getContext(); context.isUpdatingConfigurations().then((data) => { - console.info("isUpdatingConfigurations data: " + JSON.stringify(data)); + console.info('isUpdatingConfigurations data: ' + JSON.stringify(data)); }); ``` @@ -1244,7 +1243,7 @@ Notifies the system of the time required to draw this page function. This API us ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); +let context = featureAbility.getContext(); context.printDrawnCompleted((err) => { console.error('printDrawnCompleted err: ' + JSON.stringify(err)); }); @@ -1268,9 +1267,9 @@ Notifies the system of the time required to draw this page function. This API us ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); +let context = featureAbility.getContext(); context.printDrawnCompleted().then((data) => { - console.info("printDrawnCompleted data: " + JSON.stringify(data)); + console.info('printDrawnCompleted data: ' + JSON.stringify(data)); }); ``` @@ -1293,13 +1292,3 @@ context.printDrawnCompleted().then((data) => { | requestCode | Read-only | number | Yes | Request code passed.| | permissions | Read-only | Array\ | Yes | Permissions requested. | | authResults | Read-only | Array\ | Yes | Permission request result. | - -## AppVersionInfo7+ - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -| Name | Type | Readable | Writable | Description | -| ----------- | ------ | ---- | ---- | ------- | -| appName | string | Yes | No | Module name. | -| versionCode | number | Yes | No | Module description.| -| versionName | string | Yes | No | Module description ID.| diff --git a/en/application-dev/reference/apis/js-apis-inner-app-processInfo.md b/en/application-dev/reference/apis/js-apis-inner-app-processInfo.md index 351d6ad145824d0eba37a3a1eadc846034763c97..8127343de9a7723ab1f293c9b846fca4426d8dd4 100644 --- a/en/application-dev/reference/apis/js-apis-inner-app-processInfo.md +++ b/en/application-dev/reference/apis/js-apis-inner-app-processInfo.md @@ -3,10 +3,8 @@ The **ProcessInfo** module defines process information. You can use [getProcessInfo](js-apis-inner-app-context.md#contextgetprocessinfo7) to obtain information about the processes running on the current ability. > **NOTE** -> +> > The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. -> -> The APIs of this module can be used only in the FA model. **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -19,10 +17,13 @@ The **ProcessInfo** module defines process information. You can use [getProcessI ```ts import featureAbility from '@ohos.ability.featureAbility'; -var context = featureAbility.getContext(); +let context = featureAbility.getContext(); context.getProcessInfo((err, data) => { - console.info("getProcessInfo err: " + JSON.stringify(err) + "data: " + JSON.stringify(data)); - let pid = data.pid; - let processName = data.processName; + if (err.code !== 0) { + console.info('getProcessInfo err: ' + JSON.stringify(err) + 'data: ' + JSON.stringify(data)); + let pid = data.pid; + let processName = data.processName; + } }); ``` + diff --git a/en/application-dev/reference/apis/js-apis-inner-application-abilityDelegator.md b/en/application-dev/reference/apis/js-apis-inner-application-abilityDelegator.md index ad4f7e19a9fd40b82684c0acc11a458073bbb16b..94782760127cc17c7c94f1d64e4afd486d93e3ee 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-abilityDelegator.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-abilityDelegator.md @@ -35,20 +35,20 @@ Adds an **AbilityMonitor** instance. This API uses an asynchronous callback to r **Example** ```ts -var abilityDelegator; +let abilityDelegator; function onAbilityCreateCallback(data) { - console.info("onAbilityCreateCallback"); + console.info('onAbilityCreateCallback'); } -var monitor = { - abilityName: "abilityname", +let monitor = { + abilityName: 'abilityname', onAbilityCreate: onAbilityCreateCallback -} +}; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.addAbilityMonitor(monitor, (err : any) => { - console.info("addAbilityMonitor callback"); + console.info('addAbilityMonitor callback'); }); ``` @@ -75,20 +75,20 @@ Adds an **AbilityMonitor** instance. This API uses a promise to return the resul **Example** ```ts -var abilityDelegator; +let abilityDelegator; function onAbilityCreateCallback(data) { - console.info("onAbilityCreateCallback"); + console.info('onAbilityCreateCallback'); } -var monitor = { - abilityName: "abilityname", +let monitor = { + abilityName: 'abilityname', onAbilityCreate: onAbilityCreateCallback -} +}; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.addAbilityMonitor(monitor).then(() => { - console.info("addAbilityMonitor promise"); + console.info('addAbilityMonitor promise'); }); ``` @@ -112,20 +112,20 @@ Removes an **AbilityMonitor** instance. This API uses an asynchronous callback t **Example** ```ts -var abilityDelegator; +let abilityDelegator; function onAbilityCreateCallback(data) { - console.info("onAbilityCreateCallback"); + console.info('onAbilityCreateCallback'); } -var monitor = { - abilityName: "abilityname", +let monitor = { + abilityName: 'abilityname', onAbilityCreate: onAbilityCreateCallback -} +}; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.removeAbilityMonitor(monitor, (err : any) => { - console.info("removeAbilityMonitor callback"); + console.info('removeAbilityMonitor callback'); }); ``` @@ -154,20 +154,20 @@ Removes an **AbilityMonitor** instance. This API uses a promise to return the re - Example ```ts -var abilityDelegator; +let abilityDelegator; function onAbilityCreateCallback(data) { - console.info("onAbilityCreateCallback"); + console.info('onAbilityCreateCallback'); } -var monitor = { - abilityName: "abilityname", +let monitor = { + abilityName: 'abilityname', onAbilityCreate: onAbilityCreateCallback -} +}; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.removeAbilityMonitor(monitor).then(() => { - console.info("removeAbilityMonitor promise"); + console.info('removeAbilityMonitor promise'); }); ``` @@ -191,20 +191,20 @@ Waits for the **Ability** instance that matches the **AbilityMonitor** instance **Example** ```ts -var abilityDelegator; +let abilityDelegator; function onAbilityCreateCallback(data) { - console.info("onAbilityCreateCallback"); + console.info('onAbilityCreateCallback'); } -var monitor = { - abilityName: "abilityname", +let monitor = { + abilityName: 'abilityname', onAbilityCreate: onAbilityCreateCallback -} +}; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.waitAbilityMonitor(monitor, (err : any, data : any) => { - console.info("waitAbilityMonitor callback"); + console.info('waitAbilityMonitor callback'); }); ``` @@ -227,21 +227,21 @@ Waits a period of time for the **Ability** instance that matches the **AbilityMo **Example** ```ts -var abilityDelegator; -var timeout = 100; +let abilityDelegator; +let timeout = 100; function onAbilityCreateCallback(data) { - console.info("onAbilityCreateCallback"); + console.info('onAbilityCreateCallback'); } -var monitor = { - abilityName: "abilityname", +let monitor = { + abilityName: 'abilityname', onAbilityCreate: onAbilityCreateCallback -} +}; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.waitAbilityMonitor(monitor, timeout, (err : any, data : any) => { - console.info("waitAbilityMonitor callback"); + console.info('waitAbilityMonitor callback'); }); ``` @@ -271,20 +271,20 @@ Waits a period of time for the **Ability** instance that matches the **AbilityMo **Example** ```ts -var abilityDelegator; +let abilityDelegator; function onAbilityCreateCallback(data) { - console.info("onAbilityCreateCallback"); + console.info('onAbilityCreateCallback'); } -var monitor = { - abilityName: "abilityname", +let monitor = { + abilityName: 'abilityname', onAbilityCreate: onAbilityCreateCallback -} +}; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.waitAbilityMonitor(monitor).then((data : any) => { - console.info("waitAbilityMonitor promise"); + console.info('waitAbilityMonitor promise'); }); ``` @@ -307,10 +307,10 @@ Obtains the application context. **Example** ```ts -var abilityDelegator; +let abilityDelegator; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); -var context = abilityDelegator.getAppContext(); +let context = abilityDelegator.getAppContext(); ``` @@ -338,15 +338,15 @@ Obtains the lifecycle state of an ability. **Example** ```ts -var abilityDelegator; -var ability; +let abilityDelegator; +let ability; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.getCurrentTopAbility((err : any, data : any) => { - console.info("getCurrentTopAbility callback"); + console.info('getCurrentTopAbility callback'); ability = data; - var state = abilityDelegator.getAbilityState(ability); - console.info("getAbilityState" + state); + let state = abilityDelegator.getAbilityState(ability); + console.info('getAbilityState' + state); }); ``` @@ -369,12 +369,12 @@ Obtains the top ability of this application. This API uses an asynchronous callb **Example** ```ts -var abilityDelegator; -var ability; +let abilityDelegator; +let ability; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.getCurrentTopAbility((err : any, data : any) => { - console.info("getCurrentTopAbility callback"); + console.info('getCurrentTopAbility callback'); ability = data; }); ``` @@ -398,12 +398,12 @@ Obtains the top ability of this application. This API uses a promise to return t **Example** ```ts -var abilityDelegator; -var ability; +let abilityDelegator; +let ability; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.getCurrentTopAbility().then((data : any) => { - console.info("getCurrentTopAbility promise"); + console.info('getCurrentTopAbility promise'); ability = data; }); ``` @@ -428,15 +428,15 @@ Starts an ability. This API uses an asynchronous callback to return the result. **Example** ```ts -var abilityDelegator; -var want = { - bundleName: "bundleName", - abilityName: "abilityName" +let abilityDelegator; +let want = { + bundleName: 'bundleName', + abilityName: 'abilityName' }; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.startAbility(want, (err : any, data : any) => { - console.info("startAbility callback"); + console.info('startAbility callback'); }); ``` @@ -465,15 +465,15 @@ Starts an ability. This API uses a promise to return the result. **Example** ```ts -var abilityDelegator; -var want = { - bundleName: "bundleName", - abilityName: "abilityName" +let abilityDelegator; +let want = { + bundleName: 'bundleName', + abilityName: 'abilityName' }; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.startAbility(want).then((data: any) => { - console.info("startAbility promise"); + console.info('startAbility promise'); }); ``` @@ -497,15 +497,15 @@ Schedules the lifecycle state of an ability to **Foreground**. This API uses an **Example** ```ts -var abilityDelegator; -var ability; +let abilityDelegator; +let ability; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.getCurrentTopAbility((err : any, data : any) => { - console.info("getCurrentTopAbility callback"); + console.info('getCurrentTopAbility callback'); ability = data; abilityDelegator.doAbilityForeground(ability, (err : any, data : any) => { - console.info("doAbilityForeground callback"); + console.info('doAbilityForeground callback'); }); }); ``` @@ -535,15 +535,15 @@ Schedules the lifecycle state of an ability to **Foreground**. This API uses a p **Example** ```ts -var abilityDelegator; -var ability; +let abilityDelegator; +let ability; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.getCurrentTopAbility((err : any, data : any) => { - console.info("getCurrentTopAbility callback"); + console.info('getCurrentTopAbility callback'); ability = data; abilityDelegator.doAbilityForeground(ability).then((data : any) => { - console.info("doAbilityForeground promise"); + console.info('doAbilityForeground promise'); }); }); ``` @@ -568,15 +568,15 @@ Schedules the lifecycle state of an ability to **Background**. This API uses an **Example** ```ts -var abilityDelegator; -var ability; +let abilityDelegator; +let ability; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.getCurrentTopAbility((err : any, data : any) => { - console.info("getCurrentTopAbility callback"); + console.info('getCurrentTopAbility callback'); ability = data; abilityDelegator.doAbilityBackground(ability, (err : any, data : any) => { - console.info("doAbilityBackground callback"); + console.info('doAbilityBackground callback'); }); }); ``` @@ -606,15 +606,15 @@ Schedules the lifecycle state of an ability to **Background**. This API uses a p **Example** ```ts -var abilityDelegator; -var ability; +let abilityDelegator; +let ability; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.getCurrentTopAbility((err : any, data : any) => { - console.info("getCurrentTopAbility callback"); + console.info('getCurrentTopAbility callback'); ability = data; abilityDelegator.doAbilityBackground(ability).then((data : any) => { - console.info("doAbilityBackground promise"); + console.info('doAbilityBackground promise'); }); }); ``` @@ -638,8 +638,8 @@ Prints log information to the unit test console. **Example** ```ts -var abilityDelegator; -var msg = "msg"; +let abilityDelegator; +let msg = 'msg'; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.printSync(msg); @@ -665,12 +665,12 @@ Prints log information to the unit test console. This API uses an asynchronous c **Example** ```ts -var abilityDelegator; -var msg = "msg"; +let abilityDelegator; +let msg = 'msg'; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.print(msg, (err : any) => { - console.info("print callback"); + console.info('print callback'); }); ``` @@ -699,12 +699,12 @@ Prints log information to the unit test console. This API uses a promise to retu **Example** ```ts -var abilityDelegator; -var msg = "msg"; +let abilityDelegator; +let msg = 'msg'; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.print(msg).then(() => { - console.info("print promise"); + console.info('print promise'); }); ``` @@ -728,12 +728,12 @@ Executes a shell command. This API uses an asynchronous callback to return the r **Example** ```ts -var abilityDelegator; -var cmd = "cmd"; +let abilityDelegator; +let cmd = 'cmd'; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.executeShellCommand(cmd, (err : any, data : any) => { - console.info("executeShellCommand callback"); + console.info('executeShellCommand callback'); }); ``` @@ -758,13 +758,13 @@ Executes a shell command with the timeout period specified. This API uses an asy **Example** ```ts -var abilityDelegator; -var cmd = "cmd"; -var timeout = 100; +let abilityDelegator; +let cmd = 'cmd'; +let timeout = 100; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.executeShellCommand(cmd, timeout, (err : any, data : any) => { - console.info("executeShellCommand callback"); + console.info('executeShellCommand callback'); }); ``` @@ -794,13 +794,13 @@ Executes a shell command with the timeout period specified. This API uses a prom **Example** ```ts -var abilityDelegator; -var cmd = "cmd"; -var timeout = 100; +let abilityDelegator; +let cmd = 'cmd'; +let timeout = 100; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.executeShellCommand(cmd, timeout).then((data : any) => { - console.info("executeShellCommand promise"); + console.info('executeShellCommand promise'); }); ``` @@ -825,12 +825,12 @@ Finishes the test and prints log information to the unit test console. This API **Example** ```ts -var abilityDelegator; -var msg = "msg"; +let abilityDelegator; +let msg = 'msg'; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.finishTest(msg, 0, (err : any) => { - console.info("finishTest callback"); + console.info('finishTest callback'); }); ``` @@ -860,12 +860,12 @@ Finishes the test and prints log information to the unit test console. This API **Example** ```ts -var abilityDelegator; -var msg = "msg"; +let abilityDelegator; +let msg = 'msg'; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.finishTest(msg, 0).then(() => { - console.info("finishTest promise"); + console.info('finishTest promise'); }); ``` @@ -887,16 +887,16 @@ Adds an **AbilityStageMonitor** instance to monitor the lifecycle state changes **Example** ```ts -var abilityDelegator; +let abilityDelegator; -var monitor = { - moduleName: "moduleName", - srcEntrance: "srcEntrance", -} +let monitor = { + moduleName: 'moduleName', + srcEntrance: 'srcEntrance', +}; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.addAbilityStageMonitor(monitor, (err : any) => { - console.info("addAbilityStageMonitor callback"); + console.info('addAbilityStageMonitor callback'); }); ``` @@ -925,16 +925,16 @@ Adds an **AbilityStageMonitor** instance to monitor the lifecycle state changes **Example** ```ts -var abilityDelegator; +let abilityDelegator; -var monitor = { - moduleName: "moduleName", - srcEntrance: "srcEntrance", -} +let monitor = { + moduleName: 'moduleName', + srcEntrance: 'srcEntrance', +}; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.addAbilityStageMonitor(monitor).then(() => { - console.info("addAbilityStageMonitor promise"); + console.info('addAbilityStageMonitor promise'); }); ``` @@ -956,16 +956,16 @@ Removes an **AbilityStageMonitor** instance from the application memory. This AP **Example** ```ts -var abilityDelegator; +let abilityDelegator; -var monitor = { - moduleName: "moduleName", - srcEntrance: "srcEntrance", -} +let monitor = { + moduleName: 'moduleName', + srcEntrance: 'srcEntrance', +}; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.removeAbilityStageMonitor(monitor, (err : any) => { - console.info("removeAbilityStageMonitor callback"); + console.info('removeAbilityStageMonitor callback'); }); ``` @@ -994,16 +994,16 @@ Removes an **AbilityStageMonitor** object from the application memory. This API **Example** ```ts -var abilityDelegator; +let abilityDelegator; -var monitor = { - moduleName: "moduleName", - srcEntrance: "srcEntrance", -} +let monitor = { + moduleName: 'moduleName', + srcEntrance: 'srcEntrance', +}; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.removeAbilityStageMonitor(monitor).then(() => { - console.info("removeAbilityStageMonitor promise"); + console.info('removeAbilityStageMonitor promise'); }); ``` @@ -1025,20 +1025,20 @@ Waits for an **AbilityStage** instance that matches the conditions set in an **A **Example** ```ts -var abilityDelegator; +let abilityDelegator; function onAbilityCreateCallback(data) { - console.info("onAbilityCreateCallback"); + console.info('onAbilityCreateCallback'); } -var monitor = { - moduleName: "moduleName", - srcEntrance: "srcEntrance", -} +let monitor = { + moduleName: 'moduleName', + srcEntrance: 'srcEntrance', +}; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.waitAbilityStageMonitor(monitor, (err : any, data : any) => { - console.info("waitAbilityStageMonitor callback"); + console.info('waitAbilityStageMonitor callback'); }); ``` @@ -1066,20 +1066,20 @@ Waits for an **AbilityStage** instance that matches the conditions set in an **A **Example** ```ts -var abilityDelegator; +let abilityDelegator; function onAbilityCreateCallback(data) { - console.info("onAbilityCreateCallback"); + console.info('onAbilityCreateCallback'); } -var monitor = { - moduleName: "moduleName", - srcEntrance: "srcEntrance", -} +let monitor = { + moduleName: 'moduleName', + srcEntrance: 'srcEntrance', +}; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.waitAbilityStageMonitor(monitor).then((data : any) => { - console.info("waitAbilityStageMonitor promise"); + console.info('waitAbilityStageMonitor promise'); }); ``` @@ -1102,20 +1102,20 @@ Waits a period of time for an **AbilityStage** instance that matches the conditi **Example** ```ts -var abilityDelegator; -var timeout = 100; +let abilityDelegator; +let timeout = 100; function onAbilityCreateCallback(data) { - console.info("onAbilityCreateCallback"); + console.info('onAbilityCreateCallback'); } -var monitor = { - moduleName: "moduleName", - srcEntrance: "srcEntrance", -} +let monitor = { + moduleName: 'moduleName', + srcEntrance: 'srcEntrance', +}; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.waitAbilityStageMonitor(monitor, timeout, (err : any, data : any) => { - console.info("waitAbilityStageMonitor callback"); + console.info('waitAbilityStageMonitor callback'); }); ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-abilityDelegatorArgs.md b/en/application-dev/reference/apis/js-apis-inner-application-abilityDelegatorArgs.md index a5f131c3e02071f3d55cbfdc73955ffef42889d3..e95c4595831162018344c4c4fad168a8657c4d56 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-abilityDelegatorArgs.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-abilityDelegatorArgs.md @@ -1,6 +1,6 @@ # AbilityDelegatorArgs -The **AbilityDelegatorArgs** module provides APIs to obtain an **AbilityDelegatorArgs** object during the execution of test cases. +The **AbilityDelegatorArgs** module provides a global register to store the registered **AbilityDelegator** and **AbilityDelegatorArgs** instances during application startup. > **NOTE** > @@ -28,5 +28,5 @@ Describes the ability delegator arguments. ```ts import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'; -var args = AbilityDelegatorRegistry.getArguments(); +let args = AbilityDelegatorRegistry.getArguments(); ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-abilityMonitor.md b/en/application-dev/reference/apis/js-apis-inner-application-abilityMonitor.md index d8726205b8caec547f270e8efe6472e37cd99eb4..0e9b919995d16daf58aa0f73da236cf1e809aa04 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-abilityMonitor.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-abilityMonitor.md @@ -19,6 +19,7 @@ Describes an ability monitor. | Name | Type | Readable| Writable| Description | | ------------------------------------------------------------ | -------- | ---- | ---- | ------------------------------------------------------------ | | abilityName | string | Yes | Yes | Name of the ability bound to the ability monitor.| +| moduleName? | string | Yes | Yes | Name of the module bound to the ability monitor.| | onAbilityCreate?:(data: [UIAbility](js-apis-app-ability-uiAbility.md)) | function | Yes | Yes | Called when the ability is created.
If this attribute is not set, the corresponding lifecycle callback cannot be received.| | onAbilityForeground?:(data: [UIAbility](js-apis-app-ability-uiAbility.md)) | function | Yes | Yes | Called when the ability starts to run in the foreground.
If this attribute is not set, the corresponding lifecycle callback cannot be received.| | onAbilityBackground?:(data: [UIAbility](js-apis-app-ability-uiAbility.md)) | function | Yes | Yes | Called when the ability starts to run in the background.
If this attribute is not set, the corresponding lifecycle callback cannot be received.| @@ -30,19 +31,22 @@ Describes an ability monitor. **Example** ```ts -import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'; function onAbilityCreateCallback(data) { - console.info("onAbilityCreateCallback"); + console.info('onAbilityCreateCallback'); } -var monitor = { - abilityName: "abilityname", +let monitor = { + abilityName: 'abilityname', + moduleName: "moduleName", onAbilityCreate: onAbilityCreateCallback -} +}; -var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); +let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.addAbilityMonitor(monitor, (err : any) => { - console.info("addAbilityMonitor callback"); + console.info('addAbilityMonitor callback'); }); ``` + + diff --git a/en/application-dev/reference/apis/js-apis-inner-application-abilityRunningInfo.md b/en/application-dev/reference/apis/js-apis-inner-application-abilityRunningInfo.md index 62b1f7e1fae204f2e6b1f6dcdc76521da3c51777..01bf2d71fd84273aa9080b9be842ea81112e6eb8 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-abilityRunningInfo.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-abilityRunningInfo.md @@ -30,15 +30,15 @@ The ability running information is obtained by calling [getAbilityRunningInfos]( ```ts import abilitymanager from '@ohos.application.abilityManager'; abilitymanager.getAbilityRunningInfos((err,data) => { - console.log("getAbilityRunningInfos err: " + err + " data: " + JSON.stringify(data)); + console.log('getAbilityRunningInfos err: ' + err + ' data: ' + JSON.stringify(data)); for (let i = 0; i < data.length; i++) { let abilityinfo = data[i]; - console.log("abilityinfo.ability: " + JSON.stringify(abilityinfo.ability)); - console.log("abilityinfo.pid: " + JSON.stringify(abilityinfo.pid)); - console.log("abilityinfo.uid: " + JSON.stringify(abilityinfo.uid)); - console.log("abilityinfo.processName: " + JSON.stringify(abilityinfo.processName)); - console.log("abilityinfo.startTime: " + JSON.stringify(abilityinfo.startTime)); - console.log("abilityinfo.abilityState: " + JSON.stringify(abilityinfo.abilityState)); + console.log('abilityinfo.ability: ' + JSON.stringify(abilityinfo.ability)); + console.log('abilityinfo.pid: ' + JSON.stringify(abilityinfo.pid)); + console.log('abilityinfo.uid: ' + JSON.stringify(abilityinfo.uid)); + console.log('abilityinfo.processName: ' + JSON.stringify(abilityinfo.processName)); + console.log('abilityinfo.startTime: ' + JSON.stringify(abilityinfo.startTime)); + console.log('abilityinfo.abilityState: ' + JSON.stringify(abilityinfo.abilityState)); } }); ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-abilityStageContext.md b/en/application-dev/reference/apis/js-apis-inner-application-abilityStageContext.md index 79f750797c12bfd9c323e2f613650c016ea2930b..aa037839a646d9a78f7317934464ca0824606afd 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-abilityStageContext.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-abilityStageContext.md @@ -1,6 +1,6 @@ # AbilityStageContext -The **AbilityStageContext** module, inherited from [Context](js-apis-application-context.md), implements the context of an ability stage. +The **AbilityStageContext** module, inherited from [Context](js-apis-inner-application-context.md), implements the context of an ability stage. This module provides APIs for accessing a specific ability stage. You can use the APIs to obtain the **ModuleInfo** object and environment configuration of an ability stage. @@ -28,5 +28,5 @@ class MyAbilityStage extends AbilityStage { | Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | -| currentHapModuleInfo | HapModuleInfo | Yes| No| **ModuleInfo** object corresponding to the **AbilityStage**.| +| currentHapModuleInfo | [HapModuleInfo](js-apis-bundleManager-hapModuleInfo.md) | Yes| No| **ModuleInfo** object corresponding to the **AbilityStage**.| | config | [Configuration](js-apis-app-ability-configuration.md) | Yes| No| Configuration for the environment where the application is running.| diff --git a/en/application-dev/reference/apis/js-apis-inner-application-abilityStageMonitor.md b/en/application-dev/reference/apis/js-apis-inner-application-abilityStageMonitor.md index 76a4ae2e425ce91acb0f79d22889cba231809c26..9605509b0e1c7c64c379d7da92656467cdc568ca 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-abilityStageMonitor.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-abilityStageMonitor.md @@ -11,15 +11,15 @@ The **AbilityStageMonitor** module provides conditions for matching **AbilitySta **Example** ```ts -import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'; let monitor = { - moduleName: "feature_as1", - srcEntrance: "./ets/Application/MyAbilityStage.ts", + moduleName: 'feature_as1', + srcEntrance: './ets/Application/MyAbilityStage.ts', }; let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.waitAbilityStageMonitor(monitor, (error, data) => { - console.info("stageMonitor waitAbilityStageMonitor, abilityStage = " + JSON.stringify(data)); + console.info('stageMonitor waitAbilityStageMonitor, abilityStage = ' + JSON.stringify(data)); }); ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-accessibilityExtensionContext.md b/en/application-dev/reference/apis/js-apis-inner-application-accessibilityExtensionContext.md index 63336a289f7804e9f69f1f0cf7db95b19a01d080..13b30ac5ad0a9ea3b967a8fe7dfbef1da2c972cc 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-accessibilityExtensionContext.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-accessibilityExtensionContext.md @@ -15,9 +15,9 @@ You can use the APIs of this module to configure the concerned information, obta Before using the **AccessibilityExtensionContext** module, you must define a child class that inherits from **AccessibilityExtensionAbility**. ```ts -import AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtensionAbility' +import AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtensionAbility'; let axContext; -class EntryAbility extends AccessibilityExtensionAbility { +class MainAbility extends AccessibilityExtensionAbility { onConnect(): void { console.log('AxExtensionAbility onConnect'); axContext = this.context; @@ -542,7 +542,7 @@ For details about the error codes, see [Accessibility Error Codes](../errorcodes **Example** ```ts -import GesturePath from "@ohos.accessibility.GesturePath"; +import GesturePath from '@ohos.accessibility.GesturePath'; import GesturePoint from '@ohos.accessibility.GesturePoint'; let gesturePath = new GesturePath.GesturePath(100); try { @@ -585,7 +585,7 @@ For details about the error codes, see [Accessibility Error Codes](../errorcodes **Example** ```ts -import GesturePath from "@ohos.accessibility.GesturePath"; +import GesturePath from '@ohos.accessibility.GesturePath'; import GesturePoint from '@ohos.accessibility.GesturePoint'; let gesturePath = new GesturePath.GesturePath(100); try { diff --git a/en/application-dev/reference/apis/js-apis-inner-application-appStateData.md b/en/application-dev/reference/apis/js-apis-inner-application-appStateData.md index c281c62ff040c74bdc84def40b9db824ce95492a..08909d57aaf7557b88b3c8e7c34fb24ca9333a75 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-appStateData.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-appStateData.md @@ -4,32 +4,24 @@ The **AppStateData** module defines the application state data, which can be obt **System capability**: SystemCapability.Ability.AbilityRuntime.Core -**System API**: This module is marked as @systemapi and not visible to third-party applications. +**System API**: This is a system API and cannot be called by third-party applications. | Name | Type | Mandatory | Description | | ------------------------- | ------ | ---- | --------- | | bundleName8+ | string | No | Bundle name.| | uid8+ | number | No | UID of the application. | -| state8+ | number | No | Application state.
**0**: The application is being initialized.
**1**: The application has been initialized and is ready.
**2**: The application is running in the foreground.
**3**: The application is having the focus. (This state is reserved.)
**4**: The application is running in the background.
**5**: The application has exited.| +| state8+ | number | No | Application state.| **Example** - ```ts -import appManager from "@ohos.app.ability.appManager" +import appManager from "@ohos.application.appManager"; -function getForegroundAppInfos() { - appManager.getForegroundApplications((error, data) => { - if (error && error.code) { - console.log('getForegroundApplications failed, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); - return; - } - for (let i = 0; i < data.length; i++) { - let appStateData = data[i]; - console.log('appStateData.bundleName: ' + appStateData.bundleName); - console.log('appStateData.uid: ' + appStateData.uid); - console.log('appStateData.state: ' + appStateData.state); - } - }); -} +appManager.getForegroundApplications((error, data) => { + for (let i = 0; i < data.length; i++) { + let appStateData = data[i]; + console.info('appStateData.bundleName: ' + appStateData.bundleName); + console.info('appStateData.uid: ' + appStateData.uid); + console.info('appStateData.state: ' + appStateData.state); + } +}); ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-applicationContext.md b/en/application-dev/reference/apis/js-apis-inner-application-applicationContext.md index 73b2a329f018d64bf93ac8f64ece86792e4eff59..c5a1d36e8abd645fbb7d9db63982b0babfe7c980 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-applicationContext.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-applicationContext.md @@ -15,9 +15,9 @@ Before calling any APIs in **ApplicationContext**, obtain an **ApplicationContex let applicationContext = this.context.getApplicationContext(); ``` -## ApplicationContext.registerAbilityLifecycleCallback +## ApplicationContext.on(type: 'abilityLifecycle', callback: AbilityLifecycleCallback) -registerAbilityLifecycleCallback(callback: AbilityLifecycleCallback): **number**; +on(type: 'abilityLifecycle', callback: AbilityLifecycleCallback): **number**; Registers a listener to monitor the ability lifecycle of the application. @@ -27,6 +27,7 @@ Registers a listener to monitor the ability lifecycle of the application. | Name | Type | Mandatory| Description | | ------------------------ | -------- | ---- | ------------------------------ | +| type | 'abilityLifecycle' | Yes | Event type.| | callback | [AbilityLifecycleCallback](js-apis-app-ability-abilityLifecycleCallback.md) | Yes | Callback used to return the ID of the registered listener.| **Return value** @@ -40,56 +41,56 @@ Registers a listener to monitor the ability lifecycle of the application. ```ts import UIAbility from '@ohos.app.ability.UIAbility'; -var lifecycleId; +let lifecycleId; export default class EntryAbility extends UIAbility { onCreate() { - console.log("MyAbility onCreate") + console.log('MyAbility onCreate'); let AbilityLifecycleCallback = { onAbilityCreate(ability) { - console.log("AbilityLifecycleCallback onAbilityCreate ability:" + JSON.stringify(ability)); + console.log('AbilityLifecycleCallback onAbilityCreate ability:' + ability); }, onWindowStageCreate(ability, windowStage) { - console.log("AbilityLifecycleCallback onWindowStageCreate ability:" + JSON.stringify(ability)); - console.log("AbilityLifecycleCallback onWindowStageCreate windowStage:" + JSON.stringify(windowStage)); + console.log('AbilityLifecycleCallback onWindowStageCreate ability:' + ability); + console.log('AbilityLifecycleCallback onWindowStageCreate windowStage:' + windowStage); }, onWindowStageActive(ability, windowStage) { - console.log("AbilityLifecycleCallback onWindowStageActive ability:" + JSON.stringify(ability)); - console.log("AbilityLifecycleCallback onWindowStageActive windowStage:" + JSON.stringify(windowStage)); + console.log('AbilityLifecycleCallback onWindowStageActive ability:' + ability); + console.log('AbilityLifecycleCallback onWindowStageActive windowStage:' + windowStage); }, onWindowStageInactive(ability, windowStage) { - console.log("AbilityLifecycleCallback onWindowStageInactive ability:" + JSON.stringify(ability)); - console.log("AbilityLifecycleCallback onWindowStageInactive windowStage:" + JSON.stringify(windowStage)); + console.log('AbilityLifecycleCallback onWindowStageInactive ability:' + ability); + console.log('AbilityLifecycleCallback onWindowStageInactive windowStage:' + windowStage); }, onWindowStageDestroy(ability, windowStage) { - console.log("AbilityLifecycleCallback onWindowStageDestroy ability:" + JSON.stringify(ability)); - console.log("AbilityLifecycleCallback onWindowStageDestroy windowStage:" + JSON.stringify(windowStage)); + console.log('AbilityLifecycleCallback onWindowStageDestroy ability:' + ability); + console.log('AbilityLifecycleCallback onWindowStageDestroy windowStage:' + windowStage); }, onAbilityDestroy(ability) { - console.log("AbilityLifecycleCallback onAbilityDestroy ability:" + JSON.stringify(ability)); + console.log('AbilityLifecycleCallback onAbilityDestroy ability:' + ability); }, onAbilityForeground(ability) { - console.log("AbilityLifecycleCallback onAbilityForeground ability:" + JSON.stringify(ability)); + console.log('AbilityLifecycleCallback onAbilityForeground ability:' + ability); }, onAbilityBackground(ability) { - console.log("AbilityLifecycleCallback onAbilityBackground ability:" + JSON.stringify(ability)); + console.log('AbilityLifecycleCallback onAbilityBackground ability:' + ability); }, onAbilityContinue(ability) { - console.log("AbilityLifecycleCallback onAbilityContinue ability:" + JSON.stringify(ability)); + console.log('AbilityLifecycleCallback onAbilityContinue ability:' + ability); } } // 1. Obtain applicationContext through the context attribute. let applicationContext = this.context.getApplicationContext(); // 2. Use applicationContext to register a listener for the ability lifecycle in the application. - lifecycleId = applicationContext.registerAbilityLifecycleCallback(AbilityLifecycleCallback); - console.log("registerAbilityLifecycleCallback number: " + JSON.stringify(lifecycleId)); + lifecycleId = applicationContext.on('abilityLifecycle', AbilityLifecycleCallback); + console.log('registerAbilityLifecycleCallback number: ' + JSON.stringify(lifecycleId)); } } ``` -## ApplicationContext.unregisterAbilityLifecycleCallback +## ApplicationContext.off(type: 'abilityLifecycle', callbackId: number, callback: AsyncCallback) -unregisterAbilityLifecycleCallback(callbackId: **number**, callback: AsyncCallback<**void**>): **void**; +off(type: 'abilityLifecycle', callbackId: **number**, callback: AsyncCallback<**void**>): **void**; Deregisters the listener that monitors the ability lifecycle of the application. @@ -99,6 +100,7 @@ Deregisters the listener that monitors the ability lifecycle of the application. | Name | Type | Mandatory| Description | | ------------- | -------- | ---- | -------------------------- | +| type | 'abilityLifecycle' | Yes | Event type.| | callbackId | number | Yes | ID of the listener to deregister.| | callback | AsyncCallback\ | Yes | Callback used to return the result. | @@ -107,22 +109,53 @@ Deregisters the listener that monitors the ability lifecycle of the application. ```ts import UIAbility from '@ohos.app.ability.UIAbility'; -var lifecycleId; +let lifecycleId; export default class EntryAbility extends UIAbility { onDestroy() { let applicationContext = this.context.getApplicationContext(); - console.log("stage applicationContext: " + JSON.stringify(applicationContext)); - applicationContext.unregisterAbilityLifecycleCallback(lifecycleId, (error, data) => { - console.log("unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error)); + console.log('stage applicationContext: ' + applicationContext); + applicationContext.off(type: 'abilityLifecycle', lifecycleId, (error, data) => { + console.log('unregisterAbilityLifecycleCallback success, err: ' + JSON.stringify(error)); }); } } ``` -## ApplicationContext.registerEnvironmentCallback +## ApplicationContext.off(type: 'abilityLifecycle', callbackId: number) -registerEnvironmentCallback(callback: EnvironmentCallback): **number**; +off(type: 'abilityLifecycle', callbackId: **number**): **void**; + +Deregisters the listener that monitors the ability lifecycle of the application. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------------- | -------- | ---- | -------------------------- | +| type | 'abilityLifecycle' | Yes | Event type.| +| callbackId | number | Yes | ID of the listener to deregister.| + +**Example** + +```ts +import Ability from '@ohos.app.ability.UIAbility'; + +let lifecycleId; + +export default class MyAbility extends Ability { + onDestroy() { + let applicationContext = this.context.getApplicationContext(); + console.log('stage applicationContext: ' + applicationContext); + applicationContext.off(type: 'abilityLifecycle', lifecycleId); + } +} +``` + +## ApplicationContext.on(type: 'environment', callback: EnvironmentCallback) + +on(type: 'environment', callback: EnvironmentCallback): **number**; Registers a listener for system environment changes. This API uses an asynchronous callback to return the result. @@ -132,6 +165,7 @@ Registers a listener for system environment changes. This API uses an asynchrono | Name | Type | Mandatory| Description | | ------------------------ | -------- | ---- | ------------------------------ | +| type | 'environment' | Yes | Event type.| | callback | [EnvironmentCallback](js-apis-app-ability-environmentCallback.md) | Yes | Callback used to return the ID of the registered listener.| **Return value** @@ -145,32 +179,32 @@ Registers a listener for system environment changes. This API uses an asynchrono ```ts import UIAbility from '@ohos.app.ability.UIAbility'; -var callbackId; +let callbackId; export default class EntryAbility extends UIAbility { onCreate() { - console.log("MyAbility onCreate") + console.log('MyAbility onCreate') globalThis.applicationContext = this.context.getApplicationContext(); let EnvironmentCallback = { onConfigurationUpdated(config){ - console.log("onConfigurationUpdated config:" + JSON.stringify(config)); + console.log('onConfigurationUpdated config:' + JSON.stringify(config)); }, onMemoryLevel(level){ - console.log("onMemoryLevel level:" + level); + console.log('onMemoryLevel level:' + level); } } // 1. Obtain an applicationContext object. let applicationContext = globalThis.applicationContext; // 2. Use applicationContext to register a listener for the ability lifecycle in the application. - callbackId = applicationContext.registerEnvironmentCallback(EnvironmentCallback); - console.log("registerEnvironmentCallback number: " + JSON.stringify(callbackId)); + callbackId = applicationContext.on('environment', EnvironmentCallback); + console.log('registerEnvironmentCallback number: ' + JSON.stringify(callbackId)); } } ``` -## ApplicationContext.unregisterEnvironmentCallback +## ApplicationContext.off(type: 'environment', callbackId: number, callback: AsyncCallback) -unregisterEnvironmentCallback(callbackId: **number**, callback: AsyncCallback<**void**>): **void**; +off(type: 'environment', callbackId: **number**, callback: AsyncCallback<**void**>): **void**; Deregisters the listener for system environment changes. This API uses an asynchronous callback to return the result. @@ -180,6 +214,7 @@ Deregisters the listener for system environment changes. This API uses an asynch | Name | Type | Mandatory| Description | | ------------- | -------- | ---- | -------------------------- | +| type | 'environment' | Yes | Event type.| | callbackId | number | Yes | ID of the listener to deregister. | | callback | AsyncCallback\ | Yes | Callback used to return the result. | @@ -188,14 +223,154 @@ Deregisters the listener for system environment changes. This API uses an asynch ```ts import UIAbility from '@ohos.app.ability.UIAbility'; -var callbackId; +let callbackId; export default class EntryAbility extends UIAbility { onDestroy() { let applicationContext = this.context.getApplicationContext(); - applicationContext.unregisterEnvironmentCallback(callbackId, (error, data) => { - console.log("unregisterEnvironmentCallback success, err: " + JSON.stringify(error)); + applicationContext.off('environment', callbackId, (error, data) => { + console.log('unregisterEnvironmentCallback success, err: ' + JSON.stringify(error)); }); } } ``` + +## ApplicationContext.off(type: 'environment', callbackId: number) + +off(type: 'environment', callbackId: **number**, callback: AsyncCallback<**void**>): **void**; + +Deregisters the listener for system environment changes. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------------- | -------- | ---- | -------------------------- | +| type | 'environment' | Yes | Event type.| +| callbackId | number | Yes | ID of the listener to deregister. | + +**Example** + +```ts +import Ability from '@ohos.app.ability.UIAbility'; + +let callbackId; + +export default class MyAbility extends Ability { + onDestroy() { + let applicationContext = this.context.getApplicationContext(); + applicationContext.off('environment', callbackId); + } +} +``` + +## ApplicationContext.getRunningProcessInformation9+ + +getRunningProcessInformation(): Promise\>; + +Obtains information about the running processes. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.GET_RUNNING_INFO + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**System API**: This is a system API and cannot be called by third-party applications. + +**Return value** + +| Type| Description| +| -------- | -------- | +| Promise\> | Promise used to return the API call result and the process running information. You can perform error handling or custom processing in this callback.| + +**Example** + +```ts +let applicationContext = this.context.getApplicationContext(); +applicationContext.getRunningProcessInformation().then((data) => { + console.log('The process running information is:' + JSON.stringify(data)); +}).catch((error) => { + console.log('error:' + JSON.stringify(error)); +}); +``` + +## ApplicationContext.getRunningProcessInformation9+ + +getRunningProcessInformation(callback: AsyncCallback\>): void; + +Obtains information about the running processes. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.GET_RUNNING_INFO + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**System API**: This is a system API and cannot be called by third-party applications. + +**Return value** + +| Type| Description| +| -------- | -------- | +|AsyncCallback\> | Callback used to return the API call result and the process running information. You can perform error handling or custom processing in this callback.| + +**Example** + +```ts +let applicationContext = this.context.getApplicationContext(); +applicationContext.getRunningProcessInformation((err, data) => { + if (err.code !== 0) { + console.error('getRunningProcessInformation faile, err: ' + JSON.stringify(err)); + } else { + console.log('The process running information is:' + JSON.stringify(data)); + } +}) +``` + +## ApplicationContext.killProcessesBySelf9+ + +killProcessesBySelf(): Promise; + +Kills all the processes where the application is located. This API uses a promise to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Return value** + +| Type| Description| +| -------- | -------- | +| Promise\> | Promise used to return the result.| + +**Example** + +```ts +let applicationContext = this.context.getApplicationContext(); +applicationContext.killProcessesBySelf().then((data) => { + console.log('The process running information is:' + JSON.stringify(data)); +}).catch((error) => { + console.error('error:' + JSON.stringify(error)); +}); +``` + +## ApplicationContext.killProcessesBySelf9+ + +killProcessesBySelf(callback: AsyncCallback); + +Kills all the processes where the application is located. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Return value** + +| Type| Description| +| -------- | -------- | +|AsyncCallback\ | Callback used to return the result.| + +**Example** + +```ts +let applicationContext = this.context.getApplicationContext(); +applicationContext.killProcessesBySelf(err => { + if (err.code !== 0) { + console.error('killProcessesBySelf faile, err: ' + JSON.stringify(err)); + } +}) +``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-applicationStateObserver.md b/en/application-dev/reference/apis/js-apis-inner-application-applicationStateObserver.md index e6d3137582ee3b485e4a342a4a5a3b6b5473ed32..baa8975bb76e62b6aea7bb4dac067a46b6dbc8bd 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-applicationStateObserver.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-applicationStateObserver.md @@ -16,7 +16,7 @@ The **ApplicationStateObserver** module defines an observer to listen for applic **Example** ```ts -import appManager from "@ohos.application.appManager" +import appManager from "@ohos.application.appManager"; let applicationStateObserver = { onForegroundApplicationChanged(appStateData) { @@ -34,6 +34,6 @@ let applicationStateObserver = { onProcessStateChanged(processData) { console.log('onProcessStateChanged onProcessStateChanged: ' + JSON.stringify(processData)); } -} +}; let observerCode = appManager.registerApplicationStateObserver(applicationStateObserver); ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-baseContext.md b/en/application-dev/reference/apis/js-apis-inner-application-baseContext.md index 3c0e5e3806181cbff0492cfe4faa387f315e516b..208e363227aaf20c6bac05ab0b6837ea74656adb 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-baseContext.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-baseContext.md @@ -19,10 +19,10 @@ Take the stage model as an example. You can access the **stageMode** field throu ```ts import UIAbility from '@ohos.app.ability.UIAbility'; -class EntryAbility extends UIAbility { +class MainAbility extends UIAbility { onCreate(want, launchParam) { - // EntryAbility onCreate, isStageMode: true - console.log("EntryAbility onCreate, isStageMode: " + this.context.stageMode); + // MainAbility onCreate, isStageMode: true + console.log('MainAbility onCreate, isStageMode: ' + this.context.stageMode); } } ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-context.md b/en/application-dev/reference/apis/js-apis-inner-application-context.md index 068ec63b234762aa017a03a6ba40ceb84038b170..339eb62bd54fb97a121081b5691a6166c643a022 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-context.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-context.md @@ -49,7 +49,7 @@ Creates the context based on the bundle name. **Example** ```ts -let bundleContext = this.context.createBundleContext("com.example.test"); +let bundleContext = this.context.createBundleContext('com.example.test'); ``` ## Context.createModuleContext @@ -75,9 +75,11 @@ Creates the context based on the module name. **Example** ```ts -let moduleContext = this.context.createModuleContext("entry"); +let moduleContext = this.context.createModuleContext('entry'); ``` +## Context.createModuleContext + createModuleContext(bundleName: string, moduleName: string): Context; Creates the context based on the bundle name and module name. @@ -100,7 +102,7 @@ Creates the context based on the bundle name and module name. **Example** ```ts -let moduleContext = this.context.createModuleContext("com.example.test", "entry"); +let moduleContext = this.context.createModuleContext('com.example.test', 'entry'); ``` ## Context.getApplicationContext diff --git a/en/application-dev/reference/apis/js-apis-inner-application-continueCallback.md b/en/application-dev/reference/apis/js-apis-inner-application-continueCallback.md index b67c612c1b3b6dd82537b6dd5e6e7fcad2d6bdcb..03d9db491f12e36244dd83828e66380fda2ecafd 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-continueCallback.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-continueCallback.md @@ -2,32 +2,24 @@ The **ContinueCallback** module defines the callback function that indicates the result of mission continuation. For details about mission continuation, see [continueMission](js-apis-distributedMissionManager.md#distributedmissionmanagercontinuemission). -## ContinueCallback.onContinueDone - -onContinueDone(result: number): void; - -Called when the mission continuation is complete. - **System capability**: SystemCapability.Ability.AbilityRuntime.Mission -**Parameters** - - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | result | number | No| Mission continuation result.| +| Name | Type | Readable | Writable | Description | +| --------------------- | -------- | ---- | ---- | ------------------ | +| onContinueDone | function | Yes | No | Mission continuation result. | **Example** ```ts - import distributedMissionManager from '@ohos.distributedMissionManager' + import distributedMissionManager from '@ohos.distributedMissionManager'; let continueDeviceInfo = { - srcDeviceId: "123", - dstDeviceId: "456", - missionId: 123, - wantParam: { - "key":"value" - } + srcDeviceId: '123', + dstDeviceId: '456', + missionId: 123, + wantParam: { + 'key':'value' + } }; let continueCallback = { @@ -37,10 +29,9 @@ Called when the mission continuation is complete. }; distributedMissionManager.continueMission(continueDeviceInfo, continueCallback, (error) => { - if (error && error.code) { - console.log('continueMission failed, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); - } - console.log('continueMission finished'); + if (error.code != 0) { + console.error('continueMission failed, cause: ' + JSON.stringify(error)) + } + console.info('continueMission finished') }) ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-continueDeviceInfo.md b/en/application-dev/reference/apis/js-apis-inner-application-continueDeviceInfo.md index 5582132e3f610a76175cbb73796b6283498c4395..06f98fe304de1d9474123995ad9c8e384640532d 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-continueDeviceInfo.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-continueDeviceInfo.md @@ -14,15 +14,15 @@ The **ContinueDeviceInfo** module defines the parameters required for initiating **Example** ```ts - import distributedMissionManager from '@ohos.distributedMissionManager' + import distributedMissionManager from '@ohos.distributedMissionManager'; let continueDeviceInfo = { - srcDeviceId: "123", - dstDeviceId: "456", - missionId: 123, - wantParam: { - "key":"value" - } + srcDeviceId: '123', + dstDeviceId: '456', + missionId: 123, + wantParam: { + 'key':'value' + } }; let continueCallback = { @@ -32,10 +32,9 @@ The **ContinueDeviceInfo** module defines the parameters required for initiating }; distributedMissionManager.continueMission(continueDeviceInfo, continueCallback, (error) => { - if (error && error.code) { - console.log('continueMission failed, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); - } - console.log('continueMission finished'); + if (error.code != 0) { + console.error('continueMission failed, cause: ' + JSON.stringify(error)) + } + console.info('continueMission finished') }) ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-errorObserver.md b/en/application-dev/reference/apis/js-apis-inner-application-errorObserver.md index 271f2697803dde9d0b3f78c3bb661a03d925b95e..9ee22f675c5ce1430ab9d33bc2577f9e1b3fd27f 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-errorObserver.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-errorObserver.md @@ -1,8 +1,8 @@ # ErrorObserver -The **ErrorObserver** module defines an observer to listen for application errors. It can be used as an input parameter in [ErrorManager.on](js-apis-app-ability-errorManager.md#errormanageron) to listen for errors that occur in the current application. +The **ErrorObserver** module defines an observer to listen for application errors. It can be used as an input parameter in [registerErrorObserver](js-apis-application-errorManager.md#errormanagerregistererrorobserver) to listen for errors that occur in the current application. -## ErrorObserver.onUnhandledException +## onUnhandledException onUnhandledException(errMsg: string): void; @@ -19,18 +19,12 @@ Called when an unhandled exception occurs in the JS runtime. **Example** ```ts -import errorManager from '@ohos.app.ability.errorManager' +import errorManager from '@ohos.application.errorManager'; let observer = { onUnhandledException(errorMsg) { - console.log('HXW onUnhandledException, errorMsg: ', errorMsg); + console.log('onUnhandledException, errorMsg: ' + JSON.stringify(errorMsg)); } -} - -try { - errorManager.on("error", observer); -} catch (error) { - console.log('registerErrorObserver' + ' failed, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); -} +}; +errorManager.registerErrorObserver(observer); ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-eventHub.md b/en/application-dev/reference/apis/js-apis-inner-application-eventHub.md index 8b580177c7622b33b0d2c06749a928e825ae84bc..a5939795a24ba0314109b81018b4e93d381334e6 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-eventHub.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-eventHub.md @@ -9,18 +9,16 @@ The **EventHub** module provides APIs to subscribe to, unsubscribe from, and tri ## Usage -Before using any APIs in the **EventHub**, you must obtain an **EventHub** instance through the member variable **context** of the **UIAbility** instance. +Before using any APIs in the **EventHub**, you must obtain an **EventHub** instance through the member variable **context** of the **Ability** instance. ```ts -import UIAbility from '@ohos.app.ability.UIAbility'; - -export default class EntryAbility extends UIAbility { - eventFunc(){ - console.log("eventFunc is called"); +import Ability from '@ohos.application.Ability'; +export default class MainAbility extends Ability { + func1(){ + console.log('func1 is called'); } - onForeground() { - this.context.eventHub.on("myEvent", this.eventFunc); + this.context.eventHub.on('123', this.func1); } } ``` @@ -41,36 +39,33 @@ Subscribes to an event. | callback | Function | Yes| Callback invoked when the event is triggered.| **Example** + + ```ts + import Ability from '@ohos.application.Ability'; + + export default class MainAbility extends Ability { + onForeground() { + this.context.eventHub.on('123', this.func1); + this.context.eventHub.on('123', () => { + console.log('call anonymous func 1'); + }); + // Result + // func1 is called + // call anonymous func 1 + this.context.eventHub.emit('123'); + } + func1() { + console.log('func1 is called'); + } + } + ``` -```ts -import UIAbility from '@ohos.app.ability.UIAbility'; - -export default class EntryAbility extends UIAbility { - onForeground() { - this.context.eventHub.on("myEvent", this.eventFunc); - // Anonymous functions can be used to subscribe to events. - this.context.eventHub.on("myEvent", () => { - console.log("call anonymous eventFunc"); - }); - // Result - // eventFunc is called - // call anonymous eventFunc - this.context.eventHub.emit("myEvent"); - } - - eventFunc() { - console.log("eventFunc is called"); - } -} -``` ## EventHub.off off(event: string, callback?: Function): void; -Unsubscribes from an event. - - If **callback** is specified, this API unsubscribes from the given event with the specified callback. - - If **callback** is not specified, this API unsubscribes from the given event with all callbacks. +Unsubscribes from an event. **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -82,28 +77,27 @@ Unsubscribes from an event. | callback | Function | No| Callback for the event. If **callback** is unspecified, the given event with all callbacks is unsubscribed.| **Example** + + ```ts + import Ability from '@ohos.application.Ability'; + + export default class MainAbility extends Ability { + onForeground() { + this.context.eventHub.on('123', this.func1); + this.context.eventHub.off('123', this.func1); // Unsubscribe from the myEvent event with the callback eventFunc1. + this.context.eventHub.on('123', this.func1); + this.context.eventHub.on('123', this.func2); + this.context.eventHub.off('123'); // Unsubscribe from the myEvent event with all the callbacks (eventFunc1 and eventFunc2). + } + func1() { + console.log('func1 is called'); + } + func2() { + console.log('func2 is called'); + } + } + ``` -```ts -import UIAbility from '@ohos.app.ability.UIAbility'; - -export default class EntryAbility extends UIAbility { - onForeground() { - this.context.eventHub.on("myEvent", this.eventFunc1); - this.context.eventHub.off("myEvent", this.eventFunc1); // Unsubscribe from the myEvent event with the callback eventFunc1. - this.context.eventHub.on("myEvent", this.eventFunc1); - this.context.eventHub.on("myEvent", this.eventFunc2); - this.context.eventHub.off("myEvent"); // Unsubscribe from the myEvent event with all the callbacks (eventFunc1 and eventFunc2). - } - - eventFunc1() { - console.log("eventFunc1 is called"); - } - - eventFunc2() { - console.log("eventFunc2 is called"); - } -} -``` ## EventHub.emit @@ -121,26 +115,25 @@ Triggers an event. | ...args | Object[] | Yes| Variable parameters, which are passed to the callback when the event is triggered.| **Example** - -```ts -import UIAbility from '@ohos.app.ability.UIAbility'; - -export default class EntryAbility extends UIAbility { - onForeground() { - this.context.eventHub.on("myEvent", this.eventFunc); - // Result - // eventFunc is called,undefined,undefined - this.context.eventHub.emit("myEvent"); - // Result - // eventFunc is called,1,undefined - this.context.eventHub.emit("myEvent", 1); - // Result - // eventFunc is called,1,2 - this.context.eventHub.emit("myEvent", 1, 2); - } - - eventFunc(argOne, argTwo) { - console.log("eventFunc is called," + argOne + "," + argTwo); - } -} -``` + + ```ts + import Ability from '@ohos.application.Ability'; + + export default class MainAbility extends Ability { + onForeground() { + this.context.eventHub.on('123', this.func1); + // Result + // func1 is called,undefined,undefined + this.context.eventHub.emit('123'); + // Result + // func1 is called,1,undefined + this.context.eventHub.emit('123', 1); + // Result + // func1 is called,1,2 + this.context.eventHub.emit('123', 1, 2); + } + func1(a, b) { + console.log('func1 is called,' + a + ',' + b); + } + } + ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-extensionContext.md b/en/application-dev/reference/apis/js-apis-inner-application-extensionContext.md index a855d9577c9ef364caa7436a89983ca58d320d3c..ce0a916f3c17e8aeb02955b96d32d5ed50e2105f 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-extensionContext.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-extensionContext.md @@ -31,8 +31,8 @@ To adapt to devices with different performance, an application provides three mo Define a **ServiceExtension** with the same name for the three modules. ```ts -import ServiceExtension from '@ohos.app.ability.ServiceExtensionAbility' -import Want from '@ohos.application.Want' +import ServiceExtension from '@ohos.app.ability.ServiceExtensionAbility'; +import Want from '@ohos.application.Want'; export default class TheServiceExtension extends ServiceExtension { onCreate(want:Want) { console.log('ServiceAbility onCreate, want: ' + want.abilityName); @@ -61,15 +61,14 @@ export default class TheServiceExtension extends ServiceExtension { Start **ServiceExtension** within the **onCreate** callback of the main ability of the entry. ```ts -import UIAbility from '@ohos.app.ability.UIAbility'; - -export default class EntryAbility extends UIAbility { +import Ability from '@ohos.app.ability.Ability'; +export default class MainAbility extends Ability { onCreate(want, launchParam) { - console.log("[Demo] EntryAbility onCreate"); + console.log('[Demo] MainAbility onCreate'); let wantExt = { - deviceId: "", - bundleName: "com.example.TheServiceExtension", - abilityName: "TheServiceExtension", + deviceId: '', + bundleName: 'com.example.TheServiceExtension', + abilityName: 'TheServiceExtension', }; this.context.startServiceExtensionAbility(wantExt); } @@ -84,29 +83,29 @@ export default class ServiceModel { constructor() {} executeTask() { - if (globalThis.ExtensionContext == undefined) { - console.log("ERROR, ServiceExtension does not exist"); + if (globalThis.ExtensionContext === undefined) { + console.log('ERROR, ServiceExtension does not exist'); return; } - var moduleInfo = globalThis.ExtensionContext.currentHapModuleInfo; + let moduleInfo = globalThis.ExtensionContext.currentHapModuleInfo; this.moduleName = moduleInfo.name; // Execute service logic based on the module name, which differentiates devices with different performance. switch (this.moduleName) { - case "highPerformance": - console.log("This is high performance device."); + case 'highPerformance': + console.log('This is high performance device.'); // Execute the corresponding service logic. break; - case "midPerformance": - console.log("This is mid performance device."); + case 'midPerformance': + console.log('This is mid performance device.'); // Execute the corresponding service logic. break; - case "lowPerformance": - console.log("This is low performance device."); + case 'lowPerformance': + console.log('This is low performance device.'); // Execute the corresponding service logic. break; default: - console.log("ERROR, invalid moduleName."); + console.log('ERROR, invalid moduleName.'); break; } } diff --git a/en/application-dev/reference/apis/js-apis-inner-application-extensionRunningInfo.md b/en/application-dev/reference/apis/js-apis-inner-application-extensionRunningInfo.md index 9485de9efd0dc76d78a905725fb742225b50340f..8121aeba926224edc8bedf7864c943920624596d 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-extensionRunningInfo.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-extensionRunningInfo.md @@ -5,7 +5,7 @@ The **ExtensionRunningInfo** module encapsulates ExtensionAbility running inform > **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. -> - This module is marked as @systemapi and not visible to third-party applications. +> - The APIs of this module are system APIs and cannot be called by third-party applications. ## Usage @@ -17,37 +17,29 @@ Import the **abilityManager** module and obtain the ExtensionAbility running inf | Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | -| extension | [ElementName](js-apis-bundleManager-elementName.md) | Yes| No| ExtensionAbility information.| +| extension | ElementName | Yes| No| ExtensionAbility information.| | pid | number | Yes| No| Process ID.| | uid | number | Yes| No| UID of the application.| | processName | string | Yes| No| Process name.| | startTime | number | Yes| No| Timestamp when the ExtensionAbility is started.| | clientPackage | Array<String> | Yes| No| Names of all packages in the process.| -| type | [ExtensionAbilityType](js-apis-bundleManager.md#extensionabilitytype) | Yes| No| ExtensionAbility type.| +| type | [bundle.ExtensionAbilityType](js-apis-Bundle.md) | Yes| No| ExtensionAbility type.| **Example** ```ts -import abilityManager from '@ohos.app.ability.abilityManager' - -var upperLimit = 1; -function getExtensionInfos() { - abilityManager.getExtensionRunningInfos(upperLimit, (error, data) => { - if (error && error.code) { - console.log('getForegroundApplications failed, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); - return; - } - - for (let i = 0; i < data.length; i++) { - let extensionRunningInfo = data[i]; - console.log("extensionRunningInfo.extension: " + JSON.stringify(extensionRunningInfo.extension)); - console.log("extensionRunningInfo.pid: " + JSON.stringify(extensionRunningInfo.pid)); - console.log("extensionRunningInfo.uid: " + JSON.stringify(extensionRunningInfo.uid)); - console.log("extensionRunningInfo.processName: " + JSON.stringify(extensionRunningInfo.processName)); - console.log("extensionRunningInfo.startTime: " + JSON.stringify(extensionRunningInfo.startTime)); - console.log("extensionRunningInfo.clientPackage: " + JSON.stringify(extensionRunningInfo.clientPackage)); - console.log("extensionRunningInfo.type: " + JSON.stringify(extensionRunningInfo.type)); - } - }); -} +import abilityManager from '@ohos.application.abilityManager'; +let upperLimit = 1; +abilityManager.getExtensionRunningInfos(upperLimit, (err,data) => { + console.log('getExtensionRunningInfos err: ' + err + ' data: ' + JSON.stringify(data)); + for (let i = 0; i < data.length; i++) { + let extensionRunningInfo = data[i]; + console.log('extensionRunningInfo.extension: ' + JSON.stringify(extensionRunningInfo.extension)); + console.log('extensionRunningInfo.pid: ' + JSON.stringify(extensionRunningInfo.pid)); + console.log('extensionRunningInfo.uid: ' + JSON.stringify(extensionRunningInfo.uid)); + console.log('extensionRunningInfo.processName: ' + JSON.stringify(extensionRunningInfo.processName)); + console.log('extensionRunningInfo.startTime: ' + JSON.stringify(extensionRunningInfo.startTime)); + console.log('extensionRunningInfo.clientPackage: ' + JSON.stringify(extensionRunningInfo.clientPackage)); + console.log('extensionRunningInfo.type: ' + JSON.stringify(extensionRunningInfo.type)); + } +}); ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-formExtensionContext.md b/en/application-dev/reference/apis/js-apis-inner-application-formExtensionContext.md index d888ccdc51bef996937e9d2e6ef891980ffe457c..9444e1aae0fe77a44f5f453fe679864e2f24846f 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-formExtensionContext.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-formExtensionContext.md @@ -16,19 +16,18 @@ Before using the **ServiceExtensionContext** module, you must first obtain a **F ```ts import FormExtensionAbility from '@ohos.app.form.FormExtensionAbility'; import formBindingData from '@ohos.app.form.formBindingData'; - export default class MyFormExtensionAbility extends FormExtensionAbility { - onAddForm(want) { - let formContext = this.context; // Obtain a FormExtensionContext instance. - // ... - let dataObj1 = { - temperature: "11c", - "time": "11:00" - }; - let obj1 = formBindingData.createFormBindingData(dataObj1); - return obj1; - } -}; + onAddForm() { + let formContext = this.context; // ȡFormExtensionContext + // ... + let dataObj1 = { + temperature:'11c', + 'time':'11:00' + }; + let obj1 = formBindingData.createFormBindingData(dataObj1); + return obj1; + } +} ``` ## startAbility @@ -51,29 +50,23 @@ Starts an ability. This API uses an asynchronous callback to return the result. **Example** ```ts -import FormExtensionAbility from '@ohos.app.form.FormExtensionAbility'; - -export default class MyFormExtensionAbility extends FormExtensionAbility { - onFormEvent(formId, message) { - // Call startAbility() when the message event is triggered. - console.log('FormExtensionAbility onFormEvent, formId:' + formId + ", message:" + message); - let want = { - deviceId: "", - bundleName: "com.example.formstartability", - abilityName: "EntryAbility", - parameters: { - "message": message - } - }; - this.context.startAbility(want, (error, data) => { - if (error) { - console.log('FormExtensionContext startAbility, error:' + JSON.stringify(error)); - } else { - console.log('FormExtensionContext startAbility success'); - } - }); - } +let want = { + deviceId: '', + bundleName: 'com.example.formstartability', + abilityName: 'MainAbility', + action: 'action1', + entities: ['entity1'], + type: 'MIMETYPE', + uri: 'key={true,true,false}', + parameters: {} }; +this.context.startAbility(want, (error, data) => { + if (error) { + console.log('FormExtensionContext startAbility, error:' + JSON.stringify(error)); + } else { + console.log(`FormExtensionContext startAbility success`); + } +}); ``` ## startAbility @@ -96,30 +89,24 @@ Starts an ability. This API uses a promise to return the result. | Type | Description | | ------------ | ---------------------------------- | -| Promise<void> | Promise that returns no value.| +| Promise<void< | Promise that returns no value.| **Example** ```ts -import FormExtensionAbility from '@ohos.app.form.FormExtensionAbility'; - -export default class MyFormExtensionAbility extends FormExtensionAbility { - onFormEvent(formId, message) { - // Call startAbility() when the message event is triggered. - console.log('FormExtensionAbility onFormEvent, formId:' + formId + ", message:" + message); - let want = { - deviceId: "", - bundleName: "com.example.formstartability", - abilityName: "EntryAbility", - parameters: { - "message": message - } - }; - this.context.startAbility(want).then(() => { - console.info("StartAbility Success"); - }).catch((error) => { - console.info("StartAbility failed"); - }); - } +let want = { + deviceId: '', + bundleName: 'com.example.formstartability', + abilityName: 'MainAbility', + action: 'action1', + entities: ['entity1'], + type: 'MIMETYPE', + uri: 'key={true,true,false}', + parameters: {} }; +this.context.startAbility(want).then(() => { + console.info('StartAbility Success'); +}).catch((error) => { + console.info('StartAbility failed'); +}); ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-missionCallbacks.md b/en/application-dev/reference/apis/js-apis-inner-application-missionCallbacks.md index 7ccae03fa363d0850338d07f1318a377f10fc293..99005e97f90b0216c329fcaae2062d12adc1c026 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-missionCallbacks.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-missionCallbacks.md @@ -15,19 +15,19 @@ The **MissionCallback** module defines the callbacks invoked after synchronizati import distributedMissionManager from '@ohos.distributedMissionManager'; let missionDeviceInfo = { - deviceId: "123456" + deviceId: '123456' }; let missionCallback = { notifyMissionsChanged: function (deviceId) { - console.log("notifyMissionsChanged deviceId: " + JSON.stringify(deviceId)); + console.log('notifyMissionsChanged deviceId: ' + JSON.stringify(deviceId)); }, notifySnapshot: function (deviceId, mission) { - console.log("notifySnapshot deviceId: " + JSON.stringify(deviceId)); - console.log("notifySnapshot mission: " + JSON.stringify(mission)); + console.log('notifySnapshot deviceId: ' + JSON.stringify(deviceId)); + console.log('notifySnapshot mission: ' + JSON.stringify(mission)); }, notifyNetDisconnect: function (deviceId, state) { - console.log("notifyNetDisconnect deviceId: " + JSON.stringify(deviceId)); - console.log("notifyNetDisconnect state: " + JSON.stringify(state)); + console.log('notifyNetDisconnect deviceId: ' + JSON.stringify(deviceId)); + console.log('notifyNetDisconnect state: ' + JSON.stringify(state)); } }; distributedMissionManager.registerMissionListener(missionDeviceInfo, missionCallback); diff --git a/en/application-dev/reference/apis/js-apis-inner-application-missionDeviceInfo.md b/en/application-dev/reference/apis/js-apis-inner-application-missionDeviceInfo.md index 9157fc697346087895870a5bbd6e4a0368d6bde7..aa59e7a78842e43536274ae28b58c4df8b26f34b 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-missionDeviceInfo.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-missionDeviceInfo.md @@ -13,19 +13,19 @@ The **MissionDeviceInfo** module defines the parameters required for registering import distributedMissionManager from '@ohos.distributedMissionManager'; let missionDeviceInfo = { - deviceId: "123456" + deviceId: '123456' }; let missionCallback = { notifyMissionsChanged: function (deviceId) { - console.log("notifyMissionsChanged deviceId: " + JSON.stringify(deviceId)); + console.log('notifyMissionsChanged deviceId: ' + JSON.stringify(deviceId)); }, notifySnapshot: function (mission, deviceId) { - console.log("notifySnapshot mission: " + JSON.stringify(mission)); - console.log("notifySnapshot deviceId: " + JSON.stringify(deviceId)); + console.log('notifySnapshot mission: ' + JSON.stringify(mission)); + console.log('notifySnapshot deviceId: ' + JSON.stringify(deviceId)); }, notifyNetDisconnect: function (mission, state) { - console.log("notifyNetDisconnect mission: " + JSON.stringify(mission)); - console.log("notifyNetDisconnect state: " + JSON.stringify(state)); + console.log('notifyNetDisconnect mission: ' + JSON.stringify(mission)); + console.log('notifyNetDisconnect state: ' + JSON.stringify(state)); } }; distributedMissionManager.registerMissionListener(missionDeviceInfo, missionCallback); diff --git a/en/application-dev/reference/apis/js-apis-inner-application-missionInfo.md b/en/application-dev/reference/apis/js-apis-inner-application-missionInfo.md index afefb70c5a3e0b0059e4712992c3f736516bc2f7..1aabfc19619a5e5c41f2fdf1d60dada4104f8868 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-missionInfo.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-missionInfo.md @@ -19,27 +19,16 @@ The **MissionInfo** module defines detailed information about a mission. The inf **Example** ```ts -import missionManager from '@ohos.app.ability.missionManager' +import missionManager from '@ohos.application.missionManager'; -try { - missionManager.getMissionInfo("", 1, (error, data) => { - if (error.code) { - // Process service logic errors. - console.log("getMissionInfo failed, error.code:" + JSON.stringify(error.code) + - "error.message:" + JSON.stringify(error.message)); - return; - } - - console.log('getMissionInfo missionId is:' + JSON.stringify(data.missionId)); - console.log('getMissionInfo runningState is:' + JSON.stringify(data.runningState)); - console.log('getMissionInfo lockedState is:' + JSON.stringify(data.lockedState)); - console.log('getMissionInfo timestamp is:' + JSON.stringify(data.timestamp)); - console.log('getMissionInfo want is:' + JSON.stringify(data.want)); - console.log('getMissionInfo label is:' + JSON.stringify(data.label)); - console.log('getMissionInfo iconPath is:' + JSON.stringify(data.iconPath)); - console.log('getMissionInfo continuable is:' + JSON.stringify(data.continuable)); - }); -} catch (paramError) { - console.log("error: " + paramError.code + ", " + paramError.message); -} +missionManager.getMissionInfo('12345', 1, (error, data) => { + console.info('getMissionInfo missionId is:' + JSON.stringify(data.missionId)); + console.info('getMissionInfo runningState is:' + JSON.stringify(data.runningState)); + console.info('getMissionInfo lockedState is:' + JSON.stringify(data.lockedState)); + console.info('getMissionInfo timestamp is:' + JSON.stringify(data.timestamp)); + console.info('getMissionInfo want is:' + JSON.stringify(data.want)); + console.info('getMissionInfo label is:' + JSON.stringify(data.label)); + console.info('getMissionInfo iconPath is:' + JSON.stringify(data.iconPath)); + console.info('getMissionInfo continuable is:' + JSON.stringify(data.continuable)); +}); ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-missionListener.md b/en/application-dev/reference/apis/js-apis-inner-application-missionListener.md index a9f9e6cf9540c02ada58ea7e89f76b9c9c297efb..3af1f92ce0ada364d0928af3ab85ef3d5b9cfdbc 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-missionListener.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-missionListener.md @@ -1,6 +1,6 @@ # MissionListener -The **MissionListener** module defines the listeners used to observe the mission status. The listeners can be registered by using [on](js-apis-app-ability-missionManager.md#missionmanageron). +The **MissionListener** module defines the listeners used to observe the mission status. The listeners can be registered by using [registerMissionListener](js-apis-application-missionManager.md#missionmanagerregistermissionlistener). **System capability**: SystemCapability.Ability.AbilityRuntime.Mission @@ -16,32 +16,27 @@ The **MissionListener** module defines the listeners used to observe the mission **Example** ```ts -import missionManager from '@ohos.app.ability.missionManager' +import missionManager from '@ohos.application.missionManager'; let listener = { onMissionCreated: function (mission) { - console.log("onMissionCreated mission: " + JSON.stringify(mission)); + console.log('onMissionCreated mission: ' + JSON.stringify(mission)); }, onMissionDestroyed: function (mission) { - console.log("onMissionDestroyed mission: " + JSON.stringify(mission)); + console.log('onMissionDestroyed mission: ' + JSON.stringify(mission)); }, onMissionSnapshotChanged: function (mission) { - console.log("onMissionSnapshotChanged mission: " + JSON.stringify(mission)); + console.log('onMissionSnapshotChanged mission: ' + JSON.stringify(mission)); }, onMissionMovedToFront: function (mission) { - console.log("onMissionMovedToFront mission: " + JSON.stringify(mission)); + console.log('onMissionMovedToFront mission: ' + JSON.stringify(mission)); }, onMissionIconUpdated: function (mission, icon) { - console.log("onMissionIconUpdated mission: " + JSON.stringify(mission)); + console.log('onMissionIconUpdated mission: ' + JSON.stringify(mission)); }, onMissionClosed: function (mission) { - console.log("onMissionClosed mission: " + JSON.stringify(mission)); + console.log('onMissionClosed mission: ' + JSON.stringify(mission)); } }; - -try { - let listenerId = missionManager.on("mission", listener); -} catch (paramError) { - console.log("error: " + paramError.code + ", " + paramError.message); -} +let listenerid = missionManager.registerMissionListener(listener); ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-missionParameter.md b/en/application-dev/reference/apis/js-apis-inner-application-missionParameter.md index 9e2e2aa23a6589c0eb80075f8de60f65261e6903..e88556a10417f6f2ec824744c46ddf2c44f97460 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-missionParameter.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-missionParameter.md @@ -15,14 +15,14 @@ The **MissionParameter** module defines the parameters required for mission sync import distributedMissionManager from '@ohos.distributedMissionManager'; let missionParameter = { - deviceId: "123456", + deviceId: '123456', fixConflict: true, tag: 123 }; try { distributedMissionManager.startSyncRemoteMissions(missionParameter, (err, data) => { - console.log("startSyncRemoteMissions, data: " + JSON.stringify(data)); + console.log('startSyncRemoteMissions, data: ' + JSON.stringify(data)); } ); } catch (err) { diff --git a/en/application-dev/reference/apis/js-apis-inner-application-missionSnapshot.md b/en/application-dev/reference/apis/js-apis-inner-application-missionSnapshot.md index a97f3b32b71f90078cb03f32fa46262f5cf6b770..cee807663fe7e45ceb04de308aecb90e18aacc2c 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-missionSnapshot.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-missionSnapshot.md @@ -20,33 +20,19 @@ The mission snapshot information can be obtained by using **getMissionSnapShot** **Example** ```ts - import ElementName from '@ohos.bundle'; - import image from '@ohos.multimedia.image'; - import missionManager from '@ohos.app.ability.missionManager'; - - try { - missionManager.getMissionInfos("", 10, (error, missions) => { - if (error.code) { - console.log("getMissionInfos failed, error.code:" + JSON.stringify(error.code) + - "error.message:" + JSON.stringify(error.message)); - return; - } - console.log("size = " + missions.length); - console.log("missions = " + JSON.stringify(missions)); - var id = missions[0].missionId; - - missionManager.getMissionSnapShot("", id, (err, snapshot) => { - if (err.code) { - console.log("getMissionInfos failed, err.code:" + JSON.stringify(err.code) + - "err.message:" + JSON.stringify(err.message)); - return; - } - - // Carry out normal service processing. - console.log("bundleName = " + snapshot.ability.bundleName); - }) - }) - } catch (paramError) { - console.log("error: " + paramError.code + ", " + paramError.message); - } +import ElementName from '@ohos.bundle'; +import image from '@ohos.multimedia.image'; +import missionManager from '@ohos.application.missionManager'; + +missionManager.getMissionInfos('', 10, (error, missions) => { + console.log('getMissionInfos is called, error.code = ' + error.code); + console.log('size = ' + missions.length); + console.log('missions = ' + JSON.stringify(missions)); + let id = missions[0].missionId; + + missionManager.getMissionSnapShot('', id, (error, snapshot) => { + console.log('getMissionSnapShot is called, error.code = ' + error.code); + console.log('bundleName = ' + snapshot.ability.bundleName); + }); +}); ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-processData.md b/en/application-dev/reference/apis/js-apis-inner-application-processData.md index c6e91944c5ed16800f3a2a7785de5a5e60dc623a..975a3df79987adb37119b2fee6f07fef93786be3 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-processData.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-processData.md @@ -13,11 +13,10 @@ The **ProcessData** module defines process data. If a lifecycle change listener | uid8+ | number | Yes | No | UID of the application. | | isContinuousTask9+ | boolean | Yes | No | Whether the task is a continuous task. The value **true** means that the task is a continuous task, and **false** means the opposite. | | isKeepAlive9+ | boolean | Yes | No | Whether the process is a resident task. The value **true** means that the process is a resident, and **false** means the opposite. | -| state9+ | number | Yes | No | Application state. The value can be **0** (newly created), **2** (foreground), **4** (background), or **5** (terminated). | **Example** ```ts -import appManager from '@ohos.application.appManager' +import appManager from '@ohos.application.appManager'; let applicationStateObserver = { onForegroundApplicationChanged(appStateData) { @@ -39,6 +38,6 @@ let applicationStateObserver = { console.log('onProcessStateChanged processData.isContinuousTask : ' + JSON.stringify(processData.isContinuousTask)); console.log('onProcessStateChanged processData.isKeepAlive : ' + JSON.stringify(processData.isKeepAlive)); } -} +}; let observerCode = appManager.registerApplicationStateObserver(applicationStateObserver); ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md b/en/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md index ae6beb1357d9d25dfcd06cbcd1d65df660fa44bb..d17c505d3f2566a75e5ba13b3f44c75e8179d5a1 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md @@ -17,7 +17,7 @@ Before using the **ServiceExtensionContext** module, you must define a child cla import ServiceExtensionAbility from '@ohos.app.ability.ServiceExtensionAbility'; let context = undefined; - class EntryAbility extends ServiceExtensionAbility { + class MainAbility extends ServiceExtensionAbility { onCreate() { context = this.context; // Obtain a ServiceExtensionContext instance. } @@ -68,9 +68,9 @@ Starts an ability. This API uses an asynchronous callback to return the result. **Example** ```ts - var want = { - bundleName: "com.example.myapp", - abilityName: "MyAbility" + let want = { + bundleName: 'com.example.myapp', + abilityName: 'MyAbility' }; try { @@ -141,11 +141,11 @@ Starts an ability. This API uses a promise to return the result. **Example** ```ts - var want = { - bundleName: "com.example.myapp", - abilityName: "MyAbility" + let want = { + bundleName: 'com.example.myapp', + abilityName: 'MyAbility' }; - var options = { + let options = { windowMode: 0, }; @@ -212,12 +212,12 @@ Starts an ability with the start options specified. This API uses an asynchronou **Example** ```ts - var want = { - deviceId: "", - bundleName: "com.example.myapplication", - abilityName: "EntryAbility" + let want = { + deviceId: '', + bundleName: 'com.extreme.test', + abilityName: 'MainAbility' }; - var options = { + let options = { windowMode: 0 }; @@ -247,7 +247,7 @@ Starts an ability with the account ID specified. This API uses an asynchronous c Observe the following when using this API: - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. + - If **visible** of the target ability is **false**, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - For details about the startup rules for the components in the stage model, see [Component Startup Rules (Stage Model)](../../application-models/component-startup-rules.md). **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -290,12 +290,12 @@ Observe the following when using this API: **Example** ```ts - var want = { - deviceId: "", - bundleName: "com.example.myapplication", - abilityName: "EntryAbility" + let want = { + deviceId: '', + bundleName: 'com.extreme.test', + abilityName: 'MainAbility' }; - var accountId = 100; + let accountId = 100; try { this.context.startAbilityWithAccount(want, accountId, (error) => { @@ -323,7 +323,7 @@ Starts an ability with the account ID and start options specified. This API uses Observe the following when using this API: - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. + - If **visible** of the target ability is **false**, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - For details about the startup rules for the components in the stage model, see [Component Startup Rules (Stage Model)](../../application-models/component-startup-rules.md). **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -367,13 +367,13 @@ Observe the following when using this API: **Example** ```ts - var want = { - deviceId: "", - bundleName: "com.example.myapplication", - abilityName: "EntryAbility" + let want = { + deviceId: '', + bundleName: 'com.extreme.test', + abilityName: 'MainAbility' }; - var accountId = 100; - var options = { + let accountId = 100; + let options = { windowMode: 0 }; @@ -404,7 +404,7 @@ Starts an ability with the account ID specified. This API uses a promise to retu Observe the following when using this API: - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. + - If **visible** of the target ability is **false**, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - For details about the startup rules for the components in the stage model, see [Component Startup Rules (Stage Model)](../../application-models/component-startup-rules.md). **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -453,13 +453,13 @@ Observe the following when using this API: **Example** ```ts - var want = { - deviceId: "", - bundleName: "com.example.myapplication", - abilityName: "EntryAbility" + let want = { + deviceId: '', + bundleName: 'com.extreme.test', + abilityName: 'MainAbility' }; - var accountId = 100; - var options = { + let accountId = 100; + let options = { windowMode: 0 }; @@ -518,10 +518,10 @@ Starts a new ServiceExtensionAbility. This API uses an asynchronous callback to **Example** ```ts - var want = { - deviceId: "", - bundleName: "com.example.myapplication", - abilityName: "EntryAbility" + let want = { + deviceId: '', + bundleName: 'com.extreme.test', + abilityName: 'MainAbility' }; try { @@ -584,10 +584,10 @@ Starts a new ServiceExtensionAbility. This API uses a promise to return the resu **Example** ```ts - var want = { - deviceId: "", - bundleName: "com.example.myapplication", - abilityName: "EntryAbility" + let want = { + deviceId: '', + bundleName: 'com.extreme.test', + abilityName: 'MainAbility' }; try { @@ -614,7 +614,7 @@ startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: Starts a new ServiceExtensionAbility with the account ID specified. This API uses an asynchronous callback to return the result. -**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (required only when the account ID is not the current user) +**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -650,12 +650,12 @@ Starts a new ServiceExtensionAbility with the account ID specified. This API use **Example** ```ts - var want = { - deviceId: "", - bundleName: "com.example.myapplication", - abilityName: "EntryAbility" + let want = { + deviceId: '', + bundleName: 'com.extreme.test', + abilityName: 'MainAbility' }; - var accountId = 100; + let accountId = 100; try { this.context.startServiceExtensionAbilityWithAccount(want, accountId, (error) => { @@ -681,7 +681,7 @@ startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise\ Starts a new ServiceExtensionAbility with the account ID specified. This API uses a promise to return the result. -**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (required only when the account ID is not the current user) +**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -721,12 +721,12 @@ Starts a new ServiceExtensionAbility with the account ID specified. This API use **Example** ```ts - var want = { - deviceId: "", - bundleName: "com.example.myapplication", - abilityName: "EntryAbility" + let want = { + deviceId: '', + bundleName: 'com.extreme.test', + abilityName: 'MainAbility' }; - var accountId = 100; + let accountId = 100; try { this.context.startServiceExtensionAbilityWithAccount(want, accountId) @@ -780,10 +780,10 @@ Stops a ServiceExtensionAbility in the same application. This API uses an asynch **Example** ```ts - var want = { - deviceId: "", - bundleName: "com.example.myapplication", - abilityName: "EntryAbility" + let want = { + deviceId: '', + bundleName: 'com.extreme.test', + abilityName: 'MainAbility' }; try { @@ -843,10 +843,10 @@ Stops a ServiceExtensionAbility in the same application. This API uses a promise **Example** ```ts - var want = { - deviceId: "", - bundleName: "com.example.myapplication", - abilityName: "EntryAbility" + let want = { + deviceId: '', + bundleName: 'com.extreme.test', + abilityName: 'MainAbility' }; try { @@ -873,7 +873,7 @@ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: Stops a ServiceExtensionAbility in the same application with the account ID specified. This API uses an asynchronous callback to return the result. -**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (required only when the account ID is not the current user) +**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -905,12 +905,12 @@ Stops a ServiceExtensionAbility in the same application with the account ID spec **Example** ```ts - var want = { - deviceId: "", - bundleName: "com.example.myapplication", - abilityName: "EntryAbility" + let want = { + deviceId: '', + bundleName: 'com.extreme.test', + abilityName: 'MainAbility' }; - var accountId = 100; + let accountId = 100; try { this.context.stopServiceExtensionAbilityWithAccount(want, accountId, (error) => { @@ -936,7 +936,7 @@ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise\< Stops a ServiceExtensionAbility in the same application with the account ID specified. This API uses a promise to return the result. -**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (required only when the account ID is not the current user) +**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -973,12 +973,12 @@ Stops a ServiceExtensionAbility in the same application with the account ID spec **Example** ```ts - var want = { - deviceId: "", - bundleName: "com.example.myapplication", - abilityName: "EntryAbility" + let want = { + deviceId: '', + bundleName: 'com.extreme.test', + abilityName: 'MainAbility' }; - var accountId = 100; + let accountId = 100; try { this.context.stopServiceExtensionAbilityWithAccount(want, accountId) @@ -1118,17 +1118,17 @@ Connects this ability to a ServiceAbility. **Example** ```ts - var want = { - bundleName: "com.example.myapp", - abilityName: "MyAbility" + let want = { + bundleName: 'com.example.myapp', + abilityName: 'MyAbility' }; - var options = { + let options = { onConnect(elementName, remote) { console.log('----------- onConnect -----------') }, onDisconnect(elementName) { console.log('----------- onDisconnect -----------') }, onFailed(code) { console.log('----------- onFailed -----------') } - } + }; - var connection = null; + let connection = null; try { connection = this.context.connectServiceExtensionAbility(want, options); } catch (paramError) { @@ -1178,19 +1178,19 @@ Uses the **AbilityInfo.AbilityType.SERVICE** template and account ID to connect **Example** ```ts - var want = { - deviceId: "", - bundleName: "com.example.myapplication", - abilityName: "EntryAbility" + let want = { + deviceId: '', + bundleName: 'com.extreme.test', + abilityName: 'MainAbility' }; - var accountId = 100; - var options = { + let accountId = 100; + let options = { onConnect(elementName, remote) { console.log('----------- onConnect -----------') }, onDisconnect(elementName) { console.log('----------- onDisconnect -----------') }, onFailed(code) { console.log('----------- onFailed -----------') } } - var connection = null; + let connection = null; try { connection = this.context.connectServiceExtensionAbilityWithAccount(want, accountId, options); } catch (paramError) { @@ -1214,7 +1214,7 @@ Disconnects this ability from the ServiceAbility. This API uses an asynchronous | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| connection | number | Yes| Number returned after **connectAbility** is called.| +| connection | number | Yes| Number returned after **connectServiceExtensionAbility** is called.| | callback | AsyncCallback<void> | No| Callback used to return the result.| **Error codes** @@ -1232,7 +1232,7 @@ Disconnects this ability from the ServiceAbility. This API uses an asynchronous ```ts // connection is the return value of connectServiceExtensionAbility. - var connection = 1; + let connection = 1; try { this.context.disconnectServiceExtensionAbility(connection, (error) => { @@ -1266,7 +1266,7 @@ Disconnects this ability from the ServiceAbility. This API uses a promise to ret | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| connection | number | Yes| Number returned after **connectAbility** is called.| +| connection | number | Yes| Number returned after **connectServiceExtensionAbility** is called.| **Return value** @@ -1288,8 +1288,8 @@ Disconnects this ability from the ServiceAbility. This API uses a promise to ret **Example** ```ts - // connection is the return value of connectAbility. - var connection = 1; + // connection is the return value of connectServiceExtensionAbility. + let connection = 1; try { this.context.disconnectServiceExtensionAbility(connection) @@ -1317,8 +1317,8 @@ Starts an ability in the foreground or background and obtains the caller object Observe the following when using this API: - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - - The rules for using this API in the same-device and cross-device scenarios are different. For details, see [Component Startup Rules (Stage Model)](../../application-models/component-startup-rules.md). + - If **visible** of the target ability is **false**, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. + - For details about the startup rules for the components in the stage model, see [Component Startup Rules (Stage Model)](../../application-models/component-startup-rules.md). **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -1355,14 +1355,14 @@ Observe the following when using this API: Start an ability in the background. ```ts - var caller = undefined; + let caller = undefined; // Start an ability in the background by not passing parameters. - var wantBackground = { - bundleName: "com.example.myservice", - moduleName: "entry", - abilityName: "EntryAbility", - deviceId: "" + let wantBackground = { + bundleName: 'com.example.myservice', + moduleName: 'entry', + abilityName: 'MainAbility', + deviceId: '' }; try { @@ -1386,16 +1386,16 @@ Observe the following when using this API: Start an ability in the foreground. ```ts - var caller = undefined; - - // Start an ability in the foreground with ohos.aafwk.param.callAbilityToForeground in parameters set to true. - var wantForeground = { - bundleName: "com.example.myservice", - moduleName: "entry", - abilityName: "EntryAbility", - deviceId: "", + let caller = undefined; + + // Start an ability in the foreground with 'ohos.aafwk.param.callAbilityToForeground' in parameters set to true. + let wantForeground = { + bundleName: 'com.example.myservice', + moduleName: 'entry', + abilityName: 'MainAbility', + deviceId: '', parameters: { - "ohos.aafwk.param.callAbilityToForeground": true + 'ohos.aafwk.param.callAbilityToForeground': true } }; diff --git a/en/application-dev/reference/apis/js-apis-inner-application-shellCmdResult.md b/en/application-dev/reference/apis/js-apis-inner-application-shellCmdResult.md index 51b10659d38d55686ced548c624798d77391f102..fede94a87e55f92c1264c99002f33c5bd3598c55 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-shellCmdResult.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-shellCmdResult.md @@ -19,13 +19,13 @@ The result is obtained by calling [executeShellCommand](js-apis-inner-applicatio **Example** ```ts -import AbilityDelegatorRegistry from "@ohos.application.abilityDelegatorRegistry"; +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'; let abilityDelegator; -let cmd = "cmd"; +let cmd = 'cmd'; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.executeShellCommand(cmd, (err: any, data: any) => { - console.info("executeShellCommand callback, result: ", err); - console.info("executeShellCommand callback, data: ", data); + console.info('executeShellCommand callback, failed: ', err); + console.info('executeShellCommand callback, success: ', data); }); ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md b/en/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md index 91cdb18e7b4cc9563cecaf27cc125d3108d649e6..563a039ac724ef9a6e92708b3971573709336d16 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md @@ -66,9 +66,9 @@ Observe the following when using this API: **Example** ```ts - var want = { - bundleName: "com.example.myapp", - abilityName: "MyAbility" + let want = { + bundleName: 'com.example.myapp', + abilityName: 'MyAbility' }; try { @@ -138,12 +138,12 @@ Observe the following when using this API: **Example** ```ts - var want = { - deviceId: "", - bundleName: "com.extreme.test", - abilityName: "MainAbility" + let want = { + deviceId: '', + bundleName: 'com.extreme.test', + abilityName: 'MainAbility' }; - var options = { + let options = { windowMode: 0 }; @@ -218,11 +218,11 @@ Observe the following when using this API: **Example** ```ts - var want = { - bundleName: "com.example.myapp", - abilityName: "MyAbility" + let want = { + bundleName: 'com.example.myapp', + abilityName: 'MyAbility' }; - var options = { + let options = { windowMode: 0, }; @@ -295,10 +295,10 @@ Observe the following when using this API: **Example** ```ts - var want = { - deviceId: "", - bundleName: "com.extreme.test", - abilityName: "MainAbility" + let want = { + deviceId: '', + bundleName: 'com.extreme.test', + abilityName: 'MainAbility' }; try { @@ -310,7 +310,7 @@ Observe the following when using this API: return; } // Carry out normal service processing. - console.log("startAbilityForResult succeed, result.resultCode = " + + console.log('startAbilityForResult succeed, result.resultCode = ' + result.resultCode) }); } catch (paramError) { @@ -371,12 +371,12 @@ Observe the following when using this API: **Example** ```ts - var want = { - deviceId: "", - bundleName: "com.extreme.test", - abilityName: "MainAbility" + let want = { + deviceId: '', + bundleName: 'com.extreme.test', + abilityName: 'MainAbility' }; - var options = { + let options = { windowMode: 0, }; @@ -389,7 +389,7 @@ Observe the following when using this API: return; } // Carry out normal service processing. - console.log("startAbilityForResult succeed, result.resultCode = " + + console.log('startAbilityForResult succeed, result.resultCode = ' + result.resultCode) }); } catch (paramError) { @@ -457,11 +457,11 @@ Observe the following when using this API: **Example** ```ts - var want = { - bundleName: "com.example.myapp", - abilityName: "MyAbility" + let want = { + bundleName: 'com.example.myapp', + abilityName: 'MyAbility' }; - var options = { + let options = { windowMode: 0, }; @@ -469,7 +469,7 @@ Observe the following when using this API: this.context.startAbilityForResult(want, options) .then((result) => { // Carry out normal service processing. - console.log("startAbilityForResult succeed, result.resultCode = " + result.resultCode); + console.log('startAbilityForResult succeed, result.resultCode = ' + result.resultCode); }) .catch((error) => { // Process service logic errors. @@ -531,12 +531,12 @@ Starts an ability with the account ID specified. This API uses an asynchronous c **Example** ```ts - var want = { - deviceId: "", - bundleName: "com.extreme.test", - abilityName: "MainAbility" + let want = { + deviceId: '', + bundleName: 'com.extreme.test', + abilityName: 'MainAbility' }; - var accountId = 100; + let accountId = 100; try { this.context.startAbilityForResultWithAccount(want, accountId, (error, result) => { @@ -547,7 +547,7 @@ Starts an ability with the account ID specified. This API uses an asynchronous c return; } // Carry out normal service processing. - console.log("startAbilityForResultWithAccount succeed, result.resultCode = " + + console.log('startAbilityForResultWithAccount succeed, result.resultCode = ' + result.resultCode) }); } catch (paramError) { @@ -607,13 +607,13 @@ Starts an ability with the start options and account ID specified. This API uses **Example** ```ts - var want = { - deviceId: "", - bundleName: "com.extreme.test", - abilityName: "MainAbility" + let want = { + deviceId: '', + bundleName: 'com.extreme.test', + abilityName: 'MainAbility' }; - var accountId = 100; - var options = { + let accountId = 100; + let options = { windowMode: 0 }; @@ -626,7 +626,7 @@ Starts an ability with the start options and account ID specified. This API uses return; } // Carry out normal service processing. - console.log("startAbilityForResultWithAccount succeed, result.resultCode = " + + console.log('startAbilityForResultWithAccount succeed, result.resultCode = ' + result.resultCode) }); } catch (paramError) { @@ -691,13 +691,13 @@ Starts an ability with the account ID specified. This API uses a promise to retu **Example** ```ts - var want = { - deviceId: "", - bundleName: "com.extreme.test", - abilityName: "MainAbility" + let want = { + deviceId: '', + bundleName: 'com.extreme.test', + abilityName: 'MainAbility' }; - var accountId = 100; - var options = { + let accountId = 100; + let options = { windowMode: 0 }; @@ -705,7 +705,7 @@ Starts an ability with the account ID specified. This API uses a promise to retu this.context.startAbilityForResultWithAccount(want, accountId, options) .then((result) => { // Carry out normal service processing. - console.log("startAbilityForResultWithAccount succeed, result.resultCode = " + + console.log('startAbilityForResultWithAccount succeed, result.resultCode = ' + result.resultCode) }) .catch((error) => { @@ -756,10 +756,10 @@ Starts a ServiceExtensionAbility. This API uses an asynchronous callback to retu **Example** ```ts - var want = { - deviceId: "", - bundleName: "com.extreme.test", - abilityName: "MainAbility" + let want = { + deviceId: '', + bundleName: 'com.extreme.test', + abilityName: 'MainAbility' }; try { @@ -816,10 +816,10 @@ Starts a ServiceExtensionAbility. This API uses a promise to return the result. **Example** ```ts - var want = { - deviceId: "", - bundleName: "com.extreme.test", - abilityName: "MainAbility" + let want = { + deviceId: '', + bundleName: 'com.extreme.test', + abilityName: 'MainAbility' }; try { @@ -877,12 +877,12 @@ Starts a ServiceExtensionAbility with the account ID specified. This API uses an **Example** ```ts - var want = { - deviceId: "", - bundleName: "com.extreme.test", - abilityName: "MainAbility" + let want = { + deviceId: '', + bundleName: 'com.extreme.test', + abilityName: 'MainAbility' }; - var accountId = 100; + let accountId = 100; try { this.context.startServiceExtensionAbilityWithAccount(want, accountId, (error) => { @@ -942,12 +942,12 @@ Starts a ServiceExtensionAbility with the account ID specified. This API uses a **Example** ```ts - var want = { - deviceId: "", - bundleName: "com.extreme.test", - abilityName: "MainAbility" + let want = { + deviceId: '', + bundleName: 'com.extreme.test', + abilityName: 'MainAbility' }; - var accountId = 100; + let accountId = 100; try { this.context.startServiceExtensionAbilityWithAccount(want, accountId) @@ -1000,10 +1000,10 @@ Stops a ServiceExtensionAbility in the same application. This API uses an asynch **Example** ```ts - var want = { - deviceId: "", - bundleName: "com.extreme.test", - abilityName: "MainAbility" + let want = { + deviceId: '', + bundleName: 'com.extreme.test', + abilityName: 'MainAbility' }; try { @@ -1057,10 +1057,10 @@ Stops a ServiceExtensionAbility in the same application. This API uses a promise **Example** ```ts - var want = { - deviceId: "", - bundleName: "com.extreme.test", - abilityName: "MainAbility" + let want = { + deviceId: '', + bundleName: 'com.extreme.test', + abilityName: 'MainAbility' }; try { @@ -1119,12 +1119,12 @@ Stops a ServiceExtensionAbility with the account ID specified in the same applic **Example** ```ts - var want = { - deviceId: "", - bundleName: "com.extreme.test", - abilityName: "MainAbility" + let want = { + deviceId: '', + bundleName: 'com.extreme.test', + abilityName: 'MainAbility' }; - var accountId = 100; + let accountId = 100; try { this.context.stopServiceExtensionAbilityWithAccount(want, accountId, (error) => { @@ -1181,12 +1181,12 @@ Stops a ServiceExtensionAbility with the account ID specified in the same applic **Example** ```ts - var want = { - deviceId: "", - bundleName: "com.extreme.test", - abilityName: "MainAbility" + let want = { + deviceId: '', + bundleName: 'com.extreme.test', + abilityName: 'MainAbility' }; - var accountId = 100; + let accountId = 100; try { this.context.stopServiceExtensionAbilityWithAccount(want, accountId) @@ -1315,13 +1315,13 @@ Terminates this ability. If the ability is started by calling [startAbilityForRe **Example** ```ts - var want = { - bundleName: "com.extreme.myapplication", - abilityName: "SecondAbility" + let want = { + bundleName: 'com.extreme.myapplication', + abilityName: 'SecondAbility' } - var resultCode = 100; + let resultCode = 100; // AbilityResult information returned to the caller. - var abilityResult = { + let abilityResult = { want, resultCode } @@ -1380,13 +1380,13 @@ Terminates this ability. If the ability is started by calling [startAbilityForRe **Example** ```ts - var want = { - bundleName: "com.extreme.myapplication", - abilityName: "SecondAbility" + let want = { + bundleName: 'com.extreme.myapplication', + abilityName: 'SecondAbility' } - var resultCode = 100; + let resultCode = 100; // AbilityResult information returned to the caller. - var abilityResult = { + let abilityResult = { want, resultCode } @@ -1445,18 +1445,18 @@ Connects this ability to an ability that uses the **AbilityInfo.AbilityType.SERV **Example** ```ts - var want = { - deviceId: "", - bundleName: "com.extreme.test", - abilityName: "MainAbility" + let want = { + deviceId: '', + bundleName: 'com.extreme.test', + abilityName: 'MainAbility' }; - var options = { + let options = { onConnect(elementName, remote) { console.log('----------- onConnect -----------') }, onDisconnect(elementName) { console.log('----------- onDisconnect -----------') }, onFailed(code) { console.log('----------- onFailed -----------') } } - var connection = null; + let connection = null; try { connection = this.context.connectServiceExtensionAbility(want, options); } catch (paramError) { @@ -1509,19 +1509,19 @@ Connects this ability to an ability that uses the **AbilityInfo.AbilityType.SERV **Example** ```ts - var want = { - deviceId: "", - bundleName: "com.extreme.test", - abilityName: "MainAbility" + let want = { + deviceId: '', + bundleName: 'com.extreme.test', + abilityName: 'MainAbility' }; - var accountId = 100; - var options = { + let accountId = 100; + let options = { onConnect(elementName, remote) { console.log('----------- onConnect -----------') }, onDisconnect(elementName) { console.log('----------- onDisconnect -----------') }, onFailed(code) { console.log('----------- onFailed -----------') } } - var connection = null; + let connection = null; try { connection = this.context.connectServiceExtensionAbilityWithAccount(want, accountId, options); } catch (paramError) { @@ -1568,7 +1568,7 @@ Disconnects a connection. This API uses a promise to return the result. ```ts // connection is the return value of connectServiceExtensionAbility. - var connection = 1; + let connection = 1; try { this.context.disconnectServiceExtensionAbility(connection) @@ -1620,7 +1620,7 @@ Disconnects a connection. This API uses an asynchronous callback to return the r ```ts // connection is the return value of connectServiceExtensionAbility. - var connection = 1; + let connection = 1; try { this.context.disconnectServiceExtensionAbility(connection, (error) => { @@ -1670,14 +1670,14 @@ Observe the following when using this API: Start an ability in the background. ```ts - var caller = undefined; + let caller = undefined; // Start an ability in the background by not passing parameters. - var wantBackground = { - bundleName: "com.example.myservice", - moduleName: "entry", - abilityName: "MainAbility", - deviceId: "" + let wantBackground = { + bundleName: 'com.example.myservice', + moduleName: 'entry', + abilityName: 'MainAbility', + deviceId: '' }; try { @@ -1701,16 +1701,16 @@ Observe the following when using this API: Start an ability in the foreground. ```ts - var caller = undefined; - - // Start an ability in the foreground with ohos.aafwk.param.callAbilityToForeground in parameters set to true. - var wantForeground = { - bundleName: "com.example.myservice", - moduleName: "entry", - abilityName: "MainAbility", - deviceId: "", + let caller = undefined; + + // Start an ability in the foreground with 'ohos.aafwk.param.callAbilityToForeground' in parameters set to true. + let wantForeground = { + bundleName: 'com.example.myservice', + moduleName: 'entry', + abilityName: 'MainAbility', + deviceId: '', parameters: { - "ohos.aafwk.param.callAbilityToForeground": true + 'ohos.aafwk.param.callAbilityToForeground': true } }; @@ -1780,12 +1780,12 @@ Starts an ability with the account ID specified. This API uses an asynchronous c **Example** ```ts - var want = { - deviceId: "", - bundleName: "com.extreme.test", - abilityName: "MainAbility" + let want = { + deviceId: '', + bundleName: 'com.extreme.test', + abilityName: 'MainAbility' }; - var accountId = 100; + let accountId = 100; try { this.context.startAbilityWithAccount(want, accountId, (error) => { @@ -1855,13 +1855,13 @@ Starts an ability with the account ID specified. This API uses an asynchronous c **Example** ```ts - var want = { - deviceId: "", - bundleName: "com.extreme.test", - abilityName: "MainAbility" + let want = { + deviceId: '', + bundleName: 'com.extreme.test', + abilityName: 'MainAbility' }; - var accountId = 100; - var options = { + let accountId = 100; + let options = { windowMode: 0 }; @@ -1932,13 +1932,13 @@ Starts an ability with the account ID specified. This API uses a promise to retu **Example** ```ts - var want = { - deviceId: "", - bundleName: "com.extreme.test", - abilityName: "MainAbility" + let want = { + deviceId: '', + bundleName: 'com.extreme.test', + abilityName: 'MainAbility' }; - var accountId = 100; - var options = { + let accountId = 100; + let options = { windowMode: 0 }; @@ -1978,7 +1978,7 @@ Requests permissions from the user by displaying a dialog box. This API uses an **Example** ```ts - var permissions=['com.example.permission'] + let permissions=['com.example.permission'] this.context.requestPermissionsFromUser(permissions,(result) => { console.log('requestPermissionsFromUserresult:' + JSON.stringify(result)); }); @@ -2009,7 +2009,7 @@ Requests permissions from the user by displaying a dialog box. This API uses a p **Example** ```ts - var permissions=['com.example.permission'] + let permissions=['com.example.permission'] this.context.requestPermissionsFromUser(permissions).then((data) => { console.log('success:' + JSON.stringify(data)); }).catch((error) => { @@ -2037,7 +2037,7 @@ Sets a label for this ability in the mission. This API uses an asynchronous call **Example** ```ts - this.context.setMissionLabel("test",(result) => { + this.context.setMissionLabel('test',(result) => { console.log('requestPermissionsFromUserresult:' + JSON.stringify(result)); }); ``` @@ -2066,7 +2066,7 @@ Sets a label for this ability in the mission. This API uses a promise to return **Example** ```ts - this.context.setMissionLabel("test").then(() => { + this.context.setMissionLabel('test').then(() => { console.log('success'); }).catch((error) => { console.log('failed:' + JSON.stringify(error)); @@ -2093,9 +2093,9 @@ Sets an icon for this ability in the mission. This API uses an asynchronous call ```ts import image from '@ohos.multimedia.image'; - var imagePixelMap; - var color = new ArrayBuffer(0); - var initializationOptions = { + let imagePixelMap; + let color = new ArrayBuffer(0); + let initializationOptions = { size: { height: 100, width: 100 @@ -2140,9 +2140,9 @@ Sets an icon for this ability in the mission. This API uses a promise to return ```ts import image from '@ohos.multimedia.image'; - var imagePixelMap; - var color = new ArrayBuffer(0); - var initializationOptions = { + let imagePixelMap; + let color = new ArrayBuffer(0); + let initializationOptions = { size: { height: 100, width: 100 @@ -2180,7 +2180,7 @@ Restores the window stage data for this ability. **Example** ```ts - var storage = new LocalStorage(); + let storage = new LocalStorage(); this.context.restoreWindowStage(storage); ``` @@ -2201,6 +2201,6 @@ Checks whether this ability is in the terminating state. **Example** ```ts - var isTerminating = this.context.isTerminating(); + let isTerminating = this.context.isTerminating(); console.log('ability state :' + isTerminating); ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-windowExtensionContext.md b/en/application-dev/reference/apis/js-apis-inner-application-windowExtensionContext.md new file mode 100644 index 0000000000000000000000000000000000000000..4cc57989c53ded67c3514b89635fc3d1ac9f9374 --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-inner-application-windowExtensionContext.md @@ -0,0 +1,123 @@ +# WindowExtensionContext + +The **WindowExtensionContext** module, inherited from [ExtensionContext](js-apis-inner-application-extensionContext.md), is the context environment of the WindowExtensionAbility. + +The **WindowExtensionContext** module provides the capabilities of the [WindowExtensionAbility](js-apis-application-windowExtensionAbility.md), including starting the ability. + +> **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. +> +> - The APIs of this module can be used only in the stage model. + +## Usage + +Before using the **WindowExtensionContext** module, you must define a child class that inherits from **WindowExtensionAbility**. + +```ts + import WindowExtensionAbility from '@ohos.application.WindowExtensionAbility'; + + let context; + class WindowExtAbility extends WindowExtensionAbility { + onConnect() { + context = this.context; // Obtain a WindowExtensionContext instance. + } + } +``` + +## WindowExtensionContext.startAbility + +startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void>): void + +Starts an ability. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.WindowManager.WindowManager.Core + +**Parameters** + +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| want | [Want](js-apis-application-want.md) | Yes| Want information about the target ability.| +| options | [StartOptions](js-apis-app-ability-startOptions.md) | Yes| Parameters used for starting the ability.| +| callback | AsyncCallback<void> | Yes| Callback used to return the result.| + +**Example** + + ```ts + let want = { + bundleName: 'com.example.myapplication', + abilityName: 'MainAbility' + }; + let options = { + windowMode: 102 + }; + + try { + this.context.startAbility(want, options, (error) => { + if (error.code) { + // Process service logic errors. + console.log('startAbility failed, error.code: ' + JSON.stringify(error.code) + + ' error.message: ' + JSON.stringify(error.message)); + return; + } + // Carry out normal service processing. + console.log('startAbility succeed'); + }); + } catch (paramError) { + // Process input parameter errors. + console.error('error.code: ' + JSON.stringify(paramError.code) + + ' error.message: ' + JSON.stringify(paramError.message)); + } + ``` + +## WindowExtensionContext.startAbility + +startAbility(want: Want, options?: StartOptions): Promise\ + +Starts an ability. This API uses a promise to return the result. + +**System capability**: SystemCapability.WindowManager.WindowManager.Core + +**Parameters** + +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| want | [Want](js-apis-application-want.md) | Yes| Want information about the target ability, such as the ability name and bundle name.| +| options | [StartOptions](js-apis-app-ability-startOptions.md) | No| Parameters used for starting the ability.| + +**Return value** + +| Type| Description| +| -------- | -------- | +| Promise<void> | Promise that returns no value.| + +**Example** + + ```ts + let want = { + bundleName: 'com.example.myapp', + abilityName: 'MainAbility' + }; + let options = { + windowMode: 102, + }; + + try { + this.context.startAbility(want, options) + .then((data) => { + // Carry out normal service processing. + console.log('startAbility succeed'); + }) + .catch((error) => { + // Process service logic errors. + console.log('startAbility failed, error.code: ' + JSON.stringify(error.code) + + ' error.message: ' + JSON.stringify(error.message)); + }); + } catch (paramError) { + // Process input parameter errors. + console.error('error.code: ' + JSON.stringify(paramError.code) + + ' error.message: ' + JSON.stringify(paramError.message)); + } + ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-wantAgent-triggerInfo.md b/en/application-dev/reference/apis/js-apis-inner-wantAgent-triggerInfo.md index 5ca299f0ad5f9df4f5b460b30e9e34c7dad82d5d..bdd437754a4024a8b414db11cce5a3ed9887b326 100644 --- a/en/application-dev/reference/apis/js-apis-inner-wantAgent-triggerInfo.md +++ b/en/application-dev/reference/apis/js-apis-inner-wantAgent-triggerInfo.md @@ -6,7 +6,7 @@ The **TriggerInfo** module defines the information required for triggering the W | Name | Type | Mandatory| Description | | ---------- | --- |-------------------- | ----------- | -| code | number | Yes | Custom result code provided for the target WantAgent.| +| code | number | Yes | Result code.| | want | Want | No | Want. | | permission | string | No | Permission. | | extraInfo | {[key: string]: any} | No | Extra information. | diff --git a/en/application-dev/reference/apis/js-apis-inner-wantAgent-wantAgentInfo.md b/en/application-dev/reference/apis/js-apis-inner-wantAgent-wantAgentInfo.md index 8facc43fc842570c3eb0ea95a141bdaa77dcf252..289a5ebef3d8095fd599e630e0236935551246d1 100644 --- a/en/application-dev/reference/apis/js-apis-inner-wantAgent-wantAgentInfo.md +++ b/en/application-dev/reference/apis/js-apis-inner-wantAgent-wantAgentInfo.md @@ -7,7 +7,7 @@ The **WantAgentInfo** module defines the information required for triggering a * | Name | Type | Mandatory| Description | | -------------- | ------------------------------- | ---- | ---------------------- | | wants | Array\ | Yes | Array of all **Want** objects. | -| operationType | wantAgent.OperationType | Yes | Operation type. | +| operationType | [wantAgent.OperationType](js-apis-app-ability-wantAgent.md#operationtype) | Yes | Operation type. | | requestCode | number | Yes | Request code defined by the user.| | wantAgentFlags | Array<[wantAgent.WantAgentFlags](js-apis-app-ability-wantAgent.md#wantagentflags)> | No | Array of flags for using the **WantAgent** object. | | extraInfo | {[key: string]: any} | No | Extra information. | diff --git a/en/application-dev/reference/apis/js-apis-installer.md b/en/application-dev/reference/apis/js-apis-installer.md index 4478dff76f73867213cc679f06fe5b574c6bccb4..bd6f57d3dc6e36f318a757c57aceae1b417b0f41 100644 --- a/en/application-dev/reference/apis/js-apis-installer.md +++ b/en/application-dev/reference/apis/js-apis-installer.md @@ -174,7 +174,6 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc | -------- | ------------------------------------------------------------ | | 17700004 | The specified user ID is not found. | | 17700020 | The specified bundle is pre-installed bundle which cannot be uninstalled. | -| 17700101 | The system service is excepted. | **Example** @@ -283,7 +282,7 @@ Defines the parameters that need to be specified for bundle installation, uninst | Name | Type | Mandatory | Description | | ------------------------------ | ------------------------------ | ------------------ | ------------------ | -| userId | number | Yes | User ID. You can use [queryOsAccountLocalIdFromProcess](js-apis-osAccount.md#queryosaccountlocalidfromprocess9) to obtain the user of the current process.| +| userId | number | Yes | User ID. You can use [queryOsAccountLocalIdFromProcess](js-apis-osAccount.md#getOsAccountLocalId) to obtain the user of the current process.| | installFlag | number | Yes | Installation flag. The value **0** means initial installation and **1** means overwrite installation.| | isKeepData | boolean | Yes | Whether to retain the data directory during bundle uninstall.| | hashParams | Array<[HashParam](#hashparam)> | Yes| Hash parameters. | diff --git a/en/application-dev/reference/apis/js-apis-lightweightmap.md b/en/application-dev/reference/apis/js-apis-lightweightmap.md index 89893c1c97d183c69765535141b2012fae9e080a..057dc7e3f1f52f8d491ed1edf35037d42c7ee337 100644 --- a/en/application-dev/reference/apis/js-apis-lightweightmap.md +++ b/en/application-dev/reference/apis/js-apis-lightweightmap.md @@ -747,7 +747,7 @@ let lightWeightMap = new LightWeightMap(); lightWeightMap.set("sparrow", 123); lightWeightMap.set("gull", 357); lightWeightMap.forEach((value, key) => { - console.log("value:" + value, key); + console.log("value:" + value, "key:" + key); }); ``` diff --git a/en/application-dev/reference/apis/js-apis-lightweightset.md b/en/application-dev/reference/apis/js-apis-lightweightset.md index 25c7950dc4968bc3f9f33ad6b277ecdc68a6ea09..47295b0dd86d5b805607850b92a9692f71940dc7 100644 --- a/en/application-dev/reference/apis/js-apis-lightweightset.md +++ b/en/application-dev/reference/apis/js-apis-lightweightset.md @@ -611,7 +611,7 @@ let lightWeightSet = new LightWeightSet(); lightWeightSet.add("sparrow"); lightWeightSet.add("gull"); lightWeightSet.forEach((value, key) => { - console.log("value:" + value, key); + console.log("value:" + value, "key:" + key); }); ``` diff --git a/en/application-dev/reference/apis/js-apis-linkedlist.md b/en/application-dev/reference/apis/js-apis-linkedlist.md index bc51f25fbb6c54f7fadc6bdd05533113a1c7254c..ceb144301277ac8cdd08f52713ae6cf576817a18 100644 --- a/en/application-dev/reference/apis/js-apis-linkedlist.md +++ b/en/application-dev/reference/apis/js-apis-linkedlist.md @@ -1,8 +1,5 @@ # @ohos.util.LinkedList (Linear Container LinkedList) -> **NOTE** -> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. - **LinkedList** is implemented based on the doubly linked list. Each node of the doubly linked list has references pointing to the previous element and the next element. When querying an element, the system traverses the list from the beginning or end. **LinkedList** offers efficient insertion and removal operations but supports low query efficiency. **LinkedList** allows null elements. Unlike **[List](js-apis-list.md)**, which is a singly linked list, **LinkedList** is a doubly linked list that supports insertion and removal at both ends. @@ -14,6 +11,11 @@ Unlike **[List](js-apis-list.md)**, which is a singly linked list, **LinkedList* This topic uses the following to identify the use of generics: - T: Type +> **NOTE** +> +> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. + + ## Modules to Import ```ts @@ -505,6 +507,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco | -------- | -------- | | 10200011 | The removeFirstFound method cannot be bound. | | 10200010 | Container is empty. | +| 10200017 | The element does not exist in this container. | **Example** @@ -545,6 +548,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco | -------- | -------- | | 10200011 | The removeLastFound method cannot be bound. | | 10200010 | Container is empty. | +| 10200017 | The element does not exist in this container. | **Example** @@ -631,7 +635,7 @@ linkedList.add(4); linkedList.add(5); linkedList.add(4); linkedList.forEach((value, index) => { - console.log("value:" + value, index); + console.log("value:" + value, "index:" + index); }); ``` diff --git a/en/application-dev/reference/apis/js-apis-list.md b/en/application-dev/reference/apis/js-apis-list.md index bd1272f3a7a48a47f30ba689ff9df972932727d6..295824f50139aca548f3dcd5952ce75c2bec7cfc 100644 --- a/en/application-dev/reference/apis/js-apis-list.md +++ b/en/application-dev/reference/apis/js-apis-list.md @@ -1,8 +1,5 @@ # @ohos.util.List (Linear Container List) -> **NOTE** -> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. - **List** is implemented based on the singly linked list. Each node has a reference pointing to the next element. When querying an element, the system traverses the list from the beginning. **List** offers efficient insertion and removal operations but supports low query efficiency. **List** allows null elements. Unlike [LinkedList](js-apis-linkedlist.md), which is a doubly linked list, **List** is a singly linked list that does not support insertion or removal at both ends. @@ -12,6 +9,10 @@ Unlike [LinkedList](js-apis-linkedlist.md), which is a doubly linked list, **Lis This topic uses the following to identify the use of generics: - T: Type +> **NOTE** +> +> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. + ## Modules to Import ```ts @@ -505,7 +506,7 @@ list.add(4); list.add(5); list.add(4); list.forEach((value, index) => { - console.log("value: " + value, index); + console.log("value:" + value, "index:" + index); }); ``` diff --git a/en/application-dev/reference/apis/js-apis-matrix4.md b/en/application-dev/reference/apis/js-apis-matrix4.md index f5b9b27f55ed9d363939bef6f55582423afe4a28..123602526ffa59a7af9f20c7ee7eb0775ffae0e6 100644 --- a/en/application-dev/reference/apis/js-apis-matrix4.md +++ b/en/application-dev/reference/apis/js-apis-matrix4.md @@ -1,4 +1,4 @@ -# @ohos.matrix4 +# @ohos.matrix4 (Matrix Transformation) The **matrix4** module provides APIs for matrix transformation. You can use these APIs to translate, rotate, and scale images. @@ -19,7 +19,7 @@ import matrix4 from '@ohos.matrix4' init(array: Array<number>): Matrix4Transit -Matrix constructor, which is used to create a 4x4 matrix by using the input parameter. Column-major order is used. +Matrix constructor, which is used to create a 4 x 4 matrix by using the input parameter. Column-major order is used. **System capability**: SystemCapability.ArkUI.ArkUI.Full @@ -33,7 +33,7 @@ Matrix constructor, which is used to create a 4x4 matrix by using the input para | Type | Description | | -------------- | ---------------------------- | -| Matrix4Transit | 4x4 matrix object created based on the input parameter.| +| Matrix4Transit | 4 x 4 matrix object created based on the input parameter.| **array** parameters @@ -458,7 +458,7 @@ struct Test { .width('600px') .height('300px') .margin({ top: 50 }) - Text(`Coordinates before matrix transformation: [${this.transformPoint}]`) + Text(`Coordinates after matrix transformation: [${this.transformPoint}]`) .fontSize(16) .margin({ top: 100 }) Image($r("app.media.image")) diff --git a/en/application-dev/reference/apis/js-apis-media.md b/en/application-dev/reference/apis/js-apis-media.md index 3dbcf6121907865d317231e1ddcd58925367996a..efab5c23414e66eb69e95bb626846a76cb21148e 100644 --- a/en/application-dev/reference/apis/js-apis-media.md +++ b/en/application-dev/reference/apis/js-apis-media.md @@ -1161,7 +1161,7 @@ Unsubscribes from the event that checks whether the bit rate is successfully set | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | Event type, which is **'bitrateDone'** in this case| +| type | string | Yes | Event type, which is **'bitrateDone'** in this case.| **Example** @@ -1694,6 +1694,8 @@ Sets audio and video recording parameters. This API uses an asynchronous callbac This permission is required only if audio recording is involved. +To use the camera to record videos, the camera module is required. For details about how to obtain the permissions and use the APIs, see [Camera Management](js-apis-camera.md). + **System capability**: SystemCapability.Multimedia.Media.AVRecorder **Parameters** @@ -1717,13 +1719,14 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco **Example** ```js +// Configure the parameters based on those supported by the hardware device. let AVRecorderProfile = { audioBitrate : 48000, audioChannels : 2, audioCodec : media.CodecMimeType.AUDIO_AAC, audioSampleRate : 48000, fileFormat : media.ContainerFormatType.CFT_MPEG_4, - videoBitrate : 48000, + videoBitrate : 2000000, videoCodec : media.CodecMimeType.VIDEO_MPEG4, videoFrameWidth : 640, videoFrameHeight : 480, @@ -1757,6 +1760,8 @@ Sets audio and video recording parameters. This API uses a promise to return the This permission is required only if audio recording is involved. +To use the camera to record videos, the camera module is required. For details about how to obtain the permissions and use the APIs, see [Camera Management](js-apis-camera.md). + **System capability**: SystemCapability.Multimedia.Media.AVRecorder **Parameters** @@ -1785,13 +1790,14 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco **Example** ```js +// Configure the parameters based on those supported by the hardware device. let AVRecorderProfile = { audioBitrate : 48000, audioChannels : 2, audioCodec : media.CodecMimeType.AUDIO_AAC, audioSampleRate : 48000, fileFormat : media.ContainerFormatType.CFT_MPEG_4, - videoBitrate : 48000, + videoBitrate : 2000000, videoCodec : media.CodecMimeType.VIDEO_MPEG4, videoFrameWidth : 640, videoFrameHeight : 480, @@ -2479,7 +2485,7 @@ Describes the audio and video recording parameters. | audioSourceType | [AudioSourceType](#audiosourcetype9) | No | Type of the audio source to record. This parameter is mandatory for audio recording. | | videoSourceType | [VideoSourceType](#videosourcetype9) | No | Type of the video source to record. This parameter is mandatory for video recording. | | profile | [AVRecorderProfile](#avrecorderprofile9) | Yes | Recording profile. This parameter is mandatory. | -| url | string | Yes | Recording output URL: fd://xx (fd number).
![img](figures/en-us_image_url.png)
This parameter is mandatory. | +| url | string | Yes | Recording output URL: fd://xx (fd number).
![img](figures/en-us_image_url.png)
This parameter is mandatory. | | rotation | number | No | Rotation angle of the recorded video. The value can only be 0, 90, 180, or 270. | | location | [Location](#location) | No | Geographical location of the recorded video. | @@ -2601,13 +2607,14 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco **Example** ```js +// Configure the parameters based on those supported by the hardware device. let videoProfile = { audioBitrate : 48000, audioChannels : 2, audioCodec : 'audio/mp4a-latm', audioSampleRate : 48000, fileFormat : 'mp4', - videoBitrate : 48000, + videoBitrate : 2000000, videoCodec : 'video/mp4v-es', videoFrameWidth : 640, videoFrameHeight : 480, @@ -2671,13 +2678,14 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco **Example** ```js +// Configure the parameters based on those supported by the hardware device. let videoProfile = { audioBitrate : 48000, audioChannels : 2, audioCodec : 'audio/mp4a-latm', audioSampleRate : 48000, fileFormat : 'mp4', - videoBitrate : 48000, + videoBitrate : 2000000, videoCodec : 'video/mp4v-es', videoFrameWidth : 640, videoFrameHeight : 480, @@ -3796,7 +3804,7 @@ audioPlayer.on('error', (error) => { // Set the 'error' event callback console.info(`audio error called, error: ${error}`); }); -// Set the FD (local playback) of the video file selected by the user. +// Set the FD (local playback) of the audio file selected by the user. let fdPath = 'fd://'; // The stream in the path can be pushed to the device by running the "hdc file send D:\xxx\01.mp3 /data/accounts/account_0/appdata" command. let path = '/data/accounts/account_0/appdata/ohos.xxx.xxx.xxx/01.mp3'; diff --git a/en/application-dev/reference/apis/js-apis-medialibrary.md b/en/application-dev/reference/apis/js-apis-medialibrary.md index 0ee9b746e29fd8bb0473b664a1acabd0f2f157ae..cd52a40c909762b31e033274b2b5193ecf34e6f6 100644 --- a/en/application-dev/reference/apis/js-apis-medialibrary.md +++ b/en/application-dev/reference/apis/js-apis-medialibrary.md @@ -34,6 +34,7 @@ This API can be used only in the stage model. **Example (from API version 9)** ```ts +// Obtain a MediaLibrary instance. The instance obtained here is used in later. const context = getContext(this); let media = mediaLibrary.getMediaLibrary(context); ``` @@ -92,46 +93,59 @@ Obtains file assets (also called files). This API uses an asynchronous callback **Example** ```js -let fileKeyObj = mediaLibrary.FileKey; -let imageType = mediaLibrary.MediaType.IMAGE; -let imagesFetchOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], -}; -media.getFileAssets(imagesFetchOp, (error, fetchFileResult) => { - if (fetchFileResult == undefined) { - console.error('Failed to get fetchFileResult: ' + error); - return; - } - const count = fetchFileResult.getCount(); - if (count < 0) { - console.error('Failed to get count from fetchFileResult: count: ' + count); - return; - } - if (count == 0) { - console.info('The count of fetchFileResult is zero'); - return; - } - - console.info('Get fetchFileResult success, count: ' + count); - fetchFileResult.getFirstObject((err, fileAsset) => { - if (fileAsset == undefined) { - console.error('Failed to get first object: ' + err); +async function example() { + let fileKeyObj = mediaLibrary.FileKey; + let imageType = mediaLibrary.MediaType.IMAGE; + // Create options for fetching the files. The options are used to obtain files of the image type. + let imagesFetchOp = { + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + }; + // Obtain the files in asynchronous callback mode. + media.getFileAssets(imagesFetchOp, (error, fetchFileResult) => { + // Check whether the result set of the obtained files is undefined. If yes, the API call fails. + if (fetchFileResult == undefined) { + console.error('get fetchFileResult failed with error: ' + error); return; } - console.info('fileAsset.displayName ' + ': ' + fileAsset.displayName); - for (let i = 1; i < count; i++) { - fetchFileResult.getNextObject((err, fileAsset) => { - if (fileAsset == undefined) { - console.error('Failed to get next object: ' + err); - return; - } - console.info('fileAsset.displayName ' + i + ': ' + fileAsset.displayName); - }) + // Obtain the total number of files in the result set. + const count = fetchFileResult.getCount(); + // Check whether the number is less than 0. If yes, the API call fails. + if (count < 0) { + console.error('get count from fetchFileResult failed, count: ' + count); + return; } + // Check whether the number is 0. If yes, the API call is successful, but the result set is empty. Check whether the options for fetching the files are correctly set and whether the corresponding files exist on the device. + if (count == 0) { + console.info('The count of fetchFileResult is zero'); + return; + } + console.info('Get fetchFileResult successfully, count: ' + count); + // Obtain the first file in the result set in asynchronous callback mode. + fetchFileResult.getFirstObject((error, fileAsset) => { + // Check whether the first file is undefined. If yes, the API call fails. + if (fileAsset == undefined) { + console.error('get first object failed with error: ' + error); + return; + } + console.info('fileAsset.displayName ' + '0 : ' + fileAsset.displayName); + // Call getNextObject to obtain the next file until the last one. + for (let i = 1; i < count; i++) { + fetchFileResult.getNextObject((error, fileAsset) => { + if (fileAsset == undefined) { + console.error('get next object failed with error: ' + error); + return; + } + console.info('fileAsset.displayName ' + i + ': ' + fileAsset.displayName); + }) + } + }); + // Release the FetchFileResult instance and invalidate it. Other APIs can no longer be called. + fetchFileResult.close(); }); -}); +} ``` + ### getFileAssets7+ getFileAssets(options: MediaFetchOptions): Promise<FetchFileResult> @@ -157,38 +171,51 @@ Obtains file assets. This API uses a promise to return the result. **Example** ```js -let fileKeyObj = mediaLibrary.FileKey; -let imageType = mediaLibrary.MediaType.IMAGE; -let imagesFetchOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], -}; -media.getFileAssets(imagesFetchOp).then(function(fetchFileResult) { - const count = fetchFileResult.getCount(); - if (count < 0) { - console.error('Failed to get count from fetchFileResult: count: ' + count); - return; - } - if (count == 0) { - console.info('The count of fetchFileResult is zero'); - return; - } - console.info('Get fetchFileResult success, count: ' + count); - fetchFileResult.getFirstObject().then(function(fileAsset) { - console.info('fileAsset.displayName ' + ': ' + fileAsset.displayName); - for (let i = 1; i < count; i++) { - fetchFileResult.getNextObject().then(function(fileAsset) { - console.info('fileAsset.displayName ' + ': ' + fileAsset.displayName); - }).catch(function(err) { - console.error('Failed to get next object: ' + err); - }) +async function example() { + let fileKeyObj = mediaLibrary.FileKey; + let imageType = mediaLibrary.MediaType.IMAGE; + // Create options for fetching the files. The options are used to obtain files of the image type. + let imagesFetchOp = { + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + }; + // Obtain the files in promise mode. + media.getFileAssets(imagesFetchOp).then((fetchFileResult) => { + // Obtain the total number of files in the result set. + const count = fetchFileResult.getCount(); + // Check whether the number is less than 0. If yes, the API call fails. + if (count < 0) { + console.error('get count from fetchFileResult failed, count: ' + count); + return; } - }).catch(function(err) { - console.error('Failed to get first object: ' + err); + // Check whether the number is 0. If yes, the API call is successful, but the result set is empty. Check whether the options for fetching the files are correctly set and whether the corresponding files exist on the device. + if (count == 0) { + console.info('The count of fetchFileResult is zero'); + return; + } + console.info('Get fetchFileResult successfully, count: ' + count); + // Obtain the first file in the result set in promise mode. + fetchFileResult.getFirstObject().then((fileAsset) => { + console.info('fileAsset.displayName ' + '0 : ' + fileAsset.displayName); + // Call getNextObject to obtain the next file until the last one. + for (let i = 1; i < count; i++) { + fetchFileResult.getNextObject().then((fileAsset) => { + console.info('fileAsset.displayName ' + i + ': ' + fileAsset.displayName); + }).catch((error) => { + console.error('get next object failed with error: ' + error); + }) + } + }).catch((error) => { + // Calling getFirstObject fails. + console.error('get first object failed with error: ' + error); + }); + // Release the FetchFileResult instance and invalidate it. Other APIs can no longer be called. + fetchFileResult.close(); + }).catch((error) => { + // Calling getFileAssets fails. + console.error('get file assets failed with error: ' + error); }); -}).catch(function(err){ - console.error("Failed to get file assets: " + err); -}); +} ``` ### on8+ @@ -232,7 +259,7 @@ Unsubscribes from the media library changes. This API uses an asynchronous callb ```js media.off('imageChange', () => { - // stop listening success + // Stop listening successfully. }) ``` @@ -263,11 +290,11 @@ async function example() { let mediaType = mediaLibrary.MediaType.IMAGE; let DIR_IMAGE = mediaLibrary.DirectoryType.DIR_IMAGE; const path = await media.getPublicDirectory(DIR_IMAGE); - media.createAsset(mediaType, 'imageCallBack.jpg', path + 'myPicture/', (err, fileAsset) => { + media.createAsset(mediaType, 'imageCallBack.jpg', path + 'myPicture/', (error, fileAsset) => { if (fileAsset != undefined) { console.info('createAsset successfully, message'); } else { - console.error('createAsset failed, message = ' + err); + console.error('createAsset failed with error: ' + error); } }); } @@ -307,8 +334,8 @@ async function example() { const path = await media.getPublicDirectory(DIR_IMAGE); media.createAsset(mediaType, 'imagePromise.jpg', path + 'myPicture/').then((fileAsset) => { console.info('createAsset successfully, message = ' + JSON.stringify(fileAsset)); - }).catch((err) => { - console.error('createAsset failed, message = ' + err); + }).catch((error) => { + console.error('createAsset failed with error: ' + error); }); } ``` @@ -349,14 +376,15 @@ async function example() { const fetchFileResult = await media.getFileAssets(option); let asset = await fetchFileResult.getFirstObject(); if (asset == undefined) { - console.error('asset not exist') - return + console.error('asset not exist'); + return; } media.deleteAsset(asset.uri).then(() => { - console.info("deleteAsset successfully"); - }).catch((err) => { - console.error("deleteAsset failed with error:"+ err); + console.info('deleteAsset successfully'); + }).catch((error) => { + console.error('deleteAsset failed with error: ' + error); }); + fetchFileResult.close(); } ``` @@ -391,16 +419,17 @@ async function example() { const fetchFileResult = await media.getFileAssets(option); let asset = await fetchFileResult.getFirstObject(); if (asset == undefined) { - console.error('asset not exist') - return + console.error('asset not exist'); + return; } - media.deleteAsset(asset.uri, (err) => { - if (err != undefined) { - console.info("deleteAsset successfully"); + media.deleteAsset(asset.uri, (error) => { + if (error != undefined) { + console.error('deleteAsset failed with error: ' + error); } else { - console.error("deleteAsset failed with error:"+ err); + console.info('deleteAsset successfully'); } }); + fetchFileResult.close(); } ``` @@ -423,11 +452,11 @@ Obtains a public directory. This API uses an asynchronous callback to return the ```js let DIR_CAMERA = mediaLibrary.DirectoryType.DIR_CAMERA; -media.getPublicDirectory(DIR_CAMERA, (err, dicResult) => { +media.getPublicDirectory(DIR_CAMERA, (error, dicResult) => { if (dicResult == 'Camera/') { - console.info('mediaLibraryTest : getPublicDirectory passed'); + console.info('getPublicDirectory DIR_CAMERA successfully'); } else { - console.error('mediaLibraryTest : getPublicDirectory failed'); + console.error('getPublicDirectory DIR_CAMERA failed with error: ' + error); } }); ``` @@ -457,12 +486,15 @@ Obtains a public directory. This API uses a promise to return the result. ```js async function example() { let DIR_CAMERA = mediaLibrary.DirectoryType.DIR_CAMERA; - const dicResult = await media.getPublicDirectory(DIR_CAMERA); - if (dicResult == 'Camera/') { - console.info('MediaLibraryTest : getPublicDirectory'); - } else { - console.error('MediaLibraryTest : getPublicDirectory failed'); - } + media.getPublicDirectory(DIR_CAMERA).then((dicResult) => { + if (dicResult == 'Camera/') { + console.info('getPublicDirectory DIR_CAMERA successfully'); + } else { + console.error('getPublicDirectory DIR_CAMERA failed'); + } + }).catch((error) => { + console.error('getPublicDirectory failed with error: ' + error); + }); } ``` @@ -486,19 +518,19 @@ Obtains the albums. This API uses an asynchronous callback to return the result. **Example** ```js -let AlbumNoArgsfetchOp = { - selections: '', - selectionArgs: [], -}; -media.getAlbums(AlbumNoArgsfetchOp, (err, albumList) => { - if (albumList != undefined) { - const album = albumList[0]; - console.info('album.albumName = ' + album.albumName); - console.info('album.count = ' + album.count); - } else { - console.error('getAlbum fail, message = ' + err); - } -}) +async function example() { + let AlbumNoArgsfetchOp = { + selections: '', + selectionArgs: [], + }; + media.getAlbums(AlbumNoArgsfetchOp, (error, albumList) => { + if (albumList != undefined) { + console.info('getAlbums successfully: ' + JSON.stringify(albumList)); + } else { + console.error('getAlbums failed with error: ' + error); + } + }) +} ``` ### getAlbums7+ @@ -526,15 +558,17 @@ Obtains the albums. This API uses a promise to return the result. **Example** ```js -let AlbumNoArgsfetchOp = { - selections: '', - selectionArgs: [], -}; -media.getAlbums(AlbumNoArgsfetchOp).then(function(albumList){ - console.info("getAlbums successfully:"+ JSON.stringify(albumList)); -}).catch(function(err){ - console.error("getAlbums failed with error: " + err); -}); +async function example() { + let AlbumNoArgsfetchOp = { + selections: '', + selectionArgs: [], + }; + media.getAlbums(AlbumNoArgsfetchOp).then((albumList) => { + console.info('getAlbums successfully: ' + JSON.stringify(albumList)); + }).catch((error) => { + console.error('getAlbums failed with error: ' + error); + }); +} ``` ### release8+ @@ -550,12 +584,12 @@ Call this API when you no longer need to use the APIs in the **MediaLibrary** in | Name | Type | Mandatory | Description | | -------- | ------------------------- | ---- | ---------- | -| callback | AsyncCallback<void> | Yes | Callback used to return the execution result.| +| callback | AsyncCallback<void> | Yes | Callback that returns no value.| **Example** ```js -media.release((err) => { +media.release(() => { // do something }); ``` @@ -604,16 +638,16 @@ Stores a media asset. This API uses an asynchronous callback to return the URI t ```js let option = { - src : "/data/storage/el2/base/haps/entry/image.png", - mimeType : "image/*", - relativePath : "Pictures/" + src : '/data/storage/el2/base/haps/entry/image.png', + mimeType : 'image/*', + relativePath : 'Pictures/' }; -mediaLibrary.getMediaLibrary().storeMediaAsset(option, (err, value) => { - if (err) { - console.error("An error occurred when storing media resources."); +mediaLibrary.getMediaLibrary().storeMediaAsset(option, (error, value) => { + if (error) { + console.error('storeMediaAsset failed with error: ' + error); return; } - console.info("Media resources stored. "); + console.info('Media resources stored. '); // Obtain the URI that stores the media asset. }); ``` @@ -647,15 +681,15 @@ Stores a media asset. This API uses a promise to return the URI that stores the ```js let option = { - src : "/data/storage/el2/base/haps/entry/image.png", - mimeType : "image/*", - relativePath : "Pictures/" + src : '/data/storage/el2/base/haps/entry/image.png', + mimeType : 'image/*', + relativePath : 'Pictures/' }; mediaLibrary.getMediaLibrary().storeMediaAsset(option).then((value) => { - console.info("Media resources stored."); + console.info('Media resources stored.'); // Obtain the URI that stores the media asset. -}).catch((err) => { - console.error("An error occurred when storing media resources."); +}).catch((error) => { + console.error('storeMediaAsset failed with error: ' + error); }); ``` @@ -676,7 +710,7 @@ Starts image preview, with the first image to preview specified. This API can be | Name | Type | Mandatory | Description | | -------- | ------------------------- | ---- | ---------------------------------------- | -| images | Array<string> | Yes | URIs of the images to preview. The value can start with either **https://** or **datashare://**.| +| images | Array<string> | Yes | URIs of the images to preview. The value can start with either **'https://'** or **'datashare://'**.| | index | number | Yes | Index of the first image to preview. | | callback | AsyncCallback<void> | Yes | Callback used to return the image preview result. If the preview fails, an error message is returned. | @@ -684,22 +718,22 @@ Starts image preview, with the first image to preview specified. This API can be ```js let images = [ - "datashare:///media/xxxx/2", - "datashare:///media/xxxx/3" + 'datashare:///media/xxxx/2', + 'datashare:///media/xxxx/3' ]; /* Preview online images. let images = [ - "https://media.xxxx.com/image1.jpg", - "https://media.xxxx.com/image2.jpg" + 'https://media.xxxx.com/image1.jpg', + 'https://media.xxxx.com/image2.jpg' ]; */ let index = 1; -mediaLibrary.getMediaLibrary().startImagePreview(images, index, (err) => { - if (err) { - console.error("An error occurred when previewing the images."); +mediaLibrary.getMediaLibrary().startImagePreview(images, index, (error) => { + if (error) { + console.error('startImagePreview failed with error: ' + error); return; } - console.info("Succeeded in previewing the images."); + console.info('Succeeded in previewing the images.'); }); ``` @@ -720,28 +754,28 @@ Starts image preview. This API can be used to preview local images whose URIs st | Name | Type | Mandatory | Description | | -------- | ------------------------- | ---- | ---------------------------------------- | -| images | Array<string> | Yes | URIs of the images to preview. The value can start with either **https://** or **datashare://**.| +| images | Array<string> | Yes | URIs of the images to preview. The value can start with either **'https://'** or **'datashare://'**.| | callback | AsyncCallback<void> | Yes | Callback used to return the image preview result. If the preview fails, an error message is returned. | **Example** ```js let images = [ - "datashare:///media/xxxx/2", - "datashare:///media/xxxx/3" + 'datashare:///media/xxxx/2', + 'datashare:///media/xxxx/3' ]; /* Preview online images. let images = [ - "https://media.xxxx.com/image1.jpg", - "https://media.xxxx.com/image2.jpg" + 'https://media.xxxx.com/image1.jpg', + 'https://media.xxxx.com/image2.jpg' ]; */ -mediaLibrary.getMediaLibrary().startImagePreview(images, (err) => { - if (err) { - console.error("An error occurred when previewing the images."); +mediaLibrary.getMediaLibrary().startImagePreview(images, (error) => { + if (error) { + console.error('startImagePreview failed with error: ' + error); return; } - console.info("Succeeded in previewing the images."); + console.info('Succeeded in previewing the images.'); }); ``` @@ -762,7 +796,7 @@ Starts image preview, with the first image to preview specified. This API can be | Name | Type | Mandatory | Description | | ------ | ------------------- | ---- | ---------------------------------------- | -| images | Array<string> | Yes | URIs of the images to preview. The value can start with either **https://** or **datashare://**.| +| images | Array<string> | Yes | URIs of the images to preview. The value can start with either **'https://'** or **'datashare://'**.| | index | number | No | Index of the first image to preview. If this parameter is not specified, the default value **0** is used. | **Return value** @@ -775,20 +809,20 @@ Starts image preview, with the first image to preview specified. This API can be ```js let images = [ - "datashare:///media/xxxx/2", - "datashare:///media/xxxx/3" + 'datashare:///media/xxxx/2', + 'datashare:///media/xxxx/3' ]; /* Preview online images. let images = [ - "https://media.xxxx.com/image1.jpg", - "https://media.xxxx.com/image2.jpg" + 'https://media.xxxx.com/image1.jpg', + 'https://media.xxxx.com/image2.jpg' ]; */ let index = 1; mediaLibrary.getMediaLibrary().startImagePreview(images, index).then(() => { - console.info("Succeeded in previewing the images."); -}).catch((err) => { - console.error("An error occurred when previewing the images."); + console.info('Succeeded in previewing the images.'); +}).catch((error) => { + console.error('startImagePreview failed with error: ' + error); }); ``` @@ -816,15 +850,15 @@ Starts media selection. This API uses an asynchronous callback to return the lis ```js let option : mediaLibrary.MediaSelectOption = { - type : "media", + type : 'media', count : 2 }; -mediaLibrary.getMediaLibrary().startMediaSelect(option, (err, value) => { - if (err) { - console.error("An error occurred when selecting media resources."); +mediaLibrary.getMediaLibrary().startMediaSelect(option, (error, value) => { + if (error) { + console.error('startMediaSelect failed with error: ' + error); return; } - console.info("Media resources selected."); + console.info('Media resources selected.'); // Obtain the media selection value. }); ``` @@ -858,14 +892,14 @@ Starts media selection. This API uses a promise to return the list of URIs that ```js let option : mediaLibrary.MediaSelectOption = { - type : "media", + type : 'media', count : 2 }; mediaLibrary.getMediaLibrary().startMediaSelect(option).then((value) => { - console.info("Media resources selected."); + console.info('Media resources selected.'); // Obtain the media selection value. -}).catch((err) => { - console.error("An error occurred when selecting media resources."); +}).catch((error) => { + console.error('startMediaSelect failed with error: ' + error); }); ``` @@ -893,14 +927,12 @@ Obtains information about online peer devices. This API uses a promise to return async function example() { media.getActivePeers().then((devicesInfo) => { if (devicesInfo != undefined) { - for (let i = 0; i < devicesInfo.length; i++) { - console.info('get distributed info ' + devicesInfo[i].deviceName + devicesInfo[i].networkId); - } + console.info('get distributed info ' + JSON.stringify(devicesInfo)); } else { - console.info('get distributed info is undefined!') + console.info('get distributed info is undefined!'); } - }).catch((err) => { - console.error("get distributed info failed with error:" + err); + }).catch((error) => { + console.error('get distributed info failed with error: ' + error); }); } ``` @@ -927,15 +959,13 @@ Obtains information about online peer devices. This API uses an asynchronous cal ```js async function example() { - media.getActivePeers((err, devicesInfo) => { + media.getActivePeers((error, devicesInfo) => { if (devicesInfo != undefined) { - for (let i = 0; i < devicesInfo.length; i++) { - console.info('get distributed info ' + devicesInfo[i].deviceName + devicesInfo[i].networkId); - } + console.info('get distributed info ' + JSON.stringify(devicesInfo)); } else { - console.error('get distributed fail, message = ' + err) + console.error('get distributed failed with error: ' + error); } - }) + }); } ``` @@ -964,14 +994,12 @@ Obtains information about all peer devices. This API uses a promise to return th async function example() { media.getAllPeers().then((devicesInfo) => { if (devicesInfo != undefined) { - for (let i = 0; i < devicesInfo.length; i++) { - console.info('get distributed info ' + devicesInfo[i].deviceName + devicesInfo[i].networkId); - } + console.info('get distributed info ' + JSON.stringify(devicesInfo)); } else { - console.info('get distributed info is undefined!') + console.info('get distributed info is undefined!'); } - }).catch((err) => { - console.error("get distributed info failed with error: " + err); + }).catch((error) => { + console.error('get distributed info failed with error: ' + error); }); } ``` @@ -998,15 +1026,13 @@ Obtains information about online peer devices. This API uses an asynchronous cal ```js async function example() { - media.getAllPeers((err, devicesInfo) => { + media.getAllPeers((error, devicesInfo) => { if (devicesInfo != undefined) { - for (let i = 0; i < devicesInfo.length; i++) { - console.info('get distributed info ' + devicesInfo[i].deviceName + devicesInfo[i].networkId); - } + console.info('get distributed info ' + JSON.stringify(devicesInfo)); } else { - console.error('get distributed fail, message = ' + err) + console.error('get distributed failed with error: ' + error); } - }) + }); } ``` @@ -1068,19 +1094,23 @@ Checks whether this file asset is a directory. This API uses an asynchronous cal ```js async function example() { - let fileKeyObj = mediaLibrary.FileKey + let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; const fetchFileResult = await media.getFileAssets(getImageOp); const asset = await fetchFileResult.getFirstObject(); - asset.isDirectory((err, isDirectory) => { - // do something + asset.isDirectory((error, isDirectory) => { + if (error) { + console.error('isDirectory failed with error: ' + error); + } else { + console.info('isDirectory result:' + isDirectory); + } }); + fetchFileResult.close(); } ``` @@ -1104,21 +1134,21 @@ Checks whether this file asset is a directory. This API uses a promise to return ```js async function example() { - let fileKeyObj = mediaLibrary.FileKey + let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; const fetchFileResult = await media.getFileAssets(getImageOp); const asset = await fetchFileResult.getFirstObject(); - asset.isDirectory().then(function(isDirectory){ - console.info("isDirectory result:"+ isDirectory); - }).catch(function(err){ - console.error("isDirectory failed with error: " + err); + asset.isDirectory().then((isDirectory) => { + console.info('isDirectory result:' + isDirectory); + }).catch((error) => { + console.error('isDirectory failed with error: ' + error); }); + fetchFileResult.close(); } ``` @@ -1142,20 +1172,20 @@ Commits the modification in this file asset to the database. This API uses an as ```js async function example() { - let fileKeyObj = mediaLibrary.FileKey + let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; const fetchFileResult = await media.getFileAssets(getImageOp); const asset = await fetchFileResult.getFirstObject(); asset.title = 'newtitle'; asset.commitModify(() => { - console.info('commitModify success'); + console.info('commitModify successfully'); }); + fetchFileResult.close(); } ``` @@ -1179,18 +1209,18 @@ Commits the modification in this file asset to the database. This API uses a pro ```js async function example() { - let fileKeyObj = mediaLibrary.FileKey + let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; const fetchFileResult = await media.getFileAssets(getImageOp); const asset = await fetchFileResult.getFirstObject(); asset.title = 'newtitle'; - asset.commitModify(); + await asset.commitModify(); + fetchFileResult.close(); } ``` @@ -1200,9 +1230,7 @@ open(mode: string, callback: AsyncCallback<number>): void Opens this file asset. This API uses an asynchronous callback to return the result. -> **NOTE** -> -> Currently, the write operations are mutually exclusive. After the write operation is complete, you must call **close** to release the resource. +**NOTE**: When a file is opened in 'w' mode, the returned FD cannot be read. However, due to the implementation differences of file systems, some user-mode files opened in 'w' mode can be read by using FD. To perform the read or write operation on a file by using FD, you are advised to open the file in 'rw' mode. The write operations are mutually exclusive. After a write operation is complete, you must call **close** to release the resource. **Required permissions**: ohos.permission.READ_MEDIA or ohos.permission.WRITE_MEDIA @@ -1222,13 +1250,13 @@ async function example() { let mediaType = mediaLibrary.MediaType.IMAGE; let DIR_IMAGE = mediaLibrary.DirectoryType.DIR_IMAGE; const path = await media.getPublicDirectory(DIR_IMAGE); - const asset = await media.createAsset(mediaType, "image00003.jpg", path); - asset.open('rw', (openError, fd) => { - if(fd > 0){ - asset.close(fd); - }else{ - console.error('File Open Failed!' + openError); - } + const asset = await media.createAsset(mediaType, 'image00003.jpg', path); + asset.open('rw', (error, fd) => { + if (fd > 0) { + asset.close(fd); + } else { + console.error('File Open failed with error: ' + error); + } }); } ``` @@ -1239,9 +1267,7 @@ open(mode: string): Promise<number> Opens this file asset. This API uses a promise to return the result. -> **NOTE** -> -> Currently, the write operations are mutually exclusive. After the write operation is complete, you must call **close** to release the resource. +**NOTE**: When a file is opened in 'w' mode, the returned FD cannot be read. However, due to the implementation differences of file systems, some user-mode files opened in 'w' mode can be read by using FD. To perform the read or write operation on a file by using FD, you are advised to open the file in 'rw' mode. The write operations are mutually exclusive. After a write operation is complete, you must call **close** to release the resource. **Required permissions**: ohos.permission.READ_MEDIA or ohos.permission.WRITE_MEDIA @@ -1266,14 +1292,12 @@ async function example() { let mediaType = mediaLibrary.MediaType.IMAGE; let DIR_IMAGE = mediaLibrary.DirectoryType.DIR_IMAGE; const path = await media.getPublicDirectory(DIR_IMAGE); - const asset = await media.createAsset(mediaType, "image00003.jpg", path); - asset.open('rw') - .then((fd) => { - console.info('File fd!' + fd); - }) - .catch((err) => { - console.error('File err!' + err); - }); + const asset = await media.createAsset(mediaType, 'image00003.jpg', path); + asset.open('rw').then((fd) => { + console.info('File open fd: ' + fd); + }).catch((error) => { + console.error('File open failed with error: ' + error); + }); } ``` @@ -1298,30 +1322,28 @@ Closes this file asset. This API uses an asynchronous callback to return the res ```js async function example() { - let fileKeyObj = mediaLibrary.FileKey + let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; const fetchFileResult = await media.getFileAssets(getImageOp); const asset = await fetchFileResult.getFirstObject(); asset.open('rw').then((fd) => { - console.info('File fd!' + fd); - asset.close(fd, (closeErr) => { - if (closeErr != undefined) { - console.error('mediaLibraryTest : close : FAIL ' + closeErr); - console.error('mediaLibraryTest : ASSET_CALLBACK : FAIL'); + console.info('File open fd: ' + fd); + asset.close(fd, (error) => { + if (error) { + console.error('asset.close failed with error: ' + error); } else { - console.info("=======asset.close success====>"); + console.info('asset.close successfully'); } }); - }) - .catch((err) => { - console.error('File err!' + err); + }).catch((error) => { + console.error('File open failed with error: ' + error); }); + fetchFileResult.close(); } ``` @@ -1351,31 +1373,26 @@ Closes this file asset. This API uses a promise to return the result. ```js async function example() { - let fileKeyObj = mediaLibrary.FileKey + let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; const fetchFileResult = await media.getFileAssets(getImageOp); const asset = await fetchFileResult.getFirstObject(); asset.open('rw').then((fd) => { console.info('File fd!' + fd); - asset.close(fd).then((closeErr) => { - if (closeErr != undefined) { - console.error('mediaLibraryTest : close : FAIL ' + closeErr); - console.error('mediaLibraryTest : ASSET_CALLBACK : FAIL'); - - } else { - console.info("=======asset.close success====>"); - } + asset.close(fd).then(() => { + console.info('asset.close successfully'); + }).catch((closeErr) => { + console.error('asset.close fail, closeErr: ' + closeErr); }); - }) - .catch((err) => { - console.error('File err!' + err); + }).catch((error) => { + console.error('open File failed with error: ' + error); }); + fetchFileResult.close(); } ``` @@ -1399,19 +1416,23 @@ Obtains the thumbnail of this file asset. This API uses an asynchronous callback ```js async function example() { - let fileKeyObj = mediaLibrary.FileKey + let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; const fetchFileResult = await media.getFileAssets(getImageOp); const asset = await fetchFileResult.getFirstObject(); - asset.getThumbnail((err, pixelmap) => { - console.info('mediaLibraryTest : getThumbnail Successful '+ pixelmap); + asset.getThumbnail((error, pixelmap) => { + if (error) { + console.error('mediaLibrary getThumbnail failed with error: ' + error); + } else { + console.info('mediaLibrary getThumbnail Successful, pixelmap ' + JSON.stringify(pixelmap)); + } }); + fetchFileResult.close(); } ``` @@ -1439,17 +1460,21 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; let size = { width: 720, height: 720 }; const fetchFileResult = await media.getFileAssets(getImageOp); const asset = await fetchFileResult.getFirstObject(); - asset.getThumbnail(size, (err, pixelmap) => { - console.info('mediaLibraryTest : getThumbnail Successful '+ pixelmap); + asset.getThumbnail(size, (error, pixelmap) => { + if (error) { + console.error('mediaLibrary getThumbnail failed with error: ' + error); + } else { + console.info('mediaLibrary getThumbnail Successful, pixelmap ' + JSON.stringify(pixelmap)); + } }); + fetchFileResult.close(); } ``` @@ -1484,19 +1509,17 @@ async function example() { let getImageOp = { selections: fileKeyObj.MEDIA_TYPE + '= ?', selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + order: fileKeyObj.DATE_ADDED + ' DESC', }; let size = { width: 720, height: 720 }; const fetchFileResult = await media.getFileAssets(getImageOp); const asset = await fetchFileResult.getFirstObject(); - asset.getThumbnail(size) - .then((pixelmap) => { - console.info('mediaLibraryTest : getThumbnail Successful '+ pixelmap); - }) - .catch((err) => { - console.error('mediaLibraryTest : getThumbnail fail, err: ' + err); + asset.getThumbnail(size).then((pixelmap) => { + console.info('mediaLibrary getThumbnail Successful, pixelmap ' + JSON.stringify(pixelmap)); + }).catch((error) => { + console.error('mediaLibrary getThumbnail failed with error: ' + error); }); + fetchFileResult.close(); } ``` @@ -1524,16 +1547,20 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; const fetchFileResult = await media.getFileAssets(getImageOp); const asset = await fetchFileResult.getFirstObject(); - asset.favorite(true,function(err){ - // do something + asset.favorite(true,(error) => { + if (error) { + console.error('mediaLibrary favorite failed with error: ' + error); + } else { + console.info('mediaLibrary favorite Successful'); + } }); + fetchFileResult.close(); } ``` @@ -1566,18 +1593,18 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; const fetchFileResult = await media.getFileAssets(getImageOp); const asset = await fetchFileResult.getFirstObject(); - asset.favorite(true).then(function() { - console.info("favorite successfully"); - }).catch(function(err){ - console.error("favorite failed with error: " + err); + asset.favorite(true).then(() => { + console.info('mediaLibrary favorite Successful'); + }).catch((error) => { + console.error('mediaLibrary favorite failed with error: ' + error); }); + fetchFileResult.close(); } ``` @@ -1604,20 +1631,20 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; const fetchFileResult = await media.getFileAssets(getImageOp); const asset = await fetchFileResult.getFirstObject(); - asset.isFavorite((err, isFavorite) => { - if (isFavorite) { - console.info('FileAsset is favorite'); - }else{ - console.info('FileAsset is not favorite'); + asset.isFavorite((error, isFavorite) => { + if (error) { + console.error('mediaLibrary favoriisFavoritete failed with error: ' + error); + } else { + console.info('mediaLibrary isFavorite Successful, isFavorite result: ' + isFavorite); } }); + fetchFileResult.close(); } ``` @@ -1644,18 +1671,18 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; const fetchFileResult = await media.getFileAssets(getImageOp); const asset = await fetchFileResult.getFirstObject(); - asset.isFavorite().then(function(isFavorite){ - console.info("isFavorite result:"+ isFavorite); - }).catch(function(err){ - console.error("isFavorite failed with error: " + err); + asset.isFavorite().then((isFavorite) => { + console.info('mediaLibrary isFavorite Successful, isFavorite result: ' + isFavorite); + }).catch((error) => { + console.error('mediaLibrary favoriisFavoritete failed with error: ' + error); }); + fetchFileResult.close(); } ``` @@ -1685,17 +1712,20 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; const fetchFileResult = await media.getFileAssets(getImageOp); const asset = await fetchFileResult.getFirstObject(); - asset.trash(true, trashCallBack); - function trashCallBack(err, trash) { - console.info('mediaLibraryTest : ASSET_CALLBACK ASSET_CALLBACK trash'); - } + asset.trash(true, (error) => { + if (error) { + console.error('mediaLibrary trash failed with error: ' + error); + } else { + console.info('mediaLibrary trash Successful'); + } + }); + fetchFileResult.close(); } ``` @@ -1730,18 +1760,18 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; const fetchFileResult = await media.getFileAssets(getImageOp); const asset = await fetchFileResult.getFirstObject(); - asset.trash(true).then(function() { - console.info("trash successfully"); - }).catch(function(err){ - console.error("trash failed with error: " + err); + asset.trash(true).then(() => { + console.info('trash successfully'); + }).catch((error) => { + console.error('trash failed with error: ' + error); }); + fetchFileResult.close(); } ``` @@ -1768,20 +1798,20 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; const fetchFileResult = await media.getFileAssets(getImageOp); const asset = await fetchFileResult.getFirstObject(); - asset.isTrash((err, isTrash) => { - if (isTrash == undefined) { - console.error('Failed to get trash state: ' + err); - return; - } - console.info('Get trash state success: ' + isTrash); + asset.isTrash((error, isTrash) => { + if (error) { + console.error('Failed to get trash state failed with error: ' + error); + return; + } + console.info('Get trash state successfully, isTrash result: ' + isTrash); }); + fetchFileResult.close(); } ``` @@ -1808,17 +1838,18 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; const fetchFileResult = await media.getFileAssets(getImageOp); const asset = await fetchFileResult.getFirstObject(); - asset.isTrash().then(function(isTrash){ - console.info("isTrash result: " + isTrash); - }).catch(function(err){ - console.error("isTrash failed with error: " + err); + asset.isTrash().then((isTrash) => { + console.info('isTrash result: ' + isTrash); + }).catch((error) => { + console.error('isTrash failed with error: ' + error); }); + fetchFileResult.close(); } ``` @@ -1849,11 +1880,12 @@ async function example() { let getFileCountOneOp = { selections: fileKeyObj.MEDIA_TYPE + '= ?', selectionArgs: [fileType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + order: fileKeyObj.DATE_ADDED + ' DESC', }; let fetchFileResult = await media.getFileAssets(getFileCountOneOp); const fetchCount = fetchFileResult.getCount(); + console.info('fetchCount result: ' + fetchCount); + fetchFileResult.close(); } ``` @@ -1878,25 +1910,22 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; let fetchFileResult = await media.getFileAssets(getImageOp); const fetchCount = fetchFileResult.getCount(); - console.info('mediaLibraryTest : count:' + fetchCount); + console.info('mediaLibrary fetchFileResult.getCount, count:' + fetchCount); let fileAsset = await fetchFileResult.getFirstObject(); for (var i = 1; i < fetchCount; i++) { - fileAsset = await fetchFileResult.getNextObject(); - if(i == fetchCount - 1) { - console.info('mediaLibraryTest : isLast'); - var result = fetchFileResult.isAfterLast(); - console.info('mediaLibraryTest : isAfterLast:' + result); - console.info('mediaLibraryTest : isAfterLast end'); - fetchFileResult.close(); - } + fileAsset = await fetchFileResult.getNextObject(); + if(i == fetchCount - 1) { + var result = fetchFileResult.isAfterLast(); + console.info('mediaLibrary fileAsset isAfterLast result: ' + result); + } } + fetchFileResult.close(); } ``` @@ -1915,10 +1944,9 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; let fetchFileResult = await media.getFileAssets(getImageOp); fetchFileResult.close(); @@ -1946,19 +1974,19 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; let fetchFileResult = await media.getFileAssets(getImageOp); - fetchFileResult.getFirstObject((err, fileAsset) => { - if (err) { - console.error('Failed '); - return; - } - console.info('fileAsset.displayName : ' + fileAsset.displayName); + fetchFileResult.getFirstObject((error, fileAsset) => { + if (error) { + console.error('fetchFileResult getFirstObject failed with error: ' + error); + return; + } + console.info('getFirstObject successfully, displayName : ' + fileAsset.displayName); }) + fetchFileResult.close(); } ``` @@ -1983,17 +2011,17 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; let fetchFileResult = await media.getFileAssets(getImageOp); - fetchFileResult.getFirstObject().then(function(fileAsset){ - console.info("getFirstObject successfully:"+ JSON.stringify(fileAsset)); - }).catch(function(err){ - console.error("getFirstObject failed with error: " + err); + fetchFileResult.getFirstObject().then((fileAsset) => { + console.info('getFirstObject successfully, displayName: ' + fileAsset.displayName); + }).catch((error) => { + console.error('getFirstObject failed with error: ' + error); }); + fetchFileResult.close(); } ``` @@ -2002,6 +2030,9 @@ async function example() { getNextObject(callback: AsyncCallback<FileAsset>): void Obtains the next file asset in the result set. This API uses an asynchronous callback to return the result. +> **NOTE** +> +> Before using this API, you must use [getFirstObject](#getfirstobject7) to obtain the first file asset and then use [isAfterLast](#isafterlast7) to ensure that the cursor does not point to the last file asset in the result set. **System capability**: SystemCapability.Multimedia.MediaLibrary.Core @@ -2018,20 +2049,24 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; let fetchFileResult = await media.getFileAssets(getImageOp); - fetchFileResult.getNextObject((err, fileAsset) => { - if (err) { - console.error('Failed '); - return; - } - console.log('fileAsset.displayName : ' + fileAsset.displayName); - }) + let fileAsset = await fetchFileResult.getFirstObject(); + if (! fetchFileResult.isAfterLast) { + fetchFileResult.getNextObject((error, fileAsset) => { + if (error) { + console.error('fetchFileResult getNextObject failed with error: ' + error); + return; + } + console.log('fetchFileResult getNextObject successfully, displayName: ' + fileAsset.displayName); + }) + } + fetchFileResult.close(); } + ``` ### getNextObject7+ @@ -2039,6 +2074,9 @@ async function example() { getNextObject(): Promise<FileAsset> Obtains the next file asset in the result set. This API uses a promise to return the result. +> **NOTE** +> +> Before using this API, you must use [getFirstObject](#getfirstobject7) to obtain the first file asset and then use [isAfterLast](#isafterlast7) to ensure that the cursor does not point to the last file asset in the result set. **System capability**: SystemCapability.Multimedia.MediaLibrary.Core @@ -2055,15 +2093,20 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; let fetchFileResult = await media.getFileAssets(getImageOp); - const fetchCount = fetchFileResult.getCount(); - console.info('mediaLibraryTest : count:' + fetchCount); - let fileAsset = await fetchFileResult.getNextObject(); + let fileAsset = await fetchFileResult.getFirstObject(); + if (! fetchFileResult.isAfterLast) { + fetchFileResult.getNextObject().then((fileAsset) => { + console.info('fetchFileResult getNextObject successfully, displayName: ' + fileAsset.displayName); + }).catch((error) => { + console.error('fetchFileResult getNextObject failed with error: ' + error); + }) + } + fetchFileResult.close(); } ``` @@ -2088,19 +2131,19 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; let fetchFileResult = await media.getFileAssets(getImageOp); - fetchFileResult.getLastObject((err, fileAsset) => { - if (err) { - console.error('Failed '); - return; - } - console.info('fileAsset.displayName : ' + fileAsset.displayName); + fetchFileResult.getLastObject((error, fileAsset) => { + if (error) { + console.error('getLastObject failed with error: ' + error); + return; + } + console.info('getLastObject successfully, displayName: ' + fileAsset.displayName); }) + fetchFileResult.close(); } ``` @@ -2125,13 +2168,17 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; let fetchFileResult = await media.getFileAssets(getImageOp); - let lastObject = await fetchFileResult.getLastObject(); + fetchFileResult.getLastObject().then((fileAsset) => { + console.info('getLastObject successfully, displayName: ' + fileAsset.displayName); + }).catch((error) => { + console.error('getLastObject failed with error: ' + error); + }); + fetchFileResult.close(); } ``` @@ -2147,7 +2194,7 @@ Obtains a file asset with the specified index in the result set. This API uses a | Name | Type | Mandatory | Description | | -------- | ---------------------------------------- | ---- | ------------------ | -| index | number | Yes | Index of the file asset to obtain. The value starts from **0**. | +| index | number | Yes | Index of the file to obtain. The value starts from 0 and must be smaller than the **count** value of the result set. | | callback | AsyncCallback<[FileAsset](#fileasset7)> | Yes | Callback used to return the last file asset.| **Example** @@ -2157,19 +2204,19 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; let fetchFileResult = await media.getFileAssets(getImageOp); - fetchFileResult.getPositionObject(0, (err, fileAsset) => { - if (err) { - console.error('Failed '); - return; - } - console.info('fileAsset.displayName : ' + fileAsset.displayName); + fetchFileResult.getPositionObject(0, (error, fileAsset) => { + if (error) { + console.error('getPositionObject failed with error: ' + error); + return; + } + console.info('getPositionObject successfully, displayName: ' + fileAsset.displayName); }) + fetchFileResult.close(); } ``` @@ -2185,7 +2232,7 @@ Obtains a file asset with the specified index in the result set. This API uses a | Name | Type | Mandatory | Description | | ----- | ------ | ---- | -------------- | -| index | number | Yes | Index of the file asset to obtain. The value starts from **0**.| +| index | number | Yes | Index of the file to obtain. The value starts from 0 and must be smaller than the **count** value of the result set.| **Return value** @@ -2200,17 +2247,17 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; let fetchFileResult = await media.getFileAssets(getImageOp); - fetchFileResult.getPositionObject(1) .then(function (fileAsset){ - console.info('fileAsset.displayName : ' + fileAsset.displayName); - }).catch(function (err) { - console.error("getFileAssets failed with error: " + err); + fetchFileResult.getPositionObject(0).then((fileAsset) => { + console.info('getPositionObject successfully, displayName: ' + fileAsset.displayName); + }).catch((error) => { + console.error('getPositionObject failed with error: ' + error); }); + fetchFileResult.close(); } ``` @@ -2226,7 +2273,7 @@ Obtains all the file assets in the result set. This API uses an asynchronous cal | Name | Type | Mandatory | Description | | -------- | ---------------------------------------- | ---- | -------------------- | -| callback | AsyncCallback> | Yes | Callback used to return the file assets.| +| callback | AsyncCallback<Array<[FileAsset](#fileasset7)>> | Yes | Callback used to return the file assets.| **Example** @@ -2235,21 +2282,21 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; let fetchFileResult = await media.getFileAssets(getImageOp); - fetchFileResult.getAllObject((err, fileAsset) => { - if (err) { - console.error('Failed '); + fetchFileResult.getAllObject((error, fileAssetList) => { + if (error) { + console.error('getAllObject failed with error: ' + error); return; } for (let i = 0; i < fetchFileResult.getCount(); i++) { - console.info('fileAsset.displayName : ' + fileAsset[i].displayName); + console.info('getAllObject fileAssetList ' + i + ' displayName: ' + fileAssetList[i].displayName); } }) + fetchFileResult.close(); } ``` @@ -2265,7 +2312,7 @@ Obtains all the file assets in the result set. This API uses a promise to return | Type | Description | | ---------------------------------------- | --------------------- | -| Promise> | Promise used to return the file assets.| +| Promise<Array<[FileAsset](#fileasset7)>> | Promise used to return the file assets.| **Example** @@ -2274,13 +2321,19 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; let fetchFileResult = await media.getFileAssets(getImageOp); - var data = fetchFileResult.getAllObject(); + fetchFileResult.getAllObject().then((fileAssetList) => { + for (let i = 0; i < fetchFileResult.getCount(); i++) { + console.info('getAllObject fileAssetList ' + i + ' displayName: ' + fileAssetList[i].displayName); + } + }).catch((error) => { + console.error('getAllObject failed with error: ' + error); + }); + fetchFileResult.close(); } ``` @@ -2329,12 +2382,12 @@ async function example() { const albumList = await media.getAlbums(AlbumNoArgsfetchOp); const album = albumList[0]; album.albumName = 'hello'; - album.commitModify((err) => { - if (err) { - console.error('Failed '); - return; - } - console.info('Modify successful.'); + album.commitModify((error) => { + if (error) { + console.error('commitModify failed with error: ' + error); + return; + } + console.info('commitModify successful.'); }) } ``` @@ -2366,10 +2419,10 @@ async function example() { const albumList = await media.getAlbums(AlbumNoArgsfetchOp); const album = albumList[0]; album.albumName = 'hello'; - album.commitModify().then(function() { - console.info("commitModify successfully"); - }).catch(function(err){ - console.error("commitModify failed with error: " + err); + album.commitModify().then(() => { + console.info('commitModify successfully'); + }).catch((error) => { + console.error('commitModify failed with error: ' + error); }); } ``` @@ -2400,15 +2453,22 @@ async function example() { selectionArgs: [], }; let fileNoArgsfetchOp = { - selections: '', - selectionArgs: [], + selections: '', + selectionArgs: [], } + // Obtain the albums that meet the retrieval options and return the album list. const albumList = await media.getAlbums(AlbumNoArgsfetchOp); const album = albumList[0]; - album.getFileAssets(fileNoArgsfetchOp, getFileAssetsCallBack); - function getFileAssetsCallBack(err, fetchFileResult) { - // do something - } + // Obtain an album from the album list and obtain all media assets that meet the retrieval options in the album. + album.getFileAssets(fileNoArgsfetchOp, (error, fetchFileResult) => { + if (error) { + console.error('album getFileAssets failed with error: ' + error); + return; + } + let count = fetchFileResult.getcount(); + console.info('album getFileAssets successfully, count: ' + count); + }); + fetchFileResult.close(); } ``` @@ -2442,17 +2502,21 @@ async function example() { selections: '', selectionArgs: [], }; - let fileNoArgsfetchOp = { - selections: '', - selectionArgs: [], + let fileNoArgsfetchOp = { + selections: '', + selectionArgs: [], }; + // Obtain the albums that meet the retrieval options and return the album list. const albumList = await media.getAlbums(AlbumNoArgsfetchOp); const album = albumList[0]; - album.getFileAssets(fileNoArgsfetchOp).then(function(albumFetchFileResult){ - console.info("getFileAssets successfully: " + JSON.stringify(albumFetchFileResult)); - }).catch(function(err){ - console.error("getFileAssets failed with error: " + err); + // Obtain an album from the album list and obtain all media assets that meet the retrieval options in the album. + album.getFileAssets(fileNoArgsfetchOp).then((albumFetchFileResult) => { + let count = fetchFileResult.getcount(); + console.info('album getFileAssets successfully, count: ' + count); + }).catch((error) => { + console.error('album getFileAssets failed with error: ' + error); }); + fetchFileResult.close(); } ``` @@ -2491,32 +2555,32 @@ Enumerates media types. Enumerates key file information. > **NOTE** -> +> > The **bucket_id** field may change after file rename or movement. Therefore, you must obtain the field again before using it. **System capability**: SystemCapability.Multimedia.MediaLibrary.Core | Name | Value | Description | | ------------- | ------------------- | ---------------------------------------------------------- | -| ID | "file_id" | File ID. | -| RELATIVE_PATH | "relative_path" | Relative public directory of the file. | -| DISPLAY_NAME | "display_name" | Display file name. | -| PARENT | "parent" | Parent directory ID. | -| MIME_TYPE | "mime_type" | Extended file attributes. | -| MEDIA_TYPE | "media_type" | Media type. | -| SIZE | "size" | File size, in bytes. | -| DATE_ADDED | "date_added" | Date when the file was added. The value is the number of seconds elapsed since the Epoch time. | -| DATE_MODIFIED | "date_modified" | Date when the file content (not the file name) was last modified. The value is the number of seconds elapsed since the Epoch time.| -| DATE_TAKEN | "date_taken" | Date when the file (photo) was taken. The value is the number of seconds elapsed since the Epoch time. | -| TITLE | "title" | Title in the file. | -| ARTIST | "artist" | Artist of the file. | -| AUDIOALBUM | "audio_album" | Audio album. | -| DURATION | "duration" | Duration, in ms. | -| WIDTH | "width" | Image width, in pixels. | -| HEIGHT | "height" | Image height, in pixels. | -| ORIENTATION | "orientation" | Image display direction (clockwise rotation angle, for example, 0, 90, and 180, in degrees).| -| ALBUM_ID | "bucket_id" | ID of the album to which the file belongs. | -| ALBUM_NAME | "bucket_display_name" | Name of the album to which the file belongs. | +| ID | 'file_id' | File ID. | +| RELATIVE_PATH | 'relative_path' | Relative public directory of the file. | +| DISPLAY_NAME | 'display_name' | Display file name. | +| PARENT | 'parent' | Parent directory ID. | +| MIME_TYPE | 'mime_type' | Extended file attributes, such as image/, video/, and file/*. | +| MEDIA_TYPE | 'media_type' | Media type. | +| SIZE | 'size' | File size, in bytes. | +| DATE_ADDED | 'date_added' | Date when the file was added. The value is the number of seconds elapsed since the Epoch time. | +| DATE_MODIFIED | 'date_modified' | Date when the file content (not the file name) was last modified. The value is the number of seconds elapsed since the Epoch time.| +| DATE_TAKEN | 'date_taken' | Date when the file (photo) was taken. The value is the number of seconds elapsed since the Epoch time. | +| TITLE | 'title' | Title in the file. | +| ARTIST | 'artist' | Artist of the file. | +| AUDIOALBUM | 'audio_album' | Audio album. | +| DURATION | 'duration' | Duration, in ms. | +| WIDTH | 'width' | Image width, in pixels. | +| HEIGHT | 'height' | Image height, in pixels. | +| ORIENTATION | 'orientation' | Image display direction (clockwise rotation angle, for example, 0, 90, and 180, in degrees).| +| ALBUM_ID | 'bucket_id' | ID of the album to which the file belongs. | +| ALBUM_NAME | 'bucket_display_name' | Name of the album to which the file belongs. | ## DirectoryType8+ @@ -2559,9 +2623,9 @@ Describes options for fetching media files. | Name | Type | Readable| Writable| Description | | ----------------------- | ------------------- | ---- | ---- | ------------------------------------------------------------ | -| selections | string | Yes | Yes | Conditions for fetching files. The enumerated values in [FileKey](#filekey8) are used as the column names of the conditions. Example:
selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ? OR ' +mediaLibrary.FileKey.MEDIA_TYPE + '= ?', | +| selections | string | Yes | Yes | Conditions for fetching files. The enumerated values in [FileKey](#filekey8) are used as the column names of the conditions. Example:
selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ? OR ' + mediaLibrary.FileKey.MEDIA_TYPE + '= ?', | | selectionArgs | Array<string> | Yes | Yes | Value of the condition, which corresponds to the value of the condition column in **selections**.
Example:
selectionArgs: [mediaLibrary.MediaType.IMAGE.toString(), mediaLibrary.MediaType.VIDEO.toString()], | -| order | string | Yes | Yes | Sorting mode of the search results, which can be ascending or descending. The enumerated values in [FileKey](#filekey8) are used as the columns for sorting the search results. Example:
Ascending: order: mediaLibrary.FileKey.DATE_ADDED + " ASC"
Descending: order: mediaLibrary.FileKey.DATE_ADDED + " DESC"| +| order | string | Yes | Yes | Sorting mode of the search results, which can be ascending or descending. The enumerated values in [FileKey](#filekey8) are used as the columns for sorting the search results. Example:
Ascending: order: mediaLibrary.FileKey.DATE_ADDED + ' ASC'
Descending: order: mediaLibrary.FileKey.DATE_ADDED + ' DESC'| | uri8+ | string | Yes | Yes | File URI. | | networkId8+ | string | Yes | Yes | Network ID of the registered device. | | extendArgs8+ | string | Yes | Yes | Extended parameters for fetching the files. Currently, no extended parameters are available. | diff --git a/en/application-dev/reference/apis/js-apis-notificationManager.md b/en/application-dev/reference/apis/js-apis-notificationManager.md index 2d8f497bede97cc9c6d1a8d408b6e80770a2396f..71987d35944a07545d35d1c37ff438f044b5d898 100644 --- a/en/application-dev/reference/apis/js-apis-notificationManager.md +++ b/en/application-dev/reference/apis/js-apis-notificationManager.md @@ -1,4 +1,4 @@ -# @ohos.notificationManager +# @ohos.notificationManager (NotificationManager) The **notificationManager** module provides notification management capabilities, covering notifications, notification slots, notification enabled status, and notification badge status. @@ -29,6 +29,8 @@ Publishes a notification. This API uses an asynchronous callback to return the r **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------------- | | 1600001 | Internal error. | @@ -50,7 +52,7 @@ function publishCallback(err) { } } // NotificationRequest object -var notificationRequest = { +let notificationRequest = { id: 1, content: { contentType: Notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, @@ -60,8 +62,8 @@ var notificationRequest = { additionalText: "test_additionalText" } } -} -Notification.publish(notificationRequest, publishCallback) +}; +Notification.publish(notificationRequest, publishCallback); ``` @@ -82,6 +84,8 @@ Publishes a notification. This API uses a promise to return the result. **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------------- | | 1600001 | Internal error. | @@ -95,7 +99,7 @@ Publishes a notification. This API uses a promise to return the result. ```js // NotificationRequest object -var notificationRequest = { +let notificationRequest = { notificationId: 1, content: { contentType: Notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, @@ -105,7 +109,7 @@ var notificationRequest = { additionalText: "test_additionalText" } } -} +}; Notification.publish(notificationRequest).then(() => { console.info("publish success"); }); @@ -134,6 +138,8 @@ Publishes a notification to a specified user. This API uses an asynchronous call **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------------- | | 1600001 | Internal error. | @@ -156,9 +162,9 @@ function publishCallback(err) { } } // User ID -var userId = 1 +let userId = 1; // NotificationRequest object -var notificationRequest = { +let notificationRequest = { id: 1, content: { contentType: Notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, @@ -168,7 +174,7 @@ var notificationRequest = { additionalText: "test_additionalText" } } -} +}; Notification.publish(notificationRequest, userId, publishCallback); ``` @@ -193,6 +199,8 @@ Publishes a notification to a specified user. This API uses a promise to return **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------------- | | 1600001 | Internal error. | @@ -206,7 +214,7 @@ Publishes a notification to a specified user. This API uses a promise to return **Example** ```js -var notificationRequest = { +let notificationRequest = { notificationId: 1, content: { contentType: Notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, @@ -216,9 +224,9 @@ var notificationRequest = { additionalText: "test_additionalText" } } -} +}; -var userId = 1 +let userId = 1; Notification.publish(notificationRequest, userId).then(() => { console.info("publish success"); @@ -244,6 +252,8 @@ Cancels a notification with the specified ID and label. This API uses an asynchr **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -262,7 +272,7 @@ function cancelCallback(err) { console.info("cancel success"); } } -Notification.cancel(0, "label", cancelCallback) +Notification.cancel(0, "label", cancelCallback); ``` @@ -284,6 +294,8 @@ Cancels a notification with the specified ID and optional label. This API uses a **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -318,6 +330,8 @@ Cancels a notification with the specified ID. This API uses an asynchronous call **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -336,7 +350,7 @@ function cancelCallback(err) { console.info("cancel success"); } } -Notification.cancel(0, cancelCallback) +Notification.cancel(0, cancelCallback); ``` @@ -351,6 +365,8 @@ Cancels all notifications. This API uses an asynchronous callback to return the **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -374,7 +390,7 @@ function cancelAllCallback(err) { console.info("cancelAll success"); } } -Notification.cancelAll(cancelAllCallback) +Notification.cancelAll(cancelAllCallback); ``` @@ -389,6 +405,8 @@ Cancels all notifications. This API uses a promise to return the result. **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -426,6 +444,8 @@ Adds a notification slot. This API uses an asynchronous callback to return the r **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -444,10 +464,10 @@ function addSlotCallBack(err) { } } // NotificationSlot object -var notificationSlot = { +let notificationSlot = { type: Notification.SlotType.SOCIAL_COMMUNICATION -} -Notification.addSlot(notificationSlot, addSlotCallBack) +}; +Notification.addSlot(notificationSlot, addSlotCallBack); ``` @@ -472,6 +492,8 @@ Adds a notification slot. This API uses a promise to return the result. **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -482,9 +504,9 @@ Adds a notification slot. This API uses a promise to return the result. ```js // NotificationSlot object -var notificationSlot = { +let notificationSlot = { type: Notification.SlotType.SOCIAL_COMMUNICATION -} +}; Notification.addSlot(notificationSlot).then(() => { console.info("addSlot success"); }); @@ -509,6 +531,8 @@ Adds a notification slot of a specified type. This API uses an asynchronous call **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -526,7 +550,7 @@ function addSlotCallBack(err) { console.info("addSlot success"); } } -Notification.addSlot(Notification.SlotType.SOCIAL_COMMUNICATION, addSlotCallBack) +Notification.addSlot(Notification.SlotType.SOCIAL_COMMUNICATION, addSlotCallBack); ``` @@ -547,6 +571,8 @@ Adds a notification slot of a specified type. This API uses a promise to return **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -584,6 +610,8 @@ Adds an array of notification slots. This API uses an asynchronous callback to r **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -602,14 +630,14 @@ function addSlotsCallBack(err) { } } // NotificationSlot object -var notificationSlot = { +let notificationSlot = { type: Notification.SlotType.SOCIAL_COMMUNICATION -} +}; // NotificationSlotArray object -var notificationSlotArray = new Array(); +let notificationSlotArray = new Array(); notificationSlotArray[0] = notificationSlot; -Notification.addSlots(notificationSlotArray, addSlotsCallBack) +Notification.addSlots(notificationSlotArray, addSlotsCallBack); ``` @@ -634,6 +662,8 @@ Adds an array of notification slots. This API uses a promise to return the resul **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -644,11 +674,11 @@ Adds an array of notification slots. This API uses a promise to return the resul ```js // NotificationSlot object -var notificationSlot = { +let notificationSlot = { type: Notification.SlotType.SOCIAL_COMMUNICATION -} +}; // NotificationSlotArray object -var notificationSlotArray = new Array(); +let notificationSlotArray = new Array(); notificationSlotArray[0] = notificationSlot; Notification.addSlots(notificationSlotArray).then(() => { @@ -675,6 +705,8 @@ Obtains a notification slot of a specified type. This API uses an asynchronous c **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -692,8 +724,8 @@ function getSlotCallback(err,data) { console.info("getSlot success"); } } -var slotType = Notification.SlotType.SOCIAL_COMMUNICATION; -Notification.getSlot(slotType, getSlotCallback) +let slotType = Notification.SlotType.SOCIAL_COMMUNICATION; +Notification.getSlot(slotType, getSlotCallback); ``` @@ -720,6 +752,8 @@ Obtains a notification slot of a specified type. This API uses a promise to retu **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -729,7 +763,7 @@ Obtains a notification slot of a specified type. This API uses a promise to retu **Example** ```js -var slotType = Notification.SlotType.SOCIAL_COMMUNICATION; +let slotType = Notification.SlotType.SOCIAL_COMMUNICATION; Notification.getSlot(slotType).then((data) => { console.info("getSlot success, data: " + JSON.stringify(data)); }); @@ -753,6 +787,8 @@ Obtains all notification slots of this application. This API uses an asynchronou **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -770,7 +806,7 @@ function getSlotsCallback(err,data) { console.info("getSlots success"); } } -Notification.getSlots(getSlotsCallback) +Notification.getSlots(getSlotsCallback); ``` @@ -791,6 +827,8 @@ Obtains all notification slots of this application. This API uses a promise to r **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -824,6 +862,8 @@ Removes a notification slot of a specified type. This API uses an asynchronous c **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -841,8 +881,8 @@ function removeSlotCallback(err) { console.info("removeSlot success"); } } -var slotType = Notification.SlotType.SOCIAL_COMMUNICATION; -Notification.removeSlot(slotType,removeSlotCallback) +let slotType = Notification.SlotType.SOCIAL_COMMUNICATION; +Notification.removeSlot(slotType,removeSlotCallback); ``` @@ -863,6 +903,8 @@ Removes a notification slot of a specified type. This API uses a promise to retu **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -872,7 +914,7 @@ Removes a notification slot of a specified type. This API uses a promise to retu **Example** ```js -var slotType = Notification.SlotType.SOCIAL_COMMUNICATION; +let slotType = Notification.SlotType.SOCIAL_COMMUNICATION; Notification.removeSlot(slotType).then(() => { console.info("removeSlot success"); }); @@ -896,6 +938,8 @@ Removes all notification slots. This API uses an asynchronous callback to return **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -912,7 +956,7 @@ function removeAllCallBack(err) { console.info("removeAllSlots success"); } } -Notification.removeAllSlots(removeAllCallBack) +Notification.removeAllSlots(removeAllCallBack); ``` @@ -927,6 +971,8 @@ Removes all notification slots. This API uses a promise to return the result. **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -965,6 +1011,8 @@ Sets whether to enable notification for a specified application. This API uses a **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -982,9 +1030,9 @@ function setNotificationEnablenCallback(err) { console.info("setNotificationEnablenCallback success"); } } -var bundle = { +let bundle = { bundle: "bundleName1", -} +}; Notification.setNotificationEnable(bundle, false, setNotificationEnablenCallback); ``` @@ -1011,6 +1059,8 @@ Sets whether to enable notification for a specified application. This API uses a **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -1021,9 +1071,9 @@ Sets whether to enable notification for a specified application. This API uses a **Example** ```js -var bundle = { +let bundle = { bundle: "bundleName1", -} +}; Notification.setNotificationEnable(bundle, false).then(() => { console.info("setNotificationEnable success"); }); @@ -1052,6 +1102,8 @@ Checks whether notification is enabled for a specified application. This API use **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -1069,9 +1121,9 @@ function isNotificationEnabledCallback(err, data) { console.info("isNotificationEnabled success"); } } -var bundle = { +let bundle = { bundle: "bundleName1", -} +}; Notification.isNotificationEnabled(bundle, isNotificationEnabledCallback); ``` @@ -1103,6 +1155,8 @@ Checks whether notification is enabled for a specified application. This API use **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -1113,9 +1167,9 @@ Checks whether notification is enabled for a specified application. This API use **Example** ```js -var bundle = { +let bundle = { bundle: "bundleName1", -} +}; Notification.isNotificationEnabled(bundle).then((data) => { console.info("isNotificationEnabled success, data: " + JSON.stringify(data)); }); @@ -1143,6 +1197,8 @@ Checks whether notification is enabled for this application. This API uses an as **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -1191,6 +1247,8 @@ Checks whether notification is enabled for the current application. This API use **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -1230,6 +1288,8 @@ Sets whether to enable the notification badge for a specified application. This **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -1247,9 +1307,9 @@ function displayBadgeCallback(err) { console.info("displayBadge success"); } } -var bundle = { +let bundle = { bundle: "bundleName1", -} +}; Notification.displayBadge(bundle, false, displayBadgeCallback); ``` @@ -1276,6 +1336,8 @@ Sets whether to enable the notification badge for a specified application. This **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -1286,9 +1348,9 @@ Sets whether to enable the notification badge for a specified application. This **Example** ```js -var bundle = { +let bundle = { bundle: "bundleName1", -} +}; Notification.displayBadge(bundle, false).then(() => { console.info("displayBadge success"); }); @@ -1317,6 +1379,8 @@ Checks whether the notification badge is enabled for a specified application. Th **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -1334,9 +1398,9 @@ function isBadgeDisplayedCallback(err, data) { console.info("isBadgeDisplayed success"); } } -var bundle = { +let bundle = { bundle: "bundleName1", -} +}; Notification.isBadgeDisplayed(bundle, isBadgeDisplayedCallback); ``` @@ -1368,6 +1432,8 @@ Checks whether the notification badge is enabled for a specified application. Th **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -1378,9 +1444,9 @@ Checks whether the notification badge is enabled for a specified application. Th **Example** ```js -var bundle = { +let bundle = { bundle: "bundleName1", -} +}; Notification.isBadgeDisplayed(bundle).then((data) => { console.info("isBadgeDisplayed success, data: " + JSON.stringify(data)); }); @@ -1410,6 +1476,8 @@ Sets the notification slot for a specified application. This API uses an asynchr **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -1429,12 +1497,12 @@ function setSlotByBundleCallback(err) { console.info("setSlotByBundle success"); } } -var bundle = { +let bundle = { bundle: "bundleName1", -} -var notificationSlot = { +}; +let notificationSlot = { type: Notification.SlotType.SOCIAL_COMMUNICATION -} +}; Notification.setSlotByBundle(bundle, notificationSlot, setSlotByBundleCallback); ``` @@ -1461,6 +1529,8 @@ Sets the notification slot for a specified application. This API uses a promise **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -1471,12 +1541,12 @@ Sets the notification slot for a specified application. This API uses a promise **Example** ```js -var bundle = { +let bundle = { bundle: "bundleName1", -} -var notificationSlot = { +}; +let notificationSlot = { type: Notification.SlotType.SOCIAL_COMMUNICATION -} +}; Notification.setSlotByBundle(bundle, notificationSlot).then(() => { console.info("setSlotByBundle success"); }); @@ -1505,6 +1575,8 @@ Obtains the notification slots of a specified application. This API uses an asyn **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -1522,9 +1594,9 @@ function getSlotsByBundleCallback(err, data) { console.info("getSlotsByBundle success"); } } -var bundle = { +let bundle = { bundle: "bundleName1", -} +}; Notification.getSlotsByBundle(bundle, getSlotsByBundleCallback); ``` @@ -1556,6 +1628,8 @@ Obtains the notification slots of a specified application. This API uses a promi **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -1566,9 +1640,9 @@ Obtains the notification slots of a specified application. This API uses a promi **Example** ```js -var bundle = { +let bundle = { bundle: "bundleName1", -} +}; Notification.getSlotsByBundle(bundle).then((data) => { console.info("getSlotsByBundle success, data: " + JSON.stringify(data)); }); @@ -1597,6 +1671,8 @@ Obtains the number of notification slots of a specified application. This API us **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -1614,9 +1690,9 @@ function getSlotNumByBundleCallback(err, data) { console.info("getSlotNumByBundle success"); } } -var bundle = { +let bundle = { bundle: "bundleName1", -} +}; Notification.getSlotNumByBundle(bundle, getSlotNumByBundleCallback); ``` @@ -1648,6 +1724,8 @@ Obtains the number of notification slots of a specified application. This API us **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -1658,9 +1736,9 @@ Obtains the number of notification slots of a specified application. This API us **Example** ```js -var bundle = { +let bundle = { bundle: "bundleName1", -} +}; Notification.getSlotNumByBundle(bundle).then((data) => { console.info("getSlotNumByBundle success, data: " + JSON.stringify(data)); }); @@ -1689,6 +1767,8 @@ Obtains all active notifications. This API uses an asynchronous callback to retu **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -1731,6 +1811,8 @@ Obtains all active notifications. This API uses a promise to return the result. **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -1763,6 +1845,8 @@ Obtains the number of active notifications of this application. This API uses an **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -1801,6 +1885,8 @@ Obtains the number of active notifications of this application. This API uses a **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -1833,6 +1919,8 @@ Obtains active notifications of this application. This API uses an asynchronous **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -1871,6 +1959,8 @@ Obtains active notifications of this application. This API uses a promise to ret **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -1904,6 +1994,8 @@ Cancels notifications under a notification group of this application. This API u **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -1944,6 +2036,8 @@ Cancels notifications under a notification group of this application. This API u **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -1953,7 +2047,7 @@ Cancels notifications under a notification group of this application. This API u **Example** ```js -var groupName = "GroupName"; +let groupName = "GroupName"; Notification.cancelGroup(groupName).then(() => { console.info("cancelGroup success"); }); @@ -1983,6 +2077,8 @@ Removes notifications under a notification group of a specified application. Thi **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -2001,8 +2097,8 @@ function removeGroupByBundleCallback(err) { } } -var bundleOption = {bundle: "Bundle"}; -var groupName = "GroupName"; +let bundleOption = {bundle: "Bundle"}; +let groupName = "GroupName"; Notification.removeGroupByBundle(bundleOption, groupName, removeGroupByBundleCallback); ``` @@ -2030,6 +2126,8 @@ Removes notifications under a notification group of a specified application. Thi **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -2040,8 +2138,8 @@ Removes notifications under a notification group of a specified application. Thi **Example** ```js -var bundleOption = {bundle: "Bundle"}; -var groupName = "GroupName"; +let bundleOption = {bundle: "Bundle"}; +let groupName = "GroupName"; Notification.removeGroupByBundle(bundleOption, groupName).then(() => { console.info("removeGroupByBundle success"); }); @@ -2070,6 +2168,8 @@ Sets the DND time. This API uses an asynchronous callback to return the result. **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -2087,11 +2187,11 @@ function setDoNotDisturbDateCallback(err) { } } -var doNotDisturbDate = { +let doNotDisturbDate = { type: Notification.DoNotDisturbType.TYPE_ONCE, begin: new Date(), end: new Date(2021, 11, 15, 18, 0) -} +}; Notification.setDoNotDisturbDate(doNotDisturbDate, setDoNotDisturbDateCallback); ``` @@ -2118,6 +2218,8 @@ Sets the DND time. This API uses a promise to return the result. **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -2127,11 +2229,11 @@ Sets the DND time. This API uses a promise to return the result. **Example** ```js -var doNotDisturbDate = { +let doNotDisturbDate = { type: Notification.DoNotDisturbType.TYPE_ONCE, begin: new Date(), end: new Date(2021, 11, 15, 18, 0) -} +}; Notification.setDoNotDisturbDate(doNotDisturbDate).then(() => { console.info("setDoNotDisturbDate success"); }); @@ -2160,6 +2262,8 @@ Sets the DND time for a specified user. This API uses an asynchronous callback t **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -2178,13 +2282,13 @@ function setDoNotDisturbDateCallback(err) { } } -var doNotDisturbDate = { +let doNotDisturbDate = { type: Notification.DoNotDisturbType.TYPE_ONCE, begin: new Date(), end: new Date(2021, 11, 15, 18, 0) -} +}; -var userId = 1 +let userId = 1; Notification.setDoNotDisturbDate(doNotDisturbDate, userId, setDoNotDisturbDateCallback); ``` @@ -2212,6 +2316,8 @@ Sets the DND time for a specified user. This API uses a promise to return the re **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -2222,13 +2328,13 @@ Sets the DND time for a specified user. This API uses a promise to return the re **Example** ```js -var doNotDisturbDate = { +let doNotDisturbDate = { type: Notification.DoNotDisturbType.TYPE_ONCE, begin: new Date(), end: new Date(2021, 11, 15, 18, 0) -} +}; -var userId = 1 +let userId = 1; Notification.setDoNotDisturbDate(doNotDisturbDate, userId).then(() => { console.info("setDoNotDisturbDate success"); @@ -2256,6 +2362,8 @@ Obtains the DND time. This API uses an asynchronous callback to return the resul **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -2298,6 +2406,8 @@ Obtains the DND time. This API uses a promise to return the result. **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -2334,6 +2444,8 @@ Obtains the DND time of a specified user. This API uses an asynchronous callback **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -2352,7 +2464,7 @@ function getDoNotDisturbDateCallback(err,data) { } } -var userId = 1 +let userId = 1; Notification.getDoNotDisturbDate(userId, getDoNotDisturbDateCallback); ``` @@ -2385,6 +2497,8 @@ Obtains the DND time of a specified user. This API uses a promise to return the **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -2395,7 +2509,7 @@ Obtains the DND time of a specified user. This API uses a promise to return the **Example** ```js -var userId = 1 +let userId = 1; Notification.getDoNotDisturbDate(userId).then((data) => { console.info("getDoNotDisturbDate success, data: " + JSON.stringify(data)); @@ -2403,9 +2517,9 @@ Notification.getDoNotDisturbDate(userId).then((data) => { ``` -## Notification.supportDoNotDisturbMode +## Notification.isSupportDoNotDisturbMode -supportDoNotDisturbMode(callback: AsyncCallback\): void +isSupportDoNotDisturbMode(callback: AsyncCallback\): void Checks whether DND mode is supported. This API uses an asynchronous callback to return the result. @@ -2423,6 +2537,8 @@ Checks whether DND mode is supported. This API uses an asynchronous callback to **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -2432,22 +2548,22 @@ Checks whether DND mode is supported. This API uses an asynchronous callback to **Example** ```js -function supportDoNotDisturbModeCallback(err,data) { +function isSupportDoNotDisturbModeCallback(err,data) { if (err) { - console.info("supportDoNotDisturbMode failed " + JSON.stringify(err)); + console.info("isSupportDoNotDisturbMode failed " + JSON.stringify(err)); } else { - console.info("supportDoNotDisturbMode success"); + console.info("isSupportDoNotDisturbMode success"); } } -Notification.supportDoNotDisturbMode(supportDoNotDisturbModeCallback); +Notification.isSupportDoNotDisturbMode(supportDoNotDisturbModeCallback); ``` -## Notification.supportDoNotDisturbMode +## Notification.isSupportDoNotDisturbMode -supportDoNotDisturbMode(): Promise\ +isSupportDoNotDisturbMode(): Promise\ Checks whether DND mode is supported. This API uses a promise to return the result. @@ -2465,6 +2581,8 @@ Checks whether DND mode is supported. This API uses a promise to return the resu **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -2474,8 +2592,8 @@ Checks whether DND mode is supported. This API uses a promise to return the resu **Example** ```js -Notification.supportDoNotDisturbMode().then((data) => { - console.info("supportDoNotDisturbMode success, data: " + JSON.stringify(data)); +Notification.isSupportDoNotDisturbMode().then((data) => { + console.info("isSupportDoNotDisturbMode success, data: " + JSON.stringify(data)); }); ``` @@ -2498,6 +2616,8 @@ Checks whether a specified template is supported. This API uses an asynchronous **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -2508,7 +2628,7 @@ Checks whether a specified template is supported. This API uses an asynchronous **Example** ```javascript -var templateName = 'process'; +let templateName = 'process'; function isSupportTemplateCallback(err, data) { if (err) { console.info("isSupportTemplate failed " + JSON.stringify(err)); @@ -2544,6 +2664,8 @@ Checks whether a specified template is supported. This API uses a promise to ret **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -2554,7 +2676,7 @@ Checks whether a specified template is supported. This API uses a promise to ret **Example** ```javascript -var templateName = 'process'; +let templateName = 'process'; Notification.isSupportTemplate(templateName).then((data) => { console.info("isSupportTemplate success, data: " + JSON.stringify(data)); @@ -2579,6 +2701,8 @@ Requests notification to be enabled for this application. This API uses an async **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -2611,6 +2735,8 @@ Requests notification to be enabled for this application. This API uses a promis **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -2648,6 +2774,8 @@ Sets whether this device supports distributed notifications. This API uses an as **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -2666,7 +2794,7 @@ function setDistributedEnableCallback() { } }; -var enable = true +let enable = true; Notification.setDistributedEnable(enable, setDistributedEnableCallback); ``` @@ -2693,6 +2821,8 @@ Sets whether this device supports distributed notifications. This API uses a pro **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -2703,7 +2833,7 @@ Sets whether this device supports distributed notifications. This API uses a pro **Example** ```javascript -var enable = true +let enable = true; Notification.setDistributedEnable(enable).then(() => { console.info("setDistributedEnable success"); @@ -2727,6 +2857,8 @@ Checks whether this device supports distributed notifications. This API uses an **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -2766,6 +2898,8 @@ Checks whether this device supports distributed notifications. This API uses a p **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -2805,6 +2939,8 @@ Sets whether a specified application supports distributed notifications. This AP **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -2824,11 +2960,11 @@ function setDistributedEnableByBundleCallback(err) { } }; -var bundle = { +let bundle = { bundle: "bundleName1", -} +}; -var enable = true +let enable = true Notification.setDistributedEnableByBundle(bundle, enable, setDistributedEnableByBundleCallback); ``` @@ -2856,6 +2992,8 @@ Sets whether a specified application supports distributed notifications. This AP **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -2867,11 +3005,11 @@ Sets whether a specified application supports distributed notifications. This AP **Example** ```javascript -var bundle = { +let bundle = { bundle: "bundleName1", -} +}; -var enable = true +let enable = true Notification.setDistributedEnableByBundle(bundle, enable).then(() => { console.info("setDistributedEnableByBundle success"); @@ -2899,6 +3037,8 @@ Checks whether a specified application supports distributed notifications. This **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -2918,9 +3058,9 @@ function isDistributedEnabledByBundleCallback(data) { } }; -var bundle = { +let bundle = { bundle: "bundleName1", -} +}; Notification.isDistributedEnabledByBundle(bundle, isDistributedEnabledByBundleCallback); ``` @@ -2953,6 +3093,8 @@ Checks whether a specified application supports distributed notifications. This **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -2964,9 +3106,9 @@ Checks whether a specified application supports distributed notifications. This **Example** ```javascript -var bundle = { +let bundle = { bundle: "bundleName1", -} +}; Notification.isDistributedEnabledByBundle(bundle).then((data) => { console.info("isDistributedEnabledByBundle success, data: " + JSON.stringify(data)); @@ -2994,6 +3136,8 @@ Obtains the notification reminder type. This API uses an asynchronous callback t **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -3036,6 +3180,8 @@ Obtains the notification reminder type. This API uses a promise to return the re **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -3074,6 +3220,8 @@ Publishes a notification through the reminder agent. This API uses an asynchrono **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------------- | | 1600001 | Internal error. | @@ -3096,9 +3244,9 @@ function callback(err) { } } // Bundle name of the application whose notification function is taken over by the reminder agent -let representativeBundle = "com.example.demo" +let representativeBundle = "com.example.demo"; // User ID -let userId = 100 +let userId = 100; // NotificationRequest object let request = { id: 1, @@ -3110,7 +3258,7 @@ let request = { additionalText: "test_additionalText" } } -} +}; Notification.publishAsBundle(request, representativeBundle, userId, callback); ``` @@ -3138,6 +3286,8 @@ Publishes a notification through the reminder agent. This API uses a promise to **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------------- | | 1600001 | Internal error. | @@ -3152,11 +3302,11 @@ Publishes a notification through the reminder agent. This API uses a promise to ```js // Bundle name of the application whose notification function is taken over by the reminder agent -let representativeBundle = "com.example.demo" +let representativeBundle = "com.example.demo"; // User ID -let userId = 100 +let userId = 100; // NotificationRequest object -var request = { +let request = { id: 1, content: { contentType: Notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, @@ -3166,7 +3316,7 @@ var request = { additionalText: "test_additionalText" } } -} +}; Notification.publishAsBundle(request, representativeBundle, userId).then(() => { console.info("publishAsBundle success"); @@ -3198,6 +3348,8 @@ Cancels a notification published by the reminder agent. This API uses an asynchr **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -3218,9 +3370,9 @@ function cancelAsBundleCallback(err) { } } // Bundle name of the application whose notification function is taken over by the reminder agent -let representativeBundle = "com.example.demo" +let representativeBundle = "com.example.demo"; // User ID -let userId = 100 +let userId = 100; Notification.cancelAsBundle(0, representativeBundle, userId, cancelAsBundleCallback); ``` @@ -3249,6 +3401,8 @@ Cancels a notification published by the reminder agent. This API uses a promise **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -3261,9 +3415,9 @@ Cancels a notification published by the reminder agent. This API uses a promise ```js // Bundle name of the application whose notification function is taken over by the reminder agent -let representativeBundle = "com.example.demo" +let representativeBundle = "com.example.demo"; // User ID -let userId = 100 +let userId = 100; Notification.cancelAsBundle(0, representativeBundle, userId).then(() => { console.info("cancelAsBundle success"); @@ -3293,6 +3447,8 @@ Sets whether to enable a specified notification slot type for a specified applic **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -3341,6 +3497,8 @@ Sets whether to enable a specified notification slot type for a specified applic **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -3382,6 +3540,8 @@ Checks whether a specified notification slot type is enabled for a specified app **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -3434,6 +3594,8 @@ Checks whether a specified notification slot type is enabled for a specified app **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -3474,6 +3636,8 @@ Sets whether to enable the notification sync feature for devices where the appli **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -3526,6 +3690,8 @@ Sets whether to enable the notification sync feature for devices where the appli **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -3568,6 +3734,8 @@ Obtains whether the notification sync feature is enabled for devices where the a **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -3618,6 +3786,8 @@ Obtains whether the notification sync feature is enabled for devices where the a **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | diff --git a/en/application-dev/reference/apis/js-apis-notificationSubscribe.md b/en/application-dev/reference/apis/js-apis-notificationSubscribe.md index ed0ad9400ed59c637b5495c7b20f8770b0b4329c..edef7122d04facc427f9209104158ea879d05f6f 100644 --- a/en/application-dev/reference/apis/js-apis-notificationSubscribe.md +++ b/en/application-dev/reference/apis/js-apis-notificationSubscribe.md @@ -1,4 +1,4 @@ -# @ohos.notificationSubscribe +# @ohos.notificationSubscribe (NotificationSubscribe) The **NotificationSubscribe** module provides APIs for notification subscription, notification unsubscription, subscription removal, and more. In general cases, only system applications can call these APIs. @@ -36,6 +36,8 @@ Subscribes to a notification with the subscription information specified. This A **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -56,12 +58,12 @@ function subscribeCallback(err) { function onConsumeCallback(data) { console.info("Consume callback: " + JSON.stringify(data)); } -var subscriber = { +let subscriber = { onConsume: onConsumeCallback -} -var info = { +}; +let info = { bundleNames: ["bundleName1","bundleName2"] -} +}; NotificationSubscribe.subscribe(subscriber, info, subscribeCallback); ``` @@ -88,6 +90,8 @@ Subscribes to notifications of all applications under this user. This API uses a **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -107,9 +111,9 @@ function subscribeCallback(err) { function onConsumeCallback(data) { console.info("Consume callback: " + JSON.stringify(data)); } -var subscriber = { +let subscriber = { onConsume: onConsumeCallback -} +}; NotificationSubscribe.subscribe(subscriber, subscribeCallback); ``` @@ -136,6 +140,8 @@ Subscribes to a notification with the subscription information specified. This A **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -148,7 +154,7 @@ Subscribes to a notification with the subscription information specified. This A function onConsumeCallback(data) { console.info("Consume callback: " + JSON.stringify(data)); } -var subscriber = { +let subscriber = { onConsume: onConsumeCallback }; NotificationSubscribe.subscribe(subscriber).then(() => { @@ -179,6 +185,8 @@ Unsubscribes from a notification. This API uses an asynchronous callback to retu **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -198,9 +206,9 @@ function unsubscribeCallback(err) { function onDisconnectCallback(data) { console.info("Cancel callback: " + JSON.stringify(data)); } -var subscriber = { +let subscriber = { onDisconnect: onDisconnectCallback -} +}; NotificationSubscribe.unsubscribe(subscriber, unsubscribeCallback); ``` @@ -226,6 +234,8 @@ Unsubscribes from a notification. This API uses a promise to return the result. **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -238,7 +248,7 @@ Unsubscribes from a notification. This API uses a promise to return the result. function onDisconnectCallback(data) { console.info("Cancel callback: " + JSON.stringify(data)); } -var subscriber = { +let subscriber = { onDisconnect: onDisconnectCallback }; NotificationSubscribe.unsubscribe(subscriber).then(() => { @@ -271,6 +281,8 @@ Removes a notification for a specified application. This API uses an asynchronou **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -289,14 +301,14 @@ function removeCallback(err) { console.info("remove success"); } } -var bundle = { +let bundle = { bundle: "bundleName1", -} -var notificationKey = { +}; +let notificationKey = { id: 0, label: "label", -} -var reason = NotificationSubscribe.RemoveReason.CLICK_REASON_REMOVE; +}; +let reason = NotificationSubscribe.RemoveReason.CLICK_REASON_REMOVE; NotificationSubscribe.remove(bundle, notificationKey, reason, removeCallback); ``` @@ -324,6 +336,8 @@ Removes a notification for a specified application. This API uses a promise to r **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -335,14 +349,14 @@ Removes a notification for a specified application. This API uses a promise to r **Example** ```js -var bundle = { +let bundle = { bundle: "bundleName1", -} -var notificationKey = { +}; +let notificationKey = { id: 0, label: "label", -} -var reason = NotificationSubscribe.RemoveReason.CLICK_REASON_REMOVE; +}; +let reason = NotificationSubscribe.RemoveReason.CLICK_REASON_REMOVE; NotificationSubscribe.remove(bundle, notificationKey, reason).then(() => { console.info("remove success"); }); @@ -372,6 +386,8 @@ Removes a specified notification. This API uses an asynchronous callback to retu **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -382,7 +398,7 @@ Removes a specified notification. This API uses an asynchronous callback to retu **Example** ```js -var hashCode = 'hashCode' +let hashCode = 'hashCode'; function removeCallback(err) { if (err) { @@ -391,7 +407,7 @@ function removeCallback(err) { console.info("remove success"); } } -var reason = NotificationSubscribe.RemoveReason.CANCEL_REASON_REMOVE; +let reason = NotificationSubscribe.RemoveReason.CANCEL_REASON_REMOVE; NotificationSubscribe.remove(hashCode, reason, removeCallback); ``` @@ -418,6 +434,8 @@ Removes a specified notification. This API uses a promise to return the result. **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -428,8 +446,8 @@ Removes a specified notification. This API uses a promise to return the result. **Example** ```js -var hashCode = 'hashCode' -var reason = NotificationSubscribe.RemoveReason.CLICK_REASON_REMOVE; +let hashCode = 'hashCode'; +let reason = NotificationSubscribe.RemoveReason.CLICK_REASON_REMOVE; NotificationSubscribe.remove(hashCode, reason).then(() => { console.info("remove success"); }); @@ -458,6 +476,8 @@ Removes all notifications for a specified application. This API uses an asynchro **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -475,9 +495,9 @@ function removeAllCallback(err) { console.info("removeAll success"); } } -var bundle = { +let bundle = { bundle: "bundleName1", -} +}; NotificationSubscribe.removeAll(bundle, removeAllCallback); ``` @@ -503,6 +523,8 @@ Removes all notifications. This API uses an asynchronous callback to return the **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -545,6 +567,8 @@ Removes all notifications for a specified application. This API uses a promise t **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -582,6 +606,8 @@ Removes all notifications for a specified user. This API uses an asynchronous ca **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -600,7 +626,7 @@ function removeAllCallback(err) { } } -var userId = 1 +let userId = 1; NotificationSubscribe.removeAll(userId, removeAllCallback); ``` @@ -625,6 +651,8 @@ Removes all notifications for a specified user. This API uses a promise to retur **Error codes** +For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md). + | ID| Error Message | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -643,7 +671,7 @@ function removeAllCallback(err) { } } -var userId = 1 +let userId = 1; NotificationSubscribe.removeAll(userId, removeAllCallback); ``` @@ -689,7 +717,7 @@ function onConsumeCallback(data) { console.info('===> onConsume callback req.id:' + req.id); }; -var subscriber = { +let subscriber = { onConsume: onConsumeCallback }; @@ -729,7 +757,7 @@ function onCancelCallback(data) { console.info('===> onCancel callback req.id:' + req.id); } -var subscriber = { +let subscriber = { onCancel: onCancelCallback }; @@ -767,7 +795,7 @@ function onUpdateCallback(map) { console.info('===> onUpdateCallback map:' + JSON.stringify(map)); } -var subscriber = { +let subscriber = { onUpdate: onUpdateCallback }; @@ -799,7 +827,7 @@ function onConnectCallback() { console.info('===> onConnect in test'); } -var subscriber = { +let subscriber = { onConnect: onConnectCallback }; @@ -841,7 +869,7 @@ function onDisconnectCallback() { console.info('===> onDisconnect in test'); } -var subscriber = { +let subscriber = { onConnect: onConnectCallback, onDisconnect: onDisconnectCallback }; @@ -877,7 +905,7 @@ function onDestroyCallback() { console.info('===> onDestroy in test'); } -var subscriber = { +let subscriber = { onDestroy: onDestroyCallback }; @@ -915,7 +943,7 @@ function onDoNotDisturbDateChangeCallback(mode) { console.info('===> onDoNotDisturbDateChange:' + mode); } -var subscriber = { +let subscriber = { onDoNotDisturbDateChange: onDoNotDisturbDateChangeCallback }; @@ -956,7 +984,7 @@ function onEnabledNotificationChangedCallback(callbackData) { console.info("enable: ", callbackData.enable); }; -var subscriber = { +let subscriber = { onEnabledNotificationChanged: onEnabledNotificationChangedCallback }; @@ -1011,7 +1039,7 @@ NotificationSubscribe.subscribe(subscriber, subscribeCallback); ## NotificationSorting -Provides sorting information of activity notifications. +Provides sorting information of active notifications. **System capability**: SystemCapability.Notification.Notification diff --git a/en/application-dev/reference/apis/js-apis-observer.md b/en/application-dev/reference/apis/js-apis-observer.md index ae5b7999bd7e579179920a73fcaea6116890ff70..2d56d02d2ec4e0f2117266569cb5bfd905f1b338 100644 --- a/en/application-dev/reference/apis/js-apis-observer.md +++ b/en/application-dev/reference/apis/js-apis-observer.md @@ -9,7 +9,7 @@ The **observer** module provides event subscription management functions. You ca ## Modules to Import -```js +``` import observer from '@ohos.telephony.observer' ``` @@ -17,7 +17,7 @@ import observer from '@ohos.telephony.observer' on\(type: \'networkStateChange\', callback: Callback\): void; -Registers an observer for network status change events. This API uses an asynchronous callback to return the result. +Registers an observer for network status change events. This API uses an asynchronous callback to return the execution result. **Required permission**: ohos.permission.GET_NETWORK_INFO @@ -30,6 +30,18 @@ Registers an observer for network status change events. This API uses an asynchr | type | string | Yes | Network status change event. | | callback | Callback\<[NetworkState](js-apis-radio.md#networkstate)\> | Yes | Callback used to return the result. For details, see [NetworkState](js-apis-radio.md#networkstate).| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -43,7 +55,7 @@ observer.on('networkStateChange', data =>{ on\(type: \'networkStateChange\', options: { slotId: number }, callback: Callback\): void; -Registers an observer for network status change events of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. +Registers an observer for network status change events of the SIM card in the specified slot. This API uses an asynchronous callback to return the execution result. **Required permission**: ohos.permission.GET_NETWORK_INFO @@ -54,9 +66,21 @@ Registers an observer for network status change events of the SIM card in the sp | Name| Type | Mandatory| Description | | ------ | ------ | ---- | -------------------------------------- | | type | string | Yes | Network status change event. | -| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| +| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | Callback\<[NetworkState](js-apis-radio.md#networkstate)\> | Yes | Callback used to return the result. For details, see [NetworkState](js-apis-radio.md#networkstate).| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -70,7 +94,7 @@ observer.on('networkStateChange', {slotId: 0}, data =>{ off\(type: \'networkStateChange\', callback?: Callback\): void; -Unregisters the observer for network status change events. This API uses an asynchronous callback to return the result. +Unregisters the observer for network status change events. This API uses an asynchronous callback to return the execution result. >**NOTE** > @@ -85,6 +109,14 @@ Unregisters the observer for network status change events. This API uses an asyn | type | string | Yes | Network status change event. | | callback | Callback\<[NetworkState](js-apis-radio.md#networkstate)\> | No | Callback used to return the result. For details, see [NetworkState](js-apis-radio.md#networkstate).| +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -101,7 +133,7 @@ observer.off('networkStateChange'); on\(type: \'signalInfoChange\', callback: Callback\>): void; -Registers an observer for signal status change events. This API uses an asynchronous callback to return the result. +Registers an observer for signal status change events. This API uses an asynchronous callback to return the execution result. **System capability**: SystemCapability.Telephony.StateRegistry @@ -109,9 +141,21 @@ Registers an observer for signal status change events. This API uses an asynchro | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | Signal status change event. | +| type | string | Yes | Signal information change event. | | callback | Callback\> | Yes | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -125,7 +169,7 @@ observer.on('signalInfoChange', data =>{ on\(type: \'signalInfoChange\', options: { slotId: number }, callback: Callback\>): void; -Registers an observer for signal status change events of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. +Registers an observer for signal status change events of the SIM card in the specified slot. This API uses an asynchronous callback to return the execution result. **System capability**: SystemCapability.Telephony.StateRegistry @@ -133,10 +177,22 @@ Registers an observer for signal status change events of the SIM card in the spe | Name| Type | Mandatory| Description | | ------ | ------ | ---- | -------------------------------------- | -| type | string | Yes | Signal status change event. | -| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| +| type | string | Yes | Signal information change event. | +| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | Callback\> | Yes | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -150,7 +206,7 @@ observer.on('signalInfoChange', {slotId: 0}, data =>{ off\(type: \'signalInfoChange\', callback?: Callback\>): void; -Unregisters the observer for signal status change events. This API uses an asynchronous callback to return the result. +Unregisters the observer for signal status change events. This API uses an asynchronous callback to return the execution result. >**NOTE** > @@ -162,9 +218,20 @@ Unregisters the observer for signal status change events. This API uses an async | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | Signal status change event. | +| type | string | Yes | Signal information change event. | | callback | Callback\> | No | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -182,7 +249,7 @@ observer.off('signalInfoChange'); on(type: 'callStateChange', callback: Callback\<{ state: CallState, number: string }\>): void; -Registers an observer for call status change events. This API uses an asynchronous callback to return the result. +Registers an observer for call status change events. This API uses an asynchronous callback to return the execution result. **System capability**: SystemCapability.Telephony.StateRegistry @@ -193,6 +260,17 @@ Registers an observer for call status change events. This API uses an asynchrono | type | string | Yes | Call status change event. | | callback | Callback\<{ state: [CallState](js-apis-call.md#callstate), number: string }\> | Yes | Callback function. For details, see [CallState](js-apis-call.md#callstate) in call.
**number**: phone number.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -206,7 +284,7 @@ observer.on('callStateChange', value =>{ on(type: 'callStateChange', options: { slotId: number }, callback: Callback<{ state:CallState, number: string }>): void; -Registers an observer for call status change events. This API uses an asynchronous callback to return the result. +Registers an observer for call status change events. This API uses an asynchronous callback to return the execution result. **System capability**: SystemCapability.Telephony.StateRegistry @@ -215,9 +293,20 @@ Registers an observer for call status change events. This API uses an asynchrono | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | type | string | Yes | Call status change event. | -| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | +| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | | callback | Callback\<{ state: [CallState](js-apis-call.md#callstate), number: string }\> | Yes | Callback function. For details, see [CallState](js-apis-call.md#callstate) in call.
**number**: phone number.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -231,7 +320,7 @@ observer.on('callStateChange', {slotId: 0}, value =>{ off(type: 'callStateChange', callback?: Callback<{ state: CallState, number: string }>): void; -Unregisters the observer for call status change events. This API uses an asynchronous callback to return the result. +Unregisters the observer for call status change events. This API uses an asynchronous callback to return the execution result. >**NOTE** > @@ -246,6 +335,17 @@ Unregisters the observer for call status change events. This API uses an asynchr | type | string | Yes | Call status change event. | | callback | Callback\<{ state: [CallState](js-apis-call.md#callstate), number: string }\> | No | Callback function. For details, see [CallState](js-apis-call.md#callstate) in call.
**number**: phone number.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -263,7 +363,7 @@ observer.off('callStateChange'); on\(type: 'cellularDataConnectionStateChange', callback: Callback\<{ state: DataConnectState, network: RatType}\>\): void; -Registers an observer for connection status change events of the cellular data connection.This API uses an asynchronous callback to return the result. +Registers an observer for connection status change events of the cellular data link. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Telephony.StateRegistry @@ -271,9 +371,20 @@ Registers an observer for connection status change events of the cellular data c | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | Connection status change event of the cellular data connection. | +| type | string | Yes | Connection status change event of the cellular data link. | | callback | Callback\<{ state: [DataConnectState](js-apis-telephony-data.md#dataconnectstate), network: [RatType](js-apis-radio.md#radiotechnology) }\> | Yes | Callback used to return the result. For details, see [DataConnectState](js-apis-telephony-data.md#dataconnectstate) and [RadioTechnology](js-apis-radio.md#radiotechnology).| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -287,7 +398,7 @@ observer.on('cellularDataConnectionStateChange', value =>{ on\(type: 'cellularDataConnectionStateChange', options: { slotId: number }, callback: Callback\<{ state: DataConnectState, network: RatType }\>\): void; -Registers an observer for connection status change events of the cellular data connection over the SIM card in the specified slot. This API uses an asynchronous callback to return the result. +Registers an observer for connection status change events of the cellular data link over the SIM card in the specified slot. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Telephony.StateRegistry @@ -295,10 +406,21 @@ Registers an observer for connection status change events of the cellular data c | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | Connection status change event of the cellular data connection. | -| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | +| type | string | Yes | Connection status change event of the cellular data link. | +| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | | callback | Callback\<{ state: [DataConnectState](js-apis-telephony-data.md#dataconnectstate), network: [RatType](js-apis-radio.md#radiotechnology) }\> | Yes | Callback used to return the result. For details, see [DataConnectState](js-apis-telephony-data.md#dataconnectstate) and [RadioTechnology](js-apis-radio.md#radiotechnology).| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -312,7 +434,7 @@ observer.on('cellularDataConnectionStateChange', {slotId: 0}, value =>{ off\(type: 'cellularDataConnectionStateChange', callback?: Callback\<{ state: DataConnectState, network: RatType}\>\): void; -Unregisters the observer for connection status change events of the cellular data connection.This API uses an asynchronous callback to return the result. +Unregisters the observer for connection status change events of the cellular data link. This API uses an asynchronous callback to return the result. >**NOTE** > @@ -324,9 +446,20 @@ Unregisters the observer for connection status change events of the cellular dat | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | Connection status change event of the cellular data connection. | +| type | string | Yes | Connection status change event of the cellular data link. | | callback | Callback\<{ state: [DataConnectState](js-apis-telephony-data.md#dataconnectstate), network: [RatType](js-apis-radio.md#radiotechnology) }\> | No | Callback used to return the result. For details, see [DataConnectState](js-apis-telephony-data.md#dataconnectstate) and [RadioTechnology](js-apis-radio.md#radiotechnology).| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -355,6 +488,17 @@ Registers an observer for the uplink and downlink data flow status change events | type | string | Yes | Uplink and downlink data flow status change event of the cellular data service. | | callback | Callback\<[DataFlowType](js-apis-telephony-data.md#dataflowtype)\> | Yes | Callback used to return the result. For details, see [DataFlowType](js-apis-telephony-data.md#dataflowtype).| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -377,9 +521,20 @@ Registers an observer for the uplink and downlink data flow status change events | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | type | string | Yes | Uplink and downlink data flow status change event of the cellular data service. | -| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | +| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | | callback | Callback\<[DataFlowType](js-apis-telephony-data.md#dataflowtype)\> | Yes | Callback used to return the result. For details, see [DataFlowType](js-apis-telephony-data.md#dataflowtype).| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -408,6 +563,17 @@ Unregisters the observer for the uplink and downlink data flow status change eve | type | string | Yes | Uplink and downlink data flow status change event of the cellular data service. | | callback | Callback\<[DataFlowType](js-apis-telephony-data.md#dataflowtype)\> | No | Callback used to return the result. For details, see [DataFlowType](js-apis-telephony-data.md#dataflowtype).| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -436,6 +602,17 @@ Registers an observer for SIM card status change events. This API uses an asynch | type | string | Yes | SIM card status change event. | | callback | Callback\<[SimStateData](#simstatedata7)\> | Yes | Callback used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -458,9 +635,20 @@ Registers an observer for status change events of the SIM card in the specified | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | type | string | Yes | SIM card status change event. | -| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | +| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | | callback | Callback\<[SimStateData](#simstatedata7)\> | Yes | Callback used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -489,6 +677,17 @@ Unregisters the observer for SIM card status change events. This API uses an asy | type | string | Yes | SIM card status change event. | | callback | Callback\<[SimStateData](#simstatedata7)\> | No | Callback used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -531,8 +730,8 @@ Enumerates SIM card types and states. **System capability**: SystemCapability.Telephony.StateRegistry -| Name | Type | Mandatory | Description | -| -------- | ------- | --------- | ----------- | -| type | [CardType](js-apis-sim.md#cardtype) | Yes| SIM card type. For details, see [CardType](js-apis-sim.md#cardtype).| -| state | [SimState](js-apis-sim.md#simstate) | Yes| SIM card status. For details, see [SimState](js-apis-sim.md#simstate).| -| reason8+ | [LockReason](#lockreason8) | Yes| SIM card lock type.| +| Name | Type | Mandatory| Description | +| ------------------- | ----------------------------------- | ---- | -------------------------------------------------------- | +| type | [CardType](js-apis-sim.md#cardtype) | Yes | SIM card type. For details, see [CardType](js-apis-sim.md#cardtype).| +| state | [SimState](js-apis-sim.md#simstate) | Yes | SIM card status. For details, see [SimState](js-apis-sim.md#simstate).| +| reason8+ | [LockReason](#lockreason8) | Yes | SIM card lock type. | diff --git a/en/application-dev/reference/apis/js-apis-osAccount.md b/en/application-dev/reference/apis/js-apis-osAccount.md index f903401701e9f68ae6277a687215310f59afc34c..1040e892ae5eb107d5ae67d5de76a1defb246688 100644 --- a/en/application-dev/reference/apis/js-apis-osAccount.md +++ b/en/application-dev/reference/apis/js-apis-osAccount.md @@ -1,4 +1,4 @@ -# @ohos.account.osAccount +# @ohos.account.osAccount (OS Account Management) The **osAccount** module provides basic capabilities for managing OS accounts, including adding, deleting, querying, setting, subscribing to, and enabling an OS account. @@ -155,7 +155,7 @@ Checks whether multiple OS accounts are supported. This API uses an asynchronous | Name | Type | Mandatory| Description | | -------- | ---------------------------- | ---- | ------------------------------------------------------ | -| callback | AsyncCallback<boolean> | Yes | Callback invoked to return the result. The value **true** means multiple OS accounts are supported; the value false means the opposite.| +| callback | AsyncCallback<boolean> | Yes | Callback invoked to return the result. The value **true** means multiple OS accounts are supported; the value **false** means the opposite.| **Error codes** @@ -192,7 +192,7 @@ Checks whether multiple OS accounts are supported. This API uses a promise to re | Type | Description | | :--------------------- | :--------------------------------------------------------- | -| Promise<boolean> | Promise used to return the result. The value **true** means multiple OS accounts are supported; the value false means the opposite.| +| Promise<boolean> | Promise used to return the result. The value **true** means multiple OS accounts are supported; the value **false** means the opposite.| **Error codes** @@ -304,13 +304,13 @@ Checks whether an OS account is activated. This API uses a promise to return the } ``` -### checkConstraintEnabled9+ +### checkOsAccountConstraintEnabled9+ -checkConstraintEnabled(localId: number, constraint: string, callback: AsyncCallback<boolean>): void +checkOsAccountConstraintEnabled(localId: number, constraint: string, callback: AsyncCallback<boolean>): void Checks whether the specified constraint is enabled for an OS account. This API uses an asynchronous callback to return the result. -**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS +**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS **System capability**: SystemCapability.Account.OsAccount @@ -337,25 +337,25 @@ Checks whether the specified constraint is enabled for an OS account. This API u let localId = 100; let constraint = "constraint.wifi"; try { - accountManager.checkConstraintEnabled(localId, constraint, (err, isEnabled)=>{ + accountManager.checkOsAccountConstraintEnabled(localId, constraint, (err, isEnabled)=>{ if (err) { - console.log("checkConstraintEnabled failed, error: " + JSON.stringify(err)); + console.log("checkOsAccountConstraintEnabled failed, error: " + JSON.stringify(err)); } else { - console.log("checkConstraintEnabled successfully, isEnabled: " + isEnabled); + console.log("checkOsAccountConstraintEnabled successfully, isEnabled: " + isEnabled); } }); } catch (err) { - console.log("checkConstraintEnabled exception: " + JSON.stringify(err)); + console.log("checkOsAccountConstraintEnabled exception: " + JSON.stringify(err)); } ``` -### checkConstraintEnabled9+ +### checkOsAccountConstraintEnabled9+ -checkConstraintEnabled(localId: number, constraint: string): Promise<boolean> +checkOsAccountConstraintEnabled(localId: number, constraint: string): Promise<boolean> Checks whether the specified constraint is enabled for an OS account. This API uses a promise to return the result. -**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS +**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS **System capability**: SystemCapability.Account.OsAccount @@ -387,13 +387,13 @@ Checks whether the specified constraint is enabled for an OS account. This API u let localId = 100; let constraint = "constraint.wifi"; try { - accountManager.checkConstraintEnabled(localId, constraint).then((isEnabled) => { - console.log("checkConstraintEnabled successfully, isEnabled: " + isEnabled); + accountManager.checkOsAccountConstraintEnabled(localId, constraint).then((isEnabled) => { + console.log("checkOsAccountConstraintEnabled successfully, isEnabled: " + isEnabled); }).catch((err) => { - console.log("checkConstraintEnabled failed, error: " + JSON.stringify(err)); + console.log("checkOsAccountConstraintEnabled failed, error: " + JSON.stringify(err)); }); } catch (err) { - console.log("checkConstraintEnabled exception: " + JSON.stringify(err)); + console.log("checkOsAccountConstraintEnabled exception: " + JSON.stringify(err)); } ``` @@ -973,9 +973,9 @@ Obtains the number of OS accounts created. This API uses a promise to return the } ``` -### queryOsAccountLocalIdFromProcess9+ +### getOsAccountLocalId9+ -queryOsAccountLocalIdFromProcess(callback: AsyncCallback<number>): void +getOsAccountLocalId(callback: AsyncCallback<number>): void Obtains the ID of the OS account to which the current process belongs. This API uses an asynchronous callback to return the result. @@ -998,21 +998,21 @@ Obtains the ID of the OS account to which the current process belongs. This API ```js let accountManager = account_osAccount.getAccountManager(); try { - accountManager.queryOsAccountLocalIdFromProcess((err, localId) => { + accountManager.getOsAccountLocalId((err, localId) => { if (err) { - console.log("queryOsAccountLocalIdFromProcess failed, error: " + JSON.stringify(err)); + console.log("getOsAccountLocalId failed, error: " + JSON.stringify(err)); } else { - console.log("queryOsAccountLocalIdFromProcess successfully, localId: " + localId); + console.log("getOsAccountLocalId successfully, localId: " + localId); } }); } catch (err) { - console.log("queryOsAccountLocalIdFromProcess exception: " + JSON.stringify(err)); + console.log("getOsAccountLocalId exception: " + JSON.stringify(err)); } ``` -### queryOsAccountLocalIdFromProcess9+ +### getOsAccountLocalId9+ -queryOsAccountLocalIdFromProcess(): Promise<number> +getOsAccountLocalId(): Promise<number> Obtains the ID of the OS account to which the current process belongs. This API uses a promise to return the result. @@ -1035,19 +1035,19 @@ Obtains the ID of the OS account to which the current process belongs. This API ```js let accountManager = account_osAccount.getAccountManager(); try { - accountManager.queryOsAccountLocalIdFromProcess().then((localId) => { - console.log("queryOsAccountLocalIdFromProcess successfully, localId: " + localId); + accountManager.getOsAccountLocalId().then((localId) => { + console.log("getOsAccountLocalId successfully, localId: " + localId); }).catch((err) => { - console.log("queryOsAccountLocalIdFromProcess failed, error: " + JSON.stringify(err)); + console.log("getOsAccountLocalId failed, error: " + JSON.stringify(err)); }); } catch (err) { - console.log('queryOsAccountLocalIdFromProcess exception: ' + JSON.stringify(err)); + console.log('getOsAccountLocalId exception: ' + JSON.stringify(err)); } ``` -### queryOsAccountLocalIdFromUid9+ +### getOsAccountLocalIdForUid9+ -queryOsAccountLocalIdFromUid(uid: number, callback: AsyncCallback<number>): void +getOsAccountLocalIdForUid(uid: number, callback: AsyncCallback<number>): void Obtains the OS account ID based on the process UID. This API uses an asynchronous callback to return the result. @@ -1073,20 +1073,20 @@ Obtains the OS account ID based on the process UID. This API uses an asynchronou let accountManager = account_osAccount.getAccountManager(); let uid = 12345678; try { - accountManager.queryOsAccountLocalIdFromUid(uid, (err, localId) => { + accountManager.getOsAccountLocalIdForUid(uid, (err, localId) => { if (err) { - console.log("queryOsAccountLocalIdFromUid failed, error: " + JSON.stringify(err)); + console.log("getOsAccountLocalIdForUid failed, error: " + JSON.stringify(err)); } - console.log("queryOsAccountLocalIdFromUid successfully, localId: " + localId); + console.log("getOsAccountLocalIdForUid successfully, localId: " + localId); }); } catch (err) { - console.log("queryOsAccountLocalIdFromUid exception: " + JSON.stringify(err)); + console.log("getOsAccountLocalIdForUid exception: " + JSON.stringify(err)); } ``` -### queryOsAccountLocalIdFromUid9+ +### getOsAccountLocalIdForUid9+ -queryOsAccountLocalIdFromUid(uid: number): Promise<number> +getOsAccountLocalIdForUid(uid: number): Promise<number> Obtains the OS account ID based on the process UID. This API uses a promise to return the result. @@ -1117,19 +1117,19 @@ Obtains the OS account ID based on the process UID. This API uses a promise to r let accountManager = account_osAccount.getAccountManager(); let uid = 12345678; try { - accountManager.queryOsAccountLocalIdFromUid(uid).then((localId) => { - console.log("queryOsAccountLocalIdFromUid successfully, localId: " + localId); + accountManager.getOsAccountLocalIdForUid(uid).then((localId) => { + console.log("getOsAccountLocalIdForUid successfully, localId: " + localId); }).catch((err) => { - console.log("queryOsAccountLocalIdFromUid failed, error: " + JSON.stringify(err)); + console.log("getOsAccountLocalIdForUid failed, error: " + JSON.stringify(err)); }); } catch (err) { - console.log('queryOsAccountLocalIdFromUid exception: ' + JSON.stringify(err)); + console.log('getOsAccountLocalIdForUid exception: ' + JSON.stringify(err)); } ``` -### queryOsAccountLocalIdFromDomain9+ +### getOsAccountLocalIdForDomain9+ -queryOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo, callback: AsyncCallback<number>): void +getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo, callback: AsyncCallback<number>): void Obtains the OS account ID based on the domain account information. This API uses an asynchronous callback to return the result. @@ -1157,21 +1157,21 @@ Obtains the OS account ID based on the domain account information. This API uses let domainInfo = {domain: 'testDomain', accountName: 'testAccountName'}; let accountManager = account_osAccount.getAccountManager(); try { - accountManager.queryOsAccountLocalIdFromDomain(domainInfo, (err, localId) => { + accountManager.getOsAccountLocalIdForDomain(domainInfo, (err, localId) => { if (err) { - console.log("queryOsAccountLocalIdFromDomain failed, error: " + JSON.stringify(err)); + console.log("getOsAccountLocalIdForDomain failed, error: " + JSON.stringify(err)); } else { - console.log("queryOsAccountLocalIdFromDomain successfully, localId: " + localId); + console.log("getOsAccountLocalIdForDomain successfully, localId: " + localId); } }); } catch (err) { - console.log('queryOsAccountLocalIdFromDomain exception: ' + JSON.stringify(err)); + console.log('getOsAccountLocalIdForDomain exception: ' + JSON.stringify(err)); } ``` -### queryOsAccountLocalIdFromDomain9+ +### getOsAccountLocalIdForDomain9+ -queryOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo): Promise<number> +getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo): Promise<number> Obtains the OS account ID based on the domain account information. This API uses a promise to return the result. @@ -1204,13 +1204,13 @@ Obtains the OS account ID based on the domain account information. This API uses let accountManager = account_osAccount.getAccountManager(); let domainInfo = {domain: 'testDomain', accountName: 'testAccountName'}; try { - accountManager.queryOsAccountLocalIdFromDomain(domainInfo).then((localId) => { - console.log("queryOsAccountLocalIdFromDomain successfully, localId: " + localId); + accountManager.getOsAccountLocalIdForDomain(domainInfo).then((localId) => { + console.log("getOsAccountLocalIdForDomain successfully, localId: " + localId); }).catch((err) => { - console.log("queryOsAccountLocalIdFromDomain failed, error: " + JSON.stringify(err)); + console.log("getOsAccountLocalIdForDomain failed, error: " + JSON.stringify(err)); }); } catch (err) { - console.log("queryOsAccountLocalIdFromDomain exception: " + JSON.stringify(err)); + console.log("getOsAccountLocalIdForDomain exception: " + JSON.stringify(err)); } ``` @@ -1456,9 +1456,9 @@ Obtains information about all the OS accounts created. This API uses a promise t } ``` -### getActivatedOsAccountIds9+ +### getActivatedOsAccountLocalIds9+ -getActivatedOsAccountIds(callback: AsyncCallback<Array<number>>): void +getActivatedOsAccountLocalIds(callback: AsyncCallback<Array<number>>): void Obtains information about all activated OS accounts. This API uses an asynchronous callback to return the result. @@ -1481,21 +1481,21 @@ Obtains information about all activated OS accounts. This API uses an asynchrono ```js let accountManager = account_osAccount.getAccountManager(); try { - accountManager.getActivatedOsAccountIds((err, idArray)=>{ - console.log('getActivatedOsAccountIds err:' + JSON.stringify(err)); - console.log('getActivatedOsAccountIds idArray length:' + idArray.length); + accountManager.getActivatedOsAccountLocalIds((err, idArray)=>{ + console.log('getActivatedOsAccountLocalIds err:' + JSON.stringify(err)); + console.log('getActivatedOsAccountLocalIds idArray length:' + idArray.length); for(let i=0;i9+
+### getActivatedOsAccountLocalIds9+ -getActivatedOsAccountIds(): Promise<Array<number>> +getActivatedOsAccountLocalIds(): Promise<Array<number>> Obtains information about all activated OS accounts. This API uses a promise to return the result. @@ -1518,13 +1518,13 @@ Obtains information about all activated OS accounts. This API uses a promise to ```js let accountManager = account_osAccount.getAccountManager(); try { - accountManager.getActivatedOsAccountIds().then((idArray) => { - console.log('getActivatedOsAccountIds, idArray: ' + idArray); + accountManager.getActivatedOsAccountLocalIds().then((idArray) => { + console.log('getActivatedOsAccountLocalIds, idArray: ' + idArray); }).catch((err) => { - console.log('getActivatedOsAccountIds err: ' + JSON.stringify(err)); + console.log('getActivatedOsAccountLocalIds err: ' + JSON.stringify(err)); }); } catch (e) { - console.log('getActivatedOsAccountIds exception:' + JSON.stringify(e)); + console.log('getActivatedOsAccountLocalIds exception:' + JSON.stringify(e)); } ``` @@ -1690,7 +1690,7 @@ Creates an OS account and associates it with the specified domain account. This | Type | Description | | ---------------------------------------------- | -------------------------------------- | -| Promise<[OsAccountInfo](#osaccountinfo)> | Promise used to return the OS account created.| +| Promise<[OsAccountInfo](#osaccountinfo)> | Promise used to return the information about the created OS account.| **Error codes** @@ -2214,9 +2214,9 @@ Sets a profile photo for an OS account. This API uses a promise to return the re } ``` -### queryOsAccountLocalIdBySerialNumber9+ +### getOsAccountLocalIdForSerialNumber9+ -queryOsAccountLocalIdBySerialNumber(serialNumber: number, callback: AsyncCallback<number>): void +getOsAccountLocalIdForSerialNumber(serialNumber: number, callback: AsyncCallback<number>): void Obtains the OS account ID based on the serial number (SN). This API uses an asynchronous callback to return the result. @@ -2243,7 +2243,7 @@ Obtains the OS account ID based on the serial number (SN). This API uses an asyn let accountManager = account_osAccount.getAccountManager(); let serialNumber = 12345; try { - accountManager.queryOsAccountLocalIdBySerialNumber(serialNumber, (err, localId)=>{ + accountManager.getOsAccountLocalIdForSerialNumber(serialNumber, (err, localId)=>{ console.log('ger localId err:' + JSON.stringify(err)); console.log('get localId:' + localId + ' by serialNumber: ' + serialNumber); }); @@ -2252,9 +2252,9 @@ Obtains the OS account ID based on the serial number (SN). This API uses an asyn } ``` -### queryOsAccountLocalIdBySerialNumber9+ +### getOsAccountLocalIdForSerialNumber9+ -queryOsAccountLocalIdBySerialNumber(serialNumber: number): Promise<number> +getOsAccountLocalIdForSerialNumber(serialNumber: number): Promise<number> Obtains the OS account ID based on the SN. This API uses a promise to return the result. @@ -2286,19 +2286,19 @@ Obtains the OS account ID based on the SN. This API uses a promise to return the let accountManager = account_osAccount.getAccountManager(); let serialNumber = 12345; try { - accountManager.queryOsAccountLocalIdBySerialNumber(serialNumber).then((localId) => { - console.log('queryOsAccountLocalIdBySerialNumber localId: ' + localId); + accountManager.getOsAccountLocalIdForSerialNumber(serialNumber).then((localId) => { + console.log('getOsAccountLocalIdForSerialNumber localId: ' + localId); }).catch((err) => { - console.log('queryOsAccountLocalIdBySerialNumber err: ' + JSON.stringify(err)); + console.log('getOsAccountLocalIdForSerialNumber err: ' + JSON.stringify(err)); }); } catch (e) { - console.log('queryOsAccountLocalIdBySerialNumber exception: ' + JSON.stringify(e)); + console.log('getOsAccountLocalIdForSerialNumber exception: ' + JSON.stringify(e)); } ``` -### querySerialNumberByOsAccountLocalId9+ +### getSerialNumberForOsAccountLocalId9+ -querySerialNumberByOsAccountLocalId(localId: number, callback: AsyncCallback<number>): void +getSerialNumberForOsAccountLocalId(localId: number, callback: AsyncCallback<number>): void Obtains the SN of an OS account based on the account ID. This API uses an asynchronous callback to return the result. @@ -2325,7 +2325,7 @@ Obtains the SN of an OS account based on the account ID. This API uses an asynch let accountManager = account_osAccount.getAccountManager(); let localId = 100; try { - accountManager.querySerialNumberByOsAccountLocalId(localId, (err, serialNumber)=>{ + accountManager.getSerialNumberForOsAccountLocalId(localId, (err, serialNumber)=>{ console.log('ger serialNumber err:' + JSON.stringify(err)); console.log('get serialNumber:' + serialNumber + ' by localId: ' + localId); }); @@ -2334,9 +2334,9 @@ Obtains the SN of an OS account based on the account ID. This API uses an asynch } ``` -### querySerialNumberByOsAccountLocalId9+ +### getSerialNumberForOsAccountLocalId9+ -querySerialNumberByOsAccountLocalId(localId: number): Promise<number> +getSerialNumberForOsAccountLocalId(localId: number): Promise<number> Obtains the SN of an OS account based on the account ID. This API uses a promise to return the result. @@ -2368,13 +2368,13 @@ Obtains the SN of an OS account based on the account ID. This API uses a promise let accountManager = account_osAccount.getAccountManager(); let localId = 100; try { - accountManager.querySerialNumberByOsAccountLocalId(localId).then((serialNumber) => { - console.log('querySerialNumberByOsAccountLocalId serialNumber: ' + serialNumber); + accountManager.getSerialNumberForOsAccountLocalId(localId).then((serialNumber) => { + console.log('getSerialNumberForOsAccountLocalId serialNumber: ' + serialNumber); }).catch((err) => { - console.log('querySerialNumberByOsAccountLocalId err: ' + JSON.stringify(err)); + console.log('getSerialNumberForOsAccountLocalId err: ' + JSON.stringify(err)); }); } catch (e) { - console.log('querySerialNumberByOsAccountLocalId exception:' + JSON.stringify(e)); + console.log('getSerialNumberForOsAccountLocalId exception:' + JSON.stringify(e)); } ``` @@ -2462,9 +2462,9 @@ Unsubscribes from the OS account activation states, including the states of the } ``` -### getBundleIdFromUid9+ +### getBundleIdForUid9+ -getBundleIdFromUid(uid: number, callback: AsyncCallback<number>): void; +getBundleIdForUid(uid: number, callback: AsyncCallback<number>): void; Obtains the bundle ID based on the UID. This API uses an asynchronous callback to return the result. @@ -2492,17 +2492,17 @@ Obtains the bundle ID based on the UID. This API uses an asynchronous callback t let accountManager = account_osAccount.getAccountManager(); let testUid = 1000000; try { - accountManager.getBundleIdFromUid(testUid, (err, bundleId) => { - console.info('getBundleIdFromUid errInfo:' + JSON.stringify(err)); - console.info('getBundleIdFromUid bundleId:' + JSON.stringify(bundleId)); + accountManager.getBundleIdForUid(testUid, (err, bundleId) => { + console.info('getBundleIdForUid errInfo:' + JSON.stringify(err)); + console.info('getBundleIdForUid bundleId:' + JSON.stringify(bundleId)); }); } catch (e) { - console.info('getBundleIdFromUid exception:' + JSON.stringify(e)); + console.info('getBundleIdForUid exception:' + JSON.stringify(e)); } ``` -### getBundleIdFromUid9+ +### getBundleIdForUid9+ -getBundleIdFromUid(uid: number): Promise<number>; +getBundleIdForUid(uid: number): Promise<number>; Obtains the bundle ID based on the UID. This API uses a promise to return the result. @@ -2535,13 +2535,13 @@ Obtains the bundle ID based on the UID. This API uses a promise to return the re let accountManager = account_osAccount.getAccountManager(); let testUid = 1000000; try { - accountManager.getBundleIdFromUid(testUid).then((result) => { - console.info('getBundleIdFromUid bundleId:' + JSON.stringify(result)); + accountManager.getBundleIdForUid(testUid).then((result) => { + console.info('getBundleIdForUid bundleId:' + JSON.stringify(result)); }).catch((err)=>{ - console.info('getBundleIdFromUid errInfo:' + JSON.stringify(err)); + console.info('getBundleIdForUid errInfo:' + JSON.stringify(err)); }); } catch (e) { - console.info('getBundleIdFromUid exception:' + JSON.stringify(e)); + console.info('getBundleIdForUid exception:' + JSON.stringify(e)); } ``` @@ -2620,9 +2620,9 @@ Checks whether the current process belongs to the main OS account. This API uses console.info('isMainOsAccount exception:' + JSON.stringify(e)); } ``` -### queryOsAccountConstraintSourceTypes9+ +### getOsAccountConstraintSourceTypes9+ -queryOsAccountConstraintSourceTypes(localId: number, constraint: string, callback: AsyncCallback<Array<ConstraintSourceTypeInfo>>): void; +getOsAccountConstraintSourceTypes(localId: number, constraint: string, callback: AsyncCallback<Array<ConstraintSourceTypeInfo>>): void; Obtains the constraint source information of an OS account. This API uses an asynchronous callback to return the result. @@ -2653,18 +2653,18 @@ Obtains the constraint source information of an OS account. This API uses an asy ```js let accountManager = account_osAccount.getAccountManager(); try { - accountManager.queryOsAccountConstraintSourceTypes(100, 'constraint.wifi',(err,sourceTypeInfos)=>{ - console.info('queryOsAccountConstraintSourceType errInfo:' + JSON.stringify(err)); - console.info('queryOsAccountConstraintSourceType sourceTypeInfos:' + JSON.stringify(sourceTypeInfos)); + accountManager.getOsAccountConstraintSourceTypes(100, 'constraint.wifi',(err,sourceTypeInfos)=>{ + console.info('getOsAccountConstraintSourceTypes errInfo:' + JSON.stringify(err)); + console.info('getOsAccountConstraintSourceTypes sourceTypeInfos:' + JSON.stringify(sourceTypeInfos)); }); } catch (e) { - console.info('queryOsAccountConstraintSourceType exception:' + JSON.stringify(e)); + console.info('getOsAccountConstraintSourceTypes exception:' + JSON.stringify(e)); } ``` -### queryOsAccountConstraintSourceTypes9+ +### getOsAccountConstraintSourceTypes9+ -queryOsAccountConstraintSourceTypes(localId: number, constraint: string): Promise<Array<ConstraintSourceTypeInfo>>; +getOsAccountConstraintSourceTypes(localId: number, constraint: string): Promise<Array<ConstraintSourceTypeInfo>>; Obtains the constraint source information of an OS account. This API uses a promise to return the result. @@ -2700,15 +2700,16 @@ Obtains the constraint source information of an OS account. This API uses a prom ```js let accountManager = account_osAccount.getAccountManager(); try { - accountManager.queryOsAccountConstraintSourceTypes(100, 'constraint.wifi').then((result) => { - console.info('queryOsAccountConstraintSourceType sourceTypeInfos:' + JSON.stringify(result)); + accountManager.getOsAccountConstraintSourceTypes(100, 'constraint.wifi').then((result) => { + console.info('getOsAccountConstraintSourceTypes sourceTypeInfos:' + JSON.stringify(result)); }).catch((err)=>{ - console.info('queryOsAccountConstraintSourceType errInfo:' + JSON.stringify(err)); + console.info('getOsAccountConstraintSourceTypes errInfo:' + JSON.stringify(err)); }); } catch (e) { - console.info('queryOsAccountConstraintSourceType exception:' + JSON.stringify(e)); + console.info('getOsAccountConstraintSourceTypes exception:' + JSON.stringify(e)); } ``` + ### isMultiOsAccountEnable(deprecated) isMultiOsAccountEnable(callback: AsyncCallback<boolean>): void @@ -2725,7 +2726,7 @@ Checks whether multiple OS accounts are supported. This API uses an asynchronous | Name | Type | Mandatory| Description | | -------- | ---------------------------- | ---- | ------------------------------------------------------ | -| callback | AsyncCallback<boolean> | Yes | Callback invoked to return the result. The value **true** means multiple OS accounts are supported; the value false means the opposite.| +| callback | AsyncCallback<boolean> | Yes | Callback invoked to return the result. The value **true** means multiple OS accounts are supported; the value **false** means the opposite.| **Example** @@ -2756,7 +2757,7 @@ Checks whether multiple OS accounts are supported. This API uses a promise to re | Type | Description | | :--------------------- | :--------------------------------------------------------- | -| Promise<boolean> | Promise used to return the result. The value **true** means multiple OS accounts are supported; the value false means the opposite.| +| Promise<boolean> | Promise used to return the result. The value **true** means multiple OS accounts are supported; the value **false** means the opposite.| **Example** @@ -2851,7 +2852,7 @@ Checks whether the specified constraint is enabled for an OS account. This API u > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [checkConstraintEnabled](#checkconstraintenabled9). +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [checkOsAccountConstraintEnabled](#checkosaccountconstraintenabled9). **Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS @@ -2888,7 +2889,7 @@ Checks whether the specified constraint is enabled for an OS account. This API u > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [checkConstraintEnabled](#checkconstraintenabled9-1). +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [checkOsAccountConstraintEnabled](#checkosaccountconstraintenabled9-1). **Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS @@ -3157,7 +3158,7 @@ Obtains the ID of the OS account to which the current process belongs. This API > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [queryOsAccountLocalIdFromProcess](#queryosaccountlocalidfromprocess9). +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [getOsAccountLocalId](#getosaccountlocalid9). **System capability**: SystemCapability.Account.OsAccount @@ -3188,7 +3189,7 @@ Obtains the ID of the OS account to which the current process belongs. This API > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [queryOsAccountLocalIdFromProcess](#queryosaccountlocalidfromprocess9-1). +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [getOsAccountLocalId](#getosaccountlocalid9-1). **System capability**: SystemCapability.Account.OsAccount @@ -3217,7 +3218,7 @@ Obtains the OS account ID based on the process UID. This API uses an asynchronou > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [queryOsAccountLocalIdFromUid](#queryosaccountlocalidfromuid9). +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [getOsAccountLocalIdForUid](#getosaccountlocalidforuid9). **System capability**: SystemCapability.Account.OsAccount @@ -3250,7 +3251,7 @@ Obtains the OS account ID based on the process UID. This API uses a promise to r > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [queryOsAccountLocalIdFromUid](#queryosaccountlocalidfromuid9-1). +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [getOsAccountLocalIdForUid](#getosaccountlocalidforuid9-1). **System capability**: SystemCapability.Account.OsAccount @@ -3286,7 +3287,7 @@ Obtains the OS account ID based on the domain account information. This API uses > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [queryOsAccountLocalIdFromDomain](#queryosaccountlocalidfromdomain9). +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getOsAccountLocalIdForDomain](#getosaccountlocalidfordomain9). **Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS @@ -3321,7 +3322,7 @@ Obtains the OS account ID based on the domain account information. This API uses > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [queryOsAccountLocalIdFromDomain](#queryosaccountlocalidfromdomain9-1). +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getOsAccountLocalIdForDomain](#getosaccountlocalidfordomain9-1). **Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS @@ -3429,7 +3430,7 @@ Obtains information about all activated OS accounts. This API uses an asynchrono > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getActivatedOsAccountIds](#getactivatedosaccountids9). +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getActivatedOsAccountLocalIds](#getactivatedosaccountlocalids9). **System capability**: SystemCapability.Account.OsAccount @@ -3458,7 +3459,7 @@ queryActivatedOsAccountIds(): Promise<Array<number>> > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getActivatedOsAccountIds](#getactivatedosaccountids9-1). +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getActivatedOsAccountLocalIds](#getactivatedosaccountlocalids9-1). Obtains information about all activated OS accounts. This API uses a promise to return the result. @@ -3668,7 +3669,7 @@ Obtains the OS account ID based on the SN. This API uses an asynchronous callbac > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [queryOsAccountLocalIdBySerialNumber](#queryosaccountlocalidbyserialnumber9). +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getOsAccountLocalIdForSerialNumber](#getosaccountlocalidforserialnumber9). **System capability**: SystemCapability.Account.OsAccount @@ -3698,7 +3699,7 @@ Obtains the OS account ID based on the SN. This API uses a promise to return the > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [queryOsAccountLocalIdBySerialNumber](#queryosaccountlocalidbyserialnumber9-1). +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getOsAccountLocalIdForSerialNumber](#getosaccountlocalidforserialnumber9-1). **System capability**: SystemCapability.Account.OsAccount @@ -3734,7 +3735,7 @@ Obtains the SN of an OS account based on the account ID. This API uses an asynch > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [querySerialNumberByOsAccountLocalId](#queryserialnumberbyosaccountlocalid9). +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getSerialNumberForOsAccountLocalId](#getserialnumberforosaccountlocalid9). **System capability**: SystemCapability.Account.OsAccount @@ -3764,7 +3765,7 @@ Obtains the SN of an OS account based on the account ID. This API uses a promise > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [querySerialNumberByOsAccountLocalId](#queryserialnumberbyosaccountlocalid9-1). +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getSerialNumberForOsAccountLocalId](#getserialnumberforosaccountlocalid9-1). **System capability**: SystemCapability.Account.OsAccount @@ -4280,12 +4281,17 @@ Register a PIN inputer. | ----------| ----------------------- | --- | -------------------------- | | inputer | [IInputer](#iinputer8) | Yes | PIN inputer, which is used to obtain the PIN.| +**Return value** + +| Type | Description | +| :------ | :-------------------------------------------- | +| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + **Error codes** | ID| Error Message | | -------- | --------------------------- | | 12300001 | System service exception. | -| 12300102 | Invalid inputer. | | 12300103 | Inputer already registered. | **Example** @@ -4294,8 +4300,8 @@ Register a PIN inputer. let password = new Uint8Array([0, 0, 0, 0, 0]); try { let result = pinAuth.registerInputer({ - onGetData: (authSubType, callback) => { - callback.onSetData(authSubType, password); + onGetData: (pinSubType, callback) => { + callback.onSetData(pinSubType, password); } }); console.log('registerInputer result = ' + result); @@ -4322,91 +4328,6 @@ Unregisters this PIN inputer. pinAuth.unregisterInputer(); ``` -### InputerManager 10+ - -Provides APIs for managing credential inputers. - -### registerInputer10+ - -registerInputer(authType: AuthType, inputer: IInputer): void; - -Register a credential inputer. - -**System API**: This is a system API. - -**System capability**: SystemCapability.Account.OsAccount - -**Required permissions**: ohos.permission.ACCESS_USER_AUTH_INTERNAL or ohos.permission.MANAGE_USER_IDM - -**Parameters** - -| Name | Type | Mandatory| Description | -| ----------| ----------------------- | --- | -------------------------- | -| authType | [AuthType](#authtype8) | Yes | Authentication credential type.| -| inputer | [IInputer](#iinputer8) | Yes | Credential inputer to register.| - -**Error codes** - -| ID| Error Message | -| -------- | --------------------------- | -| 12300001 | System service exception. | -| 12300102 | Invalid authType or inputer. | -| 12300103 | The credential inputer has been registered. | -| 12300106 | Unsupported authType. | - -**Example** - ```js - let inputerMgr = new account_osAccount.InputerManager(); - let authType = account_osAccount.AuthType.DOMAIN; - let password = new Uint8Array([0, 0, 0, 0, 0]); - try { - InputerMgr.registerInputer(authType, { - onGetData: (authSubType, callback) => { - callback.onSetData(authSubType, password); - } - }); - console.log('registerInputer success.'); - } catch (e) { - console.log('registerInputer exception = ' + JSON.stringify(e)); - } - ``` - -### unregisterInputer10+ - -unregisterInputer(authType: AuthType): void; - -Unregisters this credential inputer. - -**System API**: This is a system API. - -**System capability**: SystemCapability.Account.OsAccount - -**Required permissions**: ohos.permission.ACCESS_USER_AUTH_INTERNAL or ohos.permission.MANAGE_USER_IDM - -**Parameters** - -| Name | Type | Mandatory| Description | -| ----------| ----------------------- | --- | -------------------------- | -| authType | [AuthType](#authtype8) | Yes | Authentication credential type.| - -**Error codes** - -| ID| Error Message | -| -------- | --------------------------- | -| 12300002 | Invalid authType. | - -**Example** - ```js - let inputerMgr = new account_osAccount.InputerManager(); - let authType = account_osAccount.AuthType.DOMAIN; - try { - inputerMgr.unregisterInputer(authType); - console.log('unregisterInputer success.'); - } catch(err) { - console.log("unregisterInputer err:" + JSON.stringify(err)); - } - ``` - ## UserIdentityManager8+ Provides APIs for user identity management (IDM). @@ -4536,8 +4457,8 @@ Adds credential information, including the credential type, subtype, and token ( let password = new Uint8Array([0, 0, 0, 0, 0, 0]); let pinAuth = new account_osAccount.PINAuth(); pinAuth.registerInputer({ - onGetData: (authSubType, callback) => { - callback.onSetData(authSubType, password); + onGetData: (pinSubType, callback) => { + callback.onSetData(pinSubType, password); } }); let credentialInfo = { @@ -4550,12 +4471,12 @@ Adds credential information, including the credential type, subtype, and token ( try { userIDM.addCredential(credentialInfo, { onResult: (result, extraInfo) => { - console.log('addCredential result = ' + result); - console.log('addCredential extraInfo = ' + extraInfo); + console.log('updateCredential result = ' + result); + console.log('updateCredential extraInfo = ' + extraInfo); } }); } catch (e) { - console.log('addCredential exception = ' + JSON.stringify(e)); + console.log('updateCredential exception = ' + JSON.stringify(e)); } }); ``` @@ -4600,8 +4521,8 @@ Updates credential information. This API uses a callback to return the result. token: null }; pinAuth.registerInputer({ - onGetData: (authSubType, callback) => { - callback.onSetData(authSubType, password); + onGetData: (pinSubType, callback) => { + callback.onSetData(pinSubType, password); } }); userIDM.openSession((err, challenge) => { @@ -4900,7 +4821,7 @@ Provides callbacks for PIN operations. ### onSetData8+ -onSetData: (authSubType: AuthSubType, data: Uint8Array) => void; +onSetData: (pinSubType: AuthSubType, data: Uint8Array) => void; **System API**: This is a system API. @@ -4912,7 +4833,7 @@ Called to set data in a PIN operation. | Name | Type | Mandatory| Description | | ---------- | ---------------------------------------- | ---- | ----------------------------------------------- | -| authSubType | [AuthSubType](#authsubtype8) | Yes | Credential subtype. | +| pinSubType | [AuthSubType](#authsubtype8) | Yes | Credential subtype. | | data | Uint8Array | Yes | Data (credential) to set. The data is used for authentication and operations for adding and modifying credentials.| **Example** @@ -4920,11 +4841,11 @@ Called to set data in a PIN operation. let password = new Uint8Array([0, 0, 0, 0, 0, 0]); let passwordNumber = new Uint8Array([1, 2, 3, 4]); let inputer = { - onGetData: (authSubType, callback) => { - if (authSubType == account_osAccount.AuthSubType.PIN_NUMBER) { - callback.onSetData(authSubType, passwordNumber); + onGetData: (pinSubType, callback) => { + if (pinSubType == account_osAccount.AuthSubType.PIN_NUMBER) { + callback.onSetData(pinSubType, passwordNumber); } else { - callback.onSetData(authSubType, password); + callback.onSetData(pinSubType, password); } } }; @@ -4932,13 +4853,13 @@ Called to set data in a PIN operation. ## IInputer8+ -Provides callbacks for credential inputers. +Provides callbacks for the PIN input box. **System API**: This is a system API. ### onGetData8+ -onGetData: (authSubType: AuthSubType, callback: IInputData) => void; +onGetData: (pinSubType: AuthSubType, callback: IInputData) => void; Called to obtain data. @@ -4957,11 +4878,11 @@ Called to obtain data. let password = new Uint8Array([0, 0, 0, 0, 0, 0]); let passwordNumber = new Uint8Array([1, 2, 3, 4]); let inputer = { - onGetData: (authSubType, callback) => { - if (authSubType == account_osAccount.AuthSubType.PIN_NUMBER) { - callback.onSetData(authSubType, passwordNumber); + onGetData: (pinSubType, callback) => { + if (pinSubType == account_osAccount.AuthSubType.PIN_NUMBER) { + callback.onSetData(pinSubType, passwordNumber); } else { - callback.onSetData(authSubType, password); + callback.onSetData(pinSubType, password); } } }; @@ -5237,8 +5158,6 @@ Enumerates the authentication credential types. | ----- | ----- | ---------------- | | PIN | 1 | PIN authentication.| | FACE | 2 | Facial authentication.| -| FINGERPRINT10+ | 4 | Fingerprint authentication.| -| DOMAIN10+ | 1024 | Domain authentication.| ## AuthSubType8+ @@ -5255,7 +5174,6 @@ Enumerates the authentication credential subtypes. | PIN_MIXED | 10002 | Custom mixed credentials.| | FACE_2D | 20000 | 2D face credential. | | FACE_3D | 20001 | 3D face credential. | -| DOMAIN_MIXED10+ | 10240001 | Mixed domain authentication credentials. | ## AuthTrustLevel8+ diff --git a/en/application-dev/reference/apis/js-apis-permissionrequestresult.md b/en/application-dev/reference/apis/js-apis-permissionrequestresult.md index 03e049e9a1bb1076f770bd2d89dc25455c453ee6..a26078b7435fadd2599f531612025511b6e63b60 100644 --- a/en/application-dev/reference/apis/js-apis-permissionrequestresult.md +++ b/en/application-dev/reference/apis/js-apis-permissionrequestresult.md @@ -4,8 +4,8 @@ The **PermissionRequestResult** module defines the result of a permission reques > **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 of this module can be used only in the stage model. +> - 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 of this module can be used only in the stage model. ## Attributes @@ -14,7 +14,7 @@ The **PermissionRequestResult** module defines the result of a permission reques | Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | | permissions | Array<string> | Yes| No| Permissions requested.| -| authResults | Array<number> | Yes| No| Whether the requested permissions are granted. The value **0** means that the requests permissions are granted, and a non-zero value means the opposite.| +| authResults | Array<number> | Yes| No|Result of the permission Request.
**-1**: The permission has been set and no dialog box will be displayed. Users can modify the permission in **Settings**.
**0**: No operation is required.
**1**: Dynamic user authorization is required via a dialog window .
**2**: The request is invalid. Possible causes are as follows:
- The permission is not declared in the configuration file.
- The permission name is invalid.
- Special conditions for applying for the permission do not satisfied. See [ohos.permission.LOCATION](../../security/permission-list.md#ohospermissionlocation) and [ohos.permission.APPROXIMATELY_LOCATION](../../security/permission-list.md#ohospermissionapproximately_location).| ## Usage @@ -36,5 +36,3 @@ try { console.log(`catch err->${JSON.stringify(err)}`); } ``` - - \ No newline at end of file diff --git a/en/application-dev/reference/apis/js-apis-plainarray.md b/en/application-dev/reference/apis/js-apis-plainarray.md index 8ccc7d7fb4bc1a5f876b8da75c181f8547e32f51..387577bb2409ae399f46a225e53e3d00db9035e6 100644 --- a/en/application-dev/reference/apis/js-apis-plainarray.md +++ b/en/application-dev/reference/apis/js-apis-plainarray.md @@ -621,7 +621,7 @@ let plainArray = new PlainArray(); plainArray.add(1, "squirrel"); plainArray.add(2, "sparrow"); plainArray.forEach((value, index) => { - console.log("value:" + value, index); + console.log("value:" + value, "index:" + index); }); ``` diff --git a/en/application-dev/reference/apis/js-apis-pointer.md b/en/application-dev/reference/apis/js-apis-pointer.md index fc74447111636244fb54e604dba5c458a6e6e061..3a31a8179560f622bcf62e7d3c3640a72436beb5 100644 --- a/en/application-dev/reference/apis/js-apis-pointer.md +++ b/en/application-dev/reference/apis/js-apis-pointer.md @@ -420,44 +420,44 @@ Enumerates mouse pointer styles. **System capability**: SystemCapability.MultimodalInput.Input.Pointer -| Name | Value | Description | -| -------------------------------- | ---- | ------ | -| DEFAULT | 0 | Default | -| EAST | 1 | East arrow | -| WEST | 2 | West arrow | -| SOUTH | 3 | South arrow | -| NORTH | 4 | North arrow | -| WEST_EAST | 5 | West-east arrow | -| NORTH_SOUTH | 6 | North-south arrow | -| NORTH_EAST | 7 | North-east arrow | -| NORTH_WEST | 8 | North-west arrow | -| SOUTH_EAST | 9 | South-east arrow | -| SOUTH_WEST | 10 | South-west arrow | -| NORTH_EAST_SOUTH_WEST | 11 | North-east and south-west adjustment| -| NORTH_WEST_SOUTH_EAST | 12 | North-west and south-east adjustment| -| CROSS | 13 | Cross (accurate selection) | -| CURSOR_COPY | 14 | Copy cursor | -| CURSOR_FORBID | 15 | Forbid cursor | -| COLOR_SUCKER | 16 | Sucker | -| HAND_GRABBING | 17 | Grabbing hand | -| HAND_OPEN | 18 | Opening hand | -| HAND_POINTING | 19 | Hand-shaped pointer | -| HELP | 20 | Help | -| MOVE | 21 | Move | -| RESIZE_LEFT_RIGHT | 22 | Left and right resizing| -| RESIZE_UP_DOWN | 23 | Up and down resizing| -| SCREENSHOT_CHOOSE | 24 | Screenshot crosshair| -| SCREENSHOT_CURSOR | 25 | Screenshot cursor | -| TEXT_CURSOR | 26 | Text cursor | -| ZOOM_IN | 27 | Zoom in | -| ZOOM_OUT | 28 | Zoom out | -| MIDDLE_BTN_EAST | 29 | Scrolling east | -| MIDDLE_BTN_WEST | 30 | Scrolling west | -| MIDDLE_BTN_SOUTH | 31 | Scrolling south | -| MIDDLE_BTN_NORTH | 32 | Scrolling north | -| MIDDLE_BTN_NORTH_SOUTH | 33 | Scrolling north-south | -| MIDDLE_BTN_NORTH_EAST | 34 | Scrolling north-east | -| MIDDLE_BTN_NORTH_WEST | 35 | Scrolling north-west | -| MIDDLE_BTN_SOUTH_EAST | 36 | Scrolling south-east | -| MIDDLE_BTN_SOUTH_WEST | 37 | Scrolling south-west | -| MIDDLE_BTN_NORTH_SOUTH_WEST_EAST | 38 | Moving as a cone in four directions| +| Name | Value | Description |Legend| +| -------------------------------- | ---- | ------ |------ | +| DEFAULT | 0 | Default |![Default.png](./figures/Default.png)| +| EAST | 1 | East arrow |![East.png](./figures/East.png)| +| WEST | 2 | West arrow |![West.png](./figures/West.png)| +| SOUTH | 3 | South arrow |![South.png](./figures/South.png)| +| NORTH | 4 | North arrow |![North.png](./figures/North.png)| +| WEST_EAST | 5 | West-east arrow |![West_East.png](./figures/West_East.png)| +| NORTH_SOUTH | 6 | North-south arrow |![North_South.png](./figures/North_South.png)| +| NORTH_EAST | 7 | North-east arrow |![North_East.png](./figures/North_East.png)| +| NORTH_WEST | 8 | North-west arrow |![North_West.png](./figures/North_West.png)| +| SOUTH_EAST | 9 | South-east arrow |![South_East.png](./figures/South_East.png)| +| SOUTH_WEST | 10 | South-west arrow |![South_West.png](./figures/South_West.png)| +| NORTH_EAST_SOUTH_WEST | 11 | North-east and south-west adjustment|![North_East_South_West.png](./figures/North_East_South_West.png)| +| NORTH_WEST_SOUTH_EAST | 12 | North-west and south-east adjustment|![North_West_South_East.png](./figures/North_West_South_East.png)| +| CROSS | 13 | Cross (accurate selection) |![Cross.png](./figures/Cross.png)| +| CURSOR_COPY | 14 | Copy cursor |![Copy.png](./figures/Copy.png)| +| CURSOR_FORBID | 15 | Forbid cursor |![Forbid.png](./figures/Forbid.png)| +| COLOR_SUCKER | 16 | Sucker |![Colorsucker.png](./figures/Colorsucker.png)| +| HAND_GRABBING | 17 | Grabbing hand |![Hand_Grabbing.png](./figures/Hand_Grabbing.png)| +| HAND_OPEN | 18 | Opening hand |![Hand_Open.png](./figures/Hand_Open.png)| +| HAND_POINTING | 19 | Hand-shaped pointer |![Hand_Poniting.png](./figures/Hand_Pointing.png)| +| HELP | 20 | Help |![Help.png](./figures/Help.png)| +| MOVE | 21 | Move |![Move.png](./figures/Move.png)| +| RESIZE_LEFT_RIGHT | 22 | Left-and-right resizing|![Resize_Left_Right.png](./figures/Resize_Left_Right.png)| +| RESIZE_UP_DOWN | 23 | Up-and-down resizing|![Resize_Up_Down.png](./figures/Resize_Up_Down.png)| +| SCREENSHOT_CHOOSE | 24 | Screenshot crosshair|![Screenshot_Cross.png](./figures/Screenshot_Cross.png)| +| SCREENSHOT_CURSOR | 25 | Screenshot cursor |![Screenshot_Cursor.png](./figures/Screenshot_Cursor.png)| +| TEXT_CURSOR | 26 | Text cursor |![Text_Cursor.png](./figures/Text_Cursor.png)| +| ZOOM_IN | 27 | Zoom in |![Zoom_In.png](./figures/Zoom_In.png)| +| ZOOM_OUT | 28 | Zoom out |![Zoom_Out.png](./figures/Zoom_Out.png)| +| MIDDLE_BTN_EAST | 29 | Scrolling east |![MID_Btn_East.png](./figures/MID_Btn_East.png)| +| MIDDLE_BTN_WEST | 30 | Scrolling west |![MID_Btn_West.png](./figures/MID_Btn_West.png)| +| MIDDLE_BTN_SOUTH | 31 | Scrolling south | ![MID_Btn_South.png](./figures/MID_Btn_South.png) | +| MIDDLE_BTN_NORTH | 32 | Scrolling north |![MID_Btn_North.png](./figures/MID_Btn_North.png)| +| MIDDLE_BTN_NORTH_SOUTH | 33 | Scrolling north-south |![MID_Btn_North_South.png](./figures/MID_Btn_North_South.png)| +| MIDDLE_BTN_NORTH_EAST | 34 | Scrolling north-east |![MID_Btn_North_East.png](./figures/MID_Btn_North_East.png)| +| MIDDLE_BTN_NORTH_WEST | 35 | Scrolling north-west |![MID_Btn_North_West.png](./figures/MID_Btn_North_West.png)| +| MIDDLE_BTN_SOUTH_EAST | 36 | Scrolling south-east |![MID_Btn_South_East.png](./figures/MID_Btn_South_East.png)| +| MIDDLE_BTN_SOUTH_WEST | 37 | Scrolling south-west |![MID_Btn_South_West.png](./figures/MID_Btn_South_West.png)| +| MIDDLE_BTN_NORTH_SOUTH_WEST_EAST | 38 | Moving as a cone in four directions|![MID_Btn_North_South_West_East.png](./figures/MID_Btn_North_South_West_East.png)| diff --git a/en/application-dev/reference/apis/js-apis-process.md b/en/application-dev/reference/apis/js-apis-process.md index 318ba307995a44950461ae3b9a43e92743c37364..02dbfe617a26b98d8c0d5b5d533fa16e2bcede04 100755 --- a/en/application-dev/reference/apis/js-apis-process.md +++ b/en/application-dev/reference/apis/js-apis-process.md @@ -18,139 +18,117 @@ import process from '@ohos.process'; | Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | -| egid | number | Yes| No| Effective group identifier (EGID) of a process.
**System API**: This is a system API.
It is used only to test applications.| -| euid | number | Yes| No| Effective user identifier (EUID) of a process.
**System API**: This is a system API.
It is used only to test applications.| -| gid | number | Yes| No| Group identifier (GID) of a process.
**System API**: This is a system API.
It is used only to test applications.| -| uid | number | Yes| No| User identifier (UID) of a process.| +| egid | number | Yes| No| Effective group identifier (EGID) of the process.
**System API**: This is a system API.
It is used only to test applications.| +| euid | number | Yes| No| Effective user identifier (EUID) of the process.
**System API**: This is a system API.
It is used only to test applications.| +| gid | number | Yes| No| Group identifier (GID) of the process.
**System API**: This is a system API.
It is used only to test applications.| +| uid | number | Yes| No| User identifier (UID) of the process.| | groups | number[] | Yes| No| Array with supplementary group IDs.
**System API**: This is a system API.
It is used only to test applications.| -| pid | number | Yes| No| Process ID (PID) of a process.| -| ppid | number | Yes| No| Parent process ID (PPID) of a process.
**System API**: This is a system API.
It is used only to test applications.| -| tid8+ | number | Yes| No| Thread ID (TID) of a process.| +| pid | number | Yes| No| Process ID (PID) of the process.| +| ppid | number | Yes| No| Parent process ID (PPID) of the process.
**System API**: This is a system API.
It is used only to test applications.| +| tid8+ | number | Yes| No| Thread ID (TID) of the thread.| -## ProcessManager9+ +## EventListener -Provides APIs for throwing exceptions during the addition of a process. +**System capability**: SystemCapability.Utils.Lang -### isAppUid9+ +| Name| Description| +| -------- | -------- | +| EventListener = (evt:  Object) => void | Event to store.| -isAppUid(v: number): boolean -Checks whether a UID belongs to this application. +## process.isIsolatedProcess8+ -**System capability**: SystemCapability.Utils.Lang +isIsolatedProcess(): boolean -**Parameters** +Checks whether this process is isolated. -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| v | number | Yes| UID.| +**System capability**: SystemCapability.Utils.Lang **Return value** | Type| Description| | -------- | -------- | -| boolean | Returns **true** if the UID is the application's UID; returns **false** otherwise.| +| boolean | Returns **true** if the process is isolated; returns **false** otherwise.| **Example** ```js -let pro = new process.ProcessManager(); -let result = pro.isAppUid(688); +let result = process.isIsolatedProcess(); ``` -### getUidForName9+ +## process.is64Bit8+ -getUidForName(v: string): number +is64Bit(): boolean -Obtains the process UID based on the process name. +Checks whether this process is running in a 64-bit environment. **System capability**: SystemCapability.Utils.Lang -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| v | string | Yes| Name of a process.| - **Return value** | Type| Description| | -------- | -------- | -| number | Process UID.| +| boolean | Returns **true** if the process is running in a 64-bit environment; returns **false** otherwise.| **Example** ```js -let pro = new process.ProcessManager(); -let pres = pro .getUidForName("tool"); +let result = process.is64Bit(); ``` -### getThreadPriority9+ +## process.getStartRealtime8+ -getThreadPriority(v: number): number +getStartRealtime(): number -Obtains the thread priority based on the specified TID. +Obtains the duration, in milliseconds, from the time the system starts to the time the process starts. **System capability**: SystemCapability.Utils.Lang -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| v | number | Yes| TID.| - **Return value** | Type| Description| | -------- | -------- | -| number | Priority of the thread.| +| number | Duration obtained, in millisecond.| **Example** ```js -let pro = new process.ProcessManager(); -let tid = process.tid; -let pres = pro.getThreadPriority(tid); +let realtime = process.getStartRealtime(); ``` +## process.getPastCpuTime8+ -### getSystemConfig9+ - -getSystemConfig(name: number): number +getPastCpuTime(): number -Obtains the system configuration. +Obtains the CPU time (in milliseconds) from the time the process starts to the current time. **System capability**: SystemCapability.Utils.Lang -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| name | number | Yes| System configuration parameter name.| - **Return value** | Type| Description| | -------- | -------- | -| number | System configuration obtained.| +| number | CPU time obtained, in millisecond.| **Example** ```js -let pro = new process.ProcessManager(); -let _SC_ARG_MAX = 0; -let pres = pro.getSystemConfig(_SC_ARG_MAX); +let result = process.getPastCpuTime() ; ``` -### getEnvironmentVar9+ +## process.runCmd -getEnvironmentVar(name: string): string +runCmd(command: string, options?: { timeout?: number, killSignal?: number | string, maxBuffer?: number }): ChildProcess -Obtains the value of an environment variable. +Forks a new process to run a shell command and returns the **ChildProcess** object. + +**System API**: This is a system API. + +It is used only to test applications. **System capability**: SystemCapability.Utils.Lang @@ -158,29 +136,58 @@ Obtains the value of an environment variable. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| name | string | Yes| Environment variable name.| +| command | string | Yes| Shell command to run.| +| options | Object | No| Related parameters.| + +**Table 1** options + +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| timeout | number | No| Maximum running time (in milliseconds) of the child process. When the running time of the child process exceeds the value of this parameter, the parent process sends a **killSignal** to the child process to terminate it. The default value is **0**.| +| killSignal | number \| string | No| Signal sent to the child process when the running time of a child process exceeds the timeout period. The default value is **SIGTERM**.| +| maxBuffer | number | No| Maximum buffer size for the standard input and output of the child process. When the size is exceeded, the child process will be terminated. The default value is **1024 \* 1024**.| **Return value** | Type| Description| | -------- | -------- | -| string | Value of the environment variable.| +| [ChildProcess](#childprocess) | **ChildProcess** object.| **Example** ```js -let pro = new process.ProcessManager(); -let pres = pro.getEnvironmentVar("PATH"); +let child = process.runCmd('ls', { maxBuffer : 2 }); +let result = child.wait(); +child.getOutput.then(val=>{ + console.log("child.getOutput = " + val); +}) ``` -### exit9+ +## process.abort -exit(code: number): void +abort(): void -Terminates this process. +Aborts a process and generates a core file. This method will cause a process to exit immediately. Exercise caution when using this method. + +**System capability**: SystemCapability.Utils.Lang -Exercise caution when using this API. +**Example** + +```js +process.abort(); +``` + + +## process.on + +on(type: string, listener: EventListener): void + +Stores the events triggered by the user. + +**System API**: This is a system API. + +It is used only to test applications. **System capability**: SystemCapability.Utils.Lang @@ -188,21 +195,27 @@ Exercise caution when using this API. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| code | number | Yes| Exit code of the process.| +| type | string | Yes| Type of the events to store. | +| listener | [EventListener](#eventlistener) | Yes| Callback invoked to return the event.| **Example** ```js -let pro = new process.ProcessManager(); -pro.exit(0); +process.on("data", (e)=>{ + console.log("data callback"); +}) ``` -### kill9+ +## process.off -kill(signal: number, pid: number): boolean +off(type: string): boolean -Sends a signal to the specified process to terminate it. +Deletes the event stored by the user. + +**System API**: This is a system API. + +It is used only to test applications. **System capability**: SystemCapability.Utils.Lang @@ -210,45 +223,29 @@ Sends a signal to the specified process to terminate it. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| pid | number | Yes| PID of the process, to which the signal will be sent.| -| signal | number | Yes| Signal to send.| +| type | string | Yes| Type of the event to delete.| **Return value** | Type| Description| | -------- | -------- | -| boolean | Returns **true** if the signal is sent successfully; returns **false** otherwise.| +| boolean | Returns **true** if the event is deleted; returns **false** otherwise.| **Example** ```js -let pro = new process.ProcessManager(); -let pres = process.pid; -let result = pro.kill(28, pres); +process.on("data", (e)=>{ + console.log("data callback"); +}) +let result = process.off("data"); ``` -## ChildProcess - -Allows a process to obtain the standard input and output of its child processes, send signals, and close its child processes. - -### Attributes - -**System capability**: SystemCapability.Utils.Lang - -| Name| Type| Readable| Writable| Description| -| -------- | -------- | -------- | -------- | -------- | -| pid | number | Yes| No| PID of the child process.
**System API**: This is a system API.
It is used only to test applications.| -| ppid | number | Yes| No| PPID of the child process.
**System API**: This is a system API.
It is used only to test applications.| -| exitCode | number | Yes| No| Exit code of the child process.
**System API**: This is a system API.
It is used only to test applications.| -| killed | boolean | Yes| No| Whether the parent process successfully sends a signal to the child process to terminate it.
**System API**: This is a system API.
It is used only to test applications.| - - -### wait +## process.cwd -wait(): Promise<number> +cwd(): string -Waits until the child process ends. This method uses a promise to return the exit code of the child process. +Obtains the working directory of this process. **System API**: This is a system API. @@ -260,24 +257,20 @@ It is used only to test applications. | Type| Description| | -------- | -------- | -| Promise<number> | Promise used to return the exit code of the child process.| +| string| Working directory obtained.| **Example** ```js -let child = process.runCmd('ls'); -let result = child.wait(); -result.then(val=>{ - console.log("result = " + val); -}) +let path = process.cwd(); ``` -### getOutput +## process.chdir -getOutput(): Promise<Uint8Array> +chdir(dir: string): void -Obtains the standard output of the child process. +Changes the working directory of this process. **System API**: This is a system API. @@ -285,81 +278,109 @@ It is used only to test applications. **System capability**: SystemCapability.Utils.Lang +**Parameters** + +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| dir | string | Yes| Path| + +**Example** + +```js +process.chdir('/system'); +``` + + +## process.uptime + +uptime(): number + +Obtains the running time of this process. + +**System capability**: SystemCapability.Utils.Lang + **Return value** | Type| Description| | -------- | -------- | -| Promise<Uint8Array> | Promise used to return the standard output in a Uint8Array.| +| number | Running time of the process, in seconds.| **Example** ```js -let child = process.runCmd('ls'); -let result = child.wait(); -child.getOutput().then(val=>{ - console.log("child.getOutput = " + val); -}) +let time = process.uptime(); ``` -### getErrorOutput +## process.kill(deprecated) -getErrorOutput(): Promise<Uint8Array> - -Obtains the standard error output of the child process. +kill(signal: number, pid: number): boolean -**System API**: This is a system API. +Sends a signal to the specified process to terminate it. -It is used only to test applications. +> **NOTE** +> +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [kill9+](#kill9) instead. **System capability**: SystemCapability.Utils.Lang +**Parameters** + +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| pid | number | Yes| PID of the process, to which the signal will be sent.| +| signal | number | Yes| Signal to send.| + **Return value** | Type| Description| | -------- | -------- | -| Promise<Uint8Array> | Promise used to return the standard error output in a Uint8Array.| +| boolean | Returns **true** if the signal is sent successfully; returns **false** otherwise.| **Example** ```js -let child = process.runCmd('madir test.text'); -let result = child.wait(); -child.getErrorOutput().then(val=>{ - console.log("child.getErrorOutput= " + val); -}) +let pres = process.pid +let result = process.kill(28, pres) ``` -### close +## process.exit(deprecated) -close(): void +exit(code: number): void -Closes the child process in running. +Terminates this process. -**System API**: This is a system API. +Exercise caution when using this API. After this API is called, the application exits. If the input parameter is not 0, data loss or exceptions may occur. -It is used only to test applications. +> **NOTE** +> +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [exit9+](#exit9) instead. **System capability**: SystemCapability.Utils.Lang +**Parameters** + +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| code | number | Yes| Exit code of the process.| + **Example** ```js -let child = process.runCmd('sleep 5; ls'); -child.close(); +process.exit(0); ``` -### kill - -kill(signal: number | string): void +## process.getUidForName(deprecated) -Sends a signal to the specified child process to terminate it. +getUidForName(v: string): number -**System API**: This is a system API. +Obtains the process UID based on the process name. -It is used only to test applications. +> **NOTE** +> +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getUidForName9+](#getuidforname9) instead. **System capability**: SystemCapability.Utils.Lang @@ -367,43 +388,63 @@ It is used only to test applications. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| signal | number \| string | Yes| Number or string to send.| +| v | string | Yes| Name of a process.| + +**Return value** + +| Type| Description| +| -------- | -------- | +| number | Process UID.| **Example** ```js -let child = process.runCmd('sleep 5; ls'); -child.kill(9); +let pres = process.getUidForName("tool") ``` -## process.isIsolatedProcess8+ +## process.getThreadPriority(deprecated) -isIsolatedProcess(): boolean +getThreadPriority(v: number): number -Checks whether this process is isolated. +Obtains the thread priority based on the specified TID. + +> **NOTE** +> +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getThreadPriority9+](#getthreadpriority9) instead. **System capability**: SystemCapability.Utils.Lang +**Parameters** + +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| v | number | Yes| TID.| + **Return value** | Type| Description| | -------- | -------- | -| boolean | Returns **true** if the process is isolated; returns **false** otherwise.| +| number | Priority of the thread.| **Example** ```js -let result = process.isIsolatedProcess(); +let tid = process.tid; +let pres = process.getThreadPriority(tid); ``` -## process.isAppUid8+ +## process.isAppUid(deprecated) isAppUid(v: number): boolean Checks whether a UID belongs to this application. +> **NOTE** +> +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [isAppUid9+](#isappuid9) instead. + **System capability**: SystemCapability.Utils.Lang **Parameters** @@ -416,7 +457,7 @@ Checks whether a UID belongs to this application. | Type| Description| | -------- | -------- | -| boolean | Returns **true** if the UID is the application's UID; returns **false** otherwise.| +| boolean | Returns **true** if the UID belongs to the application; returns **false** otherwise.| **Example** @@ -425,32 +466,47 @@ let result = process.isAppUid(688); ``` -## process.is64Bit8+ +## process.getSystemConfig(deprecated) -is64Bit(): boolean +getSystemConfig(name: number): number -Checks whether this process is running in a 64-bit environment. +Obtains the system configuration. + +> **NOTE** +> +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getSystemConfig9+](#getsystemconfig9) instead. **System capability**: SystemCapability.Utils.Lang +**Parameters** + +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| name | number | Yes| System configuration parameter name.| + **Return value** | Type| Description| | -------- | -------- | -| boolean | Returns **true** if the process is running in a 64-bit environment; returns **false** otherwise.| +| number | System configuration obtained.| **Example** ```js -let result = process.is64Bit(); +let _SC_ARG_MAX = 0 +let pres = process.getSystemConfig(_SC_ARG_MAX) ``` -## process.getUidForName8+ +## process.getEnvironmentVar(deprecated) -getUidForName(v: string): number +getEnvironmentVar(name: string): string -Obtains the process UID based on the process name. +Obtains the value of an environment variable. + +> **NOTE** +> +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getEnvironmentVar9+](#getenvironmentvar9) instead. **System capability**: SystemCapability.Utils.Lang @@ -458,26 +514,32 @@ Obtains the process UID based on the process name. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| v | string | Yes| Name of a process.| +| name | string | Yes| Environment variable name.| **Return value** | Type| Description| | -------- | -------- | -| number | Process UID.| +| string | Value of the environment variable.| **Example** ```js -let pres = process.getUidForName("tool") +let pres = process.getEnvironmentVar("PATH") ``` -## process.getThreadPriority8+ +## ProcessManager9+ + +Provides APIs for throwing exceptions during the addition of a process. + +A **ProcessManager** object is obtained through its own constructor. + +### isAppUid9+ -getThreadPriority(v: number): number +isAppUid(v: number): boolean -Obtains the thread priority based on the specified TID. +Checks whether a UID belongs to this application. **System capability**: SystemCapability.Utils.Lang @@ -485,64 +547,80 @@ Obtains the thread priority based on the specified TID. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| v | number | Yes| TID.| +| v | number | Yes| UID.| **Return value** | Type| Description| | -------- | -------- | -| number | Priority of the thread.| +| boolean | Returns **true** if the UID belongs to the application; returns **false** otherwise.| **Example** ```js -let tid = process.tid; -let pres = process.getThreadPriority(tid); +let pro = new process.ProcessManager(); +let result = pro.isAppUid(688); ``` -## process.getStartRealtime8+ +### getUidForName9+ -getStartRealtime(): number +getUidForName(v: string): number -Obtains the duration, in milliseconds, from the time the system starts to the time the process starts. +Obtains the process UID based on the process name. **System capability**: SystemCapability.Utils.Lang +**Parameters** + +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| v | string | Yes| Name of a process.| + **Return value** | Type| Description| | -------- | -------- | -| number | Duration obtained.| +| number | Process UID.| **Example** ```js -let realtime = process.getStartRealtime(); +let pro = new process.ProcessManager(); +let pres = pro .getUidForName("tool"); ``` -## process.getPastCpuTime8+ -getPastCpuTime(): number +### getThreadPriority9+ -Obtains the CPU time (in milliseconds) from the time the process starts to the current time. +getThreadPriority(v: number): number + +Obtains the thread priority based on the specified TID. **System capability**: SystemCapability.Utils.Lang +**Parameters** + +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| v | number | Yes| TID.| + **Return value** | Type| Description| | -------- | -------- | -| number | CPU time obtained.| +| number | Priority of the thread.| **Example** ```js -let result = process.getPastCpuTime() ; +let pro = new process.ProcessManager(); +let tid = process.tid; +let pres = pro.getThreadPriority(tid); ``` -## process.getSystemConfig8+ +### getSystemConfig9+ getSystemConfig(name: number): number @@ -565,12 +643,13 @@ Obtains the system configuration. **Example** ```js -let _SC_ARG_MAX = 0 -let pres = process.getSystemConfig(_SC_ARG_MAX) +let pro = new process.ProcessManager(); +let _SC_ARG_MAX = 0; +let pres = pro.getSystemConfig(_SC_ARG_MAX); ``` -## process.getEnvironmentVar8+ +### getEnvironmentVar9+ getEnvironmentVar(name: string): string @@ -593,19 +672,18 @@ Obtains the value of an environment variable. **Example** ```js -let pres = process.getEnvironmentVar("PATH") +let pro = new process.ProcessManager(); +let pres = pro.getEnvironmentVar("PATH"); ``` -## process.runCmd - -runCmd(command: string, options?: { timeout?: number, killSignal?: number | string, maxBuffer?: number }): ChildProcess +### exit9+ -Forks a new process to run a shell command and returns the **ChildProcess** object. +exit(code: number): void -**System API**: This is a system API. +Terminates this process. -It is used only to test applications. +Exercise caution when using this API. After this API is called, the application exits. If the input parameter is not 0, data loss or exceptions may occur. **System capability**: SystemCapability.Utils.Lang @@ -613,54 +691,71 @@ It is used only to test applications. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| command | string | Yes| Shell command to run.| -| options | Object | No| Related parameters.| +| code | number | Yes| Exit code of the process.| -**Table 1** options +**Example** + +```js +let pro = new process.ProcessManager(); +pro.exit(0); +``` + + +### kill9+ + +kill(signal: number, pid: number): boolean + +Sends a signal to the specified process to terminate it. + +**System capability**: SystemCapability.Utils.Lang + +**Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| timeout | number | No| Maximum running time (in ms) of the child process. When the running time of the child process exceeds the value of this parameter, the parent process sends a **killSignal** to the child process to terminate it. The default value is **0**.| -| killSignal | number \| string | No| Signal sent to the child process when the running time of a child process exceeds the timeout period. The default value is **SIGTERM**.| -| maxBuffer | number | No| Maximum buffer size for the standard input and output of the child process. When the size is exceeded, the child process will be terminated. The default value is **1024 \* 1024**.| +| pid | number | Yes| PID of the process, to which the signal will be sent.| +| signal | number | Yes| Signal to send.| **Return value** | Type| Description| | -------- | -------- | -| [ChildProcess](#childprocess) | **ChildProcess** object.| +| boolean | Returns **true** if the signal is sent successfully; returns **false** otherwise.| **Example** ```js -let child = process.runCmd('ls', { maxBuffer : 2 }); -let result = child.wait(); -child.getOutput.then(val=>{ - console.log("child.getOutput = " + val); -}) +let pro = new process.ProcessManager(); +let pres = process.pid; +let result = pro.kill(28, pres); ``` -## process.abort +## ChildProcess -abort(): void +The **ChildProcess** object is a new child process and can be obtained by calling [process.runCmd](#processruncmd). The main process can obtain the standard input and output of the child process, send signals to the child process, and close the child process. -Aborts a process and generates a core file. This method will cause a process to exit immediately. Exercise caution when using this method. +**System API**: This is a system API. -**System capability**: SystemCapability.Utils.Lang +### Attributes -**Example** +**System API**: This is a system API. -```js -process.abort(); -``` +**System capability**: SystemCapability.Utils.Lang + +| Name| Type| Readable| Writable| Description| +| -------- | -------- | -------- | -------- | -------- | +| pid | number | Yes| No| PID of the child process.
**System API**: This is a system API.
It is used only to test applications.| +| ppid | number | Yes| No| PPID of the child process.
**System API**: This is a system API.
It is used only to test applications.| +| exitCode | number | Yes| No| Exit code of the child process.
**System API**: This is a system API.
It is used only to test applications.| +| killed | boolean | Yes| No| Whether the parent process successfully sends a signal to the child process to terminate it.
**System API**: This is a system API.
It is used only to test applications.| -## process.on +### wait -on(type: string, listener: EventListener): void +wait(): Promise<number> -Stores the events triggered by the user. +Waits until the child process ends. This method uses a promise to return the exit code of the child process. **System API**: This is a system API. @@ -668,33 +763,28 @@ It is used only to test applications. **System capability**: SystemCapability.Utils.Lang -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Type of the events to store. | -| listener | EventListener | Yes| Callback invoked to return the event.| - -**Table 2** EventListener +**Return value** -| Name| Description| +| Type| Description| | -------- | -------- | -| EventListener = (evt:  Object) => void | Event to store.| +| Promise<number> | Promise used to return the exit code of the child process.| **Example** ```js -process.on("data", (e)=>{ - console.log("data callback"); +let child = process.runCmd('ls'); +let result = child.wait(); +result.then(val=>{ + console.log("result = " + val); }) ``` -## process.off +### getOutput -off(type: string): boolean +getOutput(): Promise<Uint8Array> -Deletes the event stored by the user. +Obtains the standard output of the child process. **System API**: This is a system API. @@ -702,56 +792,57 @@ It is used only to test applications. **System capability**: SystemCapability.Utils.Lang -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Type of the event to delete.| - **Return value** | Type| Description| | -------- | -------- | -| boolean | Returns **true** if the event is deleted; returns **false** otherwise.| +| Promise<Uint8Array> | Promise used to return the standard output in a Uint8Array.| **Example** ```js -process.on("data", (e)=>{ - console.log("data callback"); +let child = process.runCmd('ls'); +let result = child.wait(); +child.getOutput().then(val=>{ + console.log("child.getOutput = " + val); }) -let result = process.off("data"); ``` -## process.exit +### getErrorOutput -exit(code: number): void +getErrorOutput(): Promise<Uint8Array> -Terminates this process. +Obtains the standard error output of the child process. + +**System API**: This is a system API. -Exercise caution when using this API. +It is used only to test applications. **System capability**: SystemCapability.Utils.Lang -**Parameters** +**Return value** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| code | number | Yes| Exit code of the process.| +| Type| Description| +| -------- | -------- | +| Promise<Uint8Array> | Promise used to return the standard error output in a Uint8Array.| **Example** ```js -process.exit(0); +let child = process.runCmd('madir test.text'); +let result = child.wait(); +child.getErrorOutput().then(val=>{ + console.log("child.getErrorOutput= " + val); +}) ``` -## process.cwd +### close -cwd(): string +close(): void -Obtains the working directory of this process. +Closes the child process in running. **System API**: This is a system API. @@ -762,15 +853,16 @@ It is used only to test applications. **Example** ```js -let path = process.cwd(); +let child = process.runCmd('sleep 5; ls'); +child.close(); ``` -## process.chdir +### kill -chdir(dir: string): void +kill(signal: number | string): void -Changes the working directory of this process. +Sends a signal to the specified child process to terminate it. **System API**: This is a system API. @@ -782,60 +874,11 @@ It is used only to test applications. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| dir | string | Yes| Path| - -**Example** - -```js -process.chdir('/system'); -``` - - -## process.uptime - -uptime(): number - -Obtains the running time of this process. - -**System capability**: SystemCapability.Utils.Lang - -**Return value** - -| Type| Description| -| -------- | -------- | -| number | Running time of the process, in seconds.| - -**Example** - -```js -let time = process.uptime(); -``` - - -## process.kill - -kill(signal: number, pid: number): boolean - -Sends a signal to the specified process to terminate it. - -**System capability**: SystemCapability.Utils.Lang - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| pid | number | Yes| PID of the process, to which the signal will be sent.| -| signal | number | Yes| Signal to send.| - -**Return value** - -| Type| Description| -| -------- | -------- | -| boolean | Returns **true** if the signal is sent successfully; returns **false** otherwise.| +| signal | number \| string | Yes| Number or string to send.| **Example** ```js -let pres = process.pid -let result = process.kill(28, pres) +let child = process.runCmd('sleep 5; ls'); +child.kill(9); ``` diff --git a/en/application-dev/reference/apis/js-apis-queue.md b/en/application-dev/reference/apis/js-apis-queue.md index e4adf559e862ddc954b7e75c3253fb8aa95b6b2a..56bb71d5b88e93c2364c23176543f131d134e9f2 100644 --- a/en/application-dev/reference/apis/js-apis-queue.md +++ b/en/application-dev/reference/apis/js-apis-queue.md @@ -201,7 +201,7 @@ queue.add(4); queue.add(5); queue.add(4); queue.forEach((value, index) => { - console.log("value:" + value, index); + console.log("value:" + value, "index:" + index); }); ``` diff --git a/en/application-dev/reference/apis/js-apis-radio.md b/en/application-dev/reference/apis/js-apis-radio.md index ea662f7df4300bcc4bcad7be9391357896b74a8a..3902bb89800ffa1e043ea3a51690c92dc52b1511 100644 --- a/en/application-dev/reference/apis/js-apis-radio.md +++ b/en/application-dev/reference/apis/js-apis-radio.md @@ -30,6 +30,18 @@ Obtains the RAT used in the CS and PS domains for the SIM card in the specified | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback\<{psRadioTech: [RadioTechnology](#radiotechnology), csRadioTech:[RadioTechnology](#radiotechnology)}\> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -62,6 +74,18 @@ Obtains the RAT used in the CS and PS domains for the SIM card in the specified | ------------------------------------------------------------ | ----------------------------------------------- | | Promise<{psRadioTech: [RadioTechnology](#radiotechnology), csRadioTech: [RadioTechnology](#radiotechnology)}> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -91,6 +115,18 @@ Obtains the network status. This API uses an asynchronous callback to return the | -------- | ---------------------------------------------- | ---- | ---------- | | callback | AsyncCallback\<[NetworkState](#networkstate)\> | Yes | Callback used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -117,6 +153,18 @@ Obtains the network status. This API uses an asynchronous callback to return the | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback\<[NetworkState](#networkstate)\> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -149,6 +197,18 @@ Obtains the network status. This API uses a promise to return the result. | ---------------------------------------- | --------------------------- | | Promise\<[NetworkState](#networkstate)\> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -177,6 +237,17 @@ Obtains the network selection mode of the SIM card in the specified slot. This A | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback\<[NetworkSelectionMode](#networkselectionmode)\> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -207,6 +278,17 @@ Obtains the network selection mode of the SIM card in the specified slot. This A | -------------------------------------------------------- | ------------------------------- | | Promise\<[NetworkSelectionMode](#networkselectionmode)\> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -235,6 +317,17 @@ Obtains the ISO country code of the network with which the SIM card in the speci | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | | callback | AsyncCallback\ | Yes | Callback used to return the result, which is an ISO country code, for example, **CN** (China).| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -265,6 +358,17 @@ Obtains the ISO country code of the network with which the SIM card in the speci | ----------------- | ------------------------------------------------------------ | | Promise\ | Promise used to return the result, which is an ISO country code, for example, **CN** (China).| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -292,6 +396,17 @@ Obtains the ID of the slot in which the primary card is located. This API uses a | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | callback | AsyncCallback\ | Yes | Callback invoked to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -315,6 +430,17 @@ Obtains the ID of the slot in which the primary card is located. This API uses a | ----------------------------------------------------------- | ------------------------------------------------------------ | | Promise\ | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -342,6 +468,17 @@ Obtains a list of signal strengths of the network with which the SIM card in the | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | | callback | AsyncCallback\\> | Yes | Callback used to return the result, which is a list of [SignalInformation](#signalinformation) objects.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -372,6 +509,17 @@ Obtains a list of signal strengths of the network with which the SIM card in the | ----------------------------------------------------------- | ------------------------------------------------------------ | | Promise\\> | Promise used to return the result, which is a list of [SignalInformation](#signalinformation) objects.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -509,6 +657,18 @@ Checks whether the radio service is enabled on the primary SIM card. This API us | -------- | ------------------------ | ---- | ------------------------------------------------------- | | callback | AsyncCallback\ | Yes | Callback used to return the result.
- **true**: The radio service is enabled.
- **false**: The radio service is disabled.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -535,6 +695,18 @@ Checks whether the radio service is enabled on the SIM card in the specified slo | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | | callback | AsyncCallback\ | Yes | Callback used to return the result.
- **true**: The radio service is enabled.
- **false**: The radio service is disabled.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -567,6 +739,18 @@ Checks whether the radio service is enabled on the SIM card in the specified slo | ------------------ | ------------------------------------------------------------ | | Promise\ | Promise used to return the result.
- **true**: The radio service is enabled.
- **false**: The radio service is disabled.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -595,6 +779,17 @@ Obtains the carrier name for the SIM card in the specified slot. This API uses a | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | | callback | AsyncCallback\ | Yes | Callback used to return the result, which is the carrier name, for example, China Mobile.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -625,6 +820,17 @@ Obtains the carrier name for the SIM card in the specified slot. This API uses a | ----------------- | ------------------------------------------------------------ | | Promise\ | Promise used t return the result, which is the carrier name, for example, China Mobile. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -656,6 +862,19 @@ Sets the ID of the slot in which the primary card is located. This API uses an a | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback\ | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -690,6 +909,19 @@ Sets the ID of the slot in which the primary card is located. This API uses a pr | --------------- | ------------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -720,6 +952,18 @@ Obtains the IMEI of the SIM card in a card slot. This API uses an asynchronous c | -------- | ----------------------- | ---- | ------------------------------------------ | | callback | AsyncCallback\ | Yes | Callback used to return the result. If the IMEI does not exist, an empty string is returned.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -748,6 +992,18 @@ Obtains the IMEI of the SIM card in the specified card slot. This API uses an as | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | | callback | AsyncCallback\ | Yes | Callback used to return the result. If the IMEI does not exist, an empty string is returned.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -782,6 +1038,18 @@ Obtains the IMEI of the SIM card in the specified card slot. This API uses a pro | ----------------- | ------------------------------------------ | | Promise\ | Promise used to return the result. If the IMEI does not exist, an empty string is returned.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -812,6 +1080,18 @@ Obtains the MEID of the SIM card in a card slot. This API uses an asynchronous c | -------- | ----------------------- | ---- | ---------- | | callback | AsyncCallback\ | Yes | Callback used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -840,6 +1120,18 @@ Obtains the MEID of the SIM card in the specified card slot. This API uses an as | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback\ | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -874,6 +1166,18 @@ Obtains the MEID of the SIM card in the specified card slot. This API uses a pro | ----------------- | --------------------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -904,6 +1208,18 @@ Obtains the unique device ID of the SIM card in a card slot. This API uses an as | -------- | ----------------------- | ---- | ---------- | | callback | AsyncCallback\ | Yes | Callback used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -932,6 +1248,18 @@ Obtains the unique device ID of the SIM card in the specified card slot. This AP | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback\ | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -966,6 +1294,18 @@ Obtains the unique device ID of the SIM card in the specified card slot. This AP | ----------------- | --------------------------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -996,6 +1336,18 @@ Sends a cell location update request. This API uses an asynchronous callback to | -------- | --------------------- | ---- | ---------- | | callback | AsyncCallback\ | Yes | Callback used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1023,6 +1375,18 @@ Sends a cell location update request for the SIM card in the specified slot. Thi | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback\ | Yes | Callback used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1056,6 +1420,18 @@ Sends a cell location update request for the SIM card in the specified slot. Thi | --------------- | ----------------------- | | Promise\ | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1086,6 +1462,18 @@ Obtains cell information. This API uses an asynchronous callback to return the r | -------- | ------------------------------------------------------------ | ---- | ------------------------ | | callback | AsyncCallback\\> | Yes | Callback used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1114,6 +1502,18 @@ Obtains cell information for the SIM card in the specified slot. This API uses a | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback\\> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1148,6 +1548,18 @@ Obtains cell information for the SIM card in the specified slot. This API uses a | ------------------------------------------------------- | ----------------------- | | Promise\\> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1179,6 +1591,18 @@ Sets the network selection mode. This API uses an asynchronous callback to retur | options | [NetworkSelectionModeOptions](#networkselectionmodeoptions) | Yes | Network selection mode.| | callback | AsyncCallback\ | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1223,6 +1647,18 @@ Sets the network selection mode. This API uses a promise to return the result. | --------------- | ----------------------- | | Promise\ | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1265,6 +1701,18 @@ Obtains network search information for the SIM card in the specified slot. This | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback\<[NetworkSearchResult](#networksearchresult)\> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1297,6 +1745,18 @@ Obtains network search information for the SIM card in the specified slot. This | ------------------------------------------------------ | ----------------------- | | Promise\<[NetworkSearchResult](#networksearchresult)\> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1324,6 +1784,17 @@ Obtains the NR option mode. This API uses an asynchronous callback to return the | -------- | ----------------------------------------------- | ---- | ---------- | | callback | AsyncCallback\<[NrOptionMode](#nroptionmode8)\> | Yes | Callback used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1350,6 +1821,17 @@ Obtains the NR option mode for the SIM card in the specified slot. This API uses | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback\<[NrOptionMode](#nroptionmode8)\> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1382,6 +1864,17 @@ Obtains the NR option mode for the SIM card in the specified slot. This API uses | ----------------------------------------- | ----------------------- | | Promise\<[NrOptionMode](#nroptionmode8)\> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1412,6 +1905,18 @@ Turns on the radio function. This API uses an asynchronous callback to return th | -------- | --------------------- | ---- | ---------- | | callback | AsyncCallback\ | Yes | Callback used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1440,6 +1945,18 @@ Turns on the radio function for the SIM card in the specified slot. This API use | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback\ | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1474,6 +1991,18 @@ Turns on the radio function for the SIM card in the specified slot. This API use | --------------- | ----------------------- | | Promise\ | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1504,6 +2033,18 @@ Turns off the radio function. This API uses an asynchronous callback to return t | -------- | --------------------- | ---- | ---------- | | callback | AsyncCallback\ | Yes | Callback used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1532,6 +2073,18 @@ Turns off the radio function for the SIM card in the specified slot. This API us | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback\ | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1566,6 +2119,18 @@ Turns off the radio function for the SIM card in the specified slot. This API us | --------------- | ----------------------- | | Promise\ | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1598,6 +2163,18 @@ Sets the preferred network for the SIM card in the specified slot. This API uses | networkMode | [PreferredNetworkMode](#preferrednetworkmode8) | Yes | Preferred network mode. | | callback | AsyncCallback\ | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1631,6 +2208,18 @@ Sets the preferred network for the SIM card in the specified slot. This API uses | --------------- | ----------------------- | | Promise\ | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1656,11 +2245,23 @@ Obtains the preferred network for the SIM card in the specified slot. This API u **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ------------------------------------------------------------ | ---- | -------------------------------------- | -| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------------------------------- | ---- | -------------------------------------- | +| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback\<[PreferredNetworkMode](#preferrednetworkmode8)\> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1693,6 +2294,18 @@ Obtains the preferred network for the SIM card in the specified slot. This API u | --------------- | ----------------------- | | Promise\ | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1724,6 +2337,18 @@ Obtains the IMS registration status of the specified IMS service type for the SI | imsType | [ImsServiceType](#imsservicetype9) | Yes | IMS service type. | | callback | AsyncCallback<[ImsRegInfo](#imsreginfo9)\> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1757,6 +2382,18 @@ Obtains the IMS registration status of the specified IMS service type for the SI | ------------------------------------- | ----------------------- | | Promise\<[ImsRegInfo](#imsreginfo9)\> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1789,6 +2426,18 @@ Enables listening for **imsRegStateChange** events. This API uses an asynchronou | imsType | [ImsServiceType](#imsservicetype9) | Yes | IMS service type. | | callback | Callback<[ImsRegInfo](#imsreginfo9)> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1818,6 +2467,18 @@ Disables listening for **imsRegStateChange** events. This API uses an asynchrono | imsType | [ImsServiceType](#imsservicetype9) | Yes | IMS service type. | | callback | Callback<[ImsRegInfo](#imsreginfo9)> | No | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1855,11 +2516,11 @@ Defines the signal strength. **System capability**: SystemCapability.Telephony.CoreService -| Name | Type | Mandatory| Description | -| ----------- | --------------------------- | ---- | ----------------- | -| signalType | [NetworkType](#networktype) | Yes | Signal strength type.| -| signalLevel | number | Yes | Signal strength level.| - +| Name | Type | Mandatory| Description | +| --------------- | --------------------------- | ---- | ------------------ | +| signalType | [NetworkType](#networktype) | Yes | Signal strength type.| +| signalLevel | number | Yes | Signal strength level.| +| dBm9+| number | Yes | Signal strength, in dBm. | ## NetworkType diff --git a/en/application-dev/reference/apis/js-apis-reminderAgentManager.md b/en/application-dev/reference/apis/js-apis-reminderAgentManager.md index f443c028e40072e8b402f93b54be1e9ecfdc0842..36f2e4957980fd01e010d6dd5a0fb27813c6d046 100644 --- a/en/application-dev/reference/apis/js-apis-reminderAgentManager.md +++ b/en/application-dev/reference/apis/js-apis-reminderAgentManager.md @@ -1,4 +1,4 @@ -# @ohos.reminderAgentManager (Reminder Agent Management) +# @ohos.reminderAgentManager (reminderAgentManager) The **reminderAgentManager** module provides APIs for publishing scheduled reminders through the reminder agent. @@ -11,16 +11,14 @@ You can use the APIs to create scheduled reminders for countdown timers, calenda ## Modules to Import -```ts +``` import reminderAgentManager from'@ohos.reminderAgentManager'; ``` ## reminderAgentManager.publishReminder -```ts -publishReminder(reminderReq: ReminderRequest, callback: AsyncCallback): void -``` +publishReminder(reminderReq: ReminderRequest, callback: AsyncCallback<number>): void Publishes a reminder through the reminder agent. This API uses an asynchronous callback to return the result. It can be called only when notification is enabled for the application through [Notification.requestEnableNotification](js-apis-notification.md#notificationrequestenablenotification8). @@ -33,7 +31,7 @@ Publishes a reminder through the reminder agent. This API uses an asynchronous c | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | reminderReq | [ReminderRequest](#reminderrequest) | Yes| Reminder to be published.| - | callback | AsyncCallback\ | Yes| Callback used to return the published reminder's ID.| + | callback | AsyncCallback<number> | Yes| Callback used to return the published reminder's ID.| **Error codes** @@ -45,12 +43,11 @@ For details about the error codes, see [reminderAgentManager Error Codes](../err | 1700002 | The number of reminders exceeds the limit. | **Example** -```ts +```js let timer = { reminderType: reminderAgentManager.ReminderType.REMINDER_TYPE_TIMER, triggerTimeInSeconds: 10 } - try { reminderAgentManager.publishReminder(timer, (err, reminderId) => { if (err) { @@ -67,9 +64,7 @@ try { ## reminderAgentManager.publishReminder -```ts -publishReminder(reminderReq: ReminderRequest): Promise -``` +publishReminder(reminderReq: ReminderRequest): Promise<number> Publishes a reminder through the reminder agent. This API uses a promise to return the result. It can be called only when notification is enabled for the application through [Notification.requestEnableNotification](js-apis-notification.md#notificationrequestenablenotification8). @@ -85,7 +80,7 @@ Publishes a reminder through the reminder agent. This API uses a promise to retu **Return value** | Type| Description| | -------- | -------- | - | Promise\ | Promise used to return the published reminder's ID.| + | Promise<number> | Promise used to return the published reminder's ID.| **Error codes** @@ -97,12 +92,11 @@ For details about the error codes, see [reminderAgentManager Error Codes](../err | 1700002 | The number of reminders exceeds the limit. | **Example** -```ts +```js let timer = { reminderType: reminderAgentManager.ReminderType.REMINDER_TYPE_TIMER, triggerTimeInSeconds: 10 } - try { reminderAgentManager.publishReminder(timer).then((reminderId) => { console.log("promise, reminderId = " + reminderId); @@ -117,9 +111,7 @@ try { ## reminderAgentManager.cancelReminder -```ts -cancelReminder(reminderId: number, callback: AsyncCallback): void -``` +cancelReminder(reminderId: number, callback: AsyncCallback<void>): void Cancels the reminder with the specified ID. This API uses an asynchronous callback to return the cancellation result. @@ -130,7 +122,7 @@ Cancels the reminder with the specified ID. This API uses an asynchronous callba | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | reminderId | number | Yes| ID of the reminder to cancel.| -| callback | AsyncCallback\ | Yes| Asynchronous callback used to return the result.| +| callback | AsyncCallback<void> | Yes| Asynchronous callback used to return the result.| **Error codes** @@ -143,7 +135,7 @@ For details about the error codes, see [reminderAgentManager Error Codes](../err **Example** -```ts +```js try { reminderAgentManager.cancelReminder(1, (err, data) => { if (err) { @@ -160,9 +152,7 @@ try { ## reminderAgentManager.cancelReminder -```ts -cancelReminder(reminderId: number): Promise -``` +cancelReminder(reminderId: number): Promise<void> Cancels the reminder with the specified ID. This API uses a promise to return the cancellation result. @@ -178,7 +168,7 @@ Cancels the reminder with the specified ID. This API uses a promise to return th | Type| Description| | -------- | -------- | -| Promise\ | Promise used to return the result.| +| Promise<void> | Promise used to return the result.| **Error codes** @@ -191,7 +181,7 @@ For details about the error codes, see [reminderAgentManager Error Codes](../err **Example** -```ts +```js try { reminderAgentManager.cancelReminder(1).then(() => { console.log("cancelReminder promise"); @@ -203,12 +193,10 @@ try { }; ``` -## reminderAgentManager.getValidReminders -```ts -getValidReminders(callback: AsyncCallback>): void +## reminderAgentManager.getValidReminders -``` +getValidReminders(callback: AsyncCallback<Array<ReminderRequest>>): void Obtains all valid (not yet expired) reminders set by the current application. This API uses an asynchronous callback to return the reminders. @@ -218,7 +206,7 @@ Obtains all valid (not yet expired) reminders set by the current application. Th | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| callback | AsyncCallback\\> | Yes| Asynchronous callback used to return an array of all valid reminders set by the current application.| +| callback | AsyncCallback<Array<[ReminderRequest](#reminderrequest)>> | Yes| Asynchronous callback used to return an array of all valid reminders set by the current application.| **Error codes** @@ -230,7 +218,7 @@ For details about the error codes, see [reminderAgentManager Error Codes](../err **Example** -```ts +```js try { reminderAgentManager.getValidReminders((err, reminders) => { if (err) { @@ -265,11 +253,10 @@ try { }; ``` + ## reminderAgentManager.getValidReminders -```ts -getValidReminders(): Promise> -``` +getValidReminders(): Promise<Array<ReminderRequest>> Obtains all valid (not yet expired) reminders set by the current application. This API uses a promise to return the reminders. @@ -279,7 +266,7 @@ Obtains all valid (not yet expired) reminders set by the current application. Th | Type| Description| | -------- | -------- | -| Promise\\> | Promise used to return an array of all valid reminders set by the current application.| +| Promise<Array<[ReminderRequest](#reminderrequest)>> | Promise used to return an array of all valid reminders set by the current application.| **Error codes** @@ -291,7 +278,7 @@ For details about the error codes, see [reminderAgentManager Error Codes](../err **Example** -```ts +```js try { reminderAgentManager.getValidReminders().then((reminders) => { console.log("promise, getValidReminders length = " + reminders.length); @@ -327,9 +314,7 @@ try { ## reminderAgentManager.cancelAllReminders -```ts -cancelAllReminders(callback: AsyncCallback): void -``` +cancelAllReminders(callback: AsyncCallback<void>): void Cancels all reminders set by the current application. This API uses an asynchronous callback to return the cancellation result. @@ -339,7 +324,7 @@ Cancels all reminders set by the current application. This API uses an asynchron | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| callback | AsyncCallback\ | Yes| Asynchronous callback used to return the result.| +| callback | AsyncCallback<void> | Yes| Asynchronous callback used to return the result.| **Error codes** @@ -351,7 +336,7 @@ For details about the error codes, see [reminderAgentManager Error Codes](../err **Example** -```ts +```js try { reminderAgentManager.cancelAllReminders((err, data) =>{ if (err) { @@ -368,9 +353,7 @@ try { ## reminderAgentManager.cancelAllReminders -```ts -cancelAllReminders(): Promise -``` +cancelAllReminders(): Promise<void> Cancels all reminders set by the current application. This API uses a promise to return the cancellation result. @@ -380,7 +363,7 @@ Cancels all reminders set by the current application. This API uses a promise to | Type| Description| | -------- | -------- | -| Promise\ | Promise used to return the result.| +| Promise<void> | Promise used to return the result.| **Error codes** @@ -392,7 +375,7 @@ For details about the error codes, see [reminderAgentManager Error Codes](../err **Example** -```ts +```js try { reminderAgentManager.cancelAllReminders().then(() => { console.log("cancelAllReminders promise") @@ -407,9 +390,7 @@ try { ## reminderAgentManager.addNotificationSlot -```ts -addNotificationSlot(slot: NotificationSlot, callback: AsyncCallback): void -``` +addNotificationSlot(slot: NotificationSlot, callback: AsyncCallback<void>): void Adds a notification slot. This API uses an asynchronous callback to return the result. @@ -420,11 +401,11 @@ Adds a notification slot. This API uses an asynchronous callback to return the r | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | slot | [NotificationSlot](js-apis-notification.md#notificationslot) | Yes| Notification slot, whose type can be set.| -| callback | AsyncCallback\ | Yes| Asynchronous callback used to return the result.| +| callback | AsyncCallback<void> | Yes| Asynchronous callback used to return the result.| **Example** -```ts +```js import notification from '@ohos.notification' let mySlot = { @@ -446,9 +427,7 @@ try { ## reminderAgentManager.addNotificationSlot -```ts -addNotificationSlot(slot: NotificationSlot): Promise -``` +addNotificationSlot(slot: NotificationSlot): Promise<void> Adds a notification slot. This API uses a promise to return the result. @@ -464,11 +443,11 @@ Adds a notification slot. This API uses a promise to return the result. | Type| Description| | -------- | -------- | -| Promise\ | Promise used to return the result.| +| Promise<void> | Promise used to return the result.| **Example** -```ts +```js import notification from '@ohos.notification' let mySlot = { @@ -488,9 +467,7 @@ try { ## reminderAgentManager.removeNotificationSlot -```ts -removeNotificationSlot(slotType: notification.SlotType, callback: AsyncCallback): void -``` +removeNotificationSlot(slotType: notification.SlotType, callback: AsyncCallback<void>): void Removes a notification slot of a specified type. This API uses an asynchronous callback to return the result. @@ -501,11 +478,11 @@ Removes a notification slot of a specified type. This API uses an asynchronous c | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | slotType | [notification.SlotType](js-apis-notification.md#slottype) | Yes| Type of the notification slot to remove.| -| callback | AsyncCallback\ | Yes| Asynchronous callback used to return the result.| +| callback | AsyncCallback<void> | Yes| Asynchronous callback used to return the result.| **Example** -```ts +```js import notification from '@ohos.notification' try { @@ -524,9 +501,7 @@ try { ## reminderAgentManager.removeNotificationSlot -```ts -removeNotificationSlot(slotType: notification.SlotType): Promise -``` +removeNotificationSlot(slotType: notification.SlotType): Promise<void> Removes a notification slot of a specified type. This API uses a promise to return the result. @@ -542,11 +517,11 @@ Removes a notification slot of a specified type. This API uses a promise to retu | Type| Description| | -------- | -------- | -| Promise\ | Promise used to return the result.| +| Promise<void> | Promise used to return the result.| **Example** -```ts +```js import notification from '@ohos.notification' try { @@ -655,8 +630,8 @@ Defines a reminder for a calendar event. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | dateTime | [LocalDateTime](#localdatetime) | Yes| Reminder time.| -| repeatMonths | Array\ | No| Month in which the reminder repeats.| -| repeatDays | Array\ | No| Date on which the reminder repeats.| +| repeatMonths | Array<number> | No| Month in which the reminder repeats.| +| repeatDays | Array<number> | No| Date on which the reminder repeats.| ## ReminderRequestAlarm @@ -671,7 +646,7 @@ Defines a reminder for an alarm. | -------- | -------- | -------- | -------- | | hour | number | Yes| Hour portion of the reminder time.| | minute | number | Yes| Minute portion of the reminder time.| -| daysOfWeek | Array\ | No| Days of a week when the reminder repeats. The value ranges from 1 to 7, corresponding to the data from Monday to Sunday.| +| daysOfWeek | Array<number> | No| Days of a week when the reminder repeats. The value ranges from 1 to 7, corresponding to the data from Monday to Sunday.| ## ReminderRequestTimer @@ -696,8 +671,8 @@ Sets the time information for a calendar reminder. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | year | number | Yes| Year.| -| month | number | Yes| Month.| -| day | number | Yes| Date.| -| hour | number | Yes| Hour.| -| minute | number | Yes| Minute.| -| second | number | No| Second.| +| month | number | Yes| Month. The value ranges from 1 to 12.| +| day | number | Yes| Day. The value ranges from 1 to 31.| +| hour | number | Yes| Hour. The value ranges from 0 to 23.| +| minute | number | Yes| Minute. The value ranges from 0 to 59.| +| second | number | No| Second. The value ranges from 0 to 59.| diff --git a/en/application-dev/reference/apis/js-apis-resourceschedule-deviceUsageStatistics.md b/en/application-dev/reference/apis/js-apis-resourceschedule-deviceUsageStatistics.md index 1e243a9881594c4acf692110cfe2a2e7a363b945..ce6daa95dc50c55f328eec71d8911f5024a2e6b7 100644 --- a/en/application-dev/reference/apis/js-apis-resourceschedule-deviceUsageStatistics.md +++ b/en/application-dev/reference/apis/js-apis-resourceschedule-deviceUsageStatistics.md @@ -35,8 +35,12 @@ isIdleState(bundleName: string, callback: AsyncCallback<boolean>): void Checks whether the application specified by **bundleName** is in the idle state. This API uses an asynchronous callback to return the result. A third-party application can only check the idle status of itself. +**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO + **System capability**: SystemCapability.ResourceSchedule.UsageStatistics.AppGroup +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory | Description | @@ -53,8 +57,8 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000006 | Get application info failed. | +| 10000004 | IPC failed. | +| 10000006 | Failed to get the application information. | **Example** ```js @@ -77,8 +81,12 @@ isIdleState(bundleName: string): Promise<boolean> Checks whether the application specified by **bundleName** is in the idle state. This API uses a promise to return the result. A third-party application can only check the idle status of itself. +**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO + **System capability**: SystemCapability.ResourceSchedule.UsageStatistics.AppGroup +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory | Description | @@ -100,8 +108,8 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000006 | Get application info failed. | +| 10000004 | IPC failed. | +| 10000006 | Failed to get the application information. | **Example** @@ -140,10 +148,10 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000005 | Application is not installed. | -| 10000006 | Get application info failed. | -| 10100002 | Get Application group info failed. | +| 10000004 | IPC failed. | +| 10000005 | Application is not installed. | +| 10000006 | Failed to get the application information. | +| 10100002 | Failed to get the application group information. | **Example** @@ -182,10 +190,10 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000005 | Application is not installed. | -| 10000006 | Get application info failed. | -| 10100002 | Get Application group info failed. | +| 10000004 | IPC failed. | +| 10000005 | Application is not installed. | +| 10000006 | Failed to get the application information. | +| 10100002 | Failed to get the application group information. | **Example** @@ -232,9 +240,9 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000006 | Get application info failed. | -| 10000007 | Get system or actual time failed. | +| 10000004 | IPC failed. | +| 10000006 | Failed to get the application information. | +| 10000007 | Failed to get the system time. | **Example** @@ -292,9 +300,9 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000006 | Get application info failed. | -| 10000007 | Get system or actual time failed. | +| 10000004 | IPC failed. | +| 10000006 | Failed to get the application information. | +| 10000007 | Failed to get the system time. | **Example** @@ -346,9 +354,9 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000006 | Get application info failed. | -| 10000007 | Get system or actual time failed. | +| 10000004 | IPC failed. | +| 10000006 | Failed to get the application information. | +| 10000007 | Failed to get the system time. | **Example** @@ -405,9 +413,9 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000006 | Get application info failed. | -| 10000007 | Get system or actual time failed. | +| 10000004 | IPC failed. | +| 10000006 | Failed to get the application information. | +| 10000007 | Failed to get the system time. | **Example** @@ -456,9 +464,9 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000006 | Get application info failed. | -| 10000007 | Get system or actual time failed. | +| 10000004 | IPC failed. | +| 10000006 | Failed to get the application information. | +| 10000007 | Failed to get the system time. | **Example** @@ -514,9 +522,9 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000006 | Get application info failed. | -| 10000007 | Get system or actual time failed. | +| 10000004 | IPC failed. | +| 10000006 | Failed to get the application information. | +| 10000007 | Failed to get the system time. | **Example** @@ -561,9 +569,9 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000006 | Get application info failed. | -| 10000007 | Get system or actual time failed. | +| 10000004 | IPC failed. | +| 10000006 | Failed to get the application information. | +| 10000007 | Failed to get the system time. | **Example** @@ -615,9 +623,9 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000006 | Get application info failed. | -| 10000007 | Get system or actual time failed. | +| 10000004 | IPC failed. | +| 10000006 | Failed to get the application information. | +| 10000007 | Failed to get the system time. | **Example** @@ -664,9 +672,9 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000006 | Get application info failed. | -| 10000007 | Get system or actual time failed. | +| 10000004 | IPC failed. | +| 10000006 | Failed to get the application information. | +| 10000007 | Failed to get the system time. | **Example** @@ -714,9 +722,9 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000006 | Get application info failed. | -| 10000007 | Get system or actual time failed. | +| 10000004 | IPC failed. | +| 10000006 | Failed to get the application information. | +| 10000007 | Failed to get the system time. | **Example** @@ -771,9 +779,9 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000006 | Get application info failed. | -| 10000007 | Get system or actual time failed. | +| 10000004 | IPC failed. | +| 10000006 | Failed to get the application information. | +| 10000007 | Failed to get the system time. | **Example** @@ -821,9 +829,9 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000006 | Get application info failed. | -| 10000007 | Get system or actual time failed. | +| 10000004 | IPC failed. | +| 10000006 | Failed to get the application information. | +| 10000007 | Failed to get the system time. | **Example** @@ -878,10 +886,10 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | +| 10000004 | IPC failed. | | 10000005 | Application is not installed. | -| 10000006 | Get application info failed. | -| 10100002 | Get Application group info failed. | +| 10000006 | Failed to get the application information. | +| 10100002 | Failed to get the application group information. | **Example** @@ -927,10 +935,10 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | +| 10000004 | IPC failed. | | 10000005 | Application is not installed. | -| 10000006 | Get application info failed. | -| 10100002 | Get Application group info failed. | +| 10000006 | Failed to get the application information. | +| 10100002 | Failed to get the application group information. | **Example** @@ -977,9 +985,9 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000006 | Get application info failed. | -| 10100001 | Application group operation repeated. | +| 10000004 | IPC failed. | +| 10000006 | Failed to get the application information. | +| 10100001 | Repeated operation on the application group. | **Return value** @@ -1033,9 +1041,9 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000006 | Get application info failed. | -| 10100001 | Application group operation repeated. | +| 10000004 | IPC failed. | +| 10000006 | Failed to get the application information. | +| 10100001 | Repeated operation on the application group. | **Example** @@ -1083,8 +1091,8 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10100001 | Application group operation repeated. | +| 10000004 | IPC failed. | +| 10100001 | Repeated operation on the application group. | **Return value** @@ -1142,13 +1150,14 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10100001 | Application group operation repeated. | +| 10000004 | IPC failed. | +| 10100001 | Repeated operation on the application group. | **Example** ```javascript + // @ts-nocheck let onBundleGroupChanged = (err, res) =>{ console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack callback success.'); console.log('BUNDLE_ACTIVE registerAppGroupCallBack result appOldGroup is : ' + res.appOldGroup); @@ -1197,8 +1206,8 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10100001 | Application group operation repeated. | +| 10000004 | IPC failed. | +| 10100001 | Repeated operation on the application group. | **Example** @@ -1241,8 +1250,8 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10100001 | Application group operation repeated. | +| 10000004 | IPC failed. | +| 10100001 | Repeated operation on the application group. | **Example** @@ -1294,9 +1303,9 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000006 | Get application info failed. | -| 10000007 | Get system or actual time failed. | +| 10000004 | IPC failed. | +| 10000006 | Failed to get the application information. | +| 10000007 | Failed to get the system time. | **Example** @@ -1342,9 +1351,9 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000006 | Get application info failed. | -| 10000007 | Get system or actual time failed. | +| 10000004 | IPC failed. | +| 10000006 | Failed to get the application information. | +| 10000007 | Failed to get the system time. | **Example** @@ -1397,9 +1406,9 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000006 | Get application info failed. | -| 10000007 | Get system or actual time failed. | +| 10000004 | IPC failed. | +| 10000006 | Failed to get the application information. | +| 10000007 | Failed to get the system time. | **Example** @@ -1445,9 +1454,9 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | 10000001 | Memory operation failed. | | 10000002 | Parcel operation failed. | | 10000003 | System service operation failed. | -| 10000004 | IPC Communication failed. | -| 10000006 | Get application info failed. | -| 10000007 | Get system or actual time failed. | +| 10000004 | IPC failed. | +| 10000006 | Failed to get the application information. | +| 10000007 | Failed to get the system time. | **Example** diff --git a/en/application-dev/reference/apis/js-apis-resourceschedule-workScheduler.md b/en/application-dev/reference/apis/js-apis-resourceschedule-workScheduler.md index 736335322cef1ebb094100d2ac566b0520adf8c7..3db5bc33dc4e62a5562fc9a3de4b01c6476c586e 100644 --- a/en/application-dev/reference/apis/js-apis-resourceschedule-workScheduler.md +++ b/en/application-dev/reference/apis/js-apis-resourceschedule-workScheduler.md @@ -430,7 +430,7 @@ Provides detailed information about the task. For details about the constraints | isPersisted | boolean | No | Whether to enable persistent storage for the task. | | isDeepIdle | boolean | No | Whether the device needs to enter the idle state. | | idleWaitTime | number | No | Time to wait in the idle state. | -| parameters | {[key: string]: any} | No | Carried parameters. | +| parameters | {[key: string]: number | string | boolean} | No | Carried parameters. | ## NetworkType Enumerates the network types that can trigger the task. diff --git a/en/application-dev/reference/apis/js-apis-rpc.md b/en/application-dev/reference/apis/js-apis-rpc.md index 8fc776d5508dccfd04155a3952936743de8e711c..22d23791ce29915d8ca90980d81a4b33ba4a1e35 100644 --- a/en/application-dev/reference/apis/js-apis-rpc.md +++ b/en/application-dev/reference/apis/js-apis-rpc.md @@ -1,13 +1,12 @@ # @ohos.rpc (RPC) -The **rpc** module implements communication between processes, including inter-process communication (IPC) on a single device and remote procedure call (RPC) between processes on difference devices. IPC is implemented based on the Binder driver, and RPC is based on the DSoftBus driver. +The **RPC** module implements communication between processes, including inter-process communication (IPC) on a single device and remote procedure call (RPC) between processes on difference devices. IPC is implemented based on the Binder driver, and RPC is based on the DSoftBus driver. > **NOTE** > -> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> - The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. > -> This module supports return of error codes since API version 9. - +> - This module supports return of error codes since API version 9. ## Modules to Import @@ -15,7 +14,6 @@ The **rpc** module implements communication between processes, including inter-p import rpc from '@ohos.rpc'; ``` - ## ErrorCode9+ The APIs of this module return exceptions since API version 9. The following table lists the error codes. @@ -42,11 +40,13 @@ The APIs of this module return exceptions since API version 9. The following tab ## MessageSequence9+ - Provides APIs for reading and writing data in specific format. During RPC, the sender can use the **write()** method provided by **MessageSequence** to write data in specific format to a **MessageSequence** object. The receiver can use the **read()** method provided by **MessageSequence** to read data in specific format from a **MessageSequence** object. The data formats include basic data types and arrays, IPC objects, interface tokens, and custom sequenceable objects. +Provides APIs for reading and writing data in specific format. + +During RPC or IPC, the sender can use the **write()** method provided by **MessageSequence** to write data in specific format to a **MessageSequence** object. The receiver can use the **read()** method provided by **MessageSequence** to read data in specific format from a **MessageSequence** object. The data formats include basic data types and arrays, IPC objects, interface tokens, and custom sequenceable objects. ### create - create(): MessageSequence + static create(): MessageSequence Creates a **MessageSequence** object. This API is a static method. @@ -60,7 +60,7 @@ The APIs of this module return exceptions since API version 9. The following tab **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); console.log("RpcClient: data is " + data); ``` @@ -75,7 +75,7 @@ Reclaims the **MessageSequence** object that is no longer used. **Example** - ``` + ```ts let reply = rpc.MessageSequence.create(); reply.reclaim(); ``` @@ -105,7 +105,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts class TestRemoteObject extends rpc.RemoteObject { constructor(descriptor) { super(descriptor); @@ -146,7 +146,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts class TestRemoteObject extends rpc.RemoteObject { constructor(descriptor) { super(descriptor); @@ -187,7 +187,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeInterfaceToken("aaa"); @@ -219,22 +219,21 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode | ------- | ----- | | 1900010 | read data from message sequence failed | - **Example** - ``` - class Stub extends rpc.RemoteObject { - onRemoteRequest(code, data, reply, option) { - try { - let interfaceToken = data.readInterfaceToken(); - console.log("RpcServer: interfaceToken is " + interfaceToken); - } catch(error) { - console.info("RpcServer: read interfaceToken failed, errorCode " + error.code); - console.info("RpcServer: read interfaceToken failed, errorMessage " + error.message); - } - return true; - } - } +```ts +class Stub extends rpc.RemoteObject { + onRemoteRequest(code, data, reply, option) { + try { + let interfaceToken = data.readInterfaceToken(); + console.log("RpcServer: interfaceToken is " + interfaceToken); + } catch(error) { + console.info("RpcServer: read interfaceToken failed, errorCode " + error.code); + console.info("RpcServer: read interfaceToken failed, errorMessage " + error.message); + } + return true; + } +} ``` ### getSize @@ -253,7 +252,7 @@ Obtains the data size of this **MessageSequence** object. **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); let size = data.getSize(); console.log("RpcClient: size is " + size); @@ -275,7 +274,7 @@ Obtains the capacity of this **MessageSequence** object. **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); let result = data.getCapacity(); console.log("RpcClient: capacity is " + result); @@ -285,7 +284,7 @@ Obtains the capacity of this **MessageSequence** object. setSize(size: number): void -Sets the size of data contained in this **MessageSequence** object. +Sets the size of the data contained in this **MessageSequence** object. **System capability**: SystemCapability.Communication.IPC.Core @@ -293,11 +292,11 @@ Sets the size of data contained in this **MessageSequence** object. | Name| Type | Mandatory| Description| | ------ | ------ | ---- | ------ | - | size | number | Yes| Data size to set, in bytes.| + | size | number | Yes | Data size to set, in bytes.| **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.setSize(16); @@ -332,7 +331,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.setCapacity(100); @@ -347,7 +346,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode getWritableBytes(): number -Obtains the writable capacity of this **MessageSequence** object. +Obtains the writable capacity (in bytes) of this **MessageSequence** object. **System capability**: SystemCapability.Communication.IPC.Core @@ -355,18 +354,18 @@ Obtains the writable capacity of this **MessageSequence** object. | Type| Description| | ------ | ------ | - | number | **MessageSequence** writable capacity obtained, in bytes.| + | number | Writable capacity of the **MessageSequence** instance, in bytes.| **Example** - ``` - class Stub extends rpc.RemoteObject { - onRemoteRequest(code, data, reply, option) { - let getWritableBytes = data.getWritableBytes(); - console.log("RpcServer: getWritableBytes is " + getWritableBytes); - return true; - } - } +```ts +class Stub extends rpc.RemoteObject { + onRemoteRequest(code, data, reply, option) { + let getWritableBytes = data.getWritableBytes(); + console.log("RpcServer: getWritableBytes is " + getWritableBytes); + return true; + } +} ``` ### getReadableBytes @@ -381,18 +380,18 @@ Obtains the readable capacity of this **MessageSequence** object. | Type| Description| | ------ | ------- | - | number | **MessageSequence** readable capacity obtained, in bytes.| + | number | Readable capacity of the **MessageSequence** instance, in bytes.| **Example** - ``` - class Stub extends rpc.RemoteObject { - onRemoteRequest(code, data, reply, option) { - let result = data.getReadableBytes(); - console.log("RpcServer: getReadableBytes is " + result); - return true; - } - } + ```ts +class Stub extends rpc.RemoteObject { + onRemoteRequest(code, data, reply, option) { + let result = data.getReadableBytes(); + console.log("RpcServer: getReadableBytes is " + result); + return true; + } +} ``` ### getReadPosition @@ -411,7 +410,7 @@ Obtains the read position of this **MessageSequence** object. **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); let readPos = data.getReadPosition(); console.log("RpcClient: readPos is " + readPos); @@ -433,7 +432,7 @@ Obtains the write position of this **MessageSequence** object. **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); data.writeInt(10); let bwPos = data.getWritePosition(); @@ -456,7 +455,7 @@ Moves the read pointer to the specified position. **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); data.writeInt(12); data.writeString("sequence"); @@ -488,7 +487,7 @@ Moves the write pointer to the specified position. **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); data.writeInt(4); try { @@ -526,7 +525,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeByte(2); @@ -560,7 +559,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeByte(2); @@ -601,7 +600,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeShort(8); @@ -635,7 +634,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeShort(8); @@ -644,12 +643,12 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode console.info("rpc write short fail, errorMessage" + error.message); } try { - let ret = data.readShort(8); + let ret = data.readShort(); + console.log("RpcClient: readByte is: " + ret); } catch(error) { console.info("rpc read short fail, errorCode " + error.code); console.info("rpc read short fail, errorMessage" + error.message); } - console.log("RpcClient: readByte is: " + ret); ``` ### writeInt @@ -676,7 +675,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeInt(10); @@ -710,7 +709,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeInt(10); @@ -751,7 +750,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeLong(10000); @@ -785,7 +784,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeLong(10000); @@ -826,7 +825,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeFloat(1.2); @@ -860,7 +859,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeFloat(1.2); @@ -887,9 +886,9 @@ Writes a double-precision floating-point number to this **MessageSequence** obje **Parameters** - | Name| Type| Mandatory| Description| - | ------ | ------ | ---- | ------ | - | val number | Yes| Double-precision floating-point number to write.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ---------------------- | + | val | number | Yes | Double-precision floating-point number to write.| **Error codes** @@ -901,7 +900,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeDouble(10.2); @@ -935,7 +934,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeDouble(10.2); @@ -976,7 +975,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeBoolean(false); @@ -1010,7 +1009,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeBoolean(false); @@ -1051,7 +1050,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeChar(97); @@ -1085,7 +1084,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeChar(97); @@ -1126,7 +1125,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeString('abc'); @@ -1160,7 +1159,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeString('abc'); @@ -1201,7 +1200,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts class MySequenceable { num: number; str: string; @@ -1255,7 +1254,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts class MySequenceable { num: number; str: string; @@ -1310,7 +1309,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); let ByteArrayVar = [1, 2, 3, 4, 5]; try { @@ -1345,7 +1344,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); let ByteArrayVar = [1, 2, 3, 4, 5]; try { @@ -1387,7 +1386,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); let byteArrayVar = [1, 2, 3, 4, 5]; try { @@ -1429,7 +1428,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeShortArray([11, 12, 13]); @@ -1463,7 +1462,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeShortArray([11, 12, 13]); @@ -1504,7 +1503,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeShortArray([11, 12, 13]); @@ -1545,7 +1544,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeIntArray([100, 111, 112]); @@ -1579,7 +1578,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeIntArray([100, 111, 112]); @@ -1620,7 +1619,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeIntArray([100, 111, 112]); @@ -1661,7 +1660,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeLongArray([1111, 1112, 1113]); @@ -1695,7 +1694,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeLongArray([1111, 1112, 1113]); @@ -1736,7 +1735,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeLongArray([1111, 1112, 1113]); @@ -1777,7 +1776,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeFloatArray([1.2, 1.3, 1.4]); @@ -1811,7 +1810,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeFloatArray([1.2, 1.3, 1.4]); @@ -1852,7 +1851,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeFloatArray([1.2, 1.3, 1.4]); @@ -1893,7 +1892,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeDoubleArray([11.1, 12.2, 13.3]); @@ -1927,7 +1926,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeDoubleArray([11.1, 12.2, 13.3]); @@ -1968,7 +1967,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeDoubleArray([11.1, 12.2, 13.3]); @@ -2009,7 +2008,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeBooleanArray([false, true, false]); @@ -2043,7 +2042,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeBooleanArray([false, true, false]); @@ -2084,7 +2083,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeBooleanArray([false, true, false]); @@ -2125,7 +2124,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeCharArray([97, 98, 88]); @@ -2159,7 +2158,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeCharArray([97, 98, 88]); @@ -2200,7 +2199,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeCharArray([97, 98, 88]); @@ -2242,7 +2241,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeStringArray(["abc", "def"]); @@ -2276,7 +2275,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeStringArray(["abc", "def"]); @@ -2317,7 +2316,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let data = rpc.MessageSequence.create(); try { data.writeStringArray(["abc", "def"]); @@ -2352,7 +2351,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts class TestRemoteObject extends rpc.RemoteObject { constructor(descriptor) { super(descriptor); @@ -2394,7 +2393,9 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + Obtain the service. + + ```ts import FA from "@ohos.ability.featureAbility"; let proxy; let connect = { @@ -2414,6 +2415,11 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode "abilityName": "com.ohos.server.MainAbility", }; FA.connectAbility(want, connect); + ``` + + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **sendMessageRequest()** of the proxy object is called to send a message. + + ```ts let option = new rpc.MessageOption(); let data = rpc.MessageSequence.create(); let reply = rpc.MessageSequence.create(); @@ -2467,7 +2473,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts class MyParcelable { num: number; str: string; @@ -2524,7 +2530,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts class MyParcelable { num: number; str: string; @@ -2584,7 +2590,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts class TestRemoteObject extends rpc.RemoteObject { constructor(descriptor) { super(descriptor); @@ -2631,7 +2637,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts class MyDeathRecipient { onRemoteDied() { console.log("server died"); @@ -2684,7 +2690,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts class TestRemoteObject extends rpc.RemoteObject { constructor(descriptor) { super(descriptor); @@ -2712,7 +2718,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode static closeFileDescriptor(fd: number): void -Closes a file descriptor. +Closes a file descriptor. This API is a static method. **System capability**: SystemCapability.Communication.IPC.Core @@ -2724,7 +2730,7 @@ Closes a file descriptor. **Example** - ``` + ```ts import fileio from '@ohos.fileio'; let filePath = "path/to/file"; let fd = fileio.openSync(filePath, 0o2| 0o100, 0o666); @@ -2740,7 +2746,7 @@ Closes a file descriptor. static dupFileDescriptor(fd: number) :number -Duplicates a file descriptor. +Duplicates a file descriptor. This API is a static method. **System capability**: SystemCapability.Communication.IPC.Core @@ -2766,7 +2772,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts import fileio from '@ohos.fileio'; let filePath = "path/to/file"; let fd = fileio.openSync(filePath, 0o2| 0o100, 0o666); @@ -2795,7 +2801,7 @@ Checks whether this **MessageSequence** object contains file descriptors. **Example** - ``` + ```ts import fileio from '@ohos.fileio'; let sequence = new rpc.MessageSequence(); let filePath = "path/to/file"; @@ -2840,7 +2846,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts import fileio from '@ohos.fileio'; let sequence = new rpc.MessageSequence(); let filePath = "path/to/file"; @@ -2853,7 +2859,6 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode } ``` - ### readFileDescriptor readFileDescriptor(): number @@ -2878,7 +2883,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts import fileio from '@ohos.fileio'; let sequence = new rpc.MessageSequence(); let filePath = "path/to/file"; @@ -2897,7 +2902,6 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode } ``` - ### writeAshmem writeAshmem(ashmem: Ashmem): void @@ -2922,7 +2926,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let sequence = new rpc.MessageSequence(); let ashmem; try { @@ -2964,7 +2968,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let sequence = new rpc.MessageSequence(); let ashmem; try { @@ -2988,7 +2992,6 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode } ``` - ### getRawDataCapacity getRawDataCapacity(): number @@ -3005,13 +3008,12 @@ Obtains the maximum amount of raw data that can be held by this **MessageSequenc **Example** - ``` + ```ts let sequence = new rpc.MessageSequence(); let result = sequence.getRawDataCapacity(); console.log("RpcTest: sequence get RawDataCapacity result is : " + result); ``` - ### writeRawData writeRawData(rawData: number[], size: number): void @@ -3037,7 +3039,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let sequence = new rpc.MessageSequence(); let arr = [1, 2, 3, 4, 5]; try { @@ -3048,7 +3050,6 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode } ``` - ### readRawData readRawData(size: number): number[] @@ -3079,7 +3080,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let sequence = new rpc.MessageSequence(); let arr = [1, 2, 3, 4, 5]; try { @@ -3101,11 +3102,13 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode >This class is no longer maintained since API version 9. You are advised to use [MessageSequence](#messagesequence9). -Provides APIs for reading and writing data in specific format. During RPC, the sender can use the **write()** method provided by **MessageParcel** to write data in specific format to a **MessageParcel** object. The receiver can use the **read()** method provided by **MessageParcel** to read data in specific format from a **MessageParcel** object. The data formats include basic data types and arrays, IPC objects, interface tokens, and custom sequenceable objects. +Provides APIs for reading and writing data in specific format. + +During RPC, the sender can use the **write()** method provided by **MessageParcel** to write data in specific format to a **MessageParcel** object. The receiver can use the **read()** method provided by **MessageParcel** to read data in specific format from a **MessageParcel** object. The data formats include basic data types and arrays, IPC objects, interface tokens, and custom sequenceable objects. ### create -create(): MessageParcel +static create(): MessageParcel Creates a **MessageParcel** object. This method is a static method. @@ -3119,7 +3122,7 @@ Creates a **MessageParcel** object. This method is a static method. **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); console.log("RpcClient: data is " + data); ``` @@ -3134,7 +3137,7 @@ Reclaims the **MessageParcel** object that is no longer used. **Example** - ``` + ```ts let reply = rpc.MessageParcel.create(); reply.reclaim(); ``` @@ -3161,7 +3164,7 @@ Serializes a remote object and writes it to this **MessageParcel** object. **Example** - ``` + ```ts class MyDeathRecipient { onRemoteDied() { console.log("server died"); @@ -3202,7 +3205,7 @@ Reads the remote object from this **MessageParcel** object. You can use this met **Example** - ``` + ```ts class MyDeathRecipient { onRemoteDied() { console.log("server died"); @@ -3250,7 +3253,7 @@ Writes an interface token to this **MessageParcel** object. The remote object ca **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeInterfaceToken("aaa"); console.log("RpcServer: writeInterfaceToken is " + result); @@ -3273,7 +3276,7 @@ Reads the interface token from this **MessageParcel** object. The interface toke **Example** - ``` + ```ts class Stub extends rpc.RemoteObject { onRemoteMessageRequest(code, data, reply, option) { let interfaceToken = data.readInterfaceToken(); @@ -3283,7 +3286,6 @@ Reads the interface token from this **MessageParcel** object. The interface toke } ``` - ### getSize getSize(): number @@ -3300,13 +3302,12 @@ Obtains the data size of this **MessageParcel** object. **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let size = data.getSize(); console.log("RpcClient: size is " + size); ``` - ### getCapacity getCapacity(): number @@ -3323,13 +3324,12 @@ Obtains the capacity of this **MessageParcel** object. **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.getCapacity(); console.log("RpcClient: capacity is " + result); ``` - ### setSize setSize(size: number): boolean @@ -3352,13 +3352,12 @@ Sets the size of data contained in this **MessageParcel** object. **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let setSize = data.setSize(16); console.log("RpcClient: setSize is " + setSize); ``` - ### setCapacity setCapacity(size: number): boolean @@ -3381,13 +3380,12 @@ Sets the storage capacity of this **MessageParcel** object. **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.setCapacity(100); console.log("RpcClient: setCapacity is " + result); ``` - ### getWritableBytes getWritableBytes(): number @@ -3404,7 +3402,7 @@ Obtains the writable capacity of this **MessageParcel** object. **Example** - ``` + ```ts class Stub extends rpc.RemoteObject { onRemoteMessageRequest(code, data, reply, option) { let getWritableBytes = data.getWritableBytes(); @@ -3414,7 +3412,6 @@ Obtains the writable capacity of this **MessageParcel** object. } ``` - ### getReadableBytes getReadableBytes(): number @@ -3431,7 +3428,7 @@ Obtains the readable capacity of this **MessageParcel** object. **Example** - ``` + ```ts class Stub extends rpc.RemoteObject { onRemoteRequest(code, data, reply, option) { let result = data.getReadableBytes(); @@ -3441,7 +3438,6 @@ Obtains the readable capacity of this **MessageParcel** object. } ``` - ### getReadPosition getReadPosition(): number @@ -3458,13 +3454,12 @@ Obtains the read position of this **MessageParcel** object. **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let readPos = data.getReadPosition(); console.log("RpcClient: readPos is " + readPos); ``` - ### getWritePosition getWritePosition(): number @@ -3481,14 +3476,13 @@ Obtains the write position of this **MessageParcel** object. **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); data.writeInt(10); let bwPos = data.getWritePosition(); console.log("RpcClient: bwPos is " + bwPos); ``` - ### rewindRead rewindRead(pos: number): boolean @@ -3511,7 +3505,7 @@ Moves the read pointer to the specified position. **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); data.writeInt(12); data.writeString("parcel"); @@ -3522,7 +3516,6 @@ Moves the read pointer to the specified position. console.log("RpcClient: rewindRead is " + number2); ``` - ### rewindWrite rewindWrite(pos: number): boolean @@ -3545,7 +3538,7 @@ Moves the write pointer to the specified position. **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); data.writeInt(4); data.rewindWrite(0); @@ -3554,7 +3547,6 @@ Moves the write pointer to the specified position. console.log("RpcClient: rewindWrite is: " + number); ``` - ### writeByte writeByte(val: number): boolean @@ -3577,13 +3569,12 @@ Writes a Byte value to this **MessageParcel** object. **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeByte(2); console.log("RpcClient: writeByte is: " + result); ``` - ### readByte readByte(): number @@ -3600,7 +3591,7 @@ Reads the Byte value from this **MessageParcel** object. **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeByte(2); console.log("RpcClient: writeByte is: " + result); @@ -3608,7 +3599,6 @@ Reads the Byte value from this **MessageParcel** object. console.log("RpcClient: readByte is: " + ret); ``` - ### writeShort writeShort(val: number): boolean @@ -3627,17 +3617,16 @@ Writes a Short int value to this **MessageParcel** object. | Type | Description | | ------- | ----------------------------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeShort(8); console.log("RpcClient: writeShort is: " + result); ``` - ### readShort readShort(): number @@ -3654,7 +3643,7 @@ Reads the Short int value from this **MessageParcel** object. **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeShort(8); console.log("RpcClient: writeShort is: " + result); @@ -3662,7 +3651,6 @@ Reads the Short int value from this **MessageParcel** object. console.log("RpcClient: readShort is: " + ret); ``` - ### writeInt writeInt(val: number): boolean @@ -3685,13 +3673,12 @@ Writes an Int value to this **MessageParcel** object. **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeInt(10); console.log("RpcClient: writeInt is " + result); ``` - ### readInt readInt(): number @@ -3708,7 +3695,7 @@ Reads the Int value from this **MessageParcel** object. **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeInt(10); console.log("RpcClient: writeInt is " + result); @@ -3716,7 +3703,6 @@ Reads the Int value from this **MessageParcel** object. console.log("RpcClient: readInt is " + ret); ``` - ### writeLong writeLong(val: number): boolean @@ -3735,17 +3721,16 @@ Writes a Long int value to this **MessageParcel** object. | Type | Description | | ------- | --------------------------------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeLong(10000); console.log("RpcClient: writeLong is " + result); ``` - ### readLong readLong(): number @@ -3762,7 +3747,7 @@ Reads the Long int value from this **MessageParcel** object. **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeLong(10000); console.log("RpcClient: writeLong is " + result); @@ -3770,7 +3755,6 @@ Reads the Long int value from this **MessageParcel** object. console.log("RpcClient: readLong is " + ret); ``` - ### writeFloat writeFloat(val: number): boolean @@ -3789,17 +3773,16 @@ Writes a Float value to this **MessageParcel** object. | Type | Description | | ------- | --------------------------------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeFloat(1.2); console.log("RpcClient: writeFloat is " + result); ``` - ### readFloat readFloat(): number @@ -3816,7 +3799,7 @@ Reads the Float value from this **MessageParcel** object. **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeFloat(1.2); console.log("RpcClient: writeFloat is " + result); @@ -3824,7 +3807,6 @@ Reads the Float value from this **MessageParcel** object. console.log("RpcClient: readFloat is " + ret); ``` - ### writeDouble writeDouble(val: number): boolean @@ -3843,17 +3825,16 @@ Writes a Double value to this **MessageParcel** object. | Type | Description | | ------- | --------------------------------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeDouble(10.2); console.log("RpcClient: writeDouble is " + result); ``` - ### readDouble readDouble(): number @@ -3870,7 +3851,7 @@ Reads the Double value from this **MessageParcel** object. **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeDouble(10.2); console.log("RpcClient: writeDouble is " + result); @@ -3896,17 +3877,16 @@ Writes a Boolean value to this **MessageParcel** object. | Type | Description | | ------- | --------------------------------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeBoolean(false); console.log("RpcClient: writeBoolean is " + result); ``` - ### readBoolean readBoolean(): boolean @@ -3923,7 +3903,7 @@ Reads the Boolean value from this **MessageParcel** object. **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeBoolean(false); console.log("RpcClient: writeBoolean is " + result); @@ -3931,7 +3911,6 @@ Reads the Boolean value from this **MessageParcel** object. console.log("RpcClient: readBoolean is " + ret); ``` - ### writeChar writeChar(val: number): boolean @@ -3950,17 +3929,16 @@ Writes a Char value to this **MessageParcel** object. | Type | Description | | ------- | ----------------------------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeChar(97); console.log("RpcClient: writeChar is " + result); ``` - ### readChar readChar(): number @@ -3977,7 +3955,7 @@ Reads the Char value from this **MessageParcel** object. **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeChar(97); console.log("RpcClient: writeChar is " + result); @@ -3985,7 +3963,6 @@ Reads the Char value from this **MessageParcel** object. console.log("RpcClient: readChar is " + ret); ``` - ### writeString writeString(val: string): boolean @@ -4004,17 +3981,16 @@ Writes a string to this **MessageParcel** object. | Type | Description | | ------- | --------------------------------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeString('abc'); console.log("RpcClient: writeString is " + result); ``` - ### readString readString(): string @@ -4031,7 +4007,7 @@ Reads the string from this **MessageParcel** object. **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeString('abc'); console.log("RpcClient: writeString is " + result); @@ -4039,7 +4015,6 @@ Reads the string from this **MessageParcel** object. console.log("RpcClient: readString is " + ret); ``` - ### writeSequenceable writeSequenceable(val: Sequenceable): boolean @@ -4058,11 +4033,11 @@ Writes a sequenceable object to this **MessageParcel** object. | Type | Description | | ------- | --------------------------------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** - ``` + ```ts class MySequenceable { num: number; str: string; @@ -4087,7 +4062,6 @@ Writes a sequenceable object to this **MessageParcel** object. console.log("RpcClient: writeSequenceable is " + result); ``` - ### readSequenceable readSequenceable(dataIn: Sequenceable): boolean @@ -4110,7 +4084,7 @@ Reads member variables from this **MessageParcel** object. **Example** - ``` + ```ts class MySequenceable { num: number; str: string; @@ -4138,7 +4112,6 @@ Reads member variables from this **MessageParcel** object. console.log("RpcClient: writeSequenceable is " + result2); ``` - ### writeByteArray writeByteArray(byteArray: number[]): boolean @@ -4157,18 +4130,17 @@ Writes a byte array to this **MessageParcel** object. | Type | Description | | ------- | --------------------------------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let ByteArrayVar = [1, 2, 3, 4, 5]; let result = data.writeByteArray(ByteArrayVar); console.log("RpcClient: writeByteArray is " + result); ``` - ### readByteArray readByteArray(dataIn: number[]): void @@ -4185,7 +4157,7 @@ Reads a byte array from this **MessageParcel** object. **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let ByteArrayVar = [1, 2, 3, 4, 5]; let result = data.writeByteArray(ByteArrayVar); @@ -4194,7 +4166,6 @@ Reads a byte array from this **MessageParcel** object. data.readByteArray(array); ``` - ### readByteArray readByteArray(): number[] @@ -4211,7 +4182,7 @@ Reads the byte array from this **MessageParcel** object. **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let ByteArrayVar = [1, 2, 3, 4, 5]; let result = data.writeByteArray(ByteArrayVar); @@ -4220,7 +4191,6 @@ Reads the byte array from this **MessageParcel** object. console.log("RpcClient: readByteArray is " + array); ``` - ### writeShortArray writeShortArray(shortArray: number[]): boolean @@ -4239,17 +4209,16 @@ Writes a short array to this **MessageParcel** object. | Type | Description | | ------- | ----------------------------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeShortArray([11, 12, 13]); console.log("RpcClient: writeShortArray is " + result); ``` - ### readShortArray readShortArray(dataIn: number[]): void @@ -4266,7 +4235,7 @@ Reads a short array from this **MessageParcel** object. **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeShortArray([11, 12, 13]); console.log("RpcClient: writeShortArray is " + result); @@ -4274,7 +4243,6 @@ Reads a short array from this **MessageParcel** object. data.readShortArray(array); ``` - ### readShortArray readShortArray(): number[] @@ -4291,7 +4259,7 @@ Reads the short array from this **MessageParcel** object. **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeShortArray([11, 12, 13]); console.log("RpcClient: writeShortArray is " + result); @@ -4299,7 +4267,6 @@ Reads the short array from this **MessageParcel** object. console.log("RpcClient: readShortArray is " + array); ``` - ### writeIntArray writeIntArray(intArray: number[]): boolean @@ -4318,17 +4285,16 @@ Writes an integer array to this **MessageParcel** object. | Type | Description | | ------- | ----------------------------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeIntArray([100, 111, 112]); console.log("RpcClient: writeIntArray is " + result); ``` - ### readIntArray readIntArray(dataIn: number[]): void @@ -4345,7 +4311,7 @@ Reads an integer array from this **MessageParcel** object. **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeIntArray([100, 111, 112]); console.log("RpcClient: writeIntArray is " + result); @@ -4353,7 +4319,6 @@ Reads an integer array from this **MessageParcel** object. data.readIntArray(array); ``` - ### readIntArray readIntArray(): number[] @@ -4370,7 +4335,7 @@ Reads the integer array from this **MessageParcel** object. **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeIntArray([100, 111, 112]); console.log("RpcClient: writeIntArray is " + result); @@ -4378,7 +4343,6 @@ Reads the integer array from this **MessageParcel** object. console.log("RpcClient: readIntArray is " + array); ``` - ### writeLongArray writeLongArray(longArray: number[]): boolean @@ -4397,17 +4361,16 @@ Writes a long array to this **MessageParcel** object. | Type | Description | | ------- | ----------------------------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeLongArray([1111, 1112, 1113]); console.log("RpcClient: writeLongArray is " + result); ``` - ### readLongArray readLongArray(dataIn: number[]): void @@ -4424,7 +4387,7 @@ Reads a long array from this **MessageParcel** object. **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeLongArray([1111, 1112, 1113]); console.log("RpcClient: writeLongArray is " + result); @@ -4432,7 +4395,6 @@ Reads a long array from this **MessageParcel** object. data.readLongArray(array); ``` - ### readLongArray readLongArray(): number[] @@ -4449,7 +4411,7 @@ Reads the long array from this **MessageParcel** object. **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeLongArray([1111, 1112, 1113]); console.log("RpcClient: writeLongArray is " + result); @@ -4457,7 +4419,6 @@ Reads the long array from this **MessageParcel** object. console.log("RpcClient: readLongArray is " + array); ``` - ### writeFloatArray writeFloatArray(floatArray: number[]): boolean @@ -4476,17 +4437,16 @@ Writes a FloatArray to this **MessageParcel** object. | Type | Description | | ------- | ----------------------------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeFloatArray([1.2, 1.3, 1.4]); console.log("RpcClient: writeFloatArray is " + result); ``` - ### readFloatArray readFloatArray(dataIn: number[]): void @@ -4503,7 +4463,7 @@ Reads a FloatArray from this **MessageParcel** object. **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeFloatArray([1.2, 1.3, 1.4]); console.log("RpcClient: writeFloatArray is " + result); @@ -4511,7 +4471,6 @@ Reads a FloatArray from this **MessageParcel** object. data.readFloatArray(array); ``` - ### readFloatArray readFloatArray(): number[] @@ -4528,7 +4487,7 @@ Reads the FloatArray from this **MessageParcel** object. **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeFloatArray([1.2, 1.3, 1.4]); console.log("RpcClient: writeFloatArray is " + result); @@ -4536,7 +4495,6 @@ Reads the FloatArray from this **MessageParcel** object. console.log("RpcClient: readFloatArray is " + array); ``` - ### writeDoubleArray writeDoubleArray(doubleArray: number[]): boolean @@ -4555,17 +4513,16 @@ Writes a DoubleArray to this **MessageParcel** object. | Type | Description | | ------- | ----------------------------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeDoubleArray([11.1, 12.2, 13.3]); console.log("RpcClient: writeDoubleArray is " + result); ``` - ### readDoubleArray readDoubleArray(dataIn: number[]): void @@ -4582,7 +4539,7 @@ Reads a DoubleArray from this **MessageParcel** object. **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeDoubleArray([11.1, 12.2, 13.3]); console.log("RpcClient: writeDoubleArray is " + result); @@ -4590,7 +4547,6 @@ Reads a DoubleArray from this **MessageParcel** object. data.readDoubleArray(array); ``` - ### readDoubleArray readDoubleArray(): number[] @@ -4607,7 +4563,7 @@ Reads the DoubleArray from this **MessageParcel** object. **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeDoubleArray([11.1, 12.2, 13.3]); console.log("RpcClient: writeDoubleArray is " + result); @@ -4615,7 +4571,6 @@ Reads the DoubleArray from this **MessageParcel** object. console.log("RpcClient: readDoubleArray is " + array); ``` - ### writeBooleanArray writeBooleanArray(booleanArray: boolean[]): boolean @@ -4634,17 +4589,16 @@ Writes a Boolean array to this **MessageParcel** object. | Type | Description | | ------- | --------------------------------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeBooleanArray([false, true, false]); console.log("RpcClient: writeBooleanArray is " + result); ``` - ### readBooleanArray readBooleanArray(dataIn: boolean[]): void @@ -4661,7 +4615,7 @@ Reads a Boolean array from this **MessageParcel** object. **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeBooleanArray([false, true, false]); console.log("RpcClient: writeBooleanArray is " + result); @@ -4669,7 +4623,6 @@ Reads a Boolean array from this **MessageParcel** object. data.readBooleanArray(array); ``` - ### readBooleanArray readBooleanArray(): boolean[] @@ -4686,7 +4639,7 @@ Reads the Boolean array from this **MessageParcel** object. **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeBooleanArray([false, true, false]); console.log("RpcClient: writeBooleanArray is " + result); @@ -4694,7 +4647,6 @@ Reads the Boolean array from this **MessageParcel** object. console.log("RpcClient: readBooleanArray is " + array); ``` - ### writeCharArray writeCharArray(charArray: number[]): boolean @@ -4713,17 +4665,16 @@ Writes a character array to this **MessageParcel** object. | Type | Description | | ------- | --------------------------------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeCharArray([97, 98, 88]); console.log("RpcClient: writeCharArray is " + result); ``` - ### readCharArray readCharArray(dataIn: number[]): void @@ -4740,7 +4691,7 @@ Reads a character array from this **MessageParcel** object. **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeCharArray([97, 98, 99]); console.log("RpcClient: writeCharArray is " + result); @@ -4748,7 +4699,6 @@ Reads a character array from this **MessageParcel** object. data.readCharArray(array); ``` - ### readCharArray readCharArray(): number[] @@ -4765,7 +4715,7 @@ Reads the character array from this **MessageParcel** object. **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeCharArray([97, 98, 99]); console.log("RpcClient: writeCharArray is " + result); @@ -4773,7 +4723,6 @@ Reads the character array from this **MessageParcel** object. console.log("RpcClient: readCharArray is " + array); ``` - ### writeStringArray writeStringArray(stringArray: string[]): boolean @@ -4792,17 +4741,16 @@ Writes a string array to this **MessageParcel** object. | Type | Description| | ------- | --------------------------------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeStringArray(["abc", "def"]); console.log("RpcClient: writeStringArray is " + result); ``` - ### readStringArray readStringArray(dataIn: string[]): void @@ -4819,7 +4767,7 @@ Reads a string array from this **MessageParcel** object. **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeStringArray(["abc", "def"]); console.log("RpcClient: writeStringArray is " + result); @@ -4827,7 +4775,6 @@ Reads a string array from this **MessageParcel** object. data.readStringArray(array); ``` - ### readStringArray readStringArray(): string[] @@ -4844,7 +4791,7 @@ Reads the string array from this **MessageParcel** object. **Example** - ``` + ```ts let data = rpc.MessageParcel.create(); let result = data.writeStringArray(["abc", "def"]); console.log("RpcClient: writeStringArray is " + result); @@ -4852,7 +4799,6 @@ Reads the string array from this **MessageParcel** object. console.log("RpcClient: readStringArray is " + array); ``` - ### writeNoException8+ writeNoException(): void @@ -4863,7 +4809,7 @@ Writes information to this **MessageParcel** object indicating that no exception **Example** - ``` + ```ts class MyDeathRecipient { onRemoteDied() { console.log("server died"); @@ -4904,8 +4850,10 @@ Reads the exception information from this **MessageParcel** object. **System capability**: SystemCapability.Communication.IPC.Core **Example** + + Obtain the service. - ``` + ```ts import FA from "@ohos.ability.featureAbility"; let proxy; let connect = { @@ -4925,6 +4873,11 @@ Reads the exception information from this **MessageParcel** object. "abilityName": "com.ohos.server.MainAbility", }; FA.connectAbility(want, connect); + ``` + + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **sendMessageRequest()** of the proxy object is called to send a message. + + ```ts let option = new rpc.MessageOption(); let data = rpc.MessageParcel.create(); let reply = rpc.MessageParcel.create(); @@ -4967,11 +4920,11 @@ Writes a sequenceable array to this **MessageParcel** object. | Type | Description | | ------- | --------------------------------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** - ``` + ```ts class MySequenceable { num: number; str: string; @@ -4999,7 +4952,6 @@ Writes a sequenceable array to this **MessageParcel** object. console.log("RpcClient: writeSequenceableArray is " + result); ``` - ### readSequenceableArray8+ readSequenceableArray(sequenceableArray: Sequenceable[]): void @@ -5016,7 +4968,7 @@ Reads a sequenceable array from this **MessageParcel** object. **Example** - ``` + ```ts class MySequenceable { num: number; str: string; @@ -5046,7 +4998,6 @@ Reads a sequenceable array from this **MessageParcel** object. data.readSequenceableArray(b); ``` - ### writeRemoteObjectArray8+ writeRemoteObjectArray(objectArray: IRemoteObject[]): boolean @@ -5065,11 +5016,11 @@ Writes an array of **IRemoteObject** objects to this **MessageParcel** object. | Type | Description | | ------- | -------------------------------------------------------------------------------------------------------------------- | - | boolean | Returns **true** if the operation is successful; returns **false** if the operation fails or if the **IRemoteObject** array is null.| + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** - ``` + ```ts class MyDeathRecipient { onRemoteDied() { console.log("server died"); @@ -5099,7 +5050,6 @@ Writes an array of **IRemoteObject** objects to this **MessageParcel** object. console.log("RpcClient: writeRemoteObjectArray is " + result); ``` - ### readRemoteObjectArray8+ readRemoteObjectArray(objects: IRemoteObject[]): void @@ -5116,7 +5066,7 @@ Reads an **IRemoteObject** array from this **MessageParcel** object. **Example** - ``` + ```ts class MyDeathRecipient { onRemoteDied() { console.log("server died"); @@ -5147,7 +5097,6 @@ Reads an **IRemoteObject** array from this **MessageParcel** object. data.readRemoteObjectArray(b); ``` - ### readRemoteObjectArray8+ readRemoteObjectArray(): IRemoteObject[] @@ -5164,7 +5113,7 @@ Reads the **IRemoteObject** array from this **MessageParcel** object. **Example** - ``` + ```ts class MyDeathRecipient { onRemoteDied() { console.log("server died"); @@ -5196,12 +5145,11 @@ Reads the **IRemoteObject** array from this **MessageParcel** object. console.log("RpcClient: readRemoteObjectArray is " + b); ``` - ### closeFileDescriptor8+ static closeFileDescriptor(fd: number): void -Closes a file descriptor. +Closes a file descriptor. This API is a static method. **System capability**: SystemCapability.Communication.IPC.Core @@ -5213,19 +5161,18 @@ Closes a file descriptor. **Example** - ``` + ```ts import fileio from '@ohos.fileio'; let filePath = "path/to/file"; let fd = fileio.openSync(filePath, 0o2| 0o100, 0o666); rpc.MessageParcel.closeFileDescriptor(fd); ``` - ### dupFileDescriptor8+ static dupFileDescriptor(fd: number) :number -Duplicates a file descriptor. +Duplicates a file descriptor. This API is a static method. **System capability**: SystemCapability.Communication.IPC.Core @@ -5243,19 +5190,18 @@ Duplicates a file descriptor. **Example** - ``` + ```ts import fileio from '@ohos.fileio'; let filePath = "path/to/file"; let fd = fileio.openSync(filePath, 0o2| 0o100, 0o666); let newFd = rpc.MessageParcel.dupFileDescriptor(fd); ``` - ### containFileDescriptors8+ containFileDescriptors(): boolean -Checks whether this **MessageParcel** object contains a file descriptor. +Checks whether this **MessageParcel** object contains file descriptors. **System capability**: SystemCapability.Communication.IPC.Core @@ -5263,11 +5209,11 @@ Checks whether this **MessageParcel** object contains a file descriptor. | Type | Description | | ------- | ------------------------------------------------------------------ | - | boolean | Returns **true** if the **MessageParcel** object contains a file descriptor; returns **false** otherwise.| + | boolean |Returns **true** if the **MessageParcel** object contains file descriptors; returns **false** otherwise.| **Example** - ``` + ```ts import fileio from '@ohos.fileio'; let parcel = new rpc.MessageParcel(); let filePath = "path/to/file"; @@ -5279,7 +5225,6 @@ Checks whether this **MessageParcel** object contains a file descriptor. console.log("RpcTest: parcel after write fd containFd result is : " + containFD); ``` - ### writeFileDescriptor8+ writeFileDescriptor(fd: number): boolean @@ -5302,7 +5247,7 @@ Writes a file descriptor to this **MessageParcel** object. **Example** - ``` + ```ts import fileio from '@ohos.fileio'; let parcel = new rpc.MessageParcel(); let filePath = "path/to/file"; @@ -5311,7 +5256,6 @@ Writes a file descriptor to this **MessageParcel** object. console.log("RpcTest: parcel writeFd result is : " + writeResult); ``` - ### readFileDescriptor8+ readFileDescriptor(): number @@ -5328,7 +5272,7 @@ Reads the file descriptor from this **MessageParcel** object. **Example** - ``` + ```ts import fileio from '@ohos.fileio'; let parcel = new rpc.MessageParcel(); let filePath = "path/to/file"; @@ -5338,7 +5282,6 @@ Reads the file descriptor from this **MessageParcel** object. console.log("RpcTest: parcel read fd is : " + readFD); ``` - ### writeAshmem8+ writeAshmem(ashmem: Ashmem): boolean @@ -5357,18 +5300,17 @@ Writes an anonymous shared object to this **MessageParcel** object. | Type | Description | | ------- | -------------------------------------------------------------------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** - ``` + ```ts let parcel = new rpc.MessageParcel(); let ashmem = rpc.Ashmem.createAshmem("ashmem", 1024); let isWriteSuccess = parcel.writeAshmem(ashmem); console.log("RpcTest: write ashmem to result is : " + isWriteSuccess); ``` - ### readAshmem8+ readAshmem(): Ashmem @@ -5385,7 +5327,7 @@ Reads the anonymous shared object from this **MessageParcel** object. **Example** - ``` + ```ts let parcel = new rpc.MessageParcel(); let ashmem = rpc.Ashmem.createAshmem("ashmem", 1024); let isWriteSuccess = parcel.writeAshmem(ashmem); @@ -5394,7 +5336,6 @@ Reads the anonymous shared object from this **MessageParcel** object. console.log("RpcTest: read ashmem to result is : " + readAshmem); ``` - ### getRawDataCapacity8+ getRawDataCapacity(): number @@ -5411,13 +5352,12 @@ Obtains the maximum amount of raw data that can be held by this **MessageParcel* **Example** - ``` + ```ts let parcel = new rpc.MessageParcel(); let result = parcel.getRawDataCapacity(); console.log("RpcTest: parcel get RawDataCapacity result is : " + result); ``` - ### writeRawData8+ writeRawData(rawData: number[], size: number): boolean @@ -5437,18 +5377,17 @@ Writes raw data to this **MessageParcel** object. | Type | Description | | ------- | ----------------------------------------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** - ``` + ```ts let parcel = new rpc.MessageParcel(); let arr = [1, 2, 3, 4, 5]; let isWriteSuccess = parcel.writeRawData(arr, arr.length); console.log("RpcTest: parcel write raw data result is : " + isWriteSuccess); ``` - ### readRawData8+ readRawData(size: number): number[] @@ -5471,7 +5410,7 @@ Reads raw data from this **MessageParcel** object. **Example** - ``` + ```ts let parcel = new rpc.MessageParcel(); let arr = [1, 2, 3, 4, 5]; let isWriteSuccess = parcel.writeRawData(arr, arr.length); @@ -5480,7 +5419,6 @@ Reads raw data from this **MessageParcel** object. console.log("RpcTest: parcel read raw data result is : " + result); ``` - ## Parcelable9+ Writes an object to a **MessageSequence** and reads it from the **MessageSequence** during IPC. @@ -5504,10 +5442,9 @@ Marshals this **Parcelable** object into a **MessageSequence** object. | Type | Description | | ------- | ----------------------------------------- | | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| - **Example** - ``` + ```ts class MyParcelable { num: number; str: string; @@ -5535,7 +5472,6 @@ Marshals this **Parcelable** object into a **MessageSequence** object. console.log("RpcClient: readParcelable is " + result2); ``` - ### unmarshalling unmarshalling(dataIn: MessageSequence): boolean @@ -5558,7 +5494,7 @@ Unmarshals this **Parcelable** object from a **MessageSequence** object. **Example** - ``` + ```ts class MyParcelable { num: number; str: string; @@ -5586,7 +5522,6 @@ Unmarshals this **Parcelable** object from a **MessageSequence** object. console.log("RpcClient: readParcelable is " + result2); ``` - ## Sequenceable(deprecated) >This class is no longer maintained since API version 9. You are advised to use the [Parcelable](#parcelable9). @@ -5612,10 +5547,9 @@ Marshals the sequenceable object into a **MessageParcel** object. | Type | Description | | ------- | ----------------------------------------- | | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| - **Example** - ``` + ```ts class MySequenceable { num: number; str: string; @@ -5643,7 +5577,6 @@ Marshals the sequenceable object into a **MessageParcel** object. console.log("RpcClient: readSequenceable is " + result2); ``` - ### unmarshalling unmarshalling(dataIn: MessageParcel): boolean @@ -5666,7 +5599,7 @@ Unmarshals this sequenceable object from a **MessageParcel** object. **Example** - ``` + ```ts class MySequenceable { num: number; str: string; @@ -5694,7 +5627,6 @@ Unmarshals this sequenceable object from a **MessageParcel** object. console.log("RpcClient: readSequenceable is " + result2); ``` - ## IRemoteBroker Provides the holder of a remote proxy object. @@ -5715,17 +5647,44 @@ Obtains a proxy or remote object. This API must be implemented by its derived cl **Example** - ``` + ```ts class TestAbility extends rpc.RemoteObject { asObject() { return this; } } + let remoteObject = new TestAbility().asObject(); ``` **Example** + Obtain the service. + + ```ts + import FA from "@ohos.ability.featureAbility"; + let proxy; + let connect = { + onConnect: function (elementName, remoteProxy) { + console.log("RpcClient: js onConnect called."); + proxy = remoteProxy; + }, + onDisconnect: function (elementName) { + console.log("RpcClient: onDisconnect"); + }, + onFailed: function () { + console.log("RpcClient: onFailed"); + } + }; + let want = { + "bundleName": "com.ohos.server", + "abilityName": "com.ohos.server.MainAbility", + }; + FA.connectAbility(want, connect); ``` + + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **asObject()** of the proxy object is called to obtain the proxy or remote object. + + ```ts class TestProxy { remote: rpc.RemoteObject; constructor(remote) { @@ -5735,6 +5694,8 @@ Obtains a proxy or remote object. This API must be implemented by its derived cl return this.remote; } } + let iRemoteObject = new TestProxy(proxy).asObject(); + ``` ## DeathRecipient @@ -5751,7 +5712,7 @@ Called to perform subsequent operations when a death notification of the remote **Example** - ``` + ```ts class MyDeathRecipient { onRemoteDied() { console.log("server died"); @@ -5795,7 +5756,7 @@ Provides methods to query of obtain interface descriptors, add or delete death n getLocalInterface(descriptor: string): IRemoteBroker -Obtains the interface. +Obtains the interface descriptor. **System capability**: SystemCapability.Communication.IPC.Core @@ -5817,7 +5778,7 @@ Obtains the interface. queryLocalInterface(descriptor: string): IRemoteBroker -Obtains the interface. +Queries the interface descriptor. **System capability**: SystemCapability.Communication.IPC.Core @@ -5833,14 +5794,13 @@ Obtains the interface. | ------------- | --------------------------------------------- | | IRemoteBroker | **IRemoteBroker** object bound to the specified interface token.| - ### sendRequest(deprecated) >This API is no longer maintained since API version 9. You are advised to use [sendMessageRequest](#sendmessagerequest9). sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption): boolean -Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If **options** is the asynchronous mode, a promise will be fulfilled immediately and the reply message does not contain any content. If **options** is the synchronous mode, a promise will be fulfilled when the response to **sendRequest** is returned, and the reply message contains the returned information. +Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If asynchronous mode is set in **options**, a promise will be fulfilled immediately and the reply message does not contain any content. If synchronous mode is set in **options** , a promise will be fulfilled when the response to **sendRequest** is returned, and the reply message contains the returned information. **System capability**: SystemCapability.Communication.IPC.Core @@ -5857,7 +5817,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch | Type | Description | | ------- | --------------------------------------------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + | boolean | Returns **true** if the message is sent successfully; returns **false** otherwise.| ### sendRequest8+(deprecated) @@ -5866,7 +5826,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption): Promise<SendRequestResult> -Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If **options** is the asynchronous mode, a promise will be fulfilled immediately and the reply message does not contain any content. If **options** is the synchronous mode, a promise will be fulfilled when the response to **sendRequest** is returned, and the reply message contains the returned information. +Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If asynchronous mode is set in **options**, a promise will be fulfilled immediately and the reply message is empty. The specific reply needs to be obtained from the callback on the service side. If synchronous mode is set in **options**, a promise will be fulfilled when the response to **sendRequest** is returned, and the reply message contains the returned information. **System capability**: SystemCapability.Communication.IPC.Core @@ -5890,7 +5850,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption): Promise<RequestResult> -Sends a **MessageSequence** message to the remote process in synchronous or asynchronous mode. If **options** is the asynchronous mode, a promise will be fulfilled immediately and the reply message does not contain any content. If **options** is the synchronous mode, a promise will be fulfilled when the response to **sendMessageRequest** is returned, and the reply message contains the returned information. +Sends a **MessageSequence** message to the remote process in synchronous or asynchronous mode. If asynchronous mode is set in **options**, a promise will be fulfilled immediately and the reply message is empty. The specific reply needs to be obtained from the callback on the service side. If synchronous mode is set in **options**, a promise will be fulfilled when the response to **sendMessageRequest** is returned, and the reply message contains the returned information. **System capability**: SystemCapability.Communication.IPC.Core @@ -5914,7 +5874,7 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption, callback: AsyncCallback<RequestResult>): void -Sends a **MessageSequence** message to the remote process in synchronous or asynchronous mode. If **options** is the asynchronous mode, a callback will be invoked immediately and the reply message does not contain any content. If **options** is the synchronous mode, a callback will be invoked when the response to sendRequest is returned, and the reply message contains the returned information. +Sends a **MessageSequence** message to the remote process in synchronous or asynchronous mode. If asynchronous mode is set in **options**, a callback will be called immediately, and the reply message is empty. The specific reply needs to be obtained from the callback on the service side. If synchronous mode is set in **options**, a callback will be invoked when the response to sendRequest is returned, and the reply message contains the returned information. **System capability**: SystemCapability.Communication.IPC.Core @@ -5928,14 +5888,13 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | | callback | AsyncCallback<RequestResult> | Yes | Callback for receiving the sending result. | - ### sendRequest8+(deprecated) >This API is no longer maintained since API version 9. You are advised to use [sendMessageRequest](#sendmessagerequest9). sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption, callback: AsyncCallback<SendRequestResult>): void -Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If **options** is the asynchronous mode, a callback will be invoked immediately and the reply message does not contain any content. If **options** is the synchronous mode, a callback will be invoked when the response to sendRequest is returned, and the reply message contains the returned information. +Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If asynchronous mode is set in **options**, a callback will be called immediately, and the reply message is empty. The specific reply needs to be obtained from the callback on the service side. If synchronous mode is set in **options**, a callback will be invoked when the response to sendRequest is returned, and the reply message contains the returned information. **System capability**: SystemCapability.Communication.IPC.Core @@ -5949,12 +5908,11 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | | callback | AsyncCallback<SendRequestResult> | Yes | Callback for receiving the sending result. | - ### registerDeathRecipient9+ registerDeathRecipient(recipient: DeathRecipient, flags: number): void -Adds a callback for receiving death notifications of the remote object. This method is called if the remote object process matching the **RemoteProxy** object is killed. +Registers a callback for receiving death notifications of the remote object. The callback will be called if the remote object process matching the **RemoteProxy** object is killed. **System capability**: SystemCapability.Communication.IPC.Core @@ -5962,10 +5920,10 @@ Adds a callback for receiving death notifications of the remote object. This met | Name | Type | Mandatory| Description | | --------- | --------------------------------- | ---- | -------------- | - | recipient | [DeathRecipient](#deathrecipient) | Yes | Callback to add.| + | recipient | [DeathRecipient](#deathrecipient) | Yes | Callback to register.| | flags | number | Yes | Flag of the death notification.| -**Error Code** +**Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). @@ -5973,7 +5931,6 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode | ------- | -------- | | 1900008 | proxy or remote object is invalid | - ### addDeathrecipient(deprecated) >This API is no longer maintained since API version 9. You are advised to use [registerDeathRecipient](#registerdeathrecipient9). @@ -6002,7 +5959,7 @@ Adds a callback for receiving death notifications of the remote object. This met unregisterDeathRecipient(recipient: DeathRecipient, flags: number): void -Removes the callback used to receive death notifications of the remote object. +Unregisters the callback used to receive death notifications of the remote object. **System capability**: SystemCapability.Communication.IPC.Core @@ -6010,10 +5967,10 @@ Removes the callback used to receive death notifications of the remote object. | Name | Type | Mandatory| Description | | --------- | --------------------------------- | ---- | -------------- | - | recipient | [DeathRecipient](#deathrecipient) | Yes | Callback to remove.| + | recipient | [DeathRecipient](#deathrecipient) | Yes | Callback to unregister.| | flags | number | Yes | Flag of the death notification.| -**Error Code** +**Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). @@ -6021,7 +5978,6 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode | ------- | -------- | | 1900008 | proxy or remote object is invalid | - ### removeDeathRecipient(deprecated) >This API is no longer maintained since API version 9. You are advised to use [unregisterDeathRecipient](#unregisterdeathrecipient9). @@ -6043,14 +5999,13 @@ Removes the callback used to receive death notifications of the remote object. | Type | Description | | ------- | --------------------------------------------- | - | boolean | Returns **true** if the callback is removed successfully; returns **false** otherwise.| - + | boolean | Returns **true** if the callback is removed; returns **false** otherwise.| ### getDescriptor9+ getDescriptor(): string -Obtains the interface descriptor of this object. The interface descriptor is a string. +Obtains the interface descriptor (which is a string) of this object. **System capability**: SystemCapability.Communication.IPC.Core @@ -6060,7 +6015,7 @@ Obtains the interface descriptor of this object. The interface descriptor is a s | ------ | ---------------- | | string | Interface descriptor obtained.| -**Error Code** +**Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). @@ -6075,7 +6030,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode getInterfaceDescriptor(): string -Obtains the interface descriptor of this object. The interface descriptor is a string. +Obtains the interface descriptor (which is a string) of this object. **System capability**: SystemCapability.Communication.IPC.Core @@ -6115,14 +6070,13 @@ Provides APIs to implement **IRemoteObject**. | MIN_TRANSACTION_ID | 1 (0x00000001) | Minimum valid instruction code. | | MAX_TRANSACTION_ID | 16777215 (0x00FFFFFF) | Maximum valid instruction code. | - ### sendRequest(deprecated) >This API is no longer maintained since API version 9. You are advised to use [sendMessageRequest](#sendmessagerequest9). sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption): boolean -Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If **options** is the asynchronous mode, a promise will be fulfilled immediately and the reply message does not contain any content. If **options** is the synchronous mode, a promise will be fulfilled when the response to **sendRequest** is returned, and the reply message contains the returned information. +Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If asynchronous mode is set in **options**, a promise will be fulfilled immediately and the reply message is empty. The specific reply needs to be obtained from the callback on the service side. If synchronous mode is set in **options**, a promise will be fulfilled when the response to **sendRequest** is returned, and the reply message contains the returned information. **System capability**: SystemCapability.Communication.IPC.Core @@ -6139,11 +6093,13 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch | Type | Description | | ------- | --------------------------------------------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + | boolean | Returns **true** if the message is sent successfully; returns **false** otherwise.| **Example** - ``` + Obtain the service. + + ```ts import FA from "@ohos.ability.featureAbility"; let proxy; let connect = { @@ -6163,6 +6119,11 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch "abilityName": "com.ohos.server.MainAbility", }; FA.connectAbility(want, connect); + ``` + + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **sendMessageRequest()** of the proxy object is called to send a message. + + ```ts let option = new rpc.MessageOption(); let data = rpc.MessageParcel.create(); let reply = rpc.MessageParcel.create(); @@ -6181,12 +6142,11 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch reply.reclaim(); ``` - ### sendMessageRequest9+ sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption): Promise<RequestResult> -Sends a **MessageSequence** message to the remote process in synchronous or asynchronous mode. If **options** is the asynchronous mode, a promise will be fulfilled immediately and the reply message does not contain any content. If **options** is the synchronous mode, a promise will be fulfilled when the response to **sendMessageRequest** is returned, and the reply message contains the returned information. +Sends a **MessageSequence** message to the remote process in synchronous or asynchronous mode. If asynchronous mode is set in **options**, a promise will be fulfilled immediately and the reply message is empty. The specific reply needs to be obtained from the callback on the service side. If synchronous mode is set in **options**, a promise will be fulfilled when the response to **sendMessageRequest** is returned, and the reply message contains the returned information. **System capability**: SystemCapability.Communication.IPC.Core @@ -6207,7 +6167,9 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn **Example** - ``` + Obtain the service. + + ```ts import FA from "@ohos.ability.featureAbility"; let proxy; let connect = { @@ -6227,6 +6189,11 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn "abilityName": "com.ohos.server.MainAbility", }; FA.connectAbility(want, connect); + ``` + + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **sendMessageRequest()** of the proxy object is called to send a message. + + ```ts let option = new rpc.MessageOption(); let data = rpc.MessageSequence.create(); let reply = rpc.MessageSequence.create(); @@ -6251,14 +6218,13 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn }); ``` - ### sendRequest8+(deprecated) >This API is no longer maintained since API version 9. You are advised to use [sendMessageRequest](#sendmessagerequest9). sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption): Promise<SendRequestResult> -Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If **options** is the asynchronous mode, a promise will be fulfilled immediately and the reply message does not contain any content. If **options** is the synchronous mode, a promise will be fulfilled when the response to **sendRequest** is returned, and the reply message contains the returned information. +Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If asynchronous mode is set in **options**, a promise will be fulfilled immediately and the reply message is empty. The specific reply needs to be obtained from the callback on the service side. If synchronous mode is set in **options**, a promise will be fulfilled when the response to **sendRequest** is returned, and the reply message contains the returned information. **System capability**: SystemCapability.Communication.IPC.Core @@ -6279,7 +6245,9 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch **Example** - ``` + Obtain the service. + + ```ts import FA from "@ohos.ability.featureAbility"; let proxy; let connect = { @@ -6299,6 +6267,11 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch "abilityName": "com.ohos.server.MainAbility", }; FA.connectAbility(want, connect); + ``` + + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **sendMessageRequest()** of the proxy object is called to send a message. + + ```ts let option = new rpc.MessageOption(); let data = rpc.MessageParcel.create(); let reply = rpc.MessageParcel.create(); @@ -6327,7 +6300,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption, callback: AsyncCallback<RequestResult>): void -Sends a **MessageSequence** message to the remote process in synchronous or asynchronous mode. If **options** is the asynchronous mode, a callback will be invoked immediately and the reply message does not contain any content. If **options** is the synchronous mode, a callback will be invoked at certain time after the response to **sendMessageRequest** is returned, and the reply contains the returned information. +Sends a **MessageSequence** message to the remote process in synchronous or asynchronous mode. If asynchronous mode is set in **options**, a callback will be called immediately, and the reply message is empty. The specific reply needs to be obtained from the callback on the service side. If synchronous mode is set in **options**, a callback will be invoked at certain time after the response to **sendMessageRequest** is returned, and the reply contains the returned information. **System capability**: SystemCapability.Communication.IPC.Core @@ -6341,10 +6314,11 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | | callback | AsyncCallback<RequestResult> | Yes | Callback for receiving the sending result. | - **Example** + + Obtain the service. - ``` + ```ts import FA from "@ohos.ability.featureAbility"; let proxy; let connect = { @@ -6377,6 +6351,11 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn result.reply.reclaim(); } FA.connectAbility(want, connect); + ``` + + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **sendMessageRequest()** of the proxy object is called to send a message. + + ```ts let option = new rpc.MessageOption(); let data = rpc.MessageSequence.create(); let reply = rpc.MessageSequence.create(); @@ -6390,14 +6369,13 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn } ``` - ### sendRequest8+(deprecated) >This API is no longer maintained since API version 9. You are advised to use [sendMessageRequest](#sendmessagerequest9). sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption, callback: AsyncCallback<SendRequestResult>): void -Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If **options** is the asynchronous mode, a callback will be invoked immediately and the reply message does not contain any content. If **options** is the synchronous mode, a callback will be invoked when the response to sendRequest is returned, and the reply message contains the returned information. +Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If asynchronous mode is set in **options**, a callback will be called immediately, and the reply message is empty. The specific reply needs to be obtained from the callback on the service side. If synchronous mode is set in **options**, a callback will be invoked when the response to sendRequest is returned, and the reply message contains the returned information. **System capability**: SystemCapability.Communication.IPC.Core @@ -6413,7 +6391,9 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch **Example** - ``` + Obtain the service. + + ```ts import FA from "@ohos.ability.featureAbility"; let proxy; let connect = { @@ -6446,6 +6426,11 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch result.reply.reclaim(); } FA.connectAbility(want, connect); + ``` + + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **sendMessageRequest()** of the proxy object is called to send a message. + + ```ts let option = new rpc.MessageOption(); let data = rpc.MessageParcel.create(); let reply = rpc.MessageParcel.create(); @@ -6454,7 +6439,6 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch proxy.sendRequest(1, data, reply, option, sendRequestCallback); ``` - ### getLocalInterface9+ getLocalInterface(interface: string): IRemoteBroker @@ -6475,7 +6459,7 @@ Obtains the **LocalInterface** object of an interface token. | ------------- | ------------------------------------------ | | IRemoteBroker | Returns **Null** by default, which indicates a proxy interface.| -**Error Code** +**Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). @@ -6485,7 +6469,9 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + Obtain the service. + + ```ts import FA from "@ohos.ability.featureAbility"; let proxy; let connect = { @@ -6505,6 +6491,11 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode "abilityName":"com.ohos.server.MainAbility", }; FA.connectAbility(want, connect); + ``` + + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **getLocalInterface()** of the proxy object is called to obtain the interface descriptor. + + ```ts try { let broker = proxy.getLocalInterface("testObject"); console.log("RpcClient: getLocalInterface is " + broker); @@ -6514,7 +6505,6 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode } ``` - ### queryLocalInterface(deprecated) >This API is no longer maintained since API version 9. You are advised to use [getLocalInterface](#getlocalinterface9). @@ -6539,7 +6529,9 @@ Obtains the **LocalInterface** object of an interface token. **Example** - ``` + Obtain the service. + + ```ts import FA from "@ohos.ability.featureAbility"; let proxy; let connect = { @@ -6559,16 +6551,20 @@ Obtains the **LocalInterface** object of an interface token. "abilityName":"com.ohos.server.MainAbility", }; FA.connectAbility(want, connect); + ``` + + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **queryLocalInterface()** of the proxy object is called to obtain the interface descriptor. + + ```ts let broker = proxy.queryLocalInterface("testObject"); console.log("RpcClient: queryLocalInterface is " + broker); ``` - ### registerDeathRecipient9+ registerDeathRecipient(recipient: DeathRecipient, flags: number): void -Adds a callback for receiving death notifications of the remote object. This method is called if the remote object process matching the **RemoteProxy** object is killed. +Registers a callback for receiving death notifications of the remote object. The callback will be invoked when the remote object process matching the **RemoteProxy** object is killed. **System capability**: SystemCapability.Communication.IPC.Core @@ -6576,10 +6572,10 @@ Adds a callback for receiving death notifications of the remote object. This met | Name | Type | Mandatory| Description | | --------- | --------------------------------- | ---- | -------------- | - | recipient | [DeathRecipient](#deathrecipient) | Yes | Callback to add.| + | recipient | [DeathRecipient](#deathrecipient) | Yes | Callback to register.| | flags | number | Yes | Flag of the death notification.| -**Error Code** +**Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). @@ -6589,7 +6585,9 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + Obtain the service. + + ```ts import FA from "@ohos.ability.featureAbility"; let proxy; let connect = { @@ -6609,6 +6607,11 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode "abilityName": "com.ohos.server.MainAbility", }; FA.connectAbility(want, connect); + ``` + + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **registerDeathRecipient()** of the proxy object is called to register a callback for receiving the death notification of the remote object. + + ```ts class MyDeathRecipient { onRemoteDied() { console.log("server died"); @@ -6616,14 +6619,13 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode } let deathRecipient = new MyDeathRecipient(); try { - proxy.registerDeathRecippient(deathRecipient, 0); + proxy.registerDeathRecipient(deathRecipient, 0); } catch(error) { console.info("proxy register deathRecipient fail, errorCode " + error.code); console.info("proxy register deathRecipient fail, errorMessage " + error.message); } ``` - ### addDeathRecippient(deprecated) >This API is no longer maintained since API version 9. You are advised to use [registerDeathRecipient](#registerdeathrecipient9). @@ -6649,7 +6651,9 @@ Adds a callback for receiving the death notifications of the remote object, incl **Example** - ``` + Obtain the service. + + ```ts import FA from "@ohos.ability.featureAbility"; let proxy; let connect = { @@ -6669,20 +6673,25 @@ Adds a callback for receiving the death notifications of the remote object, incl "abilityName": "com.ohos.server.MainAbility", }; FA.connectAbility(want, connect); + ``` + + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **addDeathRecippient()** of the proxy object is called to add a callback for receiving the death notification of the remove object. + + ```ts class MyDeathRecipient { onRemoteDied() { console.log("server died"); } } let deathRecipient = new MyDeathRecipient(); - proxy.addDeathRecippient(deathRecipient, 0); + proxy.addDeathRecipient(deathRecipient, 0); ``` ### unregisterDeathRecipient9+ -unregisterDeathRecipient(recipient: DeathRecipient, flags: number): boolean +unregisterDeathRecipient(recipient: DeathRecipient, flags: number): void -Removes the callback used to receive death notifications of the remote object. +Unregisters the callback used to receive death notifications of the remote object. **System capability**: SystemCapability.Communication.IPC.Core @@ -6690,10 +6699,10 @@ Removes the callback used to receive death notifications of the remote object. | Name | Type | Mandatory| Description | | --------- | --------------------------------- | ---- | -------------- | - | recipient | [DeathRecipient](#deathrecipient) | Yes | Callback to remove.| + | recipient | [DeathRecipient](#deathrecipient) | Yes | Callback to unregister.| | flags | number | Yes | Flag of the death notification.| -**Error Code** +**Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). @@ -6703,7 +6712,9 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + Obtain the service. + + ```ts import FA from "@ohos.ability.featureAbility"; let proxy; let connect = { @@ -6723,6 +6734,11 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode "abilityName": "com.ohos.server.MainAbility", }; FA.connectAbility(want, connect); + ``` + + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **unregisterDeathRecipient()** of the proxy object is called to unregister the callback for receiving the death notification of the remote object. + + ```ts class MyDeathRecipient { onRemoteDied() { console.log("server died"); @@ -6738,7 +6754,6 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode } ``` - ### removeDeathRecipient(deprecated) >This API is no longer maintained since API version 9. You are advised to use [unregisterDeathRecipient](#unregisterdeathrecipient9). @@ -6760,11 +6775,13 @@ Removes the callback used to receive death notifications of the remote object. | Type | Description | | ------- | --------------------------------------------- | - | boolean | Returns **true** if the callback is removed successfully; returns **false** otherwise.| + | boolean | Returns **true** if the callback is removed; returns **false** otherwise.| **Example** - ``` + Obtain the service. + + ```ts import FA from "@ohos.ability.featureAbility"; let proxy; let connect = { @@ -6784,6 +6801,11 @@ Removes the callback used to receive death notifications of the remote object. "abilityName": "com.ohos.server.MainAbility", }; FA.connectAbility(want, connect); + ``` + + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **removeDeathRecipient()** of the proxy object is called to remove the callback used to receive the death notification of the remote object. + + ```ts class MyDeathRecipient { onRemoteDied() { console.log("server died"); @@ -6794,12 +6816,11 @@ Removes the callback used to receive death notifications of the remote object. proxy.removeDeathRecipient(deathRecipient, 0); ``` - ### getDescriptor9+ getDescriptor(): string -Obtains the interface descriptor of this object. The interface descriptor is a string. +Obtains the interface descriptor (which is a string) of this proxy object. **System capability**: SystemCapability.Communication.IPC.Core @@ -6809,7 +6830,7 @@ Obtains the interface descriptor of this object. The interface descriptor is a s | ------ | ---------------- | | string | Interface descriptor obtained.| -**Error Code** +**Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). @@ -6820,7 +6841,9 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + Obtain the service. + + ```ts import FA from "@ohos.ability.featureAbility"; let proxy; let connect = { @@ -6840,6 +6863,10 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode "abilityName": "com.ohos.server.MainAbility", }; FA.connectAbility(want, connect); + ``` + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **getDescriptor()** of the proxy object is called to obtain the interface descriptor of the object. + + ```ts try { let descriptor = proxy.getDescriptor(); console.log("RpcClient: descriptor is " + descriptor); @@ -6849,7 +6876,6 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode } ``` - ### getInterfaceDescriptor(deprecated) >This API is no longer maintained since API version 9. You are advised to use [getDescriptor](#getdescriptor9). @@ -6868,7 +6894,9 @@ Obtains the interface descriptor of this proxy object. **Example** - ``` + Obtain the service. + + ```ts import FA from "@ohos.ability.featureAbility"; let proxy; let connect = { @@ -6888,11 +6916,15 @@ Obtains the interface descriptor of this proxy object. "abilityName": "com.ohos.server.MainAbility", }; FA.connectAbility(want, connect); + ``` + +The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **getInterfaceDescriptor()** of the proxy object is called to obtain the interface descriptor of the current proxy object. + + ```ts let descriptor = proxy.getInterfaceDescriptor(); console.log("RpcClient: descriptor is " + descriptor); ``` - ### isObjectDead isObjectDead(): boolean @@ -6909,7 +6941,9 @@ Checks whether the **RemoteObject** is dead. **Example** - ``` + Obtain the service. + + ```ts import FA from "@ohos.ability.featureAbility"; let proxy; let connect = { @@ -6929,11 +6963,15 @@ Checks whether the **RemoteObject** is dead. "abilityName": "com.ohos.server.MainAbility", }; FA.connectAbility(want, connect); + ``` + + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **isObjectDead()** of the proxy object is called to check whether this object is dead. + + ```ts let isDead = proxy.isObjectDead(); console.log("RpcClient: isObjectDead is " + isDead); ``` - ## MessageOption Provides common message options (flag and wait time). Use the specified flag to construct the **MessageOption** object. @@ -6963,6 +7001,16 @@ A constructor used to create a **MessageOption** object. | syncFlags | number | No | Call flag, which can be synchronous or asynchronous. The default value is **synchronous**.| +**Example** + + ```ts + class TestRemoteObject extends rpc.MessageOption { + constructor(async) { + super(async); + } + } + ``` + ### constructor constructor(syncFlags?: number, waitTime?: number) @@ -6978,7 +7026,15 @@ A constructor used to create a **MessageOption** object. | syncFlags | number | No | Call flag, which can be synchronous or asynchronous. The default value is **synchronous**. | | waitTime | number | No | Maximum wait time for an RPC call. The default value is **TF_WAIT_TIME**.| +**Example** + ```ts + class TestRemoteObject extends rpc.MessageOption { + constructor(syncFlags,waitTime) { + super(syncFlags,waitTime); + } + } + ``` ### isAsync9+ isAsync(): boolean; @@ -6991,8 +7047,14 @@ Checks whether **SendMessageRequest** is called synchronously or asynchronously. | Type | Description | | ------- | ------------------------------------ | - | boolean | Call mode obtained.| + | boolean | Returns **true** if **SendMessageRequest** is called synchronously; returns **false** if **SendMessageRequest** is called asynchronously.| +**Example** + + ```ts + let option = new rpc.MessageOption(); + let isAsync = option.isAsync(); + ``` ### setAsync9+ @@ -7002,6 +7064,13 @@ Sets whether **SendMessageRequest** is called synchronously or asynchronously. **System capability**: SystemCapability.Communication.IPC.Core +**Example** + + ```ts + let option = new rpc.MessageOption(); + let setAsync = option.setAsync(true); + console.log("Set synchronization flag"); + ``` ### getFlags @@ -7017,7 +7086,23 @@ Obtains the call flag, which can be synchronous or asynchronous. | ------ | ------------------------------------ | | number | Call mode obtained.| +**Example** + ```ts + try { + let option = new rpc.MessageOption(); + console.info("create object successfully."); + let flog = option.getFlags(); + console.info("run getFlags success, flog is " + flog); + option.setFlags(1) + console.info("run setFlags success"); + let flog2 = option.getFlags(); + console.info("run getFlags success, flog2 is " + flog2); + } catch (error) { + console.info("error " + error); + } + ``` + ### setFlags setFlags(flags: number): void @@ -7032,6 +7117,19 @@ Sets the call flag, which can be synchronous or asynchronous. | ------ | ------ | ---- | ------------------------ | | flags | number | Yes | Call flag to set.| +**Example** + + ```ts + try { + let option = new rpc.MessageOption(); + option.setFlags(1) + console.info("run setFlags success"); + let flog = option.getFlags(); + console.info("run getFlags success, flog is " + flog); + } catch (error) { + console.info("error " + error); + } + ``` ### getWaitTime @@ -7047,6 +7145,20 @@ Obtains the maximum wait time for this RPC call. | ------ | ----------------- | | number | Maximum wait time obtained.| +**Example** + + ```ts + try { + let option = new rpc.MessageOption(); + let time = option.getWaitTime(); + console.info("run getWaitTime success"); + option.setWaitTime(16); + let time2 = option.getWaitTime(); + console.info("run getWaitTime success, time is " + time); + } catch (error) { + console.info("error " + error); + } + ``` ### setWaitTime @@ -7062,6 +7174,18 @@ Sets the maximum wait time for this RPC call. | -------- | ------ | ---- | --------------------- | | waitTime | number | Yes | Maximum wait time to set.| +**Example** + + ```ts + try { + let option = new rpc.MessageOption(); + option.setWaitTime(16); + let time = option.getWaitTime(); + console.info("run getWaitTime success, time is " + time); + } catch (error) { + console.info("error " + error); + } + ``` ## IPCSkeleton @@ -7071,7 +7195,7 @@ Obtains IPC context information, including the UID and PID, local and remote dev static getContextObject(): IRemoteObject -Obtains the system capability manager. +Obtains the system capability manager. This API is a static method. **System capability**: SystemCapability.Communication.IPC.Core @@ -7083,17 +7207,16 @@ Obtains the system capability manager. **Example** - ``` + ```ts let samgr = rpc.IPCSkeleton.getContextObject(); console.log("RpcServer: getContextObject result: " + samgr); ``` - ### getCallingPid static getCallingPid(): number -Obtains the PID of the caller. This method is invoked by the **RemoteObject** object in the **onRemoteRequest** method. If this method is not invoked in the IPC context (**onRemoteRequest**), the PID of the process will be returned. +Obtains the PID of the caller. This API is a static method, which is invoked by the **RemoteObject** object in the **onRemoteRequest** method. If this method is not invoked in the IPC context (**onRemoteRequest**), the PID of the process will be returned. **System capability**: SystemCapability.Communication.IPC.Core @@ -7105,7 +7228,7 @@ Obtains the PID of the caller. This method is invoked by the **RemoteObject** ob **Example** - ``` + ```ts class Stub extends rpc.RemoteObject { onRemoteMessageRequest(code, data, reply, option) { let callerPid = rpc.IPCSkeleton.getCallingPid(); @@ -7115,12 +7238,11 @@ Obtains the PID of the caller. This method is invoked by the **RemoteObject** ob } ``` - ### getCallingUid static getCallingUid(): number -Obtains the UID of the caller. This method is invoked by the **RemoteObject** object in the **onRemoteRequest** method. If this method is not invoked in the IPC context (**onRemoteRequest**), the UID of the process will be returned. +Obtains the UID of the caller. This API is a static method, which is invoked by the **RemoteObject** object in the **onRemoteRequest** method. If this method is not invoked in the IPC context (**onRemoteRequest**), the UID of the process will be returned. **System capability**: SystemCapability.Communication.IPC.Core @@ -7132,7 +7254,7 @@ Obtains the UID of the caller. This method is invoked by the **RemoteObject** ob **Example** - ``` + ```ts class Stub extends rpc.RemoteObject { onRemoteMessageRequest(code, data, reply, option) { let callerUid = rpc.IPCSkeleton.getCallingUid(); @@ -7142,7 +7264,6 @@ Obtains the UID of the caller. This method is invoked by the **RemoteObject** ob } ``` - ### getCallingTokenId8+ static getCallingTokenId(): number; @@ -7151,7 +7272,6 @@ Obtains the caller's token ID, which is used to verify the caller identity. **System capability**: SystemCapability.Communication.IPC.Core - **Return value** | Type | Description | @@ -7160,7 +7280,7 @@ Obtains the caller's token ID, which is used to verify the caller identity. **Example** - ``` + ```ts class Stub extends rpc.RemoteObject { onRemoteMessageRequest(code, data, reply, option) { let callerTokenId = rpc.IPCSkeleton.getCallingTokenId(); @@ -7175,7 +7295,7 @@ Obtains the caller's token ID, which is used to verify the caller identity. static getCallingDeviceID(): string -Obtains the ID of the device hosting the caller's process. +Obtains the ID of the device hosting the caller's process. This API is a static method. **System capability**: SystemCapability.Communication.IPC.Core @@ -7187,7 +7307,7 @@ Obtains the ID of the device hosting the caller's process. **Example** - ``` + ```ts class Stub extends rpc.RemoteObject { onRemoteMessageRequest(code, data, reply, option) { let callerDeviceID = rpc.IPCSkeleton.getCallingDeviceID(); @@ -7197,12 +7317,11 @@ Obtains the ID of the device hosting the caller's process. } ``` - ### getLocalDeviceID static getLocalDeviceID(): string -Obtains the local device ID. +Obtains the local device ID. This API is a static method. **System capability**: SystemCapability.Communication.IPC.Core @@ -7214,7 +7333,7 @@ Obtains the local device ID. **Example** - ``` + ```ts class Stub extends rpc.RemoteObject { onRemoteMessageRequest(code, data, reply, option) { let localDeviceID = rpc.IPCSkeleton.getLocalDeviceID(); @@ -7224,12 +7343,11 @@ Obtains the local device ID. } ``` - ### isLocalCalling static isLocalCalling(): boolean -Checks whether the remote process is a process of the local device. +Checks whether the remote process is a process of the local device. This API is a static method. **System capability**: SystemCapability.Communication.IPC.Core @@ -7241,7 +7359,7 @@ Checks whether the remote process is a process of the local device. **Example** - ``` + ```ts class Stub extends rpc.RemoteObject { onRemoteMessageRequest(code, data, reply, option) { let isLocalCalling = rpc.IPCSkeleton.isLocalCalling(); @@ -7251,12 +7369,11 @@ Checks whether the remote process is a process of the local device. } ``` - ### flushCmdBuffer9+ static flushCmdBuffer(object: IRemoteObject): void -Flushes all suspended commands from the specified **RemoteProxy** to the corresponding **RemoteObject**. It is recommended that this method be called before any time-sensitive operation is performed. +Flushes all suspended commands from the specified **RemoteProxy** to the corresponding **RemoteObject**. This API is a static method. It is recommended that this method be called before any time-sensitive operation is performed. **System capability**: SystemCapability.Communication.IPC.Core @@ -7269,7 +7386,7 @@ Flushes all suspended commands from the specified **RemoteProxy** to the corresp **Example** - ``` + ```ts class TestRemoteObject extends rpc.RemoteObject { constructor(descriptor) { super(descriptor); @@ -7284,14 +7401,13 @@ Flushes all suspended commands from the specified **RemoteProxy** to the corresp } ``` - ### flushCommands(deprecated) >This API is no longer maintained since API version 9. You are advised to use [flushCmdBuffer](#flushcmdbuffer9). static flushCommands(object: IRemoteObject): number -Flushes all suspended commands from the specified **RemoteProxy** to the corresponding **RemoteObject**. It is recommended that this method be called before any time-sensitive operation is performed. +Flushes all suspended commands from the specified **RemoteProxy** to the corresponding **RemoteObject**. This API is a static method. It is recommended that this method be called before any time-sensitive operation is performed. **System capability**: SystemCapability.Communication.IPC.Core @@ -7309,7 +7425,7 @@ Flushes all suspended commands from the specified **RemoteProxy** to the corresp **Example** - ``` + ```ts class MyDeathRecipient { onRemoteDied() { console.log("server died"); @@ -7338,7 +7454,7 @@ Flushes all suspended commands from the specified **RemoteProxy** to the corresp static resetCallingIdentity(): string -Changes the UID and PID of the remote user to the UID and PID of the local user. This method is used in scenarios such as identity authentication. +Changes the UID and PID of the remote user to the UID and PID of the local user. This API is a static method. You can use it in scenarios such as identity authentication. **System capability**: SystemCapability.Communication.IPC.Core @@ -7350,7 +7466,7 @@ Changes the UID and PID of the remote user to the UID and PID of the local user. **Example** - ``` + ```ts class Stub extends rpc.RemoteObject { onRemoteMessageRequest(code, data, reply, option) { let callingIdentity = rpc.IPCSkeleton.resetCallingIdentity(); @@ -7365,7 +7481,7 @@ Changes the UID and PID of the remote user to the UID and PID of the local user. static restoreCallingIdentity(identity: string): void -Changes the UID and PID of the remote user to the UID and PID of the local user. This method is used in scenarios such as identity authentication. +Changes the UID and PID of the remote user to the UID and PID of the local user. This API is a static method. You can use it in scenarios such as identity authentication. **System capability**: SystemCapability.Communication.IPC.Core @@ -7377,7 +7493,7 @@ Changes the UID and PID of the remote user to the UID and PID of the local user. **Example** - ``` + ```ts class Stub extends rpc.RemoteObject { onRemoteMessageRequest(code, data, reply, option) { let callingIdentity = null; @@ -7392,14 +7508,13 @@ Changes the UID and PID of the remote user to the UID and PID of the local user. } ``` - ### setCallingIdentity(deprecated) >This API is no longer maintained since API version 9. You are advised to use [restoreCallingIdentity](#restorecallingidentity9). static setCallingIdentity(identity: string): boolean -Restores the UID and PID of the remote user. It is usually called when the UID and PID of the remote user are required. The UID and PID of the remote user are returned by **resetCallingIdentity**. +Sets the UID and PID of the remote user. This API is a static method. It is usually called when the UID and PID of the remote user are required. The UID and PID of the remote user are returned by **resetCallingIdentity**. **System capability**: SystemCapability.Communication.IPC.Core @@ -7417,7 +7532,7 @@ Restores the UID and PID of the remote user. It is usually called when the UID a **Example** - ``` + ```ts class Stub extends rpc.RemoteObject { onRemoteMessageRequest(code, data, reply, option) { let callingIdentity = null; @@ -7433,7 +7548,6 @@ Restores the UID and PID of the remote user. It is usually called when the UID a } ``` - ## RemoteObject Provides methods to implement **RemoteObject**. The service provider must inherit from this class. @@ -7459,7 +7573,7 @@ A constructor used to create a **RemoteObject** object. sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption): boolean -Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If **options** is the asynchronous mode, a promise will be fulfilled immediately and the reply message does not contain any content. If **options** is the synchronous mode, a promise will be fulfilled when the response to **sendRequest** is returned, and the reply message contains the returned information. +Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If asynchronous mode is set in **options**, a promise will be fulfilled immediately and the reply message is empty. The specific reply needs to be obtained from the callback on the service side. If synchronous mode is set in **options**, a promise will be fulfilled when the response to **sendRequest** is returned, and the reply message contains the returned information. **System capability**: SystemCapability.Communication.IPC.Core @@ -7476,11 +7590,11 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch | Type | Description | | ------- | --------------------------------------------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + | boolean | Returns **true** if the message is sent successfully; returns **false** otherwise.| **Example** - ``` + ```ts class MyDeathRecipient { onRemoteDied() { console.log("server died"); @@ -7519,14 +7633,13 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch reply.reclaim(); ``` - ### sendRequest8+(deprecated) >This API is no longer maintained since API version 9. You are advised to use [sendMessageRequest](#sendmessagerequest9). sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption): Promise<SendRequestResult> -Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If **options** is the asynchronous mode, a promise will be fulfilled immediately and the reply message does not contain any content. If **options** is the synchronous mode, a promise will be fulfilled when the response to **sendRequest** is returned, and the reply message contains the returned information. +Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If asynchronous mode is set in **options**, a promise will be fulfilled immediately and the reply message is empty. The specific reply needs to be obtained from the callback on the service side. If synchronous mode is set in **options**, a promise will be fulfilled when the response to **sendRequest** is returned, and the reply message contains the returned information. **System capability**: SystemCapability.Communication.IPC.Core @@ -7547,7 +7660,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch **Example** - ``` + ```ts class MyDeathRecipient { onRemoteDied() { console.log("server died"); @@ -7596,7 +7709,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption): Promise<RequestResult> -Sends a **MessageSequence** message to the remote process in synchronous or asynchronous mode. If **options** is the asynchronous mode, a promise will be fulfilled immediately and the reply message does not contain any content. If **options** is the synchronous mode, a promise will be fulfilled when the response to **sendMessageRequest** is returned, and the reply message contains the returned information. +Sends a **MessageSequence** message to the remote process in synchronous or asynchronous mode. If asynchronous mode is set in **options**, a promise will be fulfilled immediately and the reply message is empty. The specific reply needs to be obtained from the callback on the service side. If synchronous mode is set in **options**, a promise will be fulfilled when the response to **sendMessageRequest** is returned, and the reply message contains the returned information. **System capability**: SystemCapability.Communication.IPC.Core @@ -7617,7 +7730,7 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn **Example** - ``` + ```ts class TestRemoteObject extends rpc.RemoteObject { constructor(descriptor) { super(descriptor); @@ -7648,12 +7761,11 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn }); ``` - ### sendMessageRequest9+ sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption, callback: AsyncCallback<RequestResult>): void -Sends a **MessageSequence** message to the remote process in synchronous or asynchronous mode. If **options** is the asynchronous mode, a callback will be invoked immediately and the reply message does not contain any content. If **options** is the synchronous mode, a callback will be invoked when the response to **sendMessageRequest** is returned, and the reply message contains the returned information. +Sends a **MessageSequence** message to the remote process in synchronous or asynchronous mode. If asynchronous mode is set in **options**, a callback will be called immediately, and the reply message is empty. The specific reply needs to be obtained from the callback on the service side. If synchronous mode is set in **options**, a callback will be invoked when the response to **sendMessageRequest** is returned, and the reply message contains the returned information. **System capability**: SystemCapability.Communication.IPC.Core @@ -7669,7 +7781,7 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn **Example** - ``` + ```ts class TestRemoteObject extends rpc.RemoteObject { constructor(descriptor) { super(descriptor); @@ -7697,14 +7809,13 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn testRemoteObject.sendMessageRequest(1, data, reply, option, sendRequestCallback); ``` - ### sendRequest8+(deprecated) >This API is no longer maintained since API version 9. You are advised to use [sendMessageRequest](#sendmessagerequest9). sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption, callback: AsyncCallback<SendRequestResult>): void -Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If **options** is the asynchronous mode, a callback will be invoked immediately and the reply message does not contain any content. If **options** is the synchronous mode, a callback will be invoked when the response to sendRequest is returned, and the reply message contains the returned information. +Sends a **MessageParcel** message to the remote process in synchronous or asynchronous mode. If asynchronous mode is set in **options**, a callback will be called immediately, and the reply message is empty. The specific reply needs to be obtained from the callback on the service side. If synchronous mode is set in **options**, a callback will be invoked when the response to sendRequest is returned, and the reply message contains the returned information. **System capability**: SystemCapability.Communication.IPC.Core @@ -7720,7 +7831,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch **Example** - ``` + ```ts class MyDeathRecipient { onRemoteDied() { console.log("server died"); @@ -7762,7 +7873,6 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch testRemoteObject.sendRequest(1, data, reply, option, sendRequestCallback); ``` - ### onRemoteRequest8+(deprecated) >This API is no longer maintained since API version 9. You are advised to use [onRemoteMessageRequest](#onremotemessagerequest9). @@ -7790,7 +7900,7 @@ Provides a response to **sendMessageRequest()**. The server processes the reques **Example** - ```ets + ```ts class MyDeathRecipient { onRemoteDied() { console.log("server died"); @@ -7847,12 +7957,12 @@ Provides a response to **sendMessageRequest()**. The server processes the reques | Type | Description | | ----------------- | ---------------------------------------------------------------------------------------------- | - | boolean | Returns a Boolean value if the request is processed synchronously in **onRemoteMessageRequest**. If the operation is successful, **true** is returned. Otherwise, **false** is returned.| + | boolean | Returns a Boolean value if the request is processed synchronously in **onRemoteMessageRequest**. The value **true** means the operation is successful; the value **false** means the opposite.| | Promise\ | Returns a promise object if the request is processed asynchronously in **onRemoteMessageRequest**. | **Example**: Overload **onRemoteMessageRequest** to process requests synchronously. - ```ets + ```ts class TestRemoteObject extends rpc.RemoteObject { constructor(descriptor) { super(descriptor); @@ -7872,7 +7982,7 @@ Provides a response to **sendMessageRequest()**. The server processes the reques **Example**: Overload **onRemoteMessageRequest** to process requests asynchronously. - ```ets + ```ts class TestRemoteObject extends rpc.RemoteObject { constructor(descriptor) { super(descriptor); @@ -7895,7 +8005,7 @@ Provides a response to **sendMessageRequest()**. The server processes the reques **Example**: Overload **onRemoteMessageRequest** and **onRemoteRequest** to process requests synchronously. - ```ets + ```ts class TestRemoteObject extends rpc.RemoteObject { constructor(descriptor) { super(descriptor); @@ -7926,7 +8036,7 @@ Provides a response to **sendMessageRequest()**. The server processes the reques **Example**: Overload **onRemoteMessageRequest** and **onRemoteRequest** to process requests asynchronously. - ```ets + ```ts class TestRemoteObject extends rpc.RemoteObject { constructor(descriptor) { super(descriptor); @@ -7957,7 +8067,6 @@ Provides a response to **sendMessageRequest()**. The server processes the reques } ``` - ### getCallingUid getCallingUid(): number @@ -7973,7 +8082,7 @@ Obtains the UID of the remote process. **Example** - ``` + ```ts class TestRemoteObject extends rpc.RemoteObject { constructor(descriptor) { super(descriptor); @@ -7999,7 +8108,7 @@ Obtains the PID of the remote process. **Example** - ``` + ```ts class TestRemoteObject extends rpc.RemoteObject { constructor(descriptor) { super(descriptor); @@ -8013,7 +8122,7 @@ Obtains the PID of the remote process. getLocalInterface(descriptor: string): IRemoteBroker -Obtains the interface. +Obtains the interface descriptor. **System capability**: SystemCapability.Communication.IPC.Core @@ -8032,7 +8141,7 @@ Obtains the interface. **Example** - ``` + ```ts class MyDeathRecipient { onRemoteDied() { console.log("server died"); @@ -8042,8 +8151,12 @@ Obtains the interface. constructor(descriptor) { super(descriptor); } - registerDeathRecipient(recipient: MyDeathRecipient, flags: number); - unregisterDeathRecipient(recipient: MyDeathRecipient, flags: number); + registerDeathRecipient(recipient: MyDeathRecipient, flags: number) { + // Implement the method logic based on service requirements. + } + unregisterDeathRecipient(recipient: MyDeathRecipient, flags: number) { + // Implement the method logic based on service requirements. + } isObjectDead(): boolean { return false; } @@ -8052,12 +8165,11 @@ Obtains the interface. try { let broker = testRemoteObject.getLocalInterface("testObject"); } catch(error) { - console.info(rpc get local interface fail, errorCode " + error.code); - console.info(rpc get local interface fail, errorMessage " + error.message); + console.info("rpc get local interface fail, errorCode " + error.code); + console.info("rpc get local interface fail, errorMessage " + error.message); } ``` - ### queryLocalInterface(deprecated) >This API is no longer maintained since API version 9. You are advised to use [getLocalInterface](#getlocalinterface9). @@ -8082,7 +8194,7 @@ Checks whether the remote object corresponding to the specified interface token **Example** - ``` + ```ts class MyDeathRecipient { onRemoteDied() { console.log("server died"); @@ -8106,7 +8218,6 @@ Checks whether the remote object corresponding to the specified interface token let broker = testRemoteObject.queryLocalInterface("testObject"); ``` - ### getDescriptor9+ getDescriptor(): string @@ -8121,7 +8232,7 @@ Obtains the interface descriptor of this object. The interface descriptor is a s | ------ | ---------------- | | string | Interface descriptor obtained.| -**Error Code** +**Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). @@ -8131,7 +8242,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts class MyDeathRecipient { onRemoteDied() { console.log("server died"); @@ -8141,8 +8252,12 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode constructor(descriptor) { super(descriptor); } - addDeathRecipient(recipient: MyDeathRecipient, flags: number); - unregisterDeathRecipient(recipient: MyDeathRecipient, flags: number); + registerDeathRecipient(recipient: MyDeathRecipient, flags: number) { + // Implement the method logic based on service requirements. + } + unregisterDeathRecipient(recipient: MyDeathRecipient, flags: number) { + // Implement the method logic based on service requirements. + } isObjectDead(): boolean { return false; } @@ -8151,13 +8266,12 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode try { let descriptor = testRemoteObject.getDescriptor(); } catch(error) { - console.info(rpc get local interface fail, errorCode " + error.code); - console.info(rpc get local interface fail, errorMessage " + error.message); + console.info("rpc get local interface fail, errorCode " + error.code); + console.info("rpc get local interface fail, errorMessage " + error.message); } console.log("RpcServer: descriptor is: " + descriptor); ``` - ### getInterfaceDescriptor(deprecated) >This API is no longer maintained since API version 9. You are advised to use [getDescriptor](#getdescriptor9). @@ -8176,7 +8290,7 @@ Obtains the interface descriptor. **Example** - ``` + ```ts class MyDeathRecipient { onRemoteDied() { console.log("server died"); @@ -8201,7 +8315,6 @@ Obtains the interface descriptor. console.log("RpcServer: descriptor is: " + descriptor); ``` - ### modifyLocalInterface9+ modifyLocalInterface(localInterface: IRemoteBroker, descriptor: string): void @@ -8217,10 +8330,9 @@ Binds an interface descriptor to an **IRemoteBroker** object. | localInterface | IRemoteBroker | Yes | **IRemoteBroker** object. | | descriptor | string | Yes | Interface descriptor.| - **Example** - ``` + ```ts class MyDeathRecipient { onRemoteDied() { console.log("server died"); @@ -8236,8 +8348,12 @@ Binds an interface descriptor to an **IRemoteBroker** object. console.info(rpc attach local interface fail, errorMessage " + error.message); } } - registerDeathRecipient(recipient: MyDeathRecipient, flags: number); - unregisterDeathRecipient(recipient: MyDeathRecipient, flags: number); + registerDeathRecipient(recipient: MyDeathRecipient, flags: number) { + // Implement the method logic based on service requirements. + } + unregisterDeathRecipient(recipient: MyDeathRecipient, flags: number) { + // Implement the method logic based on service requirements. + } isObjectDead(): boolean { return false; } @@ -8267,7 +8383,7 @@ Binds an interface descriptor to an **IRemoteBroker** object. **Example** - ``` + ```ts class MyDeathRecipient { onRemoteDied() { console.log("server died"); @@ -8294,15 +8410,14 @@ Binds an interface descriptor to an **IRemoteBroker** object. let testRemoteObject = new TestRemoteObject("testObject"); ``` - ## Ashmem8+ Provides methods related to anonymous shared memory objects, including creating, closing, mapping, and unmapping an **Ashmem** object, reading data from and writing data to an **Ashmem** object, obtaining the **Ashmem** size, and setting **Ashmem** protection. -The table below describes the protection types of the mapped memory. - **System capability**: SystemCapability.Communication.IPC.Core +The table below describes the protection types of the mapped memory. + | Name | Value | Description | | ---------- | --- | ------------------ | | PROT_EXEC | 4 | The mapped memory is executable. | @@ -8310,12 +8425,11 @@ The table below describes the protection types of the mapped memory. | PROT_READ | 1 | The mapped memory is readable. | | PROT_WRITE | 2 | The mapped memory is writeable. | - ### create9+ static create(name: string, size: number): Ashmem -Creates an **Ashmem** object with the specified name and size. +Creates an **Ashmem** object with the specified name and size. This API is a static method. **System capability**: SystemCapability.Communication.IPC.Core @@ -8332,10 +8446,9 @@ Creates an **Ashmem** object with the specified name and size. | ------ | ---------------------------------------------- | | Ashmem | Returns the **Ashmem** object if it is created successfully; returns null otherwise.| - **Example** - ``` + ```ts let ashmem; try { ashmem = rpc.Ashmem.create("ashmem", 1024*1024); @@ -8347,14 +8460,13 @@ Creates an **Ashmem** object with the specified name and size. console.log("RpcTest: get ashemm by create : " + ashmem + " size is : " + size); ``` - ### createAshmem8+(deprecated) >This API is no longer maintained since API version 9. You are advised to use [create](#create9). static createAshmem(name: string, size: number): Ashmem -Creates an **Ashmem** object with the specified name and size. +Creates an **Ashmem** object with the specified name and size. This API is a static method. **System capability**: SystemCapability.Communication.IPC.Core @@ -8373,18 +8485,17 @@ Creates an **Ashmem** object with the specified name and size. **Example** - ``` + ```ts let ashmem = rpc.Ashmem.createAshmem("ashmem", 1024*1024); let size = ashmem.getAshmemSize(); console.log("RpcTest: get ashemm by createAshmem : " + ashmem + " size is : " + size); ``` - ### create9+ static create(ashmem: Ashmem): Ashmem -Creates an **Ashmem** object by copying the file descriptor (FD) of an existing Ashmem object. The two **Ashmem** objects point to the same shared memory region. +Creates an **Ashmem** object by copying the file descriptor of an existing **Ashmem** object. The two **Ashmem** objects point to the same shared memory region. **System capability**: SystemCapability.Communication.IPC.Core @@ -8403,7 +8514,7 @@ Creates an **Ashmem** object by copying the file descriptor (FD) of an existing **Example** - ``` + ```ts let ashmem2; try { let ashmem = rpc.Ashmem.create("ashmem", 1024*1024); @@ -8416,14 +8527,13 @@ Creates an **Ashmem** object by copying the file descriptor (FD) of an existing console.log("RpcTest: get ashemm by create : " + ashmem2 + " size is : " + size); ``` - ### createAshmemFromExisting8+(deprecated) >This API is no longer maintained since API version 9. You are advised to use [create](#create9). static createAshmemFromExisting(ashmem: Ashmem): Ashmem -Creates an **Ashmem** object by copying the file descriptor (FD) of an existing Ashmem object. The two **Ashmem** objects point to the same shared memory region. +Creates an **Ashmem** object by copying the file descriptor of an existing **Ashmem** object. The two **Ashmem** objects point to the same shared memory region. **System capability**: SystemCapability.Communication.IPC.Core @@ -8441,14 +8551,13 @@ Creates an **Ashmem** object by copying the file descriptor (FD) of an existing **Example** - ``` + ```ts let ashmem = rpc.Ashmem.createAshmem("ashmem", 1024*1024); let ashmem2 = rpc.Ashmem.createAshmemFromExisting(ashmem); let size = ashmem2.getAshmemSize(); console.log("RpcTest: get ashemm by createAshmemFromExisting : " + ashmem2 + " size is : " + size); ``` - ### closeAshmem8+ closeAshmem(): void @@ -8459,12 +8568,11 @@ Closes this **Ashmem** object. **Example** - ``` + ```ts let ashmem = rpc.Ashmem.create("ashmem", 1024*1024); ashmem.closeAshmem(); ``` - ### unmapAshmem8+ unmapAshmem(): void @@ -8475,12 +8583,11 @@ Deletes the mappings for the specified address range of this **Ashmem** object. **Example** - ``` + ```ts let ashmem = rpc.Ashmem.create("ashmem", 1024*1024); ashmem.unmapAshmem(); ``` - ### getAshmemSize8+ getAshmemSize(): number @@ -8497,13 +8604,12 @@ Obtains the memory size of this **Ashmem** object. **Example** - ``` + ```ts let ashmem = rpc.Ashmem.createAshmem("ashmem", 1024*1024); let size = ashmem.getAshmemSize(); console.log("RpcTest: get ashmem is " + ashmem + " size is : " + size); ``` - ### mapTypedAshmem9+ mapTypedAshmem(mapType: number): void @@ -8518,7 +8624,7 @@ Creates the shared file mapping on the virtual address space of this process. Th | ------- | ------ | ---- | ------------------------------ | | mapType | number | Yes | Protection level of the memory region to which the shared file is mapped.| -**Error Code** +**Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). @@ -8528,7 +8634,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let ashmem = rpc.Ashmem.create("ashmem", 1024*1024); try { ashmem.mapTypedAshmem(ashmem.PROT_READ | ashmem.PROT_WRITE); @@ -8538,7 +8644,6 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode } ``` - ### mapAshmem8+(deprecated) >This API is no longer maintained since API version 9. You are advised to use [mapTypedAshmem](#maptypedashmem9). @@ -8559,17 +8664,16 @@ Creates the shared file mapping on the virtual address space of this process. Th | Type | Description | | ------- | ----------------------------------------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + | boolean | Returns **true** if the mapping is created; returns **false** otherwise.| **Example** - ``` + ```ts let ashmem = rpc.Ashmem.createAshmem("ashmem", 1024*1024); let mapReadAndWrite = ashmem.mapAshmem(ashmem.PROT_READ | ashmem.PROT_WRITE); console.log("RpcTest: map ashmem result is : " + mapReadAndWrite); ``` - ### mapReadWriteAshmem9+ mapReadWriteAshmem(): void @@ -8578,7 +8682,7 @@ Maps the shared file to the readable and writable virtual address space of the p **System capability**: SystemCapability.Communication.IPC.Core -**Error Code** +**Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). @@ -8588,7 +8692,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let ashmem = rpc.Ashmem.create("ashmem", 1024*1024); try { ashmem.mapReadWriteAshmem(); @@ -8598,7 +8702,6 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode } ``` - ### mapReadAndWriteAshmem8+(deprecated) >This API is no longer maintained since API version 9. You are advised to use [mapReadWriteAshmem](#mapreadwriteashmem9). @@ -8613,17 +8716,16 @@ Maps the shared file to the readable and writable virtual address space of the p | Type | Description | | ------- | ----------------------------------------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + | boolean | Returns **true** if the mapping is created; returns **false** otherwise.| **Example** - ``` + ```ts let ashmem = rpc.Ashmem.createAshmem("ashmem", 1024*1024); let mapResult = ashmem.mapReadAndWriteAshmem(); console.log("RpcTest: map ashmem result is : " + mapResult); ``` - ### mapReadonlyAshmem9+ mapReadonlyAshmem(): void @@ -8632,7 +8734,7 @@ Maps the shared file to the read-only virtual address space of the process. **System capability**: SystemCapability.Communication.IPC.Core -**Error Code** +**Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). @@ -8642,7 +8744,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let ashmem = rpc.Ashmem.create("ashmem", 1024*1024); try { ashmem.mapReadonlyAshmem(); @@ -8652,7 +8754,6 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode } ``` - ### mapReadOnlyAshmem8+(deprecated) >This API is no longer maintained since API version 9. You are advised to use [mapReadonlyAshmem](#mapreadonlyashmem9). @@ -8667,17 +8768,16 @@ Maps the shared file to the read-only virtual address space of the process. | Type | Description | | ------- | ----------------------------------------- | - | boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + | boolean | Returns **true** if the mapping is created; returns **false** otherwise.| **Example** - ``` + ```ts let ashmem = rpc.Ashmem.createAshmem("ashmem", 1024*1024); let mapResult = ashmem.mapReadOnlyAshmem(); console.log("RpcTest: Ashmem mapReadOnlyAshmem result is : " + mapResult); ``` - ### setProtectionType9+ setProtectionType(protectionType: number): void @@ -8692,7 +8792,7 @@ Sets the protection level of the memory region to which the shared file is mappe | -------------- | ------ | ---- | ------------------ | | protectionType | number | Yes | Protection type to set.| -**Error Code** +**Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). @@ -8702,7 +8802,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let ashmem = rpc.Ashmem.create("ashmem", 1024*1024); try { ashmem.setProtection(ashmem.PROT_READ); @@ -8712,7 +8812,6 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode } ``` - ### setProtection8+(deprecated) >This API is no longer maintained since API version 9. You are advised to use [setProtectionType](#setprotectiontype9). @@ -8737,13 +8836,12 @@ Sets the protection level of the memory region to which the shared file is mappe **Example** - ``` + ```ts let ashmem = rpc.Ashmem.createAshmem("ashmem", 1024*1024); let result = ashmem.setProtection(ashmem.PROT_READ); console.log("RpcTest: Ashmem setProtection result is : " + result); ``` - ### writeAshmem9+ writeAshmem(buf: number[], size: number, offset: number): void @@ -8760,7 +8858,7 @@ Writes data to the shared file associated with this **Ashmem** object. | size | number | Yes | Size of the data to write. | | offset | number | Yes | Start position of the data to write in the memory region associated with this **Ashmem** object.| -**Error Code** +**Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). @@ -8770,7 +8868,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let ashmem = rpc.Ashmem.create("ashmem", 1024*1024); ashmem.mapReadWriteAshmem(); var ByteArrayVar = [1, 2, 3, 4, 5]; @@ -8782,7 +8880,6 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode } ``` - ### writeToAshmem8+(deprecated) >This API is no longer maintained since API version 9. You are advised to use [writeAshmem](#writeashmem9). @@ -8805,11 +8902,11 @@ Writes data to the shared file associated with this **Ashmem** object. | Type | Description | | ------- | ----------------------------------------------------------------------------------------- | - | boolean | Returns **true** is the data is written successfully; returns **false** otherwise.| + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** - ``` + ```ts let ashmem = rpc.Ashmem.createAshmem("ashmem", 1024*1024); let mapResult = ashmem.mapReadAndWriteAshmem(); console.info("RpcTest map ashmem result is " + mapResult); @@ -8818,7 +8915,6 @@ Writes data to the shared file associated with this **Ashmem** object. console.log("RpcTest: write to Ashmem result is : " + writeResult); ``` - ### readAshmem9+ readAshmem(size: number, offset: number): number[] @@ -8840,7 +8936,7 @@ Reads data from the shared file associated with this **Ashmem** object. | -------- | ---------------- | | number[] | Data read.| -**Error Code** +**Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). @@ -8850,7 +8946,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode **Example** - ``` + ```ts let ashmem = rpc.Ashmem.create("ashmem", 1024*1024); ashmem.mapReadWriteAshmem(); var ByteArrayVar = [1, 2, 3, 4, 5]; @@ -8864,7 +8960,6 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode } ``` - ### readFromAshmem8+(deprecated) >This API is no longer maintained since API version 9. You are advised to use [readAshmem](#readashmem9). @@ -8890,7 +8985,7 @@ Reads data from the shared file associated with this **Ashmem** object. **Example** - ``` + ```ts let ashmem = rpc.Ashmem.createAshmem("ashmem", 1024*1024); let mapResult = ashmem.mapReadAndWriteAshmem(); console.info("RpcTest map ashmem result is " + mapResult); diff --git a/en/application-dev/reference/apis/js-apis-screenshot.md b/en/application-dev/reference/apis/js-apis-screenshot.md index 309a1bc64491497bf61aaf6f2695a9d5c4fbd9d4..8b760e7cb48b3031e728ec80cc2c178501abb677 100644 --- a/en/application-dev/reference/apis/js-apis-screenshot.md +++ b/en/application-dev/reference/apis/js-apis-screenshot.md @@ -37,10 +37,10 @@ Describes the region of the screen to capture. | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------------------------------------------------------------ | -| left | number | Yes | Left boundary of the screen region to capture.| -| top | number | Yes | Top boundary of the screen region to capture.| -| width | number | Yes | Width of the screen region to capture.| -| height | number | Yes | Height of the screen region to capture.| +| left | number | Yes | Left boundary of the screen region to capture, in pixels.| +| top | number | Yes | Top boundary of the screen region to capture, in pixels.| +| width | number | Yes | Width of the screen region to capture, in pixels.| +| height | number | Yes | Height of the screen region to capture, in pixels.| ## Size @@ -51,8 +51,8 @@ Describes the size of the screen region to capture. | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------------------------------------------------------------ | -| width | number | Yes | Width of the screen region to capture.| -| height | number | Yes | Height of the screen region to capture.| +| width | number | Yes | Width of the screen region to capture, in pixels.| +| height | number | Yes | Height of the screen region to capture, in pixels.| ## screenshot.save diff --git a/en/application-dev/reference/apis/js-apis-sim.md b/en/application-dev/reference/apis/js-apis-sim.md index 0c0243c3dbe85939b1da5623baac1b3137926e15..3e17df01ff13c5e74e300989517ca606f8b2e069 100644 --- a/en/application-dev/reference/apis/js-apis-sim.md +++ b/en/application-dev/reference/apis/js-apis-sim.md @@ -1,6 +1,6 @@ -# @ohos.telephony.sim (SIM Management) +# @ohos.telephony.sim (SIM) -The **sim** module provides basic SIM card management functions. You can obtain the name, number, ISO country code, home PLMN number, service provider name, SIM card status, type, installation status, activation status, and lock status of the SIM card in the specified slot. Besides, you can set the name, number, and lock status of the SIM card, activate or deactivate the SIM card, and change the PIN or unlock the PIN or PUK of the SIM card. +The SIM management module provides basic SIM card management functions. You can obtain the name, number, ISO country code, home PLMN number, service provider name, SIM card status, type, installation status, activation status, and lock status of the SIM card in the specified slot. Besides, you can set the name, number, and lock status of the SIM card, activate or deactivate the SIM card, and change the PIN or unlock the PIN or PUK of the SIM card. >**NOTE** > @@ -121,7 +121,7 @@ promise.then(data => { hasOperatorPrivileges(slotId: number, callback: AsyncCallback\): void -Checks whether the application (caller) has been granted the operator permission. This API uses an asynchronous callback to return the result. +Checks whether the application (caller) has been granted the operator permission. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Telephony.CoreService @@ -132,6 +132,18 @@ Checks whether the application (caller) has been granted the operator permission | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback\ | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -144,7 +156,7 @@ sim.hasOperatorPrivileges(0, (err, data) => { hasOperatorPrivileges(slotId: number): Promise -Checks whether the application (caller) has been granted the carrier permission. This API uses a promise to return the result. +Checks whether the application (caller) has been granted the operator permission. This API uses a promise to return the result. **System capability**: SystemCapability.Telephony.CoreService @@ -160,6 +172,18 @@ Checks whether the application (caller) has been granted the carrier permission. | :----------------- | :---------------------------------------------------------- | | Promise\ | Promise used to return the result. The value **true** indicates that the application (caller) has been granted the carrier permission, and the value **false** indicates the opposite.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -184,7 +208,19 @@ Obtains the ISO country code of the SIM card in the specified slot. This API use | Name | Type | Mandatory| Description | | -------- | ----------------------- | ---- | ---------------------------------------- | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | -| callback | AsyncCallback\ | Yes | Callback used to return the result. which is an ISO country code, for example, **CN** (China).| +| callback | AsyncCallback\ | Yes | Callback used to return the result, which is an ISO country code, for example, **CN** (China).| + +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | **Example** @@ -215,6 +251,18 @@ Obtains the ISO country code of the SIM card in the specified slot. This API use | ----------------- | ------------------------------------------------------------ | | Promise\ | Promise used to return the result, which is an ISO country code, for example, **CN** (China).| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -231,7 +279,7 @@ promise.then(data => { getSimOperatorNumeric\(slotId: number, callback: AsyncCallback\): void -Obtains the public land mobile network (PLMN) ID of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. +Obtains the public land mobile network \(PLMN\) ID of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Telephony.CoreService @@ -242,6 +290,18 @@ Obtains the public land mobile network (PLMN) ID of the SIM card in the specifie | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback\ | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -271,6 +331,18 @@ Obtains the PLMN ID of the SIM card in the specified slot. This API uses a promi | ----------------- | ------------------------------------------------ | | Promise\ | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -287,7 +359,7 @@ promise.then(data => { getSimSpn\(slotId: number, callback: AsyncCallback\): void -Obtains the service provider name (SPN) of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. +Obtains the service provider name (SPN) of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Telephony.CoreService @@ -298,6 +370,18 @@ Obtains the service provider name (SPN) of the SIM card in the specified slot. T | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback\ | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -311,7 +395,7 @@ sim.getSimSpn(0, (err, data) => { getSimSpn\(slotId: number\): Promise -Obtains the SPN of the SIM card in the specified slot. This API uses a promise to return the result. +Obtains the SPN of the SIM card in the specified slot. This API uses a promise to return the result. **System capability**: SystemCapability.Telephony.CoreService @@ -327,6 +411,18 @@ Obtains the SPN of the SIM card in the specified slot. This API uses a promise t | ----------------- | ----------------------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -343,7 +439,7 @@ promise.then(data => { getSimState\(slotId: number, callback: AsyncCallback\): void -Obtains the status of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. +Obtains the state of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Telephony.CoreService @@ -354,6 +450,18 @@ Obtains the status of the SIM card in the specified slot. This API uses an async | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback\<[SimState](#simstate)\> | Yes | Callback used to return the result. For details, see [SimState](#simstate). | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -367,7 +475,7 @@ sim.getSimState(0, (err, data) => { getSimState\(slotId: number\): Promise -Obtains the status of the SIM card in the specified slot. This API uses a promise to return the result. +Obtains the state of the SIM card in the specified slot. This API uses a promise to return the result. **System capability**: SystemCapability.Telephony.CoreService @@ -383,6 +491,18 @@ Obtains the status of the SIM card in the specified slot. This API uses a promis | -------------------------------- | ------------------------------------------ | | Promise\<[SimState](#simstate)\> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -409,6 +529,18 @@ Obtains the type of the SIM card in the specified slot. This API uses an asynchr | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback\<[CardType](#cardtype7)\> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -438,6 +570,18 @@ Obtains the type of the SIM card in the specified slot. This API uses a promise | ----------------- | ------------------------------------------------------------ | | Promise\<[CardType](#cardtype7)\> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -465,6 +609,18 @@ Checks whether the SIM card in the specified slot is installed. This API uses an | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback<boolean> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -494,6 +650,18 @@ Checks whether the SIM card in the specified slot is installed. This API uses a | --------------------- | ---------------------------------- | | Promise<boolean> | Promise used to return the result. The value **true** indicates that the SIM card in the specified slot is installed, and the value **false** indicates the opposite.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -509,7 +677,7 @@ promise.then(data => { getSimAccountInfo(slotId: number, callback: AsyncCallback): void -Obtains account information of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. +Obtains SIM card account information. This API uses an asynchronous callback to return the result. **System API**: This is a system API. @@ -524,6 +692,20 @@ Obtains account information of the SIM card in the specified slot. This API uses | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback\<[IccAccountInfo](#iccaccountinfo7)\> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -537,7 +719,7 @@ sim.getSimAccountInfo(0, (err, data) => { getSimAccountInfo(slotId: number): Promise -Obtains account information of the SIM card in the specified slot. This API uses a promise to return the result. +Obtains SIM card account information. This API uses a promise to return the result. **System API**: This is a system API. @@ -557,6 +739,20 @@ Obtains account information of the SIM card in the specified slot. This API uses | -------------------------------------------- | ------------------------------------------ | | Promise<[IccAccountInfo](#iccaccountinfo7)\> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -586,6 +782,19 @@ Obtains the account information list of the active SIM card. This API uses an as | -------- | ----------------------------------------------------------- | ---- | ---------- | | callback | AsyncCallback\\> | Yes | Callback used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -613,6 +822,19 @@ Obtains the account information list of the active SIM card. This API uses a pro | ---------------------------------------------------- | ---------------------------------------------- | | Promise\> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -643,6 +865,20 @@ Sets the default slot ID of the SIM card that provides voice services. This API | slotId | number | Yes | SIM card slot ID.
- **0**: card slot 1
- **1**: card slot 2
- **-1**: Clears the default configuration.| | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301001 | SIM card is not activated. | + **Example** ```js @@ -676,6 +912,20 @@ Sets the default slot ID of the SIM card that provides voice services. This API | --------------- | ------------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301001 | SIM card is not activated. | + **Example** ```js @@ -707,6 +957,19 @@ Sets a display name for the SIM card in the specified slot. This API uses an asy | name | string | Yes | SIM card name. | | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -741,6 +1004,19 @@ Sets a display name for the SIM card in the specified slot. This API uses a prom | --------------- | ------------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -772,6 +1048,19 @@ Obtains the name of the SIM card in the specified slot. This API uses an asynchr | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback<string> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -805,6 +1094,19 @@ Obtains the name of the SIM card in the specified slot. This API uses a promise | --------------------- | -------------------------------------- | | Promise<string> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -836,6 +1138,19 @@ Sets a display number for the SIM card in the specified slot. This API uses an a | number | string | Yes | SIM card number. | | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -871,6 +1186,19 @@ Sets a display number for the SIM card in the specified slot. This API uses a pr | -------------- | ------------------------------- | | Promise | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -902,6 +1230,19 @@ Obtains the display number of the SIM card in the specified slot. This API uses | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback<string> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -935,6 +1276,19 @@ Obtains the display number of the SIM card in the specified slot. This API uses | --------------------- | --------------------------------- | | Promise<string> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -950,7 +1304,7 @@ promise.then(data => { activateSim(slotId: number, callback: AsyncCallback): void -Activates the SIM card in the specified slot. This API uses an asynchronous callback to return the result. +Activates a SIM card in a specified card slot. This API uses an asynchronous callback to return the result. **System API**: This is a system API. @@ -965,6 +1319,19 @@ Activates the SIM card in the specified slot. This API uses an asynchronous call | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -998,6 +1365,19 @@ Activates the SIM card in the specified slot. This API uses a promise to return | --------------- | ------------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1013,7 +1393,7 @@ promise.then(data => { deactivateSim(slotId: number, callback: AsyncCallback): void -Deactivates the SIM card in the specified slot. This API uses an asynchronous callback to return the result. +Disables the SIM card in the specified slot. This API uses an asynchronous callback to return the result. **System API**: This is a system API. @@ -1028,6 +1408,19 @@ Deactivates the SIM card in the specified slot. This API uses an asynchronous ca | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1041,7 +1434,7 @@ sim.deactivateSim(0, (err, data) => { deactivateSim(slotId: number): Promise\ -Deactivates the SIM card in the specified slot. This API uses a promise to return the result. +Disables the SIM card in the specified slot. This API uses a promise to return the result. **System API**: This is a system API. @@ -1061,6 +1454,19 @@ Deactivates the SIM card in the specified slot. This API uses a promise to retur | --------------- | ------------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1090,7 +1496,21 @@ Sets the lock status of the SIM card in the specified slot. This API uses an asy | -------- | ----------------------------------------------------------- | ---- | ------------------------------------------------------------ | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | | callback | AsyncCallback\<[LockStatusResponse](#lockstatusresponse7)\> | Yes | Callback used to return the result. | -| options | [LockInfo](#lockinfo8) | Yes | Lock information.
- **lockType**: [LockType](#locktype8)
- **password**: string
- **state**: [LockState](#lockstate8) | +| options | [LockInfo](#lockinfo8) | Yes | Lock information.
- lockType: [LockType](#locktype8)
- password: string
- state: [LockState](#lockstate8) | + +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | **Example** @@ -1123,7 +1543,7 @@ Sets the lock status of the SIM card in the specified slot. This API uses a prom | Name | Type | Mandatory| Description | | ------- | ---------------------- | ---- | ------------------------------------------------------------ | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | -| options | [LockInfo](#lockinfo8) | Yes | Lock information.
- **lockType**: [LockType](#locktype8)
- **password**: string
- **state**: [LockState](#lockstate8) | +| options | [LockInfo](#lockinfo8) | Yes | Lock information.
- lockType: [LockType](#locktype8)
- password: string
- state: [LockState](#lockstate8) | **Return value** @@ -1131,6 +1551,20 @@ Sets the lock status of the SIM card in the specified slot. This API uses a prom | ---------------------------------------------------- | -------------------------------------------- | | Promise<[LockStatusResponse](#lockstatusresponse7)\> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1167,6 +1601,20 @@ Obtains the lock status of the SIM card in the specified slot. This API uses an | callback | AsyncCallback\<[LockState](#lockstate8)\> | Yes | Callback used to return the result. | | options | [LockType](#locktype8) | Yes | Lock type.
- **1**: PIN lock
- **2**: PIN 2 lock| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1201,6 +1649,20 @@ Obtains the lock status of the SIM card in the specified slot. This API uses a p | ---------------------------------- | -------------------------------------------- | | Promise<[LockState](#lockstate8)\> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1233,6 +1695,20 @@ Changes the PIN of the SIM card in the specified slot. This API uses an asynchro | newPin | string | Yes | New PIN. | | oldPin | string | Yes | Old PIN. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1268,6 +1744,20 @@ Changes the PIN of the SIM card in the specified slot. This API uses a promise t | ---------------------------------------------------- | --------------------------------------------- | | Promise<[LockStatusResponse](#lockstatusresponse7)\> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1300,6 +1790,20 @@ Changes PIN 2 of the SIM card in the specified slot. This API uses an asynchrono | newPin2 | string | Yes | New PIN. | | oldPin2 | string | Yes | Old PIN. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1335,6 +1839,20 @@ Changes PIN 2 of the SIM card in the specified slot. This API uses a promise to | ---------------------------------------------------- | --------------------------------------------- | | Promise<[LockStatusResponse](#lockstatusresponse7)\> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1350,7 +1868,7 @@ promise.then(data => { unlockPin(slotId: number, pin: string, callback: AsyncCallback): void -Unlocks PIN of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. +Unlocks the PIN of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. **System API**: This is a system API. @@ -1366,6 +1884,20 @@ Unlocks PIN of the SIM card in the specified slot. This API uses an asynchronous | pin | string | Yes | PIN of the SIM card. | | callback | AsyncCallback<[LockStatusResponse](#lockstatusresponse7)> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1401,6 +1933,20 @@ Unlocks the PIN of the SIM card in the specified slot. This API uses a promise t | ---------------------------------------------------- | -------------------------------------------------- | | Promise\<[LockStatusResponse](#lockstatusresponse7)\> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1415,7 +1961,7 @@ promise.then(data => { ## sim.unlockPuk7+ -unlockPuk(slotId: number, newPin: string, puk: string ,callback: AsyncCallback): void +unlockPuk(slotId: number, newPin: string, puk: string, callback: AsyncCallback): void Unlocks the PUK of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. @@ -1434,6 +1980,20 @@ Unlocks the PUK of the SIM card in the specified slot. This API uses an asynchro | puk | string | Yes | PUK of the SIM card. | | callback | AsyncCallback<[LockStatusResponse](#lockstatusresponse7)> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1471,6 +2031,20 @@ Unlocks the PUK of the SIM card in the specified slot. This API uses a promise t | ---------------------------------------------------- | -------------------------------------------------- | | Promise\<[LockStatusResponse](#lockstatusresponse7)\> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1504,6 +2078,20 @@ Unlocks PIN 2 of the SIM card in the specified slot. This API uses an asynchrono | pin2 | string | Yes | PIN 2 of the SIM card. | | callback | AsyncCallback<[LockStatusResponse](#lockstatusresponse7)> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1539,6 +2127,20 @@ Unlocks PIN 2 of the SIM card in the specified slot. This API uses a promise to | ----------------------------------------------------- | -------------------------------------------------- | | Promise\<[LockStatusResponse](#lockstatusresponse7)\> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1572,6 +2174,20 @@ Unlocks PUK 2 of the SIM card in the specified slot. This API uses an asynchrono | puk2 | string | Yes | PUK 2 of the SIM card. | | callback | AsyncCallback<[LockStatusResponse](#lockstatusresponse7)> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1609,6 +2225,20 @@ Unlocks PUK 2 of the SIM card in the specified slot. This API uses a promise to | ---------------------------------------------------- | -------------------------------------------------- | | Promise\<[LockStatusResponse](#lockstatusresponse7)\> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1646,7 +2276,7 @@ console.log("Result: "+ sim.getMaxSimCount()) getSimIccId(slotId: number, callback: AsyncCallback): void -Obtains the IC card identity (ICCID) of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. +Obtains the ICCID of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. **System API**: This is a system API. @@ -1661,6 +2291,19 @@ Obtains the IC card identity (ICCID) of the SIM card in the specified slot. This | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1694,6 +2337,19 @@ Obtains the ICCID of the SIM card in the specified slot. This API uses a promise | ---------------- | ------------------------------------------- | | Promise | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1724,6 +2380,19 @@ Obtains the voice mailbox alpha identifier of the SIM card in the specified slot | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1757,6 +2426,19 @@ Obtains the voice mailbox alpha identifier of the SIM card in the specified slot | ---------------- | ------------------------------------------------- | | Promise | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1787,6 +2469,19 @@ Obtains the voice mailbox number of the SIM card in the specified slot. This API | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1820,6 +2515,19 @@ Obtains the voice mailbox number of the SIM card in the specified slot. This API | ---------------- | ------------------------------------------------ | | Promise | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1831,6 +2539,7 @@ promise.then(data => { }); ``` + ## sim.setVoiceMailInfo8+ setVoiceMailInfo(slotId: number, mailName: string, mailNumber: string, callback: AsyncCallback): void @@ -1852,6 +2561,20 @@ Sets voice mailbox information for the SIM card in the specified slot. This API | mailNumber | string | Yes | Voice mailbox number. | | callback | AsyncCallback | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1887,6 +2610,20 @@ Sets voice mailbox information for the SIM card in the specified slot. This API | -------------- | ----------------------- | | Promise | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1902,7 +2639,7 @@ promise.then(data => { getSimTelephoneNumber(slotId: number, callback: AsyncCallback): void -Obtains the mobile subscriber ISDN number (MSISDN) of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. +Obtains the MSISDN of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. **System API**: This is a system API. @@ -1917,6 +2654,19 @@ Obtains the mobile subscriber ISDN number (MSISDN) of the SIM card in the specif | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1950,6 +2700,19 @@ Obtains the MSISDN of the SIM card in the specified slot. This API uses a promis | ---------------- | -------------------------------------------- | | Promise | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1980,6 +2743,19 @@ Obtains the group identifier level 1 (GID1) of the SIM card in the specified slo | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback\ | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2013,6 +2789,19 @@ Obtains the GID1 of the SIM card in the specified slot. This API uses a promise | ---------------- | ------------------------------------------------- | | Promise | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2043,6 +2832,19 @@ Obtains the international mobile subscriber identity (IMSI) of the SIM card in t | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback\ | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2076,6 +2878,19 @@ Obtains the IMSI of the SIM card in the specified slot. This API uses a promise | ---------------- | ------------------------------------------- | | Promise | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2106,6 +2921,19 @@ Obtains the carrier configuration of the SIM card in the specified slot. This AP | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2139,6 +2967,19 @@ Obtains the carrier configuration of the SIM card in the specified slot. This AP | --------------------------------------------------- | ----------------------------- | | Promise> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2167,8 +3008,22 @@ Queries contact numbers of the SIM card in the specified slot. This API uses an | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ---------------------------------------------------------- | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | -| type | [ContactType](#contacttype8) | Yes | Contact type.
- **1**: GENERAL_CONTACT
- **2**: FIXED_DIALING | -| callback | AsyncCallback> | Yes | Callback used to return the result. | +| type | [ContactType](#contacttype8) | Yes | Contact type.
- **1**: GENERAL_CONTACT
- **2**: FIXED_DIALING| +| callback | AsyncCallback> | Yes | Callback used to return the result. | + +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | **Example** @@ -2196,13 +3051,27 @@ Queries contact numbers of the SIM card in the specified slot. This API uses a p | Name| Type | Mandatory| Description | | ------ | ----------- | ---- | ---------------------------------------------------------- | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | -| type | [ContactType](#contacttype8) | Yes | Contact type.
- **1**: GENERAL_CONTACT
- **2**: FIXED_DIALING | +| type | [ContactType](#contacttype8) | Yes | Contact type.
- **1**: GENERAL_CONTACT
- **2**: FIXED_DIALING| **Return value** | Type | Description | | ------------------------------------------------------------ | ------------------------------ | -| Promise> | Promise used to return the result.| +| Promise> | Promise used to return the result.| + +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | **Example** @@ -2236,6 +3105,20 @@ Adds contact numbers for the SIM card in the specified slot. This API uses an as | diallingNumbers | [DiallingNumbersInfo](#diallingnumbersinfo8) | Yes | Contact number information. | | callback | AsyncCallback | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -2274,7 +3157,21 @@ Adds contact numbers for the SIM card in the specified slot. This API uses a pro | Type | Description | | -------------- | --------------------------- | -| Promise | Promise used to return the result.| +| Promise | Promise used to return the result.| + +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | **Example** @@ -2308,16 +3205,32 @@ Deletes contact numbers from the SIM card in the specified slot. This API uses a | Name | Type | Mandatory| Description | | --------------- | -------------------------------------------- | ---- | ---------------------------------------------------------- | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | -| type | [ContactType](#contacttype8) | Yes | Contact type.
- **1**: GENERAL_CONTACT
- **2**: FIXED_DIALING | +| type | [ContactType](#contacttype8) | Yes | Contact type.
- 1 : GENERAL_CONTACT
- 2 : FIXED_DIALING | | diallingNumbers | [DiallingNumbersInfo](#diallingnumbersinfo8) | Yes | Contact number information. | | callback | AsyncCallback | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js let diallingNumbersInof = { alphaTag: "alpha", - number: "138xxxxxxxx" + number: "138xxxxxxxx", + recordNumber: 123, + pin2: "1234" }; sim.delIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); @@ -2342,14 +3255,28 @@ Deletes contact numbers from the SIM card in the specified slot. This API uses a | Name | Type | Mandatory| Description | | --------------- | -------------------------------------------- | ---- | ---------------------------------------------------------- | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | -| type | [ContactType](#contacttype8) | Yes | Contact type.
- **1**: GENERAL_CONTACT
- **2**: FIXED_DIALING | +| type | [ContactType](#contacttype8) | Yes | Contact type.
- 1 : GENERAL_CONTACT
- 2 : FIXED_DIALING | | diallingNumbers | [DiallingNumbersInfo](#diallingnumbersinfo8) | Yes | Contact number information. | **Return value** | Type | Description | | -------------- | --------------------------- | -| Promise | Promise used to return the result.| +| Promise | Promise used to return the result.| + +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | **Example** @@ -2383,16 +3310,32 @@ Updates contact numbers for the SIM card in the specified slot. This API uses an | Name | Type | Mandatory| Description | | --------------- | -------------------------------------------- | ---- | ---------------------------------------------------------- | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | -| type | [ContactType](#contacttype8) | Yes | Contact type.
- **1**: GENERAL_CONTACT
- **2**: FIXED_DIALING | +| type | [ContactType](#contacttype8) | Yes | Contact type.
- **1**: GENERAL_CONTACT
- **2**: FIXED_DIALING| | diallingNumbers | [DiallingNumbersInfo](#diallingnumbersinfo8) | Yes | Contact number information. | | callback | AsyncCallback | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js let diallingNumbersInof = { alphaTag: "alpha", - number: "138xxxxxxxx" + number: "138xxxxxxxx", + recordNumber: 123, + pin2: "1234" }; sim.updateIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); @@ -2417,7 +3360,7 @@ Updates contact numbers for the SIM card in the specified slot. This API uses a | Name | Type | Mandatory| Description | | --------------- | -------------------------------------------- | ---- | ---------------------------------------------------------- | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | -| type | [ContactType](#contacttype8) | Yes | Contact type.
- **1**: GENERAL_CONTACT
- **2**: FIXED_DIALING | +| type | [ContactType](#contacttype8) | Yes | Contact type.
- **1**: GENERAL_CONTACT
- **2**: FIXED_DIALING| | diallingNumbers | [DiallingNumbersInfo](#diallingnumbersinfo8) | Yes | Contact number information. | **Return value** @@ -2426,14 +3369,27 @@ Updates contact numbers for the SIM card in the specified slot. This API uses a | -------------- | ----------------------------- | | Promise | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js let diallingNumbersInof = { alphaTag: "alpha", number: "138xxxxxxxx", - recordNumber: 123, - pin2: "1234" + recordNumber: 123 }; let promise = sim.updateIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof); promise.then(data => { @@ -2461,7 +3417,20 @@ Sends an envelope command to the SIM card in the specified slot. This API uses a | -------- | -------------------- | ---- | -------------------------------------- | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | cmd | string | Yes | Envelope command. | -| callback | AsyncCallback | Yes | Yes | +| callback | AsyncCallback | Yes | Callback used to return the result. | + +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | **Example** @@ -2497,6 +3466,19 @@ Sends an envelope command to the SIM card in the specified slot. This API uses a | -------------- | --------------------------- | | Promise | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2525,9 +3507,22 @@ Sends a terminal response command to the SIM card in the specified slot. This AP | Name | Type | Mandatory| Description | | -------- | -------------------- | ---- | -------------------------------------- | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| -| cmd | string | Yes | Command | +| cmd | string | Yes | Command. | | callback | AsyncCallback | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2554,7 +3549,7 @@ Sends a terminal response command to the SIM card in the specified slot. This AP | Name| Type | Mandatory| Description | | ------ | ------ | ---- | -------------------------------------- | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| -| cmd | string | Yes | Command | +| cmd | string | Yes | Command. | **Return value** @@ -2562,6 +3557,19 @@ Sends a terminal response command to the SIM card in the specified slot. This AP | -------------- | --------------------------- | | Promise | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2573,11 +3581,12 @@ promise.then(data => { }); ``` + ## sim.unlockSimLock8+ unlockSimLock(slotId: number, lockInfo: PersoLockInfo, callback: AsyncCallback): void -Unlocks the SIM card in the specified slot. This API uses an asynchronous callback to return the result. +Unlocks the SIM card in the specified slot. This API uses an asynchronous callback to return the result. **System API**: This is a system API. @@ -2593,6 +3602,20 @@ Unlocks the SIM card in the specified slot. This API uses an asynchronous callba | lockInfo | [PersoLockInfo](#persolockinfo8) | Yes | Personalized lock information. | | callback | AsyncCallback<[LockStatusResponse](#lockstatusresponse7)\> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -2610,7 +3633,7 @@ sim.unlockSimLock(0, persoLockInfo, (err, data) => { unlockSimLock(slotId: number, lockInfo: PersoLockInfo): Promise -Unlocks the SIM card in the specified slot. This API uses a promise to return the result. +Unlocks the SIM card in the specified slot. This API uses a promise to return the result. **System API**: This is a system API. @@ -2631,6 +3654,20 @@ Unlocks the SIM card in the specified slot. This API uses a promise to return th | ---------------------------------------------------- | ------------------------- | | Promise<[LockStatusResponse](#lockstatusresponse7)\> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -2652,8 +3689,6 @@ getOpKey(slotId: number, callback: AsyncCallback): void Obtains the opkey of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. -**System API**: This is a system API. - **System capability**: SystemCapability.Telephony.CoreService **Parameters** @@ -2661,14 +3696,35 @@ Obtains the opkey of the SIM card in the specified slot. This API uses an asynch | Name | Type | Mandatory| Description | | -------- | ---------------------- | ---- | -------------------------------------- | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| -| callback | AsyncCallback | Yes | Callback used to return the result. | +| callback | AsyncCallback | Yes | Callback used to return the result. | + +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 801 | Capability not supported. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | **Example** ```js -sim.getOpKey(0, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); -}); +try { + sim.getOpKey(0, (err, data) => { + if (err) { + console.log("getOpKey failed, err: " + JSON.stringify(err)); + } else { + console.log('getOpKey successfully, data: ' + JSON.stringify(data)); + } + }); +} catch (err) { + console.log("getOpKey err: " + JSON.stringify(err)); +} ``` @@ -2692,15 +3748,28 @@ Obtains the opkey of the SIM card in the specified slot. This API uses a promise | ---------------- | ----------------------------------------- | | Promise | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 801 | Capability not supported. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js -let promise = sim.getOpKey(0); -promise.then(data => { +try { + let data = sim.getOpKey(0); console.log(`getOpKey success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { - console.log(`getOpKey failed, promise: err->${JSON.stringify(err)}`); -}); +} catch (error) { + console.log(`getOpKey failed, promise: err->${JSON.stringify(error)}`); +} ``` ## sim.getOpName9+ @@ -2718,12 +3787,33 @@ Obtains the OpName of the SIM card in the specified slot. This API uses an async | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 801 | Capability not supported. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js -sim.getOpName(0, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); -}); +try { + sim.getOpName(0, (err, data) => { + if (err) { + console.log("getOpName failed, err: " + JSON.stringify(err)); + } else { + console.log('getOpName successfully, data: ' + JSON.stringify(data)); + } + }); +} catch (err) { + console.log("getOpName err: " + JSON.stringify(err)); +} ``` @@ -2747,15 +3837,28 @@ Obtains the OpName of the SIM card in the specified slot. This API uses a promis | ---------------- | ------------------------------------------ | | Promise | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 801 | Capability not supported. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js -let promise = sim.getOpName(0); -promise.then(data => { +try { + let data = sim.getOpName(0); console.log(`getOpName success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { - console.log(`getOpName failed, promise: err->${JSON.stringify(err)}`); -}); +} catch (error) { + console.log(`getOpName failed, promise: err->${JSON.stringify(error)}`); +} ``` ## SimState @@ -2781,16 +3884,16 @@ Enumerates SIM card types. | Name| Value| Description| | ----- | ----- | ----- | -|UNKNOWN_CARD | -1 | Unknown| -|SINGLE_MODE_SIM_CARD | 10 | Single-card (SIM)| -|SINGLE_MODE_USIM_CARD | 20 | Single-card (USIM)| -|SINGLE_MODE_RUIM_CARD | 30 | Single-card (RUIM)| -|DUAL_MODE_CG_CARD | 40 | Dual-card (CDMA+GSM)| -|CT_NATIONAL_ROAMING_CARD | 41 | China Telecom internal roaming card| -|CU_DUAL_MODE_CARD | 42 | China Unicom dual-mode card| -|DUAL_MODE_TELECOM_LTE_CARD | 43 | China Telecom dual-mode LTE card| -|DUAL_MODE_UG_CARD | 50 | Dual-mode card (UMTS+GSM)| -|SINGLE_MODE_ISIM_CARD8+ | 60 | Single-card (ISIM)| +|UNKNOWN_CARD | -1 | Unknown type.| +|SINGLE_MODE_SIM_CARD | 10 | Single-card (SIM).| +|SINGLE_MODE_USIM_CARD | 20 | Single-card (USIM).| +|SINGLE_MODE_RUIM_CARD | 30 | Single-card (RUIM).| +|DUAL_MODE_CG_CARD | 40 | Dual-card (CDMA+GSM).| +|CT_NATIONAL_ROAMING_CARD | 41 | China Telecom internal roaming card.| +|CU_DUAL_MODE_CARD | 42 | China Unicom dual-mode card.| +|DUAL_MODE_TELECOM_LTE_CARD | 43 | China Telecom dual-mode LTE card.| +|DUAL_MODE_UG_CARD | 50 | Dual-mode card (UMTS+GSM).| +|SINGLE_MODE_ISIM_CARD8+ | 60 | Single-card (ISIM).| ## LockType8+ @@ -2841,30 +3944,30 @@ Enumerates personalized lock types. ## LockStatusResponse7+ -Defines the lock status response. +Defines the personalized lock information. **System API**: This is a system API. **System capability**: SystemCapability.Telephony.CoreService -| Name | Type | Mandatory | Description | -| -------- | ------- | --------- | ----------- | -| result | number | Yes | Operation result. | -| remain?: number | number | Yes | Remaining attempts (can be null).| +| Name | Type | Mandatory| Description | +| --------------- | ------ | ---- | --------------------- | +| result | number | Yes | Operation result. | +| remain?: number | number | No | Remaining attempts (can be null).| ## LockInfo8+ -Defines the lock information. +Defines the personalized lock information. **System API**: This is a system API. **System capability**: SystemCapability.Telephony.CoreService -| Name | Type | Mandatory | Description | -| -------- | ------- | --------- | ----------- | -| lockType | [LockType](#locktype8) | Yes | Lock type.| -| password | string | Yes | Password. | -| state | [LockState](#lockstate8) | Yes | Lock state.| +| Name | Type | Mandatory| Description | +| -------- | ------------------------ | ---- | -------- | +| lockType | [LockType](#locktype8) | Yes | Lock type.| +| password | string | Yes | Password. | +| state | [LockState](#lockstate8) | Yes | Lock state.| ## PersoLockInfo8+ @@ -2874,10 +3977,10 @@ Defines the personalized lock information. **System capability**: SystemCapability.Telephony.CoreService -| Name | Type | Mandatory | Description | -| -------- | ------- | --------- | ----------- | -| lockType | [PersoLockType](#persolocktype8) | Yes | Personalized lock type.| -| password | string | Yes | Password. | +| Name | Type | Mandatory| Description | +| -------- | -------------------------------- | ---- | ------------- | +| lockType | [PersoLockType](#persolocktype8) | Yes | Personalized lock type.| +| password | string | Yes | Password. | ## IccAccountInfo7+ @@ -2887,15 +3990,15 @@ Defines the ICC account information. **System capability**: SystemCapability.Telephony.CoreService -| Name | Type | Mandatory | Description | -| -------- | ------- | --------- | ----------- | -| simId | number | Yes | SIM card ID. | -| slotIndex | number | Yes | Card slot ID. | -| isEsim | boolean | Yes | Whether the SIM card is an eSim card.| -| isActive | boolean | Yes | Whether the card is activated. | -| iccId | string | Yes | ICCID number. | -| showName | string | Yes | SIM card display name. | -| showNumber | string | Yes | SIM card display number. | +| Name | Type | Mandatory| Description | +| ---------- | ------- | ---- | ---------------- | +| simId | number | Yes | SIM card ID. | +| slotIndex | number | Yes | Card slot ID. | +| isEsim | boolean | Yes | Whether the SIM card is an eSim card.| +| isActive | boolean | Yes | Whether the card is activated. | +| iccId | string | Yes | ICCID number. | +| showName | string | Yes | SIM card display name. | +| showNumber | string | Yes | SIM card display number. | ## OperatorConfig8+ @@ -2905,10 +4008,10 @@ Defines the carrier configuration. **System capability**: SystemCapability.Telephony.CoreService -| Name | Type | Mandatory | Description | -| -------- | ------- | --------- | ----------- | -| field | string | Yes | Field. | -| value | string | Yes | Value. | +| Name | Type | Mandatory| Description| +| ----- | ------ | ---- | ---- | +| field | string | Yes | Field.| +| value | string | Yes | Value. | ## DiallingNumbersInfo8+ @@ -2918,12 +4021,12 @@ Defines the contact number information. **System capability**: SystemCapability.Telephony.CoreService -| Name | Type | Mandatory | Description | -| -------- | ------- | --------- | ----------- | -| alphaTag | string | Yes | Alpha tag. | -| number | string | Yes | Contact number. | -| recordNumber | number | Yes | Record number.| -| pin2 | string | Yes | PIN 2.| +| Name | Type | Mandatory| Description | +| ------------ | ------ | ---- | ---------- | +| alphaTag | string | Yes | Tag. | +| number | string | Yes | Call transfer number. | +| recordNumber | number | Yes | Record number.| +| pin2 | string | Yes | PIN 2.| ## ContactType8+ @@ -2934,7 +4037,7 @@ Enumerates contact types. **System capability**: SystemCapability.Telephony.CoreService | Name | Value | Description | -| -------------- | ---- | ---------- | +| --------------- | ---- | ---------- | | GENERAL_CONTACT | 1 | Common contact number.| | FIXED_DIALING | 2 | Fixed dialing number. | @@ -2946,8 +4049,8 @@ Enumerates carrier configuration keys. **System capability**: SystemCapability.Telephony.CoreService -| Name | Value | Description | -| ------------------------------------------------------- | ---------------------------------------------------- | -------------------- | +| Name | Value | Description | +| ------------------------------------------------------- | ------------------------------------------------------ | -------------------- | | KEY_VOICE_MAIL_NUMBER_STRING | "voice_mail_number_string" | Voice mailbox number. | | KEY_IMS_SWITCH_ON_BY_DEFAULT_BOOL | "ims_switch_on_by_default_bool" | Fixed dialing number. | | KEY_HIDE_IMS_SWITCH_BOOL | "hide_ims_switch_bool" | Whether to hide the IMS switch. | @@ -2960,7 +4063,7 @@ Enumerates carrier configuration keys. | KEY_IMS_PREFER_FOR_EMERGENCY_BOOL | "ims_prefer_for_emergency_bool" | IMS preferences for emergency. | | KEY_CALL_WAITING_SERVICE_CLASS_INT | "call_waiting_service_class_int" | Call waiting service. | | KEY_CALL_TRANSFER_VISIBILITY_BOOL | "call_transfer_visibility_bool" | Call transfer visibility. | -| KEY_IMS_CALL_DISCONNECT_REASONINFO_MAPPING_STRING_ARRAY | "ims_call_disconnect_reasoninfo_mapping_string_array" | List of IMS call disconnection reasons.| +| KEY_IMS_CALL_DISCONNECT_REASON_INFO_MAPPING_STRING_ARRAY| "ims_call_disconnect_reason_info_mapping_string_array" | List of IMS call disconnection reasons.| | KEY_FORCE_VOLTE_SWITCH_ON_BOOL | "force_volte_switch_on_bool" | Whether to forcibly turn on VoLTE. | | KEY_ENABLE_OPERATOR_NAME_CUST_BOOL | "enable_operator_name_cust_bool" | Whether to display the carrier name.| | KEY_OPERATOR_NAME_CUST_STRING | "operator_name_cust_string" | Carrier name. | diff --git a/en/application-dev/reference/apis/js-apis-sms.md b/en/application-dev/reference/apis/js-apis-sms.md index 901e3b258b7aa73530935baa81a6366f7aa50e65..fa060c0d474ef8b0fdca74e517bfebca03f44b7a 100644 --- a/en/application-dev/reference/apis/js-apis-sms.md +++ b/en/application-dev/reference/apis/js-apis-sms.md @@ -16,7 +16,7 @@ import sms from '@ohos.telephony.sms'; createMessage\(pdu: Array<number>, specification: string, callback: AsyncCallback\): void -Creates an SMS message instance based on the protocol data unit (PDU) and the specified SMS protocol. This API uses an asynchronous callback to return the result. +Creates an SMS instance based on the protocol data unit (PDU) and specified SMS protocol. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Telephony.SmsMms @@ -44,7 +44,7 @@ sms.createMessage(pdu, specification, (err, data) => { createMessage\(pdu: Array<number>, specification: string\): Promise -Creates an SMS message instance based on the PDU and the specified SMS protocol. This API uses a promise to return the result. +Creates an SMS instance based on the PDU and specified SMS protocol. This API uses a promise to return the result. **System capability**: SystemCapability.Telephony.SmsMms @@ -81,7 +81,7 @@ sendMessage(options: SendMessageOptions): void Sends an SMS message. -**Required permission**: ohos.permission.SEND_MESSAGES +**Required permissions**: ohos.permission.SEND_MESSAGES **System capability**: SystemCapability.Telephony.SmsMms @@ -114,7 +114,7 @@ sms.sendMessage(options); getDefaultSmsSlotId\(callback: AsyncCallback<number>\): void -Obtains the default slot of the SIM card used to send SMS messages. This API uses an asynchronous callback to return the result. +Obtains the default slot ID of the SIM card used to send SMS messages. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Telephony.SmsMms @@ -122,7 +122,7 @@ Obtains the default slot of the SIM card used to send SMS messages. This API use | Name | Type | Mandatory| Description | | -------- | --------------------------- | ---- | ---------------------------------------- | -| callback | AsyncCallback<number> | Yes | Callback used to return the result.
- **0**: card slot 1
- **1**: card slot 2| +| callback | AsyncCallback<number> | Yes | Callback used to return the result.
- **0**: card slot 1
- **1**: card slot 2| **Example** @@ -137,7 +137,7 @@ sms.getDefaultSmsSlotId((err, data) => { getDefaultSmsSlotId\(\): Promise<number> -Obtains the default slot of the SIM card used to send SMS messages. This API uses a promise to return the result. +Obtains the default slot ID of the SIM card used to send SMS messages. This API uses a promise to return the result. **System capability**: SystemCapability.Telephony.SmsMms @@ -162,11 +162,11 @@ promise.then(data => { setDefaultSmsSlotId\(slotId: number, callback: AsyncCallback<void>\): void -Sets the default slot of the SIM card used to send SMS messages. This API uses an asynchronous callback to return the result. +Sets the default slot ID of the SIM card used to send SMS messages. This API uses an asynchronous callback to return the result. **System API**: This is a system API. -**Required permission**: ohos.permission.SET_TELEPHONY_STATE +**Required permissions**: ohos.permission.SET_TELEPHONY_STATE **System capability**: SystemCapability.Telephony.SmsMms @@ -174,9 +174,22 @@ Sets the default slot of the SIM card used to send SMS messages. This API uses a | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | ------------------------------------------------------------ | -| slotId | number | Yes | SIM card slot ID.
- **0**: card slot 1
- **1**: card slot 2
- **-1**: clearing the default configuration| +| slotId | number | Yes | SIM card slot ID.
- **0**: card slot 1
- **1**: card slot 2
- **-1**: Clears the default configuration.| | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -190,11 +203,11 @@ sms.setDefaultSmsSlotId(0, (err, data) => { setDefaultSmsSlotId\(slotId: number\): Promise<void> -Sets the default slot of the SIM card used to send SMS messages. This API uses a promise to return the result. +Sets the default slot ID of the SIM card used to send SMS messages. This API uses a promise to return the result. **System API**: This is a system API. -**Required permission**: ohos.permission.SET_TELEPHONY_STATE +**Required permissions**: ohos.permission.SET_TELEPHONY_STATE **System capability**: SystemCapability.Telephony.SmsMms @@ -202,13 +215,26 @@ Sets the default slot of the SIM card used to send SMS messages. This API uses a | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------------------------------------------------------------ | -| slotId | number | Yes | SIM card slot ID.
- **0**: card slot 1
- **1**: card slot 2
- **-1**: clearing the default configuration| +| slotId | number | Yes | SIM card slot ID.
- **0**: card slot 1
- **1**: card slot 2
- **-1**: Clears the default configuration.| **Return value** -| Type | Description | -| -------------- | ------------------------------- | -| Promise\ | Promise used to return the result. | +| Type | Description | +| --------------- | ------------------------------- | +| Promise\ | Promise used to return the result.| + +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | **Example** @@ -229,7 +255,7 @@ Sets the short message service center (SMSC) address. This API uses an asynchron **System API**: This is a system API. -**Required permission**: ohos.permission.SET_TELEPHONY_STATE (a system permission) +**Required permissions**: ohos.permission.SET_TELEPHONY_STATE (a system permission) **System capability**: SystemCapability.Telephony.SmsMms @@ -241,6 +267,18 @@ Sets the short message service center (SMSC) address. This API uses an asynchron | smscAddr | string | Yes | SMSC address. | | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -260,7 +298,7 @@ Sets the SMSC address. This API uses a promise to return the result. **System API**: This is a system API. -**Required permission**: ohos.permission.SET_TELEPHONY_STATE (a system permission) +**Required permissions**: ohos.permission.SET_TELEPHONY_STATE (a system permission) **System capability**: SystemCapability.Telephony.SmsMms @@ -277,6 +315,18 @@ Sets the SMSC address. This API uses a promise to return the result. | ------------------- | ------------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -299,7 +349,7 @@ Obtains the SMSC address. This API uses an asynchronous callback to return the r **System API**: This is a system API. -**Required permission**: ohos.permission.GET_TELEPHONY_STATE (a system permission) +**Required permissions**: ohos.permission.GET_TELEPHONY_STATE (a system permission) **System capability**: SystemCapability.Telephony.SmsMms @@ -310,6 +360,18 @@ Obtains the SMSC address. This API uses an asynchronous callback to return the r | slotId | number | Yes | SIM card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback<string> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -328,7 +390,7 @@ Obtains the SMSC address. This API uses a promise to return the result. **System API**: This is a system API. -**Required permission**: ohos.permission.GET_TELEPHONY_STATE (a system permission) +**Required permissions**: ohos.permission.GET_TELEPHONY_STATE (a system permission) **System capability**: SystemCapability.Telephony.SmsMms @@ -344,6 +406,18 @@ Obtains the SMSC address. This API uses a promise to return the result. | --------------------- | --------------------------------------------- | | Promise<string> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -360,7 +434,7 @@ promise.then(data => { hasSmsCapability(): boolean -Checks whether the current device can send and receive SMS messages. This API returns the result synchronously. +Checks whether the current device can send and receive SMS messages. This API works in synchronous mode. **System capability**: SystemCapability.Telephony.SmsMms @@ -383,7 +457,7 @@ Splits an SMS message into multiple segments. This API uses an asynchronous call **System API**: This is a system API. -**Required permission**: ohos.permission.SEND_MESSAGES +**Required permissions**: ohos.permission.SEND_MESSAGES **System capability**: SystemCapability.Telephony.SmsMms @@ -394,6 +468,18 @@ Splits an SMS message into multiple segments. This API uses an asynchronous call | content | string | Yes | SMS message content. The value cannot be null.| | callback | AsyncCallback> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -412,7 +498,7 @@ Splits an SMS message into multiple segments. This API uses a promise to return **System API**: This is a system API. -**Required permission**: ohos.permission.SEND_MESSAGES +**Required permissions**: ohos.permission.SEND_MESSAGES **System capability**: SystemCapability.Telephony.SmsMms @@ -428,6 +514,18 @@ Splits an SMS message into multiple segments. This API uses a promise to return | ----------------------- | ----------------------------------- | | Promise> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -448,7 +546,7 @@ Adds a SIM message. This API uses an asynchronous callback to return the result. **System API**: This is a system API. -**Required permission**: ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES +**Required permissions**: ohos.permission.RECEIVE_SMS and ohos.permission.SEND_MESSAGES **System capability**: SystemCapability.Telephony.SmsMms @@ -459,6 +557,18 @@ Adds a SIM message. This API uses an asynchronous callback to return the result. | options | [SimMessageOptions](#simmessageoptions7) | Yes | SIM message options.| | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -482,7 +592,7 @@ Adds a SIM message. This API uses a promise to return the result. **System API**: This is a system API. -**Required permission**: ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES +**Required permissions**: ohos.permission.RECEIVE_SMS and ohos.permission.SEND_MESSAGES **System capability**: SystemCapability.Telephony.SmsMms @@ -498,6 +608,18 @@ Adds a SIM message. This API uses a promise to return the result. | ------------------- | ----------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -523,7 +645,7 @@ Deletes a SIM message. This API uses an asynchronous callback to return the resu **System API**: This is a system API. -**Required permission**: ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES +**Required permissions**: ohos.permission.RECEIVE_SMS and ohos.permission.SEND_MESSAGES **System capability**: SystemCapability.Telephony.SmsMms @@ -535,6 +657,18 @@ Deletes a SIM message. This API uses an asynchronous callback to return the resu | msgIndex | number | Yes | Message index. | | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -554,7 +688,7 @@ Deletes a SIM message. This API uses a promise to return the result. **System API**: This is a system API. -**Required permission**: ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES +**Required permissions**: ohos.permission.RECEIVE_SMS and ohos.permission.SEND_MESSAGES **System capability**: SystemCapability.Telephony.SmsMms @@ -571,6 +705,18 @@ Deletes a SIM message. This API uses a promise to return the result. | ------------------- | ----------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -592,7 +738,7 @@ Updates a SIM message. This API uses an asynchronous callback to return the resu **System API**: This is a system API. -**Required permission**: ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES +**Required permissions**: ohos.permission.RECEIVE_SMS and ohos.permission.SEND_MESSAGES **System capability**: SystemCapability.Telephony.SmsMms @@ -603,6 +749,18 @@ Updates a SIM message. This API uses an asynchronous callback to return the resu | options | [UpdateSimMessageOptions](#updatesimmessageoptions7) | Yes | SIM message updating options.| | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -627,7 +785,7 @@ Updates a SIM message. This API uses a promise to return the result. **System API**: This is a system API. -**Required permission**: ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES +**Required permissions**: ohos.permission.RECEIVE_SMS and ohos.permission.SEND_MESSAGES **System capability**: SystemCapability.Telephony.SmsMms @@ -643,6 +801,18 @@ Updates a SIM message. This API uses a promise to return the result. | ------------------- | ----------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -669,7 +839,7 @@ Obtains all SIM card messages. This API uses an asynchronous callback to return **System API**: This is a system API. -**Required permission**: ohos.permission.RECEIVE_SMS +**Required permissions**: ohos.permission.RECEIVE_SMS **System capability**: SystemCapability.Telephony.SmsMms @@ -680,6 +850,18 @@ Obtains all SIM card messages. This API uses an asynchronous callback to return | slotId | number | Yes | SIM card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -698,7 +880,7 @@ Obtains all SIM card messages. This API uses a promise to return the result. **System API**: This is a system API. -**Required permission**: ohos.permission.RECEIVE_SMS +**Required permissions**: ohos.permission.RECEIVE_SMS **System capability**: SystemCapability.Telephony.SmsMms @@ -714,6 +896,18 @@ Obtains all SIM card messages. This API uses a promise to return the result. | ------------------------------------------------------- | ---------------------------------- | | PromiseArray<[SimShortMessage](#simshortmessage7)\>> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -734,7 +928,7 @@ Sets the cell broadcast configuration. This API uses an asynchronous callback to **System API**: This is a system API. -**Required permission**: ohos.permission.RECEIVE_SMS +**Required permissions**: ohos.permission.RECEIVE_SMS **System capability**: SystemCapability.Telephony.SmsMms @@ -745,6 +939,18 @@ Sets the cell broadcast configuration. This API uses an asynchronous callback to | options | [CBConfigOptions](#cbconfigoptions7) | Yes | Cell broadcast configuration options.| | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -769,7 +975,7 @@ Sets the cell broadcast configuration. This API uses a promise to return the res **System API**: This is a system API. -**Required permission**: ohos.permission.RECEIVE_SMS +**Required permissions**: ohos.permission.RECEIVE_SMS **System capability**: SystemCapability.Telephony.SmsMms @@ -785,6 +991,18 @@ Sets the cell broadcast configuration. This API uses a promise to return the res | ------------------- | ----------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -820,7 +1038,18 @@ Obtains SMS message segment information. This API uses an asynchronous callback | slotId | number | Yes | SIM card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | message | string | Yes | SMS message. | | force7bit | boolean | Yes | Whether to use 7-bit coding. | -| callback | | Yes | Callback used to return the result. | +| callback | AsyncCallback<[SmsSegmentsInfo](#smssegmentsinfo8)> | Yes | Callback used to return the result. | + +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | **Example** @@ -847,14 +1076,25 @@ Obtains SMS message segment information. This API uses a promise to return the r | Name | Type | Mandatory| Description | | --------- | ------- | ---- | ----------------------------------------- | | slotId | number | Yes | SIM card slot ID.
- **0**: card slot 1
- **1**: card slot 2| -| message | string | Yes | Message | +| message | string | Yes | SMS message. | | force7bit | boolean | Yes | Whether to use 7-bit coding. | **Return value** | Type | Description | | ------------------------------------------------------- | ----------------------------- | -| | Promise used to return the result.| +| Promise<[SmsSegmentsInfo](#smssegmentsinfo8)> | Promise used to return the result.| + +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | **Example** @@ -885,6 +1125,17 @@ Checks whether SMS is supported on IMS. This API uses an asynchronous callback t | slotId | number | Yes | SIM card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback<boolean> | Yes | Callback used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -899,7 +1150,7 @@ sms.isImsSmsSupported(slotId, (err, data) => { isImsSmsSupported(slotId: number): Promise -Checks whether SMS is supported on IMS. This API uses a promise to return the result. +This API uses an asynchronous callback to return the result. This API uses a promise to return the result. **System API**: This is a system API. @@ -917,6 +1168,17 @@ Checks whether SMS is supported on IMS. This API uses a promise to return the re | ---------------------- | ----------------------- | | Promise<boolean> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -945,6 +1207,18 @@ Obtains the SMS format supported by the IMS. This API uses an asynchronous callb | -------- | --------------------------- | ---- | ---------- | | callback | AsyncCallback<string> | Yes | Callback used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -970,6 +1244,18 @@ Obtains the SMS format supported by the IMS. This API uses a promise to return t | --------------------- | -------------------------- | | Promise<string> | Promise used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -998,6 +1284,17 @@ Decodes MMS messages. This API uses an asynchronous callback to return the resul | mmsFilePathName | string \|Array | Yes | MMS message file path.| | callback | AsyncCallback<[MmsInformation](#mmsinformation8)> | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1030,6 +1327,17 @@ Decodes MMS messages. This API uses a promise to return the result. | --------------------------------------------------------- | --------------------------- | | Promise<<[MmsInformation](#mmsinformation8)>> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1046,7 +1354,7 @@ promise.then(data => { encodeMms(mms: MmsInformation, callback: AsyncCallback>): void -Encodes MMS messages. This API uses an asynchronous callback to return the result. +MMS message code. This API uses an asynchronous callback to return the result. **System API**: This is a system API. @@ -1059,6 +1367,17 @@ Encodes MMS messages. This API uses an asynchronous callback to return the resul | mms | [MmsInformation](#mmsinformation8) | Yes | MMS message information.| | callback | AsyncCallback<Array> | Yes | Callback used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1081,7 +1400,7 @@ sms.encodeMms(mmsInformation, (err, data) => { encodeMms(mms: MmsInformation): Promise> -Encodes MMS messages. This API uses a promise to return the result. +MMS message code. This API uses a promise to return the result. **System API**: This is a system API. @@ -1099,6 +1418,17 @@ Encodes MMS messages. This API uses a promise to return the result. | ----------------------------- | ----------------------------------- | | Promise<Array> | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1125,19 +1455,19 @@ Defines an SMS message instance. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory | Description | -| -------- | ------- | --------- | ----------- | -| hasReplyPath | boolean | Yes |Whether the received SMS contains **TP-Reply-Path**. The default value is **false**.
**TP-Reply-Path**: The device returns a response based on the SMSC that sends the SMS message.| -| isReplaceMessage | boolean | Yes |Whether the received SMS message is a **replace short message**. The default value is **false**.
For details, see section 9.2.3.9 in **3GPP TS 23.040**.| -| isSmsStatusReportMessage | boolean | Yes |Whether the received SMS message is an SMS delivery status report. The default value is **false**.
**SMS-Status-Report**: a message sent from the SMSC to the mobile station to show the SMS message delivery status.| -| messageClass | [ShortMessageClass](#shortmessageclass) | Yes | SMS message type. | -| pdu | Array<number> | Yes | PDU in the SMS message. | -| protocolId | number | Yes | Protocol identifier used for delivering the SMS message. | -| scAddress | string | Yes | SMSC address. | -| scTimestamp | number | Yes | SMSC timestamp. | -| status | number | Yes | SMS message status sent by the SMSC in the **SMS-STATUS-REPORT** message.| -| visibleMessageBody | string | Yes | SMS message body. | -| visibleRawAddress | string | Yes | Sender address. | +| Name | Type | Mandatory| Description | +| ------------------------ | --------------------------------------- | ---- | ------------------------------------------------------------ | +| hasReplyPath | boolean | Yes | Whether the received SMS contains **TP-Reply-Path**. The default value is **false**.
TP-Reply-Path: The device returns a response based on the SMSC that sends the SMS message. | +| isReplaceMessage | boolean | Yes | Whether the received SMS message is a **replace short message**. The default value is **false**.
For details, see section 9.2.3.9 in **3GPP TS 23.040**.| +| isSmsStatusReportMessage | boolean | Yes | Whether the received SMS message is an SMS delivery report. The default value is **false**.
SMS delivery report: a message sent from the SMSC to show the current status of the SMS message you delivered.| +| messageClass | [ShortMessageClass](#shortmessageclass) | Yes | Enumerates SMS message types. | +| pdu | Array<number> | Yes | PDU in the SMS message. | +| protocolId | number | Yes | Protocol identifier used for delivering the SMS message. | +| scAddress | string | Yes | SMSC address. | +| scTimestamp | number | Yes | SMSC timestamp. | +| status | number | Yes | SMS message status sent by the SMSC in the **SMS-STATUS-REPORT** message.| +| visibleMessageBody | string | Yes | SMS message body. | +| visibleRawAddress | string | Yes | Sender address. | ## ShortMessageClass @@ -1161,7 +1491,7 @@ Provides the options (including callbacks) for sending an SMS message. For examp **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | ---------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | slotId | number | Yes | Slot ID of the SIM card used for sending SMS messages.
- **0**: card slot 1
- **1**: card slot 2 | | destinationHost | string | Yes | Destination address of the SMS message. | @@ -1178,22 +1508,22 @@ Provides the callback for the SMS message sending result. It consists of three p **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | -| ---------- | ------------------------------- | ---- | ------------------------------------------------------------ | +| Name | Type | Mandatory| Description | +| ---------- | ------------------------------- | ---- | ----------------------------------------------------------------------------------------- | | isLastPart | boolean | No | Whether this SMS message is the last part of a long SMS message. The value **true** indicates that this SMS message is the last part of a long SMS message, and value **false** indicates the opposite. The default value is **false**.| -| result | [SendSmsResult](#sendsmsresult) | Yes | SMS message sending result. | -| url | string | Yes | URI for storing the sent SMS message. | +| result | [SendSmsResult](#sendsmsresult) | Yes | SMS message sending result. | +| url | string | Yes | URI for storing the sent SMS message. | ## IDeliveryShortMessageCallback -Provides the callback for the SMS message delivery report. +Provides the callback for the SMS message delivery report. **System capability**: SystemCapability.Telephony.SmsMms | Name| Type | Mandatory| Description | -| ------ | ------------------- | ---- | -------------- | -| pdu | Array<number> | Yes | SMS message delivery report.| +| ---- | ------------------- | ---- | -------------- | +| pdu | Array<number> | Yes | SMS message delivery report.| ## SendSmsResult @@ -1209,7 +1539,6 @@ Enumerates SMS message sending results. | SEND_SMS_FAILURE_RADIO_OFF | 2 | Failed to send the SMS message because the modem is shut down. | | SEND_SMS_FAILURE_SERVICE_UNAVAILABLE | 3 | Failed to send the SMS message because the network is unavailable or SMS message sending or receiving is not supported.| - ## MmsInformation8+ Defines the MMS message information. @@ -1218,10 +1547,10 @@ Defines the MMS message information. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | -| ----------- | ------------------------------------------------------------ | ---- | --------- | -| messageType | [MessageType](#messagetype8) | Yes | Message type. | -| mmsType | [MmsSendReq](#mmssendreq8) \|[MmsSendConf](#mmssendconf8) \|[MmsNotificationInd](#mmsnotificationind8) \|[MmsRespInd](#mmsrespind8) \|[MmsRetrieveConf](#mmsretrieveconf8)\|[MmsAcknowledgeInd](#mmsacknowledgeind8)\|[MmsDeliveryInd](#mmsdeliveryind8)\|[MmsReadOrigInd](#mmsreadorigind8)\|[MmsReadRecInd](#mmsreadrecind8)| Yes | PDU header type.| +| Name | Type | Mandatory| Description | +| ----------- | ------------------------------------------------------------ | ---- | ---------- | +| messageType | [MessageType](#messagetype8) | Yes | Message type.| +| mmsType | [MmsSendReq](#mmssendreq8) \|[MmsSendConf](#mmssendconf8) \|[MmsNotificationInd](#mmsnotificationind8) \|[MmsRespInd](#mmsrespind8) \|[MmsRetrieveConf](#mmsretrieveconf8)\|[MmsAcknowledgeInd](#mmsacknowledgeind8)\|[MmsDeliveryInd](#mmsdeliveryind8)\|[MmsReadOrigInd](#mmsreadorigind8)\|[MmsReadRecInd](#mmsreadrecind8) | Yes | PDU header type.| | attachment | Array<[MmsAttachment](#mmsattachment8)\> | No | Attachment. | ## MmsSendReq8+ @@ -1232,13 +1561,13 @@ Defines an MMS message sending request. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | ---------------- | ------------------------------------ | ---- | ------------ | | from | [MmsAddress](#mmsaddress8) | Yes | MMS message source. | | transactionId | string | Yes | Transaction ID. | | contentType | string | Yes | Content type. | | version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | -| to | Array<[MmsAddress](#mmsaddress8)\> | No | Address to which the message is sent. | +| to | Array<[MmsAddress](#mmsaddress8)\> | No | Destination address. | | date | number | No | Date. | | cc | Array<[MmsAddress](#mmsaddress8)\> | No | Carbon copy. | | bcc | Array<[MmsAddress](#mmsaddress8)\> | No | Blind carbon copy. | @@ -1258,7 +1587,7 @@ Defines the MMS message sending configuration. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | ------------- | ---------------------------------- | ---- | -------- | | responseState | number | Yes | Response status.| | transactionId | string | Yes | Transaction ID. | @@ -1273,7 +1602,7 @@ Defines an MMS notification index. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | --------------- | ---------------------------------- | ---- | -------- | | transactionId | string | Yes | Transaction ID. | | messageClass | number | Yes | Message class. | @@ -1281,7 +1610,7 @@ Defines an MMS notification index. | expiry | number | Yes | Expiration. | | contentLocation | string | Yes | Content location.| | version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | -| from | [MmsAddress](#mmsaddress8) | No | Source. | +| from | [MmsAddress](#mmsaddress8) | No | Source address. | | subject | string | No | Subject. | | deliveryReport | number | No | Status report.| | contentClass | number | No | Content class. | @@ -1294,7 +1623,7 @@ Defines an MMS confirmation index. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | ------------- | ---------------------------------- | ---- | -------- | | transactionId | string | Yes | Transaction ID. | | version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | @@ -1308,15 +1637,15 @@ Defines the MMS message retrieval configuration. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | -------------- | ------------------------------------ | ---- | -------- | | transactionId | string | Yes | Transaction ID. | | messageId | string | Yes | Message ID. | | date | number | Yes | Date. | | contentType | string | Yes | Content type.| -| to | Array<[MmsAddress](#mmsaddress8)\> | Yes | Address to which the message is sent. | -| version | [MmsVersionType](#mmsversiontype8) | Yes | Version | -| from | [MmsAddress](#mmsaddress8) | No | Source. | +| to | Array<[MmsAddress](#mmsaddress8)\> | Yes | Destination address. | +| version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | +| from | [MmsAddress](#mmsaddress8) | No | Source address. | | cc | Array<[MmsAddress](#mmsaddress8)\> | No | Carbon copy. | | subject | string | No | Subject. | | priority | [MmsPriorityType](#mmsprioritytype8) | No | Priority. | @@ -1333,16 +1662,15 @@ Defines the original MMS message reading index. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | ---------- | ---------------------------------- | ---- | -------- | | version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | | messageId | string | Yes | Message ID. | -| to | Array<[MmsAddress](#mmsaddress8)\> | Yes | Address to which the message is sent. | -| from | [MmsAddress](#mmsaddress8) | Yes | Source. | +| to | Array<[MmsAddress](#mmsaddress8)\> | Yes | Destination address. | +| from | [MmsAddress](#mmsaddress8) | Yes | Source address. | | date | number | Yes | Date. | | readStatus | number | Yes | Read status.| - ## MmsReadRecInd8+ Defines the MMS message reading index. @@ -1351,16 +1679,15 @@ Defines the MMS message reading index. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | ---------- | ---------------------------------- | ---- | -------- | -| version | [MmsVersionType](#mmsversiontype8) | Yes | Version | +| version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | | messageId | string | Yes | Message ID. | -| to | Array<[MmsAddress](#mmsaddress8)\> | Yes | Destination. | -| from | [MmsAddress](#mmsaddress8) | Yes | Source. | -| readStatus | number | Yes | Read state.| +| to | Array<[MmsAddress](#mmsaddress8)\> | Yes | Destination address. | +| from | [MmsAddress](#mmsaddress8) | Yes | Source address. | +| readStatus | number | Yes | Read status.| | date | number | No | Date. | - ## MmsAttachment8+ Defines the attachment of an MMS message. @@ -1369,7 +1696,7 @@ Defines the attachment of an MMS message. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | ----------------------- | ------------------------------------ | ---- | ------------------ | | contentId | string | Yes | Content ID. | | contentLocation | string | Yes | Content location. | @@ -1378,7 +1705,7 @@ Defines the attachment of an MMS message. | contentType | string | Yes | Content type. | | isSmil | boolean | Yes | Whether the synchronized multimedia integration language is used.| | path | string | No | Path. | -| inBuff | Array | No | In the buffer | +| inBuff | Array | No | Whether the message is in the buffer. | | fileName | string | No | File name. | | charset | [MmsCharSets](#mmscharsets8) | No | Character set. | @@ -1390,20 +1717,20 @@ Defines an MMSC address. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | ------- | ---------------------------- | ---- | ------ | -| address | string | Yes | MMSC address. | +| address | string | Yes | Network address. | | charset | [MmsCharSets](#mmscharsets8) | Yes | Character set.| ## MessageType8+ -Enumerates message types. +Message type. **System API**: This is a system API. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Value | Description | +| Name | Value | Description | | ------------------------- | ---- | -------------------- | | TYPE_MMS_SEND_REQ | 128 | MMS message sending request. | | TYPE_MMS_SEND_CONF | 129 | MMS message sending configuration. | @@ -1423,7 +1750,7 @@ Enumerates MMS message priorities. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Value | Description | +| Name | Value | Description | | ---------- | ---- | -------------- | | MMS_LOW | 128 | Low priority. | | MMS_NORMAL | 129 | Normal priority.| @@ -1437,7 +1764,7 @@ Enumerates MMS versions. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Value | Description | +| Name | Value | Description | | --------------- | ---- | ----------- | | MMS_VERSION_1_0 | 0x10 | MMS version 1_0.| | MMS_VERSION_1_1 | 0x11 | MMS version 1_1.| @@ -1452,7 +1779,7 @@ Enumerates MMS character sets. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Value | Description | +| Name | Value | Description | | --------------- | ------ | ------------------- | | BIG5 | 0X07EA | BIG5 format. | | ISO_10646_UCS_2 | 0X03E8 | ISO_10646_UCS_2 format.| @@ -1477,7 +1804,7 @@ Enumerates disposition types. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Value | Description | +| Name | Value | Description | | ---------- | ---- | -------- | | FROM_DATA | 0 | Data source.| | ATTACHMENT | 1 | Attachment. | @@ -1491,7 +1818,7 @@ Enumerates report types. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Value | Description| +| Name | Value | Description| | ------- | ---- | ---- | | MMS_YES | 128 | YES | | MMS_NO | 129 | NO | @@ -1504,7 +1831,7 @@ Defines the cell broadcast configuration options. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | -------------- | -------------------- | ---- | ------------ | | slotId | number | Yes | Card slot ID. | | enable | boolean | Yes | Whether to enable cell broadcast. | @@ -1520,7 +1847,7 @@ Defines the SIM message status. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Value | Description | +| Name | Value | Description | | ------------------------- | ---- | --------------------------- | | SIM_MESSAGE_STATUS_FREE | 0 | Free state. | | SIM_MESSAGE_STATUS_READ | 1 | Read state. | @@ -1530,13 +1857,13 @@ Defines the SIM message status. ## RanType7+ -Enumerates RAN types. +RAN type. **System API**: This is a system API. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Value | Description| +| Name | Value | Description| | --------- | ---- | ---- | | TYPE_GSM | 1 | GSM | | TYPE_CDMA | 2 | CMDA | @@ -1549,7 +1876,7 @@ Enumerates SMS encoding schemes. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Value | Description | +| Name | Value | Description | | -------------------- | ---- | ------------ | | SMS_ENCODING_UNKNOWN | 0 | Unknown code.| | SMS_ENCODING_7BIT | 1 | 7-digit code. | @@ -1564,12 +1891,12 @@ Defines the SIM message options. **System capability**: SystemCapability.Telephony.SmsMms -| Name| Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | ------ | -------------------------------------- | ---- | -------------- | | slotId | number | Yes | Card slot ID. | | smsc | string | Yes | Short message service center.| | pdu | string | Yes | Protocol data unit. | -| status | [SimMessageStatus](#simmessagestatus7) | Yes | Message status. | +| status | [SimMessageStatus](#simmessagestatus7) | Yes | Status. | ## UpdateSimMessageOptions7+ @@ -1579,7 +1906,7 @@ Defines the updating SIM message options. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | --------- | -------------------------------------- | ---- | -------------- | | slotId | number | Yes | Card slot ID. | | msgIndex | number | Yes | Message index. | @@ -1595,7 +1922,7 @@ Defines a SIM message. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | ---------------- | -------------------------------------- | ---- | ------------- | | shortMessage | [ShortMessage](#shortmessage) | Yes | SMS message. | | simMessageStatus | [SimMessageStatus](#simmessagestatus7) | Yes | SIM message status.| @@ -1609,12 +1936,12 @@ Defines an MMS message delivery index. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | --------- | ---------------------------------- | ---- | ------ | | messageId | string | Yes | Message ID.| | date | number | Yes | Date. | -| to | Array<[MmsAddress](#mmsaddress8)\> | Yes | Address to which the message is sent.| -| status | number | Yes | Status. | +| to | Array<[MmsAddress](#mmsaddress8)\> | Yes | Destination address.| +| status | number | Yes | Status | | version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | ## MmsRespInd8+ @@ -1625,7 +1952,7 @@ Defines an MMS response index. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | ------------- | ---------------------------------- | ---- | -------- | | transactionId | string | Yes | Event ID. | | status | number | Yes | Status. | @@ -1640,7 +1967,7 @@ Defines the SMS message segment information. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | -------------------- | ---------------------------------------- | ---- | ------------ | | splitCount | number | Yes | Split count. | | encodeCount | number | Yes | Encoding count. | diff --git a/en/application-dev/reference/apis/js-apis-stack.md b/en/application-dev/reference/apis/js-apis-stack.md index ff8551cad86f3f4c448e08d267548657305c5c9d..46b06f608af9615bbb138bc54d82cab7f566c0fa 100644 --- a/en/application-dev/reference/apis/js-apis-stack.md +++ b/en/application-dev/reference/apis/js-apis-stack.md @@ -239,7 +239,7 @@ stack.push(4); stack.push(5); stack.push(4); stack.forEach((value, index) => { - console.log("value:" + value, index); + console.log("value:" + value, "index:" + index); }); ``` diff --git a/en/application-dev/reference/apis/js-apis-system-configuration.md b/en/application-dev/reference/apis/js-apis-system-configuration.md index 934ceb020412a18c64499de1cb0ef1593ace2e50..ddc277722b452b8dca63eb50972d9d1f4448726d 100644 --- a/en/application-dev/reference/apis/js-apis-system-configuration.md +++ b/en/application-dev/reference/apis/js-apis-system-configuration.md @@ -50,4 +50,3 @@ Defines attributes of the current locale. | language | string | Yes | No | Language, for example, **zh**.| | countryOrRegion | string | Yes | No | Country or region, for example, **CN** or **US**.| | dir | string | Yes | No | Text layout direction. The value can be:
- **ltr**: from left to right
- **rtl**: from right to left| -| unicodeSetting5+ | string | Yes | No | Unicode language key set determined by the locale. If current locale does not have a specific key set, an empty set is returned.
For example, **{"nu":"arab"}** indicates that current locale uses Arabic numerals.| diff --git a/en/application-dev/reference/apis/js-apis-system-package.md b/en/application-dev/reference/apis/js-apis-system-package.md index 5c562892d8f5d5a99423cb79a19478609612aed6..9644d0fa26cda69a6b035c0ba1e2bcbbc9f933dc 100644 --- a/en/application-dev/reference/apis/js-apis-system-package.md +++ b/en/application-dev/reference/apis/js-apis-system-package.md @@ -23,8 +23,6 @@ hasInstalled(options: CheckPackageHasInstalledOptions): void Checks whether an application exists, or whether a native application has been installed. -**Required permissions**: none - **System capability**: SystemCapability.BundleManager.BundleFramework **Parameters** diff --git a/en/application-dev/reference/apis/js-apis-system-time.md b/en/application-dev/reference/apis/js-apis-system-time.md index db46d5e2ba5aa49c34f683e61fad3b484c1ed36e..b1f745e7085764b193567866dc6e6a74e7cb04d4 100644 --- a/en/application-dev/reference/apis/js-apis-system-time.md +++ b/en/application-dev/reference/apis/js-apis-system-time.md @@ -4,7 +4,8 @@ The **systemTime** module provides system time and time zone features. You can u > **NOTE** > -> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> - The APIs of this module are deprecated since API version 9. You are advised to use the APIs of the [@ohos.systemDateTime (System Time and Time Zone)](js-apis-system-date-time.md) module. +> - The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. ## Modules to Import diff --git a/en/application-dev/reference/apis/js-apis-taskpool.md b/en/application-dev/reference/apis/js-apis-taskpool.md index a441a39e8bb232fd589a0b03e473890ef6bbbc5f..8773e4c9df7945a5b686601b7ad8f3de3694d2f4 100644 --- a/en/application-dev/reference/apis/js-apis-taskpool.md +++ b/en/application-dev/reference/apis/js-apis-taskpool.md @@ -64,6 +64,7 @@ function func(args) { console.log("func: " + args); return args; } + let task = new taskpool.Task(func, "this is my first Task"); ``` @@ -116,7 +117,12 @@ function func(args) { return args; } -let value = taskpool.execute(func, 100); +async function taskpoolTest() { + let value = await taskpool.execute(func, 100); + console.log("taskpool result: " + value); +} + +taskpoolTest(); ``` ## taskpool.execute @@ -158,8 +164,14 @@ function func(args) { console.log("func: " + args); return args; } -let task = new taskpool.Task(func, "this is my first Task"); -let value = taskpool.execute(task); + +async function taskpoolTest() { + let task = new taskpool.Task(func, 100); + let value = await taskpool.execute(task); + console.log("taskpool result: " + value); +} + +taskpoolTest(); ``` ## taskpool.cancel @@ -193,9 +205,14 @@ function func(args) { console.log("func: " + args); return args; } -let task = new taskpool.Task(func, "this is first Task"); -let value = taskpool.execute(task); -taskpool.cancel(task); + +async function taskpoolTest() { + let task = new taskpool.Task(func, 100); + let value = await taskpool.execute(task); + taskpool.cancel(task); +} + +taskpoolTest(); ``` ## Additional Information @@ -214,10 +231,18 @@ function func(args) { return args; } -let task = new taskpool.Task(func, "create task, then execute"); -let val1 = taskpool.execute(task); +async function taskpoolTest() { + // taskpool.execute(task) + let task = new taskpool.Task(func, "create task, then execute"); + let val1 = await taskpool.execute(task); + console.log("taskpool.execute(task) result: " + val1); -let val2 = taskpool.execute(func, "execute task by func"); + // taskpool.execute(function) + let val2 = await taskpool.execute(func, "execute task by func"); + console.log("taskpool.execute(function) result: " + val2); +} + +taskpoolTest(); ``` ```js @@ -226,7 +251,7 @@ let val2 = taskpool.execute(func, "execute task by func"); // b.ts export var c = 2000; -// a.ts +// a.ts (in the same directory as b.ts) import { c } from './b' function test(a) { @@ -236,8 +261,16 @@ function test(a) { return a; } -let task = new taskpool.Task(test, "create task, then execute"); -let val1 = taskpool.execute(task); +async function taskpoolTest() { + // taskpool.execute(task) + let task = new taskpool.Task(test, "create task, then execute"); + let val1 = await taskpool.execute(task); + console.log("taskpool.execute(task) result: " + val1); + + // taskpool.execute(function) + let val2 = await taskpool.execute(test, "execute task by func"); + console.log("taskpool.execute(function) result: " + val2); +} -let val2 = taskpool.execute(test, "execute task by func"); +taskpoolTest(); ``` diff --git a/en/application-dev/reference/apis/js-apis-telephony-data.md b/en/application-dev/reference/apis/js-apis-telephony-data.md index f1c9ad362175bd709d27bc4c7aec0059b413221e..8d913cb0c597bb8a0c5de46361d51d4582ae9ed7 100644 --- a/en/application-dev/reference/apis/js-apis-telephony-data.md +++ b/en/application-dev/reference/apis/js-apis-telephony-data.md @@ -1,6 +1,6 @@ # @ohos.telephony.data (Cellular Data) -The **data** module provides basic mobile data management functions. You can obtain and set the default slot of the SIM card used for mobile data, and obtain the uplink and downlink connection status of cellular data services and connection status of the packet switched (PS) domain. Besides, you can check whether cellular data services and data roaming are enabled. +The cellular data module provides basic mobile data management functions. You can obtain and set the default slot of the SIM card used for mobile data, and obtain the uplink and downlink connection status of cellular data services and connection status of the packet switched (PS) domain. Besides, you can check whether cellular data services and data roaming are enabled. >**NOTE** > @@ -98,6 +98,20 @@ This is a system API. | slotId | number | Yes | SIM card slot ID.
**0**: card slot 1
**1**: card slot 2
**-1**: Clears the default configuration.| | callback | AsyncCallback\ | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301001 | SIM card is not activated. | + **Example** ```js @@ -130,6 +144,20 @@ This is a system API. | --------------- | ------------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301001 | SIM card is not activated. | + **Example** ```js @@ -251,6 +279,18 @@ Checks whether the cellular data service is enabled. This API uses an asynchrono | -------- | ------------------------ | ---- | ------------------------------------------------------------ | | callback | AsyncCallback\ | Yes | Callback used to return the result.
**true**: The cellular data service is enabled.
**false**: The cellular data service is disabled.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -275,6 +315,18 @@ Checks whether the cellular data service is enabled. This API uses a promise to | ------------------ | ------------------------------------------------------------ | | Promise\ | Promise used to return the result.
**true**: The cellular data service is enabled.
**false**: The cellular data service is disabled.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -303,6 +355,18 @@ Checks whether roaming is enabled for the cellular data service. This API uses a | slotId | number | Yes | Card slot ID.
**0**: card slot 1
**1**: card slot 2 | | callback | AsyncCallback\ | Yes | Callback used to return the result.
**true**: Roaming is enabled for the cellular data service.
**false**: Roaming is disabled for the cellular data service.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -333,6 +397,18 @@ Checks whether roaming is enabled for the cellular data service. This API uses a | ------------------ | ------------------------------------------------------------ | | Promise\ | Promise used to return the result.
**true**: Roaming is enabled for the cellular data service.
**false**: Roaming is disabled for the cellular data service.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -362,6 +438,18 @@ This is a system API. | -------- | --------------------- | ---- | ---------- | | callback | AsyncCallback\ | Yes | Callback used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -388,6 +476,18 @@ This is a system API. | --------------- | ----------------------- | | Promise\ | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -417,6 +517,18 @@ This is a system API. | -------- | --------------------- | ---- | ---------- | | callback | AsyncCallback\ | Yes | Callback used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -443,6 +555,18 @@ This is a system API. | --------------- | --------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -473,6 +597,18 @@ This is a system API. | slotId | number | Yes | Card slot ID.
**0**: card slot 1
**1**: card slot 2| | callback | AsyncCallback\ | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -505,6 +641,18 @@ This is a system API. | --------------- | ------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -535,6 +683,18 @@ This is a system API. | slotId | number | Yes | Card slot ID.
**0**: card slot 1
**1**: card slot 2| | callback | AsyncCallback\ | Yes | Callback used to return the result. | +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -567,6 +727,18 @@ This is a system API. | --------------- | ------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js diff --git a/en/application-dev/reference/apis/js-apis-treemap.md b/en/application-dev/reference/apis/js-apis-treemap.md index eb874f0abd94f72f56f0e1e13a23883e1ae14ce8..473b5cb99e94c1ab84069d23591b63555bfcb7d5 100644 --- a/en/application-dev/reference/apis/js-apis-treemap.md +++ b/en/application-dev/reference/apis/js-apis-treemap.md @@ -1,8 +1,5 @@ # @ohos.util.TreeMap (Nonlinear Container TreeMap) -> **NOTE** -> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. - **TreeMap** stores key-value (KV) pairs. Each key must be unique and have only one value. **TreeMap** is implemented using a red-black tree, which is a binary search tree where keys are stored in sorted order for efficient insertion and removal. @@ -12,9 +9,15 @@ Recommended use case: Use **TreeMap** when you need to store KV pairs in sorted order. This topic uses the following to identify the use of generics: + - K: Key + - V: Value +> **NOTE** +> +> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. + ## Modules to Import ```ts @@ -609,7 +612,7 @@ Uses a callback to traverse the elements in this container and obtain their posi | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | callbackFn | function | Yes| Callback invoked to traverse the elements in the container.| -| thisArg | Object | No| Value to use when the callback is invoked.| +| thisArg | Object | No| Value of **this** to use when **callbackFn** is invoked.| callbackfn | Name| Type| Mandatory| Description| @@ -633,7 +636,7 @@ let treeMap = new TreeMap(); treeMap.set("sparrow", 123); treeMap.set("gull", 357); treeMap.forEach((value, key) => { - console.log("value:" + value, key); + console.log("value:" + value, "key:" + key); }); ``` diff --git a/en/application-dev/reference/apis/js-apis-treeset.md b/en/application-dev/reference/apis/js-apis-treeset.md index 4aaaac1861ceffdfda3d7adc53b16181c42cc9c3..5ca493adcae4ff144341f04d9d1641035ae98db8 100644 --- a/en/application-dev/reference/apis/js-apis-treeset.md +++ b/en/application-dev/reference/apis/js-apis-treeset.md @@ -1,8 +1,5 @@ # @ohos.util.TreeSet (Nonlinear Container TreeSet) -> **NOTE** -> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. - **TreeSet** is implemented based on **[TreeMap](js-apis-treemap.md)**. In **TreeSet**, only **value** objects are processed. **TreeSet** can be used to store values, each of which must be unique. **[HashSet](js-apis-hashset.md)** stores data in a random order, whereas **TreeSet** stores data in sorted order. Both of them allows only unique elements. However, null values are allowed in **HashSet**, but not allowed in **TreeSet**. @@ -10,8 +7,13 @@ Recommended use case: Use **TreeSet** when you need to store data in sorted order. This topic uses the following to identify the use of generics: + - T: Type +> **NOTE** +> +> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. + ## Modules to Import ```ts @@ -482,13 +484,13 @@ Uses a callback to traverse the elements in this container and obtain their posi | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | callbackFn | function | Yes| Callback invoked to traverse the elements in the container.| -| thisArg | Object | No| Value to use when the callback is invoked.| +| thisArg | Object | No| Value of **this** to use when **callbackFn** is invoked.| callbackfn | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | value | T | No| Value of the element that is currently traversed.| -| key | T | No| Key of the element that is currently traversed (same as **value**).| +| key | T | No| Key of the element that is currently traversed.| | set | TreeSet<T> | No| Instance that invokes the **forEach** method.| **Error codes** @@ -506,7 +508,7 @@ let treeSet = new TreeSet(); treeSet.add("sparrow"); treeSet.add("gull"); treeSet.forEach((value, key) => { - console.log("value:" + value, key) + console.log("value:" + value, "key:" + key); }); ``` diff --git a/en/application-dev/reference/apis/js-apis-uri.md b/en/application-dev/reference/apis/js-apis-uri.md index b3fb6f7a3ea58550cfa93a514591715952c52ad6..a8aed60f4a0bf23080f223eec440742847a258aa 100644 --- a/en/application-dev/reference/apis/js-apis-uri.md +++ b/en/application-dev/reference/apis/js-apis-uri.md @@ -226,9 +226,9 @@ Checks whether this URI is an absolute URI (whether the scheme component is defi ```js const uriInstance = new uri.URI('https://username:password@www.qwer.com:8080?query=pppppp'); -console.log(uriInstance.checkIsAbsolute()); // true +console.log(`${uriInstance.checkIsAbsolute()}`); // true const uriInstance1 = new uri.URI('xxx.com/suppliers.htm'); -console.log(uriInstance1.checkIsAbsolute()); // false +console.log(`${uriInstance1.checkIsAbsolute()}`); // false ``` diff --git a/en/application-dev/reference/apis/js-apis-util.md b/en/application-dev/reference/apis/js-apis-util.md index f4193680d4d0732a38ab9564bbd67428c7a3497a..ea60b649da3f2d73dfb9cba42dab8ccdee16cde0 100755 --- a/en/application-dev/reference/apis/js-apis-util.md +++ b/en/application-dev/reference/apis/js-apis-util.md @@ -26,7 +26,7 @@ Formats the specified values and inserts them into the string by replacing the w | Name | Type | Mandatory| Description | | ------- | -------- | ---- | -------------- | | format | string | Yes | String.| -| ...args | Object[] | No | Values to format. The formatted values will be replaced the wildcard in the string. | +| ...args | Object[] | No | Values to format. The formatted values will replace the wildcard in the string. If this parameter is not set, the first parameter is returned by default.| **Return value** @@ -69,6 +69,20 @@ let result = util.errnoToString(errnum); console.log("result = " + result); ``` +**Some error code and message examples** + +| Error Code| Message | +| ------ | -------------------------------- | +| -1 | operation not permitted | +| -2 | no such file or directory | +| -3 | no such process | +| -4 | interrupted system call | +| -5 | i/o error | +| -11 | resource temporarily unavailable | +| -12 | not enough memory | +| -13 | permission denied | +| -100 | network is down | + ## util.callbackWrapper callbackWrapper(original: Function): (err: Object, value: Object )=>void @@ -92,15 +106,14 @@ Calls back an asynchronous function. In the callback, the first parameter indica **Example** ```js - async function promiseFn() { - return Promise.reject('value'); - } - let err = "type err"; - let cb = util.callbackWrapper(promiseFn); - cb((err, ret) => { - console.log(err); - console.log(ret); - }, err) +async function fn() { + return 'hello world'; +} +let cb = util.callbackWrapper(fn); +cb((err, ret) => { + if (err) throw err; + console.log(ret); +}); ``` ## util.promisify9+ @@ -126,24 +139,30 @@ Processes an asynchronous function and returns a promise. **Example** ```js - function aysnFun(str1, str2) { - if (typeof str1 === 'object' && typeof str2 === 'object') { - return str2 - } else { - return str1 - } - } - let newPromiseObj = util.promisify(aysnFun); - newPromiseObj({ err: "type error" }, {value:'HelloWorld'}).then(res => { - console.log(res); - }) +function fun(num, callback) { + if (typeof num === 'number') { + callback(null, num + 3); + } else { + callback("type err"); + } +} + +const addCall = util.promisify(fun); +(async () => { + try { + let res = await addCall(2); + console.log(res); + } catch (err) { + console.log(err); + } +})(); ``` -## util.randomUUID9+ +## util.generateRandomUUID9+ -randomUUID(entropyCache?: boolean): string +generateRandomUUID(entropyCache?: boolean): string -Uses a secure random number generator to generate a random universally unique identifier (UUID) of RFC 4122 version 4. +Uses a secure random number generator to generate a random universally unique identifier (UUID) of the string type in RFC 4122 version 4. **System capability**: SystemCapability.Utils.Lang @@ -162,17 +181,17 @@ Uses a secure random number generator to generate a random universally unique id **Example** ```js - let uuid = util.randomUUID(true); + let uuid = util.generateRandomUUID(true); console.log("RFC 4122 Version 4 UUID:" + uuid); // Output: // RFC 4122 Version 4 UUID:88368f2a-d5db-47d8-a05f-534fab0a0045 ``` -## util.randomBinaryUUID9+ +## util.generateRandomBinaryUUID9+ -randomBinaryUUID(entropyCache?: boolean): Uint8Array +generateRandomBinaryUUID(entropyCache?: boolean): Uint8Array -Uses a secure random number generator to generate a random binary UUID of RFC 4122 version 4. +Uses a secure random number generator to generate a random UUID of the Uint8Array type in RFC 4122 version 4. **System capability**: SystemCapability.Utils.Lang @@ -191,7 +210,7 @@ Uses a secure random number generator to generate a random binary UUID of RFC 41 **Example** ```js - let uuid = util.randomBinaryUUID(true); + let uuid = util.generateRandomBinaryUUID(true); console.log(JSON.stringify(uuid)); // Output: // 138,188,43,243,62,254,70,119,130,20,235,222,199,164,140,150 @@ -201,7 +220,7 @@ Uses a secure random number generator to generate a random binary UUID of RFC 41 parseUUID(uuid: string): Uint8Array -Parses a UUID from a string, as described in RFC 4122 version 4. +Converts the UUID of the string type generated by **generateRandomUUID** to the UUID of the **Uint8Array** type generated by **generateRandomBinaryUUID**, as described in RFC 4122 version 4. **System capability**: SystemCapability.Utils.Lang @@ -243,7 +262,7 @@ Formats the specified values and inserts them into the string by replacing the w | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | format | string | Yes| String.| -| ...args | Object[] | No| Values to format. The formatted values will be replaced the wildcard in the string.| +| ...args | Object[] | No| Values to format. The formatted values will replace the wildcard in the string. If this parameter is not set, the first parameter is returned by default.| **Return value** @@ -361,8 +380,8 @@ Creates a **TextDecoder** object. It provides the same function as the deprecate **Example** ```js -let textDecoder = new util.TextDecoder() -textDecoder.create('utf-8', { ignoreBOM : true }); +let result = util.TextDecoder.create('utf-8', { ignoreBOM : true }) +let retStr = result.encoding ``` ### decodeWithStream9+ @@ -497,6 +516,7 @@ Decodes the input content. | -------- | -------- | -------- | -------- | -------- | | encoding | string | Yes| No| Encoding format. The default format is **utf-8**.| + ### constructor constructor() @@ -1456,7 +1476,7 @@ Performs subsequent operations after a value is removed. | Name | Type | Mandatory| Description | | -------- | ------- | ---- | ------------------------------------------------------------ | -| isEvict | boolean | Yes | Whether the cache capacity is insufficient. If the value is **true**, this method is called due to insufficient capacity. | +| isEvict | boolean | Yes | Whether the cache capacity is insufficient. If the value is **true**, this API is called due to insufficient capacity. | | key | K | Yes | Key removed. | | value | V | Yes | Value removed. | | newValue | V | Yes | New value for the key if the **put()** method is called and the key to be added already exists. In other cases, this parameter is left blank.| @@ -3358,7 +3378,7 @@ A constructor used to create a **LruBuffer** instance. The default capacity of t > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [constructor9+](#constructor9) instead. +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [LRUCache.constructor9+](#constructor9-3) instead. **System capability**: SystemCapability.Utils.Lang @@ -3382,7 +3402,7 @@ Changes the **LruBuffer** capacity. If the new capacity is less than or equal to > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [updateCapacity9+](#updatecapacity9) instead. +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [LRUCache.updateCapacity9+](#updatecapacity9) instead. **System capability**: SystemCapability.Utils.Lang @@ -3407,7 +3427,7 @@ Obtains the string representation of this **LruBuffer** object. > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [toString9+](#tostring9) instead. +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [LRUCache.toString9+](#tostring9) instead. **System capability**: SystemCapability.Utils.Lang @@ -3435,7 +3455,7 @@ Obtains the capacity of this buffer. > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getCapacity9+](#getcapacity9) instead. +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [LRUCache.getCapacity9+](#getcapacity9) instead. **System capability**: SystemCapability.Utils.Lang @@ -3459,7 +3479,7 @@ Clears key-value pairs from this buffer. The **afterRemoval()** method will be c > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [clear9+](#clear9) instead. +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [LRUCache.clear9+](#clear9) instead. **System capability**: SystemCapability.Utils.Lang @@ -3480,7 +3500,7 @@ Obtains the number of return values for **createDefault()**. > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getCreateCount9+](#getcreatecount9) instead. +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [LRUCache.getCreateCount9+](#getcreatecount9) instead. **System capability**: SystemCapability.Utils.Lang @@ -3506,7 +3526,7 @@ Obtains the number of times that the queried values are mismatched. > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getMissCount9+](#getmisscount9) instead. +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [LRUCache.getMissCount9+](#getmisscount9) instead. **System capability**: SystemCapability.Utils.Lang @@ -3533,7 +3553,7 @@ Obtains the number of removals from this buffer. > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getRemovalCount9+](#getremovalcount9) instead. +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [LRUCache.getRemovalCount9+](#getremovalcount9) instead. **System capability**: SystemCapability.Utils.Lang @@ -3561,7 +3581,7 @@ Obtains the number of times that the queried values are matched. > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getMatchCount9+](#getmatchcount9) instead. +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [LRUCache.getMatchCount9+](#getmatchcount9) instead. **System capability**: SystemCapability.Utils.Lang @@ -3588,7 +3608,7 @@ Obtains the number of additions to this buffer. > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getPutCount9+](#getputcount9) instead. +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [LRUCache.getPutCount9+](#getputcount9) instead. **System capability**: SystemCapability.Utils.Lang @@ -3614,7 +3634,7 @@ Checks whether this buffer is empty. > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [isEmpty9+](#isempty9) instead. +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [LRUCache.isEmpty9+](#isempty9) instead. **System capability**: SystemCapability.Utils.Lang @@ -3640,7 +3660,7 @@ Obtains the value of the specified key. > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [get9+](#get9) instead. +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [LRUCache.get9+](#get9) instead. **System capability**: SystemCapability.Utils.Lang @@ -3672,7 +3692,7 @@ Adds a key-value pair to this buffer. > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [put9+](#put9) instead. +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [LRUCache.put9+](#put9) instead. **System capability**: SystemCapability.Utils.Lang @@ -3704,7 +3724,7 @@ Obtains all values in this buffer, listed from the most to the least recently ac > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [values9+](#values9) instead. +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [LRUCache.values9+](#values9) instead. **System capability**: SystemCapability.Utils.Lang @@ -3732,7 +3752,7 @@ Obtains all keys in this buffer, listed from the most to the least recently acce > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [keys9+](#keys9) instead. +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [LRUCache.keys9+](#keys9) instead. **System capability**: SystemCapability.Utils.Lang @@ -3743,6 +3763,7 @@ Obtains all keys in this buffer, listed from the most to the least recently acce | K [] | All keys in the buffer, listed from the most to the least recently accessed.| **Example** + ```js let pro = new util.LruBuffer(); pro.put(2,10); @@ -3757,7 +3778,7 @@ Removes the specified key and its value from this buffer. > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [remove9+](#remove9) instead. +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [LRUCache.remove9+](#remove9) instead. **System capability**: SystemCapability.Utils.Lang @@ -3788,7 +3809,7 @@ Performs subsequent operations after a value is removed. > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [afterRemoval9+](#afterremoval9) instead. +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [LRUCache.afterRemoval9+](#afterremoval9) instead. **System capability**: SystemCapability.Utils.Lang @@ -3796,7 +3817,7 @@ Performs subsequent operations after a value is removed. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| isEvict | boolean | Yes| Whether the buffer capacity is insufficient. If the value is **true**, this method is called due to insufficient capacity.| +| isEvict | boolean | Yes| Whether the buffer capacity is insufficient. If the value is **true**, this API is called due to insufficient capacity.| | key | K | Yes| Key removed.| | value | V | Yes| Value removed.| | newValue | V | Yes| New value for the key if the **put()** method is called and the key to be added already exists. In other cases, this parameter is left blank.| @@ -3832,7 +3853,7 @@ Checks whether this buffer contains the specified key. > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [contains9+](#contains9) instead. +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [LRUCache.contains9+](#contains9) instead. **System capability**: SystemCapability.Utils.Lang @@ -3864,7 +3885,7 @@ Creates a value if the value of the specified key is not available. > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [createDefault9+](#createdefault9) instead. +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [LRUCache.createDefault9+](#createdefault9) instead. **System capability**: SystemCapability.Utils.Lang @@ -3895,7 +3916,7 @@ Obtains a new iterator object that contains all key-value pairs in this object. > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [entries9+](#entries9) instead. +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [LRUCache.entries9+](#entries9) instead. **System capability**: SystemCapability.Utils.Lang @@ -3921,7 +3942,7 @@ Obtains a two-dimensional array in key-value pairs. > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [Symbol.iterator9+](#symboliterator9) instead. +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [LRUCache.Symbol.iterator9+](#symboliterator9) instead. **System capability**: SystemCapability.Utils.Lang @@ -3953,7 +3974,7 @@ A constructor used to create a **Scope** object with the specified upper and low > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [constructor9+](#constructor9) instead. +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [ScopeHelper.constructor9+](#constructor9-4) instead. **System capability**: SystemCapability.Utils.Lang @@ -3980,7 +4001,7 @@ Obtains a string representation that contains this **Scope**. > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [toString9+](#tostring9) instead. +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [ScopeHelper.toString9+](#tostring9-1) instead. **System capability**: SystemCapability.Utils.Lang @@ -4007,7 +4028,7 @@ Obtains the intersection of this **Scope** and the given **Scope**. > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [intersect9+](#intersect9) instead. +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [ScopeHelper.intersect9+](#intersect9) instead. **System capability**: SystemCapability.Utils.Lang @@ -4043,7 +4064,7 @@ Obtains the intersection of this **Scope** and the given lower and upper limits. > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [intersect9+](#intersect9) instead. +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [ScopeHelper.intersect9+](#intersect9-1) instead. **System capability**: SystemCapability.Utils.Lang @@ -4079,7 +4100,7 @@ Obtains the upper limit of this **Scope**. > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getUpper9+](#getupper9) instead. +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [ScopeHelper.getUpper9+](#getupper9) instead. **System capability**: SystemCapability.Utils.Lang @@ -4106,7 +4127,7 @@ Obtains the lower limit of this **Scope**. > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getLower9+](#getlower9) instead. +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [ScopeHelper.getLower9+](#getlower9) instead. **System capability**: SystemCapability.Utils.Lang @@ -4133,7 +4154,7 @@ Obtains the union set of this **Scope** and the given lower and upper limits. > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [expand9+](#expand9) instead. +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [ScopeHelper.expand9+](#expand9) instead. **System capability**: SystemCapability.Utils.Lang @@ -4169,7 +4190,7 @@ Obtains the union set of this **Scope** and the given **Scope**. > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [expand9+](#expand9) instead. +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [ScopeHelper.expand9+](#expand9-1) instead. **System capability**: SystemCapability.Utils.Lang @@ -4205,7 +4226,7 @@ Obtains the union set of this **Scope** and the given value. > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [expand9+](#expand9) instead. +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [ScopeHelper.expand9+](#expand9-2) instead. **System capability**: SystemCapability.Utils.Lang @@ -4239,7 +4260,7 @@ Checks whether a value is within this **Scope**. > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [contains9+](#contains9) instead. +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [ScopeHelper.contains9+](#contains9-1) instead. **System capability**: SystemCapability.Utils.Lang @@ -4273,7 +4294,7 @@ Checks whether a range is within this **Scope**. > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [contains9+](#contains9) instead. +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [ScopeHelper.contains9+](#contains9-2) instead. **System capability**: SystemCapability.Utils.Lang @@ -4310,7 +4331,7 @@ Limits a value to this **Scope**. > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [clamp9+](#clamp9) instead. +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [ScopeHelper.clamp9+](#clamp9) instead. **System capability**: SystemCapability.Utils.Lang @@ -4351,7 +4372,7 @@ A constructor used to create a **Base64** object. > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [constructor9+](#constructor9) instead. +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [Base64Helper.constructor9+](#constructor9-5) instead. **System capability**: SystemCapability.Utils.Lang @@ -4369,7 +4390,7 @@ Encodes the input content. > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [encodeSync9+](#encodesync9) instead. +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [Base64Helper.encodeSync9+](#encodesync9) instead. **System capability**: SystemCapability.Utils.Lang @@ -4401,7 +4422,7 @@ Encodes the input content. > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [encodeToStringSync9+](#encodetostringsync9) instead. +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [Base64Helper.encodeToStringSync9+](#encodetostringsync9) instead. **System capability**: SystemCapability.Utils.Lang @@ -4433,7 +4454,7 @@ Decodes the input content. > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [decodeSync9+](#decodesync9) instead. +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [Base64Helper.decodeSync9+](#decodesync9) instead. **System capability**: SystemCapability.Utils.Lang @@ -4465,7 +4486,7 @@ Encodes the input content asynchronously. > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [encode9+](#encode9) instead. +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [Base64Helper.encode9+](#encode9) instead. **System capability**: SystemCapability.Utils.Lang @@ -4502,7 +4523,7 @@ Encodes the input content asynchronously. > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [encodeToString9+](#encodetostring9) instead. +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [Base64Helper.encodeToString9+](#encodetostring9) instead. **System capability**: SystemCapability.Utils.Lang @@ -4537,7 +4558,7 @@ Decodes the input content asynchronously. > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [decode9+](#decode9) instead. +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [Base64Helper.decode9+](#decode9) instead. **System capability**: SystemCapability.Utils.Lang @@ -4565,5 +4586,3 @@ Decodes the input content asynchronously. } }) ``` - - diff --git a/en/application-dev/reference/apis/js-apis-vector.md b/en/application-dev/reference/apis/js-apis-vector.md index 302b8223c0b720390c82cb28afa921b439fef7fd..7e59a7685b38a014a76065ee04255b106c9d8133 100644 --- a/en/application-dev/reference/apis/js-apis-vector.md +++ b/en/application-dev/reference/apis/js-apis-vector.md @@ -1,9 +1,5 @@ # @ohos.util.Vector (Linear Container Vector) -> **NOTE** -> -> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. - **Vector** is a linear data structure that is implemented based on arrays. When the memory of a vector is used up, a larger contiguous memory area is automatically allocated, all the elements are copied to the new memory area, and the current memory area is reclaimed. **Vector** can be used to efficiently access elements. Both **Vector** and **[ArrayList](js-apis-arraylist.md)** are implemented based on arrays, but **Vector** provides more interfaces for operating the arrays. Both of them can dynamically adjust the capacity. **Vector** doubles the capacity each time, whereas **ArrayList** increases the capacity by 50%. @@ -13,6 +9,12 @@ Both **Vector** and **[ArrayList](js-apis-arraylist.md)** are implemented based This topic uses the following to identify the use of generics: - T: Type +> **NOTE** +> +> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> +> The APIs provided by this module are deprecated since API version 9. You are advised to use [@ohos.util.ArrayList](js-apis-arraylist.md). + ## Modules to Import ```ts @@ -251,7 +253,7 @@ Removes the first occurrence of the specified element from this container. | -------- | -------- | | boolean | Returns **true** if the element is removed successfully; returns **false** otherwise.| -**Return value** +**Example** ```ts let vector = new Vector(); @@ -320,11 +322,9 @@ vector.add(2); vector.add(4); vector.add(5); vector.add(4); -vector.replaceAllElements((value: number, index: number) => { - return value = 2 * value; -}); -vector.replaceAllElements((value: number, index: number) => { - return value = value - 2; +vector.replaceAllElements((value) => { + // Add the user operation logic based on the actual scenario. + return value; }); ``` @@ -361,7 +361,7 @@ vector.add(4); vector.add(5); vector.add(4); vector.forEach((value, index) => { - console.log("value:" + value, index) + console.log("value:" + value, "index:" + index); }); ``` @@ -421,7 +421,7 @@ Obtains elements within a range in this container, including the element at the | -------- | -------- | | Vector<T> | New **Vector** instance obtained.| -**Return value** +**Example** ```ts let vector = new Vector(); @@ -444,7 +444,7 @@ Clears all elements in this container and sets its length to **0**. **System capability**: SystemCapability.Utils.Lang -**Return value** +**Example** ```ts let vector = new Vector(); @@ -639,18 +639,6 @@ Copies elements in this container into an array to overwrite elements of the sam | -------- | -------- | -------- | -------- | | array | Array<T> | Yes| Array to which the elements in the container will be copied.| -**Example** - -```ts -let vector = new Vector(); -vector.add(2); -vector.add(4); -vector.add(5); -vector.add(4); -let array = ["a", "b", "c", "d", "e", "f"]; -let result = vector.copyToArray(array); -``` - ### getFirstElement getFirstElement(): T @@ -803,15 +791,15 @@ Obtains an element at the specified position in this container. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| index | number | Yes| Position index of the target element.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | index | number | Yes| Position index of the target element.| **Return value** -| Type| Description| -| -------- | -------- | -| T | Element obtained.| + | Type| Description| + | -------- | -------- | + | T | Element obtained.| **Example** @@ -840,20 +828,9 @@ Replaces an element at the specified position in this container with a given ele **Return value** -| Type| Description| -| -------- | -------- | -| T | New element.| - -**Example** - - ```ts - let vector = new Vector(); - vector.add(2); - vector.add(4); - vector.add(5); - vector.add(4); - let result = vector.set(2, "A"); - ``` + | Type| Description| + | -------- | -------- | + | T | New element.| ### [Symbol.iterator] diff --git a/en/application-dev/reference/apis/js-apis-wantAgent.md b/en/application-dev/reference/apis/js-apis-wantAgent.md index 6657eb3e558732fa50af4c7bb82f7b26e3457433..dca4d71f55fded097f6d9521b97540bf5eefd433 100644 --- a/en/application-dev/reference/apis/js-apis-wantAgent.md +++ b/en/application-dev/reference/apis/js-apis-wantAgent.md @@ -1,4 +1,4 @@ -# @ohos.wantAgent (wantAgent) +# @ohos.wantAgent (WantAgent) The **WantAgent** module provides APIs for creating and comparing **WantAgent** objects, and obtaining the user ID and bundle name of a **WantAgent** object. @@ -16,7 +16,7 @@ import WantAgent from '@ohos.wantAgent'; getWantAgent(info: WantAgentInfo, callback: AsyncCallback\): void -Obtains a **WantAgent** object. This API uses an asynchronous callback to return the result. +Obtains a **WantAgent** object. This API uses an asynchronous callback to return the result. If the creation fails, a null **WantAgent** object is returned. **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -75,7 +75,7 @@ WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); getWantAgent(info: WantAgentInfo): Promise\ -Obtains a **WantAgent** object. This API uses a promise to return the result. +Obtains a **WantAgent** object. This API uses a promise to return the result. If the creation fails, a null **WantAgent** object is returned. **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -160,8 +160,15 @@ function getWantAgentCallback(err, data) { if (err.code == 0) { wantAgent = data; } else { - console.info('----getWantAgent failed!----'); + console.error('getWantAgent failed, error: ' + JSON.stringify(err)); + return; } + + // getBundleName callback + function getBundleNameCallback(err, data) { + console.info('==========================>getBundleNameCallback=======================>'); + } + WantAgent.getBundleName(wantAgent, getBundleNameCallback); } // WantAgentInfo object let wantAgentInfo = { @@ -192,12 +199,6 @@ let wantAgentInfo = { } WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback) - -// getBundleName callback -function getBundleNameCallback(err, data) { - console.info('==========================>getBundleNameCallback=======================>'); -} -WantAgent.getBundleName(wantAgent, getBundleNameCallback); ``` @@ -261,10 +262,11 @@ let wantAgentInfo = { WantAgent.getWantAgent(wantAgentInfo).then((data) => { console.info('==========================>getWantAgentCallback=======================>'); wantAgent = data; -}); - -WantAgent.getBundleName(wantAgent).then((data) => { - console.info('==========================>getBundleNameCallback=======================>'); + if (wantAgent) { + WantAgent.getBundleName(wantAgent).then((data) => { + console.info('==========================>getBundleNameCallback=======================>'); + }); + } }); ``` @@ -300,8 +302,15 @@ function getWantAgentCallback(err, data) { if (err.code == 0) { wantAgent = data; } else { - console.info('----getWantAgent failed!----'); + console.error('getWantAgent failed, error: ' + JSON.stringify(err)); + return; } + + // getUid callback + function getUidCallback(err, data) { + console.info('==========================>getUidCallback=======================>'); + } + WantAgent.getUid(wantAgent, getUidCallback); } // WantAgentInfo object let wantAgentInfo = { @@ -332,12 +341,6 @@ let wantAgentInfo = { } WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback) - -// getUid callback -function getUidCallback(err, data) { - console.info('==========================>getUidCallback=======================>'); -} -WantAgent.getUid(wantAgent, getUidCallback); ``` @@ -402,10 +405,11 @@ let wantAgentInfo = { WantAgent.getWantAgent(wantAgentInfo).then((data) => { console.info('==========================>getWantAgentCallback=======================>'); wantAgent = data; -}); - -WantAgent.getUid(wantAgent).then((data) => { - console.info('==========================>getUidCallback=======================>'); + if (wantAgent) { + WantAgent.getUid(wantAgent).then((data) => { + console.info('==========================>getUidCallback=======================>'); + }); + } }); ``` @@ -440,8 +444,15 @@ function getWantAgentCallback(err, data) { if (err.code == 0) { wantAgent = data; } else { - console.info('----getWantAgent failed!----'); + console.error('getWantAgent failed, error: ' + JSON.stringify(err)); + return; } + + // cancel callback + function cancelCallback(err, data) { + console.info('==========================>cancelCallback=======================>'); + } + WantAgent.cancel(wantAgent, cancelCallback); } // WantAgentInfo object let wantAgentInfo = { @@ -472,12 +483,6 @@ let wantAgentInfo = { } WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback) - -// cancel callback -function cancelCallback(err, data) { - console.info('==========================>cancelCallback=======================>'); -} -WantAgent.cancel(wantAgent, cancelCallback); ``` @@ -542,10 +547,11 @@ let wantAgentInfo = { WantAgent.getWantAgent(wantAgentInfo).then((data) => { console.info('==========================>getWantAgentCallback=======================>'); wantAgent = data; -}); - -WantAgent.cancel(wantAgent).then((data) => { - console.info('==========================>cancelCallback=======================>'); + if (wantAgent) { + WantAgent.cancel(wantAgent).then((data) => { + console.info('==========================>cancelCallback=======================>'); + }); + } }); ``` @@ -582,8 +588,19 @@ function getWantAgentCallback(err, data) { if (err.code == 0) { wantAgent = data; } else { - console.info('----getWantAgent failed!----'); + console.error('getWantAgent failed, error: ' + JSON.stringify(err)); + return; + } + + // trigger callback + function triggerCallback(data) { + console.info('==========================>triggerCallback=======================>'); + } + + var triggerInfo = { + code:0 } + WantAgent.trigger(wantAgent, triggerInfo, triggerCallback) } // WantAgentInfo object let wantAgentInfo = { @@ -614,16 +631,6 @@ let wantAgentInfo = { } WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback) - -// trigger callback -function triggerCallback(data) { - console.info('==========================>triggerCallback=======================>'); -} - -var triggerInfo = { - code:0 -} -WantAgent.trigger(wantAgent, triggerInfo, triggerCallback) ``` @@ -661,8 +668,15 @@ function getWantAgentCallback(err, data) { wantAgent1 = data; wantAgent2 = data; } else { - console.info('----getWantAgent failed!----'); + console.error('getWantAgent failed, error: ' + JSON.stringify(err)); + return; } + + // equal callback + function equalCallback(err, data) { + console.info('==========================>equalCallback=======================>'); + } + WantAgent.equal(wantAgent1, wantAgent2, equalCallback) } // WantAgentInfo object let wantAgentInfo = { @@ -693,12 +707,6 @@ let wantAgentInfo = { } WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback) - -// equal callback -function equalCallback(err, data) { - console.info('==========================>equalCallback=======================>'); -} -WantAgent.equal(wantAgent1, wantAgent2, equalCallback) ``` @@ -766,6 +774,11 @@ WantAgent.getWantAgent(wantAgentInfo).then((data) => { console.info('==========================>getWantAgentCallback=======================>'); wantAgent1 = data; wantAgent2 = data; + if (data) { + WantAgent.equal(wantAgent1, wantAgent2).then((data) => { + console.info('==========================>equalCallback=======================>'); + }); + } }); WantAgent.equal(wantAgent1, wantAgent2).then((data) => { @@ -827,11 +840,12 @@ let wantAgentInfo = { WantAgent.getWantAgent(wantAgentInfo).then((data) => { console.info('==========================>getWantAgentCallback=======================>'); wantAgent = data; + if (data) { + WantAgent.getOperationType(wantAgent, (OperationType) => { + console.log('----------- getOperationType ----------, OperationType: ' + OperationType); + }) + } }); - -WantAgent.getOperationType(wantAgent, (OperationType) => { - console.log('----------- getOperationType ----------, OperationType: ' + OperationType); -}) ``` ## WantAgent.getOperationType9+ @@ -901,7 +915,6 @@ WantAgent.getWantAgent(wantAgentInfo).then((data) => { }); ``` - ## WantAgentFlags **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -940,5 +953,5 @@ WantAgent.getWantAgent(wantAgentInfo).then((data) => { | info | WantAgent | Yes | A triggered **WantAgent** object. | | want | Want | Yes | An existing triggered **want**. | | finalCode | number | Yes | Request code that triggers the **WantAgent** object.| -| finalData | string | No | Final data collected by the common event. | +| finalData | string | Yes | Final data collected by the common event. | | extraInfo | {[key: string]: any} | No | Extra information. | diff --git a/en/application-dev/reference/apis/js-apis-webgl.md b/en/application-dev/reference/apis/js-apis-webgl.md index 455416ed7c1290971e5a797766d35c52ed08b537..6b45cedd701e6e2a287cc8cdc80055e3f95e0caf 100644 --- a/en/application-dev/reference/apis/js-apis-webgl.md +++ b/en/application-dev/reference/apis/js-apis-webgl.md @@ -9,11 +9,13 @@ This module provides WebGL APIs that correspond to the OpenGL ES 2.0 feature set > The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. > > WebGL complies with the OpenGL protocol and does not support multi-thread calling. +> +> This module can be used only in the JavaScript-compatible web-like development paradigm. ## Invoking Method -Create a **** component in the HML file. The following is an example: +Create a **\** component in the HML file. The following is an example: ```html @@ -24,7 +26,7 @@ Create a **** component in the HML file. The following is an example: ``` -Obtain the **** component instance in the JS file. The following is an example: +Obtain the **\** component instance in the JS file. The following is an example: ```js diff --git a/en/application-dev/reference/apis/js-apis-webgl2.md b/en/application-dev/reference/apis/js-apis-webgl2.md index dc19039007c1f8207e2dd3ac026c67bdac169d9f..7a55f214f16fad1cf35faebd459e8bac7dfd1e25 100644 --- a/en/application-dev/reference/apis/js-apis-webgl2.md +++ b/en/application-dev/reference/apis/js-apis-webgl2.md @@ -9,11 +9,13 @@ This module provides WebGL APIs that correspond to the OpenGL ES 3.0 feature set > The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. > > WebGL2 complies with the OpenGL protocol and does not support multi-thread calling. +> +> This module can be used only in the JavaScript-compatible web-like development paradigm. ## Invoking Method -Create a **** component in the HML file. The following is an example: +Create a **\** component in the HML file. The following is an example: ```html @@ -24,7 +26,7 @@ Create a **** component in the HML file. The following is an example: ``` -Obtain the **** component instance in the JS file. The following is an example: +Obtain the **\** component instance in the JS file. The following is an example: ```js diff --git a/en/application-dev/reference/apis/js-apis-window.md b/en/application-dev/reference/apis/js-apis-window.md index 7cd22e2babd9ada61c3bb72549ca6ef1dfc40cda..9c531d7632c5174adfd8d908c7d648bbb3cca584 100644 --- a/en/application-dev/reference/apis/js-apis-window.md +++ b/en/application-dev/reference/apis/js-apis-window.md @@ -40,7 +40,7 @@ Enumerates the window types. | TYPE_LAUNCHER_DOCK9+ | 12 | Dock bar on the home screen.
**Model restriction**: This API can be used only in the stage model.
**System API**: This is a system API.| | TYPE_VOICE_INTERACTION9+ | 13 | Voice assistant.
**Model restriction**: This API can be used only in the stage model.
**System API**: This is a system API.| | TYPE_POINTER9+ | 14 | Mouse.
**Model restriction**: This API can be used only in the stage model.
**System API**: This is a system API.| -| TYPE_FLOAT_CAMERA9+ | 15 | Floating camera window.
**Model restriction**: This API can be used only in the stage model.
**Required permissions**: ohos.permission.SYSTEM_FLOAT_WINDOW| +| TYPE_FLOAT_CAMERA9+ | 15 | Floating camera window.
**Model restriction**: This API can be used only in the stage model.
**System API**: This is a system API.| | TYPE_DIALOG9+ | 16 | Modal window.
**Model restriction**: This API can be used only in the stage model.
**System API**: This is a system API.| | TYPE_SCREENSHOT9+ | 17 | Screenshot window.
**Model restriction**: This API can be used only in the stage model.
**System API**: This is a system API.| @@ -108,10 +108,10 @@ Describes the properties of the status bar and navigation bar. | Name | Type| Mandatory| Description | | -------------------------------------- | -------- | ---- | ------------------------------------------------------------ | -| statusBarColor | string | No | Background color of the status bar. The value is a hexadecimal RGB or aRGB color value and is case insensitive, for example, **#00FF00** or **#FF00FF00**. The default value is **#0x66000000**.| +| statusBarColor | string | No | Background color of the status bar. The value is a hexadecimal RGB or ARGB color value and is case insensitive, for example, **#00FF00** or **#FF00FF00**. The default value is **#0x66000000**. | | isStatusBarLightIcon7+ | boolean | No | Whether any icon on the status bar is highlighted. The value **true** means that the icon is highlighted, and **false** means the opposite. The default value is **false**.| | statusBarContentColor8+ | string | No | Color of the text on the status bar. After this property is set, the setting of **isStatusBarLightIcon** is invalid. The default value is **0xE5FFFFFF**.| -| navigationBarColor | string | No | Background color of the navigation bar. The value is a hexadecimal RGB or aRGB color value and is case insensitive, for example, **#00FF00** or **#FF00FF00**. The default value is **#0x66000000**.| +| navigationBarColor | string | No | Background color of the navigation bar. The value is a hexadecimal RGB or ARGB color value and is case insensitive, for example, **#00FF00** or **#FF00FF00**. The default value is **#0x66000000**. | | isNavigationBarLightIcon7+ | boolean | No | Whether any icon on the navigation bar is highlighted. The value **true** means that the icon is highlighted, and **false** means the opposite. The default value is **false**.| | navigationBarContentColor8+ | string | No | Color of the text on the navigation bar. After this property is set, the setting of **isNavigationBarLightIcon** is invalid. The default value is **0xE5FFFFFF**.| @@ -164,7 +164,7 @@ Describes the callback for a single system bar. | type | [WindowType](#windowtype7) | Yes | No | Type of the system bar whose properties are changed. Only the status bar and navigation bar are supported.| | isEnable | boolean | Yes | No | Whether the system bar is displayed. The value **true** means that the system bar is displayed, and **false** means the opposite.| | region | [Rect](#rect7) | Yes | No | Current position and size of the system bar. | -| backgroundColor | string | Yes | No | Background color of the system bar. The value is a hexadecimal RGB or aRGB color value and is case insensitive, for example, **#00FF00** or **#FF00FF00**.| +| backgroundColor | string | Yes | No | Background color of the system bar. The value is a hexadecimal RGB or ARGB color value and is case insensitive, for example, **#00FF00** or **#FF00FF00**. | | contentColor | string | Yes | No | Color of the text on the system bar. | ## SystemBarTintState8+ @@ -3064,7 +3064,7 @@ Sets the background color for this window. In the stage model, this API must be | Name| Type| Mandatory| Description| | ----- | ------ | -- | ----------------------------------------------------------------------- | -| color | string | Yes| Background color to set. The value is a hexadecimal RGB or aRGB color code and is case insensitive, for example, **#00FF00** or **#FF00FF00**.| +| color | string | Yes| Background color to set. The value is a hexadecimal RGB or ARGB color value and is case insensitive, for example, **#00FF00** or **#FF00FF00**. | **Error codes** @@ -4084,7 +4084,7 @@ Sets the shadow for the window borders. | Name | Type | Mandatory | Description | | ------- | ------ | --------- | ------------------------------------------------------------ | | radius | number | Yes | Radius of the shadow. The value is greater than or equal to 0. The value **0** means that the shadow is disabled for the window borders. | -| color | string | No | Color of the shadow. The value is a hexadecimal RGB or aRGB color code and is case insensitive, for example, **#00FF00** or **#FF00FF00**. | +| color | string | No | Color of the shadow. The value is a hexadecimal RGB or ARGB color value and is case insensitive, for example, **#00FF00** or **#FF00FF00**. | | offsetX | number | No | Offset of the shadow along the x-axis, in pixels. | | offsetY | number | No | Offset of the shadow along the y-axis, in pixels. | @@ -5278,7 +5278,7 @@ Sets the background color for this window. This API uses an asynchronous callbac | Name | Type | Mandatory | Description | | -------- | ------------------------- | --------- | ------------------------------------------------------------ | -| color | string | Yes | Background color to set. The value is a hexadecimal RGB or aRGB color code and is case insensitive, for example, **#00FF00** or **#FF00FF00**. | +| color | string | Yes | Background color to set. The value is a hexadecimal RGB or ARGB color value and is case insensitive, for example, **#00FF00** or **#FF00FF00**. | | callback | AsyncCallback<void> | Yes | Callback used to return the result. | **Example** @@ -5310,7 +5310,7 @@ Sets the background color for this window. This API uses a promise to return the | Name | Type | Mandatory | Description | | ----- | ------ | --------- | ------------------------------------------------------------ | -| color | string | Yes | Background color to set. The value is a hexadecimal RGB or aRGB color code and is case insensitive, for example, **#00FF00** or **#FF00FF00**. | +| color | string | Yes | Background color to set. The value is a hexadecimal RGB or ARGB color value and is case insensitive, for example, **#00FF00** or **#FF00FF00**. | **Return value** diff --git a/en/application-dev/reference/apis/js-apis-worker.md b/en/application-dev/reference/apis/js-apis-worker.md index 5b7468da9721fa93ba1e42313a83101adf631df1..58dca3029a4523161b3df3f50c833a5d781e460b 100644 --- a/en/application-dev/reference/apis/js-apis-worker.md +++ b/en/application-dev/reference/apis/js-apis-worker.md @@ -82,24 +82,32 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco import worker from '@ohos.worker'; // Create a Worker instance. -// In the FA model, the worker script directory and pages directory are at the same level. +// In the FA model, the workers directory is at the same level as the pages directory in the entry module. const workerFAModel01 = new worker.ThreadWorker("workers/worker.js", {name:"first worker in FA model"}); -// In the FA model, the worker script directory and pages directory are at different levels. +// In the FA model, the workers directory is at the same level as the parent directory of the pages directory in the entry module. const workerFAModel02 = new worker.ThreadWorker("../workers/worker.js"); -// In the stage model, the worker script directory and pages directory are at the same level. +// In the stage model, the workers directory is at the same level as the pages directory in the entry module. const workerStageModel01 = new worker.ThreadWorker('entry/ets/workers/worker.ts', {name:"first worker in Stage model"}); -// In the stage model, the worker script directory and pages directory are at different levels. +// In the stage model, the workers directory is at the same level as the parent directory of the pages directory in the entry module. const workerStageModel02 = new worker.ThreadWorker('entry/ets/pages/workers/worker.ts'); // For the script URL "entry/ets/workers/worker.ts" in the stage model: -// entry is the value of the name attribute under module in the module.json5 file. -// ets indicates the programming language in use. +// entry is the value of the name attribute under module in the module.json5 file, and ets indicates the programming language in use. +// The script URL is related to the level of the workers directory where the worker file is located and is irrelevant to the file where the new worker is located. + +// In the esmodule build scenario of the stage model, the script URL specification @bundle:bundlename/entryname/ets/workerdir/workerfile is added. +// @bundle is a fixed label, bundlename indicates the bundle name, entryname indicates the module name, and ets indicates the programming language in use. +// workerdir indicates the directory where the worker file is located, and workerfile indicates the worker file name. +// In the stage model, the workers directory is at the same level as the pages directory in the entry module, and bundlename is com.example.workerdemo. +const workerStageModel03 = new worker.ThreadWorker('@bundle:com.example.workerdemo/entry/ets/workers/worker'); +// In the stage model, the workers directory is at the same level as the parent directory of the pages directory in the entry module, and bundlename is com.example.workerdemo. +const workerStageModel04 = new worker.ThreadWorker('@bundle:com.example.workerdemo/entry/ets/pages/workers/worker'); ``` -Depending on whether the worker script directory and **pages** directory are at the same level, you may need to configure the **buildOption** attribute in the **build-profile.json5** file. +Depending on whether the **workers** directory and **pages** directory are at the same level, you may need to configure the **buildOption** attribute in the **build-profile.json5** file. -(1) The worker script directory and **pages** directory are at the same level. +(1) The **workers** directory and **pages** directory are at the same level. In the FA model: @@ -125,7 +133,7 @@ In the stage model: } ``` -(2) The worker script directory and **pages** directory are at different levels. +(2) The **workers** directory and **pages** directory are at different levels. In the FA model: @@ -178,7 +186,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** ```js -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); workerInstance.postMessage("hello world"); @@ -213,7 +221,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** ```js -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); workerInstance.postMessage("hello world"); @@ -248,7 +256,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** ```js -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); workerInstance.on("alert", (e)=>{ console.log("alert listener callback"); }) @@ -282,7 +290,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** ```js -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); workerInstance.once("alert", (e)=>{ console.log("alert listener callback"); }) @@ -316,7 +324,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** ```js -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); // Use on, once, or addEventListener to add a listener for the "alert" event, and use off to remove the listener. workerInstance.off("alert"); ``` @@ -341,7 +349,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** ```js -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); workerInstance.terminate(); ``` @@ -372,7 +380,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** ```js -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); workerInstance.onexit = function(e) { console.log("onexit"); } @@ -412,7 +420,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** ```js -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); workerInstance.onerror = function(e) { console.log("onerror"); } @@ -445,7 +453,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** ```js -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); workerInstance.onmessage = function(e) { // e: MessageEvents. The usage is as follows: // let data = e.data; @@ -480,7 +488,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** ```js -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); workerInstance.onmessageerror= function(e) { console.log("onmessageerror"); } @@ -513,7 +521,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** ```js -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); workerInstance.addEventListener("alert", (e)=>{ console.log("alert listener callback"); }) @@ -546,7 +554,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** ```js -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); workerInstance.addEventListener("alert", (e)=>{ console.log("alert listener callback"); }) @@ -585,7 +593,16 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** ```js -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); + +workerInstance.dispatchEvent({type:"eventType", timeStamp:0}); // timeStamp is not supported yet. +``` + +The **dispatchEvent** API can be used together with the **on**, **once**, and **addEventListener** APIs. The sample code is as follows: + +```js +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); + // Usage 1: workerInstance.on("alert_on", (e)=>{ console.log("alert listener callback"); @@ -602,7 +619,7 @@ workerInstance.dispatchEvent({type:"alert_once", timeStamp:0});// timeStamp is n // The event listener created by on will not be proactively deleted. workerInstance.dispatchEvent({type:"alert_on", timeStamp:0}); workerInstance.dispatchEvent({type:"alert_on", timeStamp:0}); -// The event listener created by addEventListener will be always valid and will not be proactively deleted. +// The event listener created by addEventListener will not be proactively deleted. workerInstance.dispatchEvent({type:"alert_add", timeStamp:0}); workerInstance.dispatchEvent({type:"alert_add", timeStamp:0}); @@ -643,7 +660,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** ```js -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); workerInstance.addEventListener("alert", (e)=>{ console.log("alert listener callback"); }) @@ -679,7 +696,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** ```js -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); workerInstance.addEventListener("alert", (e)=>{ console.log("alert listener callback"); }) @@ -699,7 +716,7 @@ Removes an event listener for the worker thread. This API provides the same func | Name | Type | Mandatory| Description | | -------- | -------------------------------------------- | ---- | ---------------------------- | | type | string | Yes | Type of the event for which the event listener is to be removed. | -| callback | [WorkerEventListener](#workereventlistener9) | No| Callback to invoke when an event of the specified type occurs. | +| callback | [WorkerEventListener](#workereventlistener9) | No| Callback to invoke when an event of the specified type occurs. Callback of the event listener to remove.| **Error codes** @@ -712,7 +729,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** ```js -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); workerInstance.addEventListener("alert", (e)=>{ console.log("alert listener callback"); }) @@ -751,7 +768,16 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** ```js -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); + +workerInstance.dispatchEvent({type:"eventType", timeStamp:0}); // timeStamp is not supported yet. +``` + +The **dispatchEvent** API can be used together with the **on**, **once**, and **addEventListener** APIs. The sample code is as follows: + +```js +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); + // Usage 1: workerInstance.on("alert_on", (e)=>{ console.log("alert listener callback"); @@ -768,7 +794,7 @@ workerInstance.dispatchEvent({type:"alert_once", timeStamp:0});// timeStamp is n // The event listener created by on will not be proactively deleted. workerInstance.dispatchEvent({type:"alert_on", timeStamp:0}); workerInstance.dispatchEvent({type:"alert_on", timeStamp:0}); -// The event listener created by addEventListener will not be proactively deleted. +// The event listener created by addEventListener will be always valid and will not be proactively deleted. workerInstance.dispatchEvent({type:"alert_add", timeStamp:0}); workerInstance.dispatchEvent({type:"alert_add", timeStamp:0}); @@ -809,7 +835,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** ```js -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); workerInstance.addEventListener("alert", (e)=>{ console.log("alert listener callback"); }) @@ -850,7 +876,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco ```js // main.js import worker from '@ohos.worker'; -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); workerInstance.postMessage("hello world"); workerInstance.onmessage = function(e) { // let data = e.data; @@ -859,7 +885,7 @@ workerInstance.onmessage = function(e) { ``` ```js -// worker.js +// worker.ts import worker from '@ohos.worker'; const workerPort = worker.workerPort; workerPort.onmessage = function(e){ @@ -898,7 +924,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco ```js // main.js import worker from '@ohos.worker'; -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); workerInstance.postMessage("hello world"); workerInstance.onmessage = function(e) { // let data = e.data; @@ -907,7 +933,7 @@ workerInstance.onmessage = function(e) { ``` ```js -// worker.js +// worker.ts import worker from '@ohos.worker'; const workerPort = worker.workerPort; workerPort.onmessage = function(e){ @@ -938,11 +964,11 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco ```js // main.js import worker from '@ohos.worker'; -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); ``` ```js -// worker.js +// worker.ts import worker from '@ohos.worker'; const workerPort = worker.workerPort; workerPort.onmessage = function(e) { @@ -980,12 +1006,12 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco ```js // main.js import worker from '@ohos.worker'; -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); workerInstance.postMessage("hello world"); ``` ```js -// worker.js +// worker.ts import worker from '@ohos.worker'; const workerPort = worker.workerPort; workerPort.onmessage = function(e) { @@ -1023,11 +1049,11 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco ```js // main.js import worker from '@ohos.worker'; -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); ``` ```js -// worker.js +// worker.ts import worker from '@ohos.worker'; const parentPort = worker.workerPort; parentPort.onmessageerror = function(e) { @@ -1068,7 +1094,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** ```js -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); workerInstance.addEventListener("alert", (e)=>{ console.log("alert listener callback"); }) @@ -1108,11 +1134,11 @@ Defines the event handler to be called when an exception occurs during worker ex ```js // main.js import worker from '@ohos.worker'; -const workerInstance = new worker.ThreadWorker("workers/worker.js") +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts") ``` ```js -// worker.js +// worker.ts import worker from '@ohos.worker'; const workerPort = worker.workerPort workerPort.onerror = function(e){ @@ -1168,23 +1194,23 @@ A constructor used to create a **Worker** instance. import worker from '@ohos.worker'; // Create a Worker instance. -// In the FA model, the worker script directory and pages directory are at the same level. +// In the FA model, the workers directory is at the same level as the pages directory. const workerFAModel01 = new worker.Worker("workers/worker.js", {name:"first worker in FA model"}); -// In the FA model, the worker script directory and pages directory are at different levels. +// In the FA model, the workers directory is at the same level as the parent directory of the pages directory. const workerFAModel02 = new worker.Worker("../workers/worker.js"); -// In the stage model, the worker script directory and pages directory are at the same level. +// In the stage model, the workers directory is at the same level as the pages directory. const workerStageModel01 = new worker.Worker('entry/ets/workers/worker.ts', {name:"first worker in Stage model"}); -// In the stage model, the worker script directory and pages directory are at different levels. +// In the stage model, the workers directory is at the same level as the child directory of the pages directory. const workerStageModel02 = new worker.Worker('entry/ets/pages/workers/worker.ts'); // For the script URL "entry/ets/workers/worker.ts" in the stage model: // entry is the value of the name attribute under module in the module.json5 file. // ets indicates the programming language in use. ``` -Depending on whether the worker script directory and **pages** directory are at the same level, you may need to configure the **buildOption** attribute in the **build-profile.json5** file. +Depending on whether the **workers** directory and **pages** directory are at the same level, you may need to configure the **buildOption** attribute in the **build-profile.json5** file. -(1) The worker script directory and **pages** directory are at the same level. +(1) The **workers** directory and **pages** directory are at the same level. In the FA model: @@ -1207,7 +1233,7 @@ In the stage model: } } ``` -(2) The worker script directory and **pages** directory are at different levels. +(2) The **workers** directory and **pages** directory are at different levels. In the FA model: ```json @@ -1594,6 +1620,14 @@ Dispatches the event defined for the worker thread. ```js const workerInstance = new worker.Worker("workers/worker.js"); +workerInstance.dispatchEvent({type:"eventType", timeStamp:0}); // timeStamp is not supported yet. +``` + +The **dispatchEvent** API can be used together with the **on**, **once**, and **addEventListener** APIs. The sample code is as follows: + +```js +const workerInstance = new worker.Worker("workers/worker.js"); + // Usage 1: workerInstance.on("alert_on", (e)=>{ console.log("alert listener callback"); @@ -2056,7 +2090,7 @@ Each actor concurrently processes tasks of the main thread. For each actor, ther ### FA Model ```js -// main.js (The following assumes that the worker script directory and pages directory are at the same level.) +// main.js (The following assumes that the workers directory and pages directory are at the same level.) import worker from '@ohos.worker'; // Create a Worker instance in the main thread. const workerInstance = new worker.ThreadWorker("workers/worker.ts"); @@ -2121,7 +2155,7 @@ Configuration of the **build-profile.json5** file: ``` ### Stage Model ```js -// main.js (The following assumes that the worker script directory and pages directory are at different levels.) +// main.js (The following assumes that the workers directory and pages directory are at different levels.) import worker from '@ohos.worker'; // Create a Worker instance in the main thread. diff --git a/en/application-dev/reference/arkui-js/figures/4-0.gif b/en/application-dev/reference/arkui-js/figures/4-0.gif deleted file mode 100644 index 1589d8650fa225626fb8dadf085732f92170e40f..0000000000000000000000000000000000000000 Binary files a/en/application-dev/reference/arkui-js/figures/4-0.gif and /dev/null differ diff --git a/en/application-dev/reference/arkui-js/figures/animate-transform.gif b/en/application-dev/reference/arkui-js/figures/animate-transform.gif deleted file mode 100644 index e83e2ce11234a97242e1f57204b96568ad248d3d..0000000000000000000000000000000000000000 Binary files a/en/application-dev/reference/arkui-js/figures/animate-transform.gif and /dev/null differ diff --git a/en/application-dev/reference/arkui-js/figures/animate-transform2.gif b/en/application-dev/reference/arkui-js/figures/animate-transform2.gif deleted file mode 100644 index 3c65871bb208133129e46956ecee119276a390a5..0000000000000000000000000000000000000000 Binary files a/en/application-dev/reference/arkui-js/figures/animate-transform2.gif and /dev/null differ diff --git a/en/application-dev/reference/arkui-js/figures/animationapi-4.gif b/en/application-dev/reference/arkui-js/figures/animationapi-4.gif deleted file mode 100644 index 294687cdfb0cf7f2ea34f91c87d0a6394b32bff0..0000000000000000000000000000000000000000 Binary files a/en/application-dev/reference/arkui-js/figures/animationapi-4.gif and /dev/null differ diff --git a/en/application-dev/reference/arkui-js/figures/en-us_image_0000001127125192.gif b/en/application-dev/reference/arkui-js/figures/en-us_image_0000001127125192.gif new file mode 100644 index 0000000000000000000000000000000000000000..3c5b1fa0343c2e6ec1ebf8592ed769e25fc5b2c4 Binary files /dev/null and b/en/application-dev/reference/arkui-js/figures/en-us_image_0000001127125192.gif differ diff --git a/en/application-dev/reference/arkui-js/figures/en-us_image_0000001127285004.gif b/en/application-dev/reference/arkui-js/figures/en-us_image_0000001127285004.gif new file mode 100644 index 0000000000000000000000000000000000000000..dcb1ff67a62b1053d3e1c392bbe0535e81771c54 Binary files /dev/null and b/en/application-dev/reference/arkui-js/figures/en-us_image_0000001127285004.gif differ diff --git a/en/application-dev/reference/arkui-js/figures/en-us_image_0000001167001464.png b/en/application-dev/reference/arkui-js/figures/en-us_image_0000001167001464.png index 5113bc6bad4f88bc2558aae304394e00e107ce88..8f997a0b5c76b206acacaf8f689e55f73bbaf20a 100644 Binary files a/en/application-dev/reference/arkui-js/figures/en-us_image_0000001167001464.png and b/en/application-dev/reference/arkui-js/figures/en-us_image_0000001167001464.png differ diff --git a/en/application-dev/reference/arkui-js/figures/en-us_image_0000001167823326.gif b/en/application-dev/reference/arkui-js/figures/en-us_image_0000001167823326.gif new file mode 100644 index 0000000000000000000000000000000000000000..78a6830c434d54aab7beba2f171edfb2f8b4e7d9 Binary files /dev/null and b/en/application-dev/reference/arkui-js/figures/en-us_image_0000001167823326.gif differ diff --git a/en/application-dev/reference/arkui-js/figures/en-us_image_0000001178875308.png b/en/application-dev/reference/arkui-js/figures/en-us_image_0000001178875308.png index c085790c6651bf041b772f58f5665d442caf6f4a..ff15fe644562b95b868829af17e7be0068097a75 100644 Binary files a/en/application-dev/reference/arkui-js/figures/en-us_image_0000001178875308.png and b/en/application-dev/reference/arkui-js/figures/en-us_image_0000001178875308.png differ diff --git a/en/application-dev/reference/arkui-js/figures/en-us_image_0000001179035242.png b/en/application-dev/reference/arkui-js/figures/en-us_image_0000001179035242.png index c7311ac9226ca3c0a04cef9a51961424daf8a47a..2c2f496c7af6589057af1ed24d69f22dc8b7e2d2 100644 Binary files a/en/application-dev/reference/arkui-js/figures/en-us_image_0000001179035242.png and b/en/application-dev/reference/arkui-js/figures/en-us_image_0000001179035242.png differ diff --git a/en/application-dev/reference/arkui-js/figures/en-us_image_0000001224354967.png b/en/application-dev/reference/arkui-js/figures/en-us_image_0000001224354967.png index 7469c1e329fc86f0ca7eec9374be7c2c03ae2d6b..ad3d9f57521f89bdcbab75649447319bee650fa1 100644 Binary files a/en/application-dev/reference/arkui-js/figures/en-us_image_0000001224354967.png and b/en/application-dev/reference/arkui-js/figures/en-us_image_0000001224354967.png differ diff --git a/en/application-dev/reference/arkui-js/figures/en-us_image_0000001229677045.gif b/en/application-dev/reference/arkui-js/figures/en-us_image_0000001229677045.gif new file mode 100644 index 0000000000000000000000000000000000000000..eaf9944676873d49c6ca1ac7110a48413583821c Binary files /dev/null and b/en/application-dev/reference/arkui-js/figures/en-us_image_0000001229677045.gif differ diff --git a/en/application-dev/reference/arkui-js/js-components-canvas-canvasrenderingcontext2d.md b/en/application-dev/reference/arkui-js/js-components-canvas-canvasrenderingcontext2d.md index 8df65d142a4129699c45f44b69c1c5f1fbe96829..ceefb977f290e2f59c5234c8e2eb99b61f0b9cd2 100644 --- a/en/application-dev/reference/arkui-js/js-components-canvas-canvasrenderingcontext2d.md +++ b/en/application-dev/reference/arkui-js/js-components-canvas-canvasrenderingcontext2d.md @@ -585,7 +585,7 @@ Fills a rectangle on the canvas. ```html
- +
``` @@ -621,7 +621,7 @@ Clears the content in a rectangle on the canvas. ```html
- +
``` @@ -1735,9 +1735,9 @@ Creates a radial gradient and returns a **CanvasGradient** object. // Radial gradient: inner circle(200,200,r:50) outer circle(200,200,r:200) var gradient = ctx.createRadialGradient(200,200,50, 200,200,200); // Add three color stops - gradient.addColorStop(0.0, 'red'); - gradient.addColorStop(0.5, 'white'); - gradient.addColorStop(1.0, 'green'); + gradient.addColorStop(0.0, '#ff0000'); + gradient.addColorStop(0.5, '#ffffff'); + gradient.addColorStop(1.0, '#00ff00'); // Set the fill style and draw a rectangle ctx.fillStyle = gradient; ctx.fillRect(0, 0, 500, 500); diff --git a/en/application-dev/reference/arkui-js/js-components-common-events.md b/en/application-dev/reference/arkui-js/js-components-common-events.md index 8461a469536052368d330ad2ad5574be941f34b5..3dd49f1812d39348f14e5e332cfba1f29fe26973 100644 --- a/en/application-dev/reference/arkui-js/js-components-common-events.md +++ b/en/application-dev/reference/arkui-js/js-components-common-events.md @@ -99,6 +99,8 @@ Different from private events, universal events can be bound to most components. When a component triggers an event, the event callback receives an event object by default. You can obtain the corresponding information through the event object. + + | Attribute | Type | Description | | -------------------- | ------ | ---------------------------------------- | | dataSet6+ | Object | Custom attribute set defined through [data-*](../arkui-js/js-components-common-attributes.md).| @@ -241,32 +243,38 @@ Sets a custom drag image. **Example** ```js -createPixelMap() { - let color = new ArrayBuffer(4*96*96); - var buffer = new Uint8Array(color); - for (var i = 0; i < buffer.length; i++) { - buffer[i] = (i + 1) % 255; - } - let opts = { - alphaType:0, - editable:true, - pixelFormat:4, - scaleMode:1, - size:{height:96,width:96} - } - const promise = image.createPixelMap(color,opts); - promise.then((data)=> { - console.error('-create pixmap has info message:' + JSON.stringify(data)); - this.pixelMap = data; - this.pixelMapReader = data; - }) -}, +import image from '@ohos.multimedia.image'; -onInit() { - this.createPixelMap -}, - -dragStart(e) { - e.dataTransfer.setDragImage(this.pixelMapReader, 50, 50); +export default { + createPixelMap() { + let color = new ArrayBuffer(4 * 96 * 96); + var buffer = new Uint8Array(color); + for (var i = 0; i < buffer.length; i++) { + buffer[i] = (i + 1) % 255; + } + let opts = { + alphaType: 0, + editable: true, + pixelFormat: 4, + scaleMode: 1, + size: { + height: 96, width: 96 + } + } + const promise = image.createPixelMap(color, opts); + promise.then((data) => { + console.error('-create pixmap has info message:' + JSON.stringify(data)); + this.pixelMap = data; + this.pixelMapReader = data; + }) + }, + + onInit() { + this.createPixelMap + }, + + dragStart(e) { + e.dataTransfer.setDragImage(this.pixelMapReader, 50, 50); + } } ``` diff --git a/en/application-dev/reference/arkui-js/js-components-common-methods.md b/en/application-dev/reference/arkui-js/js-components-common-methods.md index 3a7d61034f5e8eece95d71ebe9ca2c82556401f7..5945c299f720fa34829fe2eb6cd32b32c9f3278a 100644 --- a/en/application-dev/reference/arkui-js/js-components-common-methods.md +++ b/en/application-dev/reference/arkui-js/js-components-common-methods.md @@ -139,56 +139,46 @@ button{ ```js // xxx.js -import promptAction from '@ohos.promptAction'; -export default{ - data:{ - animation:'', - }, - onInit(){ - }, - onShow(){ - var options = { - duration: 1500, - easing: 'friction', - delay: 500, - fill: 'forwards', - iterations: 2, - direction: 'normal', - }; - var frames = [ - {transform: {translate: '-120px -0px'}, opacity: 0.1, offset: 0.0}, - {transform: {translate: '120px 0px'}, opacity: 1.0, offset: 1.0} - ]; - this.animation = this.$element('idName').animate(frames, options); - // handle finish event - this.animation.onfinish = function(){ - promptAction.showToast({ - message: "The animation is finished." - }); - }; - // handle cancel event - this.animation.oncancel = function(){ - promptAction.showToast({ - message: "The animation is canceled." - }); - }; - // handle repeat event - this.animation.onrepeat = function(){ - promptAction.showToast({ - message: "The animation is repeated." - }); - }; - }, - start(){ - this.animation.play(); - }, - cancel(){ - this.animation.cancel(); - } +export default { + data: { + animation: '', + options: {}, + frames: {} + }, + onInit() { + this.options = { + duration: 1500, + easing: 'friction', + delay: 500, + fill: 'forwards', + iterations: 2, + direction: 'normal', + }; + this.frames = [ + { + transform: { + translate: '-120px -0px' + }, opacity: 0.1, offset: 0.0 + }, + { + transform: { + translate: '120px 0px' + }, opacity: 1.0, offset: 1.0 + } + ]; + }, + + start() { + this.animation = this.$element('idName').animate(this.frames, this.options); + this.animation.play(); + }, + cancel() { + this.animation.cancel(); + } } ``` -![animationapi-4](figures/animationapi-4.gif) +![en-us_image_0000001229677045](figures/en-us_image_0000001229677045.gif) ## getBoundingClientRect diff --git a/en/application-dev/reference/arkui-js/js-components-container-swiper.md b/en/application-dev/reference/arkui-js/js-components-container-swiper.md index f607139653a52a1e1edbca359ca60d7224ebcc30..add3c751bf75dfaef1ea07bbe68ef355c5201faa 100644 --- a/en/application-dev/reference/arkui-js/js-components-container-swiper.md +++ b/en/application-dev/reference/arkui-js/js-components-container-swiper.md @@ -118,16 +118,19 @@ In addition to the [universal methods](../arkui-js/js-components-common-methods. } .swiperContent1{ height: 100%; + width: 100%; justify-content: center; background-color: #007dff; } .swiperContent2{ height: 100%; + width: 100%; justify-content: center; background-color: #ff7500; } .swiperContent3{ height: 100%; + width: 100%; justify-content: center; background-color: #41ba41; } diff --git a/en/application-dev/reference/arkui-js/js-components-svg-animate.md b/en/application-dev/reference/arkui-js/js-components-svg-animate.md index e90d520cb36057ac385917e4df3d532c8669e97d..46a636aa4043e95c4c1de83b39e09371396fa0cd 100644 --- a/en/application-dev/reference/arkui-js/js-components-svg-animate.md +++ b/en/application-dev/reference/arkui-js/js-components-svg-animate.md @@ -28,9 +28,9 @@ Not supported | end | <time> | 0 | No| Duration after which the animation ends. The value can be ms (ms), s (second), or m (minute). The default value is s (second). Other formats are not supported.| | repeatCount | <number \| indefinite> | 1 | No| Number of times the animation is played. The default value is indefinite. You can set the value to **1** to play the animation only once.| | fill | <freeze \| remove> | remove | No| State when the animation ends.| -| calcMode | <discrete \| linear \| paced \| spline> | linear | No| Interpolation mode of the animation.
**discrete**: The value of **from** directly jumps to the value of **to**.
**linear**: linear.
**paced**: linear. After this value is set, the values of **keyTimes** and **keyPoints** are invalid.
**spline**: user-defined Bessel curve. The spline point is defined in the **keyTimes** attribute, and the control point of each interval is defined by **keySplines**.| -| keyTimes | string | - | No| Start time of the key frame animation. The value ranges from 0 to 1, separated by semicolons (;), for example, **0;0.3;0.8;1**. **keyTimes**, **keySplines**, and **values** are combined to set the key frame animation. The number of **keyTimes** is the same as that of **values**. The number of **keySplines** is the number of **keyTimes** minus 1.| -| keySplines | string | - | No| A set of Bessel control points associated with **keyTimes**. You can define the Bessel curves for each key frame. The curves are separated by semicolons (;). The format of the two controls in the curve is x1 y1 x2 y2. For example, **0.5 0 0.5 1; 0.5 0 0.5 1;0.5 0 0.5 1**.| +| calcMode | <discrete \| linear \| paced \| spline> | linear | No| Interpolation mode of the animation.
**discrete**: The animation directly jumps from the value specified by **from** to the value specified by **to**.
**linear**: Linear interpolation between values is used.
**paced**: Interpolation that produces an even paced change is used. If this value is set, the values of **keyTimes** and **keyPoints** will not take effect.
**spline**: Interpolation is implemented based on a custom Bezier spline. The spline points are defined in the **keyTimes** attribute, and the control points of each interval are defined in the **keySplines** attribute.| +| keyTimes | string | - | No| Start time of the key frame animation. The value is a semicolon-separated list of values ranging from 0 to 1, for example, **0;0.3;0.8;1**. **keyTimes**, **keySplines**, and **values** are combined to set the key frame animation. The number of values defined for **keyTimes** is the same as that for **values**. The number of values defined for **keySplines** is the number of values defined for **keyTimes** minus 1.| +| keySplines | string | - | No| A set of Bezier control points associated with **keyTimes**. You can define the Bezier curves for each key frame, separating them with semicolons (;). The format of the two control points in the curve is x1 y1 x2 y2, for example, **0.5 0 0.5 1; 0.5 0 0.5 1;0.5 0 0.5 1**.| | by | number | - | No| Relative offset value to add to a specified attribute in the animation. The default value of **from** is the original attribute value.| | from | string | - | No| Start value of the attribute to which the animation is applied.
If the **values** attribute has been set, the **from** attribute is invalid.| | to | string | - | No| End value of the attribute to which the animation is applied.
If the **values** attribute has been set, the **to** attribute is invalid.| @@ -76,7 +76,7 @@ Not supported
- +
diff --git a/en/application-dev/reference/arkui-js/js-components-svg-animatetransform.md b/en/application-dev/reference/arkui-js/js-components-svg-animatetransform.md index d9242543a6fda9398032b299d00cf4cf755edfc9..20d19b53d05cc201c4a258b49ff27552701b5669 100644 --- a/en/application-dev/reference/arkui-js/js-components-svg-animatetransform.md +++ b/en/application-dev/reference/arkui-js/js-components-svg-animatetransform.md @@ -91,7 +91,7 @@ The **animate** attributes and the attributes in the following table are support ``` -![animate-transform](figures/animate-transform.gif) +![en-us_image_0000001127285004](figures/en-us_image_0000001127285004.gif) Animation overlay @@ -150,7 +150,7 @@ Animation overlay ``` -![animate-transform2](figures/animate-transform2.gif) +![en-us_image_0000001127125192](figures/en-us_image_0000001127125192.gif) Example of involved components diff --git a/en/application-dev/reference/arkui-js/js-offscreencanvasrenderingcontext2d.md b/en/application-dev/reference/arkui-js/js-offscreencanvasrenderingcontext2d.md index 8eebde2cacb7dc2e2409a8c1f6a8274ac4e38390..4a5af8ca23f34f15e617c39f9a23b2024155b7d0 100644 --- a/en/application-dev/reference/arkui-js/js-offscreencanvasrenderingcontext2d.md +++ b/en/application-dev/reference/arkui-js/js-offscreencanvasrenderingcontext2d.md @@ -95,12 +95,36 @@ Checks whether a specified point is in the path area. **Example** ```html -
- In path:{{textValue}} - +
+ In path:{{textValue}} +
``` +```css +/* xxx.css */ +.container { + display: flex; + flex-direction: column; + background-color: #F1F3F5; + align-items: center; + justify-content: center; + width: 100%; + height: 100%; +} + +canvas { + width: 600px; + height: 600px; + background-color: #fdfdfd; + border: none; +} + +.textsize { + font-size: 40px; +} +``` + ```js // xxx.js export default { @@ -145,12 +169,36 @@ Checks whether a specified point is on the edge line of a path. **Example** ```html -
- In path:{{textValue}} - +
+ In stroke:{{textValue}} +
``` +```css +/* xxx.css */ +.container { + display: flex; + flex-direction: column; + background-color: #F1F3F5; + align-items: center; + justify-content: center; + width: 100%; + height: 100%; +} + +canvas { + width: 600px; + height: 600px; + background-color: #fdfdfd; + border: none; +} + +.textsize { + font-size: 40px; +} +``` + ```js // xxx.js export default { @@ -181,12 +229,36 @@ resetTransform(): void **Example** ```html -
- In path:{{textValue}} - +
+ In path:{{textValue}} +
``` +```css +/* xxx.css */ +.container { + display: flex; + flex-direction: column; + background-color: #F1F3F5; + align-items: center; + justify-content: center; + width: 100%; + height: 100%; +} + +canvas { + width: 600px; + height: 600px; + background-color: #fdfdfd; + border: none; +} + +.textsize { + font-size: 40px; +} +``` + ```js // xxx.js export default { diff --git a/en/application-dev/reference/arkui-ts/Readme-EN.md b/en/application-dev/reference/arkui-ts/Readme-EN.md index 25736a22dced9dd795af1edd130de06ab02248cf..9710b23dba7462c0165125b4546ad1c090e80a3d 100644 --- a/en/application-dev/reference/arkui-ts/Readme-EN.md +++ b/en/application-dev/reference/arkui-ts/Readme-EN.md @@ -60,11 +60,15 @@ - [DataPanel](ts-basic-components-datapanel.md) - [DatePicker](ts-basic-components-datepicker.md) - [Divider](ts-basic-components-divider.md) + - [Formcomponent](ts-basic-components-formcomponent.md) - [Gauge](ts-basic-components-gauge.md) - [Image](ts-basic-components-image.md) - [ImageAnimator](ts-basic-components-imageanimator.md) - [LoadingProgress](ts-basic-components-loadingprogress.md) - [Marquee](ts-basic-components-marquee.md) + - [Menu](ts-basic-components-menu.md) + - [MenuItem](ts-basic-components-menuitem.md) + - [MenuItemGroup](ts-basic-components-menuitemgroup.md) - [Navigation](ts-basic-components-navigation.md) - [NavRouter](ts-basic-components-navrouter.md) - [NavDestination](ts-basic-components-navdestination.md) diff --git a/en/application-dev/reference/arkui-ts/figures/borderImageGradient.png b/en/application-dev/reference/arkui-ts/figures/borderImageGradient.png index edf91d4844deeee4f997f65d2d88b45bf7ff7f1d..0cf19ef4273d18c84b86582543129906e8720142 100644 Binary files a/en/application-dev/reference/arkui-ts/figures/borderImageGradient.png and b/en/application-dev/reference/arkui-ts/figures/borderImageGradient.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_000000111864201.gif b/en/application-dev/reference/arkui-ts/figures/en-us_image_000000111864201.gif deleted file mode 100644 index 24702d37d233b9f10a83e4e36b8c8ff23393014f..0000000000000000000000000000000000000000 Binary files a/en/application-dev/reference/arkui-ts/figures/en-us_image_000000111864201.gif and /dev/null differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001174264366.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001174264366.png new file mode 100644 index 0000000000000000000000000000000000000000..212290aaf09896bef738026b0c519eb9b5d21de2 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001174264366.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001174422906.PNG b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001174422906.PNG new file mode 100644 index 0000000000000000000000000000000000000000..854d21cc4692e51e8eac70f5644f4362a58ee640 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001174422906.PNG differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001174582854.PNG b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001174582854.PNG new file mode 100644 index 0000000000000000000000000000000000000000..0a8168a0a1041188a2a090bd380c2a9f5f6306a7 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001174582854.PNG differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001211898500.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001211898500.png deleted file mode 100644 index f27757afb281875f5cd4fca0e4b86684cdf0f1a8..0000000000000000000000000000000000000000 Binary files a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001211898500.png and /dev/null differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001212218462.gif b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001212218462.gif deleted file mode 100644 index 1be92ae9b4a61f304b91c5b03f7b0e799ac679fa..0000000000000000000000000000000000000000 Binary files a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001212218462.gif and /dev/null differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001219744189.PNG b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001219744189.PNG new file mode 100644 index 0000000000000000000000000000000000000000..3bcd5aa32b3ae31928a9691864fa792a9733b162 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001219744189.PNG differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001219744193.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001219744193.png index 5855095851b92058f270d69a46546db43ec974b8..17a7767c1f69c12ccfb0c1436110a9e22b848c26 100644 Binary files a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001219744193.png and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001219744193.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001256858413.gif b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001256858413.gif deleted file mode 100644 index 791930fb1f2f681dac85167f646dbcf88d121882..0000000000000000000000000000000000000000 Binary files a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001256858413.gif and /dev/null differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001256978365.gif b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001256978365.gif deleted file mode 100644 index 8da8a4adcc50c16eafb2378f0bbab0706471ae8b..0000000000000000000000000000000000000000 Binary files a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001256978365.gif and /dev/null differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777774.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777774.png index 60f430b646b45a3e3b16a9bb024e4a14e48bf4d3..24edbed60b52947c5effbba951a6523582603f30 100644 Binary files a/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777774.png and b/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777774.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777775.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777775.png index 60f430b646b45a3e3b16a9bb024e4a14e48bf4d3..24edbed60b52947c5effbba951a6523582603f30 100644 Binary files a/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777775.png and b/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777775.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777779.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777779.png index 4558b332925757d97d70ee57182c260804629346..24edbed60b52947c5effbba951a6523582603f30 100644 Binary files a/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777779.png and b/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777779.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/form.png b/en/application-dev/reference/arkui-ts/figures/form.png new file mode 100644 index 0000000000000000000000000000000000000000..4586dc5b6e03f856e7c0e7c7a3158d12a574a1bf Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/form.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/imageAnimator.gif b/en/application-dev/reference/arkui-ts/figures/imageAnimator.gif index 9686185c04ef6c0a764fa7fcb91b8270d503f79d..aa023c33fc6335b746d1e36eee2d9b55dc48cc1a 100644 Binary files a/en/application-dev/reference/arkui-ts/figures/imageAnimator.gif and b/en/application-dev/reference/arkui-ts/figures/imageAnimator.gif differ diff --git a/en/application-dev/reference/arkui-ts/figures/loadProgress.jpeg b/en/application-dev/reference/arkui-ts/figures/loadProgress.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..141bc03c7528681e90fc3ed91b4c05611355e092 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/loadProgress.jpeg differ diff --git a/en/application-dev/reference/arkui-ts/figures/menu1.png b/en/application-dev/reference/arkui-ts/figures/menu1.png new file mode 100644 index 0000000000000000000000000000000000000000..c431b6e9dd911b7f93b778eb6fb290063bb0338a Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/menu1.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/textstyle.png b/en/application-dev/reference/arkui-ts/figures/textstyle.png index 38128cb5f1a6aa7a36a3b4e483bf2815c7170117..babd8a3e221a628927e8f760126d625e9f395066 100644 Binary files a/en/application-dev/reference/arkui-ts/figures/textstyle.png and b/en/application-dev/reference/arkui-ts/figures/textstyle.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/transform.PNG b/en/application-dev/reference/arkui-ts/figures/transform.PNG index a840e7050d1ae79179722dd9f23e4f383d1db2ec..9dff892b65a37c26514e9ebe925d200a75d7eee7 100644 Binary files a/en/application-dev/reference/arkui-ts/figures/transform.PNG and b/en/application-dev/reference/arkui-ts/figures/transform.PNG differ diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-formcomponent.md b/en/application-dev/reference/arkui-ts/ts-basic-components-formcomponent.md new file mode 100644 index 0000000000000000000000000000000000000000..e641340a69dad32e2db89c55ba2d44911d3258b7 --- /dev/null +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-formcomponent.md @@ -0,0 +1,124 @@ +# FormComponent + +The **FormComponent** is used to display widgets. + +> **NOTE** +> +> - This component is supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> +> - This component is intended for the widget host. For details about the widget provider, see [JS Service Widget UI Components](../js-service-widget-ui/Readme-EN.md). +> +> - To use this component, you must have the system signature. + +## Required Permissions + +ohos.permission.GET_BUNDLE_INFO + +ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +ohos.permission.REQUIRE_FORM + + +## Child Components + +Not supported + + +## APIs + +FormComponent(value: { + id: number; + name: string; + bundle: string; + ability: string; + module: string; + dimension?: FormDimension; + temporary?: boolean + }) + +Creates a **FormComponent** instance to display the provided widget. + +**Parameters** + +| Name | Type | Mandatory| Description | +| --------- | ------------------------------- | ---- | ----------------------------------------------------------------------- | +| id | number | Yes | Widget ID. Set this parameter to **0** for a new widget. | +| name | string | Yes | Widget name. | +| bundle | string | Yes | Bundle name of the widget. | +| ability | string | Yes | Ability name of the widget. | +| module | string | Yes | Module name of the widget. | +| dimension | [FormDimension](#formdimension) | No | Dimensions of the widget. The widgets in the 2 x 2, 4 x 4, and 4 x 2 dimensions are supported.
Default value: **Dimension_2_2**| +| temporary | boolean | No | Whether the widget is a temporary one. | + +## FormDimension + +| Name | Description | +| -------------------------- | -------- | +| Dimension_1_2 | 1 x 2 widget.| +| Dimension_2_2 | 2 x 2 widget.| +| Dimension_2_4 | 2 x 4 widget.| +| Dimension_4_4 | 4 x 4 widget.| +| Dimension_2_19+ | 2 x 1 widget.| + +## Attributes +| Name | Type | Mandatory| Description | +| ----------- | ----------------------------------------------------------------------------------------------------- | ---- | ----------------------------------------------------------------------- | +| size | {
width?: [Length](ts-types.md#length),
height?: [Length](ts-types.md#length)
} | Yes | Size of the widget. | +| moduleName | string | Yes | Module name of the widget. | +| dimension | [FormDimension](#formdimension) | No | Dimensions of the widget. The widgets in the 2 x 2, 4 x 4, and 4 x 2 dimensions are supported.
Default value: **Dimension_2_2**| +| allowUpdate | boolean | No | Whether to allow the widget to update.
Default value: **true** | +| visibility | [Visibility](ts-appendix-enums.md#visibility) | No | Whether the widget is visible.
Default value: **Visible** | + + + +## Events + +| Name | Description | +| ------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| onAcquired(callback: (info: { id: number }) => void) | Triggered when a widget is obtained. This API returns the ID of the obtained widget. | +| onError(callback: (info: { errcode: number, msg: string }) => void) | Triggered when an error occurs during component loading.
**errcode**: error code.
**msg**: error information. | +| onRouter(callback: (info: any) => void) | Triggered when routing occurs for the widget. This API returns information in [routerEvent](../js-service-widget-ui/js-service-widget-syntax-hml.md#event-binding).| +| onUninstall(callback: (info: { id: number }) => void) | Triggered when a widget is uninstalled. This API returns the ID of the uninstalled widget. | + + +## Example + +```ts +//card.ets +@Entry +@Component +struct CardExample { + @State formId:number = 0; + build() { + Column() { + Text('this is a card') + .fontSize(50) + .fontWeight(FontWeight.Bold) + FormComponent({ + id:this.formId, + name:"Form1", + bundle:"com.example.cardexample", + ability:"FormAbility", + module:"entry", + dimension:FormDimension.Dimension_2_2, + temporary:false + }) + .allowUpdate(true) + .size({width:360,height:360}) + .visibility(Visibility.Visible) + .onAcquired((form)=>{ + console.log(`form info : ${JSON.stringify(form)}`); + this.fomId = form.id; + }) + .onError((err)=>{ + console.log(`fail to add form, err: ${JSON.stringify(err)}`); + }) + + } + .width('100%') + .height('100%') + } +} +``` + +![Form](figures/form.png) diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-image.md b/en/application-dev/reference/arkui-ts/ts-basic-components-image.md index eb5d3e065f671025dbdd28450b53f2fa955996c2..972a3ede54ffbc5040761299e3aea32572596470 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-image.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-image.md @@ -27,7 +27,7 @@ Obtains an image from the specified source for subsequent rendering and display. | Name| Type | Mandatory| Description | | ------ | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| src | string \| [PixelMap](../apis/js-apis-image.md#pixelmap7) \| [Resource](ts-types.md#resource) | Yes | Image source. Both local and online images are supported.
When using an image referenced using a relative path, for example, `Image("common/test.jpg")`, the **\** component cannot be called across bundles or modules. Therefore, you are advised to use `$r` to reference image resources that need to be used globally.
- The following image formats are supported: PNG, JPG, BMP, SVG, GIF.
\- Base64 strings are supported. The value format is data:image/[png\|jpeg\|bmp\|webp];base64,[base64 data], where [base64 data] is a Base64 string.
\- Strings with the **datashare://path** prefix are supported, which are used to access the image path provided by a data ability. Before loading images, the application must [request the required permissions](../../file-management/medialibrary-overview.md#requesting-permissions).
\- Strings with the **file:///data/storage** prefix are supported, which are used to read image resources in the **files** folder in the installation directory of the application. Ensure that the files in the directory package path have the read permission.| +| src | string \| [PixelMap](../apis/js-apis-image.md#pixelmap7) \| [Resource](ts-types.md#resource) | Yes | Image source. Both local and online images are supported.
When using an image referenced using a relative path, for example, **Image("common/test.jpg")**, the **\** component cannot be called across bundles or modules. Therefore, you are advised to use **\$r** to reference image resources that need to be used globally.
- The following image formats are supported: PNG, JPG, BMP, SVG, GIF.
\- Base64 strings are supported. The value format is data:image/[png\|jpeg\|bmp\|webp];base64,[base64 data], where [base64 data] is a Base64 string.
\- Strings with the **datashare://path** prefix are supported, which are used to access the image path provided by a data ability. Before loading images, the application must [request the required permissions](../../file-management/medialibrary-overview.md#requesting-permissions).
\- Strings with the **file:///data/storage** prefix are supported, which are used to read image resources in the **files** folder in the installation directory of the application. Ensure that the files in the directory package path have the read permission.| ## Attributes @@ -40,7 +40,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | objectRepeat | [ImageRepeat](ts-appendix-enums.md#imagerepeat) | Whether the image is repeated.
Default value: **ImageRepeat.NoRepeat**
**NOTE**
This attribute is not applicable to SVG images.| | interpolation | [ImageInterpolation](#imageinterpolation) | Interpolation effect of the image. This attribute is intended to alleviate aliasing that occurs when a low-definition image is zoomed in.
Default value: **ImageInterpolation.None**
**NOTE**
This attribute is not applicable to SVG images.
This attribute is not applicable to **PixelMap** objects.| | renderMode | [ImageRenderMode](#imagerendermode) | Rendering mode of the image.
Default value: **ImageRenderMode.Original**
**NOTE**
This attribute is not applicable to SVG images.| -| sourceSize | {
width: number,
height: number
} | Size of the decoded image. The original image is decoded into a **pixelMap** of the specified size, in px.
**NOTE**
This attribute is not applicable to **PixelMap** objects.| +| sourceSize | {
width: number,
height: number
} | Size of the decoded image. The original image is decoded into a **pixelMap** of the specified size, in px.
**NOTE**
This attribute is not applicable to **PixelMap** objects or SVG images.| | matchTextDirection | boolean | Whether to display the image in the system language direction. When this parameter is set to true, the image is horizontally flipped in the right-to-left (RTL) language context.
Default value: **false** | | fitOriginalSize | boolean | Whether to fit the component to the original size of the image source when the component size is not set.
Default value: **false** | | fillColor | [ResourceColor](ts-types.md#resourcecolor) | Fill color. This attribute only applies to an SVG image. Once set, the fill color will replace that of the SVG image.| @@ -52,7 +52,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the > **NOTE** > > To use shortcut keys to copy the image, the image must be in focus. To enable the image to gain focus, set both the **focusable** and **focusOnTouch** attributes to **true**. -> For SVG images, only the following tags are included in the supported list: **svg**, **rect**, **circle**, **ellipse**, **path**, **line**, **polyline**, **polygon**, **animate**, **animateMotion**, and **animateTransform**. +> For SVG images, only the following tags are included in the supported list: **svg**, **rect**, **circle**, **ellipse**, **path**, **line**, **polyline**, **polygon**, and **animate**. ### ImageInterpolation @@ -99,21 +99,21 @@ struct ImageExample1 { Text('default').fontSize(16).fontColor(0xcccccc).height(30) Row({ space: 5 }) { Image($r('app.media.ic_png')) - .width(110).height(110).border({ width: 1 }).borderStyle(BorderStyle.Dashed) + .width(110).height(110).border({ width: 1 }) .overlay('png', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) Image($r('app.media.ic_gif')) - .width(110).height(110).border({ width: 1 }).borderStyle(BorderStyle.Dashed) + .width(110).height(110).border({ width: 1 }) .overlay('gif', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) Image($r('app.media.ic_svg')) - .width(110).height(110).border({ width: 1 }).borderStyle(BorderStyle.Dashed) + .width(110).height(110).border({ width: 1 }) .overlay('svg', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) } Row({ space: 5 }) { Image($r('app.media.img_example')) - .width(110).height(110).border({ width: 1 }).borderStyle(BorderStyle.Dashed) + .width(110).height(110).border({ width: 1 }) .overlay('jpg', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) Image(this.src) - .width(110).height(110).border({ width: 1 }).borderStyle(BorderStyle.Dashed) + .width(110).height(110).border({ width: 1 }) .overlay('network', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) }.margin({ top: 25, bottom: 10 }) } @@ -122,25 +122,25 @@ struct ImageExample1 { Text('objectFit').fontSize(16).fontColor(0xcccccc).height(30) Row({ space: 5 }) { Image($r('app.media.img_example')) - .border({ width: 1 }).borderStyle(BorderStyle.Dashed) + .border({ width: 1 }) .objectFit(ImageFit.None).width(110).height(110) .overlay('None', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) Image($r('app.media.img_example')) - .border({ width: 1 }).borderStyle(BorderStyle.Dashed) + .border({ width: 1 }) .objectFit(ImageFit.Fill).width(110).height(110) .overlay('Fill', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) Image($r('app.media.img_example')) - .border({ width: 1 }).borderStyle(BorderStyle.Dashed) + .border({ width: 1 }) .objectFit(ImageFit.Cover).width(110).height(110) .overlay('Cover', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) } Row({ space: 5 }) { Image($r('app.media.img_example_w250')) - .border({ width: 1 }).borderStyle(BorderStyle.Dashed) + .border({ width: 1 }) .objectFit(ImageFit.Contain).width(110).height(110) .overlay('Contain', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) Image($r('app.media.img_example_w250')) - .border({ width: 1 }).borderStyle(BorderStyle.Dashed) + .border({ width: 1 }) .objectFit(ImageFit.ScaleDown).width(110).height(110) .overlay('ScaleDown', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) }.margin({ top: 25 }) @@ -160,7 +160,7 @@ The default network timeout period is 5 minutes for loading online images. When ```tsx // @ts-nocheck -import http from '@ohos.net.http'; +import http from '@ohos.net.http' import ResponseCode from '@ohos.net.http' import image from '@ohos.multimedia.image' @@ -198,7 +198,7 @@ struct Index { let code = data.responseCode if(ResponseCode.ResponseCode.OK == code) { let imageSource = image.createImageSource(data.result) - let options = {alphaType: 0, // Transparency + let options = {alphaType: 0, // Opacity editable: false, // Whether the image is editable pixelFormat: 3, // Pixel format scaleMode: 1, // Scale mode @@ -233,18 +233,18 @@ struct ImageExample2 { Row({ space: 50 }) { Image($r('app.media.img_example')) .renderMode(ImageRenderMode.Original).width(100).height(100) - .border({ width: 1 }).borderStyle(BorderStyle.Dashed) + .border({ width: 1 }) .overlay('Original', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) Image($r('app.media.img_example')) .renderMode(ImageRenderMode.Template).width(100).height(100) - .border({ width: 1 }).borderStyle(BorderStyle.Dashed) + .border({ width: 1 }) .overlay('Template', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) } Text('alt').fontSize(12).fontColor(0xcccccc).width('96%').height(30) Image('') .alt($r('app.media.Image_none')) - .width(100).height(100).border({ width: 1 }).borderStyle(BorderStyle.Dashed) + .width(100).height(100).border({ width: 1 }) Text('sourceSize').fontSize(12).fontColor(0xcccccc).width('96%') Row({ space: 50 }) { @@ -254,7 +254,7 @@ struct ImageExample2 { height: 150 }) .objectFit(ImageFit.ScaleDown).width('25%').aspectRatio(1) - .border({ width: 1 }).borderStyle(BorderStyle.Dashed) + .border({ width: 1 }) .overlay('w:150 h:150', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) Image($r('app.media.img_example')) .sourceSize({ @@ -262,22 +262,22 @@ struct ImageExample2 { height: 200 }) .objectFit(ImageFit.ScaleDown).width('25%').aspectRatio(1) - .border({ width: 1 }).borderStyle(BorderStyle.Dashed) + .border({ width: 1 }) .overlay('w:200 h:200', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) } Text('objectRepeat').fontSize(12).fontColor(0xcccccc).width('96%').height(30) Row({ space: 5 }) { Image($r('app.media.ic_health_heart')) - .width(120).height(125).border({ width: 1 }).borderStyle(BorderStyle.Dashed) + .width(120).height(125).border({ width: 1 }) .objectRepeat(ImageRepeat.XY).objectFit(ImageFit.ScaleDown) .overlay('ImageRepeat.XY', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) Image($r('app.media.ic_health_heart')) - .width(110).height(125).border({ width: 1 }).borderStyle(BorderStyle.Dashed) + .width(110).height(125).border({ width: 1 }) .objectRepeat(ImageRepeat.Y).objectFit(ImageFit.ScaleDown) .overlay('ImageRepeat.Y', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) Image($r('app.media.ic_health_heart')) - .width(110).height(125).border({ width: 1 }).borderStyle(BorderStyle.Dashed) + .width(110).height(125).border({ width: 1 }) .objectRepeat(ImageRepeat.X).objectFit(ImageFit.ScaleDown) .overlay('ImageRepeat.X', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) } diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-loadingprogress.md b/en/application-dev/reference/arkui-ts/ts-basic-components-loadingprogress.md index 9dbeb85f9b9e13c4c5f346ad999d900b9ad1511a..6a39e1c9f17f7a7150728509cdc5fdc32658189a 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-loadingprogress.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-loadingprogress.md @@ -41,4 +41,4 @@ struct LoadingProgressExample { } ``` -![en-us_image_000000111864201](figures/en-us_image_000000111864201.gif) +![loadProgress](figures/loadProgress.jpeg) diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-menu.md b/en/application-dev/reference/arkui-ts/ts-basic-components-menu.md new file mode 100644 index 0000000000000000000000000000000000000000..65f7d17c6cc5f494896482669b720539aa07ad41 --- /dev/null +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-menu.md @@ -0,0 +1,95 @@ +# Menu + +The **\** component is a vertical list of items presented to the user. + +> **NOTE** +> +> This component is supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. + +## Child Components + +This component contains the [MenuItem](ts-basic-components-menuitem.md) and [MenuItemGroup](ts-basic-components-menuitemgroup.md) child components. + +## APIs + +Menu() + +Creates a fixed container for a menu. This API does not have any parameters. + +## Attributes + +In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported. + +| Name | Type | Description | +| -------- | ------------------------- | ---------------------------------------------------------------- | +| fontSize | [Length](ts-types.md#length) | Font size that applies to all texts in the menu. When **Length** is of the number type, the unit is fp.| + +## Example + +```ts +@Entry +@Component +struct Index { + @State select: boolean = true + private iconStr: ResourceStr = $r("app.media.view_list_filled") + private iconStr2: ResourceStr = $r("app.media.view_list_filled") + + @Builder + SubMenu() { + Menu() { + MenuItem({ content: "Copy", labelInfo: "Ctrl+C" }) + MenuItem({ content: "Paste", labelInfo: "Ctrl+V" }) + } + } + + @Builder + MyMenu(){ + Menu() { + MenuItem({ startIcon: $r("app.media.icon"), content: "Menu option" }) + MenuItem({ startIcon: $r("app.media.icon"), content: "Menu option" }) + .enabled(false) + MenuItem({ + startIcon: this.iconStr, + content: "Menu option", + endIcon: $r("app.media.arrow_right_filled"), + builder: this.SubMenu.bind(this) + }) + MenuItemGroup({ header: 'Subtitle' }) { + MenuItem ({ content: "Menu option" }) + .selectIcon(true) + .selected(this.select) + .onChange((selected) => { + console.info("menuItem select" + selected); + this.iconStr2 = $r("app.media.icon"); + }) + MenuItem({ + startIcon: $r("app.media.view_list_filled"), + content: "Menu option", + endIcon: $r("app.media.arrow_right_filled"), + builder: this.SubMenu.bind(this) + }) + } + MenuItem({ + startIcon: this.iconStr2, + content: "Menu option", + endIcon: $r("app.media.arrow_right_filled") + }) + } + } + + build() { + Row() { + Column() { + Text('click to show menu') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .bindMenu(this.MyMenu) + .width('100%') + } + .height('100%') + } +} +``` + +![menu1](figures/menu1.png) diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-menuitem.md b/en/application-dev/reference/arkui-ts/ts-basic-components-menuitem.md new file mode 100644 index 0000000000000000000000000000000000000000..cce67b34b9d5c4b50f1ac55dcfffcc2fda09e3ee --- /dev/null +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-menuitem.md @@ -0,0 +1,50 @@ +# MenuItem + +The **\** component represents an item in a menu. + +> **NOTE** +> +> This component is supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. + +## Child Components + +Not supported + +## APIs + +MenuItem(value?: MenuItemOptions| CustomBuilder) + +**Parameters** + +| Name | Type | Mandatory| Description | +| ----- | ----------------------------------------------------------------------------------------------------------------------------- | ---- | ---------------------------- | +| value | [MenuItemOptions](ts-basic-components-menuitem.md#menuitemoptions) \| [CustomBuilder](ts-types.md#custombuilder8) | No | Information about the menu item.| + +## MenuItemOptions + +| Name | Type | Mandatory| Description | +| --------- | ---------------------------------------- | ---- | -------------------------------------- | +| startIcon | [ResourceStr](ts-types.md#resourcestr) | No | Path to the icon displayed on the left of the menu item. | +| content | [ResourceStr](ts-types.md#resourcestr) | Yes | Content of the menu item. | +| endIcon | [ResourceStr](ts-types.md#resourcestr) | No | Path to the icon displayed on the right of the menu item. | +| labelInfo | [ResourceStr](ts-types.md#resourcestr) | No | Information about the ending label, for example, shortcut **Ctrl+C**. | +| builder | [CustomBuilder](ts-types.md#custombuilder8) | No | Builder for a level-2 menu. | + +## Attributes + +In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported. + +| Name | Type| Description | +| ---------- | -------- | ---------------------------------------- | +| selected | boolean | Whether the menu item is selected.
Default value: **false** | +| selectIcon | boolean | Whether to display the icon of the menu item being selected.| + +## Events + +| Name | Type | Description | +| -------- | --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| onChange | (selected: boolean) => void | Triggered when the selection status of the menu item is changed manually.
The value **true** means that the menu item is selected, and **false** means the opposite. | + +## Example + +For details, see [Example in Menu](ts-basic-components-menu.md#example). diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-menuitemgroup.md b/en/application-dev/reference/arkui-ts/ts-basic-components-menuitemgroup.md new file mode 100644 index 0000000000000000000000000000000000000000..1c1b19c668d4a95ef6ab10bb2d5549b643374e40 --- /dev/null +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-menuitemgroup.md @@ -0,0 +1,32 @@ +# MenuItemGroup + +The **\** component represents a group of menu items. + +> **NOTE** +> +> This component is supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. + +## Child Components + +This component contains the [MenuItem](ts-basic-components-menuitem.md) child component. + +## APIs + +MenuItemGroup(value?: MenuItemGroupOptions) + +**Parameters** + +| Name | Type | Mandatory| Description | +| ----- | -------------------------------------------------------------------------------------- | ---- | ------------------------------------------- | +| value | [MenuItemGroupOptions](ts-basic-components-menuitemgroup.md#menuitemgroupoptions) | No | Header and footer of the menu item group.| + +## MenuItemGroupOptions + +| Name | Type | Mandatory| Description | +| ------ | ----------------------------------------------------------------------------------------- | ---- | ----------------------------- | +| header | [ResourceStr](ts-types.md#resourcestr) \| [CustomBuilder](ts-types.md#custombuilder8) | No | Header of the menu item group.| +| footer | [ResourceStr](ts-types.md#resourcestr) \| [CustomBuilder](ts-types.md#custombuilder8) | No | Footer of the menu item group.| + +## Sample + +For details, see [Example in Menu](ts-basic-components-menu.md#example). diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-navrouter.md b/en/application-dev/reference/arkui-ts/ts-basic-components-navrouter.md index ddce11da511ebe1cc573290ffd40807d31ec5ac4..8d35b928f71ec67a97fa45c7815cdd0387f3b0dd 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-navrouter.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-navrouter.md @@ -17,6 +17,63 @@ NavRouter() ## Events -| Name | Description | -| ------------------------------------------------------- | ------------------------------------------------------------ | -| onStateChange(callback: (isActivated: boolean) => void) | Invoked when the component activation status changes. The value **true** means that component is activated, and **false** means the opposite.
**NOTE**
After the user clicks **NavRouter**, if the **\** component is activated and the corresponding **\** child component loaded, **onStateChange(true)** is called. If the corresponding **\** child component is no longer displayed, **onStateChange(false)** is called. | +| Name | Description | +| ---------------------------------------- | ---------------------------------------- | +| onStateChange(callback: (isActivated: boolean) => void) | Invoked when the component activation status changes. The value **true** means that component is activated, and **false** means the opposite.
**NOTE**
After the user clicks **NavRouter**, if the **\** component is activated and the corresponding **\** child component loaded, **onStateChange(true)** is called. If the corresponding **\** child component is no longer displayed, **onStateChange(false)** is called. | + +## Example + +```ts +// xxx.ets +@Entry +@Component +struct NavRouterExample { + private arr: number[] = [0, 1, 2, 3] + @State isActive: boolean = false + @State dex: number = 0 + + build() { + Column() { + Navigation() { + List({ space: 12, initialIndex: 0 }) { + ForEach(this.arr, (item: number, index: number) => { + ListItem() { + NavRouter() { + Row() { + Image($r('app.media.icon')).width(30).height(30).borderRadius(30).margin({ left: 3, right: 10 }) + Text(`NavRouter${item + 1}`) + .fontSize(22) + .fontWeight(500) + .textAlign(TextAlign.Center) + } + .width(180) + .height(72) + .backgroundColor(this.dex === index ? '#ccc' : '#fff') + .borderRadius(24) + + NavDestination() { + Text (`I am NavDestination page ${item + 1}`).fontSize (50) + Flex({ direction: FlexDirection.Row }) { + Row() { + Image($r('app.media.icon')).width(40).height(40).borderRadius(40).margin({ right: 15 }) + Text('7 classes today').fontSize(30) + }.padding({ left: 15 }) + } + }.backgroundColor('#ccc') + .title(`NavDestination${item + 1}`) + }.onStateChange((isActivated: boolean) => { + this.dex = index + }) + } + }, item => item) + } + .height('100%') + .margin({ top: 12, left: 12 }) + } + .mode(NavigationMode.Split) + .hideTitleBar(true) + .hideToolBar(true) + }.height('100%') + } +} +``` diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-select.md b/en/application-dev/reference/arkui-ts/ts-basic-components-select.md index c1a9e51ca723ae92a530c9df98798acca7418d2e..8bb39f7eaa9cad64eb6c56936a42ddd88eaa75c6 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-select.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-select.md @@ -25,7 +25,7 @@ Select(options: Array\<[SelectOption](#selectoption)\>) | Name | Type | Description | | ----------------------- | ------------------------------------- | --------------------------------------------- | -| selected | number | Index of the initial selected option in the drop-down list box. The index of the first option is **0**.| +| selected | number | Index of the initial selected option in the drop-down list box. The index of the first option is **0**.
If this attribute is not set, the default value **-1** is used, indicating that no option is selected.| | value | string | Text of the drop-down button. | | font | [Font](ts-types.md#font) | Text font of the drop-down button. | | fontColor | [ResourceColor](ts-types.md#resourcecolor) | Text color of the drop-down button. | diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-textarea.md b/en/application-dev/reference/arkui-ts/ts-basic-components-textarea.md index bc16a8dd1638b0ad7e1538891707422c60d7ad2b..e4b6ba1ad47c9e06f3f26e6b47f4afd505b6aa36 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-textarea.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-textarea.md @@ -36,7 +36,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | textAlign | [TextAlign](ts-appendix-enums.md#textalign) | Horizontal alignment of the text.
Default value: **TextAlign.Start**| | caretColor | [ResourceColor](ts-types.md#resourcecolor) | Color of the caret in the text box. | | inputFilter8+ | {
value: [ResourceStr](ts-types.md#resourcestr),
error?: (value: string) => void
} | Regular expression for input filtering. Only inputs that comply with the regular expression can be displayed. Other inputs are filtered out. The specified regular expression can match single characters, but not strings.
- **value**: regular expression to set.
- **error**: filtered-out content to return when regular expression matching fails.| -| copyOption9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | Whether copy and paste is allowed.| +| copyOption9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | Whether copy and paste is allowed.
If this attribute is set to **CopyOptions.None**, the paste operation is allowed, but not the copy or cut operation.| ## Events diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-textinput.md b/en/application-dev/reference/arkui-ts/ts-basic-components-textinput.md index 8b4448a11cd29d2cc44f9b70a650f8a195e18bdd..aef50da2fed1f32ad0ceb82aecbf7006fcbae009 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-textinput.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-textinput.md @@ -38,7 +38,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | caretColor | [ResourceColor](ts-types.md#resourcecolor) | Color of the caret in the text box. | | maxLength | number | Maximum number of characters in the text input. | | inputFilter8+ | {
value: [ResourceStr](ts-types.md#resourcestr),
error?: (value: string) => void
} | Regular expression for input filtering. Only inputs that comply with the regular expression can be displayed. Other inputs are filtered out. The specified regular expression can match single characters, but not strings.
- **value**: regular expression to set.
- **error**: filtered-out content to return when regular expression matching fails.| -| copyOption9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | Whether copy and paste is allowed.| +| copyOption9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | Whether copy and paste is allowed.
If this attribute is set to **CopyOptions.None**, the paste operation is allowed, but not the copy or cut operation.| | showPasswordIcon9+ | boolean | Whether to display the show password icon at the end of the password text box.
Default value: **true**| | style9+ | TextInputStyle | Text input style.
Default value: **TextInputStyle.Default**| | textAlign9+ | [TextAlign](ts-appendix-enums.md#textalign) | Alignment mode of the text in the text box.
Default value: **TextAlign.Start** | @@ -53,7 +53,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | Next | The Enter key is labeled "Next."| | Done | The Enter key is labeled "Done." | -## InputType enums +## InputType | Name | Description | | ------------------ | ------------- | @@ -70,7 +70,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | Default | Default style. The caret width is fixed at 1.5 vp, and the caret height is subject to the background height and font size of the selected text. | | Inline | Inline input style. The background height of the selected text is the same as the height of the text box. | -## Event +## Events In addition to the [universal events](ts-universal-events-click.md), the following events are supported. diff --git a/en/application-dev/reference/arkui-ts/ts-canvasrenderingcontext2d.md b/en/application-dev/reference/arkui-ts/ts-canvasrenderingcontext2d.md index b198676b1136bc19ff1c4bb0b266162478180339..f0fa614ed3781273928998927cf1bccd4c965efc 100644 --- a/en/application-dev/reference/arkui-ts/ts-canvasrenderingcontext2d.md +++ b/en/application-dev/reference/arkui-ts/ts-canvasrenderingcontext2d.md @@ -683,7 +683,7 @@ Fills a rectangle on the canvas. .height('100%') .backgroundColor('#ffff00') .onReady(() =>{ - this.context.fillRect(0,30,100,100) + this.context.fillRect(30,30,100,100) }) } .width('100%') @@ -769,7 +769,7 @@ Clears the content in a rectangle on the canvas. Canvas(this.context) .width('100%') .height('100%') - .backgroundColor('#ffffff') + .backgroundColor('#ffff00') .onReady(() =>{ this.context.fillStyle = 'rgb(0,0,255)' this.context.fillRect(20,20,200,200) @@ -1579,7 +1579,7 @@ struct Fill { region.lineTo(270, 90) region.closePath() // Fill path - this.context.fillStyle = 'green' + this.context.fillStyle = '#00ff00' this.context.fill(region, "evenodd") }) } @@ -1666,10 +1666,15 @@ struct Clip { .backgroundColor('#ffff00') .onReady(() =>{ let region = new Path2D() - region.rect(80,10,20,130) - region.rect(40,50,100,50) + region.moveTo(30, 90) + region.lineTo(110, 20) + region.lineTo(240, 130) + region.lineTo(60, 130) + region.lineTo(190, 20) + region.lineTo(270, 90) + region.closePath() this.context.clip(region,"evenodd") - this.context.fillStyle = "rgb(255,0,0)" + this.context.fillStyle = "rgb(0,255,0)" this.context.fillRect(0, 0, this.context.width, this.context.height) }) } @@ -1745,7 +1750,7 @@ Rotates a canvas clockwise around its coordinate axes. .height('100%') .backgroundColor('#ffff00') .onReady(() =>{ - this.context.rotate(45 * Math.PI / 180) // Rotate the rectangle 45 degrees + this.context.rotate(45 * Math.PI / 180) this.context.fillRect(70, 20, 50, 50) }) } @@ -1918,6 +1923,8 @@ setTransform(transform?: Matrix2D): void Resets the current transformation to the identity matrix, and then creates a new transformation matrix based on the specified **Matrix2D** object. This API is a void API. +Since API version 9, this API can be used for ArkTS widgets. + ### translate @@ -2413,7 +2420,7 @@ Restores the saved drawing context. .backgroundColor('#ffff00') .onReady(() =>{ this.context.save() // save the default state - this.context.fillStyle = "green" + this.context.fillStyle = "#00ff00" this.context.fillRect(20, 20, 100, 100) this.context.restore() // restore to the default state this.context.fillRect(150, 75, 100, 100) @@ -2451,7 +2458,7 @@ Saves all states of the canvas in the stack. This API is usually called when the .backgroundColor('#ffff00') .onReady(() =>{ this.context.save() // save the default state - this.context.fillStyle = "green" + this.context.fillStyle = "#00ff00" this.context.fillRect(20, 20, 100, 100) this.context.restore() // restore to the default state this.context.fillRect(150, 75, 100, 100) @@ -2498,9 +2505,9 @@ Creates a linear gradient. .backgroundColor('#ffff00') .onReady(() =>{ var grad = this.context.createLinearGradient(50,0, 300,100) - grad.addColorStop(0.0, 'red') - grad.addColorStop(0.5, 'white') - grad.addColorStop(1.0, 'green') + grad.addColorStop(0.0, '#ff0000') + grad.addColorStop(0.5, '#ffffff') + grad.addColorStop(1.0, '#00ff00') this.context.fillStyle = grad this.context.fillRect(0, 0, 500, 500) }) @@ -2549,9 +2556,9 @@ Creates a linear gradient. .backgroundColor('#ffff00') .onReady(() =>{ var grad = this.context.createRadialGradient(200,200,50, 200,200,200) - grad.addColorStop(0.0, 'red') - grad.addColorStop(0.5, 'white') - grad.addColorStop(1.0, 'green') + grad.addColorStop(0.0, '#ff0000') + grad.addColorStop(0.5, '#ffffff') + grad.addColorStop(1.0, '#00ff00') this.context.fillStyle = grad this.context.fillRect(0, 0, 500, 500) }) diff --git a/en/application-dev/reference/arkui-ts/ts-components-summary.md b/en/application-dev/reference/arkui-ts/ts-components-summary.md index e83d70ccecae5afbb194451ca6ccc03de75ad0e6..3e5b4706f279043c2d77839cdc7da587faaec3dc 100644 --- a/en/application-dev/reference/arkui-ts/ts-components-summary.md +++ b/en/application-dev/reference/arkui-ts/ts-components-summary.md @@ -109,7 +109,7 @@ - [Button](ts-basic-components-button.md) - A component that can be used to create different types of buttons. + A component that is used to create different types of buttons. - [Toggle](ts-basic-components-toggle.md) A component that provides a clickable element in the check box, button, or switch type. @@ -231,7 +231,7 @@ - [Canvas](ts-components-canvas-canvas.md) - A component that can be used to customize drawings. + A component that is used to customize drawings. - [Circle](ts-drawing-components-circle.md) A component that is used to draw a circle. @@ -262,10 +262,10 @@ - [Web](ts-basic-components-web.md) - A component that can be used to display web pages. + A component that is used to display web pages. -## Miscellaneous +## Miscellaneous - [ScrollBar](ts-basic-components-scrollbar.md) @@ -288,3 +288,15 @@ - [RemoteWindow](ts-basic-components-remotewindow.md) A component that is used to control the application window, providing the component animator and application window linkage animator during application startup and exit. +- [Formcomponent](ts-basic-components-formcomponent.md) + + A component that is used to display widgets. +- [Menu](ts-basic-components-menu.md) + + A component that is used to present a vertical list of items to the user. Preferentially used on computers. +- [MenuItem](ts-basic-components-menuitem.md) + + A component that is used to represent an item in a menu. +- [MenuItemGroup](ts-basic-components-menuitemgroup.md) + + A component that is used to represent a group of menu items. diff --git a/en/application-dev/reference/arkui-ts/ts-container-flex.md b/en/application-dev/reference/arkui-ts/ts-container-flex.md index a2de237b09f26589ff262ea1cabe89273bec72d9..e29fd91fd85ab9142191700d2b73042fe7f77440 100644 --- a/en/application-dev/reference/arkui-ts/ts-container-flex.md +++ b/en/application-dev/reference/arkui-ts/ts-container-flex.md @@ -3,15 +3,11 @@ The **\** component allows for flexible layout of child components. > **NOTE** +> > - This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. > - The **\** component adapts the layout of flex items during rendering. This may affect the performance. Therefore, you are advised to use **[\](ts-container-column.md)** or **[\](ts-container-row.md)** instead under scenarios where consistently high performance is required. -## Required Permissions - -None - - ## Child Components Supported @@ -23,14 +19,15 @@ Flex(value?: { direction?: FlexDirection, wrap?: FlexWrap, justifyContent?: Fle Creates a standard **\** component. -- Parameters - | Name | Type | Mandatory | Default Value | Description | - | -------------- | ---------------------------------------- | ---- | ----------------- | ---------------------------------------- | - | direction | [FlexDirection](ts-appendix-enums.md#flexdirection) | No | FlexDirection.Row | Direction in which child components are arranged in the **\** component, that is, the direction of the main axis. | - | wrap | [FlexWrap](ts-appendix-enums.md#flexwrap) | No | FlexWrap.NoWrap | Whether the **\** component has a single line or multiple lines. | - | justifyContent | [FlexAlign](ts-appendix-enums.md#flexalign) | No | FlexAlign.Start | Alignment mode of the child components in the **\** component along the main axis. | - | alignItems | [ItemAlign](ts-appendix-enums.md#itemalign) | No | ItemAlign.Start | Alignment mode of the child components in the **\** component along the cross axis. | - | alignContent | [FlexAlign](ts-appendix-enums.md#flexalign) | No | FlexAlign.Start | Alignment mode of the child components in a multi-line **\** component along the cross axis. This parameter is valid only when **wrap** is set to **Wrap** or **WrapReverse**. | +**Parameters** + +| Name | Type | Mandatory | Default Value | Description | +| -------------- | ---------------------------------------- | ---- | ----------------- | ---------------------------------------- | +| direction | [FlexDirection](ts-appendix-enums.md#flexdirection) | No | FlexDirection.Row | Direction in which child components are arranged in the **\** component, that is, the direction of the main axis. | +| wrap | [FlexWrap](ts-appendix-enums.md#flexwrap) | No | FlexWrap.NoWrap | Whether the **\** component has a single line or multiple lines. | +| justifyContent | [FlexAlign](ts-appendix-enums.md#flexalign) | No | FlexAlign.Start | Alignment mode of the child components in the **\** component along the main axis. | +| alignItems | [ItemAlign](ts-appendix-enums.md#itemalign) | No | ItemAlign.Start | Alignment mode of the child components in the **\** component along the cross axis. | +| alignContent | [FlexAlign](ts-appendix-enums.md#flexalign) | No | FlexAlign.Start | Alignment mode of the child components in a multi-line **\** component along the cross axis. This parameter is valid only when **wrap** is set to **Wrap** or **WrapReverse**. | ## Example @@ -96,7 +93,7 @@ struct FlexExample1 { } ``` -![en-us_image_0000001256978365](figures/en-us_image_0000001256978365.gif) +![en-us_image_0000001219744189](figures/en-us_image_0000001219744189.PNG) ```ts // xxx.ets @@ -142,7 +139,7 @@ struct FlexExample2 { } ``` -![en-us_image_0000001211898500](figures/en-us_image_0000001211898500.png) +![en-us_image_0000001174264366](figures/en-us_image_0000001174264366.png) ```ts // xxx.ets @@ -191,7 +188,7 @@ struct FlexExample3 { } ``` -![en-us_image_0000001212218462](figures/en-us_image_0000001212218462.gif) +![en-us_image_0000001174582854](figures/en-us_image_0000001174582854.PNG) ```ts // xxx.ets @@ -289,4 +286,4 @@ struct FlexExample5 { } ``` -![en-us_image_0000001256858413](figures/en-us_image_0000001256858413.gif) +![en-us_image_0000001174422906](figures/en-us_image_0000001174422906.PNG) diff --git a/en/application-dev/reference/arkui-ts/ts-container-list.md b/en/application-dev/reference/arkui-ts/ts-container-list.md index 47cb8721c66f3d4ba5f0b9b37e2eda7809fa1900..abcb8054fbf5bd266934a5d606b6beb8b87612d7 100644 --- a/en/application-dev/reference/arkui-ts/ts-container-list.md +++ b/en/application-dev/reference/arkui-ts/ts-container-list.md @@ -1,6 +1,6 @@ # List -The **\** component provides a list container that presents a series of list items arranged in a column with the same width. It supports presentations of the same type of data in a multiple and coherent row style, for example, images or text. +The **\** component provides a list container that presents a series of list items arranged in a column with the same width. It supports presentations of the same type of data in a multiple and coherent row style, for example, images or text. > **NOTE** > diff --git a/en/application-dev/reference/arkui-ts/ts-container-navigator.md b/en/application-dev/reference/arkui-ts/ts-container-navigator.md index e1d2c00f81527d3303b45031d858b76f9537099b..f5c24ce3043f17193050c767bcd8a55ee647779b 100644 --- a/en/application-dev/reference/arkui-ts/ts-container-navigator.md +++ b/en/application-dev/reference/arkui-ts/ts-container-navigator.md @@ -27,9 +27,9 @@ Navigator(value?: {target: string, type?: NavigationType}) | Name | Description | | ------- | -------------------------- | -| Push | Navigates to a specified page in the application. | +| Push | Navigates to the specified page in the application. | | Replace | Replaces the current page with another one in the application and destroys the current page.| -| Back | Returns to the previous page or a specified page. | +| Back | Returns to the specified page. If the specified page does not exist in the stack, no response is returned. If no page is specified, the previous page is returned to.| ## Attributes diff --git a/en/application-dev/reference/arkui-ts/ts-drawing-components-path.md b/en/application-dev/reference/arkui-ts/ts-drawing-components-path.md index 4720e9731a7aa613f5ab15f2815754b5789730c1..f0645c5079ef86d29d848e059c5187bf76f5d8d3 100644 --- a/en/application-dev/reference/arkui-ts/ts-drawing-components-path.md +++ b/en/application-dev/reference/arkui-ts/ts-drawing-components-path.md @@ -74,9 +74,8 @@ struct PathExample { .width('90%') // Draw a straight line whose length is 900 px and width is 3 vp. Path() - .width(300) .height(10) - .commands('M0 0 L900 0') + .commands('M0 0 L600 0') .stroke(Color.Black) .strokeWidth(3) @@ -85,55 +84,43 @@ struct PathExample { .fontColor(0xCCCCCC) .width('90%') // Draw a straight line. - Row({ space: 20 }) { + Flex({ justifyContent: FlexAlign.SpaceBetween }) { Path() - .width(100) - .height(100) - .commands('M150 0 L300 300 L0 300 Z') + .commands('M100 0 L200 240 L0 240 Z') .fillOpacity(0) .stroke(Color.Black) .strokeWidth(3) Path() - .width(100) - .height(100) - .commands('M0 0 H300 V300 H0 Z') + .commands('M0 0 H200 V200 H0 Z') .fillOpacity(0) .stroke(Color.Black) .strokeWidth(3) Path() - .width(100) - .height(100) - .commands('M150 0 L0 150 L60 300 L240 300 L300 150 Z') + .commands('M100 0 L0 100 L50 200 L150 200 L200 100 Z') .fillOpacity(0) .stroke(Color.Black) .strokeWidth(3) - }.width('100%') + }.width('95%') Text('Curve graphics').fontSize(11).fontColor(0xCCCCCC).width('90%') // Draw an arc. - Row({ space: 20 }) { + Flex({ justifyContent: FlexAlign.SpaceBetween }) { Path() - .width(100) - .height(100) - .commands("M0 300 S150 0 300 300 Z") + .commands("M0 300 S100 0 240 300 Z") .fillOpacity(0) .stroke(Color.Black) .strokeWidth(3) Path() - .width(100) - .height(100) - .commands('M0 150 C0 150 150 0 300 150 L150 300 Z') + .commands('M0 150 C0 100 140 0 200 150 L100 300 Z') .fillOpacity(0) .stroke(Color.Black) .strokeWidth(3) Path() - .width(100) - .height(100) - .commands('M0 200 A30 20 20 0 0 250 200 Z') + .commands('M0 100 A30 20 20 0 0 200 100 Z') .fillOpacity(0) .stroke(Color.Black) .strokeWidth(3) - } + }.width('95%') }.width('100%') .margin({ top: 5 }) } diff --git a/en/application-dev/reference/arkui-ts/ts-drawing-components-rect.md b/en/application-dev/reference/arkui-ts/ts-drawing-components-rect.md index e05fad3fd06045b8a6a4641c308378f1caaafbb7..f428dedaf7cc74454f4189fdf10112e485316dbd 100644 --- a/en/application-dev/reference/arkui-ts/ts-drawing-components-rect.md +++ b/en/application-dev/reference/arkui-ts/ts-drawing-components-rect.md @@ -40,7 +40,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.| | fillOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the fill area.| | stroke | [ResourceColor](ts-types.md) | - | Stroke color. If this attribute is not set, the component does not have any stroke.| -| strokeDashArray | Array<Length> | [] | Stroke dashes. | +| strokeDashArray | Array<Length> | [] | Stroke dashes.| | strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.| | strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | Cap style of the stroke.| | strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | Join style of the stroke.| @@ -84,6 +84,7 @@ struct RectExample { Rect({ width: '90%', height: 80 }) .radius(20) .fill(Color.Pink) + .stroke(Color.Transparent) }.width('100%').margin({ top: 10 }) // Draw a 90% x 50 rectangle, with the width and height of its rounded corners as follows: 40 for the upper left rounded corner, 20 for the upper right rounded corner, 40 for the lower right rounded corner, and 20 for the lower left rounded corner. Rect({ width: '90%', height: 80 }) diff --git a/en/application-dev/reference/arkui-ts/ts-media-components-video.md b/en/application-dev/reference/arkui-ts/ts-media-components-video.md index 21bb3d6a2890f13215b0f331f3bbab298c0d1de0..feb0d96571dd263205252f8c849b5a0f6ee967b1 100644 --- a/en/application-dev/reference/arkui-ts/ts-media-components-video.md +++ b/en/application-dev/reference/arkui-ts/ts-media-components-video.md @@ -48,7 +48,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | muted | boolean | Whether to mute the video.
Default value: **false** | | autoPlay | boolean | Whether to enable auto play.
Default value: **false** | | controls | boolean | Whether to display the video playback control bar.
Default value: **true**| -| objectFit | [ImageFit](ts-basic-components-image.md) | Video scale type.
Default value: **Cover** | +| objectFit | [ImageFit](ts-appendix-enums.md#imagefit) | Video scale type.
Default value: **Cover** | | loop | boolean | Whether to repeat the video.
Default value: **false** | ## Events @@ -243,5 +243,3 @@ struct VideoCreateComponent { } } ``` - - \ No newline at end of file diff --git a/en/application-dev/reference/arkui-ts/ts-methods-action-sheet.md b/en/application-dev/reference/arkui-ts/ts-methods-action-sheet.md index c3db1cb598e80cd0b907f2eba3188cd0e23c712d..7615fe3729496bd536aebc57a9efc622fa3957a5 100644 --- a/en/application-dev/reference/arkui-ts/ts-methods-action-sheet.md +++ b/en/application-dev/reference/arkui-ts/ts-methods-action-sheet.md @@ -23,7 +23,7 @@ Defines and shows the action sheet. | autoCancel | boolean | No | Whether to close the dialog box when the overlay is clicked.
Default value: **true**| | confirm | {
value: [ResourceStr](ts-types.md#resourcestr),
action: () => void
} | No | Text content of the confirm button and callback upon button clicking.
Default value:
**value**: button text.
**action**: callback upon button clicking.| | cancel | () => void | No | Callback invoked when the dialog box is closed after the overlay is clicked. | -| alignment | [DialogAlignment](ts-methods-custom-dialog-box.md#dialogalignment) | No | Alignment mode of the dialog box in the vertical direction.
Default value: **DialogAlignment.Bottom**| +| alignment | [DialogAlignment](ts-methods-alert-dialog-box.md#dialogalignment) | No | Alignment mode of the dialog box in the vertical direction.
Default value: **DialogAlignment.Bottom**| | offset | {
dx: Length,
dy: Length
} | No | Offset of the dialog box relative to the alignment position.
Default value: {
dx: 0,
dy: 0
} | | sheets | Array<SheetInfo> | Yes | Options in the dialog box. Each option supports the image, text, and callback.| diff --git a/en/application-dev/reference/arkui-ts/ts-methods-menu.md b/en/application-dev/reference/arkui-ts/ts-methods-menu.md index 994984976e14b029d1ed82aae9375fd8387828e2..56e07e983a2e9ea10119c160f43b803d2ffb66b6 100644 --- a/en/application-dev/reference/arkui-ts/ts-methods-menu.md +++ b/en/application-dev/reference/arkui-ts/ts-methods-menu.md @@ -24,9 +24,9 @@ struct Index { @Builder MenuBuilder() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { Button('Test ContextMenu1') - Divider().strokeWidth(2).margin(5) + Divider().strokeWidth(2).margin(5).color(Color.Black) Button('Test ContextMenu2') - Divider().strokeWidth(2).margin(5) + Divider().strokeWidth(2).margin(5).color(Color.Black) Button('Test ContextMenu3') } .width(200) diff --git a/en/application-dev/reference/arkui-ts/ts-offscreencanvasrenderingcontext2d.md b/en/application-dev/reference/arkui-ts/ts-offscreencanvasrenderingcontext2d.md index 0f7d462061595e1d78647dd6e93dbd0b18f6585e..452637137c4c6794b019eec436bf686af72394b1 100644 --- a/en/application-dev/reference/arkui-ts/ts-offscreencanvasrenderingcontext2d.md +++ b/en/application-dev/reference/arkui-ts/ts-offscreencanvasrenderingcontext2d.md @@ -727,7 +727,7 @@ Fills a rectangle on the canvas. .height('100%') .backgroundColor('#ffff00') .onReady(() =>{ - this.offContext.fillRect(0,30,100,100) + this.offContext.fillRect(30,30,100,100) var image = this.offContext.transferToImageBitmap() this.context.transferFromImageBitmap(image) }) @@ -1767,10 +1767,15 @@ struct Clip { .backgroundColor('#ffff00') .onReady(() =>{ let region = new Path2D() - region.rect(80,10,20,130) - region.rect(40,50,100,50) + region.moveTo(30, 90) + region.lineTo(110, 20) + region.lineTo(240, 130) + region.lineTo(60, 130) + region.lineTo(190, 20) + region.lineTo(270, 90) + region.closePath() this.offContext.clip(region,"evenodd") - this.offContext.fillStyle = "rgb(255,0,0)" + this.offContext.fillStyle = "rgb(0,255,0)" this.offContext.fillRect(0, 0, 600, 600) var image = this.offContext.transferToImageBitmap() this.context.transferFromImageBitmap(image) diff --git a/en/application-dev/reference/arkui-ts/ts-state-management.md b/en/application-dev/reference/arkui-ts/ts-state-management.md index 6e6eaeafac441965e52b9b0fc5862ca557b90014..b5bbf02f094b27083e61c6d2fdcfed14da7f1b88 100644 --- a/en/application-dev/reference/arkui-ts/ts-state-management.md +++ b/en/application-dev/reference/arkui-ts/ts-state-management.md @@ -1,6 +1,6 @@ # State Management with Application-level Variables -The state management module provides APIs for data storage, persistent data management, Ability data storage, and environment status required by applications. The APIs for Ability data storage are supported since API version 9. +The state management module provides APIs for data storage, persistent data management, **Ability** data storage, and environment status required by applications. The APIs for **Ability** data storage are supported since API version 9. > **NOTE** > @@ -77,7 +77,7 @@ let simple = AppStorage.Prop('simpleProp') ### SetAndProp -SetAndProp\(propName: string, defaultValue: S): SubscribedAbstractProperty\; +SetAndProp\(propName: string, defaultValue: S): SubscribedAbstractProperty\ Works in a way similar to the **Prop** API. If the current key is stored in the **AppStorage**, the value corresponding to the key is returned. If the key has not been created, a **Prop** instance corresponding to the default value is created and returned. @@ -162,7 +162,7 @@ Replaces the value of a saved key. | boolean | Returns **true** and the value if the key exists; returns **false** otherwise.| ```ts -let simple = AppStorage.Set('simpleProp', 121); +let simple = AppStorage.Set('simpleProp', 121) ``` ### SetOrCreate @@ -313,7 +313,7 @@ Creates and initializes a **LocalStorage** object. | initializingProperties | Object | No | All object attributes and their values returned by **object.keys(obj)**.| ```ts -this.storage = new LocalStorage() +let storage = new LocalStorage() ``` ### GetShared9+ @@ -353,8 +353,8 @@ Checks whether the **LocalStorage** contains the specified attribute. | boolean | Returns whether the attribute exists.| ```ts -this.storage = new LocalStorage() -this.storage.has('storageSimpleProp') +let storage = new LocalStorage() +storage.has('storageSimpleProp') ``` ### get9+ @@ -376,8 +376,8 @@ Obtains the value of the specified key. | T \| undefined | Returns the value of the specified key if it exists; returns **undefined** otherwise.| ```ts -this.storage = new LocalStorage() -let simpleValue = this.storage.get('storageSimpleProp') +let storage = new LocalStorage() +let simpleValue = storage.get('storageSimpleProp') ``` ### set9+ @@ -400,8 +400,8 @@ Sets a new value for the specified key. | boolean | Returns **true** and the value if the key exists; returns **false** otherwise.| ```ts -this.storage = new LocalStorage() -this.storage.set('storageSimpleProp', 121) +let storage = new LocalStorage() +storage.set('storageSimpleProp', 121) ``` ### setOrCreate9+ @@ -424,8 +424,8 @@ Creates or updates the value of the specified key. | boolean | Updates the value of the attribute and returns **true** if an attribute that has the same name as the specified key exists; creates an attribute with the specified value as its default value and returns false otherwise. **undefined** and **null** are not allowed.| ```ts -this.storage = new LocalStorage() -this.storage.setOrCreate('storageSimpleProp', 121) +let storage = new LocalStorage() +storage.setOrCreate('storageSimpleProp', 121) ``` ### link9+ @@ -447,8 +447,8 @@ Establishes two-way data binding between an attribute and this **LocalStorage** | T | Returns two-way binding to this attribute if there is data with a given key. This means that attribute changes made by a variable or component will be synchronized to the **LocalStorage**, and attribute changes made through the **LocalStorage** will be synchronized to the variable or component. returns **undefined** if the attribute with the given key does not exist.| ```ts -this.storage = new LocalStorage() -let localStorage = this.storage.link('storageSimpleProp') +let storage = new LocalStorage() +let localStorage = storage.link('storageSimpleProp') ``` ### setAndLink9+ @@ -471,8 +471,8 @@ Works in a way similar to the **Link** API. | @Link | Returns the value corresponding to the key if the current key is stored in the **LocalStorage**; creates and returns a **Link** instance corresponding to the default value if the key has not been created.| ```ts -this.storage = new LocalStorage() -let localStorage = this.storage.setAndLink('storageSimpleProp', 121) +let storage = new LocalStorage() +let localStorage = storage.setAndLink('storageSimpleProp', 121) ``` ### prop9+ @@ -494,8 +494,8 @@ Establishes one-way data binding with an attribute to update its status. | @Prop | Returns one-way binding to an attribute with a given key if the attribute exists; returns **undefined** otherwise. One-way binding means that attribute changes made through the **LocalStorage** will be synchronized to the variable or component, but attribute changes made by the variable or component will not be synchronized to the **LocalStorage**. This API returns immutable variables and is applicable to mutable and immutable state variables alike. | ```ts -this.storage = new LocalStorage() -let localStorage = this.storage.prop('storageSimpleProp') +let storage = new LocalStorage() +let localStorage = storage.prop('storageSimpleProp') ``` ### setAndProp9+ @@ -518,8 +518,8 @@ Works in a way similar to the **Prop** API. | @Prop | Returns the value corresponding to the given key if the key is stored in the **LocalStorage**; creates and returns a **Prop** instance corresponding to the default value if the key has not been created.| ```ts -this.storage = new LocalStorage() -let localStorage = this.storage.setAndProp('storageSimpleProp', 121) +let storage = new LocalStorage() +let localStorage = storage.setAndProp('storageSimpleProp', 121) ``` ### delete9+ @@ -538,11 +538,11 @@ Deletes the key-value pair that matches the specified key. | Type | Description | | ------- | ---------------------------------------- | -| boolean | Returns **true** if the key-value pair exists and is successfully deleted; returns **false** if the key-value pair does not exist, fails to be deleted, or is being referenced by a state variable.| +| boolean | Returns **true** if the key-value pair exists and is successfully deleted; returns **false** otherwise.| ```ts -this.storage = new LocalStorage() -this.storage.delete('storageSimpleProp') +let storage = new LocalStorage() +storage.delete('storageSimpleProp') ``` ### keys9+ @@ -558,8 +558,8 @@ Searches for all keys. | array\ | Returns an array of strings containing all keys that are not serializable.| ```ts -this.storage = new LocalStorage() -let simple = this.storage.keys() +let storage = new LocalStorage() +let simple = storage.keys() ``` ### size9+ @@ -575,8 +575,8 @@ Obtains the number of existing key-value pairs. | number | Returns the number of key-value pairs.| ```ts -this.storage = new LocalStorage() -let simple = this.storage.size() +let storage = new LocalStorage() +let simple = storage.size() ``` ### Clear9+ @@ -592,8 +592,8 @@ Deletes all attributes. | boolean | Returns **true** if all attributes are deleted; returns **false** if any of the attributes is being referenced by a state variable.| ```ts -this.storage = new LocalStorage() -let simple = this.storage.clear() +let storage = new LocalStorage() +let simple = storage.clear() ``` ## PersistentStorage @@ -612,7 +612,7 @@ Creates a **persistentstorage** object. | storage | Storage | Yes | **Storage** object. | ```ts -this.persistentstorage = new PersistentStorage(AppStorage,Storage) +let persistentstorage = new PersistentStorage(AppStorage,Storage) ``` ### PersistProp @@ -650,7 +650,7 @@ PersistentStorage.DeleteProp('highScore') ### PersistProps -PersistProps(properties: {key: string, defaultValue: any}[]): void; +PersistProps(properties: {key: string, defaultValue: any}[]): void Changes the attributes that match the specified keys to persistent data in the **AppStorage**. diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-border-image.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-border-image.md index 0967cc433286589d8dcc7cdab305d1e5290b2193..d50f5ec504c3b9f215e033c4d33dd9dc48dba96d 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-border-image.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-border-image.md @@ -16,7 +16,7 @@ You can draw an image around a component. | Name | Type | Description | | ---------- | ---------------------------------------- | --------------------------------------- | -| source | string \| [Resource](ts-types.md#resource) \| [linearGradient](ts-universal-attributes-gradient-color.md) | Source or gradient color of the border image. | +| source | string \| [Resource](ts-types.md#resource) \| [linearGradient](ts-universal-attributes-gradient-color.md) | Source or gradient color of the border image.
**NOTE**
The border image source applies only to container components, such as **\**, **\**, and **\**.| | slice | [Length](ts-types.md#length) \| [EdgeWidths](ts-types.md#edgewidths9) | Slice width of the border image.
Default value: **0** | | width | [Length](ts-types.md#length) \| [EdgeWidths](ts-types.md#edgewidths9) | Width of the border image.
Default value: **0** | | outset | [Length](ts-types.md#length) \| [EdgeWidths](ts-types.md#edgewidths9) | Amount by which the border image is extended beyond the border box.
Default value: **0** | @@ -33,39 +33,31 @@ You can draw an image around a component. | Round | The source image's slices are tiled to fill the border box. Tiles may be compressed when needed.| | Space | The source image's slices are tiled to fill the border box. Extra space will be filled in between tiles. | - ## Example +### Example 1 + + ```ts // xxx.ets @Entry @Component struct Index { - @State outSetValue: number = 40 - build() { Row() { Column() { - Text('This is borderImage.').textAlign(TextAlign.Center).fontSize(50) + Text('This is gradient color.').textAlign(TextAlign.Center).height(50).width(200) .borderImage({ - source: $r('app.media.heart'), - slice: `${this.outSetValue}%`, - width: `${this.outSetValue}px`, - outset: '5px', - repeat: RepeatMode.Repeat, + source: { + angle: 90, + direction: GradientDirection.Left, + colors: [[0xAEE1E1, 0.0], [0xD3E0DC, 0.3], [0xFCD1D1, 1.0]] + }, + slice: { top: 10, bottom: 10, left: 10, right: 10 }, + width: { top: "10px", bottom: "10px", left: "10px", right: "10px" }, + repeat: RepeatMode.Stretch, fill: false }) - Slider({ - value: this.outSetValue, - min: 0, - max: 100, - style: SliderStyle.OutSet - }) - .margin({ top: 30 }) - .onChange((value: number, mode: SliderChangeMode) => { - this.outSetValue = value - console.info('value:' + value + 'mode:' + mode.toString()) - }) } .width('100%') } @@ -74,28 +66,42 @@ struct Index { } ``` -![en-us_image_borderImage](figures/borderImage.gif) +![en-us_image_borderImageGradient](figures/borderImageGradient.png) +### Example 2 ```ts // xxx.ets @Entry @Component struct Index { + @State outSetValue: number = 40 + build() { Row() { Column() { - Text('This is gradient color.').textAlign(TextAlign.Center).width(68) - .borderImage({ - source: { - angle: 90, - direction: GradientDirection.Left, - colors: [[0xAEE1E1, 0.0], [0xD3E0DC, 0.3], [0xFCD1D1, 1.0]] - }, - slice: { top: 10, bottom: 10, left: 10, right: 10 }, - width: { top: "10px", bottom: "10px", left: "10px", right: "10px" }, - repeat: RepeatMode.Stretch, - fill: false + Row() { + Text('This is borderImage.').textAlign(TextAlign.Center).fontSize(50) + } + .borderImage({ + source: $r('app.media.icon'), + slice: `${this.outSetValue}%`, + width: `${this.outSetValue}px`, + outset: '5px', + repeat: RepeatMode.Repeat, + fill: false + }) + + Slider({ + value: this.outSetValue, + min: 0, + max: 100, + style: SliderStyle.OutSet + }) + .margin({ top: 30 }) + .onChange((value: number, mode: SliderChangeMode) => { + this.outSetValue = value + console.info('value:' + value + 'mode:' + mode.toString()) }) } .width('100%') @@ -105,4 +111,4 @@ struct Index { } ``` -![en-us_image_borderImageGradient](figures/borderImageGradient.png) +![zh-cn_image_borderImage](figures/borderImage.gif) diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-layout-constraints.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-layout-constraints.md index 00099110825c5f1ba47594cf3ce9cd671f40f987..6fbaa35cdd66ca161b41999aedd1a2f06996f13d 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-layout-constraints.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-layout-constraints.md @@ -12,7 +12,7 @@ Layout constraints refer to constraints on the aspect ratio and display priority | Name | Type | Description | | --------------- | ------ | ---------------------------------------- | | aspectRatio | number | Aspect ratio of the component, which can be obtained using the following formula: Width/Height. | -| displayPriority | number | Display priority for the component in the layout container. When the space of the parent container is insufficient, the component with a lower priority is hidden.
The digits after the decimal point are not counted in determining the display priority. That is, numbers in the [x, x + 1) range are considered to represent the same priority. For example, **1.0** and **1.9** represent the same priority.
**NOTE**
This attribute is valid only for the **\**, **\**, and **\** (single-row) container components. | +| displayPriority | number | Display priority for the component in the layout container. When the space of the parent container is insufficient, the component with a lower priority is hidden.
The digits after the decimal point are not counted in determining the display priority. That is, numbers in the [x, x + 1) range are considered to represent the same priority. For example, **1.0** and **1.9** represent the same priority.
**NOTE**
This attribute is valid only for the **\**, **\**, and **\** (single-row) container components.| ## Example @@ -55,6 +55,7 @@ struct AspectRatioExample { Text(item) .backgroundColor(0xbbb2cb) .fontSize(40) + .height(160) .aspectRatio(1.5) } }, item => item) @@ -69,12 +70,10 @@ struct AspectRatioExample { } ``` -**Figure 1** Portrait display - +**Figure 1** Portrait display
![en-us_image_0000001256978379](figures/en-us_image_0000001256978379.gif) -**Figure 2** Landscape display - +**Figure 2** Landscape display
![en-us_image_0000001212218476](figures/en-us_image_0000001212218476.gif) ```ts diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-transformation.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-transformation.md index 344fda5cd13ac94198bbe5e993d671122490028f..bf35ba4e5ee69b08d9621570b664af5ca6c0429e 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-transformation.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-transformation.md @@ -14,7 +14,7 @@ Transformation attributes allow you to rotate, translate, scale, or transform a | rotate | {
x?: number,
y?: number,
z?: number,
angle?: number \| string,
centerX?: number \| string,
centerY?: number \| string
} | Rotation axis. A positive angle indicates a clockwise rotation, and a negative angle indicates a counterclockwise rotation. The default value is **0**. **centerX** and **centerY** are used to set the rotation center point.
Default value:
{
x: 0,
y: 0,
z: 0,
angle: 0,
centerX: '50%',
centerY: '50%'
} | | translate | {
x?: number \| string,
y?: number \| string,
z? : number \| string
} | Translation distance along the x-, y-, and z-axis. The translation direction is determined by the positive and negative values. The value cannot be a percentage.
Default value:
{
x: 0,
y: 0,
z: 0
} | | scale | {
x?: number,
y?: number,
z?: number,
centerX?: number \| string,
centerY?: number \| string
} | Scale ratio along the x-, y-, and z-axis. The default value is **1**. **centerX** and **centerY** are used to set the scale center point.
Default value:
{
x: 1,
y: 1,
z: 1,
centerX:'50%',
centerY:'50%'
} | -| transform | Matrix4Transit | Transformation matrix of the component. | +| transform | [Matrix4Transit](../apis/js-apis-matrix4.md) | Transformation matrix of the component. | ## Example @@ -31,13 +31,13 @@ struct TransformExample { Text('rotate').width('90%').fontColor(0xCCCCCC).padding(15).fontSize(14) Row() .rotate({ - x: 1, - y: 1, + x: 0, + y: 0, z: 1, centerX: '50%', centerY: '50%', angle: 300 - }) // The component rotates around the center point of the rotation axis (1,1,1) clockwise by 300 degrees. + }) // The component rotates around the center point of the rotation axis (0,0,1) clockwise by 300 degrees. .width(100).height(100).backgroundColor(0xAFEEEE) Text('translate').width('90%').fontColor(0xCCCCCC).padding(10).fontSize(14) diff --git a/en/application-dev/reference/arkui-ts/ts-universal-events-drag-drop.md b/en/application-dev/reference/arkui-ts/ts-universal-events-drag-drop.md index cf6afebdedc6782a19b98a25d9831f46515b4df2..47d797b263a133c740bcf5864b6347ed76af30b6 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-events-drag-drop.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-events-drag-drop.md @@ -11,8 +11,8 @@ A drag event is triggered when a component is dragged. | Name | Bubbling Supported| Description | | ------------------------------------------------------------ | -------- | ------------------------------------------------------------ | | onDragStart(event: (event?: [DragEvent](#dragevent), extraParams?: string) => [CustomBuilder](ts-types.md#custombuilder8) \| [DragItemInfo](#dragiteminfo)) | No | Triggered when the component bound to the event is dragged for the first time.
- **event**: information about the drag event, including the coordinates of the item that is being dragged.
- **extraParams**: additional information about the drag event. For details, see **[extraParams](#extraparams)**.
Return value: object being dragged, which is used for prompts displayed when the object is dragged.
A drag event can be triggered by a 150 ms long press. If the duration of a long-press gesture is set to less than or equal to 150 ms, the callback for the long-press gesture takes precedence. Otherwise, the callback for the drag event takes precedence.| -| onDragEnter(event: (event?: [DragEvent](#dragevent), extraParams?: string) => void) | No | Triggered when the dragged item enters a valid drop target.
- **event**: information about the drag event, including the coordinates of the item that is being dragged.
- **extraParams**: additional information about the drag event. For details, see **[extraParams](#extraparams)**.
This event is valid only when the **onDrop** event is listened to.| -| onDragMove(event: (event?: [DragEvent](#dragevent), extraParams?: string) => void) | No | Triggered when the dragged item moves in a valid drop target.
- **event**: information about the drag event, including the coordinates of the item that is being dragged.
- **extraParams**: additional information about the drag event. For details, see **[extraParams](#extraparams)**.
This event is valid only when the **onDrop** event is listened to.| +| onDragEnter(event: (event?: [DragEvent](#dragevent), extraParams?: string) => void) | No | Triggered when the dragged item enters a valid drop target.
- **event**: information about the drag event, including the coordinates of the item that is being dragged.
- **extraParams**: additional information about the drag event. For details, see **[extraParams](#extraparams)**.
This event is valid only when a listener for the **onDrop** event is enabled.| +| onDragMove(event: (event?: [DragEvent](#dragevent), extraParams?: string) => void) | No | Triggered when the dragged item moves in a valid drop target.
- **event**: information about the drag event, including the coordinates of the item that is being dragged.
- **extraParams**: additional information about the drag event. For details, see **[extraParams](#extraparams)**.
This event is valid only when a listener for the **onDrop** event is enabled.| | onDragLeave(event: (event?: [DragEvent](#dragevent), extraParams?: string) => void) | No | Triggered when the dragged item leaves a valid drop target.
- **event**: information about the drag event, including the coordinates of the item that is being dragged.
- **extraParams**: additional information about the drag event. For details, see **[extraParams](#extraparams)**.
This event is valid only when a listener for the **onDrop** event is enabled.| | onDrop(event: (event?: [DragEvent](#dragevent), extraParams?: string) => void) | No | Triggered when the dragged item is dropped on a valid drop target.
- **event**: information about the drag event, including the coordinates of the item that is being dragged.
- **extraParams**: additional information about the drag event. For details, see **[extraParams](#extraparams)**.| @@ -40,8 +40,8 @@ A drag event is triggered when a component is dragged. | Name | Type | Description | | ------ | ------ | ---------------- | -| getX() | number | X-coordinate of the item that is being dragged, in vp.| -| getY() | number | Y-coordinate of the item that is being dragged, in vp.| +| getX() | number | X-coordinate of the drag position relative to the upper left corner of the screen, in vp.| +| getY() | number | Y-coordinate of the drag position relative to the upper left corner of the screen, in vp.| ## Example diff --git a/en/application-dev/reference/errorcodes/Readme-EN.md b/en/application-dev/reference/errorcodes/Readme-EN.md index fabe9ee1204c0e78b50c7cbf5dab62581a2a9f4d..6f7c4e50024c533cf046fae90429c730570ea381 100644 --- a/en/application-dev/reference/errorcodes/Readme-EN.md +++ b/en/application-dev/reference/errorcodes/Readme-EN.md @@ -10,6 +10,7 @@ - [zlib Error Codes](errorcode-zlib.md) - Common Event and Notification - [Event Error Codes](errorcode-CommonEventService.md) + - [Notification Error Codes](errorcode-notification.md) - [DistributedNotificationService Error Codes](errorcode-DistributedNotificationService.md) - UI Page - [Animator Error Codes](errorcode-animator.md) @@ -26,8 +27,9 @@ - Resource Management - [I18N Error Codes](errorcode-i18n.md) - [Resource Manager Error Codes](errorcode-resource-manager.md) -- Background Tasks +- Background Task - [backgroundTaskManager Error Codes](errorcode-backgroundTaskMgr.md) + - [DeviceUsageStatistics Error Codes](errorcode-DeviceUsageStatistics.md) - [reminderAgentManager Error Codes](errorcode-reminderAgentManager.md) - [workScheduler Error Codes](errorcode-workScheduler.md) - Security @@ -60,8 +62,7 @@ - [Time and Time Zone Service Error Codes](errorcode-time.md) - [Webview Error Codes](errorcode-webview.md) - Account Management - - [Account Error Codes](errorcode-account.md) - - [App Account Error Codes](errorcode-app-account.md) + - [Account Management Error Codes](errorcode-account.md) - Device Management - [Power Consumption Statistics Error Codes](errorcode-batteryStatistics.md) - [Brightness Error Codes](errorcode-brightness.md) @@ -76,7 +77,6 @@ - [System Parameter Error Codes](errorcode-system-parameterV9.md) - [USB Error Codes](errorcode-usb.md) - [Update Error Codes](errorcode-update.md) - - [DeviceUsageStatistics Error Codes](errorcode-DeviceUsageStatistics.md) - Customization Management - [Enterprise Device Management Error Codes](errorcode-enterpriseDeviceManager.md) - Utils diff --git a/en/application-dev/reference/errorcodes/errorcode-DeviceUsageStatistics.md b/en/application-dev/reference/errorcodes/errorcode-DeviceUsageStatistics.md index 7c2246be4e0ad96b59bf22c8f5bb0cee9dcba2c6..2edb0dc58a5b83676839ec55eaa32c0c3af53bcc 100644 --- a/en/application-dev/reference/errorcodes/errorcode-DeviceUsageStatistics.md +++ b/en/application-dev/reference/errorcodes/errorcode-DeviceUsageStatistics.md @@ -58,7 +58,7 @@ Try again later or restart the device. **Error Message** -IPC communication failed. +IPC failed. **Description** @@ -94,7 +94,7 @@ Check whether the application exists. **Error Message** -Get application info failed. +Failed to get the application information. **Description** @@ -114,7 +114,7 @@ Check whether the input parameters are valid and whether the application exists. **Error Message** -Get system or actual time operation failed. +Failed to get the system time. **Description** @@ -132,7 +132,7 @@ Try again later or restart the device. **Error Message** -Application group operation failed. The application group are the the same or do not need te be updated. +Repeated operation on the application group. **Description** @@ -150,7 +150,7 @@ Do not repeatedly set application groups, or register or deregister a callback f **Error Message** -Get application group info failed. The application group infomation cannot be found. +Failed to get the application group information. **Description** diff --git a/en/application-dev/reference/errorcodes/errorcode-account.md b/en/application-dev/reference/errorcodes/errorcode-account.md index 45b1587c5402528bee4b3558fccfc25a44327465..5c146225a1d3b2e3d19ae10b95a9cb776ef5b5aa 100644 --- a/en/application-dev/reference/errorcodes/errorcode-account.md +++ b/en/application-dev/reference/errorcodes/errorcode-account.md @@ -1,4 +1,4 @@ -# Account Error Codes +# Account Management Error Codes The following includes the error codes for OS accounts, distributed accounts, and app accounts. @@ -13,13 +13,13 @@ System service works abnormally. The possible causes are as follows: 1. The account management service cannot start properly. 2. The IPC object for account management cannot be obtained. -3. The services on which the account management depends cannot start properly or the IPC object cannot be obtained. +3. The services on which the account management depends cannot start properly, or the IPC object on which the account management depends cannot be obtained. 4. The service is not initialized. 5. The disk space is insufficient. 6. The file read or write fails. -7. Directories cannot be created successfully. -8. Files cannot be created or deleted successfully. -9. The database cannot be read or written successfully. +7. Directories cannot be created. +8. Files cannot be created or deleted. +9. The database cannot be read or written. **Solution** @@ -74,15 +74,15 @@ The account does not exist. The possible causes are as follows: 1. The account to query, activate, or delete is not created. 2. The account to query, activate, or delete has been deleted. -3. The constraint, user name, or profile phone is set for an account that has been deleted. +3. The constraint, user name, or profile photo is set for an account that has been deleted. 4. The account to update is not created. -5. The access permission is set for an account that does not exist. -6. The password is set, deleted, or queried for an account that does not exist. -7. The token is set or deleted for an account that does not exist. -8. Additional information is set for an account that does not exist. -9. Credentials are set for an account that does not exist. -10. Custom data is set for an account that does not exist. -11. Distributed synchronization is enabled for an account that does not exist. +5. The access permission is to be set for an account that does not exist. +6. The password is to be set, deleted, or queried for an account that does not exist. +7. The token is to be set or deleted for an account that does not exist. +8. Additional information is to be set for an account that does not exist. +9. Credentials are to be set for an account that does not exist. +10. Custom data is to be set for an account that does not exist. +11. Distributed synchronization is to be enabled for an account that does not exist. **Solution** @@ -96,7 +96,6 @@ The account already exists. **Possible Causes** -The possible causes are as follows: The account to create already exists. **Solution** @@ -111,7 +110,6 @@ Multi-user is not supported. **Possible Causes** -The possible causes are as follows: The device does not support multiple users. **Solution** @@ -126,7 +124,6 @@ The account type is not supported. **Possible Causes** -The possible causes are as follows: The device does not support the account type. **Solution** @@ -141,12 +138,11 @@ The number of accounts has reached the limit. **Possible Causes** -The possible causes are as follows: -A maximum of 1000 OS accounts or app accounts can be created. +A maximum of 1,000 OS accounts or app accounts can be created. **Solution** -Delete the accounts that are no longer used. +Delete the accounts that are no longer used, and try again. ## 12300008 The Account Is Restricted @@ -173,12 +169,11 @@ The account has been activated. **Possible Causes** -The possible causes are as follows: The account to activate is already activated. **Solution** -No action is required. +No further action is required. ## 12300010 Account Service Not Respond @@ -189,7 +184,7 @@ The account service does not respond. **Possible Causes** The possible causes are as follows: -1. Repeated requests, such as the requests for activating an account or for applying the same settings, are submitted in a short period of time. +1. Repeated requests, such as the requests for activating an account or applying the same settings, are submitted in a short period of time. 2. When the number of authentication sessions for app accounts reaches 256, new authentication requests cannot be processed. **Solution** @@ -204,7 +199,6 @@ The event listener has been registered. **Possible Causes** -The possible causes are as follows: The listener to register has been registered with the system already. **Solution** @@ -219,7 +213,6 @@ The event listener has not been registered. **Possible Causes** -The possible causes are as follows: The event listener to unregister has not been registered. **Solution** @@ -268,7 +261,6 @@ The crdential inputer already exists. **Possible Causes** -The possible causes are as follows: The PIN inputer has been registered and cannot be registered again before deregistration. **Solution** @@ -283,7 +275,6 @@ The credential inputer is not found. **Possible Causes** -The possible causes are as follows: No credential inputer is registered when a credential is authenticated, added or modified. **Solution** @@ -298,7 +289,6 @@ The trust level is not supported. **Possible Causes** -The possible causes are as follows: The trust level passed in is not supported. **Solution** @@ -313,7 +303,6 @@ The authentication type is not supported. **Possible Causes** -The possible causes are as follows: The authentication type passed in is not supported. **Solution** @@ -328,7 +317,6 @@ The authentication type does not exist. **Possible Causes** -The possible causes are as follows: The specified authentication type does not exist when a token is queried or deleted. **Solution** @@ -343,8 +331,6 @@ The authentication session does not exist. **Possible Causes** -The possible causes are as follows: - The session callback to query does not exist. **Solution** @@ -359,7 +345,6 @@ The authentication is canceled. **Possible Causes** -The possible causes are as follows: The user cancels the authentication. **Solution** @@ -374,7 +359,6 @@ The authentication is locked. **Possible Causes** -The possible causes are as follows: The number of authentication type errors exceeds the limit. **Solution** @@ -407,9 +391,8 @@ The authentication service does not respond. **Possible Causes** The possible causes are as follows: - -- The total number of OS accounts being authenticated exceeds 5. -- The authentication service of the third-party app does not respond. +The total number of OS accounts being authenticated exceeds 5. +The authentication service of the third-party app does not respond. **Solution** @@ -423,17 +406,16 @@ The account authentication service does not exist. **Possible Causes** -The possible causes are as follows: For app accounts: 1. When an authentication is requested, the app does not support the authentication service. 2. When an account is added implicitly, the app does not support the authentication service. 3. When the credential of a specified account is verified, the app does not support the authentication service. 4. When the authenticator attributes are set for an app, the app does not support the authentication service. -5. During the account tags are checked, the specified app does not support the authentication service. +5. When the account tags are checked, the specified app does not support the authentication service. **Solution** -Cancel the operation or authenticate the app that supports the authentication service. +Cancel the operation or authenticate an app that supports the authentication service. ## 12300114 Authentication Service Abnormal @@ -451,3 +433,76 @@ The possible causes are as follows: 1. Try again or restart the system. 2. Use the app authenticator that complies with specifications. + +## 12400001 Application Not Exist + +**Error Message** + +The application does not exist. + +**Possible Causes** + +The possible causes are as follows: +1. The target app does not exist when the app permission is set. +2. The target app does not exist when the app permission is authorized. + +**Solution** + +Check that the target app has been installed and use the bundle of the app. + +## 12400002 Custom Data Not Exist + +**Error Message** + +The custom data does not exist. + +**Possible Causes** + +The key does not exist when you query the custom data of the account. + +**Solution** + +Query the custom data with a key that is already defined. + +## 12400003 Custom Data Records Reached the Limit + +**Error Message** + +The number of custom data reaches upper limit. + +**Possible Causes** + +The number of custom data records of the target account has reached 512. + +**Solution** + +Delete the custom data records that are no longer used. + +## 12400004 Token Count Reached the Limit + +**Error Message** + +The number of token reaches upper limit. + +**Possible Causes** + +The number of tokens of the target account has reached 1024. + +**Solution** + +Delete the tokens that are not longer used, and try again. + +## 12400005 Bundles in the OAuth List Reached the Limit + +**Error Message** + +The size of authorization list reaches upper limit. + +**Possible Causes** + +The number of bundles in the authorization list has reached 1024. + +**Solution** + +Revoke authorization from the apps that do not require the authorization and try again. + diff --git a/en/application-dev/reference/errorcodes/errorcode-app-account.md b/en/application-dev/reference/errorcodes/errorcode-app-account.md deleted file mode 100644 index 472a4702b21df2c7a7546a630922893cb494865c..0000000000000000000000000000000000000000 --- a/en/application-dev/reference/errorcodes/errorcode-app-account.md +++ /dev/null @@ -1,77 +0,0 @@ -# App Account Error Codes - -## 12400001 Application Not Exist - -**Error Message** - -The application does not exist. - -**Possible Causes** - -The possible causes are as follows: -1. The target application does not exist when the app permission is set. -2. The target application does not exist when the app permission is authorized. - -**Solution** - -Check that the target app has been installed and use the bundle of the app. - -## 12400002 Custom Data Not Exist - -**Error Message** - -The custom data does not exist. - -**Possible Causes** - -The possible causes are as follows: -The key does not exist when you query the custom data of the account. - -**Solution** - -Query the custom data with a key that is already defined. - -## 12400003 The Number of Custom Data Records Has Reached the Limit - -**Error Message** - -The number of custom data records has reached the limit. - -**Possible Causes** - -The possible causes are as follows: -The number of custom data records of the target account has reached 512. - -**Solution** - -Delete the custom data records that are no longer used. - -## 12400004 The Number of Tokens Has Reached the Limit - -**Error Message** - -The number of tokens has reached the limit. - -**Possible Causes** - -The possible causes are as follows: -The number of tokens of the target account has reached 1024. - -**Solution** - -Delete the tokens that are not longer used, and try again. - -## 12400005 The Number of Bundles in the OAuth List Has Reached the Limit - -**Error Message** - -The number of bundles in the OAuth list has reached the limit. - -**Possible Causes** - -The possible causes are as follows: -The number of bundles in the authorization list has reached 1024. - -**Solution** - -1. Revoke authorization from the apps that do not require the authorization, and try again. diff --git a/en/application-dev/reference/errorcodes/errorcode-form.md b/en/application-dev/reference/errorcodes/errorcode-form.md index 232306b030f7ef912726a95548d4dc1efe1c8050..44184be85518557f141f05c49732fb3d2572399e 100644 --- a/en/application-dev/reference/errorcodes/errorcode-form.md +++ b/en/application-dev/reference/errorcodes/errorcode-form.md @@ -136,3 +136,39 @@ The widget does not belong to the application. 1. Check the ownership of the widget ID. 2. Upgrade the application permission to **SystemApp**. + +## 16501004 Ability Not Installed + +**Error Message** + +The ability is not installed. + +**Description** + +The specified ability is not installed. + +**Possible Causes** + +The specified ability is not installed. + +**Solution** + +Pass in valid **abilityName** and **bundleName**. + +## 16501005 Failed to Connect to FormRenderService + +**Error Message** + +Connect FormRenderService failed, please try again later. + +**Description** + +The FormRenderService fails to be connected. + +**Possible Causes** + +The service is busy. + +**Solution** + +Try again later. diff --git a/en/application-dev/reference/errorcodes/errorcode-notification.md b/en/application-dev/reference/errorcodes/errorcode-notification.md new file mode 100644 index 0000000000000000000000000000000000000000..9f1d5219020314fb4e8b945cda3b2435f67ac1eb --- /dev/null +++ b/en/application-dev/reference/errorcodes/errorcode-notification.md @@ -0,0 +1,219 @@ +# Notification Error Codes + +## 1600001 Internal Error + +**Error Message** + +Internal error. + +**Description** + +This error code is reported when an error occurs during internal processing, such as multi-thread processing or internal pointer checks. + +**Cause** + +Common kernel errors such as multi-thread processing and internal processing errors occur. + +**Solution** + +Make sure the system resources are sufficient. + +## 1600002 Marshalling or Unmarshalling Error + +**Error Message** + +marshalling or unmarshalling error. + +**Description** + +This error code is reported when a marshalling or unmarshalling error occurs before data transmission. + +**Cause** + +A parameter mismatch is detected between the application and the notification service. + +**Solution** + +Make sure the application SDK version matches the system version. + +## 1600003 Failed to Connect to the Notification Service + +**Error Message** + +Failed to connect service. + +**Description** + +This error code is reported when the application fails to connect to the notification service. + +**Cause** + +The notification service is busy or abnormal. + +**Solution** + +Restart the system. + +## 1600004 Notification Disabled + +**Error Message** + +Notification is not enabled. + +**Description** + +This error code is reported when notification is disabled. + +**Cause** + +The notification feature is not enabled for the application. + +**Solution** + +Enable notification for the application in the notification settings. + +## 1600005 Notification Slot Disabled + +**Error Message** + +Notification slot is not enabled. + +**Description** + +This error code is reported when the notification slot is not available. + +**Cause** + +The notification slot is disabled or has not been added. + +**Solution** + +1. Access the notification settings and check whether the application has the notification slot. If no, add it. + +2. Make sure the notification slot is enabled. + +## 1600006 Notification Deletion Failed + +**Error Message** + +Notification is not allowed to remove. + +**Description** + +This error code is reported when notification deletion is disabled. + +**Cause** + +The notification attribute **isUnremovable** is set to true. + +**Solution** + +Set **isUnremovable** as needed. For details, see [NotificationRequest](../apis/js-apis-notificationManager.md#notificationrequest). + +## 1600007 Notification Not Found + +**Error Message** + +The notification is not exist. + +**Description** + +This error code is reported when the notification service could not find the notification. + +**Cause** + +The notification has been canceled or deleted. + +**Solution** + +N/A + +## 1600008 User Not Found + +**Error Message** + +The user is not exist. + +**Description** + +This error code is reported when the specified user is not found in the information system. + +**Cause** + +The user information passed is incorrect. + +**Solution** + +Verify the user information. + +## 1600009 Notification Sending Limit Reached + +**Error Message** + +Over max number notifications per second. + +**Description** + +This error code is reported when the notification sending frequency reaches the upper limit. + +**Cause** + +More than 10 notifications are sent per second. + +**Solution** + +Reduce the notification sending frequency to no more than 10 per second. + +## 16000010 Distributed Operation Failed + +**Error Message** + +Distributed operation failed. + +**Description** + +This error code is reported when an error occurs with the distributed database operation or distributed API invoking. + +**Cause** + +The distributed database could not be operated or the distributed API could not be invoked. + +**Solution** + +Verify the distributed connection. + +## 16000011 Failed to Read the Template Configuration + +**Error Message** + +Read template config failed. + +**Description** + +This error code is reported when the attempt to read the template configuration file fails. + +**Cause** + +The template configuration file is lost in the system. + +**Solution** + +Check for the template configuration file: /system/etc/notification_template/external.json. + +## 16000012 Insufficient Memory Space + +**Error Message** + +No memory space. + +**Description** + +This error code is reported when a memory allocation error occurs. + +**Cause** + +A memory allocation error occurs. + +**Solution** + +Ensure sufficient system memory. diff --git a/en/application-dev/reference/errorcodes/errorcode-telephony.md b/en/application-dev/reference/errorcodes/errorcode-telephony.md new file mode 100644 index 0000000000000000000000000000000000000000..f90efffed3589a42344d27fcbbf641872e295a96 --- /dev/null +++ b/en/application-dev/reference/errorcodes/errorcode-telephony.md @@ -0,0 +1,172 @@ +# Telephony Error Codes + +## 8300001 Input Parameter Value Out of Range + +**Error Message** + +The input parameter value is out of range. + +**Description** + +This error code is reported if the value of the input parameter (for example, **slotId**) is not within the valid range. In this case, the API call will fail and the corresponding operation cannot be performed. + +**Cause** + +The input parameter value is invalid. + +**Solution** + +Enter a valid parameter value. + + + +## 8300002 Service Connection Error + +**Error Message** + +Operation failed. Cannot connect to service. + +**Description** + +This error code is reported if the attempt to connect to a service fails. + +**Cause** + +Service startup or IPC connection has failed. + +**Solution** + +Operation error. Try again later. + + + +## 8300003 System Internal Error + +**Error Message** + +System internal error. + +**Description** + +This error code is reported if an internal error has occurred. + +**Cause** + +The possible cause is that data read/write has failed because the network is abnormal. + +**Solution** + +Operation error. Try again later. + + +## 8300004 SIM Card Not Detected + +**Error Message** + +Do not have sim card. + +**Description** + +This error code is reported if no SIM card is detected. + +**Cause** + +No SIM card is inserted or the SIM card is not properly inserted. + +**Solution** + +Insert the SIM card or remove and insert the SIM card again. + + +## 8300999 Unknown Error + +**Error Message** + +Unknown error code. + +**Description** + +This error code is reported if an unknown error occurs. + +**Cause** + +An unexpected error occurs in the system. The possible cause is that error codes of the bottom layer are not within the processing range. + +**Solution** + +Operation error. Try again later. + + +## 8301001 SIM Card Not Activated + +**Error Message** + +SIM card is not activated. + +**Description** + +This error code is reported if the SIM card is not activated. + +**Cause** + +The SIM card is not activated. + +**Solution** + +Activate the SIM card. + + +## 8301002 Failed to Read or Update SIM Card Data + +**Error Message** + +SIM card operation error. + +**Description** + +This error code is reported if the attempt to read or update SIM card data has failed. + +**Cause** + +The SIM card does not support the operation, or the SIM card is damaged. + +**Solution** + +Contact the SIM card supplier, or replace the SIM card. + + +## 8301003 Incorrect SIM Card Configuration + +**Error Message** + +Operator config error. + +**Description** + +This error code is reported if the SIM card configuration is incorrect. + +**Cause** + +The configuration file delivered with the SIM card is not properly preconfigured. + +**Solution** + +Check whether the correct SIM card is inserted. + +## 8401001 Failed to Connect to the UT + +**Error Message** + +UT is not connected. + +**Description** + +This error code is reported if the UT is not connected. + +**Cause** + +The current carrier does not support sending of UT requests over a Wi-Fi network, but the mobile phone is connected to the Wi-Fi network. + +**Solution** + +Disconnect the Wi-Fi connection, and send a new UT request. diff --git a/en/application-dev/reference/errorcodes/errorcode-utils.md b/en/application-dev/reference/errorcodes/errorcode-utils.md index 0d0f1a22baca55308747aadea65cbe64ca61f4aa..c69ef691fe54f0949dba7858b46a6faee32c46a9 100644 --- a/en/application-dev/reference/errorcodes/errorcode-utils.md +++ b/en/application-dev/reference/errorcodes/errorcode-utils.md @@ -273,3 +273,21 @@ The task to cancel is being executed. **Solution** Before canceling a task, ensure that the task finishes execution. + +## 10200017 Failed to Delete an Element That Does Not Exist + +**Error Message** + +The element does not exist in this container. + +**Description** + +This error code is reported when you attempt to delete an element that does not exist in the container. + +**Possible Causes** + +The element to delete does not exist in the container. + +**Solution** + +Before deleting an element, ensure that the element exists in this container. diff --git a/en/application-dev/security/permission-list.md b/en/application-dev/security/permission-list.md index c20a672c4a122bc3856a69a39701ffc2114348ed..0258bc1d6eb6fea5a4d0f106d7a37568374f1b4a 100644 --- a/en/application-dev/security/permission-list.md +++ b/en/application-dev/security/permission-list.md @@ -62,11 +62,11 @@ Allows an application to access the notification policy on the device. **Authorization mode**: system_grant -**Enable ACL**: FALSE +**Enable via ACL**: FALSE ## ohos.permission.GET_TELEPHONY_STATE -Allows an application to read telephony information. +Allows an application to read telephony information. **Permission level**: system_basic @@ -166,7 +166,7 @@ Allows an application to set the system time zone. ## ohos.permission.DOWNLOAD_SESSION_MANAGER -Allows an application to manage the download sessions. +Allows an application to manage download sessions. **Permission level**: system_core @@ -672,7 +672,7 @@ Allows an application to access the system identity credential information. **Authorization mode**: system_grant -**Enable ACL**: FALSE +**Enable via ACL**: FALSE ## ohos.permission.MANAGE_USER_IDM @@ -682,7 +682,7 @@ Allows an application to use the system identity credential management capabilit **Authorization mode**: system_grant -**Enable ACL**: FALSE +**Enable via ACL**: FALSE ## ohos.permission.ACCESS_BIOMETRIC @@ -702,7 +702,7 @@ Allows an application to use the system identity authentication capability to au **Authorization mode**: system_grant -**Enable ACL**: FALSE +**Enable via ACL**: FALSE ## ohos.permission.ACCESS_PIN_AUTH @@ -712,7 +712,7 @@ Allows a system application to call the PIN input APIs to present a password inp **Authorization mode**: system_grant -**Enable ACL**: FALSE +**Enable via ACL**: FALSE ## ohos.permission.GET_RUNNING_INFO @@ -852,7 +852,7 @@ Allows an application to obtain all application account information. **Authorization mode**: system_grant -**Enable ACL**: FALSE +**Enable via ACL**: FALSE ## ohos.permission.MANAGE_SECURE_SETTINGS @@ -872,7 +872,7 @@ Allows an application to access system event logging data. **Authorization mode**: system_grant -**Enable ACL**: FALSE +**Enable via ACL**: FALSE ## ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN @@ -932,7 +932,7 @@ Allows an application to read NFC tag information. **Authorization mode**: system_grant -**Enable ACL**: FALSE +**Enable via ACL**: FALSE ## ohos.permission.NFC_CARD_EMULATION @@ -942,7 +942,7 @@ Allows an application to implement card emulation. **Authorization mode**: system_grant -**Enable ACL**: FALSE +**Enable via ACL**: FALSE ## ohos.permission.PERMISSION_USED_STATS @@ -1132,7 +1132,7 @@ Allows an application running in the background to obtain the device location. **Authorization mode**: user_grant -**Enable ACL**: FALSE +**Enable via ACL**: FALSE ## ohos.permission.LOCATION @@ -1154,7 +1154,7 @@ Allows an application to obtain the approximate location information of a device **Authorization mode**: user_grant -**Enable ACL**: FALSE +**Enable via ACL**: FALSE **Application conditions**: Only applications developed using the SDK of API version 9 or later can apply for this permission. @@ -1276,7 +1276,7 @@ Allows networking between different devices. **Authorization mode**: system_grant -**Enable ACL**: FALSE +**Enable via ACL**: FALSE ## ohos.permission.ACCESS_DLP_FILE @@ -1386,7 +1386,7 @@ Allows an application to report risk data for security guard. **Authorization mode**: system_grant -**Enable ACL**: FALSE +**Enable via ACL**: FALSE ## ohos.permission.securityguard.REQUEST_SECURITY_MODEL_RESULT @@ -1406,7 +1406,7 @@ Allows an application to obtain detailed risk data. **Authorization mode**: system_grant -**Enable ACL**: FALSE +**Enable via ACL**: FALSE ## ohos.permission.READ_ACCESSIBILITY_CONFIG @@ -1416,7 +1416,7 @@ Allows an application to read the accessibility configuration. **Authorization mode**: system_grant -**Enable ACL**: FALSE +**Enable via ACL**: FALSE ## ohos.permission.WRITE_ACCESSIBILITY_CONFIG @@ -1426,7 +1426,7 @@ Allows an application to set the accessibility configuration. **Authorization mode**: system_grant -**Enable ACL**: FALSE +**Enable via ACL**: FALSE ## ohos.permission.ACCESS_CERT_MANAGER_INTERNAL @@ -1436,7 +1436,7 @@ Allows an application to install, uninstall, enable, and disable certificates an **Authorization mode**: system_grant -**Enable ACL**: FALSE +**Enable via ACL**: FALSE ## ohos.permission.ACCESS_CERT_MANAGER @@ -1446,7 +1446,7 @@ Allows an application to manage private credentials and query certificate status **Authorization mode**: system_grant -**Enable ACL**: FALSE +**Enable via ACL**: FALSE ## ohos.permission.ACCESS_PUSH_SERVICE @@ -1466,7 +1466,7 @@ Allows an application to subscribe to the startup broadcast. **Authorization mode**: system_grant -**Enable ACL**: FALSE +**Enable via ACL**: FALSE ## ohos.permission.MANAGE_CAMERA_CONFIG @@ -1476,7 +1476,7 @@ Allows an application to enable or disable cameras globally. **Authorization mode**: system_grant -**Enable ACL**: FALSE +**Enable via ACL**: FALSE ## ohos.permission.READ_WHOLE_CALENDAR @@ -1526,7 +1526,7 @@ Allows an application to mount and unmount external cards. **Authorization mode**: system_grant -**Enable ACL**: FALSE +**Enable via ACL**: FALSE ## ohos.permission.MOUNT_FORMAT_MANAGER @@ -1536,7 +1536,7 @@ Allows an application to format external cards. **Authorization mode**: system_grant -**Enable ACL**: FALSE +**Enable via ACL**: FALSE ## ohos.permission.STORAGE_MANAGER diff --git a/en/application-dev/task-management/Readme-EN.md b/en/application-dev/task-management/Readme-EN.md index 8f5c8d904521a8188079239092ffd5b88a58b955..b18e933695fa7e156440feafd5bfc7719b10b59e 100644 --- a/en/application-dev/task-management/Readme-EN.md +++ b/en/application-dev/task-management/Readme-EN.md @@ -1,4 +1,4 @@ -# Task Management +# Background Task Management - Background Task - [Background Task Management Overview](background-task-overview.md) @@ -8,6 +8,6 @@ - [WorkSchedulerExtensionAbility Development](workscheduler-extensionability.md) - [Efficiency Resource Request Development](efficiency-resources-apply-dev-guide.md) -- Agent-Powered Scheduled Reminder +- Agent-Powered Reminder - [Agent-Powered Reminder Overview](reminder-agent-overview.md) - [Agent-Powered Reminder Development](reminder-agent-development.md) \ No newline at end of file diff --git a/en/application-dev/task-management/background-task-overview.md b/en/application-dev/task-management/background-task-overview.md index dc7e7e3eda37f3fe62e70114a1804cfa0bffdc65..f07f4771b2ab0faa950c48711ca49df0e035ee1c 100644 --- a/en/application-dev/task-management/background-task-overview.md +++ b/en/application-dev/task-management/background-task-overview.md @@ -16,7 +16,7 @@ For more targeted management of background applications, OpenHarmony classifies - **Work Scheduler task**: The Work Scheduler provides a mechanism for applications to execute non-real-time tasks when the system is idle. If the preset conditions are met, the tasks will be placed in the execution queue and scheduled when the system is idle. -- **Efficiency resources**: If an application needs to ensure that it will not be suspended within a period of time or can normally use certain system resources when it is suspended, it can request efficiency resources, including CPU, WORK_SCHEDULER, software, and hardware resources. Different types of efficiency resources come with different privileges. For example, the CPU resources enable an application or process to keep running without being suspended, and the WORK_SCHEDULER resources allow for more task execution time before the application or process is suspended. +- **Efficiency resources**: If an application needs to ensure that it will not be suspended within a period of time or can normally use certain system resources when it is suspended, it can request efficiency resources, including software and hardware resources. Different types of efficiency resources come with different privileges. For example, the CPU resources enable an application or process to keep running without being suspended, and the WORK_SCHEDULER resources allow for more task execution time before the application or process is suspended. ## Selecting a Background Task @@ -41,7 +41,7 @@ Adhere to the following constraints and rules when using transient tasks: - **When to cancel**: The application shall proactively cancel the request when the transient task is complete, rather than waiting for a system callback. Otherwise, the time frame allowed for the application to run in the background will be affected. -- **Quota mechanism**: To prevent abuse of the keepalive, each application has a certain quota every day (dynamically adjusted based on user habits). After using up the quota, an application cannot request transient tasks. Therefore, applications should cancel their request immediately after the transient tasks are complete, to avoid quota consumption. (Note: The quota refers to the requested duration and does not include the time when the application runs in the background.) +- **Quota mechanism**: To prevent abuse of the keepalive, each application has a certain quota every day (dynamically adjusted based on user habits). The default quota for a single day is 10 minutes, and the maximum quota for each request is 3 minutes. After using up the quota, an application cannot request transient tasks. Therefore, applications should cancel their request immediately after the transient tasks are complete, to avoid quota consumption. (Note: The quota refers to the requested duration and does not include the time when the application runs in the background.) ## Continuous Tasks Continuous tasks provide background running lifecycle support for services that can be directly perceived by users and need to run in the background. For example, if a service needs to play audio or continue with navigation and positioning in the background, which can be perceived by users, it can execute a continuous task in the respective background mode. @@ -58,7 +58,7 @@ OpenHarmony provides 9 background modes for services that require continuous tas | audioRecording | Audio input | A recording task is running. | - | | location | Positioning and navigation | A positioning task is running. | - | | bluetoothInteraction | Bluetooth transmission | A Bluetooth-related task is running. | - | -| multiDeviceConnection | Distributed interconnection | A distributed task is running. | - | +| multiDeviceConnection | Multi-device application collaboration | A distributed task is running. | - | | wifiInteraction | WLAN transmission | A WLAN-related task is running.| System API, which is available only to system applications| | voip | Voice and video calls over VoIP | A call-related task is running. | System API, which is available only to system applications| | taskKeeping | Computing task | A computing task is running | Effective only for specific devices | @@ -105,7 +105,7 @@ Efficiency resources are classified into CPU, WORK_SCHEDULER, software, and hard An application or process is assigned the privileges associated with the obtained efficiency resources. * With the CPU resources, the application or process will not be suspended. - * With the WORK_SCHEDULER resources, the application or process has more time to execute a task and is not restricted by the execution frequency. + * With the WORK_SCHEDULER resources, the application has more time to execute a task and is not restricted by the execution frequency. * With the COMMON_EVENT resources, the application can still receive common events when it is suspended in the background. * With the TIMER resources, the application can use the timer to execute precise scheduled tasks. * With the hardware resources, the application can still be woken up by related services to execute tasks when it is suspended in the background. @@ -116,12 +116,12 @@ An application or process is assigned the privileges associated with the obtaine | Name | Value | Description | | -------------- | ---- | ------------------- | | CPU | 1 | CPU resources, which prevent the application from being suspended. | -| COMMON_EVENT | 2 | A type of software resources, which prevent common events from being proxied when the application is suspended. | -| TIMER | 4 | A type of software resources, which prevent timers from being proxied when the application is suspended. | +| COMMON_EVENT | 2 | COMMON_EVENT resources, which prevent common events from being proxied when the application is suspended. | +| TIMER | 4 | TIMER resources, which prevent timers from being proxied when the application is suspended. | | WORK_SCHEDULER | 8 | WORK_SCHEDULER resources, which ensure that the application has more time to execute the task. | -| BLUETOOTH | 16 | A type of hardware resources, which prevent Bluetooth resources from being proxied when the application is suspended. | -| GPS | 32 | A type of hardware resources, which prevent GPS resources from being proxied when the application is suspended.| -| AUDIO | 64 | A type of hardware resources, which prevent audio resources from being proxied when the application is suspended. | +| BLUETOOTH | 16 | BLUETOOTH resources, which prevent Bluetooth resources from being proxied when the application is suspended. | +| GPS | 32 | GPS resources, which prevent GPS resources from being proxied when the application is suspended.| +| AUDIO | 64 | AUDIO resources, which prevent audio resources from being proxied when the application is suspended. | ### Restrictions on Using Efficiency Resources - Applications or processes are responsible for requesting and releasing efficiency resources. A process can release the resources requested by itself, whereas an application can release the resources requested by both itself and its processes. For example, an application requests CPU resources, and its process requests CPU and WORK_SCHEDULER resources. If the application initiates CPU resource release, the CPU resources requested by the process are also released. However, the WORK_SCHEDULER resources are not released. If the process initiates CPU resource release, the CPU resources requested by the application are retained until being released by the application. diff --git a/en/application-dev/task-management/continuous-task-dev-guide.md b/en/application-dev/task-management/continuous-task-dev-guide.md index 2613b4d7ac4b36e97e62a06f7d796a6cf4ab334d..79280f8d301f75f45fbe2f0eb0724c17e7576e67 100644 --- a/en/application-dev/task-management/continuous-task-dev-guide.md +++ b/en/application-dev/task-management/continuous-task-dev-guide.md @@ -38,386 +38,387 @@ For details about **wantAgent**, see [WantAgent](../reference/apis/js-apis-wantA For details about how to use the ServiceAbility in the FA model, see [ServiceAbility Component Overview](../application-models/serviceability-overview.md). -If an application does not need to interact with a continuous task in the background, you can use **startAbility()** to start the Service ability. In the **onStart** callback of the Service ability, call **startBackgroundRunning()** to declare that the Service ability needs to run in the background for a long time. After the task execution is complete, call **stopBackgroundRunning()** to release resources. - -If an application needs to interact with a continuous task in the background (for example, an application related to music playback), you can use **connectAbility()** to start and connect to the Service ability. After obtaining the proxy of the Service ability, the application can communicate with the Service ability and control the request and cancellation of continuous tasks. - -1. Create an API version 8 project. Then right-click the project directory and choose **New > Ability > Service Ability** to create a Service ability. Configure the continuous task permission (**ohos.permission.KEEP_BACKGROUND_RUNNING**) and background mode type in the **config.json** file, with the ability type set to **service**. - -``` -"module": { - "package": "com.example.myapplication", - "abilities": [ - { - "backgroundModes": [ - "dataTransfer", - "location" - ], // Background mode - "type": "service" // The ability type is service. - } - ], - "reqPermissions": [ - { - "name": "ohos.permission.KEEP_BACKGROUND_RUNNING" // Continuous task permission - } - ] -} -``` - -2. Call the APIs for requesting and canceling a continuous task in the Service ability. - -```js -import backgroundTaskManager from '@ohos.resourceschedule.backgroundTaskManager'; -import featureAbility from '@ohos.ability.featureAbility'; -import wantAgent from '@ohos.wantAgent'; -import rpc from "@ohos.rpc"; - -function startContinuousTask() { - let wantAgentInfo = { - // List of operations to be executed after the notification is clicked. - wants: [ - { - bundleName: "com.example.myapplication", - abilityName: "com.example.myapplication.MainAbility" - } - ], - // Type of the operation to perform after the notification is clicked. - operationType: wantAgent.OperationType.START_ABILITY, - // Custom request code. - requestCode: 0, - // Execution attribute of the operation to perform after the notification is clicked. - wantAgentFlags: [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] - }; - - // Obtain the WantAgent object by using the getWantAgent API of the wantAgent module. - wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj) => { - try { - backgroundTaskManager.startBackgroundRunning(featureAbility.getContext(), - backgroundTaskManager.BackgroundMode.DATA_TRANSFER, wantAgentObj).then(() => { - console.info("Operation startBackgroundRunning succeeded"); - }).catch((err) => { - console.error("Operation startBackgroundRunning failed Cause: " + err); - }); - } catch (error) { - console.error(`Operation startBackgroundRunning failed. code is ${error.code} message is ${error.message}`); - } - }); -} - -function stopContinuousTask() { - try { - backgroundTaskManager.stopBackgroundRunning(featureAbility.getContext()).then(() => { - console.info("Operation stopBackgroundRunning succeeded"); - }).catch((err) => { - console.error("Operation stopBackgroundRunning failed Cause: " + err); - }); - } catch (error) { - console.error(`Operation stopBackgroundRunning failed. code is ${error.code} message is ${error.message}`); - } -} - -async function processAsyncJobs() { - // Execute the continuous task. - - // After the continuous task is complete, call the API to release resources. - stopContinuousTask(); -} - -let mMyStub; - -class MyStub extends rpc.RemoteObject { - constructor(des) { - if (typeof des === 'string') { - super(des); - } else { - return null; - } - } - onRemoteRequest(code, data, reply, option) { - console.log('ServiceAbility onRemoteRequest called'); - // The meaning of code is user-defined. - if (code === 1) { - // Receive the request code for requesting a continuous task. - startContinuousTask(); - // Execute the continuous task. - } else if (code === 2) { - // Receive the request code for canceling the continuous task. - stopContinuousTask(); - } else { - console.log('ServiceAbility unknown request code'); - } - return true; - } -} - -export default { - onStart(want) { - console.info('ServiceAbility onStart'); - mMyStub = new MyStub("ServiceAbility-test"); - // Call the API to start the task. - startContinuousTask(); - processAsyncJobs(); - }, - onStop() { - console.info('ServiceAbility onStop'); - }, - onConnect(want) { - console.info('ServiceAbility onConnect'); - return mMyStub; - }, - onReconnect(want) { - console.info('ServiceAbility onReconnect'); - }, - onDisconnect() { - console.info('ServiceAbility onDisconnect'); - }, - onCommand(want, restart, startId) { - console.info('ServiceAbility onCommand'); - } -}; -``` +If an application does not need to interact with a continuous task in the background, you can use **startAbility()** to start the ServiceAbility. In the **onStart** callback of the ServiceAbility, call **startBackgroundRunning()** to declare that the ServiceAbility needs to run in the background for a long time. After the task execution is complete, call **stopBackgroundRunning()** to release resources. + +If an application needs to interact with a continuous task in the background (for example, an application related to music playback), you can use **connectAbility()** to start and connect to the ServiceAbility. After obtaining the proxy of the ServiceAbility, the application can communicate with the ServiceAbility and control the request and cancellation of continuous tasks. + +1. Configure the continuous task permission **ohos.permission.KEEP_BACKGROUND_RUNNING** in the **config.json** file, and declare the corresponding background mode type for the ServiceAbility that needs to use the task. + + ``` + "module": { + "package": "com.example.myapplication", + "abilities": [ + { + "backgroundModes": [ + "dataTransfer", + "location" + ], // Background mode + "type": "service" // The ability type is Service. + } + ], + "reqPermissions": [ + { + "name": "ohos.permission.KEEP_BACKGROUND_RUNNING" // Continuous task permission + } + ] + } + ``` + +2. Call the APIs for requesting and canceling a continuous task in the ServiceAbility. + + ```js + import backgroundTaskManager from '@ohos.resourceschedule.backgroundTaskManager'; + import featureAbility from '@ohos.ability.featureAbility'; + import wantAgent from '@ohos.wantAgent'; + import rpc from "@ohos.rpc"; + + function startContinuousTask() { + let wantAgentInfo = { + // List of operations to be executed after the notification is clicked. + wants: [ + { + bundleName: "com.example.myapplication", + abilityName: "com.example.myapplication.MainAbility" + } + ], + // Type of the operation to perform after the notification is clicked. + operationType: wantAgent.OperationType.START_ABILITY, + // Custom request code. + requestCode: 0, + // Execution attribute of the operation to perform after the notification is clicked. + wantAgentFlags: [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] + }; + + // Obtain the WantAgent object by using the getWantAgent API of the wantAgent module. + wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj) => { + try { + backgroundTaskManager.startBackgroundRunning(featureAbility.getContext(), + backgroundTaskManager.BackgroundMode.DATA_TRANSFER, wantAgentObj).then(() => { + console.info("Operation startBackgroundRunning succeeded"); + }).catch((err) => { + console.error("Operation startBackgroundRunning failed Cause: " + err); + }); + } catch (error) { + console.error(`Operation startBackgroundRunning failed. code is ${error.code} message is ${error.message}`); + } + }); + } + + function stopContinuousTask() { + try { + backgroundTaskManager.stopBackgroundRunning(featureAbility.getContext()).then(() => { + console.info("Operation stopBackgroundRunning succeeded"); + }).catch((err) => { + console.error("Operation stopBackgroundRunning failed Cause: " + err); + }); + } catch (error) { + console.error(`Operation stopBackgroundRunning failed. code is ${error.code} message is ${error.message}`); + } + } + + async function processAsyncJobs() { + // Execute the continuous task. + + // After the continuous task is complete, call the API to release resources. + stopContinuousTask(); + } + + let mMyStub; + + class MyStub extends rpc.RemoteObject { + constructor(des) { + if (typeof des === 'string') { + super(des); + } else { + return null; + } + } + onRemoteRequest(code, data, reply, option) { + console.log('ServiceAbility onRemoteRequest called'); + // The meaning of code is user-defined. + if (code === 1) { + // Receive the request code for requesting a continuous task. + startContinuousTask(); + // Execute the continuous task. + } else if (code === 2) { + // Receive the request code for canceling the continuous task. + stopContinuousTask(); + } else { + console.log('ServiceAbility unknown request code'); + } + return true; + } + } + + export default { + onStart(want) { + console.info('ServiceAbility onStart'); + mMyStub = new MyStub("ServiceAbility-test"); + // Call the API to start the task. + startContinuousTask(); + processAsyncJobs(); + }, + onStop() { + console.info('ServiceAbility onStop'); + }, + onConnect(want) { + console.info('ServiceAbility onConnect'); + return mMyStub; + }, + onReconnect(want) { + console.info('ServiceAbility onReconnect'); + }, + onDisconnect() { + console.info('ServiceAbility onDisconnect'); + }, + onCommand(want, restart, startId) { + console.info('ServiceAbility onCommand'); + } + }; + ``` ### Development in the Stage Model For details about the stage model, see [Stage Model Development Overview](../application-models/stage-model-development-overview.md). -1. Create an API version 9 project. Then right-click the project directory and choose **New > Ability** to create an ability. Configure the continuous task permission (ohos.permission.KEEP_BACKGROUND_RUNNING) and background mode type in the **module.json5** file. - -``` -"module": { - "abilities": [ - { - "backgroundModes": [ - "dataTransfer", - "location" - ], // Background mode - } - ], - "requestPermissions": [ - { - "name": "ohos.permission.KEEP_BACKGROUND_RUNNING" // Continuous task permission - } - ] -} -``` +1. Configure the continuous task permission **ohos.permission.KEEP_BACKGROUND_RUNNING** in the **module.json5** file, and declare the corresponding background mode type for the ability that needs to use the task. + + ``` + "module": { + "abilities": [ + { + "backgroundModes": [ + "dataTransfer", + "location" + ], // Background mode + } + ], + "requestPermissions": [ + { + "name": "ohos.permission.KEEP_BACKGROUND_RUNNING" // Continuous task permission + } + ] + } + ``` 2. If an application needs to execute a continuous task for its own, include the execution logic in the Page ability. This is because an application cannot use **startAbilityByCall** to create and run its own ability in the background due to the restriction of ability startup controls. For details, see [UIAbility Component Overview](../application-models/uiability-overview.md). -```ts -import wantAgent from '@ohos.wantAgent'; -import backgroundTaskManager from '@ohos.resourceschedule.backgroundTaskManager'; - -@Entry -@Component -struct Index { - @State message: string = 'test' - // Use getContext to obtain the context of the Page ability. - private context: any = getContext(this) - - startContinuousTask() { - let wantAgentInfo = { - // List of operations to be executed after the notification is clicked. - wants: [ - { - bundleName: "com.example.myapplication", - abilityName: "com.example.myapplication.MainAbility", - } - ], - // Type of the operation to perform after the notification is clicked. - operationType: wantAgent.OperationType.START_ABILITY, - // Custom request code. - requestCode: 0, - // Execution attribute of the operation to perform after the notification is clicked. - wantAgentFlags: [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] - }; - - // Obtain the WantAgent object by using the getWantAgent API of the wantAgent module. - wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj) => { - try { - backgroundTaskManager.startBackgroundRunning(this.context, - backgroundTaskManager.BackgroundMode.DATA_TRANSFER, wantAgentObj).then(() => { - console.info("Operation startBackgroundRunning succeeded"); - }).catch((err) => { - console.error("Operation startBackgroundRunning failed Cause: " + err); - }); - } catch (error) { - console.error(`Operation startBackgroundRunning failed. code is ${error.code} message is ${error.message}`); - } - }); - } - - stopContinuousTask() { - try { - backgroundTaskManager.stopBackgroundRunning(this.context).then(() => { - console.info("Operation stopBackgroundRunning succeeded"); - }).catch((err) => { - console.error("Operation stopBackgroundRunning failed Cause: " + err); - }); - } catch (error) { - console.error(`Operation stopBackgroundRunning failed. code is ${error.code} message is ${error.message}`); - } - } - - build() { - Row() { - Column() { - Text("Index") - .fontSize(50) - .fontWeight(FontWeight.Bold) - - Button() { Text('Request continuous task').fontSize(25).fontWeight(FontWeight.Bold) }.type(ButtonType.Capsule) - .margin({ top: 10 }).backgroundColor('#0D9FFB').width(250).height(40) - .onClick(() => { - // Request a continuous task by clicking a button. - this.startContinuousTask(); - - // Execute the continuous task logic, for example, music playback. - }) - - Button() {Text('Cancel continuous task') .fontSize(25).fontWeight(FontWeight.Bold) }.type(ButtonType.Capsule) - .margin({ top: 10 }).backgroundColor('#0D9FFB').width(250).height(40) - .onClick(() => { - // Stop the continuous task. - - // Cancel the continuous task by clicking a button. - this.stopContinuousTask(); - }) - } - .width('100%') - } - .height('100%') - } -} -``` + ```ts + import wantAgent from '@ohos.wantAgent'; + import backgroundTaskManager from '@ohos.resourceschedule.backgroundTaskManager'; + + @Entry + @Component + struct Index { + @State message: string = 'test' + // Use getContext to obtain the context of the Page ability. + private context: any = getContext(this) + + startContinuousTask() { + let wantAgentInfo = { + // List of operations to be executed after the notification is clicked. + wants: [ + { + bundleName: "com.example.myapplication", + abilityName: "com.example.myapplication.MainAbility", + } + ], + // Type of the operation to perform after the notification is clicked. + operationType: wantAgent.OperationType.START_ABILITY, + // Custom request code. + requestCode: 0, + // Execution attribute of the operation to perform after the notification is clicked. + wantAgentFlags: [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] + }; + + // Obtain the WantAgent object by using the getWantAgent API of the wantAgent module. + wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj) => { + try { + backgroundTaskManager.startBackgroundRunning(this.context, + backgroundTaskManager.BackgroundMode.DATA_TRANSFER, wantAgentObj).then(() => { + console.info("Operation startBackgroundRunning succeeded"); + }).catch((err) => { + console.error("Operation startBackgroundRunning failed Cause: " + err); + }); + } catch (error) { + console.error(`Operation startBackgroundRunning failed. code is ${error.code} message is ${error.message}`); + } + }); + } + + stopContinuousTask() { + try { + backgroundTaskManager.stopBackgroundRunning(this.context).then(() => { + console.info("Operation stopBackgroundRunning succeeded"); + }).catch((err) => { + console.error("Operation stopBackgroundRunning failed Cause: " + err); + }); + } catch (error) { + console.error(`Operation stopBackgroundRunning failed. code is ${error.code} message is ${error.message}`); + } + } + + build() { + Row() { + Column() { + Text("Index") + .fontSize(50) + .fontWeight(FontWeight.Bold) + + Button() { Text('Request continuous task').fontSize(25).fontWeight(FontWeight.Bold) }.type(ButtonType.Capsule) + .margin({ top: 10 }).backgroundColor('#0D9FFB').width(250).height(40) + .onClick(() => { + // Request a continuous task by clicking a button. + this.startContinuousTask(); + + // Execute the continuous task logic, for example, music playback. + }) + + Button() {Text('Cancel continuous task') .fontSize(25).fontWeight(FontWeight.Bold) }.type(ButtonType.Capsule) + .margin({ top: 10 }).backgroundColor('#0D9FFB').width(250).height(40) + .onClick(() => { + // Stop the continuous task. + + // Cancel the continuous task by clicking a button. + this.stopContinuousTask(); + }) + } + .width('100%') + } + .height('100%') + } + } + ``` 3. If a continuous task needs to be executed in the background for another application or on another device, you can create and run an ability in the background in Call mode. For details, see [Using Ability Call (Intra-Device)](../application-models/uiability-intra-device-interaction.md#using-ability-call-to-implement-uiability-interaction) and [Using Ability Call (Inter-Device)](../application-models/hop-multi-device-collaboration.md#using-cross-device-ability-call). -```ts -import Ability from '@ohos.application.Ability' -import backgroundTaskManager from '@ohos.resourceschedule.backgroundTaskManager'; -import wantAgent from '@ohos.wantAgent'; - -const MSG_SEND_METHOD: string = 'CallSendMsg' - -let mContext = null; - -function startContinuousTask() { - let wantAgentInfo = { - // List of operations to be executed after the notification is clicked. - wants: [ - { - bundleName: "com.example.myapplication", - abilityName: "com.example.myapplication.MainAbility", - } - ], - // Type of the operation to perform after the notification is clicked. - operationType: wantAgent.OperationType.START_ABILITY, - // Custom request code. - requestCode: 0, - // Execution attribute of the operation to perform after the notification is clicked. - wantAgentFlags: [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] - }; - - // Obtain the WantAgent object by using the getWantAgent API of the wantAgent module. - wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj) => { - try { - backgroundTaskManager.startBackgroundRunning(featureAbility.getContext(), - backgroundTaskManager.BackgroundMode.DATA_TRANSFER, wantAgentObj).then(() => { - console.info("Operation startBackgroundRunning succeeded"); - }).catch((error) => { - console.error(`Operation startBackgroundRunning failed. code is ${error.code} message is ${error.message}`); - }); - } catch (error) { - console.error(`Operation startBackgroundRunning failed. code is ${error.code} message is ${error.message}`); - } - }); -} - -function stopContinuousTask() { - try { - backgroundTaskManager.stopBackgroundRunning(featureAbility.getContext()).then(() => { - console.info("Operation stopBackgroundRunning succeeded"); - }).catch((err) => { - console.error(`Operation stopBackgroundRunning failed. code is ${error.code} message is ${error.message}`); - }); - } catch (error) { - console.error(`Operation stopBackgroundRunning failed. code is ${error.code} message is ${error.message}`); - } -} - -class MySequenceable { - num: number = 0; - str: String = ""; - - constructor(num, string) { - this.num = num; - this.str = string; - } - - marshalling(messageParcel) { - messageParcel.writeInt(this.num); - messageParcel.writeString(this.str); - return true; - } - - unmarshalling(messageParcel) { - this.num = messageParcel.readInt(); - this.str = messageParcel.readString(); - return true; - } -} - -function sendMsgCallback(data) { - console.info('BgTaskAbility funcCallBack is called ' + data) - let receivedData = new MySequenceable(0, "") - data.readSequenceable(receivedData) - console.info(`receiveData[${receivedData.num}, ${receivedData.str}]`) - // You can execute different methods based on the str value in the sequenceable data sent by the caller. - if (receivedData.str === 'start_bgtask') { - startContinuousTask() - } else if (receivedData.str === 'stop_bgtask') { - stopContinuousTask(); - } - return new MySequenceable(10, "Callee test"); -} - -export default class BgTaskAbility extends Ability { - onCreate(want, launchParam) { - console.info("[Demo] BgTaskAbility onCreate") - this.callee.on("test", sendMsgCallback); - - try { - this.callee.on(MSG_SEND_METHOD, sendMsgCallback) - } catch (error) { - console.error(`${MSG_SEND_METHOD} register failed with error ${JSON.stringify(error)}`) - } - mContext = this.context; - } - - onDestroy() { - console.info("[Demo] BgTaskAbility onDestroy") - } - - onWindowStageCreate(windowStage) { - console.info("[Demo] BgTaskAbility onWindowStageCreate") - - windowStage.loadContent("pages/index").then((data)=> { - console.info(`load content succeed with data ${JSON.stringify(data)}`) - }).catch((error)=>{ - console.error(`load content failed with error ${JSON.stringify(error)}`) - }) - } - - onWindowStageDestroy() { - console.info("[Demo] BgTaskAbility onWindowStageDestroy") - } - - onForeground() { - console.info("[Demo] BgTaskAbility onForeground") - } + ```ts + import Ability from '@ohos.application.Ability' + import backgroundTaskManager from '@ohos.resourceschedule.backgroundTaskManager'; + import wantAgent from '@ohos.wantAgent'; + + const MSG_SEND_METHOD: string = 'CallSendMsg' + + let mContext = null; + + function startContinuousTask() { + let wantAgentInfo = { + // List of operations to be executed after the notification is clicked. + wants: [ + { + bundleName: "com.example.myapplication", + abilityName: "com.example.myapplication.MainAbility", + } + ], + // Type of the operation to perform after the notification is clicked. + operationType: wantAgent.OperationType.START_ABILITY, + // Custom request code. + requestCode: 0, + // Execution attribute of the operation to perform after the notification is clicked. + wantAgentFlags: [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] + }; + + // Obtain the WantAgent object by using the getWantAgent API of the wantAgent module. + wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj) => { + try { + backgroundTaskManager.startBackgroundRunning(mContext, + backgroundTaskManager.BackgroundMode.DATA_TRANSFER, wantAgentObj).then(() => { + console.info("Operation startBackgroundRunning succeeded"); + }).catch((error) => { + console.error(`Operation startBackgroundRunning failed. code is ${error.code} message is ${error.message}`); + }); + } catch (error) { + console.error(`Operation startBackgroundRunning failed. code is ${error.code} message is ${error.message}`); + } + }); + } + + function stopContinuousTask() { + try { + backgroundTaskManager.stopBackgroundRunning(mContext).then(() => { + console.info("Operation stopBackgroundRunning succeeded"); + }).catch((error) => { + console.error(`Operation stopBackgroundRunning failed. code is ${error.code} message is ${error.message}`); + }); + } catch (error) { + console.error(`Operation stopBackgroundRunning failed. code is ${error.code} message is ${error.message}`); + } + } + + class MySequenceable { + num: number = 0; + str: String = ""; + + constructor(num, string) { + this.num = num; + this.str = string; + } + + marshalling(messageParcel) { + messageParcel.writeInt(this.num); + messageParcel.writeString(this.str); + return true; + } + + unmarshalling(messageParcel) { + this.num = messageParcel.readInt(); + this.str = messageParcel.readString(); + return true; + } + } + + function sendMsgCallback(data) { + console.info('BgTaskAbility funcCallBack is called ' + data) + let receivedData = new MySequenceable(0, "") + data.readSequenceable(receivedData) + console.info(`receiveData[${receivedData.num}, ${receivedData.str}]`) + // You can execute different methods based on the str value in the sequenceable data sent by the caller. + if (receivedData.str === 'start_bgtask') { + startContinuousTask() + } else if (receivedData.str === 'stop_bgtask') { + stopContinuousTask(); + } + return new MySequenceable(10, "Callee test"); + } + + export default class BgTaskAbility extends Ability { + onCreate(want, launchParam) { + console.info("[Demo] BgTaskAbility onCreate") + this.callee.on("test", sendMsgCallback); + + try { + this.callee.on(MSG_SEND_METHOD, sendMsgCallback) + } catch (error) { + console.error(`${MSG_SEND_METHOD} register failed with error ${JSON.stringify(error)}`) + } + mContext = this.context; + } + + onDestroy() { + console.info("[Demo] BgTaskAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + console.info("[Demo] BgTaskAbility onWindowStageCreate") + + windowStage.loadContent("pages/index").then((data)=> { + console.info(`load content succeed with data ${JSON.stringify(data)}`) + }).catch((error)=>{ + console.error(`load content failed with error ${JSON.stringify(error)}`) + }) + } + + onWindowStageDestroy() { + console.info("[Demo] BgTaskAbility onWindowStageDestroy") + } + + onForeground() { + console.info("[Demo] BgTaskAbility onForeground") + } + + onBackground() { + console.info("[Demo] BgTaskAbility onBackground") + } + }; + ``` - onBackground() { - console.info("[Demo] BgTaskAbility onBackground") - } -}; -``` \ No newline at end of file diff --git a/en/application-dev/task-management/efficiency-resources-apply-dev-guide.md b/en/application-dev/task-management/efficiency-resources-apply-dev-guide.md index 61f1431ea4d26eb8579246b8ecec1f58fab56327..a9fbeb5e3f43dca12c51b7cdbf7f3e7558fd1c19 100644 --- a/en/application-dev/task-management/efficiency-resources-apply-dev-guide.md +++ b/en/application-dev/task-management/efficiency-resources-apply-dev-guide.md @@ -6,6 +6,9 @@ To further balance power consumption overhead of the system, privileged system a To upgrade your application as a privileged application, you must evaluate your service requirements and submit a request to the application center. The application center will determine whether to accept the request based on the conditions. +## Constraints +Only system applications can request efficiency resources. + ## Available APIs **Table 1** Main APIs for efficiency resources @@ -22,32 +25,32 @@ To upgrade your application as a privileged application, you must evaluate your 2. When the task is complete, release the resources in time. You can choose whether to release some or all resources. -```js -import backgroundTaskManager from '@ohos.backgroundTaskManager'; - -// Request efficiency resources. -let request = { - resourceTypes: backgroundTaskManager.ResourceType.COMMON_EVENT | - backgroundTaskManager.ResourceType.TIMER, - isApply: true, - timeOut: 0, - reason: "apply", - isPersist: true, - isProcess: true, -}; -let res = backgroundTaskManager.applyEfficiencyResources(request); -console.info("the result of request is: " + res); - -// Release some efficiency resources. -request = { - resourceTypes: backgroundTaskManager.ResourceType.COMMON_EVENT, - isApply: false, - timeOut: 0, - reason: "reset", -}; -res = backgroundTaskManager.applyEfficiencyResources(request); -console.info("the result of request is: " + res); - -// Release all efficiency resources. -backgroundTaskManager.resetAllEfficiencyResources(); -``` + ```js + import backgroundTaskManager from '@ohos.backgroundTaskManager'; + + // Request efficiency resources. + let request = { + resourceTypes: backgroundTaskManager.ResourceType.COMMON_EVENT | + backgroundTaskManager.ResourceType.TIMER, + isApply: true, + timeOut: 0, + reason: "apply", + isPersist: true, + isProcess: true, + }; + let res = backgroundTaskManager.applyEfficiencyResources(request); + console.info("the result of request is: " + res); + + // Release some efficiency resources. + request = { + resourceTypes: backgroundTaskManager.ResourceType.COMMON_EVENT, + isApply: false, + timeOut: 0, + reason: "reset", + }; + res = backgroundTaskManager.applyEfficiencyResources(request); + console.info("the result of request is: " + res); + + // Release all efficiency resources. + backgroundTaskManager.resetAllEfficiencyResources(); + ``` \ No newline at end of file diff --git a/en/application-dev/task-management/work-scheduler-dev-guide.md b/en/application-dev/task-management/work-scheduler-dev-guide.md index 845423ee6fa93a39d5ac93cbd8856f0ec0e49c23..3e5bed0e6bb48c54eecef75694f2419b31600116 100644 --- a/en/application-dev/task-management/work-scheduler-dev-guide.md +++ b/en/application-dev/task-management/work-scheduler-dev-guide.md @@ -2,7 +2,8 @@ ## When to Use -If your application needs to execute a non-real-time task or a persistent task, for example, data learning, you can harness the Work Scheduler mechanism, which will schedule the task based on the storage space, power consumption, temperature, and more when the preset conditions are met. Your application must implement the callbacks provided by [WorkSchedulerExtensionAbility](./workscheduler-extensionability.md) for Work Scheduler tasks. For details about the restrictions, see [Restrictions on Using Work Scheduler](./background-task-overview.md#restrictions-on-using-work-scheduler). +If your application needs to execute a non-real-time task or a persistent task, for example, data learning, you can harness the Work Scheduler mechanism, which will schedule the task based on the storage space, power consumption, temperature, and more when the preset conditions are met. Your application must implement the callbacks provided by [WorkSchedulerExtensionAbility](./workscheduler-extensionability.md) for Work Scheduler tasks. +For details about the restrictions, see [Restrictions on Using Work Scheduler](./background-task-overview.md#restrictions-on-using-work-scheduler). ## Available APIs @@ -38,7 +39,7 @@ storageRequest| [StorageRequest](../reference/apis/js-apis-resourceschedule-work isRepeat| boolean |Whether the task is repeated. repeatCycleTime| number |Repeat interval. repeatCount | number|Number of repeat times. -parameters | {[key: string]: any} |Carried parameters. +parameters | {[key: string]: number | string | boolean} |Carried parameters. **Table 3** Work Scheduler callbacks @@ -64,135 +65,134 @@ onWorkStop(work: WorkInfo): void | Called when the Work Scheduler task stops. 2. Develop an ExtensionAbility to execute a Work Scheduler task. For details about the ExtensionAbility, see [ExtensionAbility Component Overview](../application-models/extensionability-overview.md) and [WorkSchedulerExtensionAbility Development](./workscheduler-extensionability.md). -```ts -import WorkSchedulerExtensionAbility from '@ohos.WorkSchedulerExtensionAbility'; - -export default class MyExtension extends WorkSchedulerExtensionAbility { - onWorkStart(workInfo) { - console.log('MyWorkSchedulerExtensionAbility onWorkStart' + JSON.stringify(workInfo)); - } - onWorkStop(workInfo) { - console.log('MyWorkSchedulerExtensionAbility onWorkStop' + JSON.stringify(workInfo)); - } -} -``` + ```ts + import WorkSchedulerExtensionAbility from '@ohos.WorkSchedulerExtensionAbility'; + + export default class MyExtension extends WorkSchedulerExtensionAbility { + onWorkStart(workInfo) { + console.log('MyWorkSchedulerExtensionAbility onWorkStart' + JSON.stringify(workInfo)); + } + onWorkStop(workInfo) { + console.log('MyWorkSchedulerExtensionAbility onWorkStop' + JSON.stringify(workInfo)); + } + } + ``` 3. Start a Work Scheduler task. -```ts -import workScheduler from '@ohos.resourceschedule.workScheduler'; + ```ts + import workScheduler from '@ohos.resourceschedule.workScheduler'; -let workInfo = { - workId: 1, - batteryStatus:workScheduler.BatteryStatus.BATTERY_STATUS_LOW, - isRepeat: false, - isPersisted: true, - bundleName: "com.example.myapplication", - abilityName: "MyExtension", - parameters: { - mykey0: 1, - mykey1: "string value", - mykey2: true, - mykey3: 1.5 - } -} -try{ - workScheduler.startWork(workInfo); - console.info('workschedulerLog startWork success'); -} catch (error) { - console.error(`workschedulerLog startwork failed. code is ${error.code} message is ${error.message}`); -} -``` + let workInfo = { + workId: 1, + batteryStatus:workScheduler.BatteryStatus.BATTERY_STATUS_LOW, + isRepeat: false, + isPersisted: true, + bundleName: "com.example.myapplication", + abilityName: "MyExtension", + parameters: { + mykey0: 1, + mykey1: "string value", + mykey2: true, + mykey3: 1.5 + } + } + try{ + workScheduler.startWork(workInfo); + console.info('workschedulerLog startWork success'); + } catch (error) { + console.error(`workschedulerLog startwork failed. code is ${error.code} message is ${error.message}`); + } + ``` 4. Stop the Work Scheduler task. -```ts -import workScheduler from '@ohos.resourceschedule.workScheduler'; - -let workInfo = { - workId: 1, - batteryStatus:workScheduler.BatteryStatus.BATTERY_STATUS_LOW, - isRepeat: false, - isPersisted: true, - bundleName: "com.example.myapplication", - abilityName: "MyExtension", - parameters: { - mykey0: 1, - mykey1: "string value", - mykey2: true, - mykey3: 1.5 - } -} -try{ - workScheduler.stopWork(workInfo, false); - console.info('workschedulerLog stopWork success'); -} catch (error) { - console.error(`workschedulerLog stopWork failed. code is ${error.code} message is ${error.message}`); -} -``` + ```ts + import workScheduler from '@ohos.resourceschedule.workScheduler'; + + let workInfo = { + workId: 1, + batteryStatus:workScheduler.BatteryStatus.BATTERY_STATUS_LOW, + isRepeat: false, + isPersisted: true, + bundleName: "com.example.myapplication", + abilityName: "MyExtension", + parameters: { + mykey0: 1, + mykey1: "string value", + mykey2: true, + mykey3: 1.5 + } + } + try{ + workScheduler.stopWork(workInfo, false); + console.info('workschedulerLog stopWork success'); + } catch (error) { + console.error(`workschedulerLog stopWork failed. code is ${error.code} message is ${error.message}`); + } + + ``` 5. Obtain a specified Work Scheduler task. -```ts -try{ - workScheduler.getWorkStatus(50, (error, res) => { - if (error) { - console.error(`workschedulerLog getWorkStatus failed. code is ${error.code} message is ${error.message}`); - } else { - for (let item in res) { - console.info(`workschedulerLog getWorkStatus success, ${item} is: ${res[item]}`); - } - } - }); -} catch (error) { - console.error(`workschedulerLog getWorkStatus failed. code is ${error.code} message is ${error.message}`); -} -``` - + ```ts + try{ + workScheduler.getWorkStatus(50, (error, res) => { + if (error) { + console.error(`workschedulerLog getWorkStatus failed. code is ${error.code} message is ${error.message}`); + } else { + for (let item in res) { + console.info(`workschedulerLog getWorkStatus success, ${item} is: ${res[item]}`); + } + } + }); + } catch (error) { + console.error(`workschedulerLog getWorkStatus failed. code is ${error.code} message is ${error.message}`); + } + ``` 6. Obtain all the Work Scheduler tasks. -```ts -try{ - workScheduler.obtainAllWorks((error, res) =>{ - if (error) { - console.error(`workschedulerLog obtainAllWorks failed. code is ${error.code} message is ${error.message}`); - } else { - console.info(`workschedulerLog obtainAllWorks success, data is: ${JSON.stringify(res)}`); - } - }); -} catch (error) { - console.error(`workschedulerLog obtainAllWorks failed. code is ${error.code} message is ${error.message}`); -} -``` + ```ts + try{ + workScheduler.obtainAllWorks((error, res) =>{ + if (error) { + console.error(`workschedulerLog obtainAllWorks failed. code is ${error.code} message is ${error.message}`); + } else { + console.info(`workschedulerLog obtainAllWorks success, data is: ${JSON.stringify(res)}`); + } + }); + } catch (error) { + console.error(`workschedulerLog obtainAllWorks failed. code is ${error.code} message is ${error.message}`); + } + ``` 7. Stop and clear all the Work Scheduler tasks. -```ts -try{ - workScheduler.stopAndClearWorks(); - console.info(`workschedulerLog stopAndClearWorks success`); -} catch (error) { - console.error(`workschedulerLog stopAndClearWorks failed. code is ${error.code} message is ${error.message}`); -} -``` + ```ts + try{ + workScheduler.stopAndClearWorks(); + console.info(`workschedulerLog stopAndClearWorks success`); + } catch (error) { + console.error(`workschedulerLog stopAndClearWorks failed. code is ${error.code} message is ${error.message}`); + } + ``` 8. Check whether the last execution of a specified Work Scheduler task has timed out. -```ts -try{ - workScheduler.isLastWorkTimeOut(500, (error, res) =>{ - if (error) { - onsole.error(`workschedulerLog isLastWorkTimeOut failed. code is ${error.code} message is ${error.message}`); - } else { - console.info(`workschedulerLog isLastWorkTimeOut success, data is: ${res}`); - } - }); -} catch (error) { - console.error(`workschedulerLog isLastWorkTimeOut failed. code is ${error.code} message is ${error.message}`); -} -``` - + ```ts + try{ + workScheduler.isLastWorkTimeOut(500, (error, res) =>{ + if (error) { + onsole.error(`workschedulerLog isLastWorkTimeOut failed. code is ${error.code} message is ${error.message}`); + } else { + console.info(`workschedulerLog isLastWorkTimeOut success, data is: ${res}`); + } + }); + } catch (error) { + console.error(`workschedulerLog isLastWorkTimeOut failed. code is ${error.code} message is ${error.message}`); + } + ``` diff --git a/en/application-dev/tools/aa-tool.md b/en/application-dev/tools/aa-tool.md index e03cdd52c6df142c13a06c918ae242c4115b323c..1f09a918a55dc37f554438eeb4ca4a74e236e9b5 100644 --- a/en/application-dev/tools/aa-tool.md +++ b/en/application-dev/tools/aa-tool.md @@ -1,119 +1,118 @@ # Ability Assistant -The Ability Assistant provides the application debugging and testing capabilities that enable you to start applications and test cases. With this tool, you can send commands (started with **aa**) in the hdc shell to perform various system operations, such as starting application components, forcibly stopping processes, and printing application component information. +The ability assistant enables you to start applications and test cases. It provides basic application debugging and testing capabilities, for example, starting application components, forcibly stopping processes, and printing application component information. + +> **NOTE** +> +> Before using this tool, you must obtain the [hdc tool](../../device-dev/subsystems/subsys-toolchain-hdc-guide.md) and run the hdc shell command. - help - -Displays help information for the Ability Assistant. - -**Return value** - -Returns the help information. - -**Method** - - - ```bash - aa help - ``` + + Displays help information for the Ability Assistant. + + **Return value** + + Returns the help information. + + **Method** + + ```bash + aa help + ``` - start - -Starts an application component. The target component can be the PageAbility and ServiceAbility components of the FA model or the UIAbility and ServiceExtensionAbility components of the Stage model. The **visible** tag in the configuration file of the target component cannot be set to **false**. - + + Starts an application component. The target component can be the PageAbility and ServiceAbility components of the FA model or the UIAbility and ServiceExtensionAbility components of the Stage model. The **visible** tag in the configuration file of the target component cannot be set to **false**. + | Name| Description| | -------- | -------- | | -h/--help | Help information.| | -d | Device ID. Optional.| | -a | Ability name. Mandatory.| | -b | Bundle name. Mandatory.| -| -D | Debugging mode. Optional.| - -**Return value** - -Returns "start ability successfully." if the ability is started; returns "error: failed to start ability." and the corresponding error information otherwise. - -**Method** - - - ```bash - aa start [-d ] -a -b [-D] -``` - + | -D | Debugging mode. Optional.| + + **Return value** + + Returns "start ability successfully." if the ability is started; returns "error: failed to start ability." and the corresponding error information otherwise. + + **Method** + + ```bash + aa start [-d ] -a -b [-D] + ``` + - stop-service - -Stops a ServiceAbility. - + + Stops a ServiceAbility. + | Name| Description| | -------- | -------- | | -h/--help | Help information.| | -d | Device ID. Optional.| | -a | Ability name. Mandatory.| -| -b | Bundle name. Mandatory.| - -**Return value** - -Returns "stop service ability successfully." if the ServiceAbility is stopped; returns "error: failed to stop service ability." otherwise. - -**Method** - - - ```bash - aa stop-service [-d ] -a -b -``` - + | -b | Bundle name. Mandatory.| + + **Return value** + + Returns "stop service ability successfully." if the ServiceAbility is stopped; returns "error: failed to stop service ability." otherwise. + + **Method** + + ```bash + aa stop-service [-d ] -a -b + ``` + - dump - - Prints information about an application component. + + Prints information about an application component. | Name| Level-2 Parameter| Description| | -------- | -------- | -------- | | -h/--help | - | Help information.| | -a/--all | - | Application component information in all missions.| - | -l/--mission-list | type (All logs are printed if this parameter is left unspecified.)| Mission stack information.
The following values are available for **type**:
- NORMAL
- DEFAULT_STANDARD
- DEFAULT_SINGLE
- LAUNCHER | + | -l/--mission-list | type (All logs are printed if this parameter is left unspecified.)| For better management, the service side maintains four types of MissionLists, as described below:
- **NORMAL**: MissionList that is started normally. For example, if A starts B and C, the corresponding MissionList is A->B->C.
- **DEFAULT_STANDARD**: If a MissionList is damaged, missions with the launch type set to **standard** are removed to this MissionList. The Missions in it are not associated with each other.
- **DEFAULT_SINGLE**: If a MissionList is damaged, missions with the launch type set to **singleton** are removed to this MissionList. The Missions in it are not associated with each other.
- **LAUNCHER**: MissionList for launcher abilities. | | -e/--extension | elementName | Extended component information.| | -u/--userId | UserId | Mission stack information of a specified user ID. This parameter must be used together with other parameters. Example commands: **aa dump -a -u 100** and **aa dump -d -u 100**.| | -d/--data | - | DataAbility information.| -| -i/--ability | AbilityRecord ID | Detailed information about an application component.| + | -i/--ability | AbilityRecord ID | Detailed information about an application component.| | -c/--client | - | Detailed information about an application component. This parameter must be used together with other parameters. Example commands: **aa dump -a -c** and **aa dump -i 21 -c**.| **Method** - - - ```bash -aa dump -a - ``` - ![aa-dump-a](figures/aa-dump-a.png) - - - ```bash -aa dump -l - ``` + ```bash + aa dump -a + ``` - ![aa-dump-l](figures/aa-dump-l.png) + ![aa-dump-a](figures/aa-dump-a.png) - ```bash -aa dump -i 12 - ``` + ```bash + aa dump -l + ``` - ![aa-dump-i](figures/aa-dump-i.png) - -- force-stop + ![aa-dump-l](figures/aa-dump-l.png) -Forcibly stops a process based on the bundle name. - -**Return value** - -Returns "force stop process successfully." if the process is forcibly stopped; returns "error: failed to force stop process." otherwise. - -**Method** + ```bash + aa dump -i 12 + ``` + + ![aa-dump-i](figures/aa-dump-i.png) - ```bash - aa force-stop - ``` +- force-stop + + Forcibly stops a process based on the bundle name. + + **Return value** + + Returns "force stop process successfully." if the process is forcibly stopped; returns "error: failed to force stop process." otherwise. + + **Method** + + ```bash + aa force-stop + ``` diff --git a/en/application-dev/tools/anm-tool.md b/en/application-dev/tools/anm-tool.md index 5a738bc22ff538676158bb3da32aacf9b507097c..5f77e876ca2e0da4be95e0749fea79844066e854 100644 --- a/en/application-dev/tools/anm-tool.md +++ b/en/application-dev/tools/anm-tool.md @@ -1,6 +1,10 @@ # Advanced Notification Manager -The Advanced Notification Manager provides the notification debugging and testing capabilities that enable you to print notifications and set notification parameters. With this tool, you can send commands (started with **anm**) in the hdc shell to perform various system operations, such as printing notification details, setting the number of cached notifications, and enabling the notification capability. +The Advanced Notification Manager enables you to print notifications and set notification parameters. It provides the notification debugging and testing capabilities, for example, printing published notification details, setting the number of notification caches, and enabling the notification functionality. + +> **NOTE** +> +> Before using this tool, you must obtain the [hdc tool](../../device-dev/subsystems/subsys-toolchain-hdc-guide.md) and run the hdc shell command. ### help diff --git a/en/application-dev/tools/bm-tool.md b/en/application-dev/tools/bm-tool.md index 879a2f123b2e2ea9a1dc8ce30c38da81458dc2e3..96ebcca84f181209ee241cff84ae0c6303b67903 100644 --- a/en/application-dev/tools/bm-tool.md +++ b/en/application-dev/tools/bm-tool.md @@ -1,7 +1,12 @@ # Bundle Manager -The Bundle Manager provides the bundle debugging and testing capabilities that enable you to install, uninstall, update, and query a bundle (application). With this tool, you can send commands (started with **bm**) in the hdc shell to perform various system operations, such as installing and uninstalling a bundle and querying bundle information. +The Bundle Manager enables you to install, uninstall, update, and query a bundle (application). It provides the bundle debugging capabilities, for example, installing and uninstalling a bundle and querying bundle information. + +> **NOTE** +> +> Before using this tool, you must obtain the [hdc tool](../../device-dev/subsystems/subsys-toolchain-hdc-guide.md) and run the hdc shell command. + **Table 1** bm commands @@ -41,6 +46,7 @@ bm help bm install [-h] [-p path] [-u userId] [-r] [-w waitting-time] ``` + **Table 3** Installation command parameters | Name| Mandatory| Description| @@ -67,6 +73,7 @@ install bundle successfully. bm uninstall [-h help] [-n bundleName] [-m moduleName] [-u userId] [-k] ``` + **Table 4** Uninstall command parameters | Name| Mandatory| Description| @@ -81,7 +88,7 @@ bm uninstall [-h help] [-n bundleName] [-m moduleName] [-u userId] [-k] Example ```bash -bm uninstall -n com.ohos.app -m com.ohos.app.EntryAbility -u 100 -k +bm uninstall -n com.ohos.app -m com.ohos.app.MainAbility -u 100 -k // The execution result is as follows: uninstall bundle successfully. ``` @@ -96,6 +103,7 @@ bm dump [-h help] [-a] [-n bundleName] [-s shortcutInfo] [-u userId] [-d deviceI If **-u** is not specified, the command applies to all users. + **Table 5** Dump command parameters | Name| Mandatory| Description| @@ -131,6 +139,7 @@ bm clean [-h] [-c] [-n bundleName] [-d] [-u userId] If **-u** is not specified, the command applies to all active users. + **Table 6** Clean command parameters | Name| Description| @@ -164,6 +173,7 @@ bm enable [-h] [-n bundleName] [-a abilityName] [-u userId] If **-u** is not specified, the command applies to all active users. + **Table 7** Enable command parameters | Name| Description| @@ -178,7 +188,7 @@ Example ```bash # Enable a bundle. -bm enable -n com.ohos.app -a com.ohos.app.EntryAbility -u 100 +bm enable -n com.ohos.app -a com.ohos.app.MainAbility -u 100 // The execution result is as follows: enable bundle successfully. ``` @@ -193,6 +203,7 @@ bm disable [-h] [-n bundleName] [-a abilityName] [-u userId] If **-u** is not specified, the command applies to all active users. + **Table 8** Disabled command parameters | Name| Description| @@ -206,7 +217,7 @@ Example ```bash # Disable a bundle. -bm disable -n com.ohos.app -a com.ohos.app.EntryAbility -u 100 +bm disable -n com.ohos.app -a com.ohos.app.MainAbility -u 100 // The execution result is as follows: disable bundle successfully. ``` @@ -218,6 +229,7 @@ disable bundle successfully. bm get [-h] [-u] ``` + **Table 9** Parameters used in the command for obtaining the UDID | Name| Description| @@ -243,6 +255,7 @@ udid of current device is : bm quickfix [-h] [-a -f filePath] [-q -b bundleName] ``` + **Table 10** Parameters used in the command for quick fix | Name| Description| diff --git a/en/application-dev/tools/cem-tool.md b/en/application-dev/tools/cem-tool.md index beaf1a86e38b11508d5551a48e018cf98e7e7a6e..678078e5b7f0acd2da0a02b9ab9f69d5b4824743 100644 --- a/en/application-dev/tools/cem-tool.md +++ b/en/application-dev/tools/cem-tool.md @@ -1,6 +1,10 @@ # Common Event Manager -The Common Event Manager provides the common event debugging and testing capabilities that enable you to print common event information and publish common events. With this tool, you can send commands (started with **cem**) in the hdc shell to perform various system operations, such as printing all common event subscribers, sent common events, and recipients, as well as publishing common events. +The Common Event Manager enables you to print common event information and publish common events. It provides the common event debugging and testing capabilities, for example, printing all public event subscribers, sent public events, and recipients, and simulating public event release. + +> **NOTE** +> +> Before using this tool, you must obtain the [hdc tool](../../device-dev/subsystems/subsys-toolchain-hdc-guide.md) and run the hdc shell command. ## Commands diff --git a/en/application-dev/ui/figures/en-us_image_0000001163531210.gif b/en/application-dev/ui/figures/en-us_image_0000001163531210.gif new file mode 100644 index 0000000000000000000000000000000000000000..47730f745cfd341cd6f11c9a3d4ce71d4b2795fb Binary files /dev/null and b/en/application-dev/ui/figures/en-us_image_0000001163531210.gif differ diff --git a/en/application-dev/ui/figures/en-us_image_0000001189089950.gif b/en/application-dev/ui/figures/en-us_image_0000001189089950.gif new file mode 100644 index 0000000000000000000000000000000000000000..52e27cf794d93927462587c5fe202c1afb344b96 Binary files /dev/null and b/en/application-dev/ui/figures/en-us_image_0000001189089950.gif differ diff --git a/en/application-dev/ui/figures/en-us_image_0000001267887817.gif b/en/application-dev/ui/figures/en-us_image_0000001189249862.gif similarity index 100% rename from en/application-dev/ui/figures/en-us_image_0000001267887817.gif rename to en/application-dev/ui/figures/en-us_image_0000001189249862.gif diff --git a/en/application-dev/ui/figures/en-us_image_0000001218419614.png b/en/application-dev/ui/figures/en-us_image_0000001218419614.png index 101f60e44760d98db7a904189f387e2b3557cf32..6cb1dfdc2eedeb82fb0b32df1f2de8c73df08e85 100644 Binary files a/en/application-dev/ui/figures/en-us_image_0000001218419614.png and b/en/application-dev/ui/figures/en-us_image_0000001218419614.png differ diff --git a/en/application-dev/ui/figures/en-us_image_0000001218579606.png b/en/application-dev/ui/figures/en-us_image_0000001218579606.png index c8697767f19ae5cc5f7b30c4cbc2a23ffafb0844..42537bbffe87c2972e3130bf5ccc5fc6b055757a 100644 Binary files a/en/application-dev/ui/figures/en-us_image_0000001218579606.png and b/en/application-dev/ui/figures/en-us_image_0000001218579606.png differ diff --git a/en/application-dev/ui/figures/en-us_image_0000001218739566.png b/en/application-dev/ui/figures/en-us_image_0000001218739566.png index 4384ea3a2997c4417eee0fbe0e6475c4925b5c36..c5c7e29232e4f468c34faf3f521f594f6ef322bf 100644 Binary files a/en/application-dev/ui/figures/en-us_image_0000001218739566.png and b/en/application-dev/ui/figures/en-us_image_0000001218739566.png differ diff --git a/en/application-dev/ui/figures/en-us_image_0000001223287656.gif b/en/application-dev/ui/figures/en-us_image_0000001223287656.gif deleted file mode 100644 index a6296483cbe2994e36e97d422588f3a9156b56eb..0000000000000000000000000000000000000000 Binary files a/en/application-dev/ui/figures/en-us_image_0000001223287656.gif and /dev/null differ diff --git a/en/application-dev/ui/figures/en-us_image_0000001223287668.png b/en/application-dev/ui/figures/en-us_image_0000001223287668.png deleted file mode 100644 index 21d56ef14b92d136e304c4bae6ab8b1f447557bb..0000000000000000000000000000000000000000 Binary files a/en/application-dev/ui/figures/en-us_image_0000001223287668.png and /dev/null differ diff --git a/en/application-dev/ui/figures/en-us_image_0000001234011019.gif b/en/application-dev/ui/figures/en-us_image_0000001234011019.gif new file mode 100644 index 0000000000000000000000000000000000000000..7dd539689ac7b81822c934bd3c515e1d4f002d85 Binary files /dev/null and b/en/application-dev/ui/figures/en-us_image_0000001234011019.gif differ diff --git a/en/application-dev/ui/figures/en-us_image_0000001234130975.png b/en/application-dev/ui/figures/en-us_image_0000001234130975.png new file mode 100644 index 0000000000000000000000000000000000000000..3c47ec4f057b8e4b616c43a9a74c5800ff6e1771 Binary files /dev/null and b/en/application-dev/ui/figures/en-us_image_0000001234130975.png differ diff --git a/en/application-dev/ui/figures/en-us_image_0000001234289455.gif b/en/application-dev/ui/figures/en-us_image_0000001234289455.gif new file mode 100644 index 0000000000000000000000000000000000000000..7151147186f2a4f212a9b7fec79b95025be8e615 Binary files /dev/null and b/en/application-dev/ui/figures/en-us_image_0000001234289455.gif differ diff --git a/en/application-dev/ui/figures/en-us_image_0000001263019457.png b/en/application-dev/ui/figures/en-us_image_0000001263019457.png index dea13c34b80626c7fe1a0036afbe69d5f236910c..ee5931a95991c672e1b4812d9fa62541e2f8a880 100644 Binary files a/en/application-dev/ui/figures/en-us_image_0000001263019457.png and b/en/application-dev/ui/figures/en-us_image_0000001263019457.png differ diff --git a/en/application-dev/ui/figures/en-us_image_0000001263139409.png b/en/application-dev/ui/figures/en-us_image_0000001263139409.png index 395631e2ed4572806bd93bcdb8ff86486e0b5bdf..77364d35a2c56de8616a2d7ea77c4977b4b3e2bb 100644 Binary files a/en/application-dev/ui/figures/en-us_image_0000001263139409.png and b/en/application-dev/ui/figures/en-us_image_0000001263139409.png differ diff --git a/en/application-dev/ui/figures/en-us_image_0000001263259399.png b/en/application-dev/ui/figures/en-us_image_0000001263259399.png index dc4a266c02708116362da21577d5b1e582a011fd..938ded6d0b38dc838159990880c66c4211dd5aaa 100644 Binary files a/en/application-dev/ui/figures/en-us_image_0000001263259399.png and b/en/application-dev/ui/figures/en-us_image_0000001263259399.png differ diff --git a/en/application-dev/ui/figures/en-us_image_0000001263339459.png b/en/application-dev/ui/figures/en-us_image_0000001263339459.png index 99e18123d53b88779948b34c6c566005d989358b..97bdd1f5dc3bf6100e12e5d830290cdc0ad678a1 100644 Binary files a/en/application-dev/ui/figures/en-us_image_0000001263339459.png and b/en/application-dev/ui/figures/en-us_image_0000001263339459.png differ diff --git a/en/application-dev/ui/figures/en-us_image_0000001267607869.gif b/en/application-dev/ui/figures/en-us_image_0000001267607869.gif deleted file mode 100644 index eb0c760faaf917a6935af461e0094fd8e7b8e85b..0000000000000000000000000000000000000000 Binary files a/en/application-dev/ui/figures/en-us_image_0000001267607869.gif and /dev/null differ diff --git a/en/application-dev/ui/figures/en-us_image_0000001267767837.gif b/en/application-dev/ui/figures/en-us_image_0000001267767837.gif deleted file mode 100644 index 24f00c9f1aa6ec431a355f5dd2d88b920607cd05..0000000000000000000000000000000000000000 Binary files a/en/application-dev/ui/figures/en-us_image_0000001267767837.gif and /dev/null differ diff --git a/en/application-dev/ui/figures/en-us_image_0000001267767841.gif b/en/application-dev/ui/figures/en-us_image_0000001267767841.gif deleted file mode 100644 index 8d5a07d1ff67011de5d0ec6bc0c2e552db9e5cd0..0000000000000000000000000000000000000000 Binary files a/en/application-dev/ui/figures/en-us_image_0000001267767841.gif and /dev/null differ diff --git a/en/application-dev/ui/ui-js-animate-background-position-style.md b/en/application-dev/ui/ui-js-animate-background-position-style.md index 26b8fe2b594e5c31efbf9fc2c0e9268695e319ba..c12792b4095319a7f01740b844729e5af2c6f57e 100644 --- a/en/application-dev/ui/ui-js-animate-background-position-style.md +++ b/en/application-dev/ui/ui-js-animate-background-position-style.md @@ -27,6 +27,7 @@ By changing the **background-position** attribute (where the first value is the .content{ width: 400px; height: 400px; + /* The aspect ratio 1:1 is not recommended. */ background-image: url('common/images/bg-tv.jpg'); background-size: 100%; background-repeat: no-repeat; diff --git a/en/application-dev/ui/ui-js-components-canvasrenderingcontext2d.md b/en/application-dev/ui/ui-js-components-canvasrenderingcontext2d.md index 18a633ce6e129be8d2b21c8c46d293e792cd727c..95a07736c69d3d99d90074bd37da895a5860dad7 100644 --- a/en/application-dev/ui/ui-js-components-canvasrenderingcontext2d.md +++ b/en/application-dev/ui/ui-js-components-canvasrenderingcontext2d.md @@ -228,6 +228,8 @@ Globally define the canvas (**el**) and brush (**ctx**), and create a rectangle ```css /* xxx.css */ .container{ + width: 100%; + height: 100%; flex-direction: column; justify-content: center; align-items: center; @@ -251,7 +253,6 @@ select{ ```js // xxx.js -import prompt from '@system.prompt'; export default { data:{ el: null, @@ -596,7 +597,6 @@ After creating an image object, use the **drawImage** attribute to draw the imag /* xxx.css */ .container{ width: 100%; - height: 100%; flex-direction: column; background-color: #F1F3F5; align-items: center; diff --git a/en/application-dev/ui/ui-js-components-path2d.md b/en/application-dev/ui/ui-js-components-path2d.md index 1684f70db7739dbfc6cfe68344a8b3972fad2d37..b6455c4ff2905c2a93e6ba6efffd7360a3872010 100644 --- a/en/application-dev/ui/ui-js-components-path2d.md +++ b/en/application-dev/ui/ui-js-components-path2d.md @@ -36,8 +36,6 @@ canvas { ```js // xxx.js -import promptAction from '@ohos.promptAction'; - export default { onShow() { let ctx = this.$refs.canvas.getContext('2d', { @@ -60,7 +58,7 @@ export default { path.closePath(); // Door path.moveTo(250, 450); - path.rect(250, 450, 350, 600); + path.rect(250, 450, 100, 600); path.closePath(); // Chimney path.moveTo(365, 250); @@ -139,8 +137,6 @@ text { ```js // xxx.js -import promptAction from '@ohos.promptAction'; - export default { data: { ctx: null, diff --git a/en/application-dev/ui/ui-js-components-stepper.md b/en/application-dev/ui/ui-js-components-stepper.md index 2ac27eb69a7ba2cbe248994daf2e46ec06f795e4..848cc6f6a79a16b8170b7fd34739f605612c7ea1 100644 --- a/en/application-dev/ui/ui-js-components-stepper.md +++ b/en/application-dev/ui/ui-js-components-stepper.md @@ -43,7 +43,7 @@ text{ } ``` -![en-us_image_0000001223287656](figures/en-us_image_0000001223287656.gif) +![en-us_image_0000001234289455](figures/en-us_image_0000001234289455.gif) ## Setting the Index @@ -82,7 +82,7 @@ text{ } ``` -![en-us_image_0000001267767837](figures/en-us_image_0000001267767837.gif) +![en-us_image_0000001234011019](figures/en-us_image_0000001234011019.gif) Set the **label** attribute to customize the label for the **\**. @@ -143,7 +143,7 @@ export default { } ``` -![en-us_image_0000001267767841](figures/en-us_image_0000001267767841.gif) +![en-us_image_0000001163531210](figures/en-us_image_0000001163531210.gif) ## Setting Styles @@ -187,7 +187,7 @@ text{ } ``` -![en-us_image_0000001223287668](figures/en-us_image_0000001223287668.png) +![en-us_image_0000001234130975](figures/en-us_image_0000001234130975.png) ## Adding Events @@ -290,7 +290,7 @@ export default { } ``` -![en-us_image_0000001267607869](figures/en-us_image_0000001267607869.gif) +![en-us_image_0000001189089950](figures/en-us_image_0000001189089950.gif) ## Example Scenario @@ -364,8 +364,6 @@ Use a **\** component to navigate through the steps. Create a **\ { animateTo({ - duration: 2000, + duration: 1000, curve: this.curve1, delay: 100, }, () => { @@ -111,7 +111,7 @@ The splash screen animation refers to the fade-in and fade-out of the logo. Afte } ``` -5. After the splash screen animation plays for 1 second, the **FoodCategoryList** page is displayed. Set the **onFinish** callback of **animateTo**. Invoke the **setTimeout** API of the timer. After a delay of 1s, call **router.replaceUrl** to display the **FoodCategoryList** page. +5. After the splash screen animation plays for 1 second, the **FoodCategoryList** page is displayed. Set the **onFinish** callback of **animateTo**. Invoke the **setTimeout** API of the timer. After a delay of 1s, call **router.replace** to display the **FoodCategoryList** page. ```ts import router from '@ohos.router' @@ -170,9 +170,11 @@ The splash screen animation refers to the fade-in and fade-out of the logo. Afte Path() .commands('M162 128.7 a222 222 0 0 1 100.8 374.4 H198 a36 36 0 0 3 -36 -36') .fill(Color.White) + .stroke(Color.Transparent) Path() .commands(this.pathCommands1) .fill('none') + .stroke(Color.Transparent) .linearGradient( { angle: 30, @@ -183,6 +185,7 @@ The splash screen animation refers to the fade-in and fade-out of the logo. Afte Path() .commands(this.pathCommands2) .fill('none') + .stroke(Color.Transparent) .linearGradient( { angle: 50, @@ -227,10 +230,10 @@ The splash screen animation refers to the fade-in and fade-out of the logo. Afte angle: 180, colors: [['#BDE895', 0.1], ["#95DE7F", 0.6], ["#7AB967", 1]] }) - } + } } ``` - + ![animation-feature](figures/animation-feature.gif) ## Page Transition Animation diff --git a/en/application-dev/ui/ui-ts-creating-simple-page.md b/en/application-dev/ui/ui-ts-creating-simple-page.md index b33ed86346a2c88acace5e6992f75ac99afb9596..c3382498230de8e6aee8622970db3dc4375c46e5 100644 --- a/en/application-dev/ui/ui-ts-creating-simple-page.md +++ b/en/application-dev/ui/ui-ts-creating-simple-page.md @@ -2,7 +2,7 @@ In this section, we will develop an infographic food details page, by building custom components through the container components **\** and **\** as well as basic components **\** and **\**. -Before creating a page, create an ArkTS project. For details, see [Creating an ArkTS Project in FA model](../quick-start/start-with-ets-stage.md#creating-an-arkts-project) or [Creating an ArkTS Project in Stage model](../quick-start/start-with-ets-fa.md#creating-an-arkts-project). +Before creating a page, create an ArkTS project. For details, see [Creating an ArkTS Project in Stage Model](../quick-start/start-with-ets-stage.md#creating-an-arkts-project) or [Creating an ArkTS Project in FA Model](../quick-start/start-with-ets-fa.md#creating-an-arkts-project). ## Building the Stack Layout @@ -28,8 +28,9 @@ Before creating a page, create an ArkTS project. For details, see [Creating an A ![en-us_image_0000001214128687](figures/en-us_image_0000001214128687.png) 2. Display food pictures. + Create an **\** component and specify a URL for it. To display the **\** component above the **\** component, declare the **\** component first. Image resources are stored in the **rawfile** folder in **resources**. When referencing the resources in the **rawfile** folder, use the `$rawfile('filename')` format, where **filename** indicates the relative path of the file in the **rawfile** folder. `$rawfile` only allows the **\** component to reference image resources. - + ```ts @Entry @Component @@ -45,14 +46,14 @@ Before creating a page, create an ArkTS project. For details, see [Creating an A } ``` - ![en-us_image_0000001168410342](figures/en-us_image_0000001168410342.png) 3. Access images through resources. + In addition to specifying the image path, you can also use the media resource symbol **$r** to reference resources based on the resource qualifier rules in the **resources** folder. Right-click the **resources** folder, choose **New** > **Resource Directory** from the shortcut menu, and set **Resource Type** to **Media** (image resource). - + Place **Tomato.png** in the **media** folder. You can then reference the application resources in the `$r('app.type.name')` format, which is `$r('app.media.Tomato')` in this example. - + ```ts @Entry @Component @@ -69,9 +70,11 @@ Before creating a page, create an ArkTS project. For details, see [Creating an A } } ``` - + 4. Set the width and height of the image, and set the **objectFit** attribute of the image to **ImageFit.Contain**, which means to keep the aspect ratio of the image to ensure that the image is completely displayed within the boundary. + If the image fills the entire screen, the possible causes are as follows: + 1. The width and height of the image are not set. 2. The default attribute of **objectFit** of the image is **ImageFit.Cover**, that is, the image is zoomed in or zoomed out to fill the entire display boundary with the aspect ratio locked. @@ -215,12 +218,13 @@ Use the **Flex** layout to build a food composition table. In this way, cell siz ``` 2. Create a **\** component to display two food composition categories in the tomato: **Calories** and **Nutrition**. + **Calories** contains information about calories. **Nutrition** contains information about protein, fat, carbohydrates, and vitamin C. - + Create the **Calories** class. Create a **\** component and set its height to **280**, and the top, right, and left margins to **30**. The **Flex** component contains three **\** child components, which represent the category name (**Calories**), content name (**Calories**), and contain value (**17 kcal**), respectively. By default, child components in the **Flex** component are arranged horizontally. - + In the following example, code of **FoodImageDisplay** is omitted, and only code of **ContentTable** is provided. - + ```ts @Component struct ContentTable { @@ -307,12 +311,13 @@ Use the **Flex** layout to build a food composition table. In this way, cell siz } } ``` - + ![en-us_image_0000001215079443](figures/en-us_image_0000001215079443.png) - + 4. Create the **Nutrient** class in a similar process. **Nutrition** consists of four parts: **Protein**, **Fat**, **Carbohydrates**, and **VitaminC**. The names of the last three parts are omitted in the table and represented by spaces. + Set **FlexDirection.Column**, **FlexAlign.SpaceBetween**, and **ItemAlign.Start**. - + ```ts @Component struct ContentTable { @@ -406,17 +411,18 @@ Use the **Flex** layout to build a food composition table. In this way, cell siz } } ``` - + ![en-us_image_0000001215199399](figures/en-us_image_0000001215199399.png) 5. Use the custom constructor **\@Builder** to simplify the code. It can be found that the food groups in each food composition table are actually of the same UI structure. - + ![en-us_image_0000001169599582](figures/en-us_image_0000001169599582.png) - + + Currently, all food groups are declared, resulting in code duplication and redundancy. You can use **\@Builder** to build a custom method and abstract the same UI structure declaration. The **\@Builder** decorated method and the **build** method for the **@Component** decorated component are used to declare some UI rendering structures and comply with the same ArkTS syntax. You can define one or more methods decorated by **\@Builder**, but a component decorated by **@Component** can have only one **build** method. - + Declare the **IngredientItem** method decorated by **\@Builder** in **ContentTable** to declare the UI descriptions for the category name, content name, and content value. - + ```ts @Component struct ContentTable { @@ -438,9 +444,9 @@ Declare the **IngredientItem** method decorated by **\@Builder** in **ContentTab } } ``` - + When the **IngredientItem** API is called in the **build** method of **ContentTable**, **this** needs to be used to invoke the method in the scope of the component to distinguish the global method call. - + ```ts @Component struct ContentTable { @@ -458,9 +464,9 @@ When the **IngredientItem** API is called in the **build** method of **ContentTa } } ``` - + The overall code of the **ContentTable** component is as follows: - + ```ts @Component struct ContentTable { @@ -506,7 +512,7 @@ The overall code of the **ContentTable** component is as follows: } } ``` - + ![en-us_image_0000001215199399](figures/en-us_image_0000001215199399.png) You've learned how to build a simple food details page. Read on to learn how to define the page layout and connection. diff --git a/en/application-dev/ui/ui-ts-drawing-feature.md b/en/application-dev/ui/ui-ts-drawing-feature.md index 3c9085735def3ef93e814abe7c7f7508ed41d6eb..bc23bea735490686d903740612cc20ceb0140ef1 100644 --- a/en/application-dev/ui/ui-ts-drawing-feature.md +++ b/en/application-dev/ui/ui-ts-drawing-feature.md @@ -92,7 +92,7 @@ In the food component table on the **FoodDetail** page, each food group is label In addition to drawing basic geometric shapes, you can also use the **\** component to draw a custom path. The following describes how to draw an application logo. -1. Create a page **Logo.ets** in the **pages** folder. +1. Create the page **Logo.ets** in the **pages** folder. ![drawing-feature1](figures/drawing-feature1.png) @@ -217,10 +217,11 @@ In addition to drawing basic geometric shapes, you can also use the **\** ![drawing-feature4](figures/drawing-feature4.png) - In the sample code, the fill color is white. + In the sample code, the fill color is white and the stroke is transparent. ```ts .fill(Color.White) + .stroke(Color.Transparent) ``` ```ts @@ -233,6 +234,7 @@ In addition to drawing basic geometric shapes, you can also use the **\** Path() .commands('M162 128.7 a222 222 0 0 1 100.8 374.4 H198 a36 36 0 0 3 -36 -36') .fill(Color.White) + .stroke(Color.Transparent) } .height('630px') .width('630px') @@ -256,6 +258,7 @@ In addition to drawing basic geometric shapes, you can also use the **\** Path() .commands('M319.5 128.1 c103.5 0 187.5 84 187.5 187.5 v15 a172.5 172.5 0 0 3 -172.5 172.5 H198 a36 36 0 0 3 -13.8 -1 207 207 0 0 0 87 -372 h48.3 z') .fill('none') + .stroke(Corlor.Transparent) .linearGradient( { angle: 30, @@ -276,6 +279,7 @@ In addition to drawing basic geometric shapes, you can also use the **\** Path() .commands(this.pathCommands1) .fill('none') + .stroke(Color.Transparent) .linearGradient( { angle: 30, @@ -303,10 +307,12 @@ In addition to drawing basic geometric shapes, you can also use the **\** Path() .commands('M162 128.7 a222 222 0 0 1 100.8 374.4 H198 a36 36 0 0 3 -36 -36') .fill(Color.White) + .stroke(Color.Transparent) Path() .commands(this.pathCommands1) .fill('none') + .stroke(Color.Transparent) .linearGradient( { angle: 30, @@ -317,6 +323,7 @@ In addition to drawing basic geometric shapes, you can also use the **\** Path() .commands(this.pathCommands2) .fill('none') + .stroke(Color.Transparent) .linearGradient( { angle: 50, @@ -348,33 +355,37 @@ In addition to drawing basic geometric shapes, you can also use the **\** @Entry @Component struct Logo { - private pathCommands1:string = 'M319.5 128.1 c103.5 0 187.5 84 187.5 187.5 v15 a172.5 172.5 0 0 3 -172.5 172.5 H198 a36 36 0 0 3 -13.8 -1 207 207 0 0 0 87 -372 h48.3 z' - private pathCommands2:string = 'M270.6 128.1 h48.6 c51.6 0 98.4 21 132.3 54.6 a411 411 0 0 3 -45.6 123 c-25.2 45.6 -56.4 84 -87.6 110.4 a206.1 206.1 0 0 0 -47.7 -288 z' + private pathCommands1: string = 'M319.5 128.1 c103.5 0 187.5 84 187.5 187.5 v15 a172.5 172.5 0 0 3 -172.5 172.5 H198 a36 36 0 0 3 -13.8 -1 207 207 0 0 0 87 -372 h48.3 z' + private pathCommands2: string = 'M270.6 128.1 h48.6 c51.6 0 98.4 21 132.3 54.6 a411 411 0 0 3 -45.6 123 c-25.2 45.6 -56.4 84 -87.6 110.4 a206.1 206.1 0 0 0 -47.7 -288 z' + build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { Shape() { Path() .commands('M162 128.7 a222 222 0 0 1 100.8 374.4 H198 a36 36 0 0 3 -36 -36') .fill(Color.White) + .stroke(Color.Transparent) Path() .commands(this.pathCommands1) .fill('none') + .stroke(Color.Transparent) .linearGradient( - { - angle: 30, - colors: [["#C4FFA0", 0], ["#ffffff", 1]] - }) + { + angle: 30, + colors: [["#C4FFA0", 0], ["#ffffff", 1]] + }) .clip(new Path().commands(this.pathCommands1)) Path() .commands(this.pathCommands2) .fill('none') + .stroke(Color.Transparent) .linearGradient( - { - angle: 50, - colors: [['#8CC36A', 0.1], ["#B3EB90", 0.4], ["#ffffff", 0.7]] - }) + { + angle: 50, + colors: [['#8CC36A', 0.1], ["#B3EB90", 0.4], ["#ffffff", 0.7]] + }) .clip(new Path().commands(this.pathCommands2)) } .height('630px') @@ -383,22 +394,22 @@ In addition to drawing basic geometric shapes, you can also use the **\** Text('Healthy Diet') .fontSize(26) .fontColor(Color.White) - .margin({ top:300 }) + .margin({ top: 300 }) Text('Healthy life comes from a balanced diet') .fontSize(17) .fontColor(Color.White) - .margin({ top:4 }) + .margin({ top: 4 }) } .width('100%') .height('100%') .linearGradient( { angle: 180, - colors: [['#BDE895', 0.1], ["#95DE7F", 0.6], ["#7AB967", 1]] - }) + colors: [['#BDE895', 0.1], ["#95DE7F", 0.6], ["#7AB967", 1]] + }) } } ``` - + ![drawing-feature8](figures/drawing-feature8.png) diff --git a/en/application-dev/ui/ui-ts-layout-flex.md b/en/application-dev/ui/ui-ts-layout-flex.md index 20ea6ca4cedba93562ccc8ddf2d2233ea9edc1ca..a74d01cfb5183c6ebc6bcbeef5a45695bbdf217f 100644 --- a/en/application-dev/ui/ui-ts-layout-flex.md +++ b/en/application-dev/ui/ui-ts-layout-flex.md @@ -356,7 +356,7 @@ Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center }) { // The it }.width('90%').height(220).backgroundColor(0xAFEEEE) ``` -![](figures/alignself.png) +![alignself](figures/alignself.png) In the preceding example, both **alignItems** of the **\** component and the **alignSelf** attribute of the child component are set. In this case, the **alignSelf** settings take effect. @@ -452,7 +452,7 @@ Use the **alignContent** parameter to set how space is distributed between and a - **FlexAlign.SpaceEvenly**: The items are evenly distributed in the container along the cross axis. The spacing between each two adjacent items, the spacing between the start edge and the first item, and the spacing between the end edge and the last item, are the same. ```ts - Flex({ justifyContent: FlexAlign.SpaceBetween, wrap: FlexWrap.Wrap, alignContent: FlexAlign.SpaceAround }) { + Flex({ justifyContent: FlexAlign.SpaceBetween, wrap: FlexWrap.Wrap, alignContent: FlexAlign.SpaceEvenly }) { Text('1').width('30%').height(20).backgroundColor(0xF5DEB3) Text('2').width('60%').height(20).backgroundColor(0xD2B48C) Text('3').width('40%').height(20).backgroundColor(0xD2B48C) @@ -496,7 +496,7 @@ When the size of the container in the flex layout is not large enough, the follo }.width('90%').height(120).padding(10).backgroundColor(0xAFEEEE) ``` - ![](figures/flexbasis.png) + ![flexbasis](figures/flexbasis.png) - **flexGrow**: percentage of the flex layout's remaining space that is allocated to the child component. In other words, it is the grow factor of the child component. @@ -508,7 +508,7 @@ When the size of the container in the flex layout is not large enough, the follo .height(100) .backgroundColor(0xF5DEB3) - Text('flexGrow(3)') + Text('flexGrow(2)') .flexGrow(2) .width(100) .height(100) @@ -521,7 +521,7 @@ When the size of the container in the flex layout is not large enough, the follo }.width(400).height(120).padding(10).backgroundColor(0xAFEEEE) ``` - ![](figures/flexgrow.png) + ![flexgrow](figures/flexgrow.png) In the preceding figure, the width of the parent container is 400 vp, the original width of the three child components is 100 vp, which adds up to the total width of 300 vp. The remaining space 100 vp is allocated to the child components based on their **flexGrow** settings. Child components that do not have **flexGrow** set are not involved in the allocation of remaining space. The first child component and the second child component receive their share of remaining space at the 2:3 ratio. The width of the first child component is 100 vp + 100 vp x 2/5 = 140 vp, and the width of the second child component is 100 vp + 100 vp x 3/5 = 160 vp. @@ -549,7 +549,7 @@ The first child component and the second child component receive their share of }.width(400).height(120).padding(10).backgroundColor(0xAFEEEE) ``` - ![](figures/flexshrink.png) + ![flexshrink](figures/flexshrink.png) ## Example Scenario diff --git a/en/application-dev/webgl/webgl-guidelines.md b/en/application-dev/webgl/webgl-guidelines.md index b169d0586096c5e5932da39625fe656b50b21733..dc0001c50222b72b0e81f94842a6b1552dcf6ca2 100644 --- a/en/application-dev/webgl/webgl-guidelines.md +++ b/en/application-dev/webgl/webgl-guidelines.md @@ -4,6 +4,10 @@ WebGL helps you process graphics at the frontend, for example, drawing color graphics. +> **NOTE** +> +> WebGL can be used only in the JavaScript-compatible web-like development paradigm. + ## Available APIs @@ -696,6 +700,7 @@ To use WebGL to draw a color triangle (GPU drawing), perform the following steps } ``` + **Figure 2** Effect of clicking the button to draw a color triangle ![en-us_image_0000001192429306](figures/en-us_image_0000001192429306.gif) diff --git a/en/application-dev/website.md b/en/application-dev/website.md index 4e97d11e9fa074bc338a6ade52b8eb8abb5008f9..8234622dfe6b7a7238913df0ef792f40c900689f 100644 --- a/en/application-dev/website.md +++ b/en/application-dev/website.md @@ -1,5 +1,4 @@ # Application Development - - [Application Development Overview](application-dev-guide.md) - Quick Start - Getting Started @@ -63,6 +62,8 @@ - [ServiceExtensionAbility](application-models/serviceextensionability.md) - [DataShareExtensionAbility](application-models/datashareextensionability.md) - [FormExtensionAbility (Widget)](application-models/widget-development-stage.md) + - [AccessibilityExtensionAbility](application-models/accessibilityextensionability.md) + - [WindowExtensionAbility](application-models/windowextensionability.md) - [AbilityStage Component Container](application-models/abilitystage.md) - [Context](application-models/application-context-stage.md) - Want @@ -286,10 +287,8 @@ - [WebGL Overview](webgl/webgl-overview.md) - [WebGL Development](webgl/webgl-guidelines.md) - Media - - Audio + - Audio and Video - [Audio Overview](media/audio-overview.md) - - [Audio Playback Development](media/audio-playback.md) - - [Audio Recording Development](media/audio-recorder.md) - [Audio Rendering Development](media/audio-renderer.md) - [Audio Stream Management Development](media/audio-stream-manager.md) - [Audio Capture Development](media/audio-capturer.md) @@ -298,9 +297,12 @@ - [Audio Interruption Mode Development](media/audio-interruptmode.md) - [Volume Management Development](media/audio-volume-manager.md) - [Audio Routing and Device Management Development](media/audio-routing-manager.md) - - Video - - [Video Playback Development](media/video-playback.md) - - [Video Recording Development](media/video-recorder.md) + - [AVPlayer Development (Recommended)](media/avplayer-playback.md) + - [AVRecorder Development (Recommended)](media/avrecorder.md) + - [Audio Playback Development (To Be Deprecated)](media/audio-playback.md) + - [Audio Recording Development (To Be Deprecated)](media/audio-recorder.md) + - [Video Playback Development (To Be Deprecated)](media/video-playback.md) + - [Video Recording Development (To Be Deprecated)](media/video-recorder.md) - AVSession - [AVSession Overview](media/avsession-overview.md) - [AVSession Development](media/avsession-guidelines.md) @@ -324,6 +326,9 @@ - Crypto Framework - [Crypto Framework Overview](security/cryptoFramework-overview.md) - [Crypto Framework Development](security/cryptoFramework-guidelines.md) + - Certificate + - [Certificate Overview](security/cert-overview.md) + - [Certificate Development](security/cert-guidelines.md) - hapsigner - [hapsigner Overview](security/hapsigntool-overview.md) - [hapsigner Guide](security/hapsigntool-guidelines.md) @@ -366,12 +371,14 @@ - [Album Management](file-management/medialibrary-album-guidelines.md) - File Access Framework - [File Access Framework Overview](file-management/file-access-framework-overview.md) + - [FilePicker Guide](file-management/filepicker-guidelines.md) - Task Management - Background Task Management - [Background Task Management Overview](task-management/background-task-overview.md) - [Transient Task Development](task-management/transient-task-dev-guide.md) - [Continuous Task Development](task-management/continuous-task-dev-guide.md) - [Work Scheduler Development](task-management/work-scheduler-dev-guide.md) + - [WorkSchedulerExtensionAbility Development](task-management/workscheduler-extensionability.md) - [Efficiency Resource Request Development](task-management/efficiency-resources-apply-dev-guide.md) - Agent-Powered Reminder - [Agent-Powered Reminder Overview](task-management/reminder-agent-overview.md) @@ -381,9 +388,7 @@ - [USB Service Overview](device/usb-overview.md) - [USB Service Development](device/usb-guidelines.md) - Location - - [Location Overview](device/device-location-overview.md) - - [Obtaining Device Location Information](device/device-location-info.md) - - [Geocoding and Reverse Geocoding Capabilities](device/device-location-geocoding.md) + - [Location Development](device/location-guidelines.md) - Sensor - [Sensor Overview](device/sensor-overview.md) - [Sensor Development](device/sensor-guidelines.md) @@ -433,7 +438,7 @@ - [Common Event Manager](tools/anm-tool.md) - [Advanced Notification Manager](tools/cem-tool.md) - Hands-On Tutorials - - [Samples](https://gitee.com/openharmony/applications_app_samples/blob/master/README.md) + - [Samples](https://gitee.com/openharmony/applications_app_samples/blob/monthly_20221018/README.md) - [Codelabs](https://gitee.com/openharmony/codelabs) - API References - [SystemCapability](reference/syscap.md) @@ -499,6 +504,7 @@ - [DataPanel](reference/arkui-ts/ts-basic-components-datapanel.md) - [DatePicker](reference/arkui-ts/ts-basic-components-datepicker.md) - [Divider](reference/arkui-ts/ts-basic-components-divider.md) + - [Formcomponent](reference/arkui-ts/ts-basic-components-formcomponent.md) - [Gauge](reference/arkui-ts/ts-basic-components-gauge.md) - [Image](reference/arkui-ts/ts-basic-components-image.md) - [ImageAnimator](reference/arkui-ts/ts-basic-components-imageanimator.md) @@ -748,72 +754,65 @@ - [API Reference Document Description](reference/apis/development-intro.md) - Ability Framework - Stage Model (Recommended) - - [@ohos.app.ability.Ability](reference/apis/js-apis-app-ability-ability.md) - - [@ohos.app.ability.AbilityConstant](reference/apis/js-apis-app-ability-abilityConstant.md) - - [@ohos.app.ability.abilityLifecycleCallback](reference/apis/js-apis-app-ability-abilityLifecycleCallback.md) - - [@ohos.app.ability.AbilityStage](reference/apis/js-apis-app-ability-abilityStage.md) - - [@ohos.app.ability.common](reference/apis/js-apis-app-ability-common.md) - - [@ohos.app.ability.contextConstant](reference/apis/js-apis-app-ability-contextConstant.md) - - [@ohos.app.ability.EnvironmentCallback](reference/apis/js-apis-app-ability-environmentCallback.md) - - [@ohos.app.ability.ExtensionAbility](reference/apis/js-apis-app-ability-extensionAbility.md) - - [@ohos.app.ability.ServiceExtensionAbility](reference/apis/js-apis-app-ability-serviceExtensionAbility.md) - - [@ohos.app.ability.StartOptions](reference/apis/js-apis-app-ability-startOptions.md) - - [@ohos.app.ability.UIAbility](reference/apis/js-apis-app-ability-uiAbility.md) - - [@ohos.app.form.FormExtensionAbility](reference/apis/js-apis-app-form-formExtensionAbility.md) + - [@ohos.app.ability.Ability (Ability Base Class)](reference/apis/js-apis-app-ability-ability.md) + - [@ohos.app.ability.AbilityConstant (AbilityConstant)](reference/apis/js-apis-app-ability-abilityConstant.md) + - [@ohos.app.ability.abilityLifecycleCallback (AbilityLifecycleCallback)](reference/apis/js-apis-app-ability-abilityLifecycleCallback.md) + - [@ohos.app.ability.AbilityStage (AbilityStage)](reference/apis/js-apis-app-ability-abilityStage.md) + - [@ohos.app.ability.common (Context)](reference/apis/js-apis-app-ability-common.md) + - [@ohos.app.ability.contextConstant (ContextConstant)](reference/apis/js-apis-app-ability-contextConstant.md) + - [@ohos.app.ability.EnvironmentCallback (EnvironmentCallback)](reference/apis/js-apis-app-ability-environmentCallback.md) + - [@ohos.app.ability.ExtensionAbility (ExtensionAbility Base Class)](reference/apis/js-apis-app-ability-extensionAbility.md) + - [@ohos.app.ability.ServiceExtensionAbility (ServiceExtensionAbility)](reference/apis/js-apis-app-ability-serviceExtensionAbility.md) + - [@ohos.app.ability.StartOptions (StartOptions)](reference/apis/js-apis-app-ability-startOptions.md) + - [@ohos.app.ability.UIAbility (UIAbility)](reference/apis/js-apis-app-ability-uiAbility.md) + - [@ohos.app.form.FormExtensionAbility (FormExtensionAbility)](reference/apis/js-apis-app-form-formExtensionAbility.md) + - [@ohos.application.DataShareExtensionAbility (DataShare Extension Ability)](reference/apis/js-apis-application-dataShareExtensionAbility.md) + - [@ohos.application.StaticSubscriberExtensionAbility (StaticSubscriberExtensionAbility)](reference/apis/js-apis-application-staticSubscriberExtensionAbility.md) - Stage Model (To Be Deprecated Soon) - - [@ohos.application.Ability](reference/apis/js-apis-application-ability.md) - - [@ohos.application.AbilityConstant](reference/apis/js-apis-application-abilityConstant.md) - - [@ohos.application.AbilityLifecycleCallback](reference/apis/js-apis-application-abilityLifecycleCallback.md) - - [@ohos.application.AbilityStage](reference/apis/js-apis-application-abilityStage.md) - - [@ohos.application.context](reference/apis/js-apis-application-context.md) - - [@ohos.application.DataShareExtensionAbility](reference/apis/js-apis-application-dataShareExtensionAbility.md) - - [@ohos.application.EnvironmentCallback](reference/apis/js-apis-application-environmentCallback.md) - - [@ohos.application.ExtensionAbility](reference/apis/js-apis-application-extensionAbility.md) - - [@ohos.application.FormExtension](reference/apis/js-apis-application-formExtension.md) - - [@ohos.application.ServiceExtensionAbility](reference/apis/js-apis-application-serviceExtensionAbility.md) - - [@ohos.application.StartOptions](reference/apis/js-apis-application-startOptions.md) - - [@ohos.application.StaticSubscriberExtensionAbility](reference/apis/js-apis-application-staticSubscriberExtensionAbility.md) + - [@ohos.application.AbilityConstant (AbilityConstant)](reference/apis/js-apis-application-abilityConstant.md) + - [@ohos.application.AbilityStage (AbilityStage)](reference/apis/js-apis-application-abilityStage.md) + - [@ohos.application.EnvironmentCallback (EnvironmentCallback)](reference/apis/js-apis-application-environmentCallback.md) + - [@ohos.application.FormExtension (FormExtension)](reference/apis/js-apis-application-formExtension.md) + - [@ohos.application.ServiceExtensionAbility (ServiceExtensionAbility)](reference/apis/js-apis-application-serviceExtensionAbility.md) + - [@ohos.application.StartOptions (StartOptions)](reference/apis/js-apis-application-startOptions.md) - FA Model - - [@ohos.ability.ability](reference/apis/js-apis-ability-ability.md) - - [@ohos.ability.featureAbility](reference/apis/js-apis-ability-featureAbility.md) - - [@ohos.ability.particleAbility](reference/apis/js-apis-ability-particleAbility.md) + - [@ohos.ability.ability (Ability)](reference/apis/js-apis-ability-ability.md) + - [@ohos.ability.featureAbility (FeatureAbility)](reference/apis/js-apis-ability-featureAbility.md) + - [@ohos.ability.particleAbility (ParticleAbility)](reference/apis/js-apis-ability-particleAbility.md) - Both Models (Recommended) - - [@ohos.app.ability.abilityDelegatorRegistry](reference/apis/js-apis-app-ability-abilityDelegatorRegistry.md) - - [@ohos.app.ability.abilityManager](reference/apis/js-apis-app-ability-abilityManager.md) - - [@ohos.app.ability.appManager](reference/apis/js-apis-app-ability-appManager.md) - - [@ohos.app.ability.appRecovery](reference/apis/js-apis-app-ability-appRecovery.md) - - [@ohos.app.ability.Configuration](reference/apis/js-apis-app-ability-configuration.md) - - [@ohos.app.ability.ConfigurationConstant](reference/apis/js-apis-app-ability-configurationConstant.md) - - [@ohos.app.ability.dataUriUtils](reference/apis/js-apis-app-ability-dataUriUtils.md) - - [@ohos.app.ability.errorManager](reference/apis/js-apis-app-ability-errorManager.md) - - [@ohos.app.ability.missionManager](reference/apis/js-apis-app-ability-missionManager.md) - - [@ohos.app.ability.quickFixManager](reference/apis/js-apis-app-ability-quickFixManager.md) - - [@ohos.app.ability.Want](reference/apis/js-apis-app-ability-want.md) - - [@ohos.app.ability.wantAgent](reference/apis/js-apis-app-ability-wantAgent.md) - - [@ohos.app.ability.wantConstant](reference/apis/js-apis-app-ability-wantConstant.md) - - [@ohos.app.form.formBindingData](reference/apis/js-apis-app-form-formBindingData.md) - - [@ohos.app.form.formHost](reference/apis/js-apis-app-form-formHost.md) - - [@ohos.app.form.formInfo](reference/apis/js-apis-app-form-formInfo.md) - - [@ohos.app.form.formProvider](reference/apis/js-apis-app-form-formProvider.md) - - [@ohos.distributedMissionManager](reference/apis/js-apis-distributedMissionManager.md) + - [@ohos.app.ability.abilityDelegatorRegistry (AbilityDelegatorRegistry)](reference/apis/js-apis-app-ability-abilityDelegatorRegistry.md) + - [@ohos.app.ability.abilityManager (AbilityManager)](reference/apis/js-apis-app-ability-abilityManager.md) + - [@ohos.app.ability.appManager (appManager)](reference/apis/js-apis-app-ability-appManager.md) + - [@ohos.app.ability.appRecovery (appRecovery)](reference/apis/js-apis-app-ability-appRecovery.md) + - [@ohos.app.ability.Configuration (Configuration)](reference/apis/js-apis-app-ability-configuration.md) + - [@ohos.app.ability.ConfigurationConstant (ConfigurationConstant)](reference/apis/js-apis-app-ability-configurationConstant.md) + - [@ohos.app.ability.errorManager (ErrorManager)](reference/apis/js-apis-app-ability-errorManager.md) + - [@ohos.app.ability.missionManager (missionManager)](reference/apis/js-apis-app-ability-missionManager.md) + - [@ohos.app.ability.quickFixManager (quickFixManager)](reference/apis/js-apis-app-ability-quickFixManager.md) + - [@ohos.app.ability.Want (Want)](reference/apis/js-apis-app-ability-want.md) + - [@ohos.app.ability.wantAgent (WantAgent)](reference/apis/js-apis-app-ability-wantAgent.md) + - [@ohos.app.ability.wantConstant (wantConstant)](reference/apis/js-apis-app-ability-wantConstant.md) + - [@ohos.app.form.formBindingData (formBindingData)](reference/apis/js-apis-app-form-formBindingData.md) + - [@ohos.app.form.formHost (FormHost)](reference/apis/js-apis-app-form-formHost.md) + - [@ohos.app.form.formInfo (FormInfo)](reference/apis/js-apis-app-form-formInfo.md) + - [@ohos.app.form.formProvider (FormProvider)](reference/apis/js-apis-app-form-formProvider.md) - Both Models (To Be Deprecated Soon) - - [@ohos.ability.dataUriUtils](reference/apis/js-apis-ability-dataUriUtils.md) - - [@ohos.ability.errorCode](reference/apis/js-apis-ability-errorCode.md) - - [@ohos.ability.wantConstant](reference/apis/js-apis-ability-wantConstant.md) - - [@ohos.application.abilityDelegatorRegistry](reference/apis/js-apis-application-abilityDelegatorRegistry.md) - - [@ohos.application.abilityManager](reference/apis/js-apis-application-abilityManager.md) - - [@ohos.application.appManager](reference/apis/js-apis-application-appManager.md) - - [@ohos.application.Configuration](reference/apis/js-apis-application-configuration.md) - - [@ohos.application.ConfigurationConstant](reference/apis/js-apis-application-configurationConstant.md) - - [@ohos.application.errorManager](reference/apis/js-apis-application-errorManager.md) - - [@ohos.application.formBindingData](reference/apis/js-apis-application-formBindingData.md) - - [@ohos.application.formError](reference/apis/js-apis-application-formError.md) - - [@ohos.application.formHost](reference/apis/js-apis-application-formHost.md) - - [@ohos.application.formInfo](reference/apis/js-apis-application-formInfo.md) - - [@ohos.application.formProvider](reference/apis/js-apis-application-formProvider.md) - - [@ohos.application.missionManager](reference/apis/js-apis-application-missionManager.md) - - [@ohos.application.Want](reference/apis/js-apis-application-want.md) - - [@ohos.wantAgent](reference/apis/js-apis-wantAgent.md) + - [@ohos.ability.dataUriUtils (DataUriUtils)](reference/apis/js-apis-ability-dataUriUtils.md) + - [@ohos.ability.errorCode (ErrorCode)](reference/apis/js-apis-ability-errorCode.md) + - [@ohos.ability.wantConstant (wantConstant)](reference/apis/js-apis-ability-wantConstant.md) + - [@ohos.application.abilityDelegatorRegistry (AbilityDelegatorRegistry)](reference/apis/js-apis-application-abilityDelegatorRegistry.md) + - [@ohos.application.abilityManager (AbilityManager)](reference/apis/js-apis-application-abilityManager.md) + - [@ohos.application.appManager (appManager)](reference/apis/js-apis-application-appManager.md) + - [@ohos.application.Configuration (Configuration)](reference/apis/js-apis-application-configuration.md) + - [@ohos.application.ConfigurationConstant (ConfigurationConstant)](reference/apis/js-apis-application-configurationConstant.md) + - [@ohos.application.formBindingData (formBindingData)](reference/apis/js-apis-application-formBindingData.md) + - [@ohos.application.formError (FormError)](reference/apis/js-apis-application-formError.md) + - [@ohos.application.formHost (FormHost)](reference/apis/js-apis-application-formHost.md) + - [@ohos.application.formInfo (FormInfo)](reference/apis/js-apis-application-formInfo.md) + - [@ohos.application.formProvider (FormProvider)](reference/apis/js-apis-application-formProvider.md) + - [@ohos.application.missionManager (missionManager)](reference/apis/js-apis-application-missionManager.md) + - [@ohos.application.Want (Want)](reference/apis/js-apis-application-want.md) + - [@ohos.wantAgent (WantAgent)](reference/apis/js-apis-wantAgent.md) - Dependent Elements and Definitions - ability - [abilityResult](reference/apis/js-apis-inner-ability-abilityResult.md) @@ -828,7 +827,6 @@ - [context](reference/apis/js-apis-inner-app-context.md) - [processInfo](reference/apis/js-apis-inner-app-processInfo.md) - application - - [AbilityContext](reference/apis/js-apis-ability-context.md) - [abilityDelegator](reference/apis/js-apis-inner-application-abilityDelegator.md) - [abilityDelegatorArgs](reference/apis/js-apis-inner-application-abilityDelegatorArgs.md) - [abilityMonitor](reference/apis/js-apis-inner-application-abilityMonitor.md) @@ -853,13 +851,13 @@ - [MissionListener](reference/apis/js-apis-inner-application-missionListener.md) - [MissionParameter](reference/apis/js-apis-inner-application-missionParameter.md) - [MissionSnapshot](reference/apis/js-apis-inner-application-missionSnapshot.md) - - [PermissionRequestResult](reference/apis/js-apis-inner-application-permissionRequestResult.md) - [ProcessData](reference/apis/js-apis-inner-application-processData.md) - [ProcessRunningInfo](reference/apis/js-apis-inner-application-processRunningInfo.md) - - [ProcessRunningInformation](reference/apis/js-apis-inner-application-processRunningInformation.md) + - [ProcessInformation](reference/apis/js-apis-inner-application-processInformation.md) - [ServiceExtensionContext](reference/apis/js-apis-inner-application-serviceExtensionContext.md) - [UIAbilityContext](reference/apis/js-apis-inner-application-uiAbilityContext.md) - [shellCmdResult](reference/apis/js-apis-inner-application-shellCmdResult.md) + - [WindowExtensionContext](reference/apis/js-apis-inner-application-windowExtensionContext.md) - wantAgent - [triggerInfo](reference/apis/js-apis-inner-wantAgent-triggerInfo.md) - [wantAgentInfo](reference/apis/js-apis-inner-wantAgent-wantAgentInfo.md) @@ -869,264 +867,273 @@ - [continuationExtraParams](reference/apis/js-apis-continuation-continuationExtraParams.md) - [continuationResult](reference/apis/js-apis-continuation-continuationResult.md) - Common Event and Notification - - [@ohos.commonEventManager](reference/apis/js-apis-commonEventManager.md) - - [@ohos.events.emitter](reference/apis/js-apis-emitter.md) - - [@ohos.notificationManager (Recommended)](reference/apis/js-apis-notificationManager.md) - - [@ohos.notificationSubscribe (Recommended)](reference/apis/js-apis-notificationSubscribe.md) - - [@ohos.commonEvent (To Be Deprecated Soon)](reference/apis/js-apis-commonEvent.md) - - [@ohos.notification](reference/apis/js-apis-notification.md) + - [@ohos.commonEventManager (Common Event) (Recommended)](reference/apis/js-apis-commonEventManager.md) + - [@ohos.events.emitter (Emitter)](reference/apis/js-apis-emitter.md) + - [@ohos.notificationManager (NotificationManager) (Recommended)](reference/apis/js-apis-notificationManager.md) + - [@ohos.notificationSubscribe (NotificationSubscribe) (Recommended)](reference/apis/js-apis-notificationSubscribe.md) + - [@ohos.commonEvent (Common Event) (To Be Deprecated Soon)](reference/apis/js-apis-commonEvent.md) + - [@ohos.notification (Notification) (To Be Deprecated Soon)](reference/apis/js-apis-notification.md) - application - [EventHub](reference/apis/js-apis-inner-application-eventHub.md) - Bundle Management - - [@ohos.bundle.appControl](reference/apis/js-apis-appControl.md) - - [@ohos.bundle.bundleManager](reference/apis/js-apis-bundleManager.md) - - [@ohos.bundle.bundleMonitor](reference/apis/js-apis-bundleMonitor.md) - - [@ohos.bundle.defaultAppManager](reference/apis/js-apis-defaultAppManager.md) - - [@ohos.bundle.distributedBundle](reference/apis/js-apis-distributedBundle.md) - - [@ohos.bundle.freeInstall](reference/apis/js-apis-freeInstall.md) - - [@ohos.bundle.installer](reference/apis/js-apis-installer.md) - - [@ohos.bundle.launcherBundleManager](reference/apis/js-apis-launcherBundleManager.md) - - [@ohos.zlib](reference/apis/js-apis-zlib.md) + - [@ohos.bundle.appControl(appControl)](reference/apis/js-apis-appControl.md) + - [@ohos.bundle.bundleManager (bundleManager)](reference/apis/js-apis-bundleManager.md) + - [@ohos.bundle.bundleMonitor (bundleMonitor)](reference/apis/js-apis-bundleMonitor.md) + - [@ohos.bundle.defaultAppManager (Default Application Management)](reference/apis/js-apis-defaultAppManager.md) + - [@ohos.bundle.distributedBundle (distributedBundleManager)](reference/apis/js-apis-distributedBundleManager.md) + - [@ohos.bundle.freeInstall (freeInstall)](reference/apis/js-apis-freeInstall.md) + - [@ohos.bundle.installer (installer)](reference/apis/js-apis-installer.md) + - [@ohos.bundle.launcherBundleManager (launcherBundleManager)](reference/apis/js-apis-launcherBundleManager.md) + - [@ohos.zlib (Zip)](reference/apis/js-apis-zlib.md) - bundleManager - [abilityInfo](reference/apis/js-apis-bundleManager-abilityInfo.md) - [applicationInfo](reference/apis/js-apis-bundleManager-applicationInfo.md) - [bundleInfo](reference/apis/js-apis-bundleManager-bundleInfo.md) + - [BundlePackInfo](reference/apis/js-apis-bundleManager-BundlePackInfo.md) - [dispatchInfo](reference/apis/js-apis-bundleManager-dispatchInfo.md) - [elementName](reference/apis/js-apis-bundleManager-elementName.md) - [extensionAbilityInfo](reference/apis/js-apis-bundleManager-extensionAbilityInfo.md) - [hapModuleInfo](reference/apis/js-apis-bundleManager-hapModuleInfo.md) - [launcherAbilityInfo](reference/apis/js-apis-bundleManager-launcherAbilityInfo.md) - [metadata](reference/apis/js-apis-bundleManager-metadata.md) - - [packInfo](reference/apis/js-apis-bundleManager-packInfo.md) - [permissionDef](reference/apis/js-apis-bundleManager-permissionDef.md) - [remoteAbilityInfo](reference/apis/js-apis-bundleManager-remoteAbilityInfo.md) - [shortcutInfo](reference/apis/js-apis-bundleManager-shortcutInfo.md) - UI Page - - [@ohos.animator](reference/apis/js-apis-animator.md) - - [@ohos.curves](reference/apis/js-apis-curve.md) - - [@ohos.matrix4](reference/apis/js-apis-matrix4.md) - - [@ohos.mediaquery](reference/apis/js-apis-mediaquery.md) - - [@ohos.promptAction](reference/apis/js-apis-promptAction.md) - - [@ohos.router](reference/apis/js-apis-router.md) + - [@ohos.animator (Animator)](reference/apis/js-apis-animator.md) + - [@ohos.curves (Interpolation Calculation)](reference/apis/js-apis-curve.md) + - [@ohos.matrix4 (Matrix Transformation)](reference/apis/js-apis-matrix4.md) + - [@ohos.mediaquery (Media Query)](reference/apis/js-apis-mediaquery.md) + - [@ohos.promptAction (Prompt)](reference/apis/js-apis-promptAction.md) + - [@ohos.router (Page Routing)](reference/apis/js-apis-router.md) - Graphics - - [@ohos.animation.windowAnimationManager](reference/apis/js-apis-windowAnimationManager.md) - - [@ohos.application.WindowExtensionAbility](reference/apis/js-apis-application-windowExtensionAbility.md) - - [@ohos.display](reference/apis/js-apis-display.md) - - [@ohos.effectKit](reference/apis/js-apis-effectKit.md) - - [@ohos.graphics.colorSpaceManager](reference/apis/js-apis-colorSpaceManager.md) - - [@ohos.screen](reference/apis/js-apis-screen.md) - - [@ohos.screenshot](reference/apis/js-apis-screenshot.md) - - [@ohos.window](reference/apis/js-apis-window.md) + - [@ohos.animation.windowAnimationManager (Window Animation Management)](reference/apis/js-apis-windowAnimationManager.md) + - [@ohos.application.WindowExtensionAbility (WindowExtensionAbility)](reference/apis/js-apis-application-windowExtensionAbility.md) + - [@ohos.display (Display)](reference/apis/js-apis-display.md) + - [@ohos.effectKit (Image Effects)](reference/apis/js-apis-effectKit.md) + - [@ohos.graphics.colorSpaceManager (Color Space Management)](reference/apis/js-apis-colorSpaceManager.md) + - [@ohos.screen (Screen)](reference/apis/js-apis-screen.md) + - [@ohos.screenshot (Screenshot)](reference/apis/js-apis-screenshot.md) + - [@ohos.window (Window)](reference/apis/js-apis-window.md) - webgl - - [webgl](reference/apis/js-apis-webgl.md) - - [webgl2](reference/apis/js-apis-webgl2.md) + - [WebGL](reference/apis/js-apis-webgl.md) + - [WebGL2](reference/apis/js-apis-webgl2.md) - Media - - [@ohos.multimedia.audio](reference/apis/js-apis-audio.md) - - [@ohos.multimedia.avsession](reference/apis/js-apis-avsession.md) - - [@ohos.multimedia.camera](reference/apis/js-apis-camera.md) - - [@ohos.multimedia.image](reference/apis/js-apis-image.md) - - [@ohos.multimedia.media](reference/apis/js-apis-media.md) + - [@ohos.multimedia.audio (Audio Management)](reference/apis/js-apis-audio.md) + - [@ohos.multimedia.avsession (AVSession Management)](reference/apis/js-apis-avsession.md) + - [@ohos.multimedia.camera (Camera Management)](reference/apis/js-apis-camera.md) + - [@ohos.multimedia.image (Image Processing)](reference/apis/js-apis-image.md) + - [@ohos.multimedia.media (Media)](reference/apis/js-apis-media.md) - Resource Management - - [@ohos.i18n](reference/apis/js-apis-i18n.md) - - [@ohos.intl](reference/apis/js-apis-intl.md) - - [@ohos.resourceManager](reference/apis/js-apis-resource-manager.md) + - [@ohos.i18n (Internationalization)](reference/apis/js-apis-i18n.md) + - [@ohos.intl (Internationalization)](reference/apis/js-apis-intl.md) + - [@ohos.resourceManager (Resource Manager)](reference/apis/js-apis-resource-manager.md) - Resource Scheduling - - [@ohos.reminderAgentManager](reference/apis/js-apis-reminderAgentManager.md) - - [@ohos.resourceschedule.backgroundTaskManager](reference/apis/js-apis-resourceschedule-backgroundTaskManager.md) - - [@ohos.resourceschedule.workScheduler](reference/apis/js-apis-resourceschedule-workScheduler.md) - - [@ohos.WorkSchedulerExtensionAbility](reference/apis/js-apis-WorkSchedulerExtensionAbility.md) + - [@ohos.distributedMissionManager (Distributed Mission Management)](reference/apis/js-apis-distributedMissionManager.md) + - [@ohos.reminderAgentManager (Reminder Agent Management)](reference/apis/js-apis-reminderAgentManager.md) + - [@ohos.resourceschedule.backgroundTaskManager (Background Task Management)](reference/apis/js-apis-resourceschedule-backgroundTaskManager.md) + - [@ohos.resourceschedule.workScheduler (Work Scheduler)](reference/apis/js-apis-resourceschedule-workScheduler.md) + - [@ohos.resourceschedule.usageStatistics (Device Usage Statistics)](reference/apis/js-apis-resourceschedule-deviceUsageStatistics.md) + - [@ohos.WorkSchedulerExtensionAbility (Work Scheduler Callbacks)](reference/apis/js-apis-WorkSchedulerExtensionAbility.md) - Security - - [@ohos.abilityAccessCtrl](reference/apis/js-apis-abilityAccessCtrl.md) - - [@ohos.privacyManager](reference/apis/js-apis-privacyManager.md) - - [@ohos.security.cryptoFramework](reference/apis/js-apis-cryptoFramework.md) - - [@ohos.security.huks](reference/apis/js-apis-huks.md) - - [@ohos.userIAM.faceAuth](reference/apis/js-apis-useriam-faceauth.md) - - [@ohos.userIAM.userAuth](reference/apis/js-apis-useriam-userauth.md) - - [@system.cipher](reference/apis/js-apis-system-cipher.md) + - [@ohos.abilityAccessCtrl (Ability Access Control)](reference/apis/js-apis-abilityAccessCtrl.md) + - [@ohos.privacyManager (Privacy Management)](reference/apis/js-apis-privacyManager.md) + - [@ohos.security.cert (Certificate)](reference/apis/js-apis-cert.md) + - [@ohos.security.cryptoFramework (Crypto Framework)](reference/apis/js-apis-cryptoFramework.md) + - [@ohos.security.huks (HUKS)](reference/apis/js-apis-huks.md) + - [@ohos.userIAM.faceAuth (Facial Authentication)](reference/apis/js-apis-useriam-faceauth.md) + - [@ohos.userIAM.userAuth (User Authentication)](reference/apis/js-apis-useriam-userauth.md) + - [@system.cipher (Cipher Algorithm)](reference/apis/js-apis-system-cipher.md) + - security + - [PermissionRequestResult](reference/apis/js-apis-permissionrequestresult.md) - Data Management - - [@ohos.data.dataAbility](reference/apis/js-apis-data-ability.md) - - [@ohos.data.dataShare](reference/apis/js-apis-data-dataShare.md) - - [@ohos.data.dataSharePredicates](reference/apis/js-apis-data-dataSharePredicates.md) - - [@ohos.data.dataShareResultSet](reference/apis/js-apis-data-DataShareResultSet.md) - - [@ohos.data.distributedDataObject](reference/apis/js-apis-data-distributedobject.md) - - [@ohos.data.distributedKVStore](reference/apis/js-apis-distributedKVStore.md) - - [@ohos.data.preferences](reference/apis/js-apis-data-preferences.md) - - [@ohos.data.rdb](reference/apis/js-apis-data-rdb.md) + - [@ohos.data.dataAbility (DataAbility Predicates)](reference/apis/js-apis-data-ability.md) + - [@ohos.data.dataShare (DataShare)](reference/apis/js-apis-data-dataShare.md) + - [@ohos.data.dataSharePredicates (DataShare Predicates)](reference/apis/js-apis-data-dataSharePredicates.md) + - [@ohos.data.dataShareResultSet (DataShare Result Set)](reference/apis/js-apis-data-DataShareResultSet.md) + - [@ohos.data.distributedDataObject (Distributed Data Object)](reference/apis/js-apis-data-distributedobject.md) + - [@ohos.data.distributedKVStore (Distributed KV Store)](reference/apis/js-apis-distributedKVStore.md) + - [@ohos.data.preferences (Preferences)](reference/apis/js-apis-data-preferences.md) + - [@ohos.data.relationalStore (RDB Store)](reference/apis/js-apis-data-relationalStore.md) - [@ohos.data.ValuesBucket](reference/apis/js-apis-data-valuesBucket.md) - data/rdb - - [resultSet](reference/apis/js-apis-data-resultset.md) + - [resultSet (Result Set)](reference/apis/js-apis-data-resultset.md) - File Management - - [@ohos.environment](reference/apis/js-apis-environment.md) - - [@ohos.data.fileAccess](reference/apis/js-apis-fileAccess.md) - - [@ohos.fileExtensionInfo](reference/apis/js-apis-fileExtensionInfo.md) - - [@ohos.fileio](reference/apis/js-apis-fileio.md) - - [@ohos.filemanagement.userFileManager](reference/apis/js-apis-userFileManager.md) - - [@ohos.multimedia.medialibrary](reference/apis/js-apis-medialibrary.md) - - [@ohos.securityLabel](reference/apis/js-apis-securityLabel.md) - - [@ohos.statfs](reference/apis/js-apis-statfs.md) - - [@ohos.storageStatistics](reference/apis/js-apis-storage-statistics.md) - - [@ohos.volumeManager](reference/apis/js-apis-volumemanager.md) + - [@ohos.file.environment (Directory Environment Capability)](reference/apis/js-apis-file-environment.md) + - [@ohos.file.fileAccess (User File Access and Management)](reference/apis/js-apis-fileAccess.md) + - [@ohos.file.fileExtensionInfo (User File Extension Information)](reference/apis/js-apis-fileExtensionInfo.md) + - [@ohos.file.fs (File Management)](reference/apis/js-apis-file-fs.md) + - [@ohos.file.hash (File Hash Processing)](reference/apis/js-apis-file-hash.md) + - [@ohos.file.securityLabel (Data Label)](reference/apis/js-apis-file-securityLabel.md) + - [@ohos.file.statvfs (File System Space Statistics)](reference/apis/js-apis-file-statvfs.md) + - [@ohos.storageStatistics (Application Storage Statistics)](reference/apis/js-apis-file-storage-statistics.md) + - [@ohos.volumeManager (Volume Management)](reference/apis/js-apis-file-volumemanager.md) + - [@ohos.filemanagement.userFileManager (User Data Management)](reference/apis/js-apis-userFileManager.md) + - [@ohos.multimedia.medialibrary (Media Library Management)](reference/apis/js-apis-medialibrary.md) - Telephony Service - - [@ohos.contact](reference/apis/js-apis-contact.md) - - [@ohos.telephony.call](reference/apis/js-apis-call.md) - - [@ohos.telephony.data](reference/apis/js-apis-telephony-data.md) - - [@ohos.telephony.observer](reference/apis/js-apis-observer.md) - - [@ohos.telephony.radio](reference/apis/js-apis-radio.md) - - [@ohos.telephony.sim](reference/apis/js-apis-sim.md) - - [@ohos.telephony.sms](reference/apis/js-apis-sms.md) + - [@ohos.contact (Contacts)](reference/apis/js-apis-contact.md) + - [@ohos.telephony.call (Call)](reference/apis/js-apis-call.md) + - [@ohos.telephony.data (Cellular Data)](reference/apis/js-apis-telephony-data.md) + - [@ohos.telephony.observer (Observer)](reference/apis/js-apis-observer.md) + - [@ohos.telephony.radio (Network Search)](reference/apis/js-apis-radio.md) + - [@ohos.telephony.sim (SIM Management)](reference/apis/js-apis-sim.md) + - [@ohos.telephony.sms (SMS)](reference/apis/js-apis-sms.md) - Network Management - - [@ohos.net.connection](reference/apis/js-apis-net-connection.md) - - [@ohos.net.ethernet](reference/apis/js-apis-net-ethernet.md) - - [@ohos.net.http](reference/apis/js-apis-http.md) - - [@ohos.net.sharing](reference/apis/js-apis-net-sharing.md) - - [@ohos.net.socket](reference/apis/js-apis-socket.md) - - [@ohos.net.webSocket](reference/apis/js-apis-webSocket.md) - - [@ohos.request](reference/apis/js-apis-request.md) + - [@ohos.net.connection (Network Connection Management)](reference/apis/js-apis-net-connection.md) + - [@ohos.net.ethernet (Ethernet Connection Management)](reference/apis/js-apis-net-ethernet.md) + - [@ohos.net.http (Data Request)](reference/apis/js-apis-http.md) + - [@ohos.net.sharing (Network Sharing)](reference/apis/js-apis-net-sharing.md) + - [@ohos.net.socket (Socket Connection)](reference/apis/js-apis-socket.md) + - [@ohos.net.webSocket (WebSocket Connection)](reference/apis/js-apis-webSocket.md) + - [@ohos.request (Upload and Download)](reference/apis/js-apis-request.md) - Connectivity - - [@ohos.bluetooth](reference/apis/js-apis-bluetooth.md) - - [@ohos.connectedTag](reference/apis/js-apis-connectedTag.md) - - [@ohos.nfc.cardEmulation](reference/apis/js-apis-cardEmulation.md) - - [@ohos.nfc.controller](reference/apis/js-apis-nfcController.md) - - [@ohos.nfc.tag](reference/apis/js-apis-nfcTag.md) - - [@ohos.rpc](reference/apis/js-apis-rpc.md) - - [@ohos.wifiManager (Recommended)](reference/apis/js-apis-wifiManager.md) - - [@ohos.wifiManagerExt (Recommended)](reference/apis/js-apis-wifiManagerExt.md) - - [@ohos.wifi (To Be Deprecated Soon)](reference/apis/js-apis-wifi.md) - - [@ohos.wifiext (To Be Deprecated Soon)](reference/apis/js-apis-wifiext.md) + - [@ohos.bluetooth (Bluetooth)](reference/apis/js-apis-bluetooth.md) + - [@ohos.connectedTag (Active Tags)](reference/apis/js-apis-connectedTag.md) + - [@ohos.nfc.cardEmulation (Standard NFC Card Emulation)](reference/apis/js-apis-cardEmulation.md) + - [@ohos.nfc.controller (Standard NFC)](reference/apis/js-apis-nfcController.md) + - [@ohos.nfc.tag (Standard NFC Tags)](reference/apis/js-apis-nfcTag.md) + - [@ohos.rpc (RPC)](reference/apis/js-apis-rpc.md) + - [@ohos.wifiManager (WLAN)](reference/apis/js-apis-wifiManager.md) + - [@ohos.wifiManagerExt (WLAN Extension)](reference/apis/js-apis-wifiManagerExt.md) + - [@ohos.wifi (To Be Deprecated)](reference/apis/js-apis-wifi.md) + - [@ohos.wifiext (To Be Deprecated)](reference/apis/js-apis-wifiext.md) - tag - - [nfctech](reference/apis/js-apis-nfctech.md) - - [tagSession](reference/apis/js-apis-tagSession.md) + - [nfctech (Standard NFC Technologies)](reference/apis/js-apis-nfctech.md) + - [tagSession (Standard NFC Tag Session)](reference/apis/js-apis-tagSession.md) - Basic Features - - [@ohos.accessibility](reference/apis/js-apis-accessibility.md) - - [@ohos.accessibility.config](reference/apis/js-apis-accessibility-config.md) - - [@ohos.accessibility.GesturePath](reference/apis/js-apis-accessibility-GesturePath.md) - - [@ohos.accessibility.GesturePoint](reference/apis/js-apis-accessibility-GesturePoint.md) - - [@ohos.application.AccessibilityExtensionAbility](reference/apis/js-apis-application-accessibilityExtensionAbility.md) - - [@ohos.faultLogger](reference/apis/js-apis-faultLogger.md) - - [@ohos.hichecker](reference/apis/js-apis-hichecker.md) - - [@ohos.hidebug](reference/apis/js-apis-hidebug.md) - - [@ohos.hilog](reference/apis/js-apis-hilog.md) - - [@ohos.hiSysEvent](reference/apis/js-apis-hisysevent.md) - - [@ohos.hiTraceChain](reference/apis/js-apis-hitracechain.md) - - [@ohos.hiTraceMeter](reference/apis/js-apis-hitracemeter.md) - - [@ohos.hiviewdfx.hiAppEvent](reference/apis/js-apis-hiviewdfx-hiappevent.md) - - [@ohos.inputmethod](reference/apis/js-apis-inputmethod.md) - - [@ohos.inputmethodengine](reference/apis/js-apis-inputmethodengine.md) - - [@ohos.inputmethodextensionability](reference/apis/js-apis-inputmethod-extension-ability.md) - - [@ohos.inputmethodextensioncontext](reference/apis/js-apis-inputmethod-extension-context.md) - - [@ohos.inputmethodsubtype](reference/apis/js-apis-inputmethod-subtype.md) - - [@ohos.pasteboard](reference/apis/js-apis-pasteboard.md) - - [@ohos.screenLock](reference/apis/js-apis-screen-lock.md) - - [@ohos.systemTime](reference/apis/js-apis-system-time.md) - - [@ohos.systemTimer](reference/apis/js-apis-system-timer.md) - - [@ohos.wallpaper](reference/apis/js-apis-wallpaper.md) - - [@ohos.web.webview](reference/apis/js-apis-webview.md) - - [console](reference/apis/js-apis-logs.md) + - [@ohos.accessibility (Accessibility)](reference/apis/js-apis-accessibility.md) + - [@ohos.accessibility.config (System Accessibility Configuration)](reference/apis/js-apis-accessibility-config.md) + - [@ohos.accessibility.GesturePath (Gesture Path)](reference/apis/js-apis-accessibility-GesturePath.md) + - [@ohos.accessibility.GesturePoint (Gesture Point)](reference/apis/js-apis-accessibility-GesturePoint.md) + - [@ohos.application.AccessibilityExtensionAbility (AccessibilityExtensionAbility)](reference/apis/js-apis-application-accessibilityExtensionAbility.md) + - [@ohos.faultLogger (FaultLogger)](reference/apis/js-apis-faultLogger.md) + - [@ohos.hichecker (HiChecker)](reference/apis/js-apis-hichecker.md) + - [@ohos.hidebug (HiDebug)](reference/apis/js-apis-hidebug.md) + - [@ohos.hilog (HiLog)](reference/apis/js-apis-hilog.md) + - [@ohos.hiSysEvent (System Event Logging)](reference/apis/js-apis-hisysevent.md) + - [@ohos.hiTraceChain (Distributed Call Chain Tracing)](reference/apis/js-apis-hitracechain.md) + - [@ohos.hiTraceMeter (Performance Tracing)](reference/apis/js-apis-hitracemeter.md) + - [@ohos.hiviewdfx.hiAppEvent (Application Event Logging)](reference/apis/js-apis-hiviewdfx-hiappevent.md) + - [@ohos.inputMethod (Input Method Framework)](reference/apis/js-apis-inputmethod.md) + - [@ohos.inputMethodEngine (Input Method Service)](reference/apis/js-apis-inputmethodengine.md) + - [@ohos.InputMethodExtensionAbility (InputMethodExtensionAbility)](reference/apis/js-apis-inputmethod-extension-ability.md) + - [@ohos.InputMethodExtensionContext (InputMethodExtensionContext)](reference/apis/js-apis-inputmethod-extension-context.md) + - [@ohos.InputMethodSubtype (Input Method Subtype)](reference/apis/js-apis-inputmethod-subtype.md) + - [@ohos.pasteboard (Pasteboard)](reference/apis/js-apis-pasteboard.md) + - [@ohos.screenLock (Screenlock)](reference/apis/js-apis-screen-lock.md) + - [@ohos.systemDateTime (System Time and Time Zone)](reference/apis/js-apis-system-date-time.md) + - [@ohos.systemTimer (System Timer)](reference/apis/js-apis-system-timer.md) + - [@ohos.wallpaper (Wallpaper)](reference/apis/js-apis-wallpaper.md) + - [@ohos.web.webview (Webview)](reference/apis/js-apis-webview.md) + - [console (Log)](reference/apis/js-apis-logs.md) - [Timer](reference/apis/js-apis-timer.md) - application - [AccessibilityExtensionContext](reference/apis/js-apis-inner-application-accessibilityExtensionContext.md) - Device Management - - [@ohos.batteryInfo](reference/apis/js-apis-battery-info.md) - - [@ohos.batteryStatistics](reference/apis/js-apis-batteryStatistics.md) - - [@ohos.brightness](reference/apis/js-apis-brightness.md) - - [@ohos.deviceInfo](reference/apis/js-apis-device-info.md) - - [@ohos.distributedHardware.deviceManager](reference/apis/js-apis-device-manager.md) - - [@ohos.geoLocationManager](reference/apis/js-apis-geoLocationManager.md) - - [@ohos.multimodalInput.inputConsumer](reference/apis/js-apis-inputconsumer.md) - - [@ohos.multimodalInput.inputDevice](reference/apis/js-apis-inputdevice.md) - - [@ohos.multimodalInput.inputDeviceCooperate](reference/apis/js-apis-cooperate.md) - - [@ohos.multimodalInput.inputEvent](reference/apis/js-apis-inputevent.md) - - [@ohos.multimodalInput.inputEventClient](reference/apis/js-apis-inputeventclient.md) - - [@ohos.multimodalInput.inputMonitor](reference/apis/js-apis-inputmonitor.md) - - [@ohos.multimodalInput.keyCode](reference/apis/js-apis-keycode.md) - - [@ohos.multimodalInput.keyEvent](reference/apis/js-apis-keyevent.md) - - [@ohos.multimodalInput.mouseEvent](reference/apis/js-apis-mouseevent.md) - - [@ohos.multimodalInput.pointer](reference/apis/js-apis-pointer.md) - - [@ohos.multimodalInput.touchEvent](reference/apis/js-apis-touchevent.md) - - [@ohos.power](reference/apis/js-apis-power.md) - - [@ohos.resourceschedule.usageStatistics](reference/apis/js-apis-resourceschedule-deviceUsageStatistics.md) - - [@ohos.runningLock](reference/apis/js-apis-runninglock.md) - - [@ohos.sensor](reference/apis/js-apis-sensor.md) - - [@ohos.settings](reference/apis/js-apis-settings.md) - - [@ohos.stationary](reference/apis/js-apis-stationary.md) - - [@ohos.systemCapability](reference/apis/js-apis-system-capability.md) - - [@ohos.systemParameterV9](reference/apis/js-apis-system-parameterV9.md) - - [@ohos.thermal](reference/apis/js-apis-thermal.md) - - [@ohos.update](reference/apis/js-apis-update.md) - - [@ohos.usb](reference/apis/js-apis-usb.md) - - [@ohos.vibrator](reference/apis/js-apis-vibrator.md) + - [@ohos.batteryInfo (Battery Information)](reference/apis/js-apis-battery-info.md) + - [@ohos.batteryStatistics (Battery Statistics)](reference/apis/js-apis-batteryStatistics.md) + - [@ohos.brightness (Screen Brightness)](reference/apis/js-apis-brightness.md) + - [@ohos.deviceInfo (Device Information)](reference/apis/js-apis-device-info.md) + - [@ohos.distributedHardware.deviceManager (Device Management)](reference/apis/js-apis-device-manager.md) + - [@ohos.geoLocationManager (Geolocation Manager)](reference/apis/js-apis-geoLocationManager.md) + - [@ohos.multimodalInput.inputConsumer (Input Consumer)](reference/apis/js-apis-inputconsumer.md) + - [@ohos.multimodalInput.inputDevice (Input Device)](reference/apis/js-apis-inputdevice.md) + - [@ohos.multimodalInput.inputDeviceCooperate (Screen Hopping)](reference/apis/js-apis-cooperate.md) + - [@ohos.multimodalInput.inputEvent (Input Event)](reference/apis/js-apis-inputevent.md) + - [@ohos.multimodalInput.inputEventClient (Key Event Injection)](reference/apis/js-apis-inputeventclient.md) + - [@ohos.multimodalInput.inputMonitor (Input Monitor)](reference/apis/js-apis-inputmonitor.md) + - [@ohos.multimodalInput.keyCode (Key Code)](reference/apis/js-apis-keycode.md) + - [@ohos.multimodalInput.keyEvent (Key Event)](reference/apis/js-apis-keyevent.md) + - [@ohos.multimodalInput.mouseEvent (Mouse Event)](reference/apis/js-apis-mouseevent.md) + - [@ohos.multimodalInput.pointer (Mouse Pointer)](reference/apis/js-apis-pointer.md) + - [@ohos.multimodalInput.touchEvent (Touch Event)](reference/apis/js-apis-touchevent.md) + - [@ohos.power (System Power Management)](reference/apis/js-apis-power.md) + - [@ohos.runningLock (Runninglock)](reference/apis/js-apis-runninglock.md) + - [@ohos.sensor (Sensor)](reference/apis/js-apis-sensor.md) + - [@ohos.settings (Data Item Settings)](reference/apis/js-apis-settings.md) + - [@ohos.stationary (Device Status Awareness Framework)](reference/apis/js-apis-stationary.md) + - [@ohos.systemCapability (SystemCapability)](reference/apis/js-apis-system-capability.md) + - [@ohos.systemParameterEnhance (System Parameter)](reference/apis/js-apis-system-parameterEnhance.md) + - [@ohos.thermal (Thermal Management)](reference/apis/js-apis-thermal.md) + - [@ohos.update (Update)](reference/apis/js-apis-update.md) + - [@ohos.usbManager (USB Management)](reference/apis/js-apis-usbManager.md) + - [@ohos.vibrator (Vibrator)](reference/apis/js-apis-vibrator.md) - Account Management - - [@ohos.account.appAccount](reference/apis/js-apis-appAccount.md) - - [@ohos.account.distributedAccount](reference/apis/js-apis-distributed-account.md) - - [@ohos.account.osAccount](reference/apis/js-apis-osAccount.md) + - [@ohos.account.appAccount (App Account Management)](reference/apis/js-apis-appAccount.md) + - [@ohos.account.distributedAccount (Distributed Account Management)](reference/apis/js-apis-distributed-account.md) + - [@ohos.account.osAccount (OS Account Management)](reference/apis/js-apis-osAccount.md) - Custom Management - - [@ohos.configPolicy](reference/apis/js-apis-configPolicy.md) - - [@ohos.enterprise.deviceInfo](reference/apis/js-apis-enterprise-deviceInfo.md) - - [@ohos.enterprise.EnterpriseAdminExtensionAbility](reference/apis/js-apis-EnterpriseAdminExtensionAbility.md) - - [@ohos.enterprise.adminManager](reference/apis/js-apis-enterprise-adminManager.md) - - [@ohos.enterprise.dateTimeManager](reference/apis/js-apis-enterprise-dateTimeManager.md) + - [@ohos.configPolicy (Configuration Policy)](reference/apis/js-apis-configPolicy.md) + - [@ohos.enterprise.EnterpriseAdminExtensionAbility (EnterpriseAdminExtensionAbility)](reference/apis/js-apis-EnterpriseAdminExtensionAbility.md) + - [@ohos.enterprise.adminManager (Enterprise Device Management)](reference/apis/js-apis-enterprise-adminManager.md) + - [@ohos.enterprise.dateTimeManager (System Time Management)](reference/apis/js-apis-enterprise-dateTimeManager.md) - Language Base Class Library - - [@ohos.buffer](reference/apis/js-apis-buffer.md) - - [@ohos.convertxml](reference/apis/js-apis-convertxml.md) - - [@ohos.process](reference/apis/js-apis-process.md) - - [@ohos.uri](reference/apis/js-apis-uri.md) - - [@ohos.url](reference/apis/js-apis-url.md) - - [@ohos.util](reference/apis/js-apis-util.md) - - [@ohos.util.ArrayList](reference/apis/js-apis-arraylist.md) - - [@ohos.util.Deque](reference/apis/js-apis-deque.md) - - [@ohos.util.HashMap](reference/apis/js-apis-hashmap.md) - - [@ohos.util.HashSet](reference/apis/js-apis-hashset.md) - - [@ohos.util.LightWeightMap](reference/apis/js-apis-lightweightmap.md) - - [@ohos.util.LightWeightSet](reference/apis/js-apis-lightweightset.md) - - [@ohos.util.LinkedList](reference/apis/js-apis-linkedlist.md) - - [@ohos.util.List](reference/apis/js-apis-list.md) - - [@ohos.util.PlainArray](reference/apis/js-apis-plainarray.md) - - [@ohos.util.Queue](reference/apis/js-apis-queue.md) - - [@ohos.util.Stack](reference/apis/js-apis-stack.md) - - [@ohos.util.TreeMap](reference/apis/js-apis-treemap.md) - - [@ohos.util.TreeSet](reference/apis/js-apis-treeset.md) - - [@ohos.util.Vector](reference/apis/js-apis-vector.md) - - [@ohos.worker](reference/apis/js-apis-worker.md) - - [@ohos.xml](reference/apis/js-apis-xml.md) + - [@ohos.buffer (Buffer)](reference/apis/js-apis-buffer.md) + - [@ohos.convertxml (XML-to-JavaScript Conversion)](reference/apis/js-apis-convertxml.md) + - [@ohos.process (Obtaining Process Information)](reference/apis/js-apis-process.md) + - [@ohos.taskpool (Using the Task Pool)](reference/apis/js-apis-taskpool.md) + - [@ohos.uri (URI String Parsing)](reference/apis/js-apis-uri.md) + - [@ohos.url (URL String Parsing)](reference/apis/js-apis-url.md) + - [@ohos.util (util)](reference/apis/js-apis-util.md) + - [@ohos.util.ArrayList (Linear Container ArrayList)](reference/apis/js-apis-arraylist.md) + - [@ohos.util.Deque (Linear Container Deque)](reference/apis/js-apis-deque.md) + - [@ohos.util.HashMap (Nonlinear Container HashMap)](reference/apis/js-apis-hashmap.md) + - [@ohos.util.HashSet (Nonlinear Container HashSet)](reference/apis/js-apis-hashset.md) + - [@ohos.util.LightWeightMap (Nonlinear Container LightWeightMap)](reference/apis/js-apis-lightweightmap.md) + - [@ohos.util.LightWeightSet (Nonlinear Container LightWeightSet)](reference/apis/js-apis-lightweightset.md) + - [@ohos.util.LinkedList (Linear Container LinkedList)](reference/apis/js-apis-linkedlist.md) + - [@ohos.util.List (Linear Container List)](reference/apis/js-apis-list.md) + - [@ohos.util.PlainArray (Nonlinear Container PlainArray)](reference/apis/js-apis-plainarray.md) + - [@ohos.util.Queue (Linear Container Queue)](reference/apis/js-apis-queue.md) + - [@ohos.util.Stack (Linear Container Stack)](reference/apis/js-apis-stack.md) + - [@ohos.util.TreeMap (Nonlinear Container TreeMap)](reference/apis/js-apis-treemap.md) + - [@ohos.util.TreeSet (Nonlinear Container TreeSet)](reference/apis/js-apis-treeset.md) + - [@ohos.util.Vector (Linear Container Vector)](reference/apis/js-apis-vector.md) + - [@ohos.worker (Worker Startup)](reference/apis/js-apis-worker.md) + - [@ohos.xml (XML Parsing and Generation)](reference/apis/js-apis-xml.md) - Test - [@ohos.application.testRunner (TestRunner)](reference/apis/js-apis-application-testRunner.md) - [@ohos.uitest](reference/apis/js-apis-uitest.md) - APIs No Longer Maintained - - [@ohos.backgroundTaskManager](reference/apis/js-apis-backgroundTaskManager.md) - - [@ohos.bundle](reference/apis/js-apis-Bundle.md) - - [@ohos.bundle.innerBundleManager](reference/apis/js-apis-Bundle-InnerBundleManager.md) - - [@ohos.bundleState](reference/apis/js-apis-deviceUsageStatistics.md) - - [@ohos.bytrace](reference/apis/js-apis-bytrace.md) - - [@ohos.data.storage](reference/apis/js-apis-data-storage.md) - - [@ohos.data.distributedData](reference/apis/js-apis-distributed-data.md) - - [@ohos.distributedBundle](reference/apis/js-apis-Bundle-distributedBundle.md) - - [@ohos.document](reference/apis/js-apis-document.md) - - [@ohos.geolocation](reference/apis/js-apis-geolocation.md) - - [@ohos.hiAppEvent](reference/apis/js-apis-hiappevent.md) - - [@ohos.prompt](reference/apis/js-apis-prompt.md) - - [@ohos.reminderAgent](reference/apis/js-apis-reminderAgent.md) - - [@ohos.systemParameter](reference/apis/js-apis-system-parameter.md) - - [@ohos.usb](reference/apis/js-apis-usb-deprecated.md) - - [@ohos.workScheduler](reference/apis/js-apis-workScheduler.md) - - [@system.app](reference/apis/js-apis-system-app.md) - - [@system.battery](reference/apis/js-apis-system-battery.md) - - [@system.bluetooth](reference/apis/js-apis-system-bluetooth.md) - - [@system.brightness](reference/apis/js-apis-system-brightness.md) - - [@system.configuration](reference/apis/js-apis-system-configuration.md) - - [@system.device](reference/apis/js-apis-system-device.md) - - [@system.fetch](reference/apis/js-apis-system-fetch.md) - - [@system.file](reference/apis/js-apis-system-file.md) - - [@system.geolocation](reference/apis/js-apis-system-location.md) - - [@system.mediaquery](reference/apis/js-apis-system-mediaquery.md) - - [@system.network](reference/apis/js-apis-system-network.md) - - [@system.notification](reference/apis/js-apis-system-notification.md) - - [@system.package](reference/apis/js-apis-system-package.md) - - [@system.prompt](reference/apis/js-apis-system-prompt.md) - - [@system.request](reference/apis/js-apis-system-request.md) - - [@system.router](reference/apis/js-apis-system-router.md) - - [@system.sensor](reference/apis/js-apis-system-sensor.md) - - [@system.storage](reference/apis/js-apis-system-storage.md) - - [@system.vibrator](reference/apis/js-apis-system-vibrate.md) + - [@ohos.backgroundTaskManager (Background Task Management)](reference/apis/js-apis-backgroundTaskManager.md) + - [@ohos.bundle (Bundle)](reference/apis/js-apis-Bundle.md) + - [@ohos.bundle.innerBundleManager (innerBundleManager)](reference/apis/js-apis-Bundle-InnerBundleManager.md) + - [@ohos.bundleState (Device Usage Statistics)](reference/apis/js-apis-deviceUsageStatistics.md) + - [@ohos.bytrace (Performance Tracing)](reference/apis/js-apis-bytrace.md) + - [@ohos.data.distributedData (Distributed Data Management)](reference/apis/js-apis-distributed-data.md) + - [@ohos.data.storage (Lightweight Data Storage)](reference/apis/js-apis-data-storage.md) + - [@ohos.data.rdb (RDB)](reference/apis/js-apis-data-rdb.md) + - [@ohos.distributedBundle (Distributed Bundle Management)](reference/apis/js-apis-Bundle-distributedBundle.md) + - [@ohos.document (File Operation)](reference/apis/js-apis-document.md) + - [@ohos.fileio (File Management)](reference/apis/js-apis-fileio.md) + - [@ohos.geolocation (Geolocation)](reference/apis/js-apis-geolocation.md) + - [@ohos.hiAppEvent (Application Event Logging)](reference/apis/js-apis-hiappevent.md) + - [@ohos.prompt (Prompt)](reference/apis/js-apis-prompt.md) + - [@ohos.reminderAgent (Reminder Agent)](reference/apis/js-apis-reminderAgent.md) + - [@ohos.statfs (statfs)](reference/apis/js-apis-statfs.md) + - [@ohos.systemParameter (System Parameter)](reference/apis/js-apis-system-parameter.md) + - [@ohos.systemTime (System Time and Time Zone)](reference/apis/js-apis-system-time.md) + - [@ohos.usb (USB Management)](reference/apis/js-apis-usb-deprecated.md) + - [@ohos.usbV9 (USB Management)](reference/apis/js-apis-usb.md) + - [@system.app (Application Context)](reference/apis/js-apis-system-app.md) + - [@system.battery (Battery Information)](reference/apis/js-apis-system-battery.md) + - [@system.bluetooth (Bluetooth)](reference/apis/js-apis-system-bluetooth.md) + - [@system.brightness (Screen Brightness)](reference/apis/js-apis-system-brightness.md) + - [@system.configuration (Application Configuration)](reference/apis/js-apis-system-configuration.md) + - [@system.device (Device Information)](reference/apis/js-apis-system-device.md) + - [@system.fetch (Data Request)](reference/apis/js-apis-system-fetch.md) + - [@system.file (File Storage)](reference/apis/js-apis-system-file.md) + - [@system.geolocation (Geographic Location)](reference/apis/js-apis-system-location.md) + - [@system.mediaquery (Media Query)](reference/apis/js-apis-system-mediaquery.md) + - [@system.network (Network State)](reference/apis/js-apis-system-network.md) + - [@system.notification (Notification)](reference/apis/js-apis-system-notification.md) + - [@system.package (Bundle Management)](reference/apis/js-apis-system-package.md) + - [@system.prompt (Prompt)](reference/apis/js-apis-system-prompt.md) + - [@system.request (Upload and Download)](reference/apis/js-apis-system-request.md) + - [@system.router (Page Routing)](reference/apis/js-apis-system-router.md) + - [@system.sensor (Sensor)](reference/apis/js-apis-system-sensor.md) + - [@system.storage (Data Storage)](reference/apis/js-apis-system-storage.md) + - [@system.vibrator (Vibrator)](reference/apis/js-apis-system-vibrate.md) - bundle - [abilityInfo](reference/apis/js-apis-bundle-AbilityInfo.md) - [applicationInfo](reference/apis/js-apis-bundle-ApplicationInfo.md) @@ -1152,6 +1159,7 @@ - [zlib Error Codes](reference/errorcodes/errorcode-zlib.md) - Common Events and Notification - [Event Error Codes](reference/errorcodes/errorcode-CommonEventService.md) + - [Notification Error Codes](reference/errorcodes/errorcode-notification.md) - [DistributedNotificationService Error Codes](reference/errorcodes/errorcode-DistributedNotificationService.md) - UI Page - [Animator Error Codes](reference/errorcodes/errorcode-animator.md) @@ -1170,11 +1178,14 @@ - [Resource Manager Error Codes](reference/errorcodes/errorcode-resource-manager.md) - Resource Scheduling - [backgroundTaskManager Error Codes](reference/errorcodes/errorcode-backgroundTaskMgr.md) + - [DeviceUsageStatistics Error Codes](reference/errorcodes/errorcode-DeviceUsageStatistics.md) - [reminderAgentManager Error Codes](reference/errorcodes/errorcode-reminderAgentManager.md) - [workScheduler Error Codes](reference/errorcodes/errorcode-workScheduler.md) - Security - [Ability Access Control Error Codes](reference/errorcodes/errorcode-access-token.md) - [HUKS Error Codes](reference/errorcodes/errorcode-huks.md) + - [Crypto Framework Error Codes](reference/errorcodes/errorcode-crypto-framework.md) + - [Certificate Error Codes](reference/errorcodes/errorcode-cert.md) - [User Authentication Error Codes](reference/errorcodes/errorcode-useriam.md) - Data Management - [RDB Error Codes](reference/errorcodes/errorcode-data-rdb.md) @@ -1197,7 +1208,7 @@ - [HiDebug Error Codes](reference/errorcodes/errorcode-hiviewdfx-hidebug.md) - [Input Method Framework Error Codes](reference/errorcodes/errorcode-inputmethod-framework.md) - [Pasteboard Error Codes](reference/errorcodes/errorcode-pasteboard.md) - - [Screen Lock Management Error Codes](reference/errorcodes/errorcode-screenlock.md) + - [Time and Time Zone Service Error Codes](reference/errorcodes/errorcode-time.md) - [Webview Error Codes](reference/errorcodes/errorcode-webview.md) - Account Management - [Account Error Codes](reference/errorcodes/errorcode-account.md) @@ -1216,12 +1227,10 @@ - [System Parameter Error Codes](reference/errorcodes/errorcode-system-parameterV9.md) - [USB Error Codes](reference/errorcodes/errorcode-usb.md) - [Update Error Codes](reference/errorcodes/errorcode-update.md) - - [DeviceUsageStatistics Error Codes](reference/errorcodes/errorcode-DeviceUsageStatistics.md) - Customization Management - [Enterprise Device Management Error Codes](reference/errorcodes/errorcode-enterpriseDeviceManager.md) - Language Base Class Library - - [Buffer Error Codes](reference/errorcodes/errorcode-buffer.md) - - [Containers Error Codes](reference/errorcodes/errorcode-containers.md) + - [Utils Error Codes](reference/errorcodes/errorcode-utils.md) - Test - [UiTest Error Codes](reference/errorcodes/errorcode-uitest.md) - Native APIs diff --git a/en/application-dev/windowmanager/window-overview.md b/en/application-dev/windowmanager/window-overview.md index 5a2e75770469377d96c58bf93650c7a47a171e3f..a585f4c7cbde39f74123cacb4d76c2a001290539 100644 --- a/en/application-dev/windowmanager/window-overview.md +++ b/en/application-dev/windowmanager/window-overview.md @@ -36,7 +36,9 @@ In OpenHarmony, the **Window** module provides system windows and application wi - A **system window** implements specific functionalities of the system, such as the volume bar, wallpaper, notification panel, status bar, and navigation bar. - An **application window** is related to the application display. Based on the displayed content, application windows are further classified into main windows and subwindows. - A main window shows the application UI and appears on the **Recent tasks** page. - - A subwindow shows auxiliary windows such as dialog boxes and floating windows of an application. It is not displayed on the **Task Management** page. + - A subwindow shows auxiliary windows such as dialog boxes and floating windows of an application. It is not displayed on the **Task Management** page. Its lifecycle follows that of the main window. + + ### Application Window Mode diff --git a/en/release-notes/OpenHarmony-v3.2-beta1.md b/en/release-notes/OpenHarmony-v3.2-beta1.md index 55b353757fd8ea063d99eae61469785f506f8ec8..a15db26f84dd3a7191b5c086a72c20f812115689 100644 --- a/en/release-notes/OpenHarmony-v3.2-beta1.md +++ b/en/release-notes/OpenHarmony-v3.2-beta1.md @@ -172,7 +172,7 @@ This version has the following updates to OpenHarmony 3.1 Release. ### API Updates -*[API Differences](api-diff/v3.2-beta1/Readme-EN.md)* +*[API Differences](api-change/v3.2-beta1/Readme-EN.md)* ### Chip and Development Board Adaptation @@ -185,27 +185,26 @@ For details about the adaptation status, see [SIG-Devboard](https://gitee.com/op | Subsystem| Sample| Introduction| Programming Language| | -------- | -------- | -------- | -------- | -| ArkUI | [MouseEvent](https://gitee.com/openharmony/applications_app_samples/tree/master/ETSUI/MouseEvent) | This sample simulates a minesweeper game that calls mouse event-related APIs.| eTS | -| ArkUI | [Vibrator](https://gitee.com/openharmony/applications_app_samples/tree/master/device/Vibrator) | This sample simulates the countdown scenario to show the use of the vibrator APIs.| eTS | -| DFX | [FaultLogger](https://gitee.com/openharmony/applications_app_samples/tree/master/DFX/FaultLogger) | This sample illustrates how to obtain fault information of an application in eTS.| eTS | -| ArkUI | [Gallery](https://gitee.com/openharmony/applications_app_samples/tree/master/ETSUI/Gallery) | This sample demonstrates the functions of different components such as universal events, universal attributes, and gestures.| eTS | -| Graphics| [JsWebGL](https://gitee.com/openharmony/applications_app_samples/tree/master/Graphics/JsWebGL) | This sample shows how to use WebGL APIs to draw pentagrams and rectangles by invoking GPU resources.| JS | -| ArkUI | [Clock](https://gitee.com/openharmony/applications_app_samples/tree/master/Preset/Clock) | This sample exemplifies how to implement a simple clock application using the eTS UI capability.| eTS | -| Network management| [Http](https://gitee.com/openharmony/applications_app_samples/tree/master/Network/Http) | This sample simulates Postman, which requires the input of an API address and outputs the data obtained, to show the use of the data request APIs.| eTS | -| Network management| [Socket](https://gitee.com/openharmony/applications_app_samples/tree/master/Network/Socket) | This sample demonstrates the application of Socket in network communication, including connection authentication and chat communication between two devices.| eTS | -| Distributed data management| [DistributedRdb](https://gitee.com/openharmony/applications_app_samples/tree/master/data/DistributedRdb) | This sample shows how to add, delete, modify, query, and synchronize data in the distributed relational database with eTS.| eTS | -| Ability| [BackgroundTaskManager](https://gitee.com/openharmony/applications_app_samples/tree/master/ResourcesSchedule/BackgroundTaskManager) | This sample simulates the download function. Being processed by the background task management, a download task can continue after the application exits. It stops until the download is complete.| eTS | -| Ability| [BringApp](https://gitee.com/openharmony/applications_app_samples/tree/master/ETSUI/BringApp) | This sample uses the **FeatureAbility** APIs to start a system application based on the application's bundle name and ability name.| eTS | -| Media| [VideoPlayer](https://gitee.com/openharmony/applications_app_samples/tree/master/media/VideoPlayer) | This sample shows how to play a video using the **VideoPlayer** APIs in eTS. It also provides an ability that can be invoked by other applications to play the video.| eTS | -| Ability| [DistributeCalc](https://gitee.com/openharmony/applications_app_samples/tree/master/Preset/DistributeCalc) | This sample implements a simple calculator application using JS distributed features. The calculator can perform simple numerical calculations and start a remote calculator FA to perform collaborative calculation.| eTS | -| Web | [Browser](https://gitee.com/openharmony/applications_app_samples/tree/master/device/Browser) | This sample uses the stage model and related APIs to show a simple browser.| eTS | -| Ability| [DeviceUsageStatistics](https://gitee.com/openharmony/applications_app_samples/tree/master/device/DeviceUsageStatistics) | This sample shows the device usage statistics.| eTS | -| ArkUI | [AdaptiveCapabilities](https://gitee.com/openharmony/applications_app_samples/tree/master/MultiDeviceAppDev/AdaptiveCapabilities) | This sample shows multi-device adaptation in eTS, including resource qualifiers, atomic layouts, and responsive layouts.| eTS | -| ArkUI | [Game2048](https://gitee.com/openharmony/applications_app_samples/tree/master/ETSUI/Game2048) | This sample shows how to develop a 2048 game using the **\** component.| eTS | -| Window Manager| [Window](https://gitee.com/openharmony/applications_app_samples/tree/master/Graphics/Window) | This sample shows how to create a window, display an application over another application in the form of a floating window, and display an application on split screens.| eTS | -| Distributed data management| [Preference](https://gitee.com/openharmony/applications_app_samples/tree/master/data/Preferences) | This sample shows the theme switching function of preferences.| eTS | -| ArkUI | [NativeAPI](https://gitee.com/openharmony/app_samples/tree/master/Native/NativeAPI) | This sample shows how to call C++ APIs in eTS and how C++ APIs call back JS APIs to play the Gomoku game. The native APIs implement the calculation logic, and eTS implements UI rendering and re-rendering.| eTS/C++ | -| Globalization| [International](https://gitee.com/openharmony/applications_app_samples/tree/master/common/International) | This sample shows how to use APIs related to i18n, intl, and resourceManager in eTS to set the system language, region, time, and time zone. It also provides locale setting examples.| eTS | +| ArkUI | [MouseEvent](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/ETSUI/MouseEvent) | This sample simulates a minesweeper game that calls mouse event-related APIs.| eTS | +| ArkUI | [Vibrator](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/device/Vibrator) | This sample simulates the countdown scenario to show the use of the vibrator APIs.| eTS | +| DFX | [FaultLogger](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/DFX/FaultLogger) | This sample illustrates how to obtain fault information of an application in eTS.| eTS | +| ArkUI | [Gallery](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/ETSUI/Gallery) | This sample demonstrates the functions of different components such as universal events, universal attributes, and gestures.| eTS | +| Graphics| [JsWebGL](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/Graphics/JsWebGL) | This sample shows how to use WebGL APIs to draw pentagrams and rectangles by invoking GPU resources.| JS | +| ArkUI | [Clock](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/Preset/Clock) | This sample exemplifies how to implement a simple clock application using the eTS UI capability.| eTS | +| Network management| [Http](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/Network/Http) | This sample simulates Postman, which requires the input of an API address and outputs the data obtained, to show the use of the data request APIs.| eTS | +| Network management| [Socket](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/Network/Socket) | This sample demonstrates the application of Socket in network communication, including connection authentication and chat communication between two devices.| eTS | +| Distributed data management| [DistributedRdb](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/data/DistributedRdb) | This sample shows how to add, delete, modify, query, and synchronize data in the distributed relational database with eTS.| eTS | +| Ability| [BackgroundTaskManager](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/ResourcesSchedule/BackgroundTaskManager) | This sample simulates the download function. Being processed by the background task management, a download task can continue after the application exits. It stops until the download is complete.| eTS | +| Ability| [BringApp](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/ETSUI/BringApp) | This sample uses the **FeatureAbility** APIs to start a system application based on the application's bundle name and ability name.| eTS | +| Media| [VideoPlayer](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/media/VideoPlayer) | This sample shows how to play a video using the **VideoPlayer** APIs in eTS. It also provides an ability that can be invoked by other applications to play the video.| eTS | +| Ability| [DistributeCalc](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/Preset/DistributeCalc) | This sample implements a simple calculator application using JS distributed features. The calculator can perform simple numerical calculations and start a remote calculator FA to perform collaborative calculation.| eTS | +| Web | [Browser](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/device/Browser) | This sample uses the stage model and related APIs to show a simple browser.| eTS | +| Ability| [DeviceUsageStatistics](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/device/DeviceUsageStatistics) | This sample shows the device usage statistics.| eTS | +| ArkUI | [AdaptiveCapabilities](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/MultiDeviceAppDev/AdaptiveCapabilities) | This sample shows multi-device adaptation in eTS, including resource qualifiers, atomic layouts, and responsive layouts.| eTS | +| ArkUI | [Game2048](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/ETSUI/Game2048) | This sample shows how to develop a 2048 game using the **\** component.| eTS | +| Window Manager| [Window](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/Graphics/Window) | This sample shows how to create a window, display an application over another application in the form of a floating window, and display an application on split screens.| eTS | +| Distributed data management| [Preference](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/data/Preferences) | This sample shows the theme switching function of preferences.| eTS | +| Globalization| [International](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/common/International) | This sample shows how to use APIs related to i18n, intl, and resourceManager in eTS to set the system language, region, time, and time zone. It also provides locale setting examples.| eTS | For more information, visit [Samples](https://gitee.com/openharmony/applications_app_samples). diff --git a/en/release-notes/OpenHarmony-v3.2-beta3.md b/en/release-notes/OpenHarmony-v3.2-beta3.md index 506724c24b4a915053f0e7733157e398642e7a01..a948b348ed55bb6ee4c70ff2a59d118dd052b955 100644 --- a/en/release-notes/OpenHarmony-v3.2-beta3.md +++ b/en/release-notes/OpenHarmony-v3.2-beta3.md @@ -176,7 +176,7 @@ This version has the following updates to OpenHarmony 3.2 Beta2. For details about the API changes, see the following: -[API Differences](api-diff/v3.2-beta3/js-apidiff-ability.md) +[API Differences](api-change/v3.2-beta3/js-apidiff-ability.md) ### Chip and Development Board Adaptation @@ -190,15 +190,15 @@ For details about the adaptation status, see [SIG-Devboard](https://gitee.com/op | Subsystem| Name| Introduction| Programming Language| | -------- | -------- | -------- | -------- | -| ArkUI development framework| [HealthyDiet](https://gitee.com/openharmony/applications_app_samples/tree/master/ETSUI/HealthyDiet)| This sample app helps you keep food records and view food information. After you add food records, including the food type, weight, and meal time, the app can calculate nutrition data (calories, proteins, fats, and carbon water) for the meals and display the data in a bar chart.| eTS | -| ArkUI development framework| [MusicAlbum](https://gitee.com/openharmony/applications_app_samples/tree/master/MultiDeviceAppDev/MusicAlbum)| This sample shows the home page of a music album app. The adaptive layout and responsive layout are used to ensure that the app can be properly displayed on devices irrespective of screen sizes.| eTS | -| Ability framework and file management subsystem| [Share](https://gitee.com/openharmony/applications_app_samples/tree/master/Share/CustomShare)| Using this sample app, you can share texts, links, and images with third-party applications and display them in these applications.| eTS | -| Ability framework| [GalleryForm](https://gitee.com/openharmony/applications_app_samples/tree/master/ability/GalleryForm)| This sample demonstrates the display of **Gallery** images in a widget and periodic update of the widget.| eTS | -| ArkUI development framework| [AppMarket](https://gitee.com/openharmony/applications_app_samples/tree/master/MultiDeviceAppDev/AppMarket)| This sample shows the home page of an application market, which contains the tab bar, banner, featured apps, and featured games.| eTS | -| ArkUI development framework| [Weather](https://gitee.com/openharmony/applications_app_samples/tree/master/MultiDeviceAppDev/Weather)| This sample demonstrates one-time development for multi-device deployment by showing how to develop a weather app and deploy it across different devices. The demo app includes the following: home page, **Manage City** page, **Add City** page, and **Update Time** page.| eTS | -| Multimedia subsystem| [MediaCollections](https://gitee.com/openharmony/applications_app_samples/tree/master/media/MediaCollections)| This sample shows the capabilities of online streaming, audio and video playback control, and volume adjustment.| eTS | - -For more information, visit [Samples](https://gitee.com/openharmony/app_samples). +| ArkUI development framework| [HealthyDiet](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/ETSUI/HealthyDiet)| This sample app helps you keep food records and view food information. After you add food records, including the food type, weight, and meal time, the app can calculate nutrition data (calories, proteins, fats, and carbon water) for the meals and display the data in a bar chart.| eTS | +| ArkUI development framework| [MusicAlbum](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/MultiDeviceAppDev/MusicAlbum)| This sample shows the home page of a music album app. The adaptive layout and responsive layout are used to ensure that the app can be properly displayed on devices irrespective of screen sizes.| eTS | +| Ability framework and file management subsystem| [Share](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/Share/Share)| Using this sample app, you can share texts, links, and images with third-party applications and display them in these applications.| eTS | +| Ability framework| [GalleryForm](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/ability/GalleryForm)| This sample demonstrates the display of **Gallery** images in a widget and periodic update of the widget.| eTS | +| ArkUI development framework| [AppMarket](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/MultiDeviceAppDev/AppMarket)| This sample shows the home page of an application market, which contains the tab bar, banner, featured apps, and featured games.| eTS | +| ArkUI development framework| [Weather](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/MultiDeviceAppDev/Weather)| This sample demonstrates one-time development for multi-device deployment by showing how to develop a weather app and deploy it across different devices. The demo app includes the following: home page, **Manage City** page, **Add City** page, and **Update Time** page.| eTS | +| Multimedia subsystem| [MediaCollections](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/media/MediaCollections)| This sample shows the capabilities of online streaming, audio and video playback control, and volume adjustment.| eTS | + +For more information, visit [Samples](https://gitee.com/openharmony/applications_app_samples). ## Resolved Issues diff --git a/en/release-notes/OpenHarmony-v3.2-beta4.md b/en/release-notes/OpenHarmony-v3.2-beta4.md index c92fa7205174bab896b300e5641f368c70918ffd..b9d43f67927872d9bc263d86a7db1d144a25edd2 100644 --- a/en/release-notes/OpenHarmony-v3.2-beta4.md +++ b/en/release-notes/OpenHarmony-v3.2-beta4.md @@ -184,13 +184,6 @@ This version has the following updates to OpenHarmony 3.2 Beta3. | DFX | - HiTrace provides a unified dotting interface and call link interface.
- The power consumption data and system event data can be collected.
- Perf data can be collected during the startup of the JS HAP.
The following requirements are involved:
I5X4TY [New feature] Unified dotting interface of HiTrace: HiTraceMeter
I5X4U1 [New feature] Unified call link interface of HiTrace: HiTraceChain
I5X4TD [New feature] Power consumption data collection
I5X4TE [New feature] System event data collection
I5X4TL [New feature] Collection of perf data during JS HAP startup| NA | - -For details about the API changes, see the following: - -[API Differences](api-diff/v3.2-beta4/js-apidiff-ability.md) - - - ### Chip and Development Board Adaptation For details about the adaptation status, see [SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig-devboard/sig_devboard.md). @@ -201,21 +194,13 @@ The following samples written in ArkTS are added. **Table 4** New samples -| Subsystem
| Name| Introduction| +| Subsystem | Name| Introduction| | -------- | -------- | -------- | -| Common event and notification subsystem| [Event Notification](https://gitee.com/openharmony/applications_app_samples/tree/master/Notification/CustomEmitter)| This sample shows the in-process event notification. After a user selects an offering and submits an order, the selected offering is displayed in the order list.| -| Data management subsystem| [Cross-Application Data Sharing](https://gitee.com/openharmony/applications_app_samples/tree/master/data/CrossAppDataShare)| This sample implements cross-application data sharing. It provides contacts (data provider) and contacts assistant (data user). Contacts support functionalities such as adding, deleting, modifying, and querying contacts data. Contacts assistant supports contacts data synchronization and merging of duplicate data.| -| Multimedia subsystem| [Background Music Playback](https://gitee.com/openharmony/applications_app_samples/tree/master/ResourcesSchedule/PlayMusicBackground)| This sample implements the request for a continuous task to continue music playback in the background. It is based on the stage model.| -| Resource scheduler subsystem| [Agent-Powered Scheduled Reminder](https://gitee.com/openharmony/applications_app_samples/tree/master/ResourcesSchedule/ReminderAgentManager)| This sample uses agent-powered scheduled reminder to create three types of scheduled reminders: alarm clocks, calendar events, and countdown timers. Agent-powered scheduled reminder ensures that the timing and pop-up notification functions will be performed by the system service agent in the background when the application is frozen or exits.| -| File management subsystem| [Storage Space Statistics](https://gitee.com/openharmony/applications_app_samples/tree/master/FileManager/StorageStatistic)| This sample uses the application package management, application space statistics, and volume management modules to implement the viewing of storage space information of the current device, all installed applications, and all available volumes.| -| Window manager| [Screenshot](https://gitee.com/openharmony/applications_app_samples/tree/master/Graphics/Screenshot)| This sample uses the screenshot, window, and display modules to take screenshots, switch the privacy window, and query the privacy window, in sequence.| -| Bundle management framework| [Multi-HAP](https://gitee.com/openharmony/applications_app_samples/tree/master/bundle/MultiHap)| This sample shows the development of multi-HAP. The sample app includes one entry HAP and two feature HAPs. The two feature HAPs provide audio and video playback components, respectively. The two components are also used in the entry component.| -| Ability framework| [Ability Launch Mode](https://gitee.com/openharmony/applications_app_samples/tree/master/ability/AbilityStartMode)| This sample shows how to implement the standard, singleton, and specified ability launch modes in the stage model.| -| Resource management| [Application Theme Switch](https://gitee.com/openharmony/applications_app_samples/tree/master/ETSUI/ApplicationThemeSwitch)| This sample creates the **dark** and **light** folders at the same level as the **base** folder to configure resources related to the dark and light themes. The custom theme file is configured in the **ThemeConst** file to implement multi-theme switching by controlling variables.| - -For more information, visit [Samples](https://gitee.com/openharmony/app_samples). - +| Common event and notification subsystem| [Emitter: Prcessing In-Process Events](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/Notification/Emitter) | This sample shows the in-process event notification. After a user selects an offering and submits an order, the selected offering is displayed in the order list.| +| Resource scheduler subsystem| [AlarmClock: Agent-Powered Scheduled Reminder](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/Notification/AlarmClock)| This sample uses agent-powered scheduled reminder to create an alarm clock. Agent-powered scheduled reminder ensures that the timing and pop-up notification functions will be performed by the system service agent in the background when the application is frozen or exits. | +| Window manager| [Window](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/Graphics/Window)| This sample shows how to create a window and display an app in a floating window or split-screen mode.| +For more information, visit [Samples](https://gitee.com/openharmony/applications_app_samples). ## Resolved Issues diff --git a/en/release-notes/OpenHarmony-v3.2-beta5.md b/en/release-notes/OpenHarmony-v3.2-beta5.md new file mode 100644 index 0000000000000000000000000000000000000000..c00788dab41d31b9a3654320306fbbf7f6e040ab --- /dev/null +++ b/en/release-notes/OpenHarmony-v3.2-beta5.md @@ -0,0 +1,211 @@ +# OpenHarmony 3.2 Beta5 + + +## Version Description + +OpenHarmony 3.2 Beta5 provides the following enhancements over OpenHarmony 3.2 Beta4: + +**Enhanced basic capabilities for the standard system** + +The startup performance of the WebView component is optimized. Configuration management and input event support capabilities are enhanced. JSON files can be imported and loaded in modular mode. + +The task pool and the TS2AOT-tool of the host version are provided. The dynamic library of the HAP package can be loaded without being compressed. The compiler runtime supports shared packages in the same application. + +The dynamic shared library can be installed, updated, uninstalled, packed, and unpacked. For an application that is not configured with an entry icon, a default icon is displayed on the home screen. The runtime capability of the HAR shared package can be verified. + +The local database is changed for widgets. Protection against frequent restart is provided for applications. The ServiceExtensionAbility component supports the asynchronous **onConnected** lifecycle. + +Binding and authentication between local accounts and domain accounts are supported. A basic framework is provided for domain account management services. Direct creation of local users is forbidden. + +The capabilities for controlling power indicators and lights are provided. + +The HDI driver display layer supports horizontal mirroring and vertical mirroring. + +**Enhanced application development framework for the standard system** + +The process of compiling the shared package is added to the toolchain. + +ArkUI supports obtaining of resources by resource name. + +The component supports multi-level menus and group menus. + +The process of compiling the HAR package is added. + +The HAP compilation process is adapted so that .d.ets declaration files can be identified during HAP compilation. + +**Enhanced distributed capabilities for the standard system** + +BLE connection parameters can be configured, and the connection process is optimized. + + +## Version Mapping + +**Table 1** Version mapping of software and tools + +| Software/Tool| Version| Remarks| +| -------- | -------- | -------- | +| OpenHarmony | 3.2 Beta5 | NA | +| Public SDK | Ohos_sdk_public 3.2.10.6 (API Version 9 Beta5) | This toolkit is intended for application developers and does not contain system APIs that require system permissions. It is provided as standard in DevEco Studio.| +| (Optional) HUAWEI DevEco Studio| *To be released*| Recommended for developing OpenHarmony applications| +| (Optional) HUAWEI DevEco Device Tool| *To be released*| Recommended for developing OpenHarmony smart devices| + + +## Source Code Acquisition + + +### Prerequisites + +1. Register your account with Gitee. + +2. Register an SSH public key for access to Gitee. + +3. Install the [git client](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) and [git-lfs](https://gitee.com/vcs-all-in-one/git-lfs?_from=gitee_search#downloading), and configure user information. + + ``` + git config --global user.name "yourname" + git config --global user.email "your-email-address" + git config --global credential.helper store + ``` + +4. Run the following commands to install the **repo** tool: + + ``` + curl -s https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 > /usr/local/bin/repo # If you do not have the permission, download the tool to another directory and configure it as an environment variable by running the chmod a+x /usr/local/bin/repo command. + pip3 install -i https://repo.huaweicloud.com/repository/pypi/simple requests + ``` + + +### Acquiring Source Code Using the repo Tool + +**Method 1 (recommended)** + +Use the **repo** tool to download the source code over SSH. (You must have an SSH public key for access to Gitee.) + +- Obtain the source code from the version branch. You can obtain the latest source code of the version branch, which includes the code that has been incorporated into the branch up until the time you run the following commands: + ``` + repo init -u git@gitee.com:openharmony/manifest.git -b OpenHarmony-3.2-Beta5 --no-repo-verify + repo sync -c + repo forall -c 'git lfs pull' + ``` + +- Obtain the source code from the version tag, which is the same as that released with the version. + ``` + repo init -u git@gitee.com:openharmony/manifest.git -b refs/tags/OpenHarmony-v3.2-Beta5 --no-repo-verify + repo sync -c + repo forall -c 'git lfs pull' + ``` + +**Method 2** + +Use the **repo** tool to download the source code over HTTPS. + +- Obtain the source code from the version branch. You can obtain the latest source code of the version branch, which includes the code that has been incorporated into the branch up until the time you run the following commands: + ``` + repo init -u https://gitee.com/openharmony/manifest -b OpenHarmony-3.2-Beta5 --no-repo-verify + repo sync -c + repo forall -c 'git lfs pull' + ``` + +- Obtain the source code from the version tag, which is the same as that released with the version. + ``` + repo init -u https://gitee.com/openharmony/manifest -b refs/tags/OpenHarmony-v3.2-Beta5 --no-repo-verify + repo sync -c + repo forall -c 'git lfs pull' + ``` + + +### Acquiring Source Code from Mirrors + +**Table 2** Mirrors for acquiring source code + +| Source Code | Version| Mirror | SHA-256 Checksum | Software Package Size| +| --------------------------------------- | ------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | -------- | +| Full code base (for mini, small, and standard systems) | 3.2 Beta5 | [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Beta5/code-v3.2-Beta5.tar.gz) | [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Beta5/code-v3.2-Beta5.tar.gz.sha256) | 21.3 GB | +| Hi3861 solution (binary) | 3.2 Beta5 | [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Beta5/hispark_pegasus.tar.gz) | [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Beta5/hispark_pegasus.tar.gz.sha256) | 22.9 MB | +| Hi3516 solution-LiteOS (binary)| 3.2 Beta5 | [Download](https://repo.huaweicloud.com/openharmony/os/3.2-Beta5/hispark_taurus_LiteOS.tar.gz) | [Download](https://repo.huaweicloud.com/openharmony/os/3.2-Beta5/hispark_taurus_LiteOS.tar.gz.sha256) | 293.6 MB | +| Hi3516 solution-Linux (binary) | 3.2 Beta5 | [Download](hispark_taurus_Linux.tar.gz) | [Download](https://repo.huaweicloud.com/openharmony/os/3.2-Beta5/hispark_taurus_Linux.tar.gz.sha256) | 174.3 MB | +| RK3568 standard system solution (binary) | 3.2 Beta5 | [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Beta5/dayu200_standard_arm32_20230201.tar.gz) | [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Beta5/dayu200_standard_arm32_20230201.tar.gz.sha256) | 3.9 GB | +| Public SDK package for the standard system (macOS) | 3.2.10.6 | [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Beta5/ohos-sdk-mac-public.tar.gz) | [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Beta5/ohos-sdk-mac-public.tar.gz.sha256) | 674.5 MB | +| Public SDK package for the standard system (macOS-M1) | 3.2.10.6 | [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Beta5/L2-SDK-MAC-M1-PUBLIC.tar.gz)| [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Beta5/L2-SDK-MAC-M1-PUBLIC.tar.gz.sha256)| 634.5 MB | +| Public SDK package for the standard system (Windows\Linux) | 3.2.10.6 | [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Beta5/ohos-sdk-windows_linux-public.tar.gz) | [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Beta5/ohos-sdk-windows_linux-public.tar.gz.sha256) | 1.6 GB | + + + +## **What's New** + +This version has the following updates to OpenHarmony 3.2 Beta4. + +### SDK Updates + +From this version, only the public SDK is released. It can also be downloaded through DevEco Studio. + +To use the full SDK, you must download the source code, build the source code, and switch to the full SDK. For details, see [Guide to Building Full SDK](../application-dev/quick-start/full-sdk-compile-guide.md). + + +### Feature Updates + +**Table 3** New and enhanced features + +| Subsystem| Standard System| Mini and Small Systems| +| -------- | -------- | -------- | +| ArkUI | - Resources can be obtained by resource name.
- The component supports multi-level menus and group menus.
- The compilation capability is enhanced.
The following requirements are involved:
I683Z1 [New function] Adaptation to resource name–based resource retrieval
I68DBH [Basic capability] Providing multi-level menus and group menus
I68DRY [New function] Adding the HAR package compilation process
I68DRY [New function] Adapting to the HAP compilation process so that .d.ets declaration files can be identified during HAP compilation
I68DRY [New function] Adding the shared package compilation process to the toolchain| NA | +| Web subsystem| The WebView component supports the following new capabilities:
- Web pages can be loaded and displayed, including historical records, forward, and backward. Events can be reported during page loading. The webmessage supports the arraybuffer type. The fetch supports custom protocols.
- The following capabilities are added to configuration management: scroll bar and scroll position, network loading interception configuration, determining whether a page contains images, obtaining the source URL, request method, and website icon, and font management.
- The web context menu can obtain the selected content on the page.
- Interaction normalization is available for input events, and original input events are supported.
- Several W3C interfaces are supported.
The following requirements are involved:
I6BFPR [Function enhancement] [WebView component] Web page loading and display (supporting historical records and forward and backward list management)
I6BFRC [Function enhancement] [WebView component] W3C interface support (HTML-partial test cases)
I6BFS6 [Function enhancement] [WebView component] W3C interface support (CSS-partial test cases)
I6BFSK [Function enhancement] [WebView component] Web page loading and display (1. arraybuffer type support by webmessage)
I6BFTS [Function enhancement] [WebView component] W3C interface support (1. appmanifest)
I6BFUD [Function enhancement] [WebView component] Web page loading and display (1. custom protocols for fetch)
I6BFUM [Function enhancement] [WebView component] Status callback for web pages (1. page loading events)
I6BFV4 [Function enhancement] [WebView component] WebView configuration management (1. scroll bar and scroll position)
I6BFXF [Function enhancement] [WebView component] WebView configuration management (1. network loading interception configuration 2. Determining whether a page contains images 3. Obtaining the source URL, request method, and website icon)
I6BFXT [Function enhancement] [WebView component] WebView configuration management (1. font management)
I6BFY9 [Function enhancement] [WebView component] Input event support (1. interaction normalization)
I6BG4H [Function enhancement] [WebView component] Input event support (1. original input events)
I6BG59 [Function enhancement] [WebView component] Selecting and copying content on web pages (1. obtaining selected content from the web context menu)| NA | +| Security| - Mini system devices support authentication session cancellation.
- HUKS supports RSA signature enhancement.
The following requirements are involved:
I65VLX [Function enhancement] Authentication session cancellation for mini system devices
I611S5 [New specifications] RSA signature enhancement by HUKS| NA | +| Bundle management framework| - Implicit query is enhanced.
- Creation of a TS code optimization directory is supported.
- **bundleName** in **provision** can be verified during signature verification.
- A default icon is displayed on the home screen for an application for which no entry icon is configured.
- The following basic capabilities are added: packaging, unpacking, installing, updating, and uninstalling the dynamic shared library, and verifying the runtime capability of the HAR shared package.
The following requirements are involved:
I6BD9G [Basic capability] Enhancement to implicit query
I6BD9E [Basic capability] Creating a TS code optimization directory
I6BD99 [Basic capability] Verifying **bundleName** in **provision** during signature verification
I6BD8Z [Basic capability] Displaying a default icon on the home screen for an application for which no entry icon is configured
I6BD92 [New function] Packaging and unpacking the dynamic shared library
I6BD96 [New specifications] Installing, updating, and uninstalling the dynamic shared library
I6BD9I Verifying the runtime capability of the HAR shared package| NA | +| Building and runtime| - **taskpool**, a TS/JS task pool concurrency API, is added.
- The TSAOT function on the host side is supported. The TSC supports the export and import of .d.ts and .d.ets declaration files.
The following requirements are involved:
I65G6O [Basic capability] [Closed-source HAR package] Export and import of .d.ts and .d.ets declaration files
I64QIR [taskpool] TS/JS task pool concurrency APIs
I65HID [Function enhancement] TS2AOT-tool of the host version| NA | +| Pan-sensor service| The control of a single logical light is supported.
The following requirements are involved:
I63TFA [New specifications] Single logical light control| NA | +| Media| The APIs for playing and recording audio and video are reconstructed.
The following requirements are involved:
I63GTA [Reconstruction] Integration of audio and video playback APIs
I66VL5 [Reconstruction] Integration of audio and video recording APIs| NA | +| Startup subsystem| Symbols are hidden for the NAPI module, and the dependency on the static library module is changed to the dependency on the dynamic library module.
The following requirements are involved:
I698CV [Symbol optimization] Symbols hidden for the NAPI module; changing from the dependency on the static library module to the dependency on the dynamic library module| NA | +| Common event and notification subsystem| The local notification database is changed.
The following requirement is involved:
I67E9A [Basic capability] Local notification database switchover| NA | +| Graphics subsystem| Camera preview image is supported.
The following requirements are involved:
I6BDOH [RenderService] [New function] Camera preview image| NA | +| Location service| The network location framework is supported.
The following requirements are involved:
I5X4S9 [New feature] Network location framework| NA | +| File storage| - Unified URI processing is added for application files.
- Temporary authorization and unified open entry are added for user data.
The following requirements are involved:
I687C8 [New capability] Unified URI processing for application files
I64U8W [Basic capability] Temporary authorization and unified open entry for user data| NA | +| Ability framework| - The restart of resident processes is optimized.
- The widget database can be switched.
- The asynchronous **onConnected** lifecycle is provided.
The following requirements are involved:
I65M3F [Basic capability] ShellCommand execution control
I65V83 [Basic capability] ServiceExtensionAbility support for asynchronous **onConnected** lifecycle
I61H21 [Basic capability] Change of the local widget database
I63UJ5 [Ability] [ability_runtime] Exception handling in API version 8 and earlier versions
I6BDCW [Basic capability] Forbidden to load code in the **data** directory during application loading
I6BDDU [Basic capability] Default ability launch mode of the FA model: Standard
I6BDE2 [Basic capability] Protection against frequent restart of resident applications| NA | + + +### Chip and Development Board Adaptation + +For details about the adaptation status, see [SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig-devboard/sig_devboard.md). + + +### Samples + +**Table 4** New samples + +| Subsystem| Name| Introduction| Programming Language| +| -------- | -------- | -------- | -------- | +| Multimedia subsystem| [Screen Recording](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/media/Scan)| This sample illustrates how to implement screen (including audio) recording. The main task of screen recording is to create a virtual screen, capture graphics frames displayed on the screen, encode the video, and save the encoded video to a file.| ArkTS| +| ArkUI | [Home Page of the Application Market](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/MultiDeviceAppDev/AppMarket) | This sample shows a typical main page of the application market. The page has different display effects in the small window and large window, reflecting the capability of one-time development for multi-device deployment.| ArkTS| +| File management subsystem| [File Management](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/FileManager/FileIo)| This sample demonstrates file management. It uses the [mediaLibrary](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-medialibrary.md), [userFileManager](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-userfilemanager.md) and [fileio](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-fileio.md) APIs to add and access media library files and files in the application sandbox.| ArkTS| +| Ability framework| [AccessibilityExtensionAbility](https://gitee.com/openharmony/applications_app_samples/commits/monthly_20221018/ability/AccessibilityExtAbility)| This sample shows an app developed using the AccessibilityExtensionAbility component. It uses multiple APIs to implement easier interaction.| ArkTS| + + +For more information, visit [Samples](https://gitee.com/openharmony/applications_app_samples). + + +## Resolved Issues + +**Table 5** Resolved issues + +| Issue No.| Description| +| -------- | -------- | +| I5KMQX | [RK3568] The delay for switching from the **Contacts** tab to the **Call**subtab does not meet the requirement.| +| I5UFS1 | Vulnerability CVE-2022-2347 detected during the scanning of the DAS U-Boot component.| +| I5UDY5 | Linux kernel vulnerability: CVE-2022-41218.| +| I5YPMZ | Linux kernel vulnerability: CVE-2022-3344.| + + +## Known Issues + +**Table 6** Known issues + +| Issue No.| Description| Impact| To Be Resolved By| +| -------- | -------- | -------- | -------- | +| I6ATXO | [RK3568] The execution result of the OpenGL test suite contains failed items during XTS test.| The test case used to test the OpenGL interface is not adapted after other modules of the system are changed. The modules or applications that use the OpenGL interface are not affected, and the risk is controllable.| 2023-02-05| +| I6B1IC | [RK3568] [Low probability 1/10] [XTS] The ispserver thread in the /vendor/bin/ispserver process causes a cpp crash in librkaiq.z.so.| In the pressure test, there is a low probability that the ipserver thread causes a cpp crash. The ipserver thread can be automatically restarted, and services are not affected.| 2023-02-05| +| I6BJ9Z
I6BJ82 | alloc_file_pseudo memory leakage occurs.| The accept4 reference count is unbalanced, causing memory leakage on selinux_netlbl_sock_genattr, new_inode_pseudo, and inet_create. No patch is available in the upstream community yet, and the issue will be resolved once a patch is released in the upstream community.| 2023-03-30| +| I641A2
I64726 | The Bluetooth module has silent pairing issues. Other devices can be completely controlled through the Bluetooth keyboard and mouse after silent pairing.| This issue will be resolved in the form of a requirement in later versions.| 2023-03-30| +| I6BRTS | Invoking the **rdb::executeSql** interface may cause memory leakage.| Memory leakage occurs when the **rdb::executeSql** interface is repeatedly called during initialization. This interface is called only during application initialization, and therefore the impact of memory leakage is controllable.| 2023-02-10| +| I6AZ4T | Memory leakage exists for applications with the **\** component.| Memory leakage occurs when the **\** component is repeatedly called at a high frequency. The root cause is that the memory is not reclaimed during the calling of the third-party library flutter. We will first check whether the problem is caused by the open-source flutter component.| 2023-02-10| + + diff --git a/en/release-notes/Readme.md b/en/release-notes/Readme.md index 9488272e72b92c4f3a73baebd22faaa748bf1a91..de2478b990ec99ec4eeb16ad5117796ad1baee82 100644 --- a/en/release-notes/Readme.md +++ b/en/release-notes/Readme.md @@ -1,6 +1,7 @@ # OpenHarmony Release Notes ## OpenHarmony 3.x Releases +- [OpenHarmony v3.2 Beta5 (2023-01-31)](OpenHarmony-v3.2-beta5.md) - [OpenHarmony v3.2 Beta4 (2022-11-30)](OpenHarmony-v3.2-beta4.md) - [OpenHarmony v3.2 Beta3 (2022-09-30)](OpenHarmony-v3.2-beta3.md) - [OpenHarmony v3.2 Beta2 (2022-07-30)](OpenHarmony-v3.2-beta2.md) diff --git a/en/release-notes/api-change/v3.2-beta5/js-apidiff-ability.md b/en/release-notes/api-change/v3.2-beta5/js-apidiff-ability.md new file mode 100644 index 0000000000000000000000000000000000000000..d9b926892f358697064a18f0e9bc51a84a8860a9 --- /dev/null +++ b/en/release-notes/api-change/v3.2-beta5/js-apidiff-ability.md @@ -0,0 +1,266 @@ +| Change Type | Old Version | New Version | d.ts File | +| ---- | ------ | ------ | -------- | +|Added|NA|Module name: ohos.app.ability.dataUriUtils
Class name: dataUriUtils|@ohos.app.ability.dataUriUtils.d.ts| +|Added|NA|Module name: ohos.app.ability.dataUriUtils
Class name: dataUriUtils
Method or attribute name: function getId(uri: string): number|@ohos.app.ability.dataUriUtils.d.ts| +|Added|NA|Module name: ohos.app.ability.dataUriUtils
Class name: dataUriUtils
Method or attribute name: function attachId(uri: string, id: number): string|@ohos.app.ability.dataUriUtils.d.ts| +|Added|NA|Module name: ohos.app.ability.dataUriUtils
Class name: dataUriUtils
Method or attribute name: function deleteId(uri: string): string|@ohos.app.ability.dataUriUtils.d.ts| +|Added|NA|Module name: ohos.app.ability.dataUriUtils
Class name: dataUriUtils
Method or attribute name: function updateId(uri: string, id: number): string|@ohos.app.ability.dataUriUtils.d.ts| +|Added|NA|Module name: ohos.app.ability.EnvironmentCallback
Class name: EnvironmentCallback
Method or attribute name: onMemoryLevel(level: AbilityConstant.MemoryLevel): void;|@ohos.app.ability.EnvironmentCallback.d.ts| +|Deleted|Module name: ohos.app.ability.wantAgent
Class name: wantAgent
Method or attribute name: function trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: Callback): void;|NA|@ohos.app.ability.wantAgent.d.ts| +|Deleted|Module name: ohos.application.Ability
Class name: OnReleaseCallBack|NA|@ohos.application.Ability.d.ts| +|Deleted|Module name: ohos.application.Ability
Class name: OnReleaseCallBack
Method or attribute name: (msg: string): void;|NA|@ohos.application.Ability.d.ts| +|Deleted|Module name: ohos.application.Ability
Class name: CalleeCallBack|NA|@ohos.application.Ability.d.ts| +|Deleted|Module name: ohos.application.Ability
Class name: CalleeCallBack
Method or attribute name: (indata: rpc.MessageParcel): rpc.Sequenceable;|NA|@ohos.application.Ability.d.ts| +|Deleted|Module name: ohos.application.Ability
Class name: Caller|NA|@ohos.application.Ability.d.ts| +|Deleted|Module name: ohos.application.Ability
Class name: Caller
Method or attribute name: call(method: string, data: rpc.Sequenceable): Promise;|NA|@ohos.application.Ability.d.ts| +|Deleted|Module name: ohos.application.Ability
Class name: Caller
Method or attribute name: callWithResult(method: string, data: rpc.Sequenceable): Promise;|NA|@ohos.application.Ability.d.ts| +|Deleted|Module name: ohos.application.Ability
Class name: Caller
Method or attribute name: release(): void;|NA|@ohos.application.Ability.d.ts| +|Deleted|Module name: ohos.application.Ability
Class name: Caller
Method or attribute name: onRelease(callback: OnReleaseCallBack): void;|NA|@ohos.application.Ability.d.ts| +|Deleted|Module name: ohos.application.Ability
Class name: Callee|NA|@ohos.application.Ability.d.ts| +|Deleted|Module name: ohos.application.Ability
Class name: Callee
Method or attribute name: on(method: string, callback: CalleeCallBack): void;|NA|@ohos.application.Ability.d.ts| +|Deleted|Module name: ohos.application.Ability
Class name: Callee
Method or attribute name: off(method: string): void;|NA|@ohos.application.Ability.d.ts| +|Deleted|Module name: ohos.application.Ability
Class name: Ability|NA|@ohos.application.Ability.d.ts| +|Deleted|Module name: ohos.application.Ability
Class name: Ability
Method or attribute name: context: AbilityContext;|NA|@ohos.application.Ability.d.ts| +|Deleted|Module name: ohos.application.Ability
Class name: Ability
Method or attribute name: launchWant: Want;|NA|@ohos.application.Ability.d.ts| +|Deleted|Module name: ohos.application.Ability
Class name: Ability
Method or attribute name: lastRequestWant: Want;|NA|@ohos.application.Ability.d.ts| +|Deleted|Module name: ohos.application.Ability
Class name: Ability
Method or attribute name: callee: Callee;|NA|@ohos.application.Ability.d.ts| +|Deleted|Module name: ohos.application.Ability
Class name: Ability
Method or attribute name: onCreate(want: Want, param: AbilityConstant.LaunchParam): void;|NA|@ohos.application.Ability.d.ts| +|Deleted|Module name: ohos.application.Ability
Class name: Ability
Method or attribute name: onWindowStageCreate(windowStage: window.WindowStage): void;|NA|@ohos.application.Ability.d.ts| +|Deleted|Module name: ohos.application.Ability
Class name: Ability
Method or attribute name: onWindowStageDestroy(): void;|NA|@ohos.application.Ability.d.ts| +|Deleted|Module name: ohos.application.Ability
Class name: Ability
Method or attribute name: onWindowStageRestore(windowStage: window.WindowStage): void;|NA|@ohos.application.Ability.d.ts| +|Deleted|Module name: ohos.application.Ability
Class name: Ability
Method or attribute name: onDestroy(): void;|NA|@ohos.application.Ability.d.ts| +|Deleted|Module name: ohos.application.Ability
Class name: Ability
Method or attribute name: onForeground(): void;|NA|@ohos.application.Ability.d.ts| +|Deleted|Module name: ohos.application.Ability
Class name: Ability
Method or attribute name: onBackground(): void;|NA|@ohos.application.Ability.d.ts| +|Deleted|Module name: ohos.application.Ability
Class name: Ability
Method or attribute name: onContinue(wantParam : {[key: string]: any}): AbilityConstant.OnContinueResult;|NA|@ohos.application.Ability.d.ts| +|Deleted|Module name: ohos.application.Ability
Class name: Ability
Method or attribute name: onNewWant(want: Want, launchParams: AbilityConstant.LaunchParam): void;|NA|@ohos.application.Ability.d.ts| +|Deleted|Module name: ohos.application.Ability
Class name: Ability
Method or attribute name: onConfigurationUpdated(config: Configuration): void;|NA|@ohos.application.Ability.d.ts| +|Deleted|Module name: ohos.application.Ability
Class name: Ability
Method or attribute name: dump(params: Array): Array;|NA|@ohos.application.Ability.d.ts| +|Deleted|Module name: ohos.application.Ability
Class name: Ability
Method or attribute name: onMemoryLevel(level: AbilityConstant.MemoryLevel): void;|NA|@ohos.application.Ability.d.ts| +|Deleted|Module name: ohos.application.Ability
Class name: Ability
Method or attribute name: onSaveState(reason: AbilityConstant.StateType, wantParam : {[key: string]: any}): AbilityConstant.OnSaveResult;|NA|@ohos.application.Ability.d.ts| +|Deleted|Module name: ohos.application.AbilityConstant
Class name: AbilityConstant|NA|@ohos.application.AbilityConstant.d.ts| +|Deleted|Module name: ohos.application.AbilityConstant
Class name: LaunchParam|NA|@ohos.application.AbilityConstant.d.ts| +|Deleted|Module name: ohos.application.AbilityConstant
Class name: LaunchParam
Method or attribute name: launchReason: LaunchReason;|NA|@ohos.application.AbilityConstant.d.ts| +|Deleted|Module name: ohos.application.AbilityConstant
Class name: LaunchParam
Method or attribute name: lastExitReason: LastExitReason;|NA|@ohos.application.AbilityConstant.d.ts| +|Deleted|Module name: ohos.application.AbilityConstant
Class name: LaunchReason|NA|@ohos.application.AbilityConstant.d.ts| +|Deleted|Module name: ohos.application.AbilityConstant
Class name: LaunchReason
Method or attribute name: UNKNOWN = 0|NA|@ohos.application.AbilityConstant.d.ts| +|Deleted|Module name: ohos.application.AbilityConstant
Class name: LaunchReason
Method or attribute name: START_ABILITY = 1|NA|@ohos.application.AbilityConstant.d.ts| +|Deleted|Module name: ohos.application.AbilityConstant
Class name: LaunchReason
Method or attribute name: CALL = 2|NA|@ohos.application.AbilityConstant.d.ts| +|Deleted|Module name: ohos.application.AbilityConstant
Class name: LaunchReason
Method or attribute name: CONTINUATION = 3|NA|@ohos.application.AbilityConstant.d.ts| +|Deleted|Module name: ohos.application.AbilityConstant
Class name: LaunchReason
Method or attribute name: APP_RECOVERY = 4|NA|@ohos.application.AbilityConstant.d.ts| +|Deleted|Module name: ohos.application.AbilityConstant
Class name: LastExitReason|NA|@ohos.application.AbilityConstant.d.ts| +|Deleted|Module name: ohos.application.AbilityConstant
Class name: LastExitReason
Method or attribute name: UNKNOWN = 0|NA|@ohos.application.AbilityConstant.d.ts| +|Deleted|Module name: ohos.application.AbilityConstant
Class name: LastExitReason
Method or attribute name: ABILITY_NOT_RESPONDING = 1|NA|@ohos.application.AbilityConstant.d.ts| +|Deleted|Module name: ohos.application.AbilityConstant
Class name: LastExitReason
Method or attribute name: NORMAL = 2|NA|@ohos.application.AbilityConstant.d.ts| +|Deleted|Module name: ohos.application.AbilityConstant
Class name: OnContinueResult|NA|@ohos.application.AbilityConstant.d.ts| +|Deleted|Module name: ohos.application.AbilityConstant
Class name: OnContinueResult
Method or attribute name: AGREE = 0|NA|@ohos.application.AbilityConstant.d.ts| +|Deleted|Module name: ohos.application.AbilityConstant
Class name: OnContinueResult
Method or attribute name: REJECT = 1|NA|@ohos.application.AbilityConstant.d.ts| +|Deleted|Module name: ohos.application.AbilityConstant
Class name: OnContinueResult
Method or attribute name: MISMATCH = 2|NA|@ohos.application.AbilityConstant.d.ts| +|Deleted|Module name: ohos.application.AbilityConstant
Class name: MemoryLevel|NA|@ohos.application.AbilityConstant.d.ts| +|Deleted|Module name: ohos.application.AbilityConstant
Class name: MemoryLevel
Method or attribute name: MEMORY_LEVEL_MODERATE = 0|NA|@ohos.application.AbilityConstant.d.ts| +|Deleted|Module name: ohos.application.AbilityConstant
Class name: MemoryLevel
Method or attribute name: MEMORY_LEVEL_LOW = 1|NA|@ohos.application.AbilityConstant.d.ts| +|Deleted|Module name: ohos.application.AbilityConstant
Class name: MemoryLevel
Method or attribute name: MEMORY_LEVEL_CRITICAL = 2|NA|@ohos.application.AbilityConstant.d.ts| +|Deleted|Module name: ohos.application.AbilityConstant
Class name: WindowMode|NA|@ohos.application.AbilityConstant.d.ts| +|Deleted|Module name: ohos.application.AbilityConstant
Class name: WindowMode
Method or attribute name: WINDOW_MODE_UNDEFINED = 0|NA|@ohos.application.AbilityConstant.d.ts| +|Deleted|Module name: ohos.application.AbilityConstant
Class name: WindowMode
Method or attribute name: WINDOW_MODE_FULLSCREEN = 1|NA|@ohos.application.AbilityConstant.d.ts| +|Deleted|Module name: ohos.application.AbilityConstant
Class name: WindowMode
Method or attribute name: WINDOW_MODE_SPLIT_PRIMARY = 100|NA|@ohos.application.AbilityConstant.d.ts| +|Deleted|Module name: ohos.application.AbilityConstant
Class name: WindowMode
Method or attribute name: WINDOW_MODE_SPLIT_SECONDARY = 101|NA|@ohos.application.AbilityConstant.d.ts| +|Deleted|Module name: ohos.application.AbilityConstant
Class name: WindowMode
Method or attribute name: WINDOW_MODE_FLOATING = 102|NA|@ohos.application.AbilityConstant.d.ts| +|Deleted|Module name: ohos.application.AbilityConstant
Class name: OnSaveResult|NA|@ohos.application.AbilityConstant.d.ts| +|Deleted|Module name: ohos.application.AbilityConstant
Class name: OnSaveResult
Method or attribute name: ALL_AGREE = 0|NA|@ohos.application.AbilityConstant.d.ts| +|Deleted|Module name: ohos.application.AbilityConstant
Class name: OnSaveResult
Method or attribute name: CONTINUATION_REJECT = 1|NA|@ohos.application.AbilityConstant.d.ts| +|Deleted|Module name: ohos.application.AbilityConstant
Class name: OnSaveResult
Method or attribute name: CONTINUATION_MISMATCH = 2|NA|@ohos.application.AbilityConstant.d.ts| +|Deleted|Module name: ohos.application.AbilityConstant
Class name: OnSaveResult
Method or attribute name: RECOVERY_AGREE = 3|NA|@ohos.application.AbilityConstant.d.ts| +|Deleted|Module name: ohos.application.AbilityConstant
Class name: OnSaveResult
Method or attribute name: RECOVERY_REJECT = 4|NA|@ohos.application.AbilityConstant.d.ts| +|Deleted|Module name: ohos.application.AbilityConstant
Class name: OnSaveResult
Method or attribute name: ALL_REJECT|NA|@ohos.application.AbilityConstant.d.ts| +|Deleted|Module name: ohos.application.AbilityConstant
Class name: StateType|NA|@ohos.application.AbilityConstant.d.ts| +|Deleted|Module name: ohos.application.AbilityConstant
Class name: StateType
Method or attribute name: CONTINUATION = 0|NA|@ohos.application.AbilityConstant.d.ts| +|Deleted|Module name: ohos.application.AbilityConstant
Class name: StateType
Method or attribute name: APP_RECOVERY = 1|NA|@ohos.application.AbilityConstant.d.ts| +|Deleted|Module name: ohos.application.AbilityLifecycleCallback
Class name: AbilityLifecycleCallback|NA|@ohos.application.AbilityLifecycleCallback.d.ts| +|Deleted|Module name: ohos.application.AbilityLifecycleCallback
Class name: AbilityLifecycleCallback
Method or attribute name: onAbilityCreate(ability: Ability): void;|NA|@ohos.application.AbilityLifecycleCallback.d.ts| +|Deleted|Module name: ohos.application.AbilityLifecycleCallback
Class name: AbilityLifecycleCallback
Method or attribute name: onWindowStageCreate(ability: Ability, windowStage: window.WindowStage): void;|NA|@ohos.application.AbilityLifecycleCallback.d.ts| +|Deleted|Module name: ohos.application.AbilityLifecycleCallback
Class name: AbilityLifecycleCallback
Method or attribute name: onWindowStageActive(ability: Ability, windowStage: window.WindowStage): void;|NA|@ohos.application.AbilityLifecycleCallback.d.ts| +|Deleted|Module name: ohos.application.AbilityLifecycleCallback
Class name: AbilityLifecycleCallback
Method or attribute name: onWindowStageInactive(ability: Ability, windowStage: window.WindowStage): void;|NA|@ohos.application.AbilityLifecycleCallback.d.ts| +|Deleted|Module name: ohos.application.AbilityLifecycleCallback
Class name: AbilityLifecycleCallback
Method or attribute name: onWindowStageDestroy(ability: Ability, windowStage: window.WindowStage): void;|NA|@ohos.application.AbilityLifecycleCallback.d.ts| +|Deleted|Module name: ohos.application.AbilityLifecycleCallback
Class name: AbilityLifecycleCallback
Method or attribute name: onAbilityDestroy(ability: Ability): void;|NA|@ohos.application.AbilityLifecycleCallback.d.ts| +|Deleted|Module name: ohos.application.AbilityLifecycleCallback
Class name: AbilityLifecycleCallback
Method or attribute name: onAbilityForeground(ability: Ability): void;|NA|@ohos.application.AbilityLifecycleCallback.d.ts| +|Deleted|Module name: ohos.application.AbilityLifecycleCallback
Class name: AbilityLifecycleCallback
Method or attribute name: onAbilityBackground(ability: Ability): void;|NA|@ohos.application.AbilityLifecycleCallback.d.ts| +|Deleted|Module name: ohos.application.AbilityLifecycleCallback
Class name: AbilityLifecycleCallback
Method or attribute name: onAbilityContinue(ability: Ability): void;|NA|@ohos.application.AbilityLifecycleCallback.d.ts| +|Deleted|Module name: ohos.application.abilityManager
Class name: abilityManager
Method or attribute name: function getExtensionRunningInfos(upperLimit: number): Promise>;|NA|@ohos.application.abilityManager.d.ts| +|Deleted|Module name: ohos.application.abilityManager
Class name: abilityManager
Method or attribute name: function getExtensionRunningInfos(upperLimit: number, callback: AsyncCallback>): void;|NA|@ohos.application.abilityManager.d.ts| +|Deleted|Module name: ohos.application.abilityManager
Class name: abilityManager
Method or attribute name: function getTopAbility(): Promise;|NA|@ohos.application.abilityManager.d.ts| +|Deleted|Module name: ohos.application.abilityManager
Class name: abilityManager
Method or attribute name: function getTopAbility(callback: AsyncCallback): void;|NA|@ohos.application.abilityManager.d.ts| +|Deleted|Module name: ohos.application.AbilityStage
Class name: AbilityStage|NA|@ohos.application.AbilityStage.d.ts| +|Deleted|Module name: ohos.application.AbilityStage
Class name: AbilityStage
Method or attribute name: context: AbilityStageContext;|NA|@ohos.application.AbilityStage.d.ts| +|Deleted|Module name: ohos.application.AbilityStage
Class name: AbilityStage
Method or attribute name: onCreate(): void;|NA|@ohos.application.AbilityStage.d.ts| +|Deleted|Module name: ohos.application.AbilityStage
Class name: AbilityStage
Method or attribute name: onAcceptWant(want: Want): string;|NA|@ohos.application.AbilityStage.d.ts| +|Deleted|Module name: ohos.application.AbilityStage
Class name: AbilityStage
Method or attribute name: onConfigurationUpdated(config: Configuration): void;|NA|@ohos.application.AbilityStage.d.ts| +|Deleted|Module name: ohos.application.AbilityStage
Class name: AbilityStage
Method or attribute name: onMemoryLevel(level: AbilityConstant.MemoryLevel): void;|NA|@ohos.application.AbilityStage.d.ts| +|Deleted|Module name: ohos.application.appManager
Class name: ApplicationState|NA|@ohos.application.appManager.d.ts| +|Deleted|Module name: ohos.application.appManager
Class name: ApplicationState
Method or attribute name: STATE_CREATE|NA|@ohos.application.appManager.d.ts| +|Deleted|Module name: ohos.application.appManager
Class name: ApplicationState
Method or attribute name: STATE_FOREGROUND|NA|@ohos.application.appManager.d.ts| +|Deleted|Module name: ohos.application.appManager
Class name: ApplicationState
Method or attribute name: STATE_ACTIVE|NA|@ohos.application.appManager.d.ts| +|Deleted|Module name: ohos.application.appManager
Class name: ApplicationState
Method or attribute name: STATE_BACKGROUND|NA|@ohos.application.appManager.d.ts| +|Deleted|Module name: ohos.application.appManager
Class name: ApplicationState
Method or attribute name: STATE_DESTROY|NA|@ohos.application.appManager.d.ts| +|Deleted|Module name: ohos.application.appManager
Class name: ProcessState|NA|@ohos.application.appManager.d.ts| +|Deleted|Module name: ohos.application.appManager
Class name: ProcessState
Method or attribute name: STATE_CREATE|NA|@ohos.application.appManager.d.ts| +|Deleted|Module name: ohos.application.appManager
Class name: ProcessState
Method or attribute name: STATE_FOREGROUND|NA|@ohos.application.appManager.d.ts| +|Deleted|Module name: ohos.application.appManager
Class name: ProcessState
Method or attribute name: STATE_ACTIVE|NA|@ohos.application.appManager.d.ts| +|Deleted|Module name: ohos.application.appManager
Class name: ProcessState
Method or attribute name: STATE_BACKGROUND|NA|@ohos.application.appManager.d.ts| +|Deleted|Module name: ohos.application.appManager
Class name: ProcessState
Method or attribute name: STATE_DESTROY|NA|@ohos.application.appManager.d.ts| +|Deleted|Module name: ohos.application.appManager
Class name: appManager
Method or attribute name: function registerApplicationStateObserver(observer: ApplicationStateObserver, bundleNameList: Array): number;|NA|@ohos.application.appManager.d.ts| +|Deleted|Module name: ohos.application.appManager
Class name: appManager
Method or attribute name: function getProcessRunningInformation(): Promise>;|NA|@ohos.application.appManager.d.ts| +|Deleted|Module name: ohos.application.appManager
Class name: appManager
Method or attribute name: function getProcessRunningInformation(callback: AsyncCallback>): void;|NA|@ohos.application.appManager.d.ts| +|Deleted|Module name: ohos.application.Configuration
Class name: Configuration
Method or attribute name: direction?: ConfigurationConstant.Direction;|NA|@ohos.application.Configuration.d.ts| +|Deleted|Module name: ohos.application.Configuration
Class name: Configuration
Method or attribute name: screenDensity?: ConfigurationConstant.ScreenDensity;|NA|@ohos.application.Configuration.d.ts| +|Deleted|Module name: ohos.application.Configuration
Class name: Configuration
Method or attribute name: displayId?: number;|NA|@ohos.application.Configuration.d.ts| +|Deleted|Module name: ohos.application.Configuration
Class name: Configuration
Method or attribute name: hasPointerDevice?: boolean;|NA|@ohos.application.Configuration.d.ts| +|Deleted|Module name: ohos.application.ConfigurationConstant
Class name: Direction|NA|@ohos.application.ConfigurationConstant.d.ts| +|Deleted|Module name: ohos.application.ConfigurationConstant
Class name: Direction
Method or attribute name: DIRECTION_NOT_SET = -1|NA|@ohos.application.ConfigurationConstant.d.ts| +|Deleted|Module name: ohos.application.ConfigurationConstant
Class name: Direction
Method or attribute name: DIRECTION_VERTICAL = 0|NA|@ohos.application.ConfigurationConstant.d.ts| +|Deleted|Module name: ohos.application.ConfigurationConstant
Class name: Direction
Method or attribute name: DIRECTION_HORIZONTAL = 1|NA|@ohos.application.ConfigurationConstant.d.ts| +|Deleted|Module name: ohos.application.ConfigurationConstant
Class name: ScreenDensity|NA|@ohos.application.ConfigurationConstant.d.ts| +|Deleted|Module name: ohos.application.ConfigurationConstant
Class name: ScreenDensity
Method or attribute name: SCREEN_DENSITY_NOT_SET = 0|NA|@ohos.application.ConfigurationConstant.d.ts| +|Deleted|Module name: ohos.application.ConfigurationConstant
Class name: ScreenDensity
Method or attribute name: SCREEN_DENSITY_SDPI = 120|NA|@ohos.application.ConfigurationConstant.d.ts| +|Deleted|Module name: ohos.application.ConfigurationConstant
Class name: ScreenDensity
Method or attribute name: SCREEN_DENSITY_MDPI = 160|NA|@ohos.application.ConfigurationConstant.d.ts| +|Deleted|Module name: ohos.application.ConfigurationConstant
Class name: ScreenDensity
Method or attribute name: SCREEN_DENSITY_LDPI = 240|NA|@ohos.application.ConfigurationConstant.d.ts| +|Deleted|Module name: ohos.application.ConfigurationConstant
Class name: ScreenDensity
Method or attribute name: SCREEN_DENSITY_XLDPI = 320|NA|@ohos.application.ConfigurationConstant.d.ts| +|Deleted|Module name: ohos.application.ConfigurationConstant
Class name: ScreenDensity
Method or attribute name: SCREEN_DENSITY_XXLDPI = 480|NA|@ohos.application.ConfigurationConstant.d.ts| +|Deleted|Module name: ohos.application.ConfigurationConstant
Class name: ScreenDensity
Method or attribute name: SCREEN_DENSITY_XXXLDPI = 640|NA|@ohos.application.ConfigurationConstant.d.ts| +|Deleted|Module name: ohos.application.context
Class name: context|NA|@ohos.application.context.d.ts| +|Deleted|Module name: ohos.application.EnvironmentCallback
Class name: EnvironmentCallback|NA|@ohos.application.EnvironmentCallback.d.ts| +|Deleted|Module name: ohos.application.EnvironmentCallback
Class name: EnvironmentCallback
Method or attribute name: onConfigurationUpdated(config: Configuration): void;|NA|@ohos.application.EnvironmentCallback.d.ts| +|Deleted|Module name: ohos.application.errorManager
Class name: errorManager|NA|@ohos.application.errorManager.d.ts| +|Deleted|Module name: ohos.application.errorManager
Class name: errorManager
Method or attribute name: function registerErrorObserver(observer: ErrorObserver): number;|NA|@ohos.application.errorManager.d.ts| +|Deleted|Module name: ohos.application.errorManager
Class name: errorManager
Method or attribute name: function unregisterErrorObserver(observerId: number, callback: AsyncCallback): void;|NA|@ohos.application.errorManager.d.ts| +|Deleted|Module name: ohos.application.errorManager
Class name: errorManager
Method or attribute name: function unregisterErrorObserver(observerId: number): Promise;|NA|@ohos.application.errorManager.d.ts| +|Deleted|Module name: ohos.application.ExtensionAbility
Class name: ExtensionAbility|NA|@ohos.application.ExtensionAbility.d.ts| +|Deleted|Module name: ohos.application.ExtensionAbility
Class name: ExtensionAbility
Method or attribute name: onConfigurationUpdated(newConfig: Configuration): void;|NA|@ohos.application.ExtensionAbility.d.ts| +|Deleted|Module name: ohos.application.ExtensionAbility
Class name: ExtensionAbility
Method or attribute name: onMemoryLevel(level: AbilityConstant.MemoryLevel): void;|NA|@ohos.application.ExtensionAbility.d.ts| +|Deleted|Module name: ohos.application.FormExtension
Class name: FormExtension|NA|@ohos.application.FormExtension.d.ts| +|Deleted|Module name: ohos.application.FormExtension
Class name: FormExtension
Method or attribute name: context: FormExtensionContext;|NA|@ohos.application.FormExtension.d.ts| +|Deleted|Module name: ohos.application.FormExtension
Class name: FormExtension
Method or attribute name: onCreate(want: Want): formBindingData.FormBindingData;|NA|@ohos.application.FormExtension.d.ts| +|Deleted|Module name: ohos.application.FormExtension
Class name: FormExtension
Method or attribute name: onCastToNormal(formId: string): void;|NA|@ohos.application.FormExtension.d.ts| +|Deleted|Module name: ohos.application.FormExtension
Class name: FormExtension
Method or attribute name: onUpdate(formId: string): void;|NA|@ohos.application.FormExtension.d.ts| +|Deleted|Module name: ohos.application.FormExtension
Class name: FormExtension
Method or attribute name: onVisibilityChange(newStatus: { [key: string]: number }): void;|NA|@ohos.application.FormExtension.d.ts| +|Deleted|Module name: ohos.application.FormExtension
Class name: FormExtension
Method or attribute name: onEvent(formId: string, message: string): void;|NA|@ohos.application.FormExtension.d.ts| +|Deleted|Module name: ohos.application.FormExtension
Class name: FormExtension
Method or attribute name: onDestroy(formId: string): void;|NA|@ohos.application.FormExtension.d.ts| +|Deleted|Module name: ohos.application.FormExtension
Class name: FormExtension
Method or attribute name: onConfigurationUpdated(config: Configuration): void;|NA|@ohos.application.FormExtension.d.ts| +|Deleted|Module name: ohos.application.FormExtension
Class name: FormExtension
Method or attribute name: onAcquireFormState?(want: Want): formInfo.FormState;|NA|@ohos.application.FormExtension.d.ts| +|Deleted|Module name: ohos.application.FormExtension
Class name: FormExtension
Method or attribute name: onShare?(formId: string): {[key: string]: any};|NA|@ohos.application.FormExtension.d.ts| +|Deleted|Module name: ohos.application.formHost
Class name: formHost
Method or attribute name: function shareForm(formId: string, deviceId: string, callback: AsyncCallback): void;|NA|@ohos.application.formHost.d.ts| +|Deleted|Module name: ohos.application.formHost
Class name: formHost
Method or attribute name: function shareForm(formId: string, deviceId: string): Promise;|NA|@ohos.application.formHost.d.ts| +|Deleted|Module name: ohos.application.formHost
Class name: formHost
Method or attribute name: function notifyFormsPrivacyProtected(formIds: Array, isProtected: boolean, callback: AsyncCallback): void;|NA|@ohos.application.formHost.d.ts| +|Deleted|Module name: ohos.application.formHost
Class name: formHost
Method or attribute name: function notifyFormsPrivacyProtected(formIds: Array, isProtected: boolean): Promise;|NA|@ohos.application.formHost.d.ts| +|Deleted|Module name: ohos.application.formInfo
Class name: FormType
Method or attribute name: eTS = 2|NA|@ohos.application.formInfo.d.ts| +|Deleted|Module name: ohos.application.formInfo
Class name: FormParam
Method or attribute name: BUNDLE_NAME_KEY = "ohos.extra.param.key.bundle_name"|NA|@ohos.application.formInfo.d.ts| +|Deleted|Module name: ohos.application.formInfo
Class name: FormParam
Method or attribute name: ABILITY_NAME_KEY = "ohos.extra.param.key.ability_name"|NA|@ohos.application.formInfo.d.ts| +|Deleted|Module name: ohos.application.formInfo
Class name: FormParam
Method or attribute name: DEVICE_ID_KEY = "ohos.extra.param.key.device_id"|NA|@ohos.application.formInfo.d.ts| +|Deleted|Module name: ohos.application.formInfo
Class name: FormInfoFilter|NA|@ohos.application.formInfo.d.ts| +|Deleted|Module name: ohos.application.formInfo
Class name: FormInfoFilter
Method or attribute name: moduleName?: string;|NA|@ohos.application.formInfo.d.ts| +|Deleted|Module name: ohos.application.formInfo
Class name: FormDimension|NA|@ohos.application.formInfo.d.ts| +|Deleted|Module name: ohos.application.formInfo
Class name: FormDimension
Method or attribute name: Dimension_1_2 = 1|NA|@ohos.application.formInfo.d.ts| +|Deleted|Module name: ohos.application.formInfo
Class name: FormDimension
Method or attribute name: Dimension_2_2|NA|@ohos.application.formInfo.d.ts| +|Deleted|Module name: ohos.application.formInfo
Class name: FormDimension
Method or attribute name: Dimension_2_4|NA|@ohos.application.formInfo.d.ts| +|Deleted|Module name: ohos.application.formInfo
Class name: FormDimension
Method or attribute name: Dimension_4_4|NA|@ohos.application.formInfo.d.ts| +|Deleted|Module name: ohos.application.formInfo
Class name: FormDimension
Method or attribute name: Dimension_2_1|NA|@ohos.application.formInfo.d.ts| +|Deleted|Module name: ohos.application.formInfo
Class name: VisibilityType|NA|@ohos.application.formInfo.d.ts| +|Deleted|Module name: ohos.application.formInfo
Class name: VisibilityType
Method or attribute name: FORM_VISIBLE = 1|NA|@ohos.application.formInfo.d.ts| +|Deleted|Module name: ohos.application.formInfo
Class name: VisibilityType
Method or attribute name: FORM_INVISIBLE|NA|@ohos.application.formInfo.d.ts| +|Deleted|Module name: ohos.application.formProvider
Class name: formProvider
Method or attribute name: function getFormsInfo(filter: formInfo.FormInfoFilter, callback: AsyncCallback>): void;|NA|@ohos.application.formProvider.d.ts| +|Deleted|Module name: ohos.application.formProvider
Class name: formProvider
Method or attribute name: function getFormsInfo(callback: AsyncCallback>): void;|NA|@ohos.application.formProvider.d.ts| +|Deleted|Module name: ohos.application.formProvider
Class name: formProvider
Method or attribute name: function getFormsInfo(filter?: formInfo.FormInfoFilter): Promise>;|NA|@ohos.application.formProvider.d.ts| +|Deleted|Module name: ohos.application.formProvider
Class name: formProvider
Method or attribute name: function requestPublishForm(want: Want, formBindingData: formBindingData.FormBindingData,

callback: AsyncCallback): void;|NA|@ohos.application.formProvider.d.ts| +|Deleted|Module name: ohos.application.formProvider
Class name: formProvider
Method or attribute name: function requestPublishForm(want: Want, callback: AsyncCallback): void;|NA|@ohos.application.formProvider.d.ts| +|Deleted|Module name: ohos.application.formProvider
Class name: formProvider
Method or attribute name: function requestPublishForm(want: Want, formBindingData?: formBindingData.FormBindingData): Promise;|NA|@ohos.application.formProvider.d.ts| +|Deleted|Module name: ohos.application.formProvider
Class name: formProvider
Method or attribute name: function isRequestPublishFormSupported(callback: AsyncCallback): void;|NA|@ohos.application.formProvider.d.ts| +|Deleted|Module name: ohos.application.formProvider
Class name: formProvider
Method or attribute name: function isRequestPublishFormSupported(): Promise;|NA|@ohos.application.formProvider.d.ts| +|Deleted|Module name: ohos.application.missionManager
Class name: missionManager
Method or attribute name: function getLowResolutionMissionSnapShot(deviceId: string, missionId: number, callback: AsyncCallback): void;|NA|@ohos.application.missionManager.d.ts| +|Deleted|Module name: ohos.application.missionManager
Class name: missionManager
Method or attribute name: function getLowResolutionMissionSnapShot(deviceId: string, missionId: number): Promise;|NA|@ohos.application.missionManager.d.ts| +|Deleted|Module name: ohos.application.ServiceExtensionAbility
Class name: ServiceExtensionAbility|NA|@ohos.application.ServiceExtensionAbility.d.ts| +|Deleted|Module name: ohos.application.ServiceExtensionAbility
Class name: ServiceExtensionAbility
Method or attribute name: context: ServiceExtensionContext;|NA|@ohos.application.ServiceExtensionAbility.d.ts| +|Deleted|Module name: ohos.application.ServiceExtensionAbility
Class name: ServiceExtensionAbility
Method or attribute name: onCreate(want: Want): void;|NA|@ohos.application.ServiceExtensionAbility.d.ts| +|Deleted|Module name: ohos.application.ServiceExtensionAbility
Class name: ServiceExtensionAbility
Method or attribute name: onDestroy(): void;|NA|@ohos.application.ServiceExtensionAbility.d.ts| +|Deleted|Module name: ohos.application.ServiceExtensionAbility
Class name: ServiceExtensionAbility
Method or attribute name: onRequest(want: Want, startId: number): void;|NA|@ohos.application.ServiceExtensionAbility.d.ts| +|Deleted|Module name: ohos.application.ServiceExtensionAbility
Class name: ServiceExtensionAbility
Method or attribute name: onConnect(want: Want): rpc.RemoteObject;|NA|@ohos.application.ServiceExtensionAbility.d.ts| +|Deleted|Module name: ohos.application.ServiceExtensionAbility
Class name: ServiceExtensionAbility
Method or attribute name: onDisconnect(want: Want): void;|NA|@ohos.application.ServiceExtensionAbility.d.ts| +|Deleted|Module name: ohos.application.ServiceExtensionAbility
Class name: ServiceExtensionAbility
Method or attribute name: onReconnect(want: Want): void;|NA|@ohos.application.ServiceExtensionAbility.d.ts| +|Deleted|Module name: ohos.application.ServiceExtensionAbility
Class name: ServiceExtensionAbility
Method or attribute name: onConfigurationUpdated(config: Configuration): void;|NA|@ohos.application.ServiceExtensionAbility.d.ts| +|Deleted|Module name: ohos.application.ServiceExtensionAbility
Class name: ServiceExtensionAbility
Method or attribute name: dump(params: Array): Array;|NA|@ohos.application.ServiceExtensionAbility.d.ts| +|Deleted|Module name: ohos.application.StartOptions
Class name: StartOptions|NA|@ohos.application.StartOptions.d.ts| +|Deleted|Module name: ohos.application.StartOptions
Class name: StartOptions
Method or attribute name: windowMode?: number;|NA|@ohos.application.StartOptions.d.ts| +|Deleted|Module name: ohos.application.StartOptions
Class name: StartOptions
Method or attribute name: displayId?: number;|NA|@ohos.application.StartOptions.d.ts| +|Deleted|Module name: ohos.application.Want
Class name: Want
Method or attribute name: moduleName?: string;|NA|@ohos.application.Want.d.ts| +|Deleted|Module name: ohos.wantAgent
Class name: wantAgent
Method or attribute name: function trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: AsyncCallback): void;|NA|@ohos.wantAgent.d.ts| +|Deleted|Module name: ohos.wantAgent
Class name: wantAgent
Method or attribute name: function getOperationType(agent: WantAgent, callback: AsyncCallback): void;|NA|@ohos.wantAgent.d.ts| +|Deleted|Module name: ohos.wantAgent
Class name: wantAgent
Method or attribute name: function getOperationType(agent: WantAgent): Promise;|NA|@ohos.wantAgent.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: abilityInfo: AbilityInfo;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: currentHapModuleInfo: HapModuleInfo;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: config: Configuration;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: startAbility(want: Want, callback: AsyncCallback): void;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: startAbility(want: Want, options: StartOptions, callback: AsyncCallback): void;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: startAbility(want: Want, options?: StartOptions): Promise;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: startAbilityByCall(want: Want): Promise;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback): void;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): Promise;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: startAbilityForResult(want: Want, callback: AsyncCallback): void;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback): void;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: startAbilityForResult(want: Want, options?: StartOptions): Promise;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: startAbilityForResultWithAccount(want: Want, accountId: number, callback: AsyncCallback): void;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: startAbilityForResultWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback): void;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: startAbilityForResultWithAccount(want: Want, accountId: number, options?: StartOptions): Promise;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: startServiceExtensionAbility(want: Want, callback: AsyncCallback): void;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: startServiceExtensionAbility(want: Want): Promise;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: stopServiceExtensionAbility(want: Want, callback: AsyncCallback): void;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: stopServiceExtensionAbility(want: Want): Promise;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: terminateSelf(callback: AsyncCallback): void;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: terminateSelf(): Promise;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback): void;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: terminateSelfWithResult(parameter: AbilityResult): Promise;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: connectAbility(want: Want, options: ConnectOptions): number;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: connectAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: disconnectAbility(connection: number, callback:AsyncCallback): void;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: disconnectAbility(connection: number): Promise;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: connectServiceExtensionAbility(want: Want, options: ConnectOptions): number;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: connectServiceExtensionAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: disconnectServiceExtensionAbility(connection: number, callback: AsyncCallback): void;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: disconnectServiceExtensionAbility(connection: number): Promise;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: setMissionLabel(label: string, callback: AsyncCallback): void;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: setMissionLabel(label: string): Promise;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: setMissionIcon(icon: image.PixelMap, callback: AsyncCallback): void;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: setMissionIcon(icon: image.PixelMap): Promise;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: requestPermissionsFromUser(permissions: Array, requestCallback: AsyncCallback): void;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: requestPermissionsFromUser(permissions: Array): Promise;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: restoreWindowStage(localStorage: LocalStorage): void;|NA|AbilityContext.d.ts| +|Deleted|Module name: AbilityContext
Class name: AbilityContext
Method or attribute name: isTerminating(): boolean;|NA|AbilityContext.d.ts| +|Deleted|Module name: ApplicationContext
Class name: ApplicationContext
Method or attribute name: registerAbilityLifecycleCallback(callback: AbilityLifecycleCallback): number;|NA|ApplicationContext.d.ts| +|Deleted|Module name: ApplicationContext
Class name: ApplicationContext
Method or attribute name: unregisterAbilityLifecycleCallback(callbackId: number, callback: AsyncCallback): void;|NA|ApplicationContext.d.ts| +|Deleted|Module name: ApplicationContext
Class name: ApplicationContext
Method or attribute name: unregisterAbilityLifecycleCallback(callbackId: number): Promise;|NA|ApplicationContext.d.ts| +|Deleted|Module name: ApplicationContext
Class name: ApplicationContext
Method or attribute name: registerEnvironmentCallback(callback: EnvironmentCallback): number;|NA|ApplicationContext.d.ts| +|Deleted|Module name: ApplicationContext
Class name: ApplicationContext
Method or attribute name: unregisterEnvironmentCallback(callbackId: number, callback: AsyncCallback): void;|NA|ApplicationContext.d.ts| +|Deleted|Module name: ApplicationContext
Class name: ApplicationContext
Method or attribute name: unregisterEnvironmentCallback(callbackId: number): Promise;|NA|ApplicationContext.d.ts| +|Deleted|Module name: PermissionRequestResult
Class name: PermissionRequestResult|NA|PermissionRequestResult.d.ts| +|Deleted|Module name: PermissionRequestResult
Class name: PermissionRequestResult
Method or attribute name: permissions: Array;|NA|PermissionRequestResult.d.ts| +|Deleted|Module name: PermissionRequestResult
Class name: PermissionRequestResult
Method or attribute name: authResults: Array;|NA|PermissionRequestResult.d.ts| +|Deleted|Module name: ServiceExtensionContext
Class name: ServiceExtensionContext
Method or attribute name: connectAbility(want: Want, options: ConnectOptions): number;|NA|ServiceExtensionContext.d.ts| +|Deleted|Module name: ServiceExtensionContext
Class name: ServiceExtensionContext
Method or attribute name: connectAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number;|NA|ServiceExtensionContext.d.ts| +|Deleted|Module name: ServiceExtensionContext
Class name: ServiceExtensionContext
Method or attribute name: disconnectAbility(connection: number, callback:AsyncCallback): void;|NA|ServiceExtensionContext.d.ts| +|Deleted|Module name: ServiceExtensionContext
Class name: ServiceExtensionContext
Method or attribute name: disconnectAbility(connection: number): Promise;|NA|ServiceExtensionContext.d.ts| +|Deleted|Module name: UIAbilityContext
Class name: UIAbilityContext
Method or attribute name: requestPermissionsFromUser(permissions: Array, requestCallback: AsyncCallback): void;|NA|UIAbilityContext.d.ts| +|Deleted|Module name: UIAbilityContext
Class name: UIAbilityContext
Method or attribute name: requestPermissionsFromUser(permissions: Array): Promise;|NA|UIAbilityContext.d.ts| +|Access level changed|Class name: FormParam
Method or attribute name: IDENTITY_KEY = "ohos.extra.param.key.form_identity"
Access level: public API|Class name: FormParam
Method or attribute name: IDENTITY_KEY = "ohos.extra.param.key.form_identity"
Access level: system API|@ohos.application.formInfo.d.ts| +|Deprecated version changed|Class name: dataUriUtils
Deprecated version: N/A|Class name: dataUriUtils
Deprecated version: 9
Substitute API: @ohos.app.ability.dataUriUtils.d.ts |@ohos.ability.dataUriUtils.d.ts| +|Deprecated version changed|Class name: Context
Method or attribute name: setShowOnLockScreen(show: boolean, callback: AsyncCallback): void
Deprecated version: N/A|Class name: Context
Method or attribute name: setShowOnLockScreen(show: boolean, callback: AsyncCallback): void
Deprecated version: 9
Substitute API: ohos.window|context.d.ts| +|Deprecated version changed|Class name: Context
Method or attribute name: setShowOnLockScreen(show: boolean): Promise;
Deprecated version: N/A|Class name: Context
Method or attribute name: setShowOnLockScreen(show: boolean): Promise;
Deprecated version: 9|context.d.ts| +|Initial version changed|Class name: FormParam
Method or attribute name: IDENTITY_KEY = "ohos.extra.param.key.form_identity"
Initial version: 9|Class name: FormParam
Method or attribute name: IDENTITY_KEY = "ohos.extra.param.key.form_identity"
Initial version: 8|@ohos.application.formInfo.d.ts| +|Permission added|Class name: ServiceExtensionContext
Method or attribute name: startAbilityByCall(want: Want): Promise;
Permission: N/A|Class name: ServiceExtensionContext
Method or attribute name: startAbilityByCall(want: Want): Promise;
Permission: ohos.permission.ABILITY_BACKGROUND_COMMUNICATION|ServiceExtensionContext.d.ts| +|Permission added|Class name: UIAbilityContext
Method or attribute name: startAbilityByCall(want: Want): Promise;
Permission: N/A|Class name: UIAbilityContext
Method or attribute name: startAbilityByCall(want: Want): Promise;
Permission: ohos.permission.ABILITY_BACKGROUND_COMMUNICATION|UIAbilityContext.d.ts| +|Access level changed|Class name: FormParam
Method or attribute name: IDENTITY_KEY = "ohos.extra.param.key.form_identity"
Access level: public API|Class name: FormParam
Method or attribute name: IDENTITY_KEY = "ohos.extra.param.key.form_identity"
Access level: system API|@ohos.application.formInfo.d.ts| +|Function changed|Class name: ServiceExtensionAbility
Method or attribute name: onConnect(want: Want): rpc.RemoteObject;
|Class name: ServiceExtensionAbility
Method or attribute name: onConnect(want: Want): rpc.RemoteObject \| Promise;
|@ohos.app.ability.ServiceExtensionAbility.d.ts| +|Function changed|Class name: ServiceExtensionAbility
Method or attribute name: onDisconnect(want: Want): void;
|Class name: ServiceExtensionAbility
Method or attribute name: onDisconnect(want: Want): void \| Promise;
|@ohos.app.ability.ServiceExtensionAbility.d.ts| +|Function changed|Class name: UIAbility
Method or attribute name: onDestroy(): void;
|Class name: UIAbility
Method or attribute name: onDestroy(): void \| Promise;
|@ohos.app.ability.UIAbility.d.ts| diff --git a/en/release-notes/api-change/v3.2-beta5/js-apidiff-account.md b/en/release-notes/api-change/v3.2-beta5/js-apidiff-account.md new file mode 100644 index 0000000000000000000000000000000000000000..eacf5c6f0aae7f7679f84b6433f40a9033ddf579 --- /dev/null +++ b/en/release-notes/api-change/v3.2-beta5/js-apidiff-account.md @@ -0,0 +1,16 @@ +| Change Type | Old Version | New Version | d.ts File | +| ---- | ------ | ------ | -------- | +|Added|NA|Module name: ohos.account.osAccount
Class name: InputerManager|@ohos.account.osAccount.d.ts| +|Added|NA|Module name: ohos.account.osAccount
Class name: InputerManager
Method or attribute name: static registerInputer(authType: AuthType, inputer: IInputer): void;|@ohos.account.osAccount.d.ts| +|Added|NA|Module name: ohos.account.osAccount
Class name: InputerManager
Method or attribute name: static unregisterInputer(authType: AuthType): void;|@ohos.account.osAccount.d.ts| +|Added|NA|Module name: ohos.account.osAccount
Class name: DomainPlugin|@ohos.account.osAccount.d.ts| +|Added|NA|Module name: ohos.account.osAccount
Class name: DomainPlugin
Method or attribute name: auth(domainAccountInfo: DomainAccountInfo, credential: Uint8Array, callback: IUserAuthCallback): void;|@ohos.account.osAccount.d.ts| +|Added|NA|Module name: ohos.account.osAccount
Class name: DomainAccountManager|@ohos.account.osAccount.d.ts| +|Added|NA|Module name: ohos.account.osAccount
Class name: DomainAccountManager
Method or attribute name: static registerPlugin(plugin: DomainPlugin): void;|@ohos.account.osAccount.d.ts| +|Added|NA|Module name: ohos.account.osAccount
Class name: DomainAccountManager
Method or attribute name: static unregisterPlugin(): void;|@ohos.account.osAccount.d.ts| +|Added|NA|Module name: ohos.account.osAccount
Class name: AuthType
Method or attribute name: DOMAIN = 1024|@ohos.account.osAccount.d.ts| +|Added|NA|Module name: ohos.account.osAccount
Class name: AuthSubType
Method or attribute name: DOMAIN_MIXED = 10240001|@ohos.account.osAccount.d.ts| +|Permission deleted|Class name: AppAccountManager
Method or attribute name: getAllAccounts(callback: AsyncCallback>): void;
Permission: ohos.permission.GET_ALL_APP_ACCOUNTS|Class name: AppAccountManager
Method or attribute name: getAllAccounts(callback: AsyncCallback>): void;
Permission: N/A|@ohos.account.appAccount.d.ts| +|Permission deleted|Class name: AppAccountManager
Method or attribute name: getAllAccounts(): Promise>;
Permission: ohos.permission.GET_ALL_APP_ACCOUNTS|Class name: AppAccountManager
Method or attribute name: getAllAccounts(): Promise>;
Permission: N/A|@ohos.account.appAccount.d.ts| +|Permission deleted|Class name: AppAccountManager
Method or attribute name: getAccountsByOwner(owner: string, callback: AsyncCallback>): void;
Permission: ohos.permission.GET_ALL_APP_ACCOUNTS|Class name: AppAccountManager
Method or attribute name: getAccountsByOwner(owner: string, callback: AsyncCallback>): void;
Permission: N/A|@ohos.account.appAccount.d.ts| +|Permission deleted|Class name: AppAccountManager
Method or attribute name: getAccountsByOwner(owner: string): Promise>;
Permission: ohos.permission.GET_ALL_APP_ACCOUNTS|Class name: AppAccountManager
Method or attribute name: getAccountsByOwner(owner: string): Promise>;
Permission: N/A|@ohos.account.appAccount.d.ts| diff --git a/en/release-notes/api-change/v3.2-beta5/js-apidiff-application.md b/en/release-notes/api-change/v3.2-beta5/js-apidiff-application.md new file mode 100644 index 0000000000000000000000000000000000000000..93b0b017867608b642b5d1a337fdd03a2c09043e --- /dev/null +++ b/en/release-notes/api-change/v3.2-beta5/js-apidiff-application.md @@ -0,0 +1,17 @@ +| Change Type | Old Version | New Version | d.ts File | +| ---- | ------ | ------ | -------- | +|Model changed|Class name: settings
Method or attribute name: function getValue(dataAbilityHelper: DataAbilityHelper, name: string, callback: AsyncCallback): void;
Model: N/A|Class name: settings
Method or attribute name: function getValue(dataAbilityHelper: DataAbilityHelper, name: string, callback: AsyncCallback): void;
Model: @FAModelOnly|@ohos.settings.d.ts| +|Model changed|Class name: settings
Method or attribute name: function getValue(dataAbilityHelper: DataAbilityHelper, name: string): Promise;
Model: N/A|Class name: settings
Method or attribute name: function getValue(dataAbilityHelper: DataAbilityHelper, name: string): Promise;
Model: @FAModelOnly|@ohos.settings.d.ts| +|Model changed|Class name: settings
Method or attribute name: function setValue(dataAbilityHelper: DataAbilityHelper, name: string, value: object, callback: AsyncCallback): void;
Model: N/A|Class name: settings
Method or attribute name: function setValue(dataAbilityHelper: DataAbilityHelper, name: string, value: object, callback: AsyncCallback): void;
Model: @FAModelOnly|@ohos.settings.d.ts| +|Model changed|Class name: settings
Method or attribute name: function setValue(dataAbilityHelper: DataAbilityHelper, name: string, value: object): Promise;
Model: N/A|Class name: settings
Method or attribute name: function setValue(dataAbilityHelper: DataAbilityHelper, name: string, value: object): Promise;
Model: @FAModelOnly|@ohos.settings.d.ts| +|Model changed|Class name: settings
Method or attribute name: function getValueSync(dataAbilityHelper: DataAbilityHelper, name: string, defValue: string): string;
Model: N/A|Class name: settings
Method or attribute name: function getValueSync(dataAbilityHelper: DataAbilityHelper, name: string, defValue: string): string;
Model: @FAModelOnly|@ohos.settings.d.ts| +|Model changed|Class name: settings
Method or attribute name: function setValueSync(dataAbilityHelper: DataAbilityHelper, name: string, value: string): boolean;
Model: N/A|Class name: settings
Method or attribute name: function setValueSync(dataAbilityHelper: DataAbilityHelper, name: string, value: string): boolean;
Model: @FAModelOnly|@ohos.settings.d.ts| +|Deprecated version changed|Class name: settings
Method or attribute name: function getURI(name: string, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: settings
Method or attribute name: function getURI(name: string, callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: N/A|@ohos.settings.d.ts| +|Deprecated version changed|Class name: settings
Method or attribute name: function getURI(name: string): Promise;
Deprecated version: N/A|Class name: settings
Method or attribute name: function getURI(name: string): Promise;
Deprecated version: 9|@ohos.settings.d.ts| +|Deprecated version changed|Class name: settings
Method or attribute name: function getValue(dataAbilityHelper: DataAbilityHelper, name: string, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: settings
Method or attribute name: function getValue(dataAbilityHelper: DataAbilityHelper, name: string, callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: N/A|@ohos.settings.d.ts| +|Deprecated version changed|Class name: settings
Method or attribute name: function getValue(dataAbilityHelper: DataAbilityHelper, name: string): Promise;
Deprecated version: N/A|Class name: settings
Method or attribute name: function getValue(dataAbilityHelper: DataAbilityHelper, name: string): Promise;
Deprecated version: 9|@ohos.settings.d.ts| +|Deprecated version changed|Class name: settings
Method or attribute name: function setValue(dataAbilityHelper: DataAbilityHelper, name: string, value: object, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: settings
Method or attribute name: function setValue(dataAbilityHelper: DataAbilityHelper, name: string, value: object, callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: N/A|@ohos.settings.d.ts| +|Deprecated version changed|Class name: settings
Method or attribute name: function setValue(dataAbilityHelper: DataAbilityHelper, name: string, value: object): Promise;
Deprecated version: N/A|Class name: settings
Method or attribute name: function setValue(dataAbilityHelper: DataAbilityHelper, name: string, value: object): Promise;
Deprecated version: 9|@ohos.settings.d.ts| +|Deprecated version changed|Class name: settings
Method or attribute name: function getValueSync(dataAbilityHelper: DataAbilityHelper, name: string, defValue: string): string;
Deprecated version: N/A|Class name: settings
Method or attribute name: function getValueSync(dataAbilityHelper: DataAbilityHelper, name: string, defValue: string): string;
Deprecated version: 9
Substitute API: N/A|@ohos.settings.d.ts| +|Deprecated version changed|Class name: settings
Method or attribute name: function setValueSync(dataAbilityHelper: DataAbilityHelper, name: string, value: string): boolean;
Deprecated version: N/A|Class name: settings
Method or attribute name: function setValueSync(dataAbilityHelper: DataAbilityHelper, name: string, value: string): boolean;
Deprecated version: 9
Substitute API: N/A|@ohos.settings.d.ts| +|Permission added|Class name: settings
Method or attribute name: function setValueSync(dataAbilityHelper: DataAbilityHelper, name: string, value: string): boolean;
Permission: N/A|Class name: settings
Method or attribute name: function setValueSync(dataAbilityHelper: DataAbilityHelper, name: string, value: string): boolean;
Permission: ohos.permission.MANAGE_SECURE_SETTINGS|@ohos.settings.d.ts| diff --git a/en/release-notes/api-change/v3.2-beta5/js-apidiff-arkui.md b/en/release-notes/api-change/v3.2-beta5/js-apidiff-arkui.md new file mode 100644 index 0000000000000000000000000000000000000000..f4bd46712d6b11f6600f76837bf771f79c790eb3 --- /dev/null +++ b/en/release-notes/api-change/v3.2-beta5/js-apidiff-arkui.md @@ -0,0 +1,169 @@ +| Change Type | Old Version | New Version | d.ts File | +| ---- | ------ | ------ | -------- | +|Added|NA|Module name: ohos.pluginComponent
Class name: PushParameterForStage|@ohos.pluginComponent.d.ts| +|Added|NA|Module name: ohos.pluginComponent
Class name: PushParameterForStage
Method or attribute name: owner: Want;|@ohos.pluginComponent.d.ts| +|Added|NA|Module name: ohos.pluginComponent
Class name: PushParameterForStage
Method or attribute name: want: Want;|@ohos.pluginComponent.d.ts| +|Added|NA|Module name: ohos.pluginComponent
Class name: PushParameterForStage
Method or attribute name: name: string;|@ohos.pluginComponent.d.ts| +|Added|NA|Module name: ohos.pluginComponent
Class name: PushParameterForStage
Method or attribute name: data: KVObject;|@ohos.pluginComponent.d.ts| +|Added|NA|Module name: ohos.pluginComponent
Class name: PushParameterForStage
Method or attribute name: extraData: KVObject;|@ohos.pluginComponent.d.ts| +|Added|NA|Module name: ohos.pluginComponent
Class name: PushParameterForStage
Method or attribute name: jsonPath?: string;|@ohos.pluginComponent.d.ts| +|Added|NA|Module name: ohos.pluginComponent
Class name: RequestParameterForStage|@ohos.pluginComponent.d.ts| +|Added|NA|Module name: ohos.pluginComponent
Class name: RequestParameterForStage
Method or attribute name: owner: Want;|@ohos.pluginComponent.d.ts| +|Added|NA|Module name: ohos.pluginComponent
Class name: RequestParameterForStage
Method or attribute name: want: Want;|@ohos.pluginComponent.d.ts| +|Added|NA|Module name: ohos.pluginComponent
Class name: RequestParameterForStage
Method or attribute name: name: string;|@ohos.pluginComponent.d.ts| +|Added|NA|Module name: ohos.pluginComponent
Class name: RequestParameterForStage
Method or attribute name: data: KVObject;|@ohos.pluginComponent.d.ts| +|Added|NA|Module name: ohos.pluginComponent
Class name: RequestParameterForStage
Method or attribute name: jsonPath?: string;|@ohos.pluginComponent.d.ts| +|Added|NA|Module name: ohos.pluginComponent
Class name: pluginComponentManager
Method or attribute name: function push(param: PushParameterForStage, callback: AsyncCallback): void;|@ohos.pluginComponent.d.ts| +|Added|NA|Module name: ohos.pluginComponent
Class name: pluginComponentManager
Method or attribute name: function request(param: RequestParameterForStage, callback: AsyncCallback): void;|@ohos.pluginComponent.d.ts| +|Added|NA|Module name: common
Class name: SourceTool|common.d.ts| +|Added|NA|Module name: common
Class name: SourceTool
Method or attribute name: Unknown|common.d.ts| +|Added|NA|Module name: common
Class name: SourceTool
Method or attribute name: FINGER|common.d.ts| +|Added|NA|Module name: common
Class name: SourceTool
Method or attribute name: PEN|common.d.ts| +|Added|NA|Module name: common
Class name: BaseEvent
Method or attribute name: pressure: number;|common.d.ts| +|Added|NA|Module name: common
Class name: BaseEvent
Method or attribute name: tiltX: number;|common.d.ts| +|Added|NA|Module name: common
Class name: BaseEvent
Method or attribute name: tiltY: number;|common.d.ts| +|Added|NA|Module name: common
Class name: BaseEvent
Method or attribute name: sourceTool: SourceTool;|common.d.ts| +|Added|NA|Class name: Scroller
Method or attribute name: scrollPage(value: { next: boolean });|scroll.d.ts| +|Added|NA|Module name: swiper
Class name: SwiperAttribute
Method or attribute name: onAnimationStart(event: (index: number) => void): SwiperAttribute;|swiper.d.ts| +|Added|NA|Module name: swiper
Class name: SwiperAttribute
Method or attribute name: onAnimationEnd(event: (index: number) => void): SwiperAttribute;|swiper.d.ts| +|Added|NA|Module name: web
Class name: WebDarkMode|web.d.ts| +|Added|NA|Class name: WebDarkMode
Method or attribute name: |web.d.ts| +|Added|NA|Module name: web
Class name: WebDarkMode
Method or attribute name: Off|web.d.ts| +|Added|NA|Class name: WebDarkMode
Method or attribute name: Off|web.d.ts| +|Added|NA|Module name: web
Class name: WebDarkMode
Method or attribute name: On|web.d.ts| +|Added|NA|Class name: WebDarkMode
Method or attribute name: On|web.d.ts| +|Added|NA|Module name: web
Class name: WebDarkMode
Method or attribute name: Auto|web.d.ts| +|Added|NA|Class name: WebDarkMode
Method or attribute name: Auto|web.d.ts| +|Added|NA|Module name: web
Class name: DataResubmissionHandler|web.d.ts| +|Added|NA|Class name: DataResubmissionHandler
Method or attribute name: |web.d.ts| +|Added|NA|Module name: web
Class name: DataResubmissionHandler
Method or attribute name: resend(): void;|web.d.ts| +|Added|NA|Class name: DataResubmissionHandler
Method or attribute name: resend(): void;|web.d.ts| +|Added|NA|Module name: web
Class name: DataResubmissionHandler
Method or attribute name: cancel(): void;|web.d.ts| +|Added|NA|Class name: DataResubmissionHandler
Method or attribute name: cancel(): void;|web.d.ts| +|Added|NA|Module name: web
Class name: ContextMenuSourceType|web.d.ts| +|Added|NA|Class name: ContextMenuSourceType
Method or attribute name: |web.d.ts| +|Added|NA|Module name: web
Class name: ContextMenuSourceType
Method or attribute name: None|web.d.ts| +|Added|NA|Class name: ContextMenuSourceType
Method or attribute name: None|web.d.ts| +|Added|NA|Module name: web
Class name: ContextMenuSourceType
Method or attribute name: Mouse|web.d.ts| +|Added|NA|Class name: ContextMenuSourceType
Method or attribute name: Mouse|web.d.ts| +|Added|NA|Module name: web
Class name: ContextMenuSourceType
Method or attribute name: LongPress|web.d.ts| +|Added|NA|Class name: ContextMenuSourceType
Method or attribute name: LongPress|web.d.ts| +|Added|NA|Module name: web
Class name: ContextMenuMediaType|web.d.ts| +|Added|NA|Class name: ContextMenuMediaType
Method or attribute name: |web.d.ts| +|Added|NA|Module name: web
Class name: ContextMenuMediaType
Method or attribute name: None|web.d.ts| +|Added|NA|Class name: ContextMenuMediaType
Method or attribute name: None|web.d.ts| +|Added|NA|Module name: web
Class name: ContextMenuMediaType
Method or attribute name: Image|web.d.ts| +|Added|NA|Class name: ContextMenuMediaType
Method or attribute name: Image|web.d.ts| +|Added|NA|Module name: web
Class name: ContextMenuInputFieldType|web.d.ts| +|Added|NA|Class name: ContextMenuInputFieldType
Method or attribute name: |web.d.ts| +|Added|NA|Module name: web
Class name: ContextMenuInputFieldType
Method or attribute name: None|web.d.ts| +|Added|NA|Class name: ContextMenuInputFieldType
Method or attribute name: None|web.d.ts| +|Added|NA|Module name: web
Class name: ContextMenuInputFieldType
Method or attribute name: PlainText|web.d.ts| +|Added|NA|Class name: ContextMenuInputFieldType
Method or attribute name: PlainText|web.d.ts| +|Added|NA|Module name: web
Class name: ContextMenuInputFieldType
Method or attribute name: Password|web.d.ts| +|Added|NA|Class name: ContextMenuInputFieldType
Method or attribute name: Password|web.d.ts| +|Added|NA|Module name: web
Class name: ContextMenuInputFieldType
Method or attribute name: Number|web.d.ts| +|Added|NA|Class name: ContextMenuInputFieldType
Method or attribute name: Number|web.d.ts| +|Added|NA|Module name: web
Class name: ContextMenuInputFieldType
Method or attribute name: Telephone|web.d.ts| +|Added|NA|Class name: ContextMenuInputFieldType
Method or attribute name: Telephone|web.d.ts| +|Added|NA|Module name: web
Class name: ContextMenuInputFieldType
Method or attribute name: Other|web.d.ts| +|Added|NA|Class name: ContextMenuInputFieldType
Method or attribute name: Other|web.d.ts| +|Added|NA|Module name: web
Class name: ContextMenuEditStateFlags|web.d.ts| +|Added|NA|Class name: ContextMenuEditStateFlags
Method or attribute name: |web.d.ts| +|Added|NA|Module name: web
Class name: ContextMenuEditStateFlags
Method or attribute name: NONE = 0|web.d.ts| +|Added|NA|Class name: ContextMenuEditStateFlags
Method or attribute name: NONE = 0|web.d.ts| +|Added|NA|Module name: web
Class name: ContextMenuEditStateFlags
Method or attribute name: CAN_CUT = 1 << 0|web.d.ts| +|Added|NA|Class name: ContextMenuEditStateFlags
Method or attribute name: CAN_CUT = 1 << 0|web.d.ts| +|Added|NA|Module name: web
Class name: ContextMenuEditStateFlags
Method or attribute name: CAN_COPY = 1 << 1|web.d.ts| +|Added|NA|Class name: ContextMenuEditStateFlags
Method or attribute name: CAN_COPY = 1 << 1|web.d.ts| +|Added|NA|Module name: web
Class name: ContextMenuEditStateFlags
Method or attribute name: CAN_PASTE = 1 << 2|web.d.ts| +|Added|NA|Class name: ContextMenuEditStateFlags
Method or attribute name: CAN_PASTE = 1 << 2|web.d.ts| +|Added|NA|Module name: web
Class name: ContextMenuEditStateFlags
Method or attribute name: CAN_SELECT_ALL = 1 << 3|web.d.ts| +|Added|NA|Class name: ContextMenuEditStateFlags
Method or attribute name: CAN_SELECT_ALL = 1 << 3|web.d.ts| +|Added|NA|Class name: WebContextMenuParam
Method or attribute name: getUnfilteredLinkUrl(): string;|web.d.ts| +|Added|NA|Class name: WebContextMenuParam
Method or attribute name: getMediaType(): ContextMenuMediaType;|web.d.ts| +|Added|NA|Class name: WebContextMenuParam
Method or attribute name: getSelectionText(): string;|web.d.ts| +|Added|NA|Class name: WebContextMenuParam
Method or attribute name: getSourceType(): ContextMenuSourceType;|web.d.ts| +|Added|NA|Class name: WebContextMenuParam
Method or attribute name: getInputFieldType(): ContextMenuInputFieldType;|web.d.ts| +|Added|NA|Class name: WebContextMenuParam
Method or attribute name: isEditable(): boolean;|web.d.ts| +|Added|NA|Class name: WebContextMenuParam
Method or attribute name: getEditStateFlags(): number;|web.d.ts| +|Added|NA|Module name: web
Class name: WebContextMenuResult
Method or attribute name: copy(): void;|web.d.ts| +|Added|NA|Class name: WebContextMenuResult
Method or attribute name: copy(): void;|web.d.ts| +|Added|NA|Module name: web
Class name: WebContextMenuResult
Method or attribute name: paste(): void;|web.d.ts| +|Added|NA|Class name: WebContextMenuResult
Method or attribute name: paste(): void;|web.d.ts| +|Added|NA|Module name: web
Class name: WebContextMenuResult
Method or attribute name: cut(): void;|web.d.ts| +|Added|NA|Class name: WebContextMenuResult
Method or attribute name: cut(): void;|web.d.ts| +|Added|NA|Module name: web
Class name: WebContextMenuResult
Method or attribute name: selectAll(): void;|web.d.ts| +|Added|NA|Class name: WebContextMenuResult
Method or attribute name: selectAll(): void;|web.d.ts| +|Added|NA|Module name: web
Class name: WebResourceRequest
Method or attribute name: getRequestMethod(): string;|web.d.ts| +|Added|NA|Class name: WebResourceRequest
Method or attribute name: getRequestMethod(): string;|web.d.ts| +|Added|NA|Class name: WebResourceResponse
Method or attribute name: setResponseIsReady(IsReady: boolean);|web.d.ts| +|Added|NA|Module name: web
Class name: WebAttribute
Method or attribute name: darkMode(mode: WebDarkMode): WebAttribute;|web.d.ts| +|Added|NA|Class name: WebAttribute
Method or attribute name: darkMode(mode: WebDarkMode): WebAttribute;|web.d.ts| +|Added|NA|Module name: web
Class name: WebAttribute
Method or attribute name: forceDarkAccess(access: boolean): WebAttribute;|web.d.ts| +|Added|NA|Class name: WebAttribute
Method or attribute name: forceDarkAccess(access: boolean): WebAttribute;|web.d.ts| +|Added|NA|Module name: web
Class name: WebAttribute
Method or attribute name: onInterceptKeyEvent(callback: (event: KeyEvent) => boolean): WebAttribute;|web.d.ts| +|Added|NA|Class name: WebAttribute
Method or attribute name: onInterceptKeyEvent(callback: (event: KeyEvent) => boolean): WebAttribute;|web.d.ts| +|Added|NA|Module name: web
Class name: WebAttribute
Method or attribute name: webStandardFont(family: string): WebAttribute;|web.d.ts| +|Added|NA|Class name: WebAttribute
Method or attribute name: webStandardFont(family: string): WebAttribute;|web.d.ts| +|Added|NA|Module name: web
Class name: WebAttribute
Method or attribute name: webSerifFont(family: string): WebAttribute;|web.d.ts| +|Added|NA|Class name: WebAttribute
Method or attribute name: webSerifFont(family: string): WebAttribute;|web.d.ts| +|Added|NA|Module name: web
Class name: WebAttribute
Method or attribute name: webSansSerifFont(family: string): WebAttribute;|web.d.ts| +|Added|NA|Class name: WebAttribute
Method or attribute name: webSansSerifFont(family: string): WebAttribute;|web.d.ts| +|Added|NA|Module name: web
Class name: WebAttribute
Method or attribute name: webFixedFont(family: string): WebAttribute;|web.d.ts| +|Added|NA|Class name: WebAttribute
Method or attribute name: webFixedFont(family: string): WebAttribute;|web.d.ts| +|Added|NA|Module name: web
Class name: WebAttribute
Method or attribute name: webFantasyFont(family: string): WebAttribute;|web.d.ts| +|Added|NA|Class name: WebAttribute
Method or attribute name: webFantasyFont(family: string): WebAttribute;|web.d.ts| +|Added|NA|Module name: web
Class name: WebAttribute
Method or attribute name: webCursiveFont(family: string): WebAttribute;|web.d.ts| +|Added|NA|Class name: WebAttribute
Method or attribute name: webCursiveFont(family: string): WebAttribute;|web.d.ts| +|Added|NA|Module name: web
Class name: WebAttribute
Method or attribute name: defaultFixedFontSize(size: number): WebAttribute;|web.d.ts| +|Added|NA|Class name: WebAttribute
Method or attribute name: defaultFixedFontSize(size: number): WebAttribute;|web.d.ts| +|Added|NA|Module name: web
Class name: WebAttribute
Method or attribute name: defaultFontSize(size: number): WebAttribute;|web.d.ts| +|Added|NA|Class name: WebAttribute
Method or attribute name: defaultFontSize(size: number): WebAttribute;|web.d.ts| +|Added|NA|Module name: web
Class name: WebAttribute
Method or attribute name: minFontSize(size: number): WebAttribute;|web.d.ts| +|Added|NA|Class name: WebAttribute
Method or attribute name: minFontSize(size: number): WebAttribute;|web.d.ts| +|Added|NA|Module name: web
Class name: WebAttribute
Method or attribute name: minLogicalFontSize(size: number): WebAttribute;|web.d.ts| +|Added|NA|Class name: WebAttribute
Method or attribute name: minLogicalFontSize(size: number): WebAttribute;|web.d.ts| +|Added|NA|Module name: web
Class name: WebAttribute
Method or attribute name: blockNetwork(block: boolean): WebAttribute;|web.d.ts| +|Added|NA|Class name: WebAttribute
Method or attribute name: blockNetwork(block: boolean): WebAttribute;|web.d.ts| +|Added|NA|Module name: web
Class name: WebAttribute
Method or attribute name: horizontalScrollBarAccess(horizontalScrollBar: boolean): WebAttribute;|web.d.ts| +|Added|NA|Class name: WebAttribute
Method or attribute name: horizontalScrollBarAccess(horizontalScrollBar: boolean): WebAttribute;|web.d.ts| +|Added|NA|Module name: web
Class name: WebAttribute
Method or attribute name: verticalScrollBarAccess(verticalScrollBar: boolean): WebAttribute;|web.d.ts| +|Added|NA|Class name: WebAttribute
Method or attribute name: verticalScrollBarAccess(verticalScrollBar: boolean): WebAttribute;|web.d.ts| +|Added|NA|Module name: web
Class name: WebAttribute
Method or attribute name: onTouchIconUrlReceived(callback: (event: {url: string,
precomposed: boolean}) => void): WebAttribute;|web.d.ts| +|Added|NA|Class name: WebAttribute
Method or attribute name: onTouchIconUrlReceived(callback: (event: {url: string,
precomposed: boolean}) => void): WebAttribute;|web.d.ts| +|Added|NA|Module name: web
Class name: WebAttribute
Method or attribute name: onFaviconReceived(callback: (event: {favicon: PixelMap}) => void): WebAttribute;|web.d.ts| +|Added|NA|Class name: WebAttribute
Method or attribute name: onFaviconReceived(callback: (event: {favicon: PixelMap}) => void): WebAttribute;|web.d.ts| +|Added|NA|Module name: web
Class name: WebAttribute
Method or attribute name: onPageVisible(callback: (event: {url: string}) => void): WebAttribute;|web.d.ts| +|Added|NA|Class name: WebAttribute
Method or attribute name: onPageVisible(callback: (event: {url: string}) => void): WebAttribute;|web.d.ts| +|Added|NA|Module name: web
Class name: WebAttribute
Method or attribute name: onDataResubmitted(callback: (event: {handler: DataResubmissionHandler}) => void): WebAttribute;|web.d.ts| +|Added|NA|Class name: WebAttribute
Method or attribute name: onDataResubmitted(callback: (event: {handler: DataResubmissionHandler}) => void): WebAttribute;|web.d.ts| +|Added|NA|Module name: web
Class name: WebAttribute
Method or attribute name: pinchSmooth(isEnabled: boolean): WebAttribute;|web.d.ts| +|Added|NA|Class name: WebAttribute
Method or attribute name: pinchSmooth(isEnabled: boolean): WebAttribute;|web.d.ts| +|Deleted|Module name: web
Class name: WebContextMenuParam
Method or attribute name: getUnfilterendLinkUrl(): string;|NA|web.d.ts| +|Access level changed|Class name: SubscribedAbstractProperty
Access level: system API|Class name: SubscribedAbstractProperty
Access level: public API|common_ts_ets_api.d.ts| +|Access level changed|Class name: SubscribedAbstractProperty
Method or attribute name: abstract get(): T;
Access level: system API|Class name: SubscribedAbstractProperty
Method or attribute name: abstract get(): T;
Access level: public API|common_ts_ets_api.d.ts| +|Access level changed|Class name: SubscribedAbstractProperty
Method or attribute name: abstract set(newValue: T): void;
Access level: system API|Class name: SubscribedAbstractProperty
Method or attribute name: abstract set(newValue: T): void;
Access level: public API|common_ts_ets_api.d.ts| +|Deprecated version changed|Class name: Edge
Method or attribute name: Center
Deprecated version: N/A|Class name: Edge
Method or attribute name: Center
Deprecated version: 9
Substitute API: N/A|enums.d.ts| +|Deprecated version changed|Class name: Edge
Method or attribute name: Baseline
Deprecated version: N/A|Class name: Edge
Method or attribute name: Baseline
Deprecated version: 9
Substitute API: N/A|enums.d.ts| +|Deprecated version changed|Class name: Edge
Method or attribute name: Middle
Deprecated version: N/A|Class name: Edge
Method or attribute name: Middle
Deprecated version: 9
Substitute API: N/A|enums.d.ts| +|Deprecated version changed|Class name: ImageAnimatorAttribute
Method or attribute name: preDecode(value: number): ImageAnimatorAttribute;
Deprecated version: N/A|Class name: ImageAnimatorAttribute
Method or attribute name: preDecode(value: number): ImageAnimatorAttribute;
Deprecated version: 9
Substitute API: N/A|image_animator.d.ts| +|Deprecated version changed|Class name: ListAttribute
Method or attribute name: editMode(value: boolean): ListAttribute;
Deprecated version: N/A|Class name: ListAttribute
Method or attribute name: editMode(value: boolean): ListAttribute;
Deprecated version: 9
Substitute API: N/A|list.d.ts| +|Deprecated version changed|Class name: ListAttribute
Method or attribute name: onItemDelete(event: (index: number) => boolean): ListAttribute;
Deprecated version: N/A|Class name: ListAttribute
Method or attribute name: onItemDelete(event: (index: number) => boolean): ListAttribute;
Deprecated version: 9
Substitute API: N/A|list.d.ts| +|Deprecated version changed|Class name: EditMode
Deprecated version: N/A|Class name: EditMode
Deprecated version: 9
Substitute API: N/A|list_item.d.ts| +|Deprecated version changed|Class name: ListItemAttribute
Method or attribute name: editable(value: boolean \| EditMode): ListItemAttribute;
Deprecated version: N/A|Class name: ListItemAttribute
Method or attribute name: editable(value: boolean \| EditMode): ListItemAttribute;
Deprecated version: 9
Substitute API: N/A|list_item.d.ts| +|Deprecated version changed|Class name: ScrollDirection
Method or attribute name: Free
Deprecated version: N/A|Class name: ScrollDirection
Method or attribute name: Free
Deprecated version: 9
Substitute API: N/A|scroll.d.ts| +|Deprecated version changed|Class name: Scroller
Method or attribute name: scrollPage(value: { next: boolean; direction?: Axis });
Deprecated version: N/A|Class name: Scroller
Method or attribute name: scrollPage(value: { next: boolean; direction?: Axis });
Deprecated version: 9
Substitute API: N/A|scroll.d.ts| +|Deprecated version changed|Class name: SliderAttribute
Method or attribute name: minLabel(value: string): SliderAttribute;
Deprecated version: N/A|Class name: SliderAttribute
Method or attribute name: minLabel(value: string): SliderAttribute;
Deprecated version: 9
Substitute API: min |slider.d.ts| +|Deprecated version changed|Class name: SliderAttribute
Method or attribute name: maxLabel(value: string): SliderAttribute;
Deprecated version: N/A|Class name: SliderAttribute
Method or attribute name: maxLabel(value: string): SliderAttribute;
Deprecated version: 9
Substitute API: max |slider.d.ts| +|Initial version changed|Class name: SubscribedAbstractProperty
Initial version: 7|Class name: SubscribedAbstractProperty
Initial version: 9|common_ts_ets_api.d.ts| +|Initial version changed|Class name: SubscribedAbstractProperty
Method or attribute name: abstract get(): T;
Initial version: 7|Class name: SubscribedAbstractProperty
Method or attribute name: abstract get(): T;
Initial version: 9|common_ts_ets_api.d.ts| +|Initial version changed|Class name: SubscribedAbstractProperty
Method or attribute name: abstract set(newValue: T): void;
Initial version: 7|Class name: SubscribedAbstractProperty
Method or attribute name: abstract set(newValue: T): void;
Initial version: 9|common_ts_ets_api.d.ts| +|Initial version changed|Class name: NavigationAttribute
Method or attribute name: title(value: string \| CustomBuilder \| NavigationCommonTitle \| NavigationCustomTitle): NavigationAttribute;
Initial version: 8|Class name: NavigationAttribute
Method or attribute name: title(value: string \| CustomBuilder \| NavigationCommonTitle \| NavigationCustomTitle): NavigationAttribute;
Initial version: 9|navigation.d.ts| +|Access level changed|Class name: SubscribedAbstractProperty
Access level: system API|Class name: SubscribedAbstractProperty
Access level: public API|common_ts_ets_api.d.ts| +|Access level changed|Class name: SubscribedAbstractProperty
Method or attribute name: abstract get(): T;
Access level: system API|Class name: SubscribedAbstractProperty
Method or attribute name: abstract get(): T;
Access level: public API|common_ts_ets_api.d.ts| +|Access level changed|Class name: SubscribedAbstractProperty
Method or attribute name: abstract set(newValue: T): void;
Access level: system API|Class name: SubscribedAbstractProperty
Method or attribute name: abstract set(newValue: T): void;
Access level: public API|common_ts_ets_api.d.ts| +|Function changed|Class name: AbilityComponentInterface
Method or attribute name: (value: {want: import('../api/@ohos.application.Want').default}): AbilityComponentAttribute;
|Class name: AbilityComponentInterface
Method or attribute name: (value: {want: import('../api/@ohos.app.ability.Want').default}): AbilityComponentAttribute;
|ability_component.d.ts| +|Function changed|Class name: FormComponentInterface
Method or attribute name: (value: {
id: number;
name: string;
bundle: string;
ability: string;
module: string;
dimension?: FormDimension;
temporary?: boolean;
want?: import('../api/@ohos.application.Want').default;
}): FormComponentAttribute;
|Class name: FormComponentInterface
Method or attribute name: (value: {
id: number;
name: string;
bundle: string;
ability: string;
module: string;
dimension?: FormDimension;
temporary?: boolean;
want?: import('../api/@ohos.app.ability.Want').default;
}): FormComponentAttribute;
|form_component.d.ts| +|Function changed|Class name: ControllerHandler
Method or attribute name: setWebController(controller: WebController): void;
|Class name: ControllerHandler
Method or attribute name: setWebController(controller: WebviewController): void;
|web.d.ts| +|Function changed|Class name: WebResourceResponse
Method or attribute name: setResponseData(data: string);
|Class name: WebResourceResponse
Method or attribute name: setResponseData(data: string \| number);
|web.d.ts| diff --git a/en/release-notes/api-change/v3.2-beta5/js-apidiff-battery.md b/en/release-notes/api-change/v3.2-beta5/js-apidiff-battery.md new file mode 100644 index 0000000000000000000000000000000000000000..a4a8826ff3e9c8d97a9f4c54a5c06fb210c6c1a7 --- /dev/null +++ b/en/release-notes/api-change/v3.2-beta5/js-apidiff-battery.md @@ -0,0 +1,3 @@ +| Change Type | Old Version | New Version | d.ts File | +| ---- | ------ | ------ | -------- | +|Permission deleted|Class name: power
Method or attribute name: function getPowerMode(): DevicePowerMode;
Permission: ohos.permission.POWER_OPTIMIZATION|Class name: power
Method or attribute name: function getPowerMode(): DevicePowerMode;
Permission: N/A|@ohos.power.d.ts| diff --git a/en/release-notes/api-change/v3.2-beta5/js-apidiff-bundle.md b/en/release-notes/api-change/v3.2-beta5/js-apidiff-bundle.md new file mode 100644 index 0000000000000000000000000000000000000000..602350fcc5f0c55762d29668d8d13696add6b9e2 --- /dev/null +++ b/en/release-notes/api-change/v3.2-beta5/js-apidiff-bundle.md @@ -0,0 +1,24 @@ +| Change Type | Old Version | New Version | d.ts File | +| ---- | ------ | ------ | -------- | +|Added|NA|Module name: ohos.bundle.distributedBundleManager
Class name: distributedBundleManager|@ohos.bundle.distributedBundleManager.d.ts| +|Added|NA|Module name: ohos.bundle.distributedBundleManager
Class name: distributedBundleManager
Method or attribute name: function getRemoteAbilityInfo(elementName: ElementName, callback: AsyncCallback): void;|@ohos.bundle.distributedBundleManager.d.ts| +|Added|NA|Module name: ohos.bundle.distributedBundleManager
Class name: distributedBundleManager
Method or attribute name: function getRemoteAbilityInfo(elementName: ElementName): Promise;|@ohos.bundle.distributedBundleManager.d.ts| +|Added|NA|Module name: ohos.bundle.distributedBundleManager
Class name: distributedBundleManager
Method or attribute name: function getRemoteAbilityInfo(elementNames: Array, callback: AsyncCallback>): void;|@ohos.bundle.distributedBundleManager.d.ts| +|Added|NA|Module name: ohos.bundle.distributedBundleManager
Class name: distributedBundleManager
Method or attribute name: function getRemoteAbilityInfo(elementNames: Array): Promise>;|@ohos.bundle.distributedBundleManager.d.ts| +|Added|NA|Module name: ohos.bundle.distributedBundleManager
Class name: distributedBundleManager
Method or attribute name: function getRemoteAbilityInfo(elementName: ElementName, locale: string, callback: AsyncCallback): void;|@ohos.bundle.distributedBundleManager.d.ts| +|Added|NA|Module name: ohos.bundle.distributedBundleManager
Class name: distributedBundleManager
Method or attribute name: function getRemoteAbilityInfo(elementName: ElementName, locale: string): Promise;|@ohos.bundle.distributedBundleManager.d.ts| +|Added|NA|Module name: ohos.bundle.distributedBundleManager
Class name: distributedBundleManager
Method or attribute name: function getRemoteAbilityInfo(elementNames: Array, locale: string, callback: AsyncCallback>): void;|@ohos.bundle.distributedBundleManager.d.ts| +|Added|NA|Module name: ohos.bundle.distributedBundleManager
Class name: distributedBundleManager
Method or attribute name: function getRemoteAbilityInfo(elementNames: Array, locale: string): Promise>;|@ohos.bundle.distributedBundleManager.d.ts| +|Added|NA|Class name: BundleInstaller
Method or attribute name: install(hapFilePaths: Array, installParam?: InstallParam) : Promise;|@ohos.bundle.installer.d.ts| +|Added|NA|Class name: BundleInstaller
Method or attribute name: uninstall(bundleName: string, installParam?: InstallParam) : Promise;|@ohos.bundle.installer.d.ts| +|Added|NA|Class name: BundleInstaller
Method or attribute name: recover(bundleName: string, installParam?: InstallParam) : Promise;|@ohos.bundle.installer.d.ts| +|Deleted|Module name: ohos.bundle.distributedBundle
Class name: distributedBundle|NA|@ohos.bundle.distributedBundle.d.ts| +|Deleted|Module name: ohos.bundle.distributedBundle
Class name: distributedBundle
Method or attribute name: function getRemoteAbilityInfo(elementName: ElementName, callback: AsyncCallback): void;|NA|@ohos.bundle.distributedBundle.d.ts| +|Deleted|Module name: ohos.bundle.distributedBundle
Class name: distributedBundle
Method or attribute name: function getRemoteAbilityInfo(elementName: ElementName): Promise;|NA|@ohos.bundle.distributedBundle.d.ts| +|Deleted|Module name: ohos.bundle.distributedBundle
Class name: distributedBundle
Method or attribute name: function getRemoteAbilityInfo(elementNames: Array, callback: AsyncCallback>): void;|NA|@ohos.bundle.distributedBundle.d.ts| +|Deleted|Module name: ohos.bundle.distributedBundle
Class name: distributedBundle
Method or attribute name: function getRemoteAbilityInfo(elementNames: Array): Promise>;|NA|@ohos.bundle.distributedBundle.d.ts| +|Deleted|Module name: ohos.bundle.distributedBundle
Class name: distributedBundle
Method or attribute name: function getRemoteAbilityInfo(elementName: ElementName, locale: string, callback: AsyncCallback): void;|NA|@ohos.bundle.distributedBundle.d.ts| +|Deleted|Module name: ohos.bundle.distributedBundle
Class name: distributedBundle
Method or attribute name: function getRemoteAbilityInfo(elementName: ElementName, locale: string): Promise;|NA|@ohos.bundle.distributedBundle.d.ts| +|Deleted|Module name: ohos.bundle.distributedBundle
Class name: distributedBundle
Method or attribute name: function getRemoteAbilityInfo(elementNames: Array, locale: string, callback: AsyncCallback>): void;|NA|@ohos.bundle.distributedBundle.d.ts| +|Deleted|Module name: ohos.bundle.distributedBundle
Class name: distributedBundle
Method or attribute name: function getRemoteAbilityInfo(elementNames: Array, locale: string): Promise>;|NA|@ohos.bundle.distributedBundle.d.ts| +|Deleted|Module name: hapModuleInfo
Class name: HapModuleInfo
Method or attribute name: readonly moduleSourceDir: string;|NA|hapModuleInfo.d.ts| diff --git a/en/release-notes/api-change/v3.2-beta5/js-apidiff-communication.md b/en/release-notes/api-change/v3.2-beta5/js-apidiff-communication.md new file mode 100644 index 0000000000000000000000000000000000000000..3863f9e4fa73496442ab492d4e044245f2346560 --- /dev/null +++ b/en/release-notes/api-change/v3.2-beta5/js-apidiff-communication.md @@ -0,0 +1,131 @@ +| Change Type | Old Version | New Version | d.ts File | +| ---- | ------ | ------ | -------- | +|Added|NA|Class name: connectedTag
Method or attribute name: function initialize(): void;|@ohos.connectedTag.d.ts| +|Added|NA|Class name: connectedTag
Method or attribute name: function uninitialize(): void;|@ohos.connectedTag.d.ts| +|Added|NA|Class name: connectedTag
Method or attribute name: function read(): Promise;|@ohos.connectedTag.d.ts| +|Added|NA|Class name: connectedTag
Method or attribute name: function read(callback: AsyncCallback): void;|@ohos.connectedTag.d.ts| +|Added|NA|Class name: connectedTag
Method or attribute name: function write(data: number[]): Promise;|@ohos.connectedTag.d.ts| +|Added|NA|Class name: connectedTag
Method or attribute name: function write(data: number[], callback: AsyncCallback): void;|@ohos.connectedTag.d.ts| +|Added|NA|Module name: ohos.net.sharing
Class name: sharing|@ohos.net.sharing.d.ts| +|Added|NA|Module name: ohos.net.sharing
Class name: sharing
Method or attribute name: function isSharingSupported(callback: AsyncCallback): void;|@ohos.net.sharing.d.ts| +|Added|NA|Module name: ohos.net.sharing
Class name: sharing
Method or attribute name: function isSharingSupported(): Promise;|@ohos.net.sharing.d.ts| +|Added|NA|Module name: ohos.net.sharing
Class name: sharing
Method or attribute name: function isSharing(callback: AsyncCallback): void;|@ohos.net.sharing.d.ts| +|Added|NA|Module name: ohos.net.sharing
Class name: sharing
Method or attribute name: function isSharing(): Promise;|@ohos.net.sharing.d.ts| +|Added|NA|Module name: ohos.net.sharing
Class name: sharing
Method or attribute name: function startSharing(type: SharingIfaceType, callback: AsyncCallback): void;|@ohos.net.sharing.d.ts| +|Added|NA|Module name: ohos.net.sharing
Class name: sharing
Method or attribute name: function startSharing(type: SharingIfaceType): Promise;|@ohos.net.sharing.d.ts| +|Added|NA|Module name: ohos.net.sharing
Class name: sharing
Method or attribute name: function stopSharing(type: SharingIfaceType, callback: AsyncCallback): void;|@ohos.net.sharing.d.ts| +|Added|NA|Module name: ohos.net.sharing
Class name: sharing
Method or attribute name: function stopSharing(type: SharingIfaceType): Promise;|@ohos.net.sharing.d.ts| +|Added|NA|Module name: ohos.net.sharing
Class name: sharing
Method or attribute name: function getStatsRxBytes(callback: AsyncCallback): void;|@ohos.net.sharing.d.ts| +|Added|NA|Module name: ohos.net.sharing
Class name: sharing
Method or attribute name: function getStatsRxBytes(): Promise;|@ohos.net.sharing.d.ts| +|Added|NA|Module name: ohos.net.sharing
Class name: sharing
Method or attribute name: function getStatsTxBytes(callback: AsyncCallback): void;|@ohos.net.sharing.d.ts| +|Added|NA|Module name: ohos.net.sharing
Class name: sharing
Method or attribute name: function getStatsTxBytes(): Promise;|@ohos.net.sharing.d.ts| +|Added|NA|Module name: ohos.net.sharing
Class name: sharing
Method or attribute name: function getStatsTotalBytes(callback: AsyncCallback): void;|@ohos.net.sharing.d.ts| +|Added|NA|Module name: ohos.net.sharing
Class name: sharing
Method or attribute name: function getStatsTotalBytes(): Promise;|@ohos.net.sharing.d.ts| +|Added|NA|Module name: ohos.net.sharing
Class name: sharing
Method or attribute name: function getSharingIfaces(state: SharingIfaceState, callback: AsyncCallback>): void;|@ohos.net.sharing.d.ts| +|Added|NA|Module name: ohos.net.sharing
Class name: sharing
Method or attribute name: function getSharingIfaces(state: SharingIfaceState): Promise>;|@ohos.net.sharing.d.ts| +|Added|NA|Module name: ohos.net.sharing
Class name: sharing
Method or attribute name: function getSharingState(type: SharingIfaceType, callback: AsyncCallback): void;|@ohos.net.sharing.d.ts| +|Added|NA|Module name: ohos.net.sharing
Class name: sharing
Method or attribute name: function getSharingState(type: SharingIfaceType): Promise;|@ohos.net.sharing.d.ts| +|Added|NA|Module name: ohos.net.sharing
Class name: sharing
Method or attribute name: function getSharableRegexes(type: SharingIfaceType, callback: AsyncCallback>): void;|@ohos.net.sharing.d.ts| +|Added|NA|Module name: ohos.net.sharing
Class name: sharing
Method or attribute name: function getSharableRegexes(type: SharingIfaceType): Promise>;|@ohos.net.sharing.d.ts| +|Added|NA|Module name: ohos.net.sharing
Class name: sharing
Method or attribute name: function on(type: 'sharingStateChange', callback: Callback): void;|@ohos.net.sharing.d.ts| +|Added|NA|Module name: ohos.net.sharing
Class name: sharing
Method or attribute name: function off(type: 'sharingStateChange', callback?: Callback): void;|@ohos.net.sharing.d.ts| +|Added|NA|Module name: ohos.net.sharing
Class name: sharing
Method or attribute name: function on(type: 'interfaceSharingStateChange', callback: Callback<{ type: SharingIfaceType, iface: string, state: SharingIfaceState }>): void;|@ohos.net.sharing.d.ts| +|Added|NA|Module name: ohos.net.sharing
Class name: sharing
Method or attribute name: function off(type: 'interfaceSharingStateChange', callback?: Callback<{ type: SharingIfaceType, iface: string, state: SharingIfaceState }>): void;|@ohos.net.sharing.d.ts| +|Added|NA|Module name: ohos.net.sharing
Class name: sharing
Method or attribute name: function on(type: 'sharingUpstreamChange', callback: Callback): void;|@ohos.net.sharing.d.ts| +|Added|NA|Module name: ohos.net.sharing
Class name: sharing
Method or attribute name: function off(type: 'sharingUpstreamChange', callback?: Callback): void;|@ohos.net.sharing.d.ts| +|Added|NA|Module name: ohos.net.sharing
Class name: SharingIfaceState|@ohos.net.sharing.d.ts| +|Added|NA|Module name: ohos.net.sharing
Class name: SharingIfaceState
Method or attribute name: SHARING_NIC_SERVING = 1|@ohos.net.sharing.d.ts| +|Added|NA|Module name: ohos.net.sharing
Class name: SharingIfaceState
Method or attribute name: SHARING_NIC_CAN_SERVER = 2|@ohos.net.sharing.d.ts| +|Added|NA|Module name: ohos.net.sharing
Class name: SharingIfaceState
Method or attribute name: SHARING_NIC_ERROR = 3|@ohos.net.sharing.d.ts| +|Added|NA|Module name: ohos.net.sharing
Class name: SharingIfaceType|@ohos.net.sharing.d.ts| +|Added|NA|Module name: ohos.net.sharing
Class name: SharingIfaceType
Method or attribute name: SHARING_WIFI = 0|@ohos.net.sharing.d.ts| +|Added|NA|Module name: ohos.net.sharing
Class name: SharingIfaceType
Method or attribute name: SHARING_USB = 1|@ohos.net.sharing.d.ts| +|Added|NA|Module name: ohos.net.sharing
Class name: SharingIfaceType
Method or attribute name: SHARING_BLUETOOTH = 2|@ohos.net.sharing.d.ts| +|Added|NA|Module name: ohos.nfc.cardEmulation
Class name: CardType|@ohos.nfc.cardEmulation.d.ts| +|Added|NA|Class name: CardType
Method or attribute name: |@ohos.nfc.cardEmulation.d.ts| +|Added|NA|Module name: ohos.nfc.cardEmulation
Class name: CardType
Method or attribute name: PAYMENT = "payment"|@ohos.nfc.cardEmulation.d.ts| +|Added|NA|Class name: CardType
Method or attribute name: PAYMENT = "payment"|@ohos.nfc.cardEmulation.d.ts| +|Added|NA|Module name: ohos.nfc.cardEmulation
Class name: CardType
Method or attribute name: OTHER = "other"|@ohos.nfc.cardEmulation.d.ts| +|Added|NA|Class name: CardType
Method or attribute name: OTHER = "other"|@ohos.nfc.cardEmulation.d.ts| +|Added|NA|Class name: cardEmulation
Method or attribute name: function hasHceCapability(): boolean;|@ohos.nfc.cardEmulation.d.ts| +|Added|NA|Class name: cardEmulation
Method or attribute name: function isDefaultService(elementName: ElementName, type: CardType): boolean;|@ohos.nfc.cardEmulation.d.ts| +|Added|NA|Class name: HceService
Method or attribute name: start(elementName: ElementName, aidList: string[]): void|@ohos.nfc.cardEmulation.d.ts| +|Added|NA|Class name: HceService
Method or attribute name: stop(elementName: ElementName): void|@ohos.nfc.cardEmulation.d.ts| +|Added|NA|Class name: HceService
Method or attribute name: transmit(response: number[]): Promise;|@ohos.nfc.cardEmulation.d.ts| +|Added|NA|Class name: HceService
Method or attribute name: transmit(response: number[], callback: AsyncCallback): void;|@ohos.nfc.cardEmulation.d.ts| +|Added|NA|Class name: nfcController
Method or attribute name: function enableNfc(): void|@ohos.nfc.controller.d.ts| +|Added|NA|Class name: nfcController
Method or attribute name: function disableNfc(): void|@ohos.nfc.controller.d.ts| +|Added|NA|Class name: tag
Method or attribute name: function getNfcA(tagInfo: TagInfo): NfcATag|@ohos.nfc.tag.d.ts| +|Added|NA|Class name: tag
Method or attribute name: function getNfcB(tagInfo: TagInfo): NfcBTag|@ohos.nfc.tag.d.ts| +|Added|NA|Class name: tag
Method or attribute name: function getNfcF(tagInfo: TagInfo): NfcFTag|@ohos.nfc.tag.d.ts| +|Added|NA|Class name: tag
Method or attribute name: function getNfcV(tagInfo: TagInfo): NfcVTag|@ohos.nfc.tag.d.ts| +|Added|NA|Class name: wifiManager
Method or attribute name: function p2pCancelConnect(): void;|@ohos.wifiManager.d.ts| +|Added|NA|Class name: TagSession
Method or attribute name: connect(): void;|tagSession.d.ts| +|Added|NA|Class name: TagSession
Method or attribute name: resetConnection(): void;|tagSession.d.ts| +|Added|NA|Class name: TagSession
Method or attribute name: isConnected(): boolean;|tagSession.d.ts| +|Added|NA|Class name: TagSession
Method or attribute name: setTimeout(timeout: number): void;|tagSession.d.ts| +|Added|NA|Class name: TagSession
Method or attribute name: getTimeout(): number;|tagSession.d.ts| +|Added|NA|Class name: TagSession
Method or attribute name: transmit(data: number[]): Promise;|tagSession.d.ts| +|Added|NA|Class name: TagSession
Method or attribute name: transmit(data: number[], callback: AsyncCallback): void;|tagSession.d.ts| +|Added|NA|Class name: TagSession
Method or attribute name: getMaxTransmitSize(): number;|tagSession.d.ts| +|Deleted|Module name: ohos.wifiManager
Class name: wifiManager
Method or attribute name: function p2pDisconnect(): void;|NA|@ohos.wifiManager.d.ts| +|Deprecated version changed|Class name: connectedTag
Method or attribute name: function init(): boolean;
Deprecated version: N/A|Class name: connectedTag
Method or attribute name: function init(): boolean;
Deprecated version: 9
Substitute API: ohos.connectedTag/connectedTag|@ohos.connectedTag.d.ts| +|Deprecated version changed|Class name: connectedTag
Method or attribute name: function uninit(): boolean;
Deprecated version: N/A|Class name: connectedTag
Method or attribute name: function uninit(): boolean;
Deprecated version: 9
Substitute API: ohos.connectedTag/connectedTag|@ohos.connectedTag.d.ts| +|Deprecated version changed|Class name: connectedTag
Method or attribute name: function readNdefTag(): Promise;
Deprecated version: N/A|Class name: connectedTag
Method or attribute name: function readNdefTag(): Promise;
Deprecated version: 9
Substitute API: ohos.connectedTag/connectedTag|@ohos.connectedTag.d.ts| +|Deprecated version changed|Class name: connectedTag
Method or attribute name: function readNdefTag(callback: AsyncCallback): void;
Deprecated version: N/A|Class name: connectedTag
Method or attribute name: function readNdefTag(callback: AsyncCallback): void;
Deprecated version: 9|@ohos.connectedTag.d.ts| +|Deprecated version changed|Class name: connectedTag
Method or attribute name: function writeNdefTag(data: string): Promise;
Deprecated version: N/A|Class name: connectedTag
Method or attribute name: function writeNdefTag(data: string): Promise;
Deprecated version: 9
Substitute API: ohos.connectedTag/connectedTag|@ohos.connectedTag.d.ts| +|Deprecated version changed|Class name: connectedTag
Method or attribute name: function writeNdefTag(data: string, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: connectedTag
Method or attribute name: function writeNdefTag(data: string, callback: AsyncCallback): void;
Deprecated version: 9|@ohos.connectedTag.d.ts| +|Deprecated version changed|Class name: FeatureType
Deprecated version: N/A|Class name: FeatureType
Deprecated version: 9
Substitute API: ohos.nfc.cardEmulation/cardEmulation|@ohos.nfc.cardEmulation.d.ts| +|Deprecated version changed|Class name: cardEmulation
Method or attribute name: function isSupported(feature: number): boolean;
Deprecated version: N/A|Class name: cardEmulation
Method or attribute name: function isSupported(feature: number): boolean;
Deprecated version: 9
Substitute API: ohos.nfc.cardEmulation/cardEmulation|@ohos.nfc.cardEmulation.d.ts| +|Deprecated version changed|Class name: HceService
Method or attribute name: startHCE(aidList: string[]): boolean;
Deprecated version: N/A|Class name: HceService
Method or attribute name: startHCE(aidList: string[]): boolean;
Deprecated version: 9
Substitute API: ohos.nfc.cardEmulation/cardEmulation.HceService|@ohos.nfc.cardEmulation.d.ts| +|Deprecated version changed|Class name: HceService
Method or attribute name: stopHCE(): boolean;
Deprecated version: N/A|Class name: HceService
Method or attribute name: stopHCE(): boolean;
Deprecated version: 9
Substitute API: ohos.nfc.cardEmulation/cardEmulation.HceService|@ohos.nfc.cardEmulation.d.ts| +|Deprecated version changed|Class name: HceService
Method or attribute name: sendResponse(responseApdu: number[]): void;
Deprecated version: N/A|Class name: HceService
Method or attribute name: sendResponse(responseApdu: number[]): void;
Deprecated version: 9
Substitute API: ohos.nfc.cardEmulation/cardEmulation.HceService|@ohos.nfc.cardEmulation.d.ts| +|Deprecated version changed|Class name: nfcController
Method or attribute name: function isNfcAvailable(): boolean
Deprecated version: N/A|Class name: nfcController
Method or attribute name: function isNfcAvailable(): boolean
Deprecated version: 9
Substitute API: global|@ohos.nfc.controller.d.ts| +|Deprecated version changed|Class name: nfcController
Method or attribute name: function openNfc(): boolean
Deprecated version: N/A|Class name: nfcController
Method or attribute name: function openNfc(): boolean
Deprecated version: 9
Substitute API: @ohos.nfc.controller.nfcController|@ohos.nfc.controller.d.ts| +|Deprecated version changed|Class name: nfcController
Method or attribute name: function closeNfc(): boolean
Deprecated version: N/A|Class name: nfcController
Method or attribute name: function closeNfc(): boolean
Deprecated version: 9
Substitute API: @ohos.nfc.controller.nfcController|@ohos.nfc.controller.d.ts| +|Deprecated version changed|Class name: tag
Method or attribute name: function getNfcATag(tagInfo: TagInfo): NfcATag
Deprecated version: N/A|Class name: tag
Method or attribute name: function getNfcATag(tagInfo: TagInfo): NfcATag
Deprecated version: 9
Substitute API: ohos.nfc.tag/tag|@ohos.nfc.tag.d.ts| +|Deprecated version changed|Class name: tag
Method or attribute name: function getNfcBTag(tagInfo: TagInfo): NfcBTag
Deprecated version: N/A|Class name: tag
Method or attribute name: function getNfcBTag(tagInfo: TagInfo): NfcBTag
Deprecated version: 9
Substitute API: ohos.nfc.tag/tag|@ohos.nfc.tag.d.ts| +|Deprecated version changed|Class name: tag
Method or attribute name: function getNfcFTag(tagInfo: TagInfo): NfcFTag
Deprecated version: N/A|Class name: tag
Method or attribute name: function getNfcFTag(tagInfo: TagInfo): NfcFTag
Deprecated version: 9
Substitute API: ohos.nfc.tag/tag|@ohos.nfc.tag.d.ts| +|Deprecated version changed|Class name: tag
Method or attribute name: function getNfcVTag(tagInfo: TagInfo): NfcVTag
Deprecated version: N/A|Class name: tag
Method or attribute name: function getNfcVTag(tagInfo: TagInfo): NfcVTag
Deprecated version: 9
Substitute API: ohos.nfc.tag/tag|@ohos.nfc.tag.d.ts| +|Deprecated version changed|Class name: TagSession
Method or attribute name: getTagInfo(): tag.TagInfo;
Deprecated version: N/A|Class name: TagSession
Method or attribute name: getTagInfo(): tag.TagInfo;
Deprecated version: 9
Substitute API: ohos.nfc.tag/tag|tagSession.d.ts| +|Deprecated version changed|Class name: TagSession
Method or attribute name: connectTag(): boolean;
Deprecated version: N/A|Class name: TagSession
Method or attribute name: connectTag(): boolean;
Deprecated version: 9
Substitute API: tagSession.TagSession|tagSession.d.ts| +|Deprecated version changed|Class name: TagSession
Method or attribute name: reset(): void;
Deprecated version: N/A|Class name: TagSession
Method or attribute name: reset(): void;
Deprecated version: 9
Substitute API: tagSession.TagSession|tagSession.d.ts| +|Deprecated version changed|Class name: TagSession
Method or attribute name: isTagConnected(): boolean;
Deprecated version: N/A|Class name: TagSession
Method or attribute name: isTagConnected(): boolean;
Deprecated version: 9
Substitute API: tagSession.TagSession|tagSession.d.ts| +|Deprecated version changed|Class name: TagSession
Method or attribute name: setSendDataTimeout(timeout: number): boolean;
Deprecated version: N/A|Class name: TagSession
Method or attribute name: setSendDataTimeout(timeout: number): boolean;
Deprecated version: 9
Substitute API: tagSession.TagSession|tagSession.d.ts| +|Deprecated version changed|Class name: TagSession
Method or attribute name: getSendDataTimeout(): number;
Deprecated version: N/A|Class name: TagSession
Method or attribute name: getSendDataTimeout(): number;
Deprecated version: 9
Substitute API: tagSession.TagSession|tagSession.d.ts| +|Deprecated version changed|Class name: TagSession
Method or attribute name: sendData(data: number[]): Promise;
Deprecated version: N/A|Class name: TagSession
Method or attribute name: sendData(data: number[]): Promise;
Deprecated version: 9
Substitute API: tagSession.TagSession|tagSession.d.ts| +|Deprecated version changed|Class name: TagSession
Method or attribute name: sendData(data: number[], callback: AsyncCallback): void;
Deprecated version: N/A|Class name: TagSession
Method or attribute name: sendData(data: number[], callback: AsyncCallback): void;
Deprecated version: 9|tagSession.d.ts| +|Deprecated version changed|Class name: TagSession
Method or attribute name: getMaxSendLength(): number;
Deprecated version: N/A|Class name: TagSession
Method or attribute name: getMaxSendLength(): number;
Deprecated version: 9
Substitute API: tagSession.TagSession|tagSession.d.ts| +|Initial version changed|Class name: FeatureType
Initial version: N/A|Class name: FeatureType
Initial version: 6|@ohos.nfc.cardEmulation.d.ts| +|Permission changed|Class name: A2dpSourceProfile
Method or attribute name: connect(device: string): boolean;
Permission: permission ohos.permission.DISCOVER_BLUETOOTH|Class name: A2dpSourceProfile
Method or attribute name: connect(device: string): boolean;
Permission: ohos.permission.DISCOVER_BLUETOOTH|@ohos.bluetooth.d.ts| +|Permission changed|Class name: A2dpSourceProfile
Method or attribute name: disconnect(device: string): boolean;
Permission: permission ohos.permission.DISCOVER_BLUETOOTH|Class name: A2dpSourceProfile
Method or attribute name: disconnect(device: string): boolean;
Permission: ohos.permission.DISCOVER_BLUETOOTH|@ohos.bluetooth.d.ts| +|Permission changed|Class name: HandsFreeAudioGatewayProfile
Method or attribute name: connect(device: string): boolean;
Permission: permission ohos.permission.DISCOVER_BLUETOOTH|Class name: HandsFreeAudioGatewayProfile
Method or attribute name: connect(device: string): boolean;
Permission: ohos.permission.DISCOVER_BLUETOOTH|@ohos.bluetooth.d.ts| +|Permission changed|Class name: HandsFreeAudioGatewayProfile
Method or attribute name: disconnect(device: string): boolean;
Permission: permission ohos.permission.DISCOVER_BLUETOOTH|Class name: HandsFreeAudioGatewayProfile
Method or attribute name: disconnect(device: string): boolean;
Permission: ohos.permission.DISCOVER_BLUETOOTH|@ohos.bluetooth.d.ts| +|Permission changed|Class name: HidHostProfile
Method or attribute name: connect(device: string): boolean;
Permission: permission ohos.permission.DISCOVER_BLUETOOTH|Class name: HidHostProfile
Method or attribute name: connect(device: string): boolean;
Permission: ohos.permission.DISCOVER_BLUETOOTH|@ohos.bluetooth.d.ts| +|Permission changed|Class name: HidHostProfile
Method or attribute name: disconnect(device: string): boolean;
Permission: permission ohos.permission.DISCOVER_BLUETOOTH|Class name: HidHostProfile
Method or attribute name: disconnect(device: string): boolean;
Permission: ohos.permission.DISCOVER_BLUETOOTH|@ohos.bluetooth.d.ts| +|Permission changed|Class name: PanProfile
Method or attribute name: disconnect(device: string): boolean;
Permission: permission ohos.permission.USE_BLUETOOTH|Class name: PanProfile
Method or attribute name: disconnect(device: string): boolean;
Permission: ohos.permission.USE_BLUETOOTH|@ohos.bluetooth.d.ts| +|Permission changed|Class name: PanProfile
Method or attribute name: setTethering(enable: boolean): void;
Permission: permission ohos.permission.DISCOVER_BLUETOOTH|Class name: PanProfile
Method or attribute name: setTethering(enable: boolean): void;
Permission: ohos.permission.DISCOVER_BLUETOOTH|@ohos.bluetooth.d.ts| +|Permission changed|Class name: connectedTag
Method or attribute name: function init(): boolean;
Permission: s ohos.permission.NFC_TAG|Class name: connectedTag
Method or attribute name: function init(): boolean;
Permission: ohos.permission.NFC_TAG|@ohos.connectedTag.d.ts| +|Permission changed|Class name: connectedTag
Method or attribute name: function uninit(): boolean;
Permission: s ohos.permission.NFC_TAG|Class name: connectedTag
Method or attribute name: function uninit(): boolean;
Permission: ohos.permission.NFC_TAG|@ohos.connectedTag.d.ts| +|Permission changed|Class name: connectedTag
Method or attribute name: function readNdefTag(): Promise;
Permission: s ohos.permission.NFC_TAG|Class name: connectedTag
Method or attribute name: function readNdefTag(): Promise;
Permission: ohos.permission.NFC_TAG|@ohos.connectedTag.d.ts| +|Permission changed|Class name: connectedTag
Method or attribute name: function readNdefTag(callback: AsyncCallback): void;
Permission: s ohos.permission.NFC_TAG|Class name: connectedTag
Method or attribute name: function readNdefTag(callback: AsyncCallback): void;
Permission: ohos.permission.NFC_TAG|@ohos.connectedTag.d.ts| +|Permission changed|Class name: connectedTag
Method or attribute name: function writeNdefTag(data: string): Promise;
Permission: s ohos.permission.NFC_TAG|Class name: connectedTag
Method or attribute name: function writeNdefTag(data: string): Promise;
Permission: ohos.permission.NFC_TAG|@ohos.connectedTag.d.ts| +|Permission changed|Class name: connectedTag
Method or attribute name: function writeNdefTag(data: string, callback: AsyncCallback): void;
Permission: s ohos.permission.NFC_TAG|Class name: connectedTag
Method or attribute name: function writeNdefTag(data: string, callback: AsyncCallback): void;
Permission: ohos.permission.NFC_TAG|@ohos.connectedTag.d.ts| +|Permission changed|Class name: connectedTag
Method or attribute name: function on(type: "notify", callback: Callback): void;
Permission: s ohos.permission.NFC_TAG|Class name: connectedTag
Method or attribute name: function on(type: "notify", callback: Callback): void;
Permission: ohos.permission.NFC_TAG|@ohos.connectedTag.d.ts| +|Permission changed|Class name: connectedTag
Method or attribute name: function off(type: "notify", callback?:Callback): void;
Permission: s ohos.permission.NFC_TAG|Class name: connectedTag
Method or attribute name: function off(type: "notify", callback?:Callback): void;
Permission: ohos.permission.NFC_TAG|@ohos.connectedTag.d.ts| +|Permission deleted|Class name: tag
Method or attribute name: function getNfcATag(tagInfo: TagInfo): NfcATag
Permission: ohos.permission.NFC_TAG|Class name: tag
Method or attribute name: function getNfcATag(tagInfo: TagInfo): NfcATag
Permission: N/A|@ohos.nfc.tag.d.ts| +|Permission deleted|Class name: tag
Method or attribute name: function getNfcBTag(tagInfo: TagInfo): NfcBTag
Permission: ohos.permission.NFC_TAG|Class name: tag
Method or attribute name: function getNfcBTag(tagInfo: TagInfo): NfcBTag
Permission: N/A|@ohos.nfc.tag.d.ts| +|Permission deleted|Class name: tag
Method or attribute name: function getNfcFTag(tagInfo: TagInfo): NfcFTag
Permission: ohos.permission.NFC_TAG|Class name: tag
Method or attribute name: function getNfcFTag(tagInfo: TagInfo): NfcFTag
Permission: N/A|@ohos.nfc.tag.d.ts| +|Permission deleted|Class name: tag
Method or attribute name: function getNfcVTag(tagInfo: TagInfo): NfcVTag
Permission: ohos.permission.NFC_TAG|Class name: tag
Method or attribute name: function getNfcVTag(tagInfo: TagInfo): NfcVTag
Permission: N/A|@ohos.nfc.tag.d.ts| +|Permission deleted|Class name: NfcATag
Method or attribute name: getSak(): number;
Permission: ohos.permission.NFC_TAG|Class name: NfcATag
Method or attribute name: getSak(): number;
Permission: N/A|nfctech.d.ts| +|Permission deleted|Class name: NfcATag
Method or attribute name: getAtqa(): number[];
Permission: ohos.permission.NFC_TAG|Class name: NfcATag
Method or attribute name: getAtqa(): number[];
Permission: N/A|nfctech.d.ts| +|Permission deleted|Class name: NfcBTag
Method or attribute name: getRespAppData(): number[];
Permission: ohos.permission.NFC_TAG|Class name: NfcBTag
Method or attribute name: getRespAppData(): number[];
Permission: N/A|nfctech.d.ts| +|Permission deleted|Class name: NfcBTag
Method or attribute name: getRespProtocol(): number[];
Permission: ohos.permission.NFC_TAG|Class name: NfcBTag
Method or attribute name: getRespProtocol(): number[];
Permission: N/A|nfctech.d.ts| +|Permission deleted|Class name: NfcFTag
Method or attribute name: getSystemCode(): number[];
Permission: ohos.permission.NFC_TAG|Class name: NfcFTag
Method or attribute name: getSystemCode(): number[];
Permission: N/A|nfctech.d.ts| +|Permission deleted|Class name: NfcFTag
Method or attribute name: getPmm(): number[];
Permission: ohos.permission.NFC_TAG|Class name: NfcFTag
Method or attribute name: getPmm(): number[];
Permission: N/A|nfctech.d.ts| +|Permission deleted|Class name: NfcVTag
Method or attribute name: getResponseFlags(): number;
Permission: ohos.permission.NFC_TAG|Class name: NfcVTag
Method or attribute name: getResponseFlags(): number;
Permission: N/A|nfctech.d.ts| +|Permission deleted|Class name: NfcVTag
Method or attribute name: getDsfId(): number;
Permission: ohos.permission.NFC_TAG|Class name: NfcVTag
Method or attribute name: getDsfId(): number;
Permission: N/A|nfctech.d.ts| +|Permission deleted|Class name: TagSession
Method or attribute name: isTagConnected(): boolean;
Permission: ohos.permission.NFC_TAG|Class name: TagSession
Method or attribute name: isTagConnected(): boolean;
Permission: N/A|tagSession.d.ts| +|Permission added|Class name: connection
Method or attribute name: function hasDefaultNet(callback: AsyncCallback): void;
Permission: N/A|Class name: connection
Method or attribute name: function hasDefaultNet(callback: AsyncCallback): void;
Permission: ohos.permission.GET_NETWORK_INFO|@ohos.net.connection.d.ts| +|Permission added|Class name: connection
Method or attribute name: function hasDefaultNet(): Promise;
Permission: N/A|Class name: connection
Method or attribute name: function hasDefaultNet(): Promise;
Permission: ohos.permission.GET_NETWORK_INFO|@ohos.net.connection.d.ts| +|Function changed|Class name: wifiManager
Method or attribute name: function disconnect(): boolean;
|Class name: wifiManager
Method or attribute name: function disconnect(): void;
|@ohos.wifiManager.d.ts| diff --git a/en/release-notes/api-change/v3.2-beta5/js-apidiff-compiler-and-runtime.md b/en/release-notes/api-change/v3.2-beta5/js-apidiff-compiler-and-runtime.md new file mode 100644 index 0000000000000000000000000000000000000000..7e16ba13415a7d704fa888368748c91a6b455d48 --- /dev/null +++ b/en/release-notes/api-change/v3.2-beta5/js-apidiff-compiler-and-runtime.md @@ -0,0 +1,25 @@ +| Change Type | Old Version | New Version | d.ts File | +| ---- | ------ | ------ | -------- | +|Added|NA|Module name: ohos.taskpool
Class name: taskpool|@ohos.taskpool.d.ts| +|Added|NA|Module name: ohos.taskpool
Class name: Priority|@ohos.taskpool.d.ts| +|Added|NA|Module name: ohos.taskpool
Class name: Priority
Method or attribute name: HIGH|@ohos.taskpool.d.ts| +|Added|NA|Module name: ohos.taskpool
Class name: Priority
Method or attribute name: MEDIUM|@ohos.taskpool.d.ts| +|Added|NA|Module name: ohos.taskpool
Class name: Priority
Method or attribute name: LOW|@ohos.taskpool.d.ts| +|Added|NA|Module name: ohos.taskpool
Class name: Task|@ohos.taskpool.d.ts| +|Added|NA|Module name: ohos.taskpool
Class name: Task
Method or attribute name: constructor(func: Function, ...args: unknown[]);|@ohos.taskpool.d.ts| +|Added|NA|Module name: ohos.taskpool
Class name: Task
Method or attribute name: function: Function;|@ohos.taskpool.d.ts| +|Added|NA|Module name: ohos.taskpool
Class name: Task
Method or attribute name: arguments?: unknown[];|@ohos.taskpool.d.ts| +|Added|NA|Module name: ohos.taskpool
Class name: taskpool
Method or attribute name: function execute(func: Function, ...args: unknown[]): Promise;|@ohos.taskpool.d.ts| +|Added|NA|Module name: ohos.taskpool
Class name: taskpool
Method or attribute name: function execute(task: Task, priority?: Priority): Promise;|@ohos.taskpool.d.ts| +|Added|NA|Module name: ohos.taskpool
Class name: taskpool
Method or attribute name: function cancel(task: Task): void;|@ohos.taskpool.d.ts| +|Added|NA|Class name: URLParams
Method or attribute name: constructor(init?: string[][] \| Record \| string \| URLParams);|@ohos.url.d.ts| +|Added|NA|Class name: URL
Method or attribute name: readonly params: URLParams;|@ohos.url.d.ts| +|Deprecated version changed|Class name: URL
Method or attribute name: readonly searchParams: URLSearchParams;
Deprecated version: N/A|Class name: URL
Method or attribute name: readonly searchParams: URLSearchParams;
Deprecated version: 9
Substitute API: ohos.url.URL.params |@ohos.url.d.ts| +|Deprecated version changed|Class name: worker
Method or attribute name: const parentPort: DedicatedWorkerGlobalScope;
Deprecated version: N/A|Class name: worker
Method or attribute name: const parentPort: DedicatedWorkerGlobalScope;
Deprecated version: 9
Substitute API: ohos.worker.workerPort |@ohos.worker.d.ts| +|Initial version changed|Class name: URL
Method or attribute name: static parseURL(url: string, base?: string \| URL): URL;
Initial version: N/A|Class name: URL
Method or attribute name: static parseURL(url: string, base?: string \| URL): URL;
Initial version: 9|@ohos.url.d.ts| +|Initial version changed|Class name: worker
Method or attribute name: const parentPort: DedicatedWorkerGlobalScope;
Initial version: N/A|Class name: worker
Method or attribute name: const parentPort: DedicatedWorkerGlobalScope;
Initial version: 7|@ohos.worker.d.ts| +|Initial version changed|Class name: worker
Method or attribute name: const workerPort: ThreadWorkerGlobalScope;
Initial version: N/A|Class name: worker
Method or attribute name: const workerPort: ThreadWorkerGlobalScope;
Initial version: 9|@ohos.worker.d.ts| +|Function changed|Class name: DedicatedWorkerGlobalScope
Method or attribute name: onmessage?: (this: DedicatedWorkerGlobalScope, ev: MessageEvent) => void;
|Class name: DedicatedWorkerGlobalScope
Method or attribute name: onmessage?: (this: DedicatedWorkerGlobalScope, ev: MessageEvent) => void;
|@ohos.worker.d.ts| +|Function changed|Class name: DedicatedWorkerGlobalScope
Method or attribute name: onmessageerror?: (this: DedicatedWorkerGlobalScope, ev: MessageEvent) => void;
|Class name: DedicatedWorkerGlobalScope
Method or attribute name: onmessageerror?: (this: DedicatedWorkerGlobalScope, ev: MessageEvent) => void;
|@ohos.worker.d.ts| +|Function changed|Class name: Worker
Method or attribute name: onmessage?: (event: MessageEvent) => void;
|Class name: Worker
Method or attribute name: onmessage?: (event: MessageEvent) => void;
|@ohos.worker.d.ts| +|Function changed|Class name: Worker
Method or attribute name: onmessageerror?: (event: MessageEvent) => void;
|Class name: Worker
Method or attribute name: onmessageerror?: (event: MessageEvent) => void;
|@ohos.worker.d.ts| diff --git a/en/release-notes/api-change/v3.2-beta5/js-apidiff-distributed-data.md b/en/release-notes/api-change/v3.2-beta5/js-apidiff-distributed-data.md new file mode 100644 index 0000000000000000000000000000000000000000..7cd57e2b19218831d46f924b88c96246d1483fd9 --- /dev/null +++ b/en/release-notes/api-change/v3.2-beta5/js-apidiff-distributed-data.md @@ -0,0 +1,309 @@ +| Change Type | Old Version | New Version | d.ts File | +| ---- | ------ | ------ | -------- | +|Added|NA|Class name: distributedKVStore
Method or attribute name: function createKVManager(config: KVManagerConfig): KVManager;|@ohos.data.distributedKVStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: relationalStore|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: relationalStore
Method or attribute name: type ValuesBucket = { [key:string]: ValueType \| Uint8Array \| null;}|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: relationalStore
Method or attribute name: function getRdbStore(context: Context, config: StoreConfig, callback: AsyncCallback): void;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: relationalStore
Method or attribute name: function getRdbStore(context: Context, config: StoreConfig): Promise;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: relationalStore
Method or attribute name: function deleteRdbStore(context: Context, name: string, callback: AsyncCallback): void;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: relationalStore
Method or attribute name: function deleteRdbStore(context: Context, name: string): Promise;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: SyncMode|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: SyncMode
Method or attribute name: SYNC_MODE_PUSH = 0|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: SyncMode
Method or attribute name: SYNC_MODE_PULL = 1|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: SubscribeType|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: SubscribeType
Method or attribute name: SUBSCRIBE_TYPE_REMOTE = 0|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: SecurityLevel|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: SecurityLevel
Method or attribute name: S1 = 1|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: SecurityLevel
Method or attribute name: S2 = 2|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: SecurityLevel
Method or attribute name: S3 = 3|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: SecurityLevel
Method or attribute name: S4 = 4|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbStore|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbStore
Method or attribute name: insert(table: string, values: ValuesBucket, callback: AsyncCallback): void;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbStore
Method or attribute name: insert(table: string, values: ValuesBucket): Promise;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbStore
Method or attribute name: batchInsert(table: string, values: Array, callback: AsyncCallback): void;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbStore
Method or attribute name: batchInsert(table: string, values: Array): Promise;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbStore
Method or attribute name: update(values: ValuesBucket, predicates: RdbPredicates, callback: AsyncCallback): void;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbStore
Method or attribute name: update(values: ValuesBucket, predicates: RdbPredicates): Promise;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbStore
Method or attribute name: update(table: string, values: ValuesBucket, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbStore
Method or attribute name: update(table: string, values: ValuesBucket, predicates: dataSharePredicates.DataSharePredicates): Promise;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbStore
Method or attribute name: delete(predicates: RdbPredicates, callback: AsyncCallback): void;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbStore
Method or attribute name: delete(predicates: RdbPredicates): Promise;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbStore
Method or attribute name: delete(table: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbStore
Method or attribute name: delete(table: string, predicates: dataSharePredicates.DataSharePredicates): Promise;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbStore
Method or attribute name: query(predicates: RdbPredicates, columns: Array, callback: AsyncCallback): void;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbStore
Method or attribute name: query(predicates: RdbPredicates, columns ?: Array): Promise;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbStore
Method or attribute name: query(table: string, predicates: dataSharePredicates.DataSharePredicates, columns: Array, callback: AsyncCallback): void;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbStore
Method or attribute name: query(table: string, predicates: dataSharePredicates.DataSharePredicates, columns ?: Array): Promise;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbStore
Method or attribute name: remoteQuery(device: string, table: string, predicates: RdbPredicates, columns: Array, callback: AsyncCallback): void;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbStore
Method or attribute name: remoteQuery(device: string, table: string, predicates: RdbPredicates, columns: Array): Promise;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbStore
Method or attribute name: querySql(sql: string, bindArgs: Array, callback: AsyncCallback): void;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbStore
Method or attribute name: querySql(sql: string, bindArgs ?: Array): Promise;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbStore
Method or attribute name: executeSql(sql: string, bindArgs: Array, callback: AsyncCallback): void;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbStore
Method or attribute name: executeSql(sql: string, bindArgs ?: Array): Promise;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbStore
Method or attribute name: beginTransaction(): void;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbStore
Method or attribute name: commit(): void;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbStore
Method or attribute name: rollBack(): void;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbStore
Method or attribute name: backup(destName: string, callback: AsyncCallback): void;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbStore
Method or attribute name: backup(destName: string): Promise;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbStore
Method or attribute name: restore(srcName: string, callback: AsyncCallback): void;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbStore
Method or attribute name: restore(srcName: string): Promise;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbStore
Method or attribute name: setDistributedTables(tables: Array, callback: AsyncCallback): void;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbStore
Method or attribute name: setDistributedTables(tables: Array): Promise;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbStore
Method or attribute name: obtainDistributedTableName(device: string, table: string, callback: AsyncCallback): void;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbStore
Method or attribute name: obtainDistributedTableName(device: string, table: string): Promise;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbStore
Method or attribute name: sync(mode: SyncMode, predicates: RdbPredicates, callback: AsyncCallback>): void;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbStore
Method or attribute name: sync(mode: SyncMode, predicates: RdbPredicates): Promise>;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbStore
Method or attribute name: on(event: 'dataChange', type: SubscribeType, observer: Callback>): void;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbStore
Method or attribute name: off(event: 'dataChange', type: SubscribeType, observer: Callback>): void;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: StoreConfig|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: StoreConfig
Method or attribute name: name: string;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: StoreConfig
Method or attribute name: securityLevel: SecurityLevel;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: StoreConfig
Method or attribute name: encrypt ?: boolean;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbPredicates|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbPredicates
Method or attribute name: constructor(name: string)|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbPredicates
Method or attribute name: inDevices(devices: Array): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbPredicates
Method or attribute name: inAllDevices(): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbPredicates
Method or attribute name: equalTo(field: string, value: ValueType): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbPredicates
Method or attribute name: notEqualTo(field: string, value: ValueType): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbPredicates
Method or attribute name: beginWrap(): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbPredicates
Method or attribute name: endWrap(): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbPredicates
Method or attribute name: or(): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbPredicates
Method or attribute name: and(): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbPredicates
Method or attribute name: contains(field: string, value: string): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbPredicates
Method or attribute name: beginsWith(field: string, value: string): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbPredicates
Method or attribute name: endsWith(field: string, value: string): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbPredicates
Method or attribute name: isNull(field: string): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbPredicates
Method or attribute name: isNotNull(field: string): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbPredicates
Method or attribute name: like(field: string, value: string): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbPredicates
Method or attribute name: glob(field: string, value: string): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbPredicates
Method or attribute name: between(field: string, low: ValueType, high: ValueType): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbPredicates
Method or attribute name: notBetween(field: string, low: ValueType, high: ValueType): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbPredicates
Method or attribute name: greaterThan(field: string, value: ValueType): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbPredicates
Method or attribute name: lessThan(field: string, value: ValueType): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbPredicates
Method or attribute name: greaterThanOrEqualTo(field: string, value: ValueType): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbPredicates
Method or attribute name: lessThanOrEqualTo(field: string, value: ValueType): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbPredicates
Method or attribute name: orderByAsc(field: string): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbPredicates
Method or attribute name: orderByDesc(field: string): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbPredicates
Method or attribute name: distinct(): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbPredicates
Method or attribute name: limitAs(value: number): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbPredicates
Method or attribute name: offsetAs(rowOffset: number): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbPredicates
Method or attribute name: groupBy(fields: Array): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbPredicates
Method or attribute name: indexedBy(field: string): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbPredicates
Method or attribute name: in(field: string, value: Array): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: RdbPredicates
Method or attribute name: notIn(field: string, value: Array): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: ResultSet|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: ResultSet
Method or attribute name: columnNames: Array;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: ResultSet
Method or attribute name: columnCount: number;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: ResultSet
Method or attribute name: rowCount: number;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: ResultSet
Method or attribute name: rowIndex: number;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: ResultSet
Method or attribute name: isAtFirstRow: boolean;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: ResultSet
Method or attribute name: isAtLastRow: boolean;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: ResultSet
Method or attribute name: isEnded: boolean;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: ResultSet
Method or attribute name: isStarted: boolean;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: ResultSet
Method or attribute name: isClosed: boolean;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: ResultSet
Method or attribute name: getColumnIndex(columnName: string): number;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: ResultSet
Method or attribute name: getColumnName(columnIndex: number): string;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: ResultSet
Method or attribute name: goTo(offset: number): boolean;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: ResultSet
Method or attribute name: goToRow(position: number): boolean;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: ResultSet
Method or attribute name: goToFirstRow(): boolean;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: ResultSet
Method or attribute name: goToLastRow(): boolean;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: ResultSet
Method or attribute name: goToNextRow(): boolean;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: ResultSet
Method or attribute name: goToPreviousRow(): boolean;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: ResultSet
Method or attribute name: getBlob(columnIndex: number): Uint8Array;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: ResultSet
Method or attribute name: getString(columnIndex: number): string;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: ResultSet
Method or attribute name: getLong(columnIndex: number): number;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: ResultSet
Method or attribute name: getDouble(columnIndex: number): number;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: ResultSet
Method or attribute name: isColumnNull(columnIndex: number): boolean;|@ohos.data.relationalStore.d.ts| +|Added|NA|Module name: ohos.data.relationalStore
Class name: ResultSet
Method or attribute name: close(): void;|@ohos.data.relationalStore.d.ts| +|Model changed|Class name: dataSharePredicates
Model: N/A|Class name: dataSharePredicates
Model: @StageModelOnly|@ohos.data.dataSharePredicates.d.ts| +|Model changed|Class name: DataSharePredicates
Model: N/A|Class name: DataSharePredicates
Model: @StageModelOnly|@ohos.data.dataSharePredicates.d.ts| +|Model changed|Class name: DataSharePredicates
Method or attribute name: equalTo(field: string, value: ValueType): DataSharePredicates;
Model: N/A|Class name: DataSharePredicates
Method or attribute name: equalTo(field: string, value: ValueType): DataSharePredicates;
Model: @StageModelOnly|@ohos.data.dataSharePredicates.d.ts| +|Model changed|Class name: DataSharePredicates
Method or attribute name: notEqualTo(field: string, value: ValueType): DataSharePredicates;
Model: N/A|Class name: DataSharePredicates
Method or attribute name: notEqualTo(field: string, value: ValueType): DataSharePredicates;
Model: @StageModelOnly|@ohos.data.dataSharePredicates.d.ts| +|Model changed|Class name: DataSharePredicates
Method or attribute name: beginWrap(): DataSharePredicates;
Model: N/A|Class name: DataSharePredicates
Method or attribute name: beginWrap(): DataSharePredicates;
Model: @StageModelOnly|@ohos.data.dataSharePredicates.d.ts| +|Model changed|Class name: DataSharePredicates
Method or attribute name: endWrap(): DataSharePredicates;
Model: N/A|Class name: DataSharePredicates
Method or attribute name: endWrap(): DataSharePredicates;
Model: @StageModelOnly|@ohos.data.dataSharePredicates.d.ts| +|Model changed|Class name: DataSharePredicates
Method or attribute name: or(): DataSharePredicates;
Model: N/A|Class name: DataSharePredicates
Method or attribute name: or(): DataSharePredicates;
Model: @StageModelOnly|@ohos.data.dataSharePredicates.d.ts| +|Model changed|Class name: DataSharePredicates
Method or attribute name: and(): DataSharePredicates;
Model: N/A|Class name: DataSharePredicates
Method or attribute name: and(): DataSharePredicates;
Model: @StageModelOnly|@ohos.data.dataSharePredicates.d.ts| +|Model changed|Class name: DataSharePredicates
Method or attribute name: contains(field: string, value: string): DataSharePredicates;
Model: N/A|Class name: DataSharePredicates
Method or attribute name: contains(field: string, value: string): DataSharePredicates;
Model: @StageModelOnly|@ohos.data.dataSharePredicates.d.ts| +|Model changed|Class name: DataSharePredicates
Method or attribute name: beginsWith(field: string, value: string): DataSharePredicates;
Model: N/A|Class name: DataSharePredicates
Method or attribute name: beginsWith(field: string, value: string): DataSharePredicates;
Model: @StageModelOnly|@ohos.data.dataSharePredicates.d.ts| +|Model changed|Class name: DataSharePredicates
Method or attribute name: endsWith(field: string, value: string): DataSharePredicates;
Model: N/A|Class name: DataSharePredicates
Method or attribute name: endsWith(field: string, value: string): DataSharePredicates;
Model: @StageModelOnly|@ohos.data.dataSharePredicates.d.ts| +|Model changed|Class name: DataSharePredicates
Method or attribute name: isNull(field: string): DataSharePredicates;
Model: N/A|Class name: DataSharePredicates
Method or attribute name: isNull(field: string): DataSharePredicates;
Model: @StageModelOnly|@ohos.data.dataSharePredicates.d.ts| +|Model changed|Class name: DataSharePredicates
Method or attribute name: isNotNull(field: string): DataSharePredicates;
Model: N/A|Class name: DataSharePredicates
Method or attribute name: isNotNull(field: string): DataSharePredicates;
Model: @StageModelOnly|@ohos.data.dataSharePredicates.d.ts| +|Model changed|Class name: DataSharePredicates
Method or attribute name: like(field: string, value: string): DataSharePredicates;
Model: N/A|Class name: DataSharePredicates
Method or attribute name: like(field: string, value: string): DataSharePredicates;
Model: @StageModelOnly|@ohos.data.dataSharePredicates.d.ts| +|Model changed|Class name: DataSharePredicates
Method or attribute name: unlike(field: string, value: string): DataSharePredicates;
Model: N/A|Class name: DataSharePredicates
Method or attribute name: unlike(field: string, value: string): DataSharePredicates;
Model: @StageModelOnly|@ohos.data.dataSharePredicates.d.ts| +|Model changed|Class name: DataSharePredicates
Method or attribute name: glob(field: string, value: string): DataSharePredicates;
Model: N/A|Class name: DataSharePredicates
Method or attribute name: glob(field: string, value: string): DataSharePredicates;
Model: @StageModelOnly|@ohos.data.dataSharePredicates.d.ts| +|Model changed|Class name: DataSharePredicates
Method or attribute name: between(field: string, low: ValueType, high: ValueType): DataSharePredicates;
Model: N/A|Class name: DataSharePredicates
Method or attribute name: between(field: string, low: ValueType, high: ValueType): DataSharePredicates;
Model: @StageModelOnly|@ohos.data.dataSharePredicates.d.ts| +|Model changed|Class name: DataSharePredicates
Method or attribute name: notBetween(field: string, low: ValueType, high: ValueType): DataSharePredicates;
Model: N/A|Class name: DataSharePredicates
Method or attribute name: notBetween(field: string, low: ValueType, high: ValueType): DataSharePredicates;
Model: @StageModelOnly|@ohos.data.dataSharePredicates.d.ts| +|Model changed|Class name: DataSharePredicates
Method or attribute name: greaterThan(field: string, value: ValueType): DataSharePredicates;
Model: N/A|Class name: DataSharePredicates
Method or attribute name: greaterThan(field: string, value: ValueType): DataSharePredicates;
Model: @StageModelOnly|@ohos.data.dataSharePredicates.d.ts| +|Model changed|Class name: DataSharePredicates
Method or attribute name: lessThan(field: string, value: ValueType): DataSharePredicates;
Model: N/A|Class name: DataSharePredicates
Method or attribute name: lessThan(field: string, value: ValueType): DataSharePredicates;
Model: @StageModelOnly|@ohos.data.dataSharePredicates.d.ts| +|Model changed|Class name: DataSharePredicates
Method or attribute name: greaterThanOrEqualTo(field: string, value: ValueType): DataSharePredicates;
Model: N/A|Class name: DataSharePredicates
Method or attribute name: greaterThanOrEqualTo(field: string, value: ValueType): DataSharePredicates;
Model: @StageModelOnly|@ohos.data.dataSharePredicates.d.ts| +|Model changed|Class name: DataSharePredicates
Method or attribute name: lessThanOrEqualTo(field: string, value: ValueType): DataSharePredicates;
Model: N/A|Class name: DataSharePredicates
Method or attribute name: lessThanOrEqualTo(field: string, value: ValueType): DataSharePredicates;
Model: @StageModelOnly|@ohos.data.dataSharePredicates.d.ts| +|Model changed|Class name: DataSharePredicates
Method or attribute name: orderByAsc(field: string): DataSharePredicates;
Model: N/A|Class name: DataSharePredicates
Method or attribute name: orderByAsc(field: string): DataSharePredicates;
Model: @StageModelOnly|@ohos.data.dataSharePredicates.d.ts| +|Model changed|Class name: DataSharePredicates
Method or attribute name: orderByDesc(field: string): DataSharePredicates;
Model: N/A|Class name: DataSharePredicates
Method or attribute name: orderByDesc(field: string): DataSharePredicates;
Model: @StageModelOnly|@ohos.data.dataSharePredicates.d.ts| +|Model changed|Class name: DataSharePredicates
Method or attribute name: distinct(): DataSharePredicates;
Model: N/A|Class name: DataSharePredicates
Method or attribute name: distinct(): DataSharePredicates;
Model: @StageModelOnly|@ohos.data.dataSharePredicates.d.ts| +|Model changed|Class name: DataSharePredicates
Method or attribute name: limit(total: number, offset: number): DataSharePredicates;
Model: N/A|Class name: DataSharePredicates
Method or attribute name: limit(total: number, offset: number): DataSharePredicates;
Model: @StageModelOnly|@ohos.data.dataSharePredicates.d.ts| +|Model changed|Class name: DataSharePredicates
Method or attribute name: groupBy(fields: Array): DataSharePredicates;
Model: N/A|Class name: DataSharePredicates
Method or attribute name: groupBy(fields: Array): DataSharePredicates;
Model: @StageModelOnly|@ohos.data.dataSharePredicates.d.ts| +|Model changed|Class name: DataSharePredicates
Method or attribute name: indexedBy(field: string): DataSharePredicates;
Model: N/A|Class name: DataSharePredicates
Method or attribute name: indexedBy(field: string): DataSharePredicates;
Model: @StageModelOnly|@ohos.data.dataSharePredicates.d.ts| +|Model changed|Class name: DataSharePredicates
Method or attribute name: in(field: string, value: Array): DataSharePredicates;
Model: N/A|Class name: DataSharePredicates
Method or attribute name: in(field: string, value: Array): DataSharePredicates;
Model: @StageModelOnly|@ohos.data.dataSharePredicates.d.ts| +|Model changed|Class name: DataSharePredicates
Method or attribute name: notIn(field: string, value: Array): DataSharePredicates;
Model: N/A|Class name: DataSharePredicates
Method or attribute name: notIn(field: string, value: Array): DataSharePredicates;
Model: @StageModelOnly|@ohos.data.dataSharePredicates.d.ts| +|Model changed|Class name: DataSharePredicates
Method or attribute name: prefixKey(prefix: string): DataSharePredicates;
Model: N/A|Class name: DataSharePredicates
Method or attribute name: prefixKey(prefix: string): DataSharePredicates;
Model: @StageModelOnly|@ohos.data.dataSharePredicates.d.ts| +|Model changed|Class name: DataSharePredicates
Method or attribute name: inKeys(keys: Array): DataSharePredicates;
Model: N/A|Class name: DataSharePredicates
Method or attribute name: inKeys(keys: Array): DataSharePredicates;
Model: @StageModelOnly|@ohos.data.dataSharePredicates.d.ts| +|Model changed|Class name: DataType
Model: N/A|Class name: DataType
Model: @StageModelOnly|@ohos.data.DataShareResultSet.d.ts| +|Model changed|Class name: DataType
Method or attribute name: TYPE_NULL = 0
Model: N/A|Class name: DataType
Method or attribute name: TYPE_NULL = 0
Model: @StageModelOnly|@ohos.data.DataShareResultSet.d.ts| +|Model changed|Class name: DataType
Method or attribute name: TYPE_LONG = 1
Model: N/A|Class name: DataType
Method or attribute name: TYPE_LONG = 1
Model: @StageModelOnly|@ohos.data.DataShareResultSet.d.ts| +|Model changed|Class name: DataType
Method or attribute name: TYPE_DOUBLE = 2
Model: N/A|Class name: DataType
Method or attribute name: TYPE_DOUBLE = 2
Model: @StageModelOnly|@ohos.data.DataShareResultSet.d.ts| +|Model changed|Class name: DataType
Method or attribute name: TYPE_STRING = 3
Model: N/A|Class name: DataType
Method or attribute name: TYPE_STRING = 3
Model: @StageModelOnly|@ohos.data.DataShareResultSet.d.ts| +|Model changed|Class name: DataType
Method or attribute name: TYPE_BLOB = 4
Model: N/A|Class name: DataType
Method or attribute name: TYPE_BLOB = 4
Model: @StageModelOnly|@ohos.data.DataShareResultSet.d.ts| +|Model changed|Class name: DataShareResultSet
Model: N/A|Class name: DataShareResultSet
Model: @StageModelOnly|@ohos.data.DataShareResultSet.d.ts| +|Model changed|Class name: DataShareResultSet
Method or attribute name: columnNames: Array;
Model: N/A|Class name: DataShareResultSet
Method or attribute name: columnNames: Array;
Model: @StageModelOnly|@ohos.data.DataShareResultSet.d.ts| +|Model changed|Class name: DataShareResultSet
Method or attribute name: columnCount: number;
Model: N/A|Class name: DataShareResultSet
Method or attribute name: columnCount: number;
Model: @StageModelOnly|@ohos.data.DataShareResultSet.d.ts| +|Model changed|Class name: DataShareResultSet
Method or attribute name: rowCount: number;
Model: N/A|Class name: DataShareResultSet
Method or attribute name: rowCount: number;
Model: @StageModelOnly|@ohos.data.DataShareResultSet.d.ts| +|Model changed|Class name: DataShareResultSet
Method or attribute name: isClosed: boolean;
Model: N/A|Class name: DataShareResultSet
Method or attribute name: isClosed: boolean;
Model: @StageModelOnly|@ohos.data.DataShareResultSet.d.ts| +|Model changed|Class name: DataShareResultSet
Method or attribute name: goToFirstRow(): boolean;
Model: N/A|Class name: DataShareResultSet
Method or attribute name: goToFirstRow(): boolean;
Model: @StageModelOnly|@ohos.data.DataShareResultSet.d.ts| +|Model changed|Class name: DataShareResultSet
Method or attribute name: goToLastRow(): boolean;
Model: N/A|Class name: DataShareResultSet
Method or attribute name: goToLastRow(): boolean;
Model: @StageModelOnly|@ohos.data.DataShareResultSet.d.ts| +|Model changed|Class name: DataShareResultSet
Method or attribute name: goToNextRow(): boolean;
Model: N/A|Class name: DataShareResultSet
Method or attribute name: goToNextRow(): boolean;
Model: @StageModelOnly|@ohos.data.DataShareResultSet.d.ts| +|Model changed|Class name: DataShareResultSet
Method or attribute name: goToPreviousRow(): boolean;
Model: N/A|Class name: DataShareResultSet
Method or attribute name: goToPreviousRow(): boolean;
Model: @StageModelOnly|@ohos.data.DataShareResultSet.d.ts| +|Model changed|Class name: DataShareResultSet
Method or attribute name: goTo(offset: number): boolean;
Model: N/A|Class name: DataShareResultSet
Method or attribute name: goTo(offset: number): boolean;
Model: @StageModelOnly|@ohos.data.DataShareResultSet.d.ts| +|Model changed|Class name: DataShareResultSet
Method or attribute name: goToRow(position: number): boolean;
Model: N/A|Class name: DataShareResultSet
Method or attribute name: goToRow(position: number): boolean;
Model: @StageModelOnly|@ohos.data.DataShareResultSet.d.ts| +|Model changed|Class name: DataShareResultSet
Method or attribute name: getBlob(columnIndex: number): Uint8Array;
Model: N/A|Class name: DataShareResultSet
Method or attribute name: getBlob(columnIndex: number): Uint8Array;
Model: @StageModelOnly|@ohos.data.DataShareResultSet.d.ts| +|Model changed|Class name: DataShareResultSet
Method or attribute name: getString(columnIndex: number): string;
Model: N/A|Class name: DataShareResultSet
Method or attribute name: getString(columnIndex: number): string;
Model: @StageModelOnly|@ohos.data.DataShareResultSet.d.ts| +|Model changed|Class name: DataShareResultSet
Method or attribute name: getLong(columnIndex: number): number;
Model: N/A|Class name: DataShareResultSet
Method or attribute name: getLong(columnIndex: number): number;
Model: @StageModelOnly|@ohos.data.DataShareResultSet.d.ts| +|Model changed|Class name: DataShareResultSet
Method or attribute name: getDouble(columnIndex: number): number;
Model: N/A|Class name: DataShareResultSet
Method or attribute name: getDouble(columnIndex: number): number;
Model: @StageModelOnly|@ohos.data.DataShareResultSet.d.ts| +|Model changed|Class name: DataShareResultSet
Method or attribute name: close(): void;
Model: N/A|Class name: DataShareResultSet
Method or attribute name: close(): void;
Model: @StageModelOnly|@ohos.data.DataShareResultSet.d.ts| +|Model changed|Class name: DataShareResultSet
Method or attribute name: getColumnIndex(columnName: string): number;
Model: N/A|Class name: DataShareResultSet
Method or attribute name: getColumnIndex(columnName: string): number;
Model: @StageModelOnly|@ohos.data.DataShareResultSet.d.ts| +|Model changed|Class name: DataShareResultSet
Method or attribute name: getColumnName(columnIndex: number): string;
Model: N/A|Class name: DataShareResultSet
Method or attribute name: getColumnName(columnIndex: number): string;
Model: @StageModelOnly|@ohos.data.DataShareResultSet.d.ts| +|Model changed|Class name: DataShareResultSet
Method or attribute name: getDataType(columnIndex: number): DataType;
Model: N/A|Class name: DataShareResultSet
Method or attribute name: getDataType(columnIndex: number): DataType;
Model: @StageModelOnly|@ohos.data.DataShareResultSet.d.ts| +|Model changed|Class name: SingleKVStore
Method or attribute name: putBatch(value: Array, callback: AsyncCallback): void;
Model: N/A|Class name: SingleKVStore
Method or attribute name: putBatch(value: Array, callback: AsyncCallback): void;
Model: @StageModelOnly|@ohos.data.distributedKVStore.d.ts| +|Model changed|Class name: SingleKVStore
Method or attribute name: putBatch(value: Array): Promise;
Model: N/A|Class name: SingleKVStore
Method or attribute name: putBatch(value: Array): Promise;
Model: @StageModelOnly|@ohos.data.distributedKVStore.d.ts| +|Model changed|Class name: SingleKVStore
Method or attribute name: delete(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback);
Model: N/A|Class name: SingleKVStore
Method or attribute name: delete(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback);
Model: @StageModelOnly|@ohos.data.distributedKVStore.d.ts| +|Model changed|Class name: SingleKVStore
Method or attribute name: delete(predicates: dataSharePredicates.DataSharePredicates): Promise;
Model: N/A|Class name: SingleKVStore
Method or attribute name: delete(predicates: dataSharePredicates.DataSharePredicates): Promise;
Model: @StageModelOnly|@ohos.data.distributedKVStore.d.ts| +|Model changed|Class name: SingleKVStore
Method or attribute name: getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void;
Model: N/A|Class name: SingleKVStore
Method or attribute name: getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void;
Model: @StageModelOnly|@ohos.data.distributedKVStore.d.ts| +|Model changed|Class name: SingleKVStore
Method or attribute name: getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise;
Model: N/A|Class name: SingleKVStore
Method or attribute name: getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise;
Model: @StageModelOnly|@ohos.data.distributedKVStore.d.ts| +|Model changed|Class name: DeviceKVStore
Method or attribute name: getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void;
Model: N/A|Class name: DeviceKVStore
Method or attribute name: getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void;
Model: @StageModelOnly|@ohos.data.distributedKVStore.d.ts| +|Model changed|Class name: DeviceKVStore
Method or attribute name: getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise;
Model: N/A|Class name: DeviceKVStore
Method or attribute name: getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise;
Model: @StageModelOnly|@ohos.data.distributedKVStore.d.ts| +|Model changed|Class name: DeviceKVStore
Method or attribute name: getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void;
Model: N/A|Class name: DeviceKVStore
Method or attribute name: getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void;
Model: @StageModelOnly|@ohos.data.distributedKVStore.d.ts| +|Model changed|Class name: DeviceKVStore
Method or attribute name: getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicates): Promise;
Model: N/A|Class name: DeviceKVStore
Method or attribute name: getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicates): Promise;
Model: @StageModelOnly|@ohos.data.distributedKVStore.d.ts| +|Access level changed|Class name: dataSharePredicates
Access level: public API|Class name: dataSharePredicates
Access level: system API|@ohos.data.dataSharePredicates.d.ts| +|Deprecated version changed|Class name: rdb
Method or attribute name: type ValuesBucket = { [key:string]: ValueType \| Uint8Array \| null;
}
Deprecated version: N/A|Class name: rdb
Method or attribute name: type ValuesBucket = { [key:string]: ValueType \| Uint8Array \| null;
}
Deprecated version: 9
Substitute API: ohos.data.relationalStore.ValuesBucket |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: rdb
Method or attribute name: function getRdbStoreV9(context: Context, config: StoreConfigV9, version: number, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: rdb
Method or attribute name: function getRdbStoreV9(context: Context, config: StoreConfigV9, version: number, callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.getRdbStore |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: rdb
Method or attribute name: function getRdbStoreV9(context: Context, config: StoreConfigV9, version: number): Promise;
Deprecated version: N/A|Class name: rdb
Method or attribute name: function getRdbStoreV9(context: Context, config: StoreConfigV9, version: number): Promise;
Deprecated version: 9
Substitute API: N/A|@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: rdb
Method or attribute name: function deleteRdbStoreV9(context: Context, name: string, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: rdb
Method or attribute name: function deleteRdbStoreV9(context: Context, name: string, callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.getRdbStore |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: rdb
Method or attribute name: function deleteRdbStoreV9(context: Context, name: string): Promise;
Deprecated version: N/A|Class name: rdb
Method or attribute name: function deleteRdbStoreV9(context: Context, name: string): Promise;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.getRdbStore |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: SyncMode
Deprecated version: N/A|Class name: SyncMode
Deprecated version: 9
Substitute API: ohos.data.relationalStore.SyncMode |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: SyncMode
Method or attribute name: SYNC_MODE_PUSH = 0
Deprecated version: N/A|Class name: SyncMode
Method or attribute name: SYNC_MODE_PUSH = 0
Deprecated version: 9
Substitute API: ohos.data.relationalStore.SyncMode.SYNC_MODE_PUSH |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: SyncMode
Method or attribute name: SYNC_MODE_PULL = 1
Deprecated version: N/A|Class name: SyncMode
Method or attribute name: SYNC_MODE_PULL = 1
Deprecated version: 9
Substitute API: ohos.data.relationalStore.SyncMode.SYNC_MODE_PULL |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: SubscribeType
Deprecated version: N/A|Class name: SubscribeType
Deprecated version: 9
Substitute API: ohos.data.relationalStore.SubscribeType |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: SubscribeType
Method or attribute name: SUBSCRIBE_TYPE_REMOTE = 0
Deprecated version: N/A|Class name: SubscribeType
Method or attribute name: SUBSCRIBE_TYPE_REMOTE = 0
Deprecated version: 9
Substitute API: ohos.data.relationalStore.SubscribeType.SUBSCRIBE_TYPE_REMOTE |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: SecurityLevel
Deprecated version: N/A|Class name: SecurityLevel
Deprecated version: 9
Substitute API: ohos.data.relationalStore.SecurityLevel |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: SecurityLevel
Method or attribute name: S1 = 1
Deprecated version: N/A|Class name: SecurityLevel
Method or attribute name: S1 = 1
Deprecated version: 9
Substitute API: ohos.data.relationalStore.SubscribeType.SecurityLevel.S1 |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: SecurityLevel
Method or attribute name: S2 = 2
Deprecated version: N/A|Class name: SecurityLevel
Method or attribute name: S2 = 2
Deprecated version: 9
Substitute API: ohos.data.relationalStore.SubscribeType.SecurityLevel.S2 |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: SecurityLevel
Method or attribute name: S3 = 3
Deprecated version: N/A|Class name: SecurityLevel
Method or attribute name: S3 = 3
Deprecated version: 9
Substitute API: ohos.data.relationalStore.SubscribeType.SecurityLevel.S3 |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: SecurityLevel
Method or attribute name: S4 = 4
Deprecated version: N/A|Class name: SecurityLevel
Method or attribute name: S4 = 4
Deprecated version: 9
Substitute API: ohos.data.relationalStore.SubscribeType.SecurityLevel.S4 |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbStoreV9
Deprecated version: N/A|Class name: RdbStoreV9
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbStore |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbStoreV9
Method or attribute name: insert(table: string, values: ValuesBucket, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: RdbStoreV9
Method or attribute name: insert(table: string, values: ValuesBucket, callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbStore.insert |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbStoreV9
Method or attribute name: insert(table: string, values: ValuesBucket): Promise;
Deprecated version: N/A|Class name: RdbStoreV9
Method or attribute name: insert(table: string, values: ValuesBucket): Promise;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbStore.insert |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbStoreV9
Method or attribute name: batchInsert(table: string, values: Array, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: RdbStoreV9
Method or attribute name: batchInsert(table: string, values: Array, callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbStore.batchInsert |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbStoreV9
Method or attribute name: batchInsert(table: string, values: Array): Promise;
Deprecated version: N/A|Class name: RdbStoreV9
Method or attribute name: batchInsert(table: string, values: Array): Promise;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbStore.batchInsert |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbStoreV9
Method or attribute name: update(values: ValuesBucket, predicates: RdbPredicatesV9, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: RdbStoreV9
Method or attribute name: update(values: ValuesBucket, predicates: RdbPredicatesV9, callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbStore.update |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbStoreV9
Method or attribute name: update(values: ValuesBucket, predicates: RdbPredicatesV9): Promise;
Deprecated version: N/A|Class name: RdbStoreV9
Method or attribute name: update(values: ValuesBucket, predicates: RdbPredicatesV9): Promise;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbStore.update |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbStoreV9
Method or attribute name: update(table: string, values: ValuesBucket, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: RdbStoreV9
Method or attribute name: update(table: string, values: ValuesBucket, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbStore.update |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbStoreV9
Method or attribute name: update(table: string, values: ValuesBucket, predicates: dataSharePredicates.DataSharePredicates): Promise;
Deprecated version: N/A|Class name: RdbStoreV9
Method or attribute name: update(table: string, values: ValuesBucket, predicates: dataSharePredicates.DataSharePredicates): Promise;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbStore.update |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbStoreV9
Method or attribute name: delete(predicates: RdbPredicatesV9, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: RdbStoreV9
Method or attribute name: delete(predicates: RdbPredicatesV9, callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbStore.delete |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbStoreV9
Method or attribute name: delete(predicates: RdbPredicatesV9): Promise;
Deprecated version: N/A|Class name: RdbStoreV9
Method or attribute name: delete(predicates: RdbPredicatesV9): Promise;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbStore.delete |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbStoreV9
Method or attribute name: delete(table: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: RdbStoreV9
Method or attribute name: delete(table: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbStore.delete |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbStoreV9
Method or attribute name: delete(table: string, predicates: dataSharePredicates.DataSharePredicates): Promise;
Deprecated version: N/A|Class name: RdbStoreV9
Method or attribute name: delete(table: string, predicates: dataSharePredicates.DataSharePredicates): Promise;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbStore.delete |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbStoreV9
Method or attribute name: query(predicates: RdbPredicatesV9, columns: Array, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: RdbStoreV9
Method or attribute name: query(predicates: RdbPredicatesV9, columns: Array, callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbStore.query |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbStoreV9
Method or attribute name: query(predicates: RdbPredicatesV9, columns ?: Array): Promise;
Deprecated version: N/A|Class name: RdbStoreV9
Method or attribute name: query(predicates: RdbPredicatesV9, columns ?: Array): Promise;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbStore.query |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbStoreV9
Method or attribute name: query(table: string, predicates: dataSharePredicates.DataSharePredicates, columns: Array, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: RdbStoreV9
Method or attribute name: query(table: string, predicates: dataSharePredicates.DataSharePredicates, columns: Array, callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbStore.query |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbStoreV9
Method or attribute name: query(table: string, predicates: dataSharePredicates.DataSharePredicates, columns ?: Array): Promise;
Deprecated version: N/A|Class name: RdbStoreV9
Method or attribute name: query(table: string, predicates: dataSharePredicates.DataSharePredicates, columns ?: Array): Promise;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbStore.query |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbStoreV9
Method or attribute name: remoteQuery(device: string, table: string, predicates: RdbPredicatesV9, columns: Array, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: RdbStoreV9
Method or attribute name: remoteQuery(device: string, table: string, predicates: RdbPredicatesV9, columns: Array, callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbStore.remoteQuery |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbStoreV9
Method or attribute name: remoteQuery(device: string, table: string, predicates: RdbPredicatesV9, columns: Array): Promise;
Deprecated version: N/A|Class name: RdbStoreV9
Method or attribute name: remoteQuery(device: string, table: string, predicates: RdbPredicatesV9, columns: Array): Promise;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbStore.remoteQuery |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbStoreV9
Method or attribute name: querySql(sql: string, bindArgs: Array, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: RdbStoreV9
Method or attribute name: querySql(sql: string, bindArgs: Array, callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbStore.querySql |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbStoreV9
Method or attribute name: querySql(sql: string, bindArgs ?: Array): Promise;
Deprecated version: N/A|Class name: RdbStoreV9
Method or attribute name: querySql(sql: string, bindArgs ?: Array): Promise;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbStore.querySql |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbStoreV9
Method or attribute name: executeSql(sql: string, bindArgs: Array, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: RdbStoreV9
Method or attribute name: executeSql(sql: string, bindArgs: Array, callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbStore.executeSql |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbStoreV9
Method or attribute name: executeSql(sql: string, bindArgs ?: Array): Promise;
Deprecated version: N/A|Class name: RdbStoreV9
Method or attribute name: executeSql(sql: string, bindArgs ?: Array): Promise;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbStore.executeSql |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbStoreV9
Method or attribute name: beginTransaction(): void;
Deprecated version: N/A|Class name: RdbStoreV9
Method or attribute name: beginTransaction(): void;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbStore.beginTransaction |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbStoreV9
Method or attribute name: commit(): void;
Deprecated version: N/A|Class name: RdbStoreV9
Method or attribute name: commit(): void;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbStore.commit |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbStoreV9
Method or attribute name: rollBack(): void;
Deprecated version: N/A|Class name: RdbStoreV9
Method or attribute name: rollBack(): void;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbStore.rollBack |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbStoreV9
Method or attribute name: backup(destName: string, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: RdbStoreV9
Method or attribute name: backup(destName: string, callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbStore.backup |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbStoreV9
Method or attribute name: backup(destName: string): Promise;
Deprecated version: N/A|Class name: RdbStoreV9
Method or attribute name: backup(destName: string): Promise;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbStore.backup |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbStoreV9
Method or attribute name: restore(srcName: string, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: RdbStoreV9
Method or attribute name: restore(srcName: string, callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbStore.restore |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbStoreV9
Method or attribute name: restore(srcName: string): Promise;
Deprecated version: N/A|Class name: RdbStoreV9
Method or attribute name: restore(srcName: string): Promise;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbStore.restore |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbStoreV9
Method or attribute name: setDistributedTables(tables: Array, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: RdbStoreV9
Method or attribute name: setDistributedTables(tables: Array, callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbStore.setDistributedTables |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbStoreV9
Method or attribute name: setDistributedTables(tables: Array): Promise;
Deprecated version: N/A|Class name: RdbStoreV9
Method or attribute name: setDistributedTables(tables: Array): Promise;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbStore.setDistributedTables |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbStoreV9
Method or attribute name: obtainDistributedTableName(device: string, table: string, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: RdbStoreV9
Method or attribute name: obtainDistributedTableName(device: string, table: string, callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbStore.obtainDistributedTableName |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbStoreV9
Method or attribute name: obtainDistributedTableName(device: string, table: string): Promise;
Deprecated version: N/A|Class name: RdbStoreV9
Method or attribute name: obtainDistributedTableName(device: string, table: string): Promise;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbStore.obtainDistributedTableName |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbStoreV9
Method or attribute name: sync(mode: SyncMode, predicates: RdbPredicatesV9, callback: AsyncCallback>): void;
Deprecated version: N/A|Class name: RdbStoreV9
Method or attribute name: sync(mode: SyncMode, predicates: RdbPredicatesV9, callback: AsyncCallback>): void;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbStore.sync |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbStoreV9
Method or attribute name: sync(mode: SyncMode, predicates: RdbPredicatesV9): Promise>;
Deprecated version: N/A|Class name: RdbStoreV9
Method or attribute name: sync(mode: SyncMode, predicates: RdbPredicatesV9): Promise>;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbStore.sync |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbStoreV9
Method or attribute name: on(event: 'dataChange', type: SubscribeType, observer: Callback>): void;
Deprecated version: N/A|Class name: RdbStoreV9
Method or attribute name: on(event: 'dataChange', type: SubscribeType, observer: Callback>): void;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbStore.on |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbStoreV9
Method or attribute name: off(event: 'dataChange', type: SubscribeType, observer: Callback>): void;
Deprecated version: N/A|Class name: RdbStoreV9
Method or attribute name: off(event: 'dataChange', type: SubscribeType, observer: Callback>): void;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbStore.off |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: StoreConfigV9
Deprecated version: N/A|Class name: StoreConfigV9
Deprecated version: 9
Substitute API: ohos.data.relationalStore.StoreConfig |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: StoreConfigV9
Method or attribute name: name: string;
Deprecated version: N/A|Class name: StoreConfigV9
Method or attribute name: name: string;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.StoreConfig.name |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: StoreConfigV9
Method or attribute name: securityLevel: SecurityLevel;
Deprecated version: N/A|Class name: StoreConfigV9
Method or attribute name: securityLevel: SecurityLevel;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.StoreConfig.securityLevel |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: StoreConfigV9
Method or attribute name: encrypt ?: boolean;
Deprecated version: N/A|Class name: StoreConfigV9
Method or attribute name: encrypt ?: boolean;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.StoreConfig.encrypt |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbPredicatesV9
Deprecated version: N/A|Class name: RdbPredicatesV9
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbPredicates |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbPredicatesV9
Method or attribute name: constructor(name: string)
Deprecated version: N/A|Class name: RdbPredicatesV9
Method or attribute name: constructor(name: string)
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbPredicates.constructor |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbPredicatesV9
Method or attribute name: inDevices(devices: Array): RdbPredicatesV9;
Deprecated version: N/A|Class name: RdbPredicatesV9
Method or attribute name: inDevices(devices: Array): RdbPredicatesV9;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbPredicates.inDevices |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbPredicatesV9
Method or attribute name: inAllDevices(): RdbPredicatesV9;
Deprecated version: N/A|Class name: RdbPredicatesV9
Method or attribute name: inAllDevices(): RdbPredicatesV9;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbPredicates.inAllDevices |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbPredicatesV9
Method or attribute name: equalTo(field: string, value: ValueType): RdbPredicatesV9;
Deprecated version: N/A|Class name: RdbPredicatesV9
Method or attribute name: equalTo(field: string, value: ValueType): RdbPredicatesV9;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbPredicates.equalTo |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbPredicatesV9
Method or attribute name: notEqualTo(field: string, value: ValueType): RdbPredicatesV9;
Deprecated version: N/A|Class name: RdbPredicatesV9
Method or attribute name: notEqualTo(field: string, value: ValueType): RdbPredicatesV9;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbPredicates.notEqualTo |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbPredicatesV9
Method or attribute name: beginWrap(): RdbPredicatesV9;
Deprecated version: N/A|Class name: RdbPredicatesV9
Method or attribute name: beginWrap(): RdbPredicatesV9;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbPredicates.beginWrap |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbPredicatesV9
Method or attribute name: endWrap(): RdbPredicatesV9;
Deprecated version: N/A|Class name: RdbPredicatesV9
Method or attribute name: endWrap(): RdbPredicatesV9;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbPredicates.endWrap |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbPredicatesV9
Method or attribute name: or(): RdbPredicatesV9;
Deprecated version: N/A|Class name: RdbPredicatesV9
Method or attribute name: or(): RdbPredicatesV9;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbPredicates.or |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbPredicatesV9
Method or attribute name: and(): RdbPredicatesV9;
Deprecated version: N/A|Class name: RdbPredicatesV9
Method or attribute name: and(): RdbPredicatesV9;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbPredicates.and |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbPredicatesV9
Method or attribute name: contains(field: string, value: string): RdbPredicatesV9;
Deprecated version: N/A|Class name: RdbPredicatesV9
Method or attribute name: contains(field: string, value: string): RdbPredicatesV9;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbPredicates.contains |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbPredicatesV9
Method or attribute name: beginsWith(field: string, value: string): RdbPredicatesV9;
Deprecated version: N/A|Class name: RdbPredicatesV9
Method or attribute name: beginsWith(field: string, value: string): RdbPredicatesV9;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbPredicates.beginsWith |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbPredicatesV9
Method or attribute name: endsWith(field: string, value: string): RdbPredicatesV9;
Deprecated version: N/A|Class name: RdbPredicatesV9
Method or attribute name: endsWith(field: string, value: string): RdbPredicatesV9;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbPredicates.endsWith |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbPredicatesV9
Method or attribute name: isNull(field: string): RdbPredicatesV9;
Deprecated version: N/A|Class name: RdbPredicatesV9
Method or attribute name: isNull(field: string): RdbPredicatesV9;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbPredicates.isNull |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbPredicatesV9
Method or attribute name: isNotNull(field: string): RdbPredicatesV9;
Deprecated version: N/A|Class name: RdbPredicatesV9
Method or attribute name: isNotNull(field: string): RdbPredicatesV9;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbPredicates.isNotNull |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbPredicatesV9
Method or attribute name: like(field: string, value: string): RdbPredicatesV9;
Deprecated version: N/A|Class name: RdbPredicatesV9
Method or attribute name: like(field: string, value: string): RdbPredicatesV9;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbPredicates.like |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbPredicatesV9
Method or attribute name: glob(field: string, value: string): RdbPredicatesV9;
Deprecated version: N/A|Class name: RdbPredicatesV9
Method or attribute name: glob(field: string, value: string): RdbPredicatesV9;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbPredicates.glob |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbPredicatesV9
Method or attribute name: between(field: string, low: ValueType, high: ValueType): RdbPredicatesV9;
Deprecated version: N/A|Class name: RdbPredicatesV9
Method or attribute name: between(field: string, low: ValueType, high: ValueType): RdbPredicatesV9;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbPredicates.between |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbPredicatesV9
Method or attribute name: notBetween(field: string, low: ValueType, high: ValueType): RdbPredicatesV9;
Deprecated version: N/A|Class name: RdbPredicatesV9
Method or attribute name: notBetween(field: string, low: ValueType, high: ValueType): RdbPredicatesV9;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbPredicates.notBetween |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbPredicatesV9
Method or attribute name: greaterThan(field: string, value: ValueType): RdbPredicatesV9;
Deprecated version: N/A|Class name: RdbPredicatesV9
Method or attribute name: greaterThan(field: string, value: ValueType): RdbPredicatesV9;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbPredicates.greaterThan |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbPredicatesV9
Method or attribute name: lessThan(field: string, value: ValueType): RdbPredicatesV9;
Deprecated version: N/A|Class name: RdbPredicatesV9
Method or attribute name: lessThan(field: string, value: ValueType): RdbPredicatesV9;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbPredicates.lessThan |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbPredicatesV9
Method or attribute name: greaterThanOrEqualTo(field: string, value: ValueType): RdbPredicatesV9;
Deprecated version: N/A|Class name: RdbPredicatesV9
Method or attribute name: greaterThanOrEqualTo(field: string, value: ValueType): RdbPredicatesV9;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbPredicates.greaterThanOrEqualTo |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbPredicatesV9
Method or attribute name: lessThanOrEqualTo(field: string, value: ValueType): RdbPredicatesV9;
Deprecated version: N/A|Class name: RdbPredicatesV9
Method or attribute name: lessThanOrEqualTo(field: string, value: ValueType): RdbPredicatesV9;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbPredicates.lessThanOrEqualTo |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbPredicatesV9
Method or attribute name: orderByAsc(field: string): RdbPredicatesV9;
Deprecated version: N/A|Class name: RdbPredicatesV9
Method or attribute name: orderByAsc(field: string): RdbPredicatesV9;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbPredicates.orderByAsc |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbPredicatesV9
Method or attribute name: orderByDesc(field: string): RdbPredicatesV9;
Deprecated version: N/A|Class name: RdbPredicatesV9
Method or attribute name: orderByDesc(field: string): RdbPredicatesV9;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbPredicates.orderByDesc |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbPredicatesV9
Method or attribute name: distinct(): RdbPredicatesV9;
Deprecated version: N/A|Class name: RdbPredicatesV9
Method or attribute name: distinct(): RdbPredicatesV9;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbPredicates.distinct |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbPredicatesV9
Method or attribute name: limitAs(value: number): RdbPredicatesV9;
Deprecated version: N/A|Class name: RdbPredicatesV9
Method or attribute name: limitAs(value: number): RdbPredicatesV9;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbPredicates.limitAs |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbPredicatesV9
Method or attribute name: offsetAs(rowOffset: number): RdbPredicatesV9;
Deprecated version: N/A|Class name: RdbPredicatesV9
Method or attribute name: offsetAs(rowOffset: number): RdbPredicatesV9;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbPredicates.offsetAs |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbPredicatesV9
Method or attribute name: groupBy(fields: Array): RdbPredicatesV9;
Deprecated version: N/A|Class name: RdbPredicatesV9
Method or attribute name: groupBy(fields: Array): RdbPredicatesV9;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbPredicates.groupBy |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbPredicatesV9
Method or attribute name: indexedBy(field: string): RdbPredicatesV9;
Deprecated version: N/A|Class name: RdbPredicatesV9
Method or attribute name: indexedBy(field: string): RdbPredicatesV9;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbPredicates.indexedBy |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbPredicatesV9
Method or attribute name: in(field: string, value: Array): RdbPredicatesV9;
Deprecated version: N/A|Class name: RdbPredicatesV9
Method or attribute name: in(field: string, value: Array): RdbPredicatesV9;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbPredicates.in |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: RdbPredicatesV9
Method or attribute name: notIn(field: string, value: Array): RdbPredicatesV9;
Deprecated version: N/A|Class name: RdbPredicatesV9
Method or attribute name: notIn(field: string, value: Array): RdbPredicatesV9;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.RdbPredicates.notIn |@ohos.data.rdb.d.ts| +|Deprecated version changed|Class name: ResultSetV9
Deprecated version: N/A|Class name: ResultSetV9
Deprecated version: 9
Substitute API: ohos.data.relationalStore.ResultSet |resultSet.d.ts| +|Deprecated version changed|Class name: ResultSetV9
Method or attribute name: columnNames: Array;
Deprecated version: N/A|Class name: ResultSetV9
Method or attribute name: columnNames: Array;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.ResultSet.columnNames |resultSet.d.ts| +|Deprecated version changed|Class name: ResultSetV9
Method or attribute name: columnCount: number;
Deprecated version: N/A|Class name: ResultSetV9
Method or attribute name: columnCount: number;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.ResultSet.columnCount |resultSet.d.ts| +|Deprecated version changed|Class name: ResultSetV9
Method or attribute name: rowCount: number;
Deprecated version: N/A|Class name: ResultSetV9
Method or attribute name: rowCount: number;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.ResultSet.rowCount |resultSet.d.ts| +|Deprecated version changed|Class name: ResultSetV9
Method or attribute name: rowIndex: number;
Deprecated version: N/A|Class name: ResultSetV9
Method or attribute name: rowIndex: number;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.ResultSet.rowIndex |resultSet.d.ts| +|Deprecated version changed|Class name: ResultSetV9
Method or attribute name: isAtFirstRow: boolean;
Deprecated version: N/A|Class name: ResultSetV9
Method or attribute name: isAtFirstRow: boolean;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.ResultSet.isAtFirstRow |resultSet.d.ts| +|Deprecated version changed|Class name: ResultSetV9
Method or attribute name: isAtLastRow: boolean;
Deprecated version: N/A|Class name: ResultSetV9
Method or attribute name: isAtLastRow: boolean;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.ResultSet.isAtLastRow |resultSet.d.ts| +|Deprecated version changed|Class name: ResultSetV9
Method or attribute name: isEnded: boolean;
Deprecated version: N/A|Class name: ResultSetV9
Method or attribute name: isEnded: boolean;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.ResultSet.isEnded |resultSet.d.ts| +|Deprecated version changed|Class name: ResultSetV9
Method or attribute name: isStarted: boolean;
Deprecated version: N/A|Class name: ResultSetV9
Method or attribute name: isStarted: boolean;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.ResultSet.isStarted |resultSet.d.ts| +|Deprecated version changed|Class name: ResultSetV9
Method or attribute name: isClosed: boolean;
Deprecated version: N/A|Class name: ResultSetV9
Method or attribute name: isClosed: boolean;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.ResultSet.isClosed |resultSet.d.ts| +|Deprecated version changed|Class name: ResultSetV9
Method or attribute name: getColumnIndex(columnName: string): number;
Deprecated version: N/A|Class name: ResultSetV9
Method or attribute name: getColumnIndex(columnName: string): number;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.ResultSet.getColumnIndex |resultSet.d.ts| +|Deprecated version changed|Class name: ResultSetV9
Method or attribute name: getColumnName(columnIndex: number): string;
Deprecated version: N/A|Class name: ResultSetV9
Method or attribute name: getColumnName(columnIndex: number): string;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.ResultSet.getColumnName |resultSet.d.ts| +|Deprecated version changed|Class name: ResultSetV9
Method or attribute name: goTo(offset: number): boolean;
Deprecated version: N/A|Class name: ResultSetV9
Method or attribute name: goTo(offset: number): boolean;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.ResultSet.goTo |resultSet.d.ts| +|Deprecated version changed|Class name: ResultSetV9
Method or attribute name: goToRow(position: number): boolean;
Deprecated version: N/A|Class name: ResultSetV9
Method or attribute name: goToRow(position: number): boolean;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.ResultSet.goToRow |resultSet.d.ts| +|Deprecated version changed|Class name: ResultSetV9
Method or attribute name: goToFirstRow(): boolean;
Deprecated version: N/A|Class name: ResultSetV9
Method or attribute name: goToFirstRow(): boolean;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.ResultSet.goToFirstRow |resultSet.d.ts| +|Deprecated version changed|Class name: ResultSetV9
Method or attribute name: goToLastRow(): boolean;
Deprecated version: N/A|Class name: ResultSetV9
Method or attribute name: goToLastRow(): boolean;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.ResultSet.goToLastRow |resultSet.d.ts| +|Deprecated version changed|Class name: ResultSetV9
Method or attribute name: goToNextRow(): boolean;
Deprecated version: N/A|Class name: ResultSetV9
Method or attribute name: goToNextRow(): boolean;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.ResultSet.goToNextRow |resultSet.d.ts| +|Deprecated version changed|Class name: ResultSetV9
Method or attribute name: goToPreviousRow(): boolean;
Deprecated version: N/A|Class name: ResultSetV9
Method or attribute name: goToPreviousRow(): boolean;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.ResultSet.goToPreviousRow |resultSet.d.ts| +|Deprecated version changed|Class name: ResultSetV9
Method or attribute name: getBlob(columnIndex: number): Uint8Array;
Deprecated version: N/A|Class name: ResultSetV9
Method or attribute name: getBlob(columnIndex: number): Uint8Array;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.ResultSet.getBlob |resultSet.d.ts| +|Deprecated version changed|Class name: ResultSetV9
Method or attribute name: getString(columnIndex: number): string;
Deprecated version: N/A|Class name: ResultSetV9
Method or attribute name: getString(columnIndex: number): string;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.ResultSet.getString |resultSet.d.ts| +|Deprecated version changed|Class name: ResultSetV9
Method or attribute name: getLong(columnIndex: number): number;
Deprecated version: N/A|Class name: ResultSetV9
Method or attribute name: getLong(columnIndex: number): number;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.ResultSet.getLong |resultSet.d.ts| +|Deprecated version changed|Class name: ResultSetV9
Method or attribute name: getDouble(columnIndex: number): number;
Deprecated version: N/A|Class name: ResultSetV9
Method or attribute name: getDouble(columnIndex: number): number;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.ResultSet.getDouble |resultSet.d.ts| +|Deprecated version changed|Class name: ResultSetV9
Method or attribute name: isColumnNull(columnIndex: number): boolean;
Deprecated version: N/A|Class name: ResultSetV9
Method or attribute name: isColumnNull(columnIndex: number): boolean;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.ResultSet.isColumnNull |resultSet.d.ts| +|Deprecated version changed|Class name: ResultSetV9
Method or attribute name: close(): void;
Deprecated version: N/A|Class name: ResultSetV9
Method or attribute name: close(): void;
Deprecated version: 9
Substitute API: ohos.data.relationalStore.ResultSet.close |resultSet.d.ts| +|Initial version changed|Class name: dataSharePredicates
Initial version: N/A|Class name: dataSharePredicates
Initial version: 9|@ohos.data.dataSharePredicates.d.ts| +|Permission deleted|Class name: SubscribeType
Permission: ohos.permission.DISTRIBUTED_DATASYNC|Class name: SubscribeType
Permission: N/A|@ohos.data.rdb.d.ts| +|Access level changed|Class name: dataSharePredicates
Access level: public API|Class name: dataSharePredicates
Access level: system API|@ohos.data.dataSharePredicates.d.ts| +|Function changed|Class name: DeviceKVStore
Method or attribute name: getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicates): Promise;
|Class name: DeviceKVStore
Method or attribute name: getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise;
|@ohos.data.distributedKVStore.d.ts| +|Function changed|Class name: DeviceKVStore
Method or attribute name: getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise;
|Class name: DeviceKVStore
Method or attribute name: getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicates): Promise;
|@ohos.data.distributedKVStore.d.ts| +|Function changed|Class name: RdbStoreV9
Method or attribute name: update(table: string, values: ValuesBucket, predicates: dataSharePredicates.DataSharePredicates): Promise;
|Class name: RdbStoreV9
Method or attribute name: update(values: ValuesBucket, predicates: RdbPredicatesV9): Promise;
|@ohos.data.rdb.d.ts| +|Function changed|Class name: RdbStoreV9
Method or attribute name: update(values: ValuesBucket, predicates: RdbPredicatesV9): Promise;
|Class name: RdbStoreV9
Method or attribute name: update(table: string, values: ValuesBucket, predicates: dataSharePredicates.DataSharePredicates): Promise;
|@ohos.data.rdb.d.ts| +|Function changed|Class name: RdbStoreV9
Method or attribute name: delete(table: string, predicates: dataSharePredicates.DataSharePredicates): Promise;
|Class name: RdbStoreV9
Method or attribute name: delete(predicates: RdbPredicatesV9): Promise;
|@ohos.data.rdb.d.ts| +|Function changed|Class name: RdbStoreV9
Method or attribute name: delete(predicates: RdbPredicatesV9): Promise;
|Class name: RdbStoreV9
Method or attribute name: delete(table: string, predicates: dataSharePredicates.DataSharePredicates): Promise;
|@ohos.data.rdb.d.ts| +|Function changed|Class name: RdbStoreV9
Method or attribute name: query(table: string, predicates: dataSharePredicates.DataSharePredicates, columns ?: Array): Promise;
|Class name: RdbStoreV9
Method or attribute name: query(predicates: RdbPredicatesV9, columns ?: Array): Promise;
|@ohos.data.rdb.d.ts| +|Function changed|Class name: RdbStoreV9
Method or attribute name: query(predicates: RdbPredicatesV9, columns ?: Array): Promise;
|Class name: RdbStoreV9
Method or attribute name: query(table: string, predicates: dataSharePredicates.DataSharePredicates, columns ?: Array): Promise;
|@ohos.data.rdb.d.ts| diff --git a/en/release-notes/api-change/v3.2-beta5/js-apidiff-file-management.md b/en/release-notes/api-change/v3.2-beta5/js-apidiff-file-management.md new file mode 100644 index 0000000000000000000000000000000000000000..47ba2652d265c1129aecd471f74b6c1fb41405fe --- /dev/null +++ b/en/release-notes/api-change/v3.2-beta5/js-apidiff-file-management.md @@ -0,0 +1,323 @@ +| Change Type | Old Version | New Version | d.ts File | +| ---- | ------ | ------ | -------- | +|Added|NA|Module name: ohos.file.environment
Class name: Environment|@ohos.file.environment.d.ts| +|Added|NA|Module name: ohos.file.environment
Class name: Environment
Method or attribute name: function getStorageDataDir(): Promise;|@ohos.file.environment.d.ts| +|Added|NA|Module name: ohos.file.environment
Class name: Environment
Method or attribute name: function getStorageDataDir(callback: AsyncCallback): void;|@ohos.file.environment.d.ts| +|Added|NA|Module name: ohos.file.environment
Class name: Environment
Method or attribute name: function getUserDataDir(): Promise;|@ohos.file.environment.d.ts| +|Added|NA|Module name: ohos.file.environment
Class name: Environment
Method or attribute name: function getUserDataDir(callback: AsyncCallback): void;|@ohos.file.environment.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: fileAccess|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: fileAccess
Method or attribute name: function getFileAccessAbilityInfo(callback: AsyncCallback>): void;|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: fileAccess
Method or attribute name: function getFileAccessAbilityInfo(): Promise>;|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: fileAccess
Method or attribute name: function createFileAccessHelper(context: Context): FileAccessHelper;|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: fileAccess
Method or attribute name: function createFileAccessHelper(context: Context, wants: Array): FileAccessHelper;|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: FileInfo|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: FileInfo
Method or attribute name: uri: string;|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: FileInfo
Method or attribute name: fileName: string;|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: FileInfo
Method or attribute name: mode: number;|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: FileInfo
Method or attribute name: size: number;|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: FileInfo
Method or attribute name: mtime: number;|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: FileInfo
Method or attribute name: mimeType: string;|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: FileInfo
Method or attribute name: listFile(filter?: Filter): FileIterator;|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: FileInfo
Method or attribute name: scanFile(filter?: Filter): FileIterator;|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: FileIterator|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: FileIterator
Method or attribute name: next(): {value: FileInfo, done: boolean}|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: RootInfo|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: RootInfo
Method or attribute name: deviceType: number;|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: RootInfo
Method or attribute name: uri: string;|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: RootInfo
Method or attribute name: displayName: string;|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: RootInfo
Method or attribute name: deviceFlags: number;|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: RootInfo
Method or attribute name: listFile(filter?: Filter): FileIterator;|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: RootInfo
Method or attribute name: scanFile(filter?: Filter): FileIterator;|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: RootIterator|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: RootIterator
Method or attribute name: next(): {value: RootInfo, done: boolean}|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: OPENFLAGS|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: OPENFLAGS
Method or attribute name: READ = 0o0|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: OPENFLAGS
Method or attribute name: WRITE = 0o1|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: OPENFLAGS
Method or attribute name: WRITE_READ = 0o2|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: FileAccessHelper|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: FileAccessHelper
Method or attribute name: openFile(uri: string, flags: OPENFLAGS) : Promise;|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: FileAccessHelper
Method or attribute name: openFile(uri: string, flags: OPENFLAGS, callback: AsyncCallback) : void;|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: FileAccessHelper
Method or attribute name: createFile(uri: string, displayName: string) : Promise;|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: FileAccessHelper
Method or attribute name: createFile(uri: string, displayName: string, callback: AsyncCallback) : void;|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: FileAccessHelper
Method or attribute name: mkDir(parentUri: string, displayName: string) : Promise;|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: FileAccessHelper
Method or attribute name: mkDir(parentUri: string, displayName: string, callback: AsyncCallback) : void;|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: FileAccessHelper
Method or attribute name: delete(uri: string) : Promise;|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: FileAccessHelper
Method or attribute name: delete(uri: string, callback: AsyncCallback) : void;|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: FileAccessHelper
Method or attribute name: move(sourceFile: string, destFile: string) : Promise;|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: FileAccessHelper
Method or attribute name: move(sourceFile: string, destFile: string, callback: AsyncCallback) : void;|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: FileAccessHelper
Method or attribute name: rename(uri: string, displayName: string) : Promise;|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: FileAccessHelper
Method or attribute name: rename(uri: string, displayName: string, callback: AsyncCallback) : void;|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: FileAccessHelper
Method or attribute name: access(sourceFileUri: string) : Promise;|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: FileAccessHelper
Method or attribute name: access(sourceFileUri: string, callback: AsyncCallback) : void;|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: FileAccessHelper
Method or attribute name: getRoots(): Promise;|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileAccess
Class name: FileAccessHelper
Method or attribute name: getRoots(callback:AsyncCallback) : void;|@ohos.file.fileAccess.d.ts| +|Added|NA|Module name: ohos.file.fileExtensionInfo
Class name: fileExtensionInfo|@ohos.file.fileExtensionInfo.d.ts| +|Added|NA|Module name: ohos.file.fileExtensionInfo
Class name: DeviceType|@ohos.file.fileExtensionInfo.d.ts| +|Added|NA|Module name: ohos.file.fileExtensionInfo
Class name: DeviceType
Method or attribute name: DEVICE_LOCAL_DISK = 1|@ohos.file.fileExtensionInfo.d.ts| +|Added|NA|Module name: ohos.file.fileExtensionInfo
Class name: DeviceType
Method or attribute name: DEVICE_SHARED_DISK|@ohos.file.fileExtensionInfo.d.ts| +|Added|NA|Module name: ohos.file.fileExtensionInfo
Class name: DeviceType
Method or attribute name: DEVICE_SHARED_TERMINAL|@ohos.file.fileExtensionInfo.d.ts| +|Added|NA|Module name: ohos.file.fileExtensionInfo
Class name: DeviceType
Method or attribute name: DEVICE_NETWORK_NEIGHBORHOODS|@ohos.file.fileExtensionInfo.d.ts| +|Added|NA|Module name: ohos.file.fileExtensionInfo
Class name: DeviceType
Method or attribute name: DEVICE_EXTERNAL_MTP|@ohos.file.fileExtensionInfo.d.ts| +|Added|NA|Module name: ohos.file.fileExtensionInfo
Class name: DeviceType
Method or attribute name: DEVICE_EXTERNAL_USB|@ohos.file.fileExtensionInfo.d.ts| +|Added|NA|Module name: ohos.file.fileExtensionInfo
Class name: DeviceType
Method or attribute name: DEVICE_EXTERNAL_CLOUD|@ohos.file.fileExtensionInfo.d.ts| +|Added|NA|Module name: ohos.file.fileExtensionInfo
Class name: DeviceFlag|@ohos.file.fileExtensionInfo.d.ts| +|Added|NA|Module name: ohos.file.fileExtensionInfo
Class name: DeviceFlag
Method or attribute name: const SUPPORTS_READ = 0b1;|@ohos.file.fileExtensionInfo.d.ts| +|Added|NA|Module name: ohos.file.fileExtensionInfo
Class name: DeviceFlag
Method or attribute name: const SUPPORTS_WRITE = 0b10;|@ohos.file.fileExtensionInfo.d.ts| +|Added|NA|Module name: ohos.file.fileExtensionInfo
Class name: DocumentFlag|@ohos.file.fileExtensionInfo.d.ts| +|Added|NA|Module name: ohos.file.fileExtensionInfo
Class name: DocumentFlag
Method or attribute name: const REPRESENTS_FILE = 0b1;|@ohos.file.fileExtensionInfo.d.ts| +|Added|NA|Module name: ohos.file.fileExtensionInfo
Class name: DocumentFlag
Method or attribute name: const REPRESENTS_DIR = 0b10;|@ohos.file.fileExtensionInfo.d.ts| +|Added|NA|Module name: ohos.file.fileExtensionInfo
Class name: DocumentFlag
Method or attribute name: const SUPPORTS_READ = 0b100;|@ohos.file.fileExtensionInfo.d.ts| +|Added|NA|Module name: ohos.file.fileExtensionInfo
Class name: DocumentFlag
Method or attribute name: const SUPPORTS_WRITE = 0b1000;|@ohos.file.fileExtensionInfo.d.ts| +|Added|NA|Module name: ohos.file.fileuri
Class name: fileUri|@ohos.file.fileuri.d.ts| +|Added|NA|Module name: ohos.file.fileuri
Class name: fileUri
Method or attribute name: function getUriFromPath(path: string): string;|@ohos.file.fileuri.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function access(path: string): Promise;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function access(path: string, callback: AsyncCallback): void;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function accessSync(path: string): boolean;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function close(file: number \| File): Promise;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function close(file: number \| File, callback: AsyncCallback): void;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function closeSync(fd: number \| File): void;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function copyFile(src: string \| number, dest: string \| number, mode?: number): Promise;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function copyFile(src: string \| number, dest: string \| number, callback: AsyncCallback): void;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function copyFile(src: string \| number, dest: string \| number, mode: number, callback: AsyncCallback): void;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function copyFileSync(src: string \| number, dest: string \| number, mode?: number): void;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function createStream(path: string, mode: string): Promise;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function createStream(path: string, mode: string, callback: AsyncCallback): void;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function createStreamSync(path: string, mode: string): Stream;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function fdatasync(fd: number): Promise;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function fdatasync(fd: number, callback: AsyncCallback): void;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function fdatasyncSync(fd: number): void;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function fdopenStream(fd: number, mode: string): Promise;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function fdopenStream(fd: number, mode: string, callback: AsyncCallback): void;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function fdopenStreamSync(fd: number, mode: string): Stream;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function fsync(fd: number): Promise;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function fsync(fd: number, callback: AsyncCallback): void;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function fsyncSync(fd: number): void;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function lstat(path: string): Promise;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function lstat(path: string, callback: AsyncCallback): void;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function lstatSync(path: string): Stat;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function mkdir(path: string): Promise;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function mkdir(path: string, callback: AsyncCallback): void;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function mkdirSync(path: string): void;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function mkdtemp(prefix: string): Promise;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function mkdtemp(prefix: string, callback: AsyncCallback): void;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function mkdtempSync(prefix: string): string;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function readText(filePath: string, options?: {
offset?: number;
length?: number;
encoding?: string;
}): Promise;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function readText(filePath: string, callback: AsyncCallback): void;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function readText(filePath: string, options: {
offset?: number;
length?: number;
encoding?: string;
}, callback: AsyncCallback): void;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function readTextSync(filePath: string, options?: {
offset?: number;
length?: number;
encoding?: string;
}): string;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function rename(oldPath: string, newPath: string): Promise;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function rename(oldPath: string, newPath: string, callback: AsyncCallback): void;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function renameSync(oldPath: string, newPath: string): void;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function rmdir(path: string): Promise;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function rmdir(path: string, callback: AsyncCallback): void;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function rmdirSync(path: string): void;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function symlink(target: string, srcPath: string): Promise;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function symlink(target: string, srcPath: string, callback: AsyncCallback): void;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function symlinkSync(target: string, srcPath: string): void;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function unlink(path: string): Promise;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function unlink(path: string, callback: AsyncCallback): void;|@ohos.file.fs.d.ts| +|Added|NA|Class name: fileIo
Method or attribute name: function unlinkSync(path: string): void;|@ohos.file.fs.d.ts| +|Added|NA|Class name: Stat
Method or attribute name: readonly ino: bigint;|@ohos.file.fs.d.ts| +|Added|NA|Module name: ohos.file.fs
Class name: Stream|@ohos.file.fs.d.ts| +|Added|NA|Class name: Stream
Method or attribute name: |@ohos.file.fs.d.ts| +|Added|NA|Module name: ohos.file.fs
Class name: Stream
Method or attribute name: close(): Promise;|@ohos.file.fs.d.ts| +|Added|NA|Class name: Stream
Method or attribute name: close(): Promise;|@ohos.file.fs.d.ts| +|Added|NA|Module name: ohos.file.fs
Class name: Stream
Method or attribute name: close(callback: AsyncCallback): void;|@ohos.file.fs.d.ts| +|Added|NA|Class name: Stream
Method or attribute name: close(callback: AsyncCallback): void;|@ohos.file.fs.d.ts| +|Added|NA|Module name: ohos.file.fs
Class name: Stream
Method or attribute name: closeSync(): void;|@ohos.file.fs.d.ts| +|Added|NA|Class name: Stream
Method or attribute name: closeSync(): void;|@ohos.file.fs.d.ts| +|Added|NA|Module name: ohos.file.fs
Class name: Stream
Method or attribute name: flush(): Promise;|@ohos.file.fs.d.ts| +|Added|NA|Class name: Stream
Method or attribute name: flush(): Promise;|@ohos.file.fs.d.ts| +|Added|NA|Module name: ohos.file.fs
Class name: Stream
Method or attribute name: flush(callback: AsyncCallback): void;|@ohos.file.fs.d.ts| +|Added|NA|Class name: Stream
Method or attribute name: flush(callback: AsyncCallback): void;|@ohos.file.fs.d.ts| +|Added|NA|Module name: ohos.file.fs
Class name: Stream
Method or attribute name: flushSync(): void;|@ohos.file.fs.d.ts| +|Added|NA|Class name: Stream
Method or attribute name: flushSync(): void;|@ohos.file.fs.d.ts| +|Added|NA|Module name: ohos.file.fs
Class name: Stream
Method or attribute name: write(buffer: ArrayBuffer \| string, options?: {
offset?: number;
length?: number;
encoding?: string;
}): Promise;|@ohos.file.fs.d.ts| +|Added|NA|Class name: Stream
Method or attribute name: write(buffer: ArrayBuffer \| string, options?: {
offset?: number;
length?: number;
encoding?: string;
}): Promise;|@ohos.file.fs.d.ts| +|Added|NA|Module name: ohos.file.fs
Class name: Stream
Method or attribute name: write(buffer: ArrayBuffer \| string, callback: AsyncCallback): void;|@ohos.file.fs.d.ts| +|Added|NA|Class name: Stream
Method or attribute name: write(buffer: ArrayBuffer \| string, callback: AsyncCallback): void;|@ohos.file.fs.d.ts| +|Added|NA|Module name: ohos.file.fs
Class name: Stream
Method or attribute name: write(buffer: ArrayBuffer \| string, options: {
offset?: number;
length?: number;
encoding?: string;
}, callback: AsyncCallback): void;|@ohos.file.fs.d.ts| +|Added|NA|Class name: Stream
Method or attribute name: write(buffer: ArrayBuffer \| string, options: {
offset?: number;
length?: number;
encoding?: string;
}, callback: AsyncCallback): void;|@ohos.file.fs.d.ts| +|Added|NA|Module name: ohos.file.fs
Class name: Stream
Method or attribute name: writeSync(buffer: ArrayBuffer \| string, options?: {
offset?: number;
length?: number;
encoding?: string;
}): number;|@ohos.file.fs.d.ts| +|Added|NA|Class name: Stream
Method or attribute name: writeSync(buffer: ArrayBuffer \| string, options?: {
offset?: number;
length?: number;
encoding?: string;
}): number;|@ohos.file.fs.d.ts| +|Added|NA|Module name: ohos.file.fs
Class name: Stream
Method or attribute name: read(buffer: ArrayBuffer, options?: {
offset?: number;
length?: number;
}): Promise;|@ohos.file.fs.d.ts| +|Added|NA|Class name: Stream
Method or attribute name: read(buffer: ArrayBuffer, options?: {
offset?: number;
length?: number;
}): Promise;|@ohos.file.fs.d.ts| +|Added|NA|Module name: ohos.file.fs
Class name: Stream
Method or attribute name: read(buffer: ArrayBuffer, callback: AsyncCallback): void;|@ohos.file.fs.d.ts| +|Added|NA|Class name: Stream
Method or attribute name: read(buffer: ArrayBuffer, callback: AsyncCallback): void;|@ohos.file.fs.d.ts| +|Added|NA|Module name: ohos.file.fs
Class name: Stream
Method or attribute name: read(buffer: ArrayBuffer, options: {
offset?: number;
length?: number;
}, callback: AsyncCallback): void;|@ohos.file.fs.d.ts| +|Added|NA|Class name: Stream
Method or attribute name: read(buffer: ArrayBuffer, options: {
offset?: number;
length?: number;
}, callback: AsyncCallback): void;|@ohos.file.fs.d.ts| +|Added|NA|Module name: ohos.file.fs
Class name: Stream
Method or attribute name: readSync(buffer: ArrayBuffer, options?: {
offset?: number;
length?: number;
}): number;|@ohos.file.fs.d.ts| +|Added|NA|Class name: Stream
Method or attribute name: readSync(buffer: ArrayBuffer, options?: {
offset?: number;
length?: number;
}): number;|@ohos.file.fs.d.ts| +|Added|NA|Module name: ohos.file.hash
Class name: Hash|@ohos.file.hash.d.ts| +|Added|NA|Module name: ohos.file.hash
Class name: Hash
Method or attribute name: function hash(path: string, algorithm: string): Promise;|@ohos.file.hash.d.ts| +|Added|NA|Module name: ohos.file.hash
Class name: Hash
Method or attribute name: function hash(path: string, algorithm: string, callback: AsyncCallback): void;|@ohos.file.hash.d.ts| +|Added|NA|Module name: ohos.file.securityLabel
Class name: securityLabel|@ohos.file.securityLabel.d.ts| +|Added|NA|Module name: ohos.file.securityLabel
Class name: dataLevel
Method or attribute name: type dataLevel = 's0'\|'s1'\|'s2'\|'s3'\|'s4';|@ohos.file.securityLabel.d.ts| +|Added|NA|Module name: ohos.file.securityLabel
Class name: dataLevel
Method or attribute name: type dataLevel = 's0'\|'s1'\|'s2'\|'s3'\|'s4';|@ohos.file.securityLabel.d.ts| +|Added|NA|Module name: ohos.file.securityLabel
Class name: dataLevel
Method or attribute name: type dataLevel = 's0'\|'s1'\|'s2'\|'s3'\|'s4';|@ohos.file.securityLabel.d.ts| +|Added|NA|Module name: ohos.file.securityLabel
Class name: dataLevel
Method or attribute name: type dataLevel = 's0'\|'s1'\|'s2'\|'s3'\|'s4';|@ohos.file.securityLabel.d.ts| +|Added|NA|Module name: ohos.file.securityLabel
Class name: dataLevel
Method or attribute name: type dataLevel = 's0'\|'s1'\|'s2'\|'s3'\|'s4';|@ohos.file.securityLabel.d.ts| +|Added|NA|Module name: ohos.file.securityLabel
Class name: securityLabel
Method or attribute name: function setSecurityLabel(path: string, type: dataLevel): Promise;|@ohos.file.securityLabel.d.ts| +|Added|NA|Module name: ohos.file.securityLabel
Class name: securityLabel
Method or attribute name: function setSecurityLabel(path: string, type: dataLevel, callback: AsyncCallback): void;|@ohos.file.securityLabel.d.ts| +|Added|NA|Module name: ohos.file.securityLabel
Class name: securityLabel
Method or attribute name: function setSecurityLabelSync(path: string, type: dataLevel): void;|@ohos.file.securityLabel.d.ts| +|Added|NA|Module name: ohos.file.securityLabel
Class name: securityLabel
Method or attribute name: function getSecurityLabel(path: string): Promise;|@ohos.file.securityLabel.d.ts| +|Added|NA|Module name: ohos.file.securityLabel
Class name: securityLabel
Method or attribute name: function getSecurityLabel(path: string, callback: AsyncCallback): void;|@ohos.file.securityLabel.d.ts| +|Added|NA|Module name: ohos.file.securityLabel
Class name: securityLabel
Method or attribute name: function getSecurityLabelSync(path: string): string;|@ohos.file.securityLabel.d.ts| +|Added|NA|Module name: ohos.file.statvfs
Class name: Statfs|@ohos.file.statvfs.d.ts| +|Added|NA|Module name: ohos.file.statvfs
Class name: Statfs
Method or attribute name: function getFreeSize(path: string): Promise;|@ohos.file.statvfs.d.ts| +|Added|NA|Module name: ohos.file.statvfs
Class name: Statfs
Method or attribute name: function getFreeSize(path: string, callback: AsyncCallback): void;|@ohos.file.statvfs.d.ts| +|Added|NA|Module name: ohos.file.statvfs
Class name: Statfs
Method or attribute name: function getTotalSize(path: string): Promise;|@ohos.file.statvfs.d.ts| +|Added|NA|Module name: ohos.file.statvfs
Class name: Statfs
Method or attribute name: function getTotalSize(path: string, callback: AsyncCallback): void;|@ohos.file.statvfs.d.ts| +|Added|NA|Module name: ohos.fileshare
Class name: fileShare|@ohos.fileshare.d.ts| +|Added|NA|Module name: ohos.fileshare
Class name: fileShare
Method or attribute name: function grantUriPermission(uri: string, bundleName: string, flag: wantConstant.Flags, callback: AsyncCallback): void;|@ohos.fileshare.d.ts| +|Added|NA|Module name: ohos.fileshare
Class name: fileShare
Method or attribute name: function grantUriPermission(uri: string, bundleName: string, flag: wantConstant.Flags): Promise;|@ohos.fileshare.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: fileAccess|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: fileAccess
Method or attribute name: function getFileAccessAbilityInfo(callback: AsyncCallback>): void;|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: fileAccess
Method or attribute name: function getFileAccessAbilityInfo(): Promise>;|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: fileAccess
Method or attribute name: function createFileAccessHelper(context: Context): FileAccessHelper;|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: fileAccess
Method or attribute name: function createFileAccessHelper(context: Context, wants: Array): FileAccessHelper;|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: FileInfo|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: FileInfo
Method or attribute name: uri: string;|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: FileInfo
Method or attribute name: fileName: string;|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: FileInfo
Method or attribute name: mode: number;|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: FileInfo
Method or attribute name: size: number;|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: FileInfo
Method or attribute name: mtime: number;|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: FileInfo
Method or attribute name: mimeType: string;|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: FileInfo
Method or attribute name: listFile(filter?: Filter): FileIterator;|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: FileInfo
Method or attribute name: scanFile(filter?: Filter): FileIterator;|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: FileIterator|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: FileIterator
Method or attribute name: next(): {value: FileInfo, done: boolean}|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: RootInfo|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: RootInfo
Method or attribute name: deviceType: number;|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: RootInfo
Method or attribute name: uri: string;|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: RootInfo
Method or attribute name: displayName: string;|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: RootInfo
Method or attribute name: deviceFlags: number;|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: RootInfo
Method or attribute name: listFile(filter?: Filter): FileIterator;|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: RootInfo
Method or attribute name: scanFile(filter?: Filter): FileIterator;|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: RootIterator|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: RootIterator
Method or attribute name: next(): {value: RootInfo, done: boolean}|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: OPENFLAGS|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: OPENFLAGS
Method or attribute name: READ = 0o0|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: OPENFLAGS
Method or attribute name: WRITE = 0o1|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: OPENFLAGS
Method or attribute name: WRITE_READ = 0o2|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: FileAccessHelper|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: FileAccessHelper
Method or attribute name: openFile(uri: string, flags: OPENFLAGS) : Promise;|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: FileAccessHelper
Method or attribute name: openFile(uri: string, flags: OPENFLAGS, callback: AsyncCallback) : void;|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: FileAccessHelper
Method or attribute name: createFile(uri: string, displayName: string) : Promise;|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: FileAccessHelper
Method or attribute name: createFile(uri: string, displayName: string, callback: AsyncCallback) : void;|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: FileAccessHelper
Method or attribute name: mkDir(parentUri: string, displayName: string) : Promise;|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: FileAccessHelper
Method or attribute name: mkDir(parentUri: string, displayName: string, callback: AsyncCallback) : void;|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: FileAccessHelper
Method or attribute name: delete(uri: string) : Promise;|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: FileAccessHelper
Method or attribute name: delete(uri: string, callback: AsyncCallback) : void;|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: FileAccessHelper
Method or attribute name: move(sourceFile: string, destFile: string) : Promise;|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: FileAccessHelper
Method or attribute name: move(sourceFile: string, destFile: string, callback: AsyncCallback) : void;|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: FileAccessHelper
Method or attribute name: rename(uri: string, displayName: string) : Promise;|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: FileAccessHelper
Method or attribute name: rename(uri: string, displayName: string, callback: AsyncCallback) : void;|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: FileAccessHelper
Method or attribute name: access(sourceFileUri: string) : Promise;|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: FileAccessHelper
Method or attribute name: access(sourceFileUri: string, callback: AsyncCallback) : void;|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: FileAccessHelper
Method or attribute name: getRoots(): Promise;|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.data.fileAccess
Class name: FileAccessHelper
Method or attribute name: getRoots(callback:AsyncCallback) : void;|NA|@ohos.data.fileAccess.d.ts| +|Deleted|Module name: ohos.environment
Class name: Environment|NA|@ohos.environment.d.ts| +|Deleted|Module name: ohos.environment
Class name: Environment
Method or attribute name: function getStorageDataDir(callback: AsyncCallback): void;|NA|@ohos.environment.d.ts| +|Deleted|Module name: ohos.environment
Class name: Environment
Method or attribute name: function getStorageDataDir(): Promise;|NA|@ohos.environment.d.ts| +|Deleted|Module name: ohos.environment
Class name: Environment
Method or attribute name: function getUserDataDir(callback: AsyncCallback): void;|NA|@ohos.environment.d.ts| +|Deleted|Module name: ohos.environment
Class name: Environment
Method or attribute name: function getUserDataDir(): Promise;|NA|@ohos.environment.d.ts| +|Deleted|Module name: ohos.fileExtensionInfo
Class name: fileExtensionInfo|NA|@ohos.fileExtensionInfo.d.ts| +|Deleted|Module name: ohos.fileExtensionInfo
Class name: DeviceType|NA|@ohos.fileExtensionInfo.d.ts| +|Deleted|Module name: ohos.fileExtensionInfo
Class name: DeviceType
Method or attribute name: DEVICE_LOCAL_DISK = 1|NA|@ohos.fileExtensionInfo.d.ts| +|Deleted|Module name: ohos.fileExtensionInfo
Class name: DeviceType
Method or attribute name: DEVICE_SHARED_DISK|NA|@ohos.fileExtensionInfo.d.ts| +|Deleted|Module name: ohos.fileExtensionInfo
Class name: DeviceType
Method or attribute name: DEVICE_SHARED_TERMINAL|NA|@ohos.fileExtensionInfo.d.ts| +|Deleted|Module name: ohos.fileExtensionInfo
Class name: DeviceType
Method or attribute name: DEVICE_NETWORK_NEIGHBORHOODS|NA|@ohos.fileExtensionInfo.d.ts| +|Deleted|Module name: ohos.fileExtensionInfo
Class name: DeviceType
Method or attribute name: DEVICE_EXTERNAL_MTP|NA|@ohos.fileExtensionInfo.d.ts| +|Deleted|Module name: ohos.fileExtensionInfo
Class name: DeviceType
Method or attribute name: DEVICE_EXTERNAL_USB|NA|@ohos.fileExtensionInfo.d.ts| +|Deleted|Module name: ohos.fileExtensionInfo
Class name: DeviceType
Method or attribute name: DEVICE_EXTERNAL_CLOUD|NA|@ohos.fileExtensionInfo.d.ts| +|Deleted|Module name: ohos.fileExtensionInfo
Class name: DeviceFlag|NA|@ohos.fileExtensionInfo.d.ts| +|Deleted|Module name: ohos.fileExtensionInfo
Class name: DeviceFlag
Method or attribute name: const SUPPORTS_READ = 0b1;|NA|@ohos.fileExtensionInfo.d.ts| +|Deleted|Module name: ohos.fileExtensionInfo
Class name: DeviceFlag
Method or attribute name: const SUPPORTS_WRITE = 0b10;|NA|@ohos.fileExtensionInfo.d.ts| +|Deleted|Module name: ohos.fileExtensionInfo
Class name: DocumentFlag|NA|@ohos.fileExtensionInfo.d.ts| +|Deleted|Module name: ohos.fileExtensionInfo
Class name: DocumentFlag
Method or attribute name: const REPRESENTS_FILE = 0b1;|NA|@ohos.fileExtensionInfo.d.ts| +|Deleted|Module name: ohos.fileExtensionInfo
Class name: DocumentFlag
Method or attribute name: const REPRESENTS_DIR = 0b10;|NA|@ohos.fileExtensionInfo.d.ts| +|Deleted|Module name: ohos.fileExtensionInfo
Class name: DocumentFlag
Method or attribute name: const SUPPORTS_READ = 0b100;|NA|@ohos.fileExtensionInfo.d.ts| +|Deleted|Module name: ohos.fileExtensionInfo
Class name: DocumentFlag
Method or attribute name: const SUPPORTS_WRITE = 0b1000;|NA|@ohos.fileExtensionInfo.d.ts| +|Deleted|Module name: ohos.securityLabel
Class name: securityLabel|NA|@ohos.securityLabel.d.ts| +|Deleted|Module name: ohos.securityLabel
Class name: dataLevel
Method or attribute name: type dataLevel = 's0'\|'s1'\|'s2'\|'s3'\|'s4';|NA|@ohos.securityLabel.d.ts| +|Deleted|Module name: ohos.securityLabel
Class name: dataLevel
Method or attribute name: type dataLevel = 's0'\|'s1'\|'s2'\|'s3'\|'s4';|NA|@ohos.securityLabel.d.ts| +|Deleted|Module name: ohos.securityLabel
Class name: dataLevel
Method or attribute name: type dataLevel = 's0'\|'s1'\|'s2'\|'s3'\|'s4';|NA|@ohos.securityLabel.d.ts| +|Deleted|Module name: ohos.securityLabel
Class name: dataLevel
Method or attribute name: type dataLevel = 's0'\|'s1'\|'s2'\|'s3'\|'s4';|NA|@ohos.securityLabel.d.ts| +|Deleted|Module name: ohos.securityLabel
Class name: dataLevel
Method or attribute name: type dataLevel = 's0'\|'s1'\|'s2'\|'s3'\|'s4';|NA|@ohos.securityLabel.d.ts| +|Deleted|Module name: ohos.securityLabel
Class name: securityLabel
Method or attribute name: function setSecurityLabel(path:string, type:dataLevel, callback: AsyncCallback): void;|NA|@ohos.securityLabel.d.ts| +|Deleted|Module name: ohos.securityLabel
Class name: securityLabel
Method or attribute name: function setSecurityLabel(path:string, type:dataLevel): Promise;|NA|@ohos.securityLabel.d.ts| +|Deleted|Module name: ohos.securityLabel
Class name: securityLabel
Method or attribute name: function setSecurityLabelSync(path:string, type:dataLevel): void;|NA|@ohos.securityLabel.d.ts| +|Deleted|Module name: ohos.securityLabel
Class name: securityLabel
Method or attribute name: function getSecurityLabel(path:string, callback: AsyncCallback): void;|NA|@ohos.securityLabel.d.ts| +|Deleted|Module name: ohos.securityLabel
Class name: securityLabel
Method or attribute name: function getSecurityLabel(path:string): Promise;|NA|@ohos.securityLabel.d.ts| +|Deleted|Module name: ohos.securityLabel
Class name: securityLabel
Method or attribute name: function getSecurityLabelSync(path:string): string;|NA|@ohos.securityLabel.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function access(path: string, mode?: number): Promise;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function access(path: string, mode?: number): Promise;
Deprecated version: 9
Substitute API: ohos.file.fs.access |@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function access(path: string, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function access(path: string, callback: AsyncCallback): void;
Deprecated version: 9|@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function access(path: string, mode: number, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function access(path: string, mode: number, callback: AsyncCallback): void;
Deprecated version: 9|@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function accessSync(path: string, mode?: number): void;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function accessSync(path: string, mode?: number): void;
Deprecated version: 9
Substitute API: ohos.file.fs.accessSync |@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function close(fd: number): Promise;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function close(fd: number): Promise;
Deprecated version: 9
Substitute API: ohos.file.fs.close |@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function close(fd: number, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function close(fd: number, callback: AsyncCallback): void;
Deprecated version: 9|@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function closeSync(fd: number): void;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function closeSync(fd: number): void;
Deprecated version: 9
Substitute API: ohos.file.fs.closeSync |@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function copyFile(src: string \| number, dest: string \| number, mode?: number): Promise;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function copyFile(src: string \| number, dest: string \| number, mode?: number): Promise;
Deprecated version: 9
Substitute API: ohos.file.fs.copyFile |@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function copyFile(src: string \| number, dest: string \| number, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function copyFile(src: string \| number, dest: string \| number, callback: AsyncCallback): void;
Deprecated version: 9|@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function copyFile(src: string \| number, dest: string \| number, mode: number, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function copyFile(src: string \| number, dest: string \| number, mode: number, callback: AsyncCallback): void;
Deprecated version: 9|@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function copyFileSync(src: string \| number, dest: string \| number, mode?: number): void;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function copyFileSync(src: string \| number, dest: string \| number, mode?: number): void;
Deprecated version: 9
Substitute API: ohos.file.fs.copyFileSync |@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function createStream(path: string, mode: string): Promise;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function createStream(path: string, mode: string): Promise;
Deprecated version: 9
Substitute API: ohos.file.fs.createStream |@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function createStream(path: string, mode: string, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function createStream(path: string, mode: string, callback: AsyncCallback): void;
Deprecated version: 9|@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function createStreamSync(path: string, mode: string): Stream;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function createStreamSync(path: string, mode: string): Stream;
Deprecated version: 9
Substitute API: ohos.file.fs.createStreamSync |@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function chown(path: string, uid: number, gid: number): Promise;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function chown(path: string, uid: number, gid: number): Promise;
Deprecated version: 9
Substitute API: N/A|@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function chown(path: string, uid: number, gid: number, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function chown(path: string, uid: number, gid: number, callback: AsyncCallback): void;
Deprecated version: 9|@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function chownSync(path: string, uid: number, gid: number): void;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function chownSync(path: string, uid: number, gid: number): void;
Deprecated version: 9
Substitute API: N/A|@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function chmod(path: string, mode: number): Promise;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function chmod(path: string, mode: number): Promise;
Deprecated version: 9
Substitute API: N/A|@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function chmod(path: string, mode: number, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function chmod(path: string, mode: number, callback: AsyncCallback): void;
Deprecated version: 9|@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function chmodSync(path: string, mode: number): void;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function chmodSync(path: string, mode: number): void;
Deprecated version: 9
Substitute API: N/A|@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function fsync(fd: number): Promise;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function fsync(fd: number): Promise;
Deprecated version: 9
Substitute API: ohos.file.fs.fsync |@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function fsync(fd: number, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function fsync(fd: number, callback: AsyncCallback): void;
Deprecated version: 9|@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function fsyncSync(fd: number): void;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function fsyncSync(fd: number): void;
Deprecated version: 9
Substitute API: ohos.file.fs.fsyncSync |@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function fdatasync(fd: number): Promise;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function fdatasync(fd: number): Promise;
Deprecated version: 9
Substitute API: ohos.file.fs.fdatasync |@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function fdatasync(fd: number, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function fdatasync(fd: number, callback: AsyncCallback): void;
Deprecated version: 9|@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function fdatasyncSync(fd: number): void;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function fdatasyncSync(fd: number): void;
Deprecated version: 9
Substitute API: ohos.file.fs.fdatasyncSync |@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function fchown(fd: number, uid: number, gid: number): Promise;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function fchown(fd: number, uid: number, gid: number): Promise;
Deprecated version: 9
Substitute API: N/A|@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function fchown(fd: number, uid: number, gid: number, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function fchown(fd: number, uid: number, gid: number, callback: AsyncCallback): void;
Deprecated version: 9|@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function fchownSync(fd: number, uid: number, gid: number): void;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function fchownSync(fd: number, uid: number, gid: number): void;
Deprecated version: 9
Substitute API: N/A|@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function fchmod(fd: number, mode: number): Promise;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function fchmod(fd: number, mode: number): Promise;
Deprecated version: 9
Substitute API: N/A|@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function fchmod(fd: number, mode: number, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function fchmod(fd: number, mode: number, callback: AsyncCallback): void;
Deprecated version: 9|@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function fchmodSync(fd: number, mode: number): void;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function fchmodSync(fd: number, mode: number): void;
Deprecated version: 9
Substitute API: N/A|@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function fdopenStream(fd: number, mode: string): Promise;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function fdopenStream(fd: number, mode: string): Promise;
Deprecated version: 9
Substitute API: ohos.file.fs.fdopenStream |@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function fdopenStream(fd: number, mode: string, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function fdopenStream(fd: number, mode: string, callback: AsyncCallback): void;
Deprecated version: 9|@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function fdopenStreamSync(fd: number, mode: string): Stream;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function fdopenStreamSync(fd: number, mode: string): Stream;
Deprecated version: 9
Substitute API: ohos.file.fs.fdopenStreamSync |@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function hash(path: string, algorithm: string): Promise;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function hash(path: string, algorithm: string): Promise;
Deprecated version: 9
Substitute API: ohos.file.hash.hash |@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function hash(path: string, algorithm: string, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function hash(path: string, algorithm: string, callback: AsyncCallback): void;
Deprecated version: 9|@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function lchown(path: string, uid: number, gid: number): Promise;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function lchown(path: string, uid: number, gid: number): Promise;
Deprecated version: 9
Substitute API: N/A|@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function lchown(path: string, uid: number, gid: number, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function lchown(path: string, uid: number, gid: number, callback: AsyncCallback): void;
Deprecated version: 9|@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function lchownSync(path: string, uid: number, gid: number): void;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function lchownSync(path: string, uid: number, gid: number): void;
Deprecated version: 9
Substitute API: N/A|@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function lstat(path: string): Promise;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function lstat(path: string): Promise;
Deprecated version: 9
Substitute API: ohos.file.fs.lstat |@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function lstat(path: string, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function lstat(path: string, callback: AsyncCallback): void;
Deprecated version: 9|@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function lstatSync(path: string): Stat;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function lstatSync(path: string): Stat;
Deprecated version: 9
Substitute API: ohos.file.fs.lstatSync |@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function mkdir(path: string, mode?: number): Promise;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function mkdir(path: string, mode?: number): Promise;
Deprecated version: 9
Substitute API: ohos.file.fs.mkdir |@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function mkdir(path: string, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function mkdir(path: string, callback: AsyncCallback): void;
Deprecated version: 9|@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function mkdir(path: string, mode: number, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function mkdir(path: string, mode: number, callback: AsyncCallback): void;
Deprecated version: 9|@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function mkdirSync(path: string, mode?: number): void;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function mkdirSync(path: string, mode?: number): void;
Deprecated version: 9
Substitute API: ohos.file.fs.mkdirSync |@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function mkdtemp(prefix: string): Promise;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function mkdtemp(prefix: string): Promise;
Deprecated version: 9
Substitute API: ohos.file.fs.mkdtemp |@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function mkdtemp(prefix: string, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function mkdtemp(prefix: string, callback: AsyncCallback): void;
Deprecated version: 9|@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function mkdtempSync(prefix: string): string;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function mkdtempSync(prefix: string): string;
Deprecated version: 9
Substitute API: ohos.file.fs.mkdtempSync |@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function readText(filePath: string, options?: {
position?: number;
length?: number;
encoding?: string;
}): Promise;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function readText(filePath: string, options?: {
position?: number;
length?: number;
encoding?: string;
}): Promise;
Deprecated version: 9
Substitute API: ohos.file.fs.readText |@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function readText(filePath: string, options: {
position?: number;
length?: number;
encoding?: string;
}, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function readText(filePath: string, options: {
position?: number;
length?: number;
encoding?: string;
}, callback: AsyncCallback): void;
Deprecated version: 9|@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function readTextSync(filePath: string, options?: {
position?: number;
length?: number;
encoding?: string;
}): string;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function readTextSync(filePath: string, options?: {
position?: number;
length?: number;
encoding?: string;
}): string;
Deprecated version: 9
Substitute API: ohos.file.fs.readTextSync |@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function rename(oldPath: string, newPath: string): Promise;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function rename(oldPath: string, newPath: string): Promise;
Deprecated version: 9
Substitute API: ohos.file.fs.rename |@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function rename(oldPath: string, newPath: string, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function rename(oldPath: string, newPath: string, callback: AsyncCallback): void;
Deprecated version: 9|@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function renameSync(oldPath: string, newPath: string): void;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function renameSync(oldPath: string, newPath: string): void;
Deprecated version: 9
Substitute API: ohos.file.fs.renameSync |@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function rmdir(path: string): Promise;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function rmdir(path: string): Promise;
Deprecated version: 9
Substitute API: ohos.file.fs.rmdir |@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function rmdir(path: string, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function rmdir(path: string, callback: AsyncCallback): void;
Deprecated version: 9|@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function rmdirSync(path: string): void;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function rmdirSync(path: string): void;
Deprecated version: 9
Substitute API: ohos.file.fs.rmdirSync |@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function symlink(target: string, srcPath: string): Promise;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function symlink(target: string, srcPath: string): Promise;
Deprecated version: 9
Substitute API: ohos.file.fs.symlink |@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function symlink(target: string, srcPath: string, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function symlink(target: string, srcPath: string, callback: AsyncCallback): void;
Deprecated version: 9|@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function symlinkSync(target: string, srcPath: string): void;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function symlinkSync(target: string, srcPath: string): void;
Deprecated version: 9
Substitute API: ohos.file.fs.symlinkSync |@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function unlink(path: string): Promise;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function unlink(path: string): Promise;
Deprecated version: 9
Substitute API: ohos.file.fs.unlink |@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function unlink(path: string, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function unlink(path: string, callback: AsyncCallback): void;
Deprecated version: 9|@ohos.fileio.d.ts| +|Deprecated version changed|Class name: fileIO
Method or attribute name: function unlinkSync(path: string): void;
Deprecated version: N/A|Class name: fileIO
Method or attribute name: function unlinkSync(path: string): void;
Deprecated version: 9
Substitute API: ohos.file.fs.unlinkSync |@ohos.fileio.d.ts| +|Deprecated version changed|Class name: Stream
Deprecated version: N/A|Class name: Stream
Deprecated version: 9
Substitute API: ohos.file.fs.Stream |@ohos.fileio.d.ts| +|Deprecated version changed|Class name: Statfs
Method or attribute name: function getFreeBytes(path: string, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: Statfs
Method or attribute name: function getFreeBytes(path: string, callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.file.statvfs.getFreeSize |@ohos.statfs.d.ts| +|Deprecated version changed|Class name: Statfs
Method or attribute name: function getFreeBytes(path: string): Promise;
Deprecated version: N/A|Class name: Statfs
Method or attribute name: function getFreeBytes(path: string): Promise;
Deprecated version: 9|@ohos.statfs.d.ts| +|Deprecated version changed|Class name: Statfs
Method or attribute name: function getTotalBytes(path: string, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: Statfs
Method or attribute name: function getTotalBytes(path: string, callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.file.statvfs.getTotalSize |@ohos.statfs.d.ts| +|Deprecated version changed|Class name: Statfs
Method or attribute name: function getTotalBytes(path: string): Promise;
Deprecated version: N/A|Class name: Statfs
Method or attribute name: function getTotalBytes(path: string): Promise;
Deprecated version: 9|@ohos.statfs.d.ts| diff --git a/en/release-notes/api-change/v3.2-beta5/js-apidiff-geolocation.md b/en/release-notes/api-change/v3.2-beta5/js-apidiff-geolocation.md new file mode 100644 index 0000000000000000000000000000000000000000..50bd238bbe205fde2b696e8615328b91d89cde4a --- /dev/null +++ b/en/release-notes/api-change/v3.2-beta5/js-apidiff-geolocation.md @@ -0,0 +1,185 @@ +| Change Type | Old Version | New Version | d.ts File | +| ---- | ------ | ------ | -------- | +|Added|NA|Class name: geoLocationManager
Method or attribute name: function on(type: 'locationChange', request: LocationRequest, callback: Callback): void;|@ohos.geoLocationManager.d.ts| +|Added|NA|Class name: geoLocationManager
Method or attribute name: function off(type: 'locationChange', callback?: Callback): void;|@ohos.geoLocationManager.d.ts| +|Added|NA|Class name: geoLocationManager
Method or attribute name: function on(type: 'locationEnabledChange', callback: Callback): void;|@ohos.geoLocationManager.d.ts| +|Added|NA|Class name: geoLocationManager
Method or attribute name: function off(type: 'locationEnabledChange', callback?: Callback): void;|@ohos.geoLocationManager.d.ts| +|Added|NA|Class name: geoLocationManager
Method or attribute name: function on(type: 'cachedGnssLocationsChange', request: CachedGnssLocationsRequest, callback: Callback>): void;|@ohos.geoLocationManager.d.ts| +|Added|NA|Class name: geoLocationManager
Method or attribute name: function off(type: 'cachedGnssLocationsChange', callback?: Callback>): void;|@ohos.geoLocationManager.d.ts| +|Added|NA|Class name: geoLocationManager
Method or attribute name: function on(type: 'satelliteStatusChange', callback: Callback): void;|@ohos.geoLocationManager.d.ts| +|Added|NA|Class name: geoLocationManager
Method or attribute name: function off(type: 'satelliteStatusChange', callback?: Callback): void;|@ohos.geoLocationManager.d.ts| +|Added|NA|Class name: geoLocationManager
Method or attribute name: function on(type: 'nmeaMessage', callback: Callback): void;|@ohos.geoLocationManager.d.ts| +|Added|NA|Class name: geoLocationManager
Method or attribute name: function off(type: 'nmeaMessage', callback?: Callback): void;|@ohos.geoLocationManager.d.ts| +|Added|NA|Class name: geoLocationManager
Method or attribute name: function on(type: 'gnssFenceStatusChange', request: GeofenceRequest, want: WantAgent): void;|@ohos.geoLocationManager.d.ts| +|Added|NA|Class name: geoLocationManager
Method or attribute name: function off(type: 'gnssFenceStatusChange', request: GeofenceRequest, want: WantAgent): void;|@ohos.geoLocationManager.d.ts| +|Added|NA|Class name: geoLocationManager
Method or attribute name: function getCurrentLocation(request: CurrentLocationRequest, callback: AsyncCallback): void;|@ohos.geoLocationManager.d.ts| +|Added|NA|Class name: geoLocationManager
Method or attribute name: function getCurrentLocation(callback: AsyncCallback): void;|@ohos.geoLocationManager.d.ts| +|Added|NA|Class name: geoLocationManager
Method or attribute name: function getCurrentLocation(request?: CurrentLocationRequest): Promise;|@ohos.geoLocationManager.d.ts| +|Added|NA|Class name: geoLocationManager
Method or attribute name: function getLastLocation(): Location;|@ohos.geoLocationManager.d.ts| +|Added|NA|Class name: geoLocationManager
Method or attribute name: function isLocationEnabled(): boolean;|@ohos.geoLocationManager.d.ts| +|Added|NA|Class name: geoLocationManager
Method or attribute name: function disableLocation(): void;|@ohos.geoLocationManager.d.ts| +|Added|NA|Class name: geoLocationManager
Method or attribute name: function getAddressesFromLocation(request: ReverseGeoCodeRequest, callback: AsyncCallback>): void;|@ohos.geoLocationManager.d.ts| +|Added|NA|Class name: geoLocationManager
Method or attribute name: function getAddressesFromLocation(request: ReverseGeoCodeRequest): Promise>;|@ohos.geoLocationManager.d.ts| +|Added|NA|Class name: geoLocationManager
Method or attribute name: function getAddressesFromLocationName(request: GeoCodeRequest, callback: AsyncCallback>): void;|@ohos.geoLocationManager.d.ts| +|Added|NA|Class name: geoLocationManager
Method or attribute name: function getAddressesFromLocationName(request: GeoCodeRequest): Promise>;|@ohos.geoLocationManager.d.ts| +|Added|NA|Class name: geoLocationManager
Method or attribute name: function isGeocoderAvailable(): boolean;|@ohos.geoLocationManager.d.ts| +|Added|NA|Class name: geoLocationManager
Method or attribute name: function getCachedGnssLocationsSize(callback: AsyncCallback): void;|@ohos.geoLocationManager.d.ts| +|Added|NA|Class name: geoLocationManager
Method or attribute name: function getCachedGnssLocationsSize(): Promise;|@ohos.geoLocationManager.d.ts| +|Added|NA|Class name: geoLocationManager
Method or attribute name: function flushCachedGnssLocations(callback: AsyncCallback): void;|@ohos.geoLocationManager.d.ts| +|Added|NA|Class name: geoLocationManager
Method or attribute name: function flushCachedGnssLocations(): Promise;|@ohos.geoLocationManager.d.ts| +|Added|NA|Class name: geoLocationManager
Method or attribute name: function sendCommand(command: LocationCommand, callback: AsyncCallback): void;|@ohos.geoLocationManager.d.ts| +|Added|NA|Class name: geoLocationManager
Method or attribute name: function sendCommand(command: LocationCommand): Promise;|@ohos.geoLocationManager.d.ts| +|Added|NA|Class name: geoLocationManager
Method or attribute name: function enableLocationMock(): void;|@ohos.geoLocationManager.d.ts| +|Added|NA|Class name: geoLocationManager
Method or attribute name: function disableLocationMock(): void;|@ohos.geoLocationManager.d.ts| +|Added|NA|Class name: geoLocationManager
Method or attribute name: function setMockedLocations(config: LocationMockConfig): void;|@ohos.geoLocationManager.d.ts| +|Added|NA|Class name: geoLocationManager
Method or attribute name: function enableReverseGeocodingMock(): void;|@ohos.geoLocationManager.d.ts| +|Added|NA|Class name: geoLocationManager
Method or attribute name: function disableReverseGeocodingMock(): void;|@ohos.geoLocationManager.d.ts| +|Added|NA|Class name: geoLocationManager
Method or attribute name: function setReverseGeocodingMockInfo(mockInfos: Array): void;|@ohos.geoLocationManager.d.ts| +|Added|NA|Class name: geoLocationManager
Method or attribute name: function isLocationPrivacyConfirmed(type: LocationPrivacyType): boolean;|@ohos.geoLocationManager.d.ts| +|Added|NA|Class name: geoLocationManager
Method or attribute name: function setLocationPrivacyConfirmStatus(type: LocationPrivacyType, isConfirmed: boolean): void;|@ohos.geoLocationManager.d.ts| +|Deleted|Module name: ohos.geolocation
Class name: geolocation
Method or attribute name: function enableLocation(callback: AsyncCallback): void;|NA|@ohos.geolocation.d.ts| +|Deleted|Module name: ohos.geolocation
Class name: geolocation
Method or attribute name: function enableLocation(): Promise;|NA|@ohos.geolocation.d.ts| +|Deleted|Module name: ohos.geolocation
Class name: geolocation
Method or attribute name: function disableLocation(callback: AsyncCallback): void;|NA|@ohos.geolocation.d.ts| +|Deleted|Module name: ohos.geolocation
Class name: geolocation
Method or attribute name: function disableLocation(): Promise;|NA|@ohos.geolocation.d.ts| +|Deleted|Module name: ohos.geoLocationManager
Class name: GeofenceRequest
Method or attribute name: priority: LocationRequestPriority;|NA|@ohos.geoLocationManager.d.ts| +|Access level changed|Class name: ReverseGeocodingMockInfo
Method or attribute name: location: ReverseGeoCodeRequest;
Access level: public API|Class name: ReverseGeocodingMockInfo
Method or attribute name: location: ReverseGeoCodeRequest;
Access level: system API|@ohos.geoLocationManager.d.ts| +|Access level changed|Class name: ReverseGeocodingMockInfo
Method or attribute name: geoAddress: GeoAddress;
Access level: public API|Class name: ReverseGeocodingMockInfo
Method or attribute name: geoAddress: GeoAddress;
Access level: system API|@ohos.geoLocationManager.d.ts| +|Access level changed|Class name: LocationMockConfig
Method or attribute name: timeInterval: number;
Access level: public API|Class name: LocationMockConfig
Method or attribute name: timeInterval: number;
Access level: system API|@ohos.geoLocationManager.d.ts| +|Access level changed|Class name: LocationMockConfig
Method or attribute name: locations: Array;
Access level: public API|Class name: LocationMockConfig
Method or attribute name: locations: Array;
Access level: system API|@ohos.geoLocationManager.d.ts| +|Access level changed|Class name: GeoAddress
Method or attribute name: isFromMock?: Boolean;
Access level: public API|Class name: GeoAddress
Method or attribute name: isFromMock?: Boolean;
Access level: system API|@ohos.geoLocationManager.d.ts| +|Access level changed|Class name: Location
Method or attribute name: isFromMock?: Boolean;
Access level: public API|Class name: Location
Method or attribute name: isFromMock?: Boolean;
Access level: system API|@ohos.geoLocationManager.d.ts| +|Access level changed|Class name: LocationPrivacyType
Access level: public API|Class name: LocationPrivacyType
Access level: system API|@ohos.geoLocationManager.d.ts| +|Access level changed|Class name: LocationPrivacyType
Method or attribute name: OTHERS = 0
Access level: public API|Class name: LocationPrivacyType
Method or attribute name: OTHERS = 0
Access level: system API|@ohos.geoLocationManager.d.ts| +|Access level changed|Class name: LocationPrivacyType
Method or attribute name: STARTUP
Access level: public API|Class name: LocationPrivacyType
Method or attribute name: STARTUP
Access level: system API|@ohos.geoLocationManager.d.ts| +|Access level changed|Class name: LocationPrivacyType
Method or attribute name: CORE_LOCATION
Access level: public API|Class name: LocationPrivacyType
Method or attribute name: CORE_LOCATION
Access level: system API|@ohos.geoLocationManager.d.ts| +|Deprecated version changed|Class name: geolocation
Deprecated version: N/A|Class name: geolocation
Deprecated version: 9
Substitute API: N/A|@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: geolocation
Method or attribute name: function on(type: 'locationChange', request: LocationRequest, callback: Callback): void;
Deprecated version: N/A|Class name: geolocation
Method or attribute name: function on(type: 'locationChange', request: LocationRequest, callback: Callback): void;
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager.on|@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: geolocation
Method or attribute name: function off(type: 'locationChange', callback?: Callback): void;
Deprecated version: N/A|Class name: geolocation
Method or attribute name: function off(type: 'locationChange', callback?: Callback): void;
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager.off|@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: geolocation
Method or attribute name: function on(type: 'locationServiceState', callback: Callback): void;
Deprecated version: N/A|Class name: geolocation
Method or attribute name: function on(type: 'locationServiceState', callback: Callback): void;
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager.on|@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: geolocation
Method or attribute name: function off(type: 'locationServiceState', callback?: Callback): void;
Deprecated version: N/A|Class name: geolocation
Method or attribute name: function off(type: 'locationServiceState', callback?: Callback): void;
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager.off|@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: geolocation
Method or attribute name: function on(type: 'cachedGnssLocationsReporting', request: CachedGnssLocationsRequest, callback: Callback>): void;
Deprecated version: N/A|Class name: geolocation
Method or attribute name: function on(type: 'cachedGnssLocationsReporting', request: CachedGnssLocationsRequest, callback: Callback>): void;
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager.on|@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: geolocation
Method or attribute name: function off(type: 'cachedGnssLocationsReporting', callback?: Callback>): void;
Deprecated version: N/A|Class name: geolocation
Method or attribute name: function off(type: 'cachedGnssLocationsReporting', callback?: Callback>): void;
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager.off|@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: geolocation
Method or attribute name: function on(type: 'gnssStatusChange', callback: Callback): void;
Deprecated version: N/A|Class name: geolocation
Method or attribute name: function on(type: 'gnssStatusChange', callback: Callback): void;
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager.on|@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: geolocation
Method or attribute name: function off(type: 'gnssStatusChange', callback?: Callback): void;
Deprecated version: N/A|Class name: geolocation
Method or attribute name: function off(type: 'gnssStatusChange', callback?: Callback): void;
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager.off|@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: geolocation
Method or attribute name: function on(type: 'nmeaMessageChange', callback: Callback): void;
Deprecated version: N/A|Class name: geolocation
Method or attribute name: function on(type: 'nmeaMessageChange', callback: Callback): void;
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager.on|@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: geolocation
Method or attribute name: function off(type: 'nmeaMessageChange', callback?: Callback): void;
Deprecated version: N/A|Class name: geolocation
Method or attribute name: function off(type: 'nmeaMessageChange', callback?: Callback): void;
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager.off|@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: geolocation
Method or attribute name: function on(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent): void;
Deprecated version: N/A|Class name: geolocation
Method or attribute name: function on(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent): void;
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager.on|@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: geolocation
Method or attribute name: function off(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent): void;
Deprecated version: N/A|Class name: geolocation
Method or attribute name: function off(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent): void;
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager.off|@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: geolocation
Method or attribute name: function getCurrentLocation(request: CurrentLocationRequest, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: geolocation
Method or attribute name: function getCurrentLocation(request: CurrentLocationRequest, callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager.getCurrentLocation |@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: geolocation
Method or attribute name: function getCurrentLocation(callback: AsyncCallback): void;
Deprecated version: N/A|Class name: geolocation
Method or attribute name: function getCurrentLocation(callback: AsyncCallback): void;
Deprecated version: 9|@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: geolocation
Method or attribute name: function getCurrentLocation(request?: CurrentLocationRequest): Promise;
Deprecated version: N/A|Class name: geolocation
Method or attribute name: function getCurrentLocation(request?: CurrentLocationRequest): Promise;
Deprecated version: 9|@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: geolocation
Method or attribute name: function getLastLocation(callback: AsyncCallback): void;
Deprecated version: N/A|Class name: geolocation
Method or attribute name: function getLastLocation(callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager.getLastLocation |@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: geolocation
Method or attribute name: function getLastLocation(): Promise;
Deprecated version: N/A|Class name: geolocation
Method or attribute name: function getLastLocation(): Promise;
Deprecated version: 9|@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: geolocation
Method or attribute name: function isLocationEnabled(callback: AsyncCallback): void;
Deprecated version: N/A|Class name: geolocation
Method or attribute name: function isLocationEnabled(callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager.isLocationEnabled |@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: geolocation
Method or attribute name: function isLocationEnabled(): Promise;
Deprecated version: N/A|Class name: geolocation
Method or attribute name: function isLocationEnabled(): Promise;
Deprecated version: 9|@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: geolocation
Method or attribute name: function requestEnableLocation(callback: AsyncCallback): void;
Deprecated version: N/A|Class name: geolocation
Method or attribute name: function requestEnableLocation(callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: N/A|@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: geolocation
Method or attribute name: function requestEnableLocation(): Promise;
Deprecated version: N/A|Class name: geolocation
Method or attribute name: function requestEnableLocation(): Promise;
Deprecated version: 9|@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: geolocation
Method or attribute name: function getAddressesFromLocation(request: ReverseGeoCodeRequest, callback: AsyncCallback>): void;
Deprecated version: N/A|Class name: geolocation
Method or attribute name: function getAddressesFromLocation(request: ReverseGeoCodeRequest, callback: AsyncCallback>): void;
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager.getAddressesFromLocation |@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: geolocation
Method or attribute name: function getAddressesFromLocation(request: ReverseGeoCodeRequest): Promise>;
Deprecated version: N/A|Class name: geolocation
Method or attribute name: function getAddressesFromLocation(request: ReverseGeoCodeRequest): Promise>;
Deprecated version: 9|@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: geolocation
Method or attribute name: function getAddressesFromLocationName(request: GeoCodeRequest, callback: AsyncCallback>): void;
Deprecated version: N/A|Class name: geolocation
Method or attribute name: function getAddressesFromLocationName(request: GeoCodeRequest, callback: AsyncCallback>): void;
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager.getAddressesFromLocationName |@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: geolocation
Method or attribute name: function getAddressesFromLocationName(request: GeoCodeRequest): Promise>;
Deprecated version: N/A|Class name: geolocation
Method or attribute name: function getAddressesFromLocationName(request: GeoCodeRequest): Promise>;
Deprecated version: 9|@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: geolocation
Method or attribute name: function isGeoServiceAvailable(callback: AsyncCallback): void;
Deprecated version: N/A|Class name: geolocation
Method or attribute name: function isGeoServiceAvailable(callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager.isGeocoderAvailable |@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: geolocation
Method or attribute name: function isGeoServiceAvailable(): Promise;
Deprecated version: N/A|Class name: geolocation
Method or attribute name: function isGeoServiceAvailable(): Promise;
Deprecated version: 9|@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: geolocation
Method or attribute name: function getCachedGnssLocationsSize(callback: AsyncCallback): void;
Deprecated version: N/A|Class name: geolocation
Method or attribute name: function getCachedGnssLocationsSize(callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager.getCachedGnssLocationsSize |@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: geolocation
Method or attribute name: function getCachedGnssLocationsSize(): Promise;
Deprecated version: N/A|Class name: geolocation
Method or attribute name: function getCachedGnssLocationsSize(): Promise;
Deprecated version: 9|@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: geolocation
Method or attribute name: function flushCachedGnssLocations(callback: AsyncCallback): void;
Deprecated version: N/A|Class name: geolocation
Method or attribute name: function flushCachedGnssLocations(callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager.flushCachedGnssLocations |@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: geolocation
Method or attribute name: function flushCachedGnssLocations(): Promise;
Deprecated version: N/A|Class name: geolocation
Method or attribute name: function flushCachedGnssLocations(): Promise;
Deprecated version: 9|@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: geolocation
Method or attribute name: function sendCommand(command: LocationCommand, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: geolocation
Method or attribute name: function sendCommand(command: LocationCommand, callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager.sendCommand |@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: geolocation
Method or attribute name: function sendCommand(command: LocationCommand): Promise;
Deprecated version: N/A|Class name: geolocation
Method or attribute name: function sendCommand(command: LocationCommand): Promise;
Deprecated version: 9|@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: SatelliteStatusInfo
Deprecated version: N/A|Class name: SatelliteStatusInfo
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager.SatelliteStatusInfo |@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: CachedGnssLocationsRequest
Deprecated version: N/A|Class name: CachedGnssLocationsRequest
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager.CachedGnssLocationsRequest |@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: GeofenceRequest
Deprecated version: N/A|Class name: GeofenceRequest
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager.GeofenceRequest |@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: Geofence
Deprecated version: N/A|Class name: Geofence
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager.Geofence |@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: ReverseGeoCodeRequest
Deprecated version: N/A|Class name: ReverseGeoCodeRequest
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager.ReverseGeoCodeRequest |@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: GeoCodeRequest
Deprecated version: N/A|Class name: GeoCodeRequest
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager.GeoCodeRequest |@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: GeoAddress
Deprecated version: N/A|Class name: GeoAddress
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager.GeoAddress |@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: LocationRequest
Deprecated version: N/A|Class name: LocationRequest
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager.LocationRequest |@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: CurrentLocationRequest
Deprecated version: N/A|Class name: CurrentLocationRequest
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager.CurrentLocationRequest |@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: Location
Deprecated version: N/A|Class name: Location
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager.Location |@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: LocationRequestPriority
Deprecated version: N/A|Class name: LocationRequestPriority
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager.LocationRequestPriority |@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: LocationRequestScenario
Deprecated version: N/A|Class name: LocationRequestScenario
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager.LocationRequestScenario |@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: GeoLocationErrorCode
Deprecated version: N/A|Class name: GeoLocationErrorCode
Deprecated version: 9
Substitute API: N/A|@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: LocationPrivacyType
Deprecated version: N/A|Class name: LocationPrivacyType
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager.LocationPrivacyType |@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: LocationCommand
Deprecated version: N/A|Class name: LocationCommand
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager.LocationCommand |@ohos.geolocation.d.ts| +|Deprecated version changed|Class name: GeolocationResponse
Deprecated version: N/A|Class name: GeolocationResponse
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager.Location |@system.geolocation.d.ts| +|Deprecated version changed|Class name: GetLocationOption
Deprecated version: N/A|Class name: GetLocationOption
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager.CurrentLocationRequest |@system.geolocation.d.ts| +|Deprecated version changed|Class name: GetLocationTypeResponse
Deprecated version: N/A|Class name: GetLocationTypeResponse
Deprecated version: 9
Substitute API: N/A|@system.geolocation.d.ts| +|Deprecated version changed|Class name: GetLocationTypeOption
Deprecated version: N/A|Class name: GetLocationTypeOption
Deprecated version: 9
Substitute API: N/A|@system.geolocation.d.ts| +|Deprecated version changed|Class name: SubscribeLocationOption
Deprecated version: N/A|Class name: SubscribeLocationOption
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager.LocationRequest |@system.geolocation.d.ts| +|Deprecated version changed|Class name: Geolocation
Deprecated version: N/A|Class name: Geolocation
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager |@system.geolocation.d.ts| +|Deprecated version changed|Class name: Geolocation
Method or attribute name: static getLocation(options?: GetLocationOption): void;
Deprecated version: N/A|Class name: Geolocation
Method or attribute name: static getLocation(options?: GetLocationOption): void;
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager.getCurrentLocation |@system.geolocation.d.ts| +|Deprecated version changed|Class name: Geolocation
Method or attribute name: static getLocationType(options?: GetLocationTypeOption): void;
Deprecated version: N/A|Class name: Geolocation
Method or attribute name: static getLocationType(options?: GetLocationTypeOption): void;
Deprecated version: 9
Substitute API: N/A|@system.geolocation.d.ts| +|Deprecated version changed|Class name: Geolocation
Method or attribute name: static subscribe(options: SubscribeLocationOption): void;
Deprecated version: N/A|Class name: Geolocation
Method or attribute name: static subscribe(options: SubscribeLocationOption): void;
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager.on|@system.geolocation.d.ts| +|Deprecated version changed|Class name: Geolocation
Method or attribute name: static unsubscribe(): void;
Deprecated version: N/A|Class name: Geolocation
Method or attribute name: static unsubscribe(): void;
Deprecated version: 9
Substitute API: ohos.geoLocationManager/geoLocationManager.off|@system.geolocation.d.ts| +|Deprecated version changed|Class name: Geolocation
Method or attribute name: static getSupportedCoordTypes(): Array;
Deprecated version: N/A|Class name: Geolocation
Method or attribute name: static getSupportedCoordTypes(): Array;
Deprecated version: 9
Substitute API: N/A|@system.geolocation.d.ts| +|Initial version changed|Class name: ReverseGeocodingMockInfo
Method or attribute name: location: ReverseGeoCodeRequest;
Initial version: N/A|Class name: ReverseGeocodingMockInfo
Method or attribute name: location: ReverseGeoCodeRequest;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: ReverseGeocodingMockInfo
Method or attribute name: geoAddress: GeoAddress;
Initial version: N/A|Class name: ReverseGeocodingMockInfo
Method or attribute name: geoAddress: GeoAddress;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: LocationMockConfig
Method or attribute name: timeInterval: number;
Initial version: N/A|Class name: LocationMockConfig
Method or attribute name: timeInterval: number;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: LocationMockConfig
Method or attribute name: locations: Array;
Initial version: N/A|Class name: LocationMockConfig
Method or attribute name: locations: Array;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: SatelliteStatusInfo
Method or attribute name: satellitesNumber: number;
Initial version: N/A|Class name: SatelliteStatusInfo
Method or attribute name: satellitesNumber: number;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: SatelliteStatusInfo
Method or attribute name: satelliteIds: Array;
Initial version: N/A|Class name: SatelliteStatusInfo
Method or attribute name: satelliteIds: Array;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: SatelliteStatusInfo
Method or attribute name: carrierToNoiseDensitys: Array;
Initial version: N/A|Class name: SatelliteStatusInfo
Method or attribute name: carrierToNoiseDensitys: Array;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: SatelliteStatusInfo
Method or attribute name: altitudes: Array;
Initial version: N/A|Class name: SatelliteStatusInfo
Method or attribute name: altitudes: Array;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: SatelliteStatusInfo
Method or attribute name: azimuths: Array;
Initial version: N/A|Class name: SatelliteStatusInfo
Method or attribute name: azimuths: Array;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: SatelliteStatusInfo
Method or attribute name: carrierFrequencies: Array;
Initial version: N/A|Class name: SatelliteStatusInfo
Method or attribute name: carrierFrequencies: Array;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: CachedGnssLocationsRequest
Method or attribute name: reportingPeriodSec: number;
Initial version: N/A|Class name: CachedGnssLocationsRequest
Method or attribute name: reportingPeriodSec: number;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: CachedGnssLocationsRequest
Method or attribute name: wakeUpCacheQueueFull: boolean;
Initial version: N/A|Class name: CachedGnssLocationsRequest
Method or attribute name: wakeUpCacheQueueFull: boolean;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: GeofenceRequest
Method or attribute name: scenario: LocationRequestScenario;
Initial version: N/A|Class name: GeofenceRequest
Method or attribute name: scenario: LocationRequestScenario;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: GeofenceRequest
Method or attribute name: geofence: Geofence;
Initial version: N/A|Class name: GeofenceRequest
Method or attribute name: geofence: Geofence;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: Geofence
Method or attribute name: latitude: number;
Initial version: N/A|Class name: Geofence
Method or attribute name: latitude: number;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: Geofence
Method or attribute name: longitude: number;
Initial version: N/A|Class name: Geofence
Method or attribute name: longitude: number;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: Geofence
Method or attribute name: radius: number;
Initial version: N/A|Class name: Geofence
Method or attribute name: radius: number;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: Geofence
Method or attribute name: expiration: number;
Initial version: N/A|Class name: Geofence
Method or attribute name: expiration: number;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: ReverseGeoCodeRequest
Method or attribute name: locale?: string;
Initial version: N/A|Class name: ReverseGeoCodeRequest
Method or attribute name: locale?: string;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: ReverseGeoCodeRequest
Method or attribute name: latitude: number;
Initial version: N/A|Class name: ReverseGeoCodeRequest
Method or attribute name: latitude: number;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: ReverseGeoCodeRequest
Method or attribute name: longitude: number;
Initial version: N/A|Class name: ReverseGeoCodeRequest
Method or attribute name: longitude: number;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: ReverseGeoCodeRequest
Method or attribute name: maxItems?: number;
Initial version: N/A|Class name: ReverseGeoCodeRequest
Method or attribute name: maxItems?: number;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: GeoCodeRequest
Method or attribute name: locale?: string;
Initial version: N/A|Class name: GeoCodeRequest
Method or attribute name: locale?: string;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: GeoCodeRequest
Method or attribute name: description: string;
Initial version: N/A|Class name: GeoCodeRequest
Method or attribute name: description: string;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: GeoCodeRequest
Method or attribute name: maxItems?: number;
Initial version: N/A|Class name: GeoCodeRequest
Method or attribute name: maxItems?: number;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: GeoCodeRequest
Method or attribute name: minLatitude?: number;
Initial version: N/A|Class name: GeoCodeRequest
Method or attribute name: minLatitude?: number;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: GeoCodeRequest
Method or attribute name: minLongitude?: number;
Initial version: N/A|Class name: GeoCodeRequest
Method or attribute name: minLongitude?: number;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: GeoCodeRequest
Method or attribute name: maxLatitude?: number;
Initial version: N/A|Class name: GeoCodeRequest
Method or attribute name: maxLatitude?: number;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: GeoCodeRequest
Method or attribute name: maxLongitude?: number;
Initial version: N/A|Class name: GeoCodeRequest
Method or attribute name: maxLongitude?: number;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: LocationRequest
Method or attribute name: priority?: LocationRequestPriority;
Initial version: N/A|Class name: LocationRequest
Method or attribute name: priority?: LocationRequestPriority;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: LocationRequest
Method or attribute name: scenario?: LocationRequestScenario;
Initial version: N/A|Class name: LocationRequest
Method or attribute name: scenario?: LocationRequestScenario;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: LocationRequest
Method or attribute name: timeInterval?: number;
Initial version: N/A|Class name: LocationRequest
Method or attribute name: timeInterval?: number;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: LocationRequest
Method or attribute name: distanceInterval?: number;
Initial version: N/A|Class name: LocationRequest
Method or attribute name: distanceInterval?: number;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: LocationRequest
Method or attribute name: maxAccuracy?: number;
Initial version: N/A|Class name: LocationRequest
Method or attribute name: maxAccuracy?: number;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: CurrentLocationRequest
Method or attribute name: priority?: LocationRequestPriority;
Initial version: N/A|Class name: CurrentLocationRequest
Method or attribute name: priority?: LocationRequestPriority;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: CurrentLocationRequest
Method or attribute name: scenario?: LocationRequestScenario;
Initial version: N/A|Class name: CurrentLocationRequest
Method or attribute name: scenario?: LocationRequestScenario;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: CurrentLocationRequest
Method or attribute name: maxAccuracy?: number;
Initial version: N/A|Class name: CurrentLocationRequest
Method or attribute name: maxAccuracy?: number;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: CurrentLocationRequest
Method or attribute name: timeoutMs?: number;
Initial version: N/A|Class name: CurrentLocationRequest
Method or attribute name: timeoutMs?: number;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: LocationRequestPriority
Method or attribute name: UNSET = 0x200
Initial version: N/A|Class name: LocationRequestPriority
Method or attribute name: UNSET = 0x200
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: LocationRequestPriority
Method or attribute name: ACCURACY
Initial version: N/A|Class name: LocationRequestPriority
Method or attribute name: ACCURACY
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: LocationRequestPriority
Method or attribute name: LOW_POWER
Initial version: N/A|Class name: LocationRequestPriority
Method or attribute name: LOW_POWER
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: LocationRequestPriority
Method or attribute name: FIRST_FIX
Initial version: N/A|Class name: LocationRequestPriority
Method or attribute name: FIRST_FIX
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: LocationRequestScenario
Method or attribute name: UNSET = 0x300
Initial version: N/A|Class name: LocationRequestScenario
Method or attribute name: UNSET = 0x300
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: LocationRequestScenario
Method or attribute name: NAVIGATION
Initial version: N/A|Class name: LocationRequestScenario
Method or attribute name: NAVIGATION
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: LocationRequestScenario
Method or attribute name: TRAJECTORY_TRACKING
Initial version: N/A|Class name: LocationRequestScenario
Method or attribute name: TRAJECTORY_TRACKING
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: LocationRequestScenario
Method or attribute name: CAR_HAILING
Initial version: N/A|Class name: LocationRequestScenario
Method or attribute name: CAR_HAILING
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: LocationRequestScenario
Method or attribute name: DAILY_LIFE_SERVICE
Initial version: N/A|Class name: LocationRequestScenario
Method or attribute name: DAILY_LIFE_SERVICE
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: LocationRequestScenario
Method or attribute name: NO_POWER
Initial version: N/A|Class name: LocationRequestScenario
Method or attribute name: NO_POWER
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: LocationPrivacyType
Method or attribute name: OTHERS = 0
Initial version: N/A|Class name: LocationPrivacyType
Method or attribute name: OTHERS = 0
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: LocationPrivacyType
Method or attribute name: STARTUP
Initial version: N/A|Class name: LocationPrivacyType
Method or attribute name: STARTUP
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: LocationPrivacyType
Method or attribute name: CORE_LOCATION
Initial version: N/A|Class name: LocationPrivacyType
Method or attribute name: CORE_LOCATION
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: LocationCommand
Method or attribute name: scenario: LocationRequestScenario;
Initial version: N/A|Class name: LocationCommand
Method or attribute name: scenario: LocationRequestScenario;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: LocationCommand
Method or attribute name: command: string;
Initial version: N/A|Class name: LocationCommand
Method or attribute name: command: string;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: CountryCode
Method or attribute name: country: string;
Initial version: N/A|Class name: CountryCode
Method or attribute name: country: string;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: CountryCode
Method or attribute name: type: CountryCodeType;
Initial version: N/A|Class name: CountryCode
Method or attribute name: type: CountryCodeType;
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: CountryCodeType
Method or attribute name: COUNTRY_CODE_FROM_LOCALE = 1
Initial version: N/A|Class name: CountryCodeType
Method or attribute name: COUNTRY_CODE_FROM_LOCALE = 1
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: CountryCodeType
Method or attribute name: COUNTRY_CODE_FROM_SIM
Initial version: N/A|Class name: CountryCodeType
Method or attribute name: COUNTRY_CODE_FROM_SIM
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: CountryCodeType
Method or attribute name: COUNTRY_CODE_FROM_LOCATION
Initial version: N/A|Class name: CountryCodeType
Method or attribute name: COUNTRY_CODE_FROM_LOCATION
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Initial version changed|Class name: CountryCodeType
Method or attribute name: COUNTRY_CODE_FROM_NETWORK
Initial version: N/A|Class name: CountryCodeType
Method or attribute name: COUNTRY_CODE_FROM_NETWORK
Initial version: 9|@ohos.geoLocationManager.d.ts| +|Error code added|NA|Class name: geoLocationManager
Method or attribute name: function enableLocation(): Promise;
Error code: 201,202,801,3301000|@ohos.geoLocationManager.d.ts| +|Error code added|NA|Class name: geoLocationManager
Method or attribute name: function getCountryCode(): Promise;
Error code: 801,3301000,3301500|@ohos.geoLocationManager.d.ts| +|Access level changed|Class name: ReverseGeocodingMockInfo
Method or attribute name: location: ReverseGeoCodeRequest;
Access level: public API|Class name: ReverseGeocodingMockInfo
Method or attribute name: location: ReverseGeoCodeRequest;
Access level: system API|@ohos.geoLocationManager.d.ts| +|Access level changed|Class name: ReverseGeocodingMockInfo
Method or attribute name: geoAddress: GeoAddress;
Access level: public API|Class name: ReverseGeocodingMockInfo
Method or attribute name: geoAddress: GeoAddress;
Access level: system API|@ohos.geoLocationManager.d.ts| +|Access level changed|Class name: LocationMockConfig
Method or attribute name: timeInterval: number;
Access level: public API|Class name: LocationMockConfig
Method or attribute name: timeInterval: number;
Access level: system API|@ohos.geoLocationManager.d.ts| +|Access level changed|Class name: LocationMockConfig
Method or attribute name: locations: Array;
Access level: public API|Class name: LocationMockConfig
Method or attribute name: locations: Array;
Access level: system API|@ohos.geoLocationManager.d.ts| +|Access level changed|Class name: GeoAddress
Method or attribute name: isFromMock?: Boolean;
Access level: public API|Class name: GeoAddress
Method or attribute name: isFromMock?: Boolean;
Access level: system API|@ohos.geoLocationManager.d.ts| +|Access level changed|Class name: Location
Method or attribute name: isFromMock?: Boolean;
Access level: public API|Class name: Location
Method or attribute name: isFromMock?: Boolean;
Access level: system API|@ohos.geoLocationManager.d.ts| +|Access level changed|Class name: LocationPrivacyType
Access level: public API|Class name: LocationPrivacyType
Access level: system API|@ohos.geoLocationManager.d.ts| +|Access level changed|Class name: LocationPrivacyType
Method or attribute name: OTHERS = 0
Access level: public API|Class name: LocationPrivacyType
Method or attribute name: OTHERS = 0
Access level: system API|@ohos.geoLocationManager.d.ts| +|Access level changed|Class name: LocationPrivacyType
Method or attribute name: STARTUP
Access level: public API|Class name: LocationPrivacyType
Method or attribute name: STARTUP
Access level: system API|@ohos.geoLocationManager.d.ts| +|Access level changed|Class name: LocationPrivacyType
Method or attribute name: CORE_LOCATION
Access level: public API|Class name: LocationPrivacyType
Method or attribute name: CORE_LOCATION
Access level: system API|@ohos.geoLocationManager.d.ts| diff --git a/en/release-notes/api-change/v3.2-beta5/js-apidiff-global.md b/en/release-notes/api-change/v3.2-beta5/js-apidiff-global.md new file mode 100644 index 0000000000000000000000000000000000000000..83202e125ed29d9617b9c0c6110d35683e176891 --- /dev/null +++ b/en/release-notes/api-change/v3.2-beta5/js-apidiff-global.md @@ -0,0 +1,36 @@ +| Change Type | Old Version | New Version | d.ts File | +| ---- | ------ | ------ | -------- | +|Added|NA|Module name: ohos.resourceManager
Class name: AsyncCallback|@ohos.resourceManager.d.ts| +|Added|NA|Class name: AsyncCallback
Method or attribute name: |@ohos.resourceManager.d.ts| +|Added|NA|Module name: ohos.resourceManager
Class name: AsyncCallback
Method or attribute name: (err: Error, data: T): void;|@ohos.resourceManager.d.ts| +|Added|NA|Class name: AsyncCallback
Method or attribute name: (err: Error, data: T): void;|@ohos.resourceManager.d.ts| +|Function changed|Class name: ResourceManager
Method or attribute name: getStringValue(resource: Resource, callback: AsyncCallback): void;
|Class name: ResourceManager
Method or attribute name: getStringValue(resource: Resource, callback: _AsyncCallback): void;
|@ohos.resourceManager.d.ts| +|Function changed|Class name: ResourceManager
Method or attribute name: getStringValue(resId: number, callback: AsyncCallback): void;
|Class name: ResourceManager
Method or attribute name: getStringValue(resource: Resource, callback: _AsyncCallback): void;
|@ohos.resourceManager.d.ts| +|Function changed|Class name: ResourceManager
Method or attribute name: getStringArrayValue(resource: Resource, callback: AsyncCallback>): void;
|Class name: ResourceManager
Method or attribute name: getStringArrayValue(resource: Resource, callback: _AsyncCallback>): void;
|@ohos.resourceManager.d.ts| +|Function changed|Class name: ResourceManager
Method or attribute name: getStringArrayValue(resId: number, callback: AsyncCallback>): void;
|Class name: ResourceManager
Method or attribute name: getStringArrayValue(resource: Resource, callback: _AsyncCallback>): void;
|@ohos.resourceManager.d.ts| +|Function changed|Class name: ResourceManager
Method or attribute name: getMediaContent(resource: Resource, callback: AsyncCallback): void;
|Class name: ResourceManager
Method or attribute name: getMediaContent(resource: Resource, callback: _AsyncCallback): void;
|@ohos.resourceManager.d.ts| +|Function changed|Class name: ResourceManager
Method or attribute name: getMediaContent(resId: number, callback: AsyncCallback): void;
|Class name: ResourceManager
Method or attribute name: getMediaContent(resource: Resource, callback: _AsyncCallback): void;
|@ohos.resourceManager.d.ts| +|Function changed|Class name: ResourceManager
Method or attribute name: getMediaContentBase64(resource: Resource, callback: AsyncCallback): void;
|Class name: ResourceManager
Method or attribute name: getMediaContentBase64(resource: Resource, callback: _AsyncCallback): void;
|@ohos.resourceManager.d.ts| +|Function changed|Class name: ResourceManager
Method or attribute name: getMediaContentBase64(resId: number, callback: AsyncCallback): void;
|Class name: ResourceManager
Method or attribute name: getMediaContentBase64(resource: Resource, callback: _AsyncCallback): void;
|@ohos.resourceManager.d.ts| +|Function changed|Class name: ResourceManager
Method or attribute name: getDeviceCapability(callback: AsyncCallback): void;
|Class name: ResourceManager
Method or attribute name: getDeviceCapability(callback: _AsyncCallback): void;
|@ohos.resourceManager.d.ts| +|Function changed|Class name: ResourceManager
Method or attribute name: getConfiguration(callback: AsyncCallback): void;
|Class name: ResourceManager
Method or attribute name: getConfiguration(callback: _AsyncCallback): void;
|@ohos.resourceManager.d.ts| +|Function changed|Class name: ResourceManager
Method or attribute name: getPluralStringValue(resource: Resource, num: number, callback: AsyncCallback): void;
|Class name: ResourceManager
Method or attribute name: getPluralStringValue(resource: Resource, num: number, callback: _AsyncCallback): void;
|@ohos.resourceManager.d.ts| +|Function changed|Class name: ResourceManager
Method or attribute name: getPluralStringValue(resId: number, num: number, callback: AsyncCallback): void;
|Class name: ResourceManager
Method or attribute name: getPluralStringValue(resource: Resource, num: number, callback: _AsyncCallback): void;
|@ohos.resourceManager.d.ts| +|Function changed|Class name: ResourceManager
Method or attribute name: getStringByName(resName: string, callback: AsyncCallback): void;
|Class name: ResourceManager
Method or attribute name: getStringByName(resName: string, callback: _AsyncCallback): void;
|@ohos.resourceManager.d.ts| +|Function changed|Class name: ResourceManager
Method or attribute name: getStringArrayByName(resName: string, callback: AsyncCallback>): void;
|Class name: ResourceManager
Method or attribute name: getStringArrayByName(resName: string, callback: _AsyncCallback>): void;
|@ohos.resourceManager.d.ts| +|Function changed|Class name: ResourceManager
Method or attribute name: getMediaByName(resName: string, callback: AsyncCallback): void;
|Class name: ResourceManager
Method or attribute name: getMediaByName(resName: string, callback: _AsyncCallback): void;
|@ohos.resourceManager.d.ts| +|Function changed|Class name: ResourceManager
Method or attribute name: getMediaBase64ByName(resName: string, callback: AsyncCallback): void;
|Class name: ResourceManager
Method or attribute name: getMediaBase64ByName(resName: string, callback: _AsyncCallback): void;
|@ohos.resourceManager.d.ts| +|Function changed|Class name: ResourceManager
Method or attribute name: getPluralStringByName(resName: string, num: number, callback: AsyncCallback): void;
|Class name: ResourceManager
Method or attribute name: getPluralStringByName(resName: string, num: number, callback: _AsyncCallback): void;
|@ohos.resourceManager.d.ts| +|Function changed|Class name: ResourceManager
Method or attribute name: getStringValue(resource: Resource, callback: AsyncCallback): void;
|Class name: ResourceManager
Method or attribute name: getStringValue(resId: number, callback: _AsyncCallback): void;
|@ohos.resourceManager.d.ts| +|Function changed|Class name: ResourceManager
Method or attribute name: getStringValue(resId: number, callback: AsyncCallback): void;
|Class name: ResourceManager
Method or attribute name: getStringValue(resId: number, callback: _AsyncCallback): void;
|@ohos.resourceManager.d.ts| +|Function changed|Class name: ResourceManager
Method or attribute name: getStringArrayValue(resource: Resource, callback: AsyncCallback>): void;
|Class name: ResourceManager
Method or attribute name: getStringArrayValue(resId: number, callback: _AsyncCallback>): void;
|@ohos.resourceManager.d.ts| +|Function changed|Class name: ResourceManager
Method or attribute name: getStringArrayValue(resId: number, callback: AsyncCallback>): void;
|Class name: ResourceManager
Method or attribute name: getStringArrayValue(resId: number, callback: _AsyncCallback>): void;
|@ohos.resourceManager.d.ts| +|Function changed|Class name: ResourceManager
Method or attribute name: getPluralStringValue(resource: Resource, num: number, callback: AsyncCallback): void;
|Class name: ResourceManager
Method or attribute name: getPluralStringValue(resId: number, num: number, callback: _AsyncCallback): void;
|@ohos.resourceManager.d.ts| +|Function changed|Class name: ResourceManager
Method or attribute name: getPluralStringValue(resId: number, num: number, callback: AsyncCallback): void;
|Class name: ResourceManager
Method or attribute name: getPluralStringValue(resId: number, num: number, callback: _AsyncCallback): void;
|@ohos.resourceManager.d.ts| +|Function changed|Class name: ResourceManager
Method or attribute name: getMediaContent(resource: Resource, callback: AsyncCallback): void;
|Class name: ResourceManager
Method or attribute name: getMediaContent(resId: number, callback: _AsyncCallback): void;
|@ohos.resourceManager.d.ts| +|Function changed|Class name: ResourceManager
Method or attribute name: getMediaContent(resId: number, callback: AsyncCallback): void;
|Class name: ResourceManager
Method or attribute name: getMediaContent(resId: number, callback: _AsyncCallback): void;
|@ohos.resourceManager.d.ts| +|Function changed|Class name: ResourceManager
Method or attribute name: getMediaContentBase64(resource: Resource, callback: AsyncCallback): void;
|Class name: ResourceManager
Method or attribute name: getMediaContentBase64(resId: number, callback: _AsyncCallback): void;
|@ohos.resourceManager.d.ts| +|Function changed|Class name: ResourceManager
Method or attribute name: getMediaContentBase64(resId: number, callback: AsyncCallback): void;
|Class name: ResourceManager
Method or attribute name: getMediaContentBase64(resId: number, callback: _AsyncCallback): void;
|@ohos.resourceManager.d.ts| +|Function changed|Class name: ResourceManager
Method or attribute name: getRawFileContent(path: string, callback: AsyncCallback): void;
|Class name: ResourceManager
Method or attribute name: getRawFileContent(path: string, callback: _AsyncCallback): void;
|@ohos.resourceManager.d.ts| +|Function changed|Class name: ResourceManager
Method or attribute name: getRawFd(path: string, callback: AsyncCallback): void;
|Class name: ResourceManager
Method or attribute name: getRawFd(path: string, callback: _AsyncCallback): void;
|@ohos.resourceManager.d.ts| +|Function changed|Class name: ResourceManager
Method or attribute name: closeRawFd(path: string, callback: AsyncCallback): void;
|Class name: ResourceManager
Method or attribute name: closeRawFd(path: string, callback: _AsyncCallback): void;
|@ohos.resourceManager.d.ts| diff --git a/en/release-notes/api-change/v3.2-beta5/js-apidiff-misc.md b/en/release-notes/api-change/v3.2-beta5/js-apidiff-misc.md new file mode 100644 index 0000000000000000000000000000000000000000..38efc9449b101e3928f0654adfa119d8cb9969cc --- /dev/null +++ b/en/release-notes/api-change/v3.2-beta5/js-apidiff-misc.md @@ -0,0 +1,458 @@ +| Change Type | Old Version | New Version | d.ts File | +| ---- | ------ | ------ | -------- | +|Added|NA|Module name: ohos.inputMethod
Class name: inputMethod|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: inputMethod
Method or attribute name: const MAX_TYPE_NUM: number|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: inputMethod
Method or attribute name: function getInputMethodSetting(): InputMethodSetting;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: inputMethod
Method or attribute name: function getInputMethodController(): InputMethodController;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: inputMethod
Method or attribute name: function getSetting(): InputMethodSetting;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: inputMethod
Method or attribute name: function getController(): InputMethodController;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: inputMethod
Method or attribute name: function switchInputMethod(target: InputMethodProperty, callback: AsyncCallback): void;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: inputMethod
Method or attribute name: function switchInputMethod(target: InputMethodProperty): Promise;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: inputMethod
Method or attribute name: function getCurrentInputMethod(): InputMethodProperty;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: inputMethod
Method or attribute name: function switchCurrentInputMethodSubtype(target: InputMethodSubtype, callback: AsyncCallback): void;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: inputMethod
Method or attribute name: function switchCurrentInputMethodSubtype(target: InputMethodSubtype): Promise;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: inputMethod
Method or attribute name: function getCurrentInputMethodSubtype(): InputMethodSubtype;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: inputMethod
Method or attribute name: function switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype, callback: AsyncCallback): void;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: inputMethod
Method or attribute name: function switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype): Promise;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: InputMethodSetting|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: InputMethodSetting
Method or attribute name: on(type: 'imeChange', callback: (inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype) => void): void;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: InputMethodSetting
Method or attribute name: off(type: 'imeChange', callback?: (inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype) => void): void;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: InputMethodSetting
Method or attribute name: listInputMethodSubtype(inputMethodProperty: InputMethodProperty, callback: AsyncCallback>): void;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: InputMethodSetting
Method or attribute name: listInputMethodSubtype(inputMethodProperty: InputMethodProperty): Promise>;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: InputMethodSetting
Method or attribute name: listCurrentInputMethodSubtype(callback: AsyncCallback>): void;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: InputMethodSetting
Method or attribute name: listCurrentInputMethodSubtype(): Promise>;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: InputMethodSetting
Method or attribute name: getInputMethods(enable: boolean, callback: AsyncCallback>): void;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: InputMethodSetting
Method or attribute name: getInputMethods(enable: boolean): Promise>;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: InputMethodSetting
Method or attribute name: listInputMethod(callback: AsyncCallback>): void;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: InputMethodSetting
Method or attribute name: listInputMethod(): Promise>;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: InputMethodSetting
Method or attribute name: showOptionalInputMethods(callback: AsyncCallback): void;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: InputMethodSetting
Method or attribute name: showOptionalInputMethods(): Promise;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: InputMethodSetting
Method or attribute name: displayOptionalInputMethod(callback: AsyncCallback): void;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: InputMethodSetting
Method or attribute name: displayOptionalInputMethod(): Promise;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: InputMethodController|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: InputMethodController
Method or attribute name: stopInputSession(callback: AsyncCallback): void;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: InputMethodController
Method or attribute name: stopInputSession(): Promise;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: InputMethodController
Method or attribute name: stopInput(callback: AsyncCallback): void;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: InputMethodController
Method or attribute name: stopInput(): Promise;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: InputMethodController
Method or attribute name: showSoftKeyboard(callback: AsyncCallback): void;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: InputMethodController
Method or attribute name: showSoftKeyboard():Promise;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: InputMethodController
Method or attribute name: hideSoftKeyboard(callback: AsyncCallback): void;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: InputMethodController
Method or attribute name: hideSoftKeyboard():Promise;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: InputMethodProperty|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: InputMethodProperty
Method or attribute name: readonly packageName: string;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: InputMethodProperty
Method or attribute name: readonly methodId: string;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: InputMethodProperty
Method or attribute name: readonly name: string;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: InputMethodProperty
Method or attribute name: readonly id: string;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: InputMethodProperty
Method or attribute name: readonly label?: string;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: InputMethodProperty
Method or attribute name: readonly icon?: string;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: InputMethodProperty
Method or attribute name: readonly iconId?: number;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethod
Class name: InputMethodProperty
Method or attribute name: extra: object;|@ohos.inputMethod.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: inputMethodEngine|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: inputMethodEngine
Method or attribute name: const ENTER_KEY_TYPE_UNSPECIFIED: number;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: inputMethodEngine
Method or attribute name: const ENTER_KEY_TYPE_GO: number;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: inputMethodEngine
Method or attribute name: const ENTER_KEY_TYPE_SEARCH: number;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: inputMethodEngine
Method or attribute name: const ENTER_KEY_TYPE_SEND: number;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: inputMethodEngine
Method or attribute name: const ENTER_KEY_TYPE_NEXT: number;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: inputMethodEngine
Method or attribute name: const ENTER_KEY_TYPE_DONE: number;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: inputMethodEngine
Method or attribute name: const ENTER_KEY_TYPE_PREVIOUS: number;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: inputMethodEngine
Method or attribute name: const PATTERN_NULL: number;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: inputMethodEngine
Method or attribute name: const PATTERN_TEXT: number;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: inputMethodEngine
Method or attribute name: const PATTERN_NUMBER: number;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: inputMethodEngine
Method or attribute name: const PATTERN_PHONE: number;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: inputMethodEngine
Method or attribute name: const PATTERN_DATETIME: number;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: inputMethodEngine
Method or attribute name: const PATTERN_EMAIL: number;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: inputMethodEngine
Method or attribute name: const PATTERN_URI: number;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: inputMethodEngine
Method or attribute name: const PATTERN_PASSWORD: number;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: inputMethodEngine
Method or attribute name: const FLAG_SELECTING: number;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: inputMethodEngine
Method or attribute name: const FLAG_SINGLE_LINE: number;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: inputMethodEngine
Method or attribute name: const DISPLAY_MODE_PART: number;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: inputMethodEngine
Method or attribute name: const DISPLAY_MODE_FULL: number;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: inputMethodEngine
Method or attribute name: const OPTION_ASCII: number;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: inputMethodEngine
Method or attribute name: const OPTION_NONE: number;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: inputMethodEngine
Method or attribute name: const OPTION_AUTO_CAP_CHARACTERS: number;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: inputMethodEngine
Method or attribute name: const OPTION_AUTO_CAP_SENTENCES: number;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: inputMethodEngine
Method or attribute name: const OPTION_AUTO_WORDS: number;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: inputMethodEngine
Method or attribute name: const OPTION_MULTI_LINE: number;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: inputMethodEngine
Method or attribute name: const OPTION_NO_FULLSCREEN: number;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: inputMethodEngine
Method or attribute name: const CURSOR_UP: number;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: inputMethodEngine
Method or attribute name: const CURSOR_DOWN: number;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: inputMethodEngine
Method or attribute name: const CURSOR_LEFT: number;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: inputMethodEngine
Method or attribute name: const CURSOR_RIGHT: number;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: inputMethodEngine
Method or attribute name: const WINDOW_TYPE_INPUT_METHOD_FLOAT: number;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: inputMethodEngine
Method or attribute name: function getInputMethodAbility(): InputMethodAbility;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: inputMethodEngine
Method or attribute name: function getInputMethodEngine(): InputMethodEngine;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: inputMethodEngine
Method or attribute name: function getKeyboardDelegate(): KeyboardDelegate;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: inputMethodEngine
Method or attribute name: function createKeyboardDelegate(): KeyboardDelegate;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: KeyboardController|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: KeyboardController
Method or attribute name: hide(callback: AsyncCallback): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: KeyboardController
Method or attribute name: hide(): Promise;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: KeyboardController
Method or attribute name: hideKeyboard(callback: AsyncCallback): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: KeyboardController
Method or attribute name: hideKeyboard(): Promise;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: InputMethodEngine|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: InputMethodEngine
Method or attribute name: on(type: 'inputStart', callback: (kbController: KeyboardController, textInputClient: TextInputClient) => void): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: InputMethodEngine
Method or attribute name: off(type: 'inputStart', callback?: (kbController: KeyboardController, textInputClient: TextInputClient) => void): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: InputMethodEngine
Method or attribute name: on(type: 'keyboardShow'\|'keyboardHide', callback: () => void): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: InputMethodEngine
Method or attribute name: on(type: 'keyboardShow'\|'keyboardHide', callback: () => void): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: InputMethodEngine
Method or attribute name: off(type: 'keyboardShow'\|'keyboardHide', callback?: () => void): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: InputMethodEngine
Method or attribute name: off(type: 'keyboardShow'\|'keyboardHide', callback?: () => void): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: InputMethodAbility|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: InputMethodAbility
Method or attribute name: on(type: 'inputStart', callback: (kbController: KeyboardController, inputClient: InputClient) => void): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: InputMethodAbility
Method or attribute name: off(type: 'inputStart', callback?: (kbController: KeyboardController, inputClient: InputClient) => void): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: InputMethodAbility
Method or attribute name: on(type: 'inputStop', callback: () => void): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: InputMethodAbility
Method or attribute name: off(type: 'inputStop', callback: () => void): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: InputMethodAbility
Method or attribute name: on(type: 'setCallingWindow', callback: (wid:number) => void): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: InputMethodAbility
Method or attribute name: off(type: 'setCallingWindow', callback: (wid:number) => void): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: InputMethodAbility
Method or attribute name: on(type: 'keyboardShow'\|'keyboardHide', callback: () => void): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: InputMethodAbility
Method or attribute name: on(type: 'keyboardShow'\|'keyboardHide', callback: () => void): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: InputMethodAbility
Method or attribute name: off(type: 'keyboardShow'\|'keyboardHide', callback?: () => void): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: InputMethodAbility
Method or attribute name: off(type: 'keyboardShow'\|'keyboardHide', callback?: () => void): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: InputMethodAbility
Method or attribute name: on(type: 'setSubtype', callback: (inputMethodSubtype: InputMethodSubtype) => void): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: InputMethodAbility
Method or attribute name: off(type: 'setSubtype', callback?: (inputMethodSubtype: InputMethodSubtype) => void): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: TextInputClient|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: TextInputClient
Method or attribute name: sendKeyFunction(action: number, callback: AsyncCallback): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: TextInputClient
Method or attribute name: sendKeyFunction(action: number): Promise;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: TextInputClient
Method or attribute name: deleteForward(length: number, callback: AsyncCallback): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: TextInputClient
Method or attribute name: deleteForward(length: number): Promise;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: TextInputClient
Method or attribute name: deleteBackward(length: number, callback: AsyncCallback): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: TextInputClient
Method or attribute name: deleteBackward(length: number): Promise;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: TextInputClient
Method or attribute name: insertText(text: string, callback: AsyncCallback): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: TextInputClient
Method or attribute name: insertText(text: string): Promise;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: TextInputClient
Method or attribute name: getForward(length: number, callback: AsyncCallback): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: TextInputClient
Method or attribute name: getForward(length: number): Promise;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: TextInputClient
Method or attribute name: getBackward(length: number, callback: AsyncCallback): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: TextInputClient
Method or attribute name: getBackward(length: number): Promise;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: TextInputClient
Method or attribute name: getEditorAttribute(callback: AsyncCallback): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: TextInputClient
Method or attribute name: getEditorAttribute(): Promise;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: InputClient|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: InputClient
Method or attribute name: sendKeyFunction(action: number, callback: AsyncCallback): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: InputClient
Method or attribute name: sendKeyFunction(action: number): Promise;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: InputClient
Method or attribute name: deleteForward(length: number, callback: AsyncCallback): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: InputClient
Method or attribute name: deleteForward(length: number): Promise;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: InputClient
Method or attribute name: deleteBackward(length: number, callback: AsyncCallback): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: InputClient
Method or attribute name: deleteBackward(length: number): Promise;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: InputClient
Method or attribute name: insertText(text: string, callback: AsyncCallback): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: InputClient
Method or attribute name: insertText(text: string): Promise;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: InputClient
Method or attribute name: getForward(length: number, callback: AsyncCallback): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: InputClient
Method or attribute name: getForward(length: number): Promise;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: InputClient
Method or attribute name: getBackward(length: number, callback: AsyncCallback): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: InputClient
Method or attribute name: getBackward(length: number): Promise;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: InputClient
Method or attribute name: getEditorAttribute(callback: AsyncCallback): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: InputClient
Method or attribute name: getEditorAttribute(): Promise;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: InputClient
Method or attribute name: moveCursor(direction: number, callback: AsyncCallback): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: InputClient
Method or attribute name: moveCursor(direction: number): Promise;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: KeyboardDelegate|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: KeyboardDelegate
Method or attribute name: on(type: 'keyDown'\|'keyUp', callback: (event: KeyEvent) => boolean): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: KeyboardDelegate
Method or attribute name: on(type: 'keyDown'\|'keyUp', callback: (event: KeyEvent) => boolean): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: KeyboardDelegate
Method or attribute name: off(type: 'keyDown'\|'keyUp', callback?: (event: KeyEvent) => boolean): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: KeyboardDelegate
Method or attribute name: off(type: 'keyDown'\|'keyUp', callback?: (event: KeyEvent) => boolean): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: KeyboardDelegate
Method or attribute name: on(type: 'cursorContextChange', callback: (x: number, y: number, height: number) => void): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: KeyboardDelegate
Method or attribute name: off(type: 'cursorContextChange', callback?: (x: number, y: number, height: number) => void): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: KeyboardDelegate
Method or attribute name: on(type: 'selectionChange', callback: (oldBegin: number, oldEnd: number, newBegin: number, newEnd: number) => void): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: KeyboardDelegate
Method or attribute name: off(type: 'selectionChange', callback?: (oldBegin: number, oldEnd: number, newBegin: number, newEnd: number) => void): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: KeyboardDelegate
Method or attribute name: on(type: 'textChange', callback: (text: string) => void): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: KeyboardDelegate
Method or attribute name: off(type: 'textChange', callback?: (text: string) => void): void;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: EditorAttribute|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: EditorAttribute
Method or attribute name: readonly inputPattern: number;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: EditorAttribute
Method or attribute name: readonly enterKeyType: number;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: KeyEvent|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: KeyEvent
Method or attribute name: readonly keyCode: number;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.inputMethodEngine
Class name: KeyEvent
Method or attribute name: readonly keyAction: number;|@ohos.inputMethodEngine.d.ts| +|Added|NA|Module name: ohos.InputMethodExtensionAbility
Class name: InputMethodExtensionAbility|@ohos.InputMethodExtensionAbility.d.ts| +|Added|NA|Module name: ohos.InputMethodExtensionAbility
Class name: InputMethodExtensionAbility
Method or attribute name: context: InputMethodExtensionContext;|@ohos.InputMethodExtensionAbility.d.ts| +|Added|NA|Module name: ohos.InputMethodExtensionAbility
Class name: InputMethodExtensionAbility
Method or attribute name: onCreate(want: Want): void;|@ohos.InputMethodExtensionAbility.d.ts| +|Added|NA|Module name: ohos.InputMethodExtensionAbility
Class name: InputMethodExtensionAbility
Method or attribute name: onDestroy(): void;|@ohos.InputMethodExtensionAbility.d.ts| +|Added|NA|Module name: ohos.InputMethodExtensionContext
Class name: InputMethodExtensionContext|@ohos.InputMethodExtensionContext.d.ts| +|Added|NA|Module name: ohos.InputMethodExtensionContext
Class name: InputMethodExtensionContext
Method or attribute name: destroy(callback: AsyncCallback): void;|@ohos.InputMethodExtensionContext.d.ts| +|Added|NA|Module name: ohos.InputMethodExtensionContext
Class name: InputMethodExtensionContext
Method or attribute name: destroy(): Promise;|@ohos.InputMethodExtensionContext.d.ts| +|Added|NA|Module name: ohos.InputMethodSubtype
Class name: InputMethodSubtype|@ohos.InputMethodSubtype.d.ts| +|Added|NA|Module name: ohos.InputMethodSubtype
Class name: InputMethodSubtype
Method or attribute name: readonly label?: string;|@ohos.InputMethodSubtype.d.ts| +|Added|NA|Module name: ohos.InputMethodSubtype
Class name: InputMethodSubtype
Method or attribute name: readonly name: string;|@ohos.InputMethodSubtype.d.ts| +|Added|NA|Module name: ohos.InputMethodSubtype
Class name: InputMethodSubtype
Method or attribute name: readonly id: string;|@ohos.InputMethodSubtype.d.ts| +|Added|NA|Module name: ohos.InputMethodSubtype
Class name: InputMethodSubtype
Method or attribute name: readonly mode?: 'upper'\|'lower';|@ohos.InputMethodSubtype.d.ts| +|Added|NA|Module name: ohos.InputMethodSubtype
Class name: InputMethodSubtype
Method or attribute name: readonly locale: string;|@ohos.InputMethodSubtype.d.ts| +|Added|NA|Module name: ohos.InputMethodSubtype
Class name: InputMethodSubtype
Method or attribute name: readonly language: string;|@ohos.InputMethodSubtype.d.ts| +|Added|NA|Module name: ohos.InputMethodSubtype
Class name: InputMethodSubtype
Method or attribute name: readonly icon?: string;|@ohos.InputMethodSubtype.d.ts| +|Added|NA|Module name: ohos.InputMethodSubtype
Class name: InputMethodSubtype
Method or attribute name: readonly iconId?: number;|@ohos.InputMethodSubtype.d.ts| +|Added|NA|Module name: ohos.InputMethodSubtype
Class name: InputMethodSubtype
Method or attribute name: extra: object;|@ohos.InputMethodSubtype.d.ts| +|Added|NA|Module name: ohos.request
Class name: request
Method or attribute name: const PAUSED_BY_USER: number;|@ohos.request.d.ts| +|Added|NA|Class name: request
Method or attribute name: const PAUSED_BY_USER: number;|@ohos.request.d.ts| +|Added|NA|Module name: ohos.systemDateTime
Class name: systemDateTime|@ohos.systemDateTime.d.ts| +|Added|NA|Module name: ohos.systemDateTime
Class name: systemDateTime
Method or attribute name: function setTime(time : number, callback : AsyncCallback) : void;|@ohos.systemDateTime.d.ts| +|Added|NA|Module name: ohos.systemDateTime
Class name: systemDateTime
Method or attribute name: function setTime(time : number) : Promise;|@ohos.systemDateTime.d.ts| +|Added|NA|Module name: ohos.systemDateTime
Class name: systemDateTime
Method or attribute name: function getCurrentTime(isNano: boolean, callback: AsyncCallback): void;|@ohos.systemDateTime.d.ts| +|Added|NA|Module name: ohos.systemDateTime
Class name: systemDateTime
Method or attribute name: function getCurrentTime(callback: AsyncCallback): void;|@ohos.systemDateTime.d.ts| +|Added|NA|Module name: ohos.systemDateTime
Class name: systemDateTime
Method or attribute name: function getCurrentTime(isNano?: boolean): Promise;|@ohos.systemDateTime.d.ts| +|Added|NA|Module name: ohos.systemDateTime
Class name: systemDateTime
Method or attribute name: function getRealActiveTime(isNano: boolean, callback: AsyncCallback): void;|@ohos.systemDateTime.d.ts| +|Added|NA|Module name: ohos.systemDateTime
Class name: systemDateTime
Method or attribute name: function getRealActiveTime(callback: AsyncCallback): void;|@ohos.systemDateTime.d.ts| +|Added|NA|Module name: ohos.systemDateTime
Class name: systemDateTime
Method or attribute name: function getRealActiveTime(isNano?: boolean): Promise;|@ohos.systemDateTime.d.ts| +|Added|NA|Module name: ohos.systemDateTime
Class name: systemDateTime
Method or attribute name: function getRealTime(isNano: boolean, callback: AsyncCallback): void;|@ohos.systemDateTime.d.ts| +|Added|NA|Module name: ohos.systemDateTime
Class name: systemDateTime
Method or attribute name: function getRealTime(callback: AsyncCallback): void;|@ohos.systemDateTime.d.ts| +|Added|NA|Module name: ohos.systemDateTime
Class name: systemDateTime
Method or attribute name: function getRealTime(isNano?: boolean): Promise;|@ohos.systemDateTime.d.ts| +|Added|NA|Module name: ohos.systemDateTime
Class name: systemDateTime
Method or attribute name: function setDate(date: Date, callback: AsyncCallback): void;|@ohos.systemDateTime.d.ts| +|Added|NA|Module name: ohos.systemDateTime
Class name: systemDateTime
Method or attribute name: function setDate(date: Date): Promise;|@ohos.systemDateTime.d.ts| +|Added|NA|Module name: ohos.systemDateTime
Class name: systemDateTime
Method or attribute name: function getDate(callback: AsyncCallback): void;|@ohos.systemDateTime.d.ts| +|Added|NA|Module name: ohos.systemDateTime
Class name: systemDateTime
Method or attribute name: function getDate(): Promise;|@ohos.systemDateTime.d.ts| +|Added|NA|Module name: ohos.systemDateTime
Class name: systemDateTime
Method or attribute name: function setTimezone(timezone: string, callback: AsyncCallback): void;|@ohos.systemDateTime.d.ts| +|Added|NA|Module name: ohos.systemDateTime
Class name: systemDateTime
Method or attribute name: function setTimezone(timezone: string): Promise;|@ohos.systemDateTime.d.ts| +|Added|NA|Module name: ohos.systemDateTime
Class name: systemDateTime
Method or attribute name: function getTimezone(callback: AsyncCallback): void;|@ohos.systemDateTime.d.ts| +|Added|NA|Module name: ohos.systemDateTime
Class name: systemDateTime
Method or attribute name: function getTimezone(): Promise;|@ohos.systemDateTime.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: inputMethod|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: inputMethod
Method or attribute name: const MAX_TYPE_NUM: number|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: inputMethod
Method or attribute name: function getInputMethodSetting(): InputMethodSetting;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: inputMethod
Method or attribute name: function getInputMethodController(): InputMethodController;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: inputMethod
Method or attribute name: function getSetting(): InputMethodSetting;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: inputMethod
Method or attribute name: function getController(): InputMethodController;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: inputMethod
Method or attribute name: function switchInputMethod(target: InputMethodProperty, callback: AsyncCallback): void;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: inputMethod
Method or attribute name: function switchInputMethod(target: InputMethodProperty): Promise;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: inputMethod
Method or attribute name: function getCurrentInputMethod(): InputMethodProperty;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: inputMethod
Method or attribute name: function switchCurrentInputMethodSubtype(target: InputMethodSubtype, callback: AsyncCallback): void;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: inputMethod
Method or attribute name: function switchCurrentInputMethodSubtype(target: InputMethodSubtype): Promise;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: inputMethod
Method or attribute name: function getCurrentInputMethodSubtype(): InputMethodSubtype;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: inputMethod
Method or attribute name: function switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype, callback: AsyncCallback): void;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: inputMethod
Method or attribute name: function switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype): Promise;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: InputMethodSetting|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: InputMethodSetting
Method or attribute name: on(type: 'imeChange', callback: (inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype) => void): void;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: InputMethodSetting
Method or attribute name: off(type: 'imeChange', callback?: (inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype) => void): void;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: InputMethodSetting
Method or attribute name: listInputMethodSubtype(inputMethodProperty: InputMethodProperty, callback: AsyncCallback>): void;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: InputMethodSetting
Method or attribute name: listInputMethodSubtype(inputMethodProperty: InputMethodProperty): Promise>;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: InputMethodSetting
Method or attribute name: listCurrentInputMethodSubtype(callback: AsyncCallback>): void;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: InputMethodSetting
Method or attribute name: listCurrentInputMethodSubtype(): Promise>;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: InputMethodSetting
Method or attribute name: getInputMethods(enable: boolean, callback: AsyncCallback>): void;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: InputMethodSetting
Method or attribute name: getInputMethods(enable: boolean): Promise>;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: InputMethodSetting
Method or attribute name: listInputMethod(callback: AsyncCallback>): void;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: InputMethodSetting
Method or attribute name: listInputMethod(): Promise>;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: InputMethodSetting
Method or attribute name: showOptionalInputMethods(callback: AsyncCallback): void;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: InputMethodSetting
Method or attribute name: showOptionalInputMethods(): Promise;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: InputMethodSetting
Method or attribute name: displayOptionalInputMethod(callback: AsyncCallback): void;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: InputMethodSetting
Method or attribute name: displayOptionalInputMethod(): Promise;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: InputMethodController|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: InputMethodController
Method or attribute name: stopInputSession(callback: AsyncCallback): void;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: InputMethodController
Method or attribute name: stopInputSession(): Promise;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: InputMethodController
Method or attribute name: stopInput(callback: AsyncCallback): void;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: InputMethodController
Method or attribute name: stopInput(): Promise;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: InputMethodController
Method or attribute name: showSoftKeyboard(callback: AsyncCallback): void;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: InputMethodController
Method or attribute name: showSoftKeyboard():Promise;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: InputMethodController
Method or attribute name: hideSoftKeyboard(callback: AsyncCallback): void;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: InputMethodController
Method or attribute name: hideSoftKeyboard():Promise;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: InputMethodProperty|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: InputMethodProperty
Method or attribute name: readonly packageName: string;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: InputMethodProperty
Method or attribute name: readonly methodId: string;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: InputMethodProperty
Method or attribute name: readonly name: string;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: InputMethodProperty
Method or attribute name: readonly id: string;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: InputMethodProperty
Method or attribute name: readonly label?: string;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: InputMethodProperty
Method or attribute name: readonly icon?: string;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: InputMethodProperty
Method or attribute name: readonly iconId?: number;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethod
Class name: InputMethodProperty
Method or attribute name: extra: object;|NA|@ohos.inputmethod.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: inputMethodEngine|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: inputMethodEngine
Method or attribute name: const ENTER_KEY_TYPE_UNSPECIFIED: number;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: inputMethodEngine
Method or attribute name: const ENTER_KEY_TYPE_GO: number;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: inputMethodEngine
Method or attribute name: const ENTER_KEY_TYPE_SEARCH: number;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: inputMethodEngine
Method or attribute name: const ENTER_KEY_TYPE_SEND: number;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: inputMethodEngine
Method or attribute name: const ENTER_KEY_TYPE_NEXT: number;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: inputMethodEngine
Method or attribute name: const ENTER_KEY_TYPE_DONE: number;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: inputMethodEngine
Method or attribute name: const ENTER_KEY_TYPE_PREVIOUS: number;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: inputMethodEngine
Method or attribute name: const PATTERN_NULL: number;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: inputMethodEngine
Method or attribute name: const PATTERN_TEXT: number;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: inputMethodEngine
Method or attribute name: const PATTERN_NUMBER: number;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: inputMethodEngine
Method or attribute name: const PATTERN_PHONE: number;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: inputMethodEngine
Method or attribute name: const PATTERN_DATETIME: number;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: inputMethodEngine
Method or attribute name: const PATTERN_EMAIL: number;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: inputMethodEngine
Method or attribute name: const PATTERN_URI: number;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: inputMethodEngine
Method or attribute name: const PATTERN_PASSWORD: number;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: inputMethodEngine
Method or attribute name: const FLAG_SELECTING: number;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: inputMethodEngine
Method or attribute name: const FLAG_SINGLE_LINE: number;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: inputMethodEngine
Method or attribute name: const DISPLAY_MODE_PART: number;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: inputMethodEngine
Method or attribute name: const DISPLAY_MODE_FULL: number;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: inputMethodEngine
Method or attribute name: const OPTION_ASCII: number;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: inputMethodEngine
Method or attribute name: const OPTION_NONE: number;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: inputMethodEngine
Method or attribute name: const OPTION_AUTO_CAP_CHARACTERS: number;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: inputMethodEngine
Method or attribute name: const OPTION_AUTO_CAP_SENTENCES: number;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: inputMethodEngine
Method or attribute name: const OPTION_AUTO_WORDS: number;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: inputMethodEngine
Method or attribute name: const OPTION_MULTI_LINE: number;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: inputMethodEngine
Method or attribute name: const OPTION_NO_FULLSCREEN: number;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: inputMethodEngine
Method or attribute name: const CURSOR_UP: number;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: inputMethodEngine
Method or attribute name: const CURSOR_DOWN: number;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: inputMethodEngine
Method or attribute name: const CURSOR_LEFT: number;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: inputMethodEngine
Method or attribute name: const CURSOR_RIGHT: number;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: inputMethodEngine
Method or attribute name: const WINDOW_TYPE_INPUT_METHOD_FLOAT: number;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: inputMethodEngine
Method or attribute name: function getInputMethodAbility(): InputMethodAbility;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: inputMethodEngine
Method or attribute name: function getInputMethodEngine(): InputMethodEngine;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: inputMethodEngine
Method or attribute name: function getKeyboardDelegate(): KeyboardDelegate;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: inputMethodEngine
Method or attribute name: function createKeyboardDelegate(): KeyboardDelegate;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: KeyboardController|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: KeyboardController
Method or attribute name: hide(callback: AsyncCallback): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: KeyboardController
Method or attribute name: hide(): Promise;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: KeyboardController
Method or attribute name: hideKeyboard(callback: AsyncCallback): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: KeyboardController
Method or attribute name: hideKeyboard(): Promise;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: InputMethodEngine|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: InputMethodEngine
Method or attribute name: on(type: 'inputStart', callback: (kbController: KeyboardController, textInputClient: TextInputClient) => void): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: InputMethodEngine
Method or attribute name: off(type: 'inputStart', callback?: (kbController: KeyboardController, textInputClient: TextInputClient) => void): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: InputMethodEngine
Method or attribute name: on(type: 'keyboardShow'\|'keyboardHide', callback: () => void): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: InputMethodEngine
Method or attribute name: on(type: 'keyboardShow'\|'keyboardHide', callback: () => void): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: InputMethodEngine
Method or attribute name: off(type: 'keyboardShow'\|'keyboardHide', callback?: () => void): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: InputMethodEngine
Method or attribute name: off(type: 'keyboardShow'\|'keyboardHide', callback?: () => void): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: InputMethodAbility|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: InputMethodAbility
Method or attribute name: on(type: 'inputStart', callback: (kbController: KeyboardController, inputClient: InputClient) => void): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: InputMethodAbility
Method or attribute name: off(type: 'inputStart', callback?: (kbController: KeyboardController, inputClient: InputClient) => void): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: InputMethodAbility
Method or attribute name: on(type: 'inputStop', callback: () => void): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: InputMethodAbility
Method or attribute name: off(type: 'inputStop', callback: () => void): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: InputMethodAbility
Method or attribute name: on(type: 'setCallingWindow', callback: (wid:number) => void): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: InputMethodAbility
Method or attribute name: off(type: 'setCallingWindow', callback: (wid:number) => void): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: InputMethodAbility
Method or attribute name: on(type: 'keyboardShow'\|'keyboardHide', callback: () => void): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: InputMethodAbility
Method or attribute name: on(type: 'keyboardShow'\|'keyboardHide', callback: () => void): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: InputMethodAbility
Method or attribute name: off(type: 'keyboardShow'\|'keyboardHide', callback?: () => void): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: InputMethodAbility
Method or attribute name: off(type: 'keyboardShow'\|'keyboardHide', callback?: () => void): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: InputMethodAbility
Method or attribute name: on(type: 'setSubtype', callback: (inputMethodSubtype: InputMethodSubtype) => void): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: InputMethodAbility
Method or attribute name: off(type: 'setSubtype', callback?: (inputMethodSubtype: InputMethodSubtype) => void): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: TextInputClient|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: TextInputClient
Method or attribute name: sendKeyFunction(action: number, callback: AsyncCallback): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: TextInputClient
Method or attribute name: sendKeyFunction(action: number): Promise;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: TextInputClient
Method or attribute name: deleteForward(length: number, callback: AsyncCallback): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: TextInputClient
Method or attribute name: deleteForward(length: number): Promise;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: TextInputClient
Method or attribute name: deleteBackward(length: number, callback: AsyncCallback): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: TextInputClient
Method or attribute name: deleteBackward(length: number): Promise;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: TextInputClient
Method or attribute name: insertText(text: string, callback: AsyncCallback): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: TextInputClient
Method or attribute name: insertText(text: string): Promise;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: TextInputClient
Method or attribute name: getForward(length: number, callback: AsyncCallback): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: TextInputClient
Method or attribute name: getForward(length: number): Promise;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: TextInputClient
Method or attribute name: getBackward(length: number, callback: AsyncCallback): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: TextInputClient
Method or attribute name: getBackward(length: number): Promise;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: TextInputClient
Method or attribute name: getEditorAttribute(callback: AsyncCallback): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: TextInputClient
Method or attribute name: getEditorAttribute(): Promise;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: InputClient|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: InputClient
Method or attribute name: sendKeyFunction(action: number, callback: AsyncCallback): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: InputClient
Method or attribute name: sendKeyFunction(action: number): Promise;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: InputClient
Method or attribute name: deleteForward(length: number, callback: AsyncCallback): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: InputClient
Method or attribute name: deleteForward(length: number): Promise;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: InputClient
Method or attribute name: deleteBackward(length: number, callback: AsyncCallback): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: InputClient
Method or attribute name: deleteBackward(length: number): Promise;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: InputClient
Method or attribute name: insertText(text: string, callback: AsyncCallback): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: InputClient
Method or attribute name: insertText(text: string): Promise;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: InputClient
Method or attribute name: getForward(length: number, callback: AsyncCallback): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: InputClient
Method or attribute name: getForward(length: number): Promise;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: InputClient
Method or attribute name: getBackward(length: number, callback: AsyncCallback): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: InputClient
Method or attribute name: getBackward(length: number): Promise;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: InputClient
Method or attribute name: getEditorAttribute(callback: AsyncCallback): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: InputClient
Method or attribute name: getEditorAttribute(): Promise;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: InputClient
Method or attribute name: moveCursor(direction: number, callback: AsyncCallback): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: InputClient
Method or attribute name: moveCursor(direction: number): Promise;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: KeyboardDelegate|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: KeyboardDelegate
Method or attribute name: on(type: 'keyDown'\|'keyUp', callback: (event: KeyEvent) => boolean): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: KeyboardDelegate
Method or attribute name: on(type: 'keyDown'\|'keyUp', callback: (event: KeyEvent) => boolean): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: KeyboardDelegate
Method or attribute name: off(type: 'keyDown'\|'keyUp', callback?: (event: KeyEvent) => boolean): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: KeyboardDelegate
Method or attribute name: off(type: 'keyDown'\|'keyUp', callback?: (event: KeyEvent) => boolean): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: KeyboardDelegate
Method or attribute name: on(type: 'cursorContextChange', callback: (x: number, y: number, height: number) => void): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: KeyboardDelegate
Method or attribute name: off(type: 'cursorContextChange', callback?: (x: number, y: number, height: number) => void): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: KeyboardDelegate
Method or attribute name: on(type: 'selectionChange', callback: (oldBegin: number, oldEnd: number, newBegin: number, newEnd: number) => void): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: KeyboardDelegate
Method or attribute name: off(type: 'selectionChange', callback?: (oldBegin: number, oldEnd: number, newBegin: number, newEnd: number) => void): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: KeyboardDelegate
Method or attribute name: on(type: 'textChange', callback: (text: string) => void): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: KeyboardDelegate
Method or attribute name: off(type: 'textChange', callback?: (text: string) => void): void;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: EditorAttribute|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: EditorAttribute
Method or attribute name: readonly inputPattern: number;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: EditorAttribute
Method or attribute name: readonly enterKeyType: number;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: KeyEvent|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: KeyEvent
Method or attribute name: readonly keyCode: number;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodengine
Class name: KeyEvent
Method or attribute name: readonly keyAction: number;|NA|@ohos.inputmethodengine.d.ts| +|Deleted|Module name: ohos.inputmethodextensionability
Class name: InputMethodExtensionAbility|NA|@ohos.inputmethodextensionability.d.ts| +|Deleted|Module name: ohos.inputmethodextensionability
Class name: InputMethodExtensionAbility
Method or attribute name: context: InputMethodExtensionContext;|NA|@ohos.inputmethodextensionability.d.ts| +|Deleted|Module name: ohos.inputmethodextensionability
Class name: InputMethodExtensionAbility
Method or attribute name: onCreate(want: Want): void;|NA|@ohos.inputmethodextensionability.d.ts| +|Deleted|Module name: ohos.inputmethodextensionability
Class name: InputMethodExtensionAbility
Method or attribute name: onDestroy(): void;|NA|@ohos.inputmethodextensionability.d.ts| +|Deleted|Module name: ohos.inputmethodextensioncontext
Class name: InputMethodExtensionContext|NA|@ohos.inputmethodextensioncontext.d.ts| +|Deleted|Module name: ohos.inputmethodextensioncontext
Class name: InputMethodExtensionContext
Method or attribute name: destroy(callback: AsyncCallback): void;|NA|@ohos.inputmethodextensioncontext.d.ts| +|Deleted|Module name: ohos.inputmethodextensioncontext
Class name: InputMethodExtensionContext
Method or attribute name: destroy(): Promise;|NA|@ohos.inputmethodextensioncontext.d.ts| +|Deleted|Module name: ohos.inputMethodSubtype
Class name: InputMethodSubtype|NA|@ohos.inputMethodSubtype.d.ts| +|Deleted|Module name: ohos.inputMethodSubtype
Class name: InputMethodSubtype
Method or attribute name: readonly label?: string;|NA|@ohos.inputMethodSubtype.d.ts| +|Deleted|Module name: ohos.inputMethodSubtype
Class name: InputMethodSubtype
Method or attribute name: readonly name: string;|NA|@ohos.inputMethodSubtype.d.ts| +|Deleted|Module name: ohos.inputMethodSubtype
Class name: InputMethodSubtype
Method or attribute name: readonly id: string;|NA|@ohos.inputMethodSubtype.d.ts| +|Deleted|Module name: ohos.inputMethodSubtype
Class name: InputMethodSubtype
Method or attribute name: readonly mode?: 'upper'\|'lower';|NA|@ohos.inputMethodSubtype.d.ts| +|Deleted|Module name: ohos.inputMethodSubtype
Class name: InputMethodSubtype
Method or attribute name: readonly locale: string;|NA|@ohos.inputMethodSubtype.d.ts| +|Deleted|Module name: ohos.inputMethodSubtype
Class name: InputMethodSubtype
Method or attribute name: readonly language: string;|NA|@ohos.inputMethodSubtype.d.ts| +|Deleted|Module name: ohos.inputMethodSubtype
Class name: InputMethodSubtype
Method or attribute name: readonly icon?: string;|NA|@ohos.inputMethodSubtype.d.ts| +|Deleted|Module name: ohos.inputMethodSubtype
Class name: InputMethodSubtype
Method or attribute name: readonly iconId?: number;|NA|@ohos.inputMethodSubtype.d.ts| +|Deleted|Module name: ohos.inputMethodSubtype
Class name: InputMethodSubtype
Method or attribute name: extra: object;|NA|@ohos.inputMethodSubtype.d.ts| +|Access level changed|Class name: SystemEvent
Access level: public API|Class name: SystemEvent
Access level: system API|@ohos.screenLock.d.ts| +|Access level changed|Class name: systemTimer
Method or attribute name: const TIMER_TYPE_REALTIME: number;
Access level: public API|Class name: systemTimer
Method or attribute name: const TIMER_TYPE_REALTIME: number;
Access level: system API|@ohos.systemTimer.d.ts| +|Access level changed|Class name: systemTimer
Method or attribute name: const TIMER_TYPE_WAKEUP: number;
Access level: public API|Class name: systemTimer
Method or attribute name: const TIMER_TYPE_WAKEUP: number;
Access level: system API|@ohos.systemTimer.d.ts| +|Access level changed|Class name: systemTimer
Method or attribute name: const TIMER_TYPE_EXACT: number;
Access level: public API|Class name: systemTimer
Method or attribute name: const TIMER_TYPE_EXACT: number;
Access level: system API|@ohos.systemTimer.d.ts| +|Access level changed|Class name: systemTimer
Method or attribute name: const TIMER_TYPE_IDLE: number;
Access level: public API|Class name: systemTimer
Method or attribute name: const TIMER_TYPE_IDLE: number;
Access level: system API|@ohos.systemTimer.d.ts| +|Access level changed|Class name: systemTimer
Method or attribute name: function createTimer(options: TimerOptions, callback: AsyncCallback): void;
Access level: public API|Class name: systemTimer
Method or attribute name: function createTimer(options: TimerOptions, callback: AsyncCallback): void;
Access level: system API|@ohos.systemTimer.d.ts| +|Access level changed|Class name: systemTimer
Method or attribute name: function createTimer(options: TimerOptions): Promise;
Access level: public API|Class name: systemTimer
Method or attribute name: function createTimer(options: TimerOptions): Promise;
Access level: system API|@ohos.systemTimer.d.ts| +|Access level changed|Class name: systemTimer
Method or attribute name: function startTimer(timer: number, triggerTime: number, callback: AsyncCallback): void;
Access level: public API|Class name: systemTimer
Method or attribute name: function startTimer(timer: number, triggerTime: number, callback: AsyncCallback): void;
Access level: system API|@ohos.systemTimer.d.ts| +|Access level changed|Class name: systemTimer
Method or attribute name: function startTimer(timer: number, triggerTime: number): Promise;
Access level: public API|Class name: systemTimer
Method or attribute name: function startTimer(timer: number, triggerTime: number): Promise;
Access level: system API|@ohos.systemTimer.d.ts| +|Access level changed|Class name: systemTimer
Method or attribute name: function stopTimer(timer: number, callback: AsyncCallback): void;
Access level: public API|Class name: systemTimer
Method or attribute name: function stopTimer(timer: number, callback: AsyncCallback): void;
Access level: system API|@ohos.systemTimer.d.ts| +|Access level changed|Class name: systemTimer
Method or attribute name: function stopTimer(timer: number): Promise;
Access level: public API|Class name: systemTimer
Method or attribute name: function stopTimer(timer: number): Promise;
Access level: system API|@ohos.systemTimer.d.ts| +|Access level changed|Class name: systemTimer
Method or attribute name: function destroyTimer(timer: number, callback: AsyncCallback): void;
Access level: public API|Class name: systemTimer
Method or attribute name: function destroyTimer(timer: number, callback: AsyncCallback): void;
Access level: system API|@ohos.systemTimer.d.ts| +|Access level changed|Class name: systemTimer
Method or attribute name: function destroyTimer(timer: number): Promise;
Access level: public API|Class name: systemTimer
Method or attribute name: function destroyTimer(timer: number): Promise;
Access level: system API|@ohos.systemTimer.d.ts| +|Access level changed|Class name: TimerOptions
Access level: public API|Class name: TimerOptions
Access level: system API|@ohos.systemTimer.d.ts| +|Access level changed|Class name: TimerOptions
Method or attribute name: type: number;
Access level: public API|Class name: TimerOptions
Method or attribute name: type: number;
Access level: system API|@ohos.systemTimer.d.ts| +|Access level changed|Class name: TimerOptions
Method or attribute name: repeat: boolean;
Access level: public API|Class name: TimerOptions
Method or attribute name: repeat: boolean;
Access level: system API|@ohos.systemTimer.d.ts| +|Access level changed|Class name: TimerOptions
Method or attribute name: interval?: number;
Access level: public API|Class name: TimerOptions
Method or attribute name: interval?: number;
Access level: system API|@ohos.systemTimer.d.ts| +|Access level changed|Class name: TimerOptions
Method or attribute name: wantAgent?: WantAgent;
Access level: public API|Class name: TimerOptions
Method or attribute name: wantAgent?: WantAgent;
Access level: system API|@ohos.systemTimer.d.ts| +|Access level changed|Class name: TimerOptions
Method or attribute name: callback?: () => void;
Access level: public API|Class name: TimerOptions
Method or attribute name: callback?: () => void;
Access level: system API|@ohos.systemTimer.d.ts| +|Deprecated version changed|Class name: systemTime
Deprecated version: N/A|Class name: systemTime
Deprecated version: 9
Substitute API: ohos.systemDateTime |@ohos.systemTime.d.ts| +|Deprecated version changed|Class name: systemTime
Method or attribute name: function setTime(time : number, callback : AsyncCallback) : void;
Deprecated version: N/A|Class name: systemTime
Method or attribute name: function setTime(time : number, callback : AsyncCallback) : void;
Deprecated version: 9
Substitute API: N/A|@ohos.systemTime.d.ts| +|Deprecated version changed|Class name: systemTime
Method or attribute name: function setTime(time : number) : Promise;
Deprecated version: N/A|Class name: systemTime
Method or attribute name: function setTime(time : number) : Promise;
Deprecated version: 9|@ohos.systemTime.d.ts| +|Deprecated version changed|Class name: systemTime
Method or attribute name: function getCurrentTime(isNano: boolean, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: systemTime
Method or attribute name: function getCurrentTime(isNano: boolean, callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.systemDateTime/systemDateTime.getCurrentTime |@ohos.systemTime.d.ts| +|Deprecated version changed|Class name: systemTime
Method or attribute name: function getCurrentTime(callback: AsyncCallback): void;
Deprecated version: N/A|Class name: systemTime
Method or attribute name: function getCurrentTime(callback: AsyncCallback): void;
Deprecated version: 9|@ohos.systemTime.d.ts| +|Deprecated version changed|Class name: systemTime
Method or attribute name: function getCurrentTime(isNano?: boolean): Promise;
Deprecated version: N/A|Class name: systemTime
Method or attribute name: function getCurrentTime(isNano?: boolean): Promise;
Deprecated version: 9|@ohos.systemTime.d.ts| +|Deprecated version changed|Class name: systemTime
Method or attribute name: function getRealActiveTime(isNano: boolean, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: systemTime
Method or attribute name: function getRealActiveTime(isNano: boolean, callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.systemDateTime/systemDateTime.getRealActiveTime |@ohos.systemTime.d.ts| +|Deprecated version changed|Class name: systemTime
Method or attribute name: function getRealActiveTime(callback: AsyncCallback): void;
Deprecated version: N/A|Class name: systemTime
Method or attribute name: function getRealActiveTime(callback: AsyncCallback): void;
Deprecated version: 9|@ohos.systemTime.d.ts| +|Deprecated version changed|Class name: systemTime
Method or attribute name: function getRealActiveTime(isNano?: boolean): Promise;
Deprecated version: N/A|Class name: systemTime
Method or attribute name: function getRealActiveTime(isNano?: boolean): Promise;
Deprecated version: 9|@ohos.systemTime.d.ts| +|Deprecated version changed|Class name: systemTime
Method or attribute name: function getRealTime(isNano: boolean, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: systemTime
Method or attribute name: function getRealTime(isNano: boolean, callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.systemDateTime/systemDateTime.getRealTime |@ohos.systemTime.d.ts| +|Deprecated version changed|Class name: systemTime
Method or attribute name: function getRealTime(callback: AsyncCallback): void;
Deprecated version: N/A|Class name: systemTime
Method or attribute name: function getRealTime(callback: AsyncCallback): void;
Deprecated version: 9|@ohos.systemTime.d.ts| +|Deprecated version changed|Class name: systemTime
Method or attribute name: function getRealTime(isNano?: boolean): Promise;
Deprecated version: N/A|Class name: systemTime
Method or attribute name: function getRealTime(isNano?: boolean): Promise;
Deprecated version: 9|@ohos.systemTime.d.ts| +|Deprecated version changed|Class name: systemTime
Method or attribute name: function setDate(date: Date, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: systemTime
Method or attribute name: function setDate(date: Date, callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: N/A|@ohos.systemTime.d.ts| +|Deprecated version changed|Class name: systemTime
Method or attribute name: function setDate(date: Date): Promise;
Deprecated version: N/A|Class name: systemTime
Method or attribute name: function setDate(date: Date): Promise;
Deprecated version: 9|@ohos.systemTime.d.ts| +|Deprecated version changed|Class name: systemTime
Method or attribute name: function getDate(callback: AsyncCallback): void;
Deprecated version: N/A|Class name: systemTime
Method or attribute name: function getDate(callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.systemDateTime/systemDateTime.getDate |@ohos.systemTime.d.ts| +|Deprecated version changed|Class name: systemTime
Method or attribute name: function getDate(): Promise;
Deprecated version: N/A|Class name: systemTime
Method or attribute name: function getDate(): Promise;
Deprecated version: 9|@ohos.systemTime.d.ts| +|Deprecated version changed|Class name: systemTime
Method or attribute name: function setTimezone(timezone: string, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: systemTime
Method or attribute name: function setTimezone(timezone: string, callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: N/A|@ohos.systemTime.d.ts| +|Deprecated version changed|Class name: systemTime
Method or attribute name: function setTimezone(timezone: string): Promise;
Deprecated version: N/A|Class name: systemTime
Method or attribute name: function setTimezone(timezone: string): Promise;
Deprecated version: 9|@ohos.systemTime.d.ts| +|Deprecated version changed|Class name: systemTime
Method or attribute name: function getTimezone(callback: AsyncCallback): void;
Deprecated version: N/A|Class name: systemTime
Method or attribute name: function getTimezone(callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.systemDateTime/systemDateTime.getTimezone |@ohos.systemTime.d.ts| +|Deprecated version changed|Class name: systemTime
Method or attribute name: function getTimezone(): Promise;
Deprecated version: N/A|Class name: systemTime
Method or attribute name: function getTimezone(): Promise;
Deprecated version: 9|@ohos.systemTime.d.ts| +|Initial version changed|Class name: DownloadTask
Initial version: N/A|Class name: DownloadTask
Initial version: 6|@ohos.request.d.ts| +|Initial version changed|Class name: UploadTask
Initial version: N/A|Class name: UploadTask
Initial version: 6|@ohos.request.d.ts| +|Initial version changed|Class name: SystemEvent
Initial version: N/A|Class name: SystemEvent
Initial version: 9|@ohos.screenLock.d.ts| +|Initial version changed|Class name: systemTimer
Method or attribute name: const TIMER_TYPE_REALTIME: number;
Initial version: N/A|Class name: systemTimer
Method or attribute name: const TIMER_TYPE_REALTIME: number;
Initial version: 7|@ohos.systemTimer.d.ts| +|Initial version changed|Class name: systemTimer
Method or attribute name: const TIMER_TYPE_WAKEUP: number;
Initial version: N/A|Class name: systemTimer
Method or attribute name: const TIMER_TYPE_WAKEUP: number;
Initial version: 7|@ohos.systemTimer.d.ts| +|Initial version changed|Class name: systemTimer
Method or attribute name: const TIMER_TYPE_EXACT: number;
Initial version: N/A|Class name: systemTimer
Method or attribute name: const TIMER_TYPE_EXACT: number;
Initial version: 7|@ohos.systemTimer.d.ts| +|Initial version changed|Class name: systemTimer
Method or attribute name: const TIMER_TYPE_IDLE: number;
Initial version: N/A|Class name: systemTimer
Method or attribute name: const TIMER_TYPE_IDLE: number;
Initial version: 7|@ohos.systemTimer.d.ts| +|Initial version changed|Class name: systemTimer
Method or attribute name: function createTimer(options: TimerOptions, callback: AsyncCallback): void;
Initial version: N/A|Class name: systemTimer
Method or attribute name: function createTimer(options: TimerOptions, callback: AsyncCallback): void;
Initial version: 7|@ohos.systemTimer.d.ts| +|Initial version changed|Class name: systemTimer
Method or attribute name: function createTimer(options: TimerOptions): Promise;
Initial version: N/A|Class name: systemTimer
Method or attribute name: function createTimer(options: TimerOptions): Promise;
Initial version: 7|@ohos.systemTimer.d.ts| +|Initial version changed|Class name: systemTimer
Method or attribute name: function startTimer(timer: number, triggerTime: number, callback: AsyncCallback): void;
Initial version: N/A|Class name: systemTimer
Method or attribute name: function startTimer(timer: number, triggerTime: number, callback: AsyncCallback): void;
Initial version: 7|@ohos.systemTimer.d.ts| +|Initial version changed|Class name: systemTimer
Method or attribute name: function startTimer(timer: number, triggerTime: number): Promise;
Initial version: N/A|Class name: systemTimer
Method or attribute name: function startTimer(timer: number, triggerTime: number): Promise;
Initial version: 7|@ohos.systemTimer.d.ts| +|Initial version changed|Class name: systemTimer
Method or attribute name: function stopTimer(timer: number, callback: AsyncCallback): void;
Initial version: N/A|Class name: systemTimer
Method or attribute name: function stopTimer(timer: number, callback: AsyncCallback): void;
Initial version: 7|@ohos.systemTimer.d.ts| +|Initial version changed|Class name: systemTimer
Method or attribute name: function stopTimer(timer: number): Promise;
Initial version: N/A|Class name: systemTimer
Method or attribute name: function stopTimer(timer: number): Promise;
Initial version: 7|@ohos.systemTimer.d.ts| +|Initial version changed|Class name: systemTimer
Method or attribute name: function destroyTimer(timer: number, callback: AsyncCallback): void;
Initial version: N/A|Class name: systemTimer
Method or attribute name: function destroyTimer(timer: number, callback: AsyncCallback): void;
Initial version: 7|@ohos.systemTimer.d.ts| +|Initial version changed|Class name: systemTimer
Method or attribute name: function destroyTimer(timer: number): Promise;
Initial version: N/A|Class name: systemTimer
Method or attribute name: function destroyTimer(timer: number): Promise;
Initial version: 7|@ohos.systemTimer.d.ts| +|Initial version changed|Class name: TimerOptions
Initial version: N/A|Class name: TimerOptions
Initial version: 7|@ohos.systemTimer.d.ts| +|Initial version changed|Class name: TimerOptions
Method or attribute name: type: number;
Initial version: N/A|Class name: TimerOptions
Method or attribute name: type: number;
Initial version: 7|@ohos.systemTimer.d.ts| +|Initial version changed|Class name: TimerOptions
Method or attribute name: repeat: boolean;
Initial version: N/A|Class name: TimerOptions
Method or attribute name: repeat: boolean;
Initial version: 7|@ohos.systemTimer.d.ts| +|Initial version changed|Class name: TimerOptions
Method or attribute name: interval?: number;
Initial version: N/A|Class name: TimerOptions
Method or attribute name: interval?: number;
Initial version: 7|@ohos.systemTimer.d.ts| +|Initial version changed|Class name: TimerOptions
Method or attribute name: wantAgent?: WantAgent;
Initial version: N/A|Class name: TimerOptions
Method or attribute name: wantAgent?: WantAgent;
Initial version: 7|@ohos.systemTimer.d.ts| +|Initial version changed|Class name: TimerOptions
Method or attribute name: callback?: () => void;
Initial version: N/A|Class name: TimerOptions
Method or attribute name: callback?: () => void;
Initial version: 7|@ohos.systemTimer.d.ts| +|Error code added|NA|Class name: DownloadTask
Method or attribute name: delete(): Promise;
Error code: N/A|@ohos.request.d.ts| +|Error code added|NA|Class name: systemTimer
Method or attribute name: function createTimer(options: TimerOptions): Promise;
Error code: 202,401|@ohos.systemTimer.d.ts| +|Error code added|NA|Class name: systemTimer
Method or attribute name: function startTimer(timer: number, triggerTime: number): Promise;
Error code: 202,401|@ohos.systemTimer.d.ts| +|Error code added|NA|Class name: systemTimer
Method or attribute name: function stopTimer(timer: number): Promise;
Error code: 202,401|@ohos.systemTimer.d.ts| +|Error code added|NA|Class name: systemTimer
Method or attribute name: function destroyTimer(timer: number): Promise;
Error code: 202,401|@ohos.systemTimer.d.ts| +|Permission added|Class name: DownloadTask
Permission: N/A|Class name: DownloadTask
Permission: ohos.permission.INTERNET|@ohos.request.d.ts| +|Permission added|Class name: UploadTask
Permission: N/A|Class name: UploadTask
Permission: ohos.permission.INTERNET|@ohos.request.d.ts| +|Access level changed|Class name: SystemEvent
Access level: public API|Class name: SystemEvent
Access level: system API|@ohos.screenLock.d.ts| +|Access level changed|Class name: systemTimer
Method or attribute name: const TIMER_TYPE_REALTIME: number;
Access level: public API|Class name: systemTimer
Method or attribute name: const TIMER_TYPE_REALTIME: number;
Access level: system API|@ohos.systemTimer.d.ts| +|Access level changed|Class name: systemTimer
Method or attribute name: const TIMER_TYPE_WAKEUP: number;
Access level: public API|Class name: systemTimer
Method or attribute name: const TIMER_TYPE_WAKEUP: number;
Access level: system API|@ohos.systemTimer.d.ts| +|Access level changed|Class name: systemTimer
Method or attribute name: const TIMER_TYPE_EXACT: number;
Access level: public API|Class name: systemTimer
Method or attribute name: const TIMER_TYPE_EXACT: number;
Access level: system API|@ohos.systemTimer.d.ts| +|Access level changed|Class name: systemTimer
Method or attribute name: const TIMER_TYPE_IDLE: number;
Access level: public API|Class name: systemTimer
Method or attribute name: const TIMER_TYPE_IDLE: number;
Access level: system API|@ohos.systemTimer.d.ts| +|Access level changed|Class name: systemTimer
Method or attribute name: function createTimer(options: TimerOptions, callback: AsyncCallback): void;
Access level: public API|Class name: systemTimer
Method or attribute name: function createTimer(options: TimerOptions, callback: AsyncCallback): void;
Access level: system API|@ohos.systemTimer.d.ts| +|Access level changed|Class name: systemTimer
Method or attribute name: function createTimer(options: TimerOptions): Promise;
Access level: public API|Class name: systemTimer
Method or attribute name: function createTimer(options: TimerOptions): Promise;
Access level: system API|@ohos.systemTimer.d.ts| +|Access level changed|Class name: systemTimer
Method or attribute name: function startTimer(timer: number, triggerTime: number, callback: AsyncCallback): void;
Access level: public API|Class name: systemTimer
Method or attribute name: function startTimer(timer: number, triggerTime: number, callback: AsyncCallback): void;
Access level: system API|@ohos.systemTimer.d.ts| +|Access level changed|Class name: systemTimer
Method or attribute name: function startTimer(timer: number, triggerTime: number): Promise;
Access level: public API|Class name: systemTimer
Method or attribute name: function startTimer(timer: number, triggerTime: number): Promise;
Access level: system API|@ohos.systemTimer.d.ts| +|Access level changed|Class name: systemTimer
Method or attribute name: function stopTimer(timer: number, callback: AsyncCallback): void;
Access level: public API|Class name: systemTimer
Method or attribute name: function stopTimer(timer: number, callback: AsyncCallback): void;
Access level: system API|@ohos.systemTimer.d.ts| +|Access level changed|Class name: systemTimer
Method or attribute name: function stopTimer(timer: number): Promise;
Access level: public API|Class name: systemTimer
Method or attribute name: function stopTimer(timer: number): Promise;
Access level: system API|@ohos.systemTimer.d.ts| +|Access level changed|Class name: systemTimer
Method or attribute name: function destroyTimer(timer: number, callback: AsyncCallback): void;
Access level: public API|Class name: systemTimer
Method or attribute name: function destroyTimer(timer: number, callback: AsyncCallback): void;
Access level: system API|@ohos.systemTimer.d.ts| +|Access level changed|Class name: systemTimer
Method or attribute name: function destroyTimer(timer: number): Promise;
Access level: public API|Class name: systemTimer
Method or attribute name: function destroyTimer(timer: number): Promise;
Access level: system API|@ohos.systemTimer.d.ts| +|Access level changed|Class name: TimerOptions
Access level: public API|Class name: TimerOptions
Access level: system API|@ohos.systemTimer.d.ts| +|Access level changed|Class name: TimerOptions
Method or attribute name: type: number;
Access level: public API|Class name: TimerOptions
Method or attribute name: type: number;
Access level: system API|@ohos.systemTimer.d.ts| +|Access level changed|Class name: TimerOptions
Method or attribute name: repeat: boolean;
Access level: public API|Class name: TimerOptions
Method or attribute name: repeat: boolean;
Access level: system API|@ohos.systemTimer.d.ts| +|Access level changed|Class name: TimerOptions
Method or attribute name: interval?: number;
Access level: public API|Class name: TimerOptions
Method or attribute name: interval?: number;
Access level: system API|@ohos.systemTimer.d.ts| +|Access level changed|Class name: TimerOptions
Method or attribute name: wantAgent?: WantAgent;
Access level: public API|Class name: TimerOptions
Method or attribute name: wantAgent?: WantAgent;
Access level: system API|@ohos.systemTimer.d.ts| +|Access level changed|Class name: TimerOptions
Method or attribute name: callback?: () => void;
Access level: public API|Class name: TimerOptions
Method or attribute name: callback?: () => void;
Access level: system API|@ohos.systemTimer.d.ts| diff --git a/en/release-notes/api-change/v3.2-beta5/js-apidiff-multimedia.md b/en/release-notes/api-change/v3.2-beta5/js-apidiff-multimedia.md new file mode 100644 index 0000000000000000000000000000000000000000..501855f19540b7aa9e91b9e345df0b1419f753fa --- /dev/null +++ b/en/release-notes/api-change/v3.2-beta5/js-apidiff-multimedia.md @@ -0,0 +1,666 @@ +| Change Type | Old Version | New Version | d.ts File | +| ---- | ------ | ------ | -------- | +|Added|NA|Class name: camera
Method or attribute name: function getCameraManager(context: Context): CameraManager;|@ohos.multimedia.camera.d.ts| +|Added|NA|Module name: ohos.multimedia.camera
Class name: CameraErrorCode|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CameraErrorCode
Method or attribute name: |@ohos.multimedia.camera.d.ts| +|Added|NA|Module name: ohos.multimedia.camera
Class name: CameraErrorCode
Method or attribute name: INVALID_ARGUMENT = 7400101|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CameraErrorCode
Method or attribute name: INVALID_ARGUMENT = 7400101|@ohos.multimedia.camera.d.ts| +|Added|NA|Module name: ohos.multimedia.camera
Class name: CameraErrorCode
Method or attribute name: OPERATION_NOT_ALLOWED = 7400102|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CameraErrorCode
Method or attribute name: OPERATION_NOT_ALLOWED = 7400102|@ohos.multimedia.camera.d.ts| +|Added|NA|Module name: ohos.multimedia.camera
Class name: CameraErrorCode
Method or attribute name: SESSION_NOT_CONFIG = 7400103|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CameraErrorCode
Method or attribute name: SESSION_NOT_CONFIG = 7400103|@ohos.multimedia.camera.d.ts| +|Added|NA|Module name: ohos.multimedia.camera
Class name: CameraErrorCode
Method or attribute name: SESSION_NOT_RUNNING = 7400104|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CameraErrorCode
Method or attribute name: SESSION_NOT_RUNNING = 7400104|@ohos.multimedia.camera.d.ts| +|Added|NA|Module name: ohos.multimedia.camera
Class name: CameraErrorCode
Method or attribute name: SESSION_CONFIG_LOCKED = 7400105|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CameraErrorCode
Method or attribute name: SESSION_CONFIG_LOCKED = 7400105|@ohos.multimedia.camera.d.ts| +|Added|NA|Module name: ohos.multimedia.camera
Class name: CameraErrorCode
Method or attribute name: DEVICE_SETTING_LOCKED = 7400106|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CameraErrorCode
Method or attribute name: DEVICE_SETTING_LOCKED = 7400106|@ohos.multimedia.camera.d.ts| +|Added|NA|Module name: ohos.multimedia.camera
Class name: CameraErrorCode
Method or attribute name: CONFILICT_CAMERA = 7400107|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CameraErrorCode
Method or attribute name: CONFILICT_CAMERA = 7400107|@ohos.multimedia.camera.d.ts| +|Added|NA|Module name: ohos.multimedia.camera
Class name: CameraErrorCode
Method or attribute name: DEVICE_DISABLED = 7400108|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CameraErrorCode
Method or attribute name: DEVICE_DISABLED = 7400108|@ohos.multimedia.camera.d.ts| +|Added|NA|Module name: ohos.multimedia.camera
Class name: CameraErrorCode
Method or attribute name: SERVICE_FATAL_ERROR = 7400201|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CameraErrorCode
Method or attribute name: SERVICE_FATAL_ERROR = 7400201|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CameraManager
Method or attribute name: getSupportedCameras(): Array;|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CameraManager
Method or attribute name: getSupportedOutputCapability(camera: CameraDevice): CameraOutputCapability;|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CameraManager
Method or attribute name: createCameraInput(camera: CameraDevice): CameraInput;|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CameraManager
Method or attribute name: createCameraInput(position: CameraPosition, type: CameraType): CameraInput;|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CameraManager
Method or attribute name: createPreviewOutput(profile: Profile, surfaceId: string): PreviewOutput;|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CameraManager
Method or attribute name: createPhotoOutput(profile: Profile, surfaceId: string): PhotoOutput;|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CameraManager
Method or attribute name: createVideoOutput(profile: VideoProfile, surfaceId: string): VideoOutput;|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CameraManager
Method or attribute name: createMetadataOutput(metadataObjectTypes: Array): MetadataOutput;|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CameraManager
Method or attribute name: createCaptureSession(): CaptureSession;|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CameraType
Method or attribute name: CAMERA_TYPE_DEFAULT = 0|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CaptureSession
Method or attribute name: beginConfig(): void;|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CaptureSession
Method or attribute name: addInput(cameraInput: CameraInput): void;|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CaptureSession
Method or attribute name: removeInput(cameraInput: CameraInput): void;|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CaptureSession
Method or attribute name: addOutput(cameraOutput: CameraOutput): void;|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CaptureSession
Method or attribute name: removeOutput(cameraOutput: CameraOutput): void;|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CaptureSession
Method or attribute name: hasFlash(): boolean;|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CaptureSession
Method or attribute name: isFlashModeSupported(flashMode: FlashMode): boolean;|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CaptureSession
Method or attribute name: getFlashMode(): FlashMode;|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CaptureSession
Method or attribute name: setFlashMode(flashMode: FlashMode): void;|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CaptureSession
Method or attribute name: isExposureModeSupported(aeMode: ExposureMode): boolean;|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CaptureSession
Method or attribute name: getExposureMode(): ExposureMode;|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CaptureSession
Method or attribute name: setExposureMode(aeMode: ExposureMode): void;|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CaptureSession
Method or attribute name: getMeteringPoint(): Point;|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CaptureSession
Method or attribute name: setMeteringPoint(point: Point): void;|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CaptureSession
Method or attribute name: getExposureBiasRange(): Array;|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CaptureSession
Method or attribute name: setExposureBias(exposureBias: number): void;|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CaptureSession
Method or attribute name: getExposureValue(): number;|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CaptureSession
Method or attribute name: isFocusModeSupported(afMode: FocusMode): boolean;|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CaptureSession
Method or attribute name: getFocusMode(): FocusMode;|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CaptureSession
Method or attribute name: setFocusMode(afMode: FocusMode): void;|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CaptureSession
Method or attribute name: setFocusPoint(point: Point): void;|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CaptureSession
Method or attribute name: getFocusPoint(): Point;|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CaptureSession
Method or attribute name: getFocalLength(): number;|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CaptureSession
Method or attribute name: getZoomRatioRange(): Array;|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CaptureSession
Method or attribute name: getZoomRatio(): number;|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CaptureSession
Method or attribute name: setZoomRatio(zoomRatio: number): void;|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CaptureSession
Method or attribute name: isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): boolean;|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CaptureSession
Method or attribute name: getActiveVideoStabilizationMode(): VideoStabilizationMode;|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: CaptureSession
Method or attribute name: setVideoStabilizationMode(mode: VideoStabilizationMode): void;|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: PhotoOutput
Method or attribute name: isMirrorSupported(): boolean;|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: MetadataObject
Method or attribute name: readonly type: MetadataObjectType;|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: MetadataObject
Method or attribute name: readonly timestamp: number;|@ohos.multimedia.camera.d.ts| +|Added|NA|Class name: MetadataObject
Method or attribute name: readonly boundingBox: Rect;|@ohos.multimedia.camera.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayerState
Method or attribute name: type AVPlayerState = 'idle' \| 'initialized' \| 'prepared' \| 'playing' \| 'paused' \| 'completed' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayerState
Method or attribute name: type AVPlayerState = 'idle' \| 'initialized' \| 'prepared' \| 'playing' \| 'paused' \| 'completed' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayerState
Method or attribute name: type AVPlayerState = 'idle' \| 'initialized' \| 'prepared' \| 'playing' \| 'paused' \| 'completed' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayerState
Method or attribute name: type AVPlayerState = 'idle' \| 'initialized' \| 'prepared' \| 'playing' \| 'paused' \| 'completed' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayerState
Method or attribute name: type AVPlayerState = 'idle' \| 'initialized' \| 'prepared' \| 'playing' \| 'paused' \| 'completed' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayerState
Method or attribute name: type AVPlayerState = 'idle' \| 'initialized' \| 'prepared' \| 'playing' \| 'paused' \| 'completed' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayerState
Method or attribute name: type AVPlayerState = 'idle' \| 'initialized' \| 'prepared' \| 'playing' \| 'paused' \| 'completed' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayerState
Method or attribute name: type AVPlayerState = 'idle' \| 'initialized' \| 'prepared' \| 'playing' \| 'paused' \| 'completed' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayerState
Method or attribute name: type AVPlayerState = 'idle' \| 'initialized' \| 'prepared' \| 'playing' \| 'paused' \| 'completed' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayerState
Method or attribute name: type AVPlayerState = 'idle' \| 'initialized' \| 'prepared' \| 'playing' \| 'paused' \| 'completed' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayerState
Method or attribute name: type AVPlayerState = 'idle' \| 'initialized' \| 'prepared' \| 'playing' \| 'paused' \| 'completed' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayerState
Method or attribute name: type AVPlayerState = 'idle' \| 'initialized' \| 'prepared' \| 'playing' \| 'paused' \| 'completed' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayerState
Method or attribute name: type AVPlayerState = 'idle' \| 'initialized' \| 'prepared' \| 'playing' \| 'paused' \| 'completed' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayerState
Method or attribute name: type AVPlayerState = 'idle' \| 'initialized' \| 'prepared' \| 'playing' \| 'paused' \| 'completed' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayerState
Method or attribute name: type AVPlayerState = 'idle' \| 'initialized' \| 'prepared' \| 'playing' \| 'paused' \| 'completed' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayerState
Method or attribute name: type AVPlayerState = 'idle' \| 'initialized' \| 'prepared' \| 'playing' \| 'paused' \| 'completed' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayerState
Method or attribute name: type AVPlayerState = 'idle' \| 'initialized' \| 'prepared' \| 'playing' \| 'paused' \| 'completed' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayerState
Method or attribute name: type AVPlayerState = 'idle' \| 'initialized' \| 'prepared' \| 'playing' \| 'paused' \| 'completed' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorderState
Method or attribute name: type AVRecorderState = 'idle' \| 'prepared' \| 'started' \| 'paused' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorderState
Method or attribute name: type AVRecorderState = 'idle' \| 'prepared' \| 'started' \| 'paused' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorderState
Method or attribute name: type AVRecorderState = 'idle' \| 'prepared' \| 'started' \| 'paused' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorderState
Method or attribute name: type AVRecorderState = 'idle' \| 'prepared' \| 'started' \| 'paused' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorderState
Method or attribute name: type AVRecorderState = 'idle' \| 'prepared' \| 'started' \| 'paused' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorderState
Method or attribute name: type AVRecorderState = 'idle' \| 'prepared' \| 'started' \| 'paused' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorderState
Method or attribute name: type AVRecorderState = 'idle' \| 'prepared' \| 'started' \| 'paused' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorderState
Method or attribute name: type AVRecorderState = 'idle' \| 'prepared' \| 'started' \| 'paused' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorderState
Method or attribute name: type AVRecorderState = 'idle' \| 'prepared' \| 'started' \| 'paused' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorderState
Method or attribute name: type AVRecorderState = 'idle' \| 'prepared' \| 'started' \| 'paused' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorderState
Method or attribute name: type AVRecorderState = 'idle' \| 'prepared' \| 'started' \| 'paused' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorderState
Method or attribute name: type AVRecorderState = 'idle' \| 'prepared' \| 'started' \| 'paused' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorderState
Method or attribute name: type AVRecorderState = 'idle' \| 'prepared' \| 'started' \| 'paused' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorderState
Method or attribute name: type AVRecorderState = 'idle' \| 'prepared' \| 'started' \| 'paused' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: media
Method or attribute name: function createAVPlayer(callback: AsyncCallback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: media
Method or attribute name: function createAVPlayer() : Promise;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: media
Method or attribute name: function createAVRecorder(callback: AsyncCallback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: media
Method or attribute name: function createAVRecorder() : Promise;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: StateChangeReason|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: StateChangeReason
Method or attribute name: |@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: StateChangeReason
Method or attribute name: USER = 1|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: StateChangeReason
Method or attribute name: USER = 1|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: StateChangeReason
Method or attribute name: BACKGROUND = 2|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: StateChangeReason
Method or attribute name: BACKGROUND = 2|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVErrorCode|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVErrorCode
Method or attribute name: |@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVErrorCode
Method or attribute name: AVERR_OK = 0|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVErrorCode
Method or attribute name: AVERR_OK = 0|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVErrorCode
Method or attribute name: AVERR_NO_PERMISSION = 201|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVErrorCode
Method or attribute name: AVERR_NO_PERMISSION = 201|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVErrorCode
Method or attribute name: AVERR_INVALID_PARAMETER = 401|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVErrorCode
Method or attribute name: AVERR_INVALID_PARAMETER = 401|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVErrorCode
Method or attribute name: AVERR_UNSUPPORT_CAPABILITY = 801|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVErrorCode
Method or attribute name: AVERR_UNSUPPORT_CAPABILITY = 801|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVErrorCode
Method or attribute name: AVERR_NO_MEMORY = 5400101|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVErrorCode
Method or attribute name: AVERR_NO_MEMORY = 5400101|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVErrorCode
Method or attribute name: AVERR_OPERATE_NOT_PERMIT = 5400102|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVErrorCode
Method or attribute name: AVERR_OPERATE_NOT_PERMIT = 5400102|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVErrorCode
Method or attribute name: AVERR_IO = 5400103|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVErrorCode
Method or attribute name: AVERR_IO = 5400103|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVErrorCode
Method or attribute name: AVERR_TIMEOUT = 5400104|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVErrorCode
Method or attribute name: AVERR_TIMEOUT = 5400104|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVErrorCode
Method or attribute name: AVERR_SERVICE_DIED = 5400105|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVErrorCode
Method or attribute name: AVERR_SERVICE_DIED = 5400105|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVErrorCode
Method or attribute name: AVERR_UNSUPPORT_FORMAT = 5400106|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVErrorCode
Method or attribute name: AVERR_UNSUPPORT_FORMAT = 5400106|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: |@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: prepare(callback: AsyncCallback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: prepare(callback: AsyncCallback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: prepare(): Promise;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: prepare(): Promise;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: play(callback: AsyncCallback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: play(callback: AsyncCallback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: play(): Promise;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: play(): Promise;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: pause(callback: AsyncCallback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: pause(callback: AsyncCallback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: pause(): Promise;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: pause(): Promise;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: stop(callback: AsyncCallback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: stop(callback: AsyncCallback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: stop(): Promise;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: stop(): Promise;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: reset(callback: AsyncCallback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: reset(callback: AsyncCallback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: reset(): Promise;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: reset(): Promise;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: release(callback: AsyncCallback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: release(callback: AsyncCallback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: release(): Promise;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: release(): Promise;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: seek(timeMs: number, mode?:SeekMode): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: seek(timeMs: number, mode?:SeekMode): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: setVolume(volume: number): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: setVolume(volume: number): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: getTrackDescription(callback: AsyncCallback>): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: getTrackDescription(callback: AsyncCallback>): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: getTrackDescription() : Promise>;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: getTrackDescription() : Promise>;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: url ?: string;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: url ?: string;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: fdSrc ?: AVFileDescriptor;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: fdSrc ?: AVFileDescriptor;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: loop: boolean;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: loop: boolean;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: audioInterruptMode ?: audio.InterruptMode;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: audioInterruptMode ?: audio.InterruptMode;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: readonly currentTime: number;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: readonly currentTime: number;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: readonly duration: number;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: readonly duration: number;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: readonly state: AVPlayerState;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: readonly state: AVPlayerState;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: surfaceId ?: string;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: surfaceId ?: string;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: readonly width: number;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: readonly width: number;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: readonly height: number;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: readonly height: number;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: videoScaleType ?: VideoScaleType;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: videoScaleType ?: VideoScaleType;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: setSpeed(speed: PlaybackSpeed): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: setSpeed(speed: PlaybackSpeed): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: setBitrate(bitrate: number): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: setBitrate(bitrate: number): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: on(type: 'stateChange', callback: (state: AVPlayerState, reason: StateChangeReason) => void): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: on(type: 'stateChange', callback: (state: AVPlayerState, reason: StateChangeReason) => void): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: off(type: 'stateChange'): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: off(type: 'stateChange'): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: on(type: 'volumeChange', callback: Callback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: on(type: 'volumeChange', callback: Callback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: off(type: 'volumeChange'): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: off(type: 'volumeChange'): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: on(type: 'endOfStream', callback: Callback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: on(type: 'endOfStream', callback: Callback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: off(type: 'endOfStream'): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: off(type: 'endOfStream'): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: on(type: 'seekDone', callback: Callback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: on(type: 'seekDone', callback: Callback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: off(type: 'seekDone'): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: off(type: 'seekDone'): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: on(type: 'speedDone', callback: Callback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: on(type: 'speedDone', callback: Callback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: off(type: 'speedDone'): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: off(type: 'speedDone'): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: on(type: 'bitrateDone', callback: Callback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: on(type: 'bitrateDone', callback: Callback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: off(type: 'bitrateDone'): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: off(type: 'bitrateDone'): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: on(type: 'timeUpdate', callback: Callback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: on(type: 'timeUpdate', callback: Callback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: off(type: 'timeUpdate'): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: off(type: 'timeUpdate'): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: on(type: 'durationUpdate', callback: Callback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: on(type: 'durationUpdate', callback: Callback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: off(type: 'durationUpdate'): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: off(type: 'durationUpdate'): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: on(type: 'bufferingUpdate', callback: (infoType: BufferingInfoType, value: number) => void): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: on(type: 'bufferingUpdate', callback: (infoType: BufferingInfoType, value: number) => void): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: off(type: 'bufferingUpdate'): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: off(type: 'bufferingUpdate'): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: on(type: 'startRenderFrame', callback: Callback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: on(type: 'startRenderFrame', callback: Callback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: off(type: 'startRenderFrame'): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: off(type: 'startRenderFrame'): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: on(type: 'videoSizeChange', callback: (width: number, height: number) => void): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: on(type: 'videoSizeChange', callback: (width: number, height: number) => void): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: off(type: 'videoSizeChange'): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: off(type: 'videoSizeChange'): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: on(type: 'audioInterrupt', callback: (info: audio.InterruptEvent) => void): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: on(type: 'audioInterrupt', callback: (info: audio.InterruptEvent) => void): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: off(type: 'audioInterrupt'): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: off(type: 'audioInterrupt'): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: on(type: 'availableBitrates', callback: (bitrates: Array) => void): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: on(type: 'availableBitrates', callback: (bitrates: Array) => void): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: off(type: 'availableBitrates'): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: off(type: 'availableBitrates'): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: on(type: 'error', callback: ErrorCallback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: on(type: 'error', callback: ErrorCallback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVPlayer
Method or attribute name: off(type: 'error'): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVPlayer
Method or attribute name: off(type: 'error'): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorder|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorder
Method or attribute name: |@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorder
Method or attribute name: prepare(config: AVRecorderConfig, callback: AsyncCallback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorder
Method or attribute name: prepare(config: AVRecorderConfig, callback: AsyncCallback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorder
Method or attribute name: prepare(config: AVRecorderConfig): Promise;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorder
Method or attribute name: prepare(config: AVRecorderConfig): Promise;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorder
Method or attribute name: getInputSurface(callback: AsyncCallback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorder
Method or attribute name: getInputSurface(callback: AsyncCallback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorder
Method or attribute name: getInputSurface(): Promise;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorder
Method or attribute name: getInputSurface(): Promise;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorder
Method or attribute name: start(callback: AsyncCallback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorder
Method or attribute name: start(callback: AsyncCallback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorder
Method or attribute name: start(): Promise;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorder
Method or attribute name: start(): Promise;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorder
Method or attribute name: pause(callback: AsyncCallback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorder
Method or attribute name: pause(callback: AsyncCallback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorder
Method or attribute name: pause(): Promise;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorder
Method or attribute name: pause(): Promise;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorder
Method or attribute name: resume(callback: AsyncCallback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorder
Method or attribute name: resume(callback: AsyncCallback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorder
Method or attribute name: resume(): Promise;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorder
Method or attribute name: resume(): Promise;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorder
Method or attribute name: stop(callback: AsyncCallback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorder
Method or attribute name: stop(callback: AsyncCallback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorder
Method or attribute name: stop(): Promise;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorder
Method or attribute name: stop(): Promise;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorder
Method or attribute name: reset(callback: AsyncCallback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorder
Method or attribute name: reset(callback: AsyncCallback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorder
Method or attribute name: reset(): Promise;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorder
Method or attribute name: reset(): Promise;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorder
Method or attribute name: release(callback: AsyncCallback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorder
Method or attribute name: release(callback: AsyncCallback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorder
Method or attribute name: release(): Promise;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorder
Method or attribute name: release(): Promise;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorder
Method or attribute name: readonly state: AVRecorderState;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorder
Method or attribute name: readonly state: AVRecorderState;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorder
Method or attribute name: on(type: 'stateChange', callback: (state: AVRecorderState, reason: StateChangeReason) => void): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorder
Method or attribute name: on(type: 'stateChange', callback: (state: AVRecorderState, reason: StateChangeReason) => void): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorder
Method or attribute name: on(type: 'error', callback: ErrorCallback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorder
Method or attribute name: on(type: 'error', callback: ErrorCallback): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorder
Method or attribute name: off(type: 'stateChange'): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorder
Method or attribute name: off(type: 'stateChange'): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorder
Method or attribute name: off(type: 'error'): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorder
Method or attribute name: off(type: 'error'): void;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorderProfile|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorderProfile
Method or attribute name: |@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorderProfile
Method or attribute name: audioBitrate?: number;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorderProfile
Method or attribute name: audioBitrate?: number;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorderProfile
Method or attribute name: audioChannels?: number;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorderProfile
Method or attribute name: audioChannels?: number;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorderProfile
Method or attribute name: audioCodec?: CodecMimeType;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorderProfile
Method or attribute name: audioCodec?: CodecMimeType;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorderProfile
Method or attribute name: audioSampleRate?: number;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorderProfile
Method or attribute name: audioSampleRate?: number;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorderProfile
Method or attribute name: fileFormat: ContainerFormatType;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorderProfile
Method or attribute name: fileFormat: ContainerFormatType;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorderProfile
Method or attribute name: videoBitrate?: number;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorderProfile
Method or attribute name: videoBitrate?: number;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorderProfile
Method or attribute name: videoCodec?: CodecMimeType;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorderProfile
Method or attribute name: videoCodec?: CodecMimeType;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorderProfile
Method or attribute name: videoFrameWidth?: number;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorderProfile
Method or attribute name: videoFrameWidth?: number;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorderProfile
Method or attribute name: videoFrameHeight?: number;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorderProfile
Method or attribute name: videoFrameHeight?: number;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorderProfile
Method or attribute name: videoFrameRate?: number;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorderProfile
Method or attribute name: videoFrameRate?: number;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorderConfig|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorderConfig
Method or attribute name: |@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorderConfig
Method or attribute name: audioSourceType?: AudioSourceType;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorderConfig
Method or attribute name: audioSourceType?: AudioSourceType;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorderConfig
Method or attribute name: videoSourceType?: VideoSourceType;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorderConfig
Method or attribute name: videoSourceType?: VideoSourceType;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorderConfig
Method or attribute name: profile: AVRecorderProfile;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorderConfig
Method or attribute name: profile: AVRecorderProfile;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorderConfig
Method or attribute name: url: string;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorderConfig
Method or attribute name: url: string;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorderConfig
Method or attribute name: rotation?: number;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorderConfig
Method or attribute name: rotation?: number;|@ohos.multimedia.media.d.ts| +|Added|NA|Module name: ohos.multimedia.media
Class name: AVRecorderConfig
Method or attribute name: location?: Location;|@ohos.multimedia.media.d.ts| +|Added|NA|Class name: AVRecorderConfig
Method or attribute name: location?: Location;|@ohos.multimedia.media.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: CameraType
Method or attribute name: CAMERA_TYPE_UNSPECIFIED = 0|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: CameraInput
Method or attribute name: release(callback: AsyncCallback): void;|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: CameraInput
Method or attribute name: release(): Promise;|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: CameraInputErrorCode|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: CameraInputErrorCode
Method or attribute name: ERROR_UNKNOWN = -1|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: CameraInputErrorCode
Method or attribute name: ERROR_NO_PERMISSION = 0|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: CameraInputErrorCode
Method or attribute name: ERROR_DEVICE_PREEMPTED = 1|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: CameraInputErrorCode
Method or attribute name: ERROR_DEVICE_DISCONNECTED = 2|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: CameraInputErrorCode
Method or attribute name: ERROR_DEVICE_IN_USE = 3|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: CameraInputErrorCode
Method or attribute name: ERROR_DRIVER_ERROR = 4|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: CameraInputError|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: CameraInputError
Method or attribute name: code: CameraInputErrorCode;|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: CaptureSessionErrorCode|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: CaptureSessionErrorCode
Method or attribute name: ERROR_UNKNOWN = -1|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: CaptureSessionErrorCode
Method or attribute name: ERROR_INSUFFICIENT_RESOURCES = 0|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: CaptureSessionErrorCode
Method or attribute name: ERROR_TIMEOUT = 1|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: CaptureSessionError|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: CaptureSessionError
Method or attribute name: code: CaptureSessionErrorCode;|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: PreviewOutputErrorCode|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: PreviewOutputErrorCode
Method or attribute name: ERROR_UNKNOWN = -1|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: PreviewOutputError|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: PreviewOutputError
Method or attribute name: code: PreviewOutputErrorCode;|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: PhotoOutputErrorCode|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: PhotoOutputErrorCode
Method or attribute name: ERROR_UNKNOWN = -1|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: PhotoOutputErrorCode
Method or attribute name: ERROR_DRIVER_ERROR = 0|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: PhotoOutputErrorCode
Method or attribute name: ERROR_INSUFFICIENT_RESOURCES = 1|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: PhotoOutputErrorCode
Method or attribute name: ERROR_TIMEOUT = 2|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: PhotoOutputError|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: PhotoOutputError
Method or attribute name: code: PhotoOutputErrorCode;|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: VideoOutputErrorCode|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: VideoOutputErrorCode
Method or attribute name: ERROR_UNKNOWN = -1|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: VideoOutputErrorCode
Method or attribute name: ERROR_DRIVER_ERROR = 0|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: VideoOutputError|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: VideoOutputError
Method or attribute name: code: VideoOutputErrorCode;|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: MetadataObject
Method or attribute name: getType(callback: AsyncCallback): void;|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: MetadataObject
Method or attribute name: getType(): Promise;|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: MetadataObject
Method or attribute name: getTimestamp(callback: AsyncCallback): void;|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: MetadataObject
Method or attribute name: getTimestamp(): Promise;|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: MetadataObject
Method or attribute name: getBoundingBox(callback: AsyncCallback): void;|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: MetadataObject
Method or attribute name: getBoundingBox(): Promise;|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: MetadataFaceObject|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: MetadataOutputErrorCode|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: MetadataOutputErrorCode
Method or attribute name: ERROR_UNKNOWN = -1|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: MetadataOutputErrorCode
Method or attribute name: ERROR_INSUFFICIENT_RESOURCES = 0|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: MetadataOutputError|NA|@ohos.multimedia.camera.d.ts| +|Deleted|Module name: ohos.multimedia.camera
Class name: MetadataOutputError
Method or attribute name: code: MetadataOutputErrorCode;|NA|@ohos.multimedia.camera.d.ts| +|Access level changed|Class name: AVSessionType
Method or attribute name: type AVSessionType = 'audio' \| 'video';
Access level: public API|Class name: AVSessionType
Method or attribute name: type AVSessionType = 'audio' \| 'video';
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionType
Method or attribute name: type AVSessionType = 'audio' \| 'video';
Access level: public API|Class name: AVSessionType
Method or attribute name: type AVSessionType = 'audio' \| 'video';
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: public API|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: public API|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: public API|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: public API|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: public API|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: public API|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: public API|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: public API|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: public API|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: public API|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: public API|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: avSession
Method or attribute name: function createAVSession(context: Context, tag: string, type: AVSessionType, callback: AsyncCallback): void;
Access level: public API|Class name: avSession
Method or attribute name: function createAVSession(context: Context, tag: string, type: AVSessionType, callback: AsyncCallback): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: avSession
Method or attribute name: function createAVSession(context: Context, tag: string, type: AVSessionType): Promise;
Access level: public API|Class name: avSession
Method or attribute name: function createAVSession(context: Context, tag: string, type: AVSessionType): Promise;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: avSession
Method or attribute name: function on(type: 'sessionServiceDie', callback: () => void): void;
Access level: public API|Class name: avSession
Method or attribute name: function on(type: 'sessionServiceDie', callback: () => void): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Access level: public API|Class name: AVSession
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: readonly sessionId: string;
Access level: public API|Class name: AVSession
Method or attribute name: readonly sessionId: string;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: setAVMetadata(data: AVMetadata, callback: AsyncCallback): void;
Access level: public API|Class name: AVSession
Method or attribute name: setAVMetadata(data: AVMetadata, callback: AsyncCallback): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: setAVMetadata(data: AVMetadata): Promise;
Access level: public API|Class name: AVSession
Method or attribute name: setAVMetadata(data: AVMetadata): Promise;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: setAVPlaybackState(state: AVPlaybackState, callback: AsyncCallback): void;
Access level: public API|Class name: AVSession
Method or attribute name: setAVPlaybackState(state: AVPlaybackState, callback: AsyncCallback): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: setAVPlaybackState(state: AVPlaybackState): Promise;
Access level: public API|Class name: AVSession
Method or attribute name: setAVPlaybackState(state: AVPlaybackState): Promise;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: setLaunchAbility(ability: WantAgent, callback: AsyncCallback): void;
Access level: public API|Class name: AVSession
Method or attribute name: setLaunchAbility(ability: WantAgent, callback: AsyncCallback): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: setLaunchAbility(ability: WantAgent): Promise;
Access level: public API|Class name: AVSession
Method or attribute name: setLaunchAbility(ability: WantAgent): Promise;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: getController(callback: AsyncCallback): void;
Access level: public API|Class name: AVSession
Method or attribute name: getController(callback: AsyncCallback): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: getController(): Promise;
Access level: public API|Class name: AVSession
Method or attribute name: getController(): Promise;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: getOutputDevice(callback: AsyncCallback): void;
Access level: public API|Class name: AVSession
Method or attribute name: getOutputDevice(callback: AsyncCallback): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: getOutputDevice(): Promise;
Access level: public API|Class name: AVSession
Method or attribute name: getOutputDevice(): Promise;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback: () => void): void;
Access level: public API|Class name: AVSession
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback: () => void): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback: () => void): void;
Access level: public API|Class name: AVSession
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback: () => void): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback: () => void): void;
Access level: public API|Class name: AVSession
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback: () => void): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback: () => void): void;
Access level: public API|Class name: AVSession
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback: () => void): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback: () => void): void;
Access level: public API|Class name: AVSession
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback: () => void): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback: () => void): void;
Access level: public API|Class name: AVSession
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback: () => void): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback: () => void): void;
Access level: public API|Class name: AVSession
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback: () => void): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: on(type: 'seek', callback: (time: number) => void): void;
Access level: public API|Class name: AVSession
Method or attribute name: on(type: 'seek', callback: (time: number) => void): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: on(type: 'setSpeed', callback: (speed: number) => void): void;
Access level: public API|Class name: AVSession
Method or attribute name: on(type: 'setSpeed', callback: (speed: number) => void): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: on(type: 'setLoopMode', callback: (mode: LoopMode) => void): void;
Access level: public API|Class name: AVSession
Method or attribute name: on(type: 'setLoopMode', callback: (mode: LoopMode) => void): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: on(type: 'toggleFavorite', callback: (assetId: string) => void): void;
Access level: public API|Class name: AVSession
Method or attribute name: on(type: 'toggleFavorite', callback: (assetId: string) => void): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: on(type: 'handleKeyEvent', callback: (event: KeyEvent) => void): void;
Access level: public API|Class name: AVSession
Method or attribute name: on(type: 'handleKeyEvent', callback: (event: KeyEvent) => void): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: on(type: 'outputDeviceChange', callback: (device: OutputDeviceInfo) => void): void;
Access level: public API|Class name: AVSession
Method or attribute name: on(type: 'outputDeviceChange', callback: (device: OutputDeviceInfo) => void): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: activate(callback: AsyncCallback): void;
Access level: public API|Class name: AVSession
Method or attribute name: activate(callback: AsyncCallback): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: activate(): Promise;
Access level: public API|Class name: AVSession
Method or attribute name: activate(): Promise;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: deactivate(callback: AsyncCallback): void;
Access level: public API|Class name: AVSession
Method or attribute name: deactivate(callback: AsyncCallback): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: deactivate(): Promise;
Access level: public API|Class name: AVSession
Method or attribute name: deactivate(): Promise;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: destroy(callback: AsyncCallback): void;
Access level: public API|Class name: AVSession
Method or attribute name: destroy(callback: AsyncCallback): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: destroy(): Promise;
Access level: public API|Class name: AVSession
Method or attribute name: destroy(): Promise;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVMetadata
Access level: public API|Class name: AVMetadata
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVPlaybackState
Access level: public API|Class name: AVPlaybackState
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: PlaybackPosition
Access level: public API|Class name: PlaybackPosition
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: OutputDeviceInfo
Access level: public API|Class name: OutputDeviceInfo
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: LoopMode
Access level: public API|Class name: LoopMode
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: PlaybackState
Access level: public API|Class name: PlaybackState
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Access level: public API|Class name: AVSessionController
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: readonly sessionId: string;
Access level: public API|Class name: AVSessionController
Method or attribute name: readonly sessionId: string;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: getAVPlaybackState(callback: AsyncCallback): void;
Access level: public API|Class name: AVSessionController
Method or attribute name: getAVPlaybackState(callback: AsyncCallback): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: getAVPlaybackState(): Promise;
Access level: public API|Class name: AVSessionController
Method or attribute name: getAVPlaybackState(): Promise;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: getAVMetadata(callback: AsyncCallback): void;
Access level: public API|Class name: AVSessionController
Method or attribute name: getAVMetadata(callback: AsyncCallback): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: getAVMetadata(): Promise;
Access level: public API|Class name: AVSessionController
Method or attribute name: getAVMetadata(): Promise;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: getOutputDevice(callback: AsyncCallback): void;
Access level: public API|Class name: AVSessionController
Method or attribute name: getOutputDevice(callback: AsyncCallback): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: getOutputDevice(): Promise;
Access level: public API|Class name: AVSessionController
Method or attribute name: getOutputDevice(): Promise;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: sendAVKeyEvent(event: KeyEvent, callback: AsyncCallback): void;
Access level: public API|Class name: AVSessionController
Method or attribute name: sendAVKeyEvent(event: KeyEvent, callback: AsyncCallback): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: sendAVKeyEvent(event: KeyEvent): Promise;
Access level: public API|Class name: AVSessionController
Method or attribute name: sendAVKeyEvent(event: KeyEvent): Promise;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: getLaunchAbility(callback: AsyncCallback): void;
Access level: public API|Class name: AVSessionController
Method or attribute name: getLaunchAbility(callback: AsyncCallback): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: getLaunchAbility(): Promise;
Access level: public API|Class name: AVSessionController
Method or attribute name: getLaunchAbility(): Promise;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: getRealPlaybackPositionSync(): number;
Access level: public API|Class name: AVSessionController
Method or attribute name: getRealPlaybackPositionSync(): number;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: isActive(callback: AsyncCallback): void;
Access level: public API|Class name: AVSessionController
Method or attribute name: isActive(callback: AsyncCallback): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: isActive(): Promise;
Access level: public API|Class name: AVSessionController
Method or attribute name: isActive(): Promise;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: destroy(callback: AsyncCallback): void;
Access level: public API|Class name: AVSessionController
Method or attribute name: destroy(callback: AsyncCallback): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: destroy(): Promise;
Access level: public API|Class name: AVSessionController
Method or attribute name: destroy(): Promise;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: getValidCommands(callback: AsyncCallback>): void;
Access level: public API|Class name: AVSessionController
Method or attribute name: getValidCommands(callback: AsyncCallback>): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: getValidCommands(): Promise>;
Access level: public API|Class name: AVSessionController
Method or attribute name: getValidCommands(): Promise>;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: sendControlCommand(command: AVControlCommand, callback: AsyncCallback): void;
Access level: public API|Class name: AVSessionController
Method or attribute name: sendControlCommand(command: AVControlCommand, callback: AsyncCallback): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: sendControlCommand(command: AVControlCommand): Promise;
Access level: public API|Class name: AVSessionController
Method or attribute name: sendControlCommand(command: AVControlCommand): Promise;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: on(type: 'metadataChange', filter: Array \| 'all', callback: (data: AVMetadata) => void);
Access level: public API|Class name: AVSessionController
Method or attribute name: on(type: 'metadataChange', filter: Array \| 'all', callback: (data: AVMetadata) => void);
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: on(type: 'playbackStateChange', filter: Array \| 'all', callback: (state: AVPlaybackState) => void);
Access level: public API|Class name: AVSessionController
Method or attribute name: on(type: 'playbackStateChange', filter: Array \| 'all', callback: (state: AVPlaybackState) => void);
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: on(type: 'sessionDestroy', callback: () => void);
Access level: public API|Class name: AVSessionController
Method or attribute name: on(type: 'sessionDestroy', callback: () => void);
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: on(type: 'activeStateChange', callback: (isActive: boolean) => void);
Access level: public API|Class name: AVSessionController
Method or attribute name: on(type: 'activeStateChange', callback: (isActive: boolean) => void);
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: on(type: 'validCommandChange', callback: (commands: Array) => void);
Access level: public API|Class name: AVSessionController
Method or attribute name: on(type: 'validCommandChange', callback: (commands: Array) => void);
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: on(type: 'outputDeviceChange', callback: (device: OutputDeviceInfo) => void): void;
Access level: public API|Class name: AVSessionController
Method or attribute name: on(type: 'outputDeviceChange', callback: (device: OutputDeviceInfo) => void): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVControlCommand
Access level: public API|Class name: AVControlCommand
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionErrorCode
Access level: public API|Class name: AVSessionErrorCode
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: camera
Access level: public API|Class name: camera
Access level: system API|@ohos.multimedia.camera.d.ts| +|Access level changed|Class name: AudioSourceType
Access level: system API|Class name: AudioSourceType
Access level: public API|@ohos.multimedia.media.d.ts| +|Access level changed|Class name: AudioSourceType
Method or attribute name: AUDIO_SOURCE_TYPE_DEFAULT = 0
Access level: system API|Class name: AudioSourceType
Method or attribute name: AUDIO_SOURCE_TYPE_DEFAULT = 0
Access level: public API|@ohos.multimedia.media.d.ts| +|Access level changed|Class name: AudioSourceType
Method or attribute name: AUDIO_SOURCE_TYPE_MIC = 1
Access level: system API|Class name: AudioSourceType
Method or attribute name: AUDIO_SOURCE_TYPE_MIC = 1
Access level: public API|@ohos.multimedia.media.d.ts| +|Access level changed|Class name: VideoSourceType
Access level: system API|Class name: VideoSourceType
Access level: public API|@ohos.multimedia.media.d.ts| +|Access level changed|Class name: VideoSourceType
Method or attribute name: VIDEO_SOURCE_TYPE_SURFACE_YUV = 0
Access level: system API|Class name: VideoSourceType
Method or attribute name: VIDEO_SOURCE_TYPE_SURFACE_YUV = 0
Access level: public API|@ohos.multimedia.media.d.ts| +|Access level changed|Class name: VideoSourceType
Method or attribute name: VIDEO_SOURCE_TYPE_SURFACE_ES = 1
Access level: system API|Class name: VideoSourceType
Method or attribute name: VIDEO_SOURCE_TYPE_SURFACE_ES = 1
Access level: public API|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioState
Method or attribute name: type AudioState = 'idle' \| 'playing' \| 'paused' \| 'stopped' \| 'error';
Deprecated version: N/A|Class name: AudioState
Method or attribute name: type AudioState = 'idle' \| 'playing' \| 'paused' \| 'stopped' \| 'error';
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayerState |@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioState
Method or attribute name: type AudioState = 'idle' \| 'playing' \| 'paused' \| 'stopped' \| 'error';
Deprecated version: N/A|Class name: AudioState
Method or attribute name: type AudioState = 'idle' \| 'playing' \| 'paused' \| 'stopped' \| 'error';
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayerState |@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioState
Method or attribute name: type AudioState = 'idle' \| 'playing' \| 'paused' \| 'stopped' \| 'error';
Deprecated version: N/A|Class name: AudioState
Method or attribute name: type AudioState = 'idle' \| 'playing' \| 'paused' \| 'stopped' \| 'error';
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayerState |@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioState
Method or attribute name: type AudioState = 'idle' \| 'playing' \| 'paused' \| 'stopped' \| 'error';
Deprecated version: N/A|Class name: AudioState
Method or attribute name: type AudioState = 'idle' \| 'playing' \| 'paused' \| 'stopped' \| 'error';
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayerState |@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioState
Method or attribute name: type AudioState = 'idle' \| 'playing' \| 'paused' \| 'stopped' \| 'error';
Deprecated version: N/A|Class name: AudioState
Method or attribute name: type AudioState = 'idle' \| 'playing' \| 'paused' \| 'stopped' \| 'error';
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayerState |@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayState
Method or attribute name: type VideoPlayState = 'idle' \| 'prepared' \| 'playing' \| 'paused' \| 'stopped' \| 'error';
Deprecated version: N/A|Class name: VideoPlayState
Method or attribute name: type VideoPlayState = 'idle' \| 'prepared' \| 'playing' \| 'paused' \| 'stopped' \| 'error';
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayerState |@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayState
Method or attribute name: type VideoPlayState = 'idle' \| 'prepared' \| 'playing' \| 'paused' \| 'stopped' \| 'error';
Deprecated version: N/A|Class name: VideoPlayState
Method or attribute name: type VideoPlayState = 'idle' \| 'prepared' \| 'playing' \| 'paused' \| 'stopped' \| 'error';
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayerState |@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayState
Method or attribute name: type VideoPlayState = 'idle' \| 'prepared' \| 'playing' \| 'paused' \| 'stopped' \| 'error';
Deprecated version: N/A|Class name: VideoPlayState
Method or attribute name: type VideoPlayState = 'idle' \| 'prepared' \| 'playing' \| 'paused' \| 'stopped' \| 'error';
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayerState |@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayState
Method or attribute name: type VideoPlayState = 'idle' \| 'prepared' \| 'playing' \| 'paused' \| 'stopped' \| 'error';
Deprecated version: N/A|Class name: VideoPlayState
Method or attribute name: type VideoPlayState = 'idle' \| 'prepared' \| 'playing' \| 'paused' \| 'stopped' \| 'error';
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayerState |@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayState
Method or attribute name: type VideoPlayState = 'idle' \| 'prepared' \| 'playing' \| 'paused' \| 'stopped' \| 'error';
Deprecated version: N/A|Class name: VideoPlayState
Method or attribute name: type VideoPlayState = 'idle' \| 'prepared' \| 'playing' \| 'paused' \| 'stopped' \| 'error';
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayerState |@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayState
Method or attribute name: type VideoPlayState = 'idle' \| 'prepared' \| 'playing' \| 'paused' \| 'stopped' \| 'error';
Deprecated version: N/A|Class name: VideoPlayState
Method or attribute name: type VideoPlayState = 'idle' \| 'prepared' \| 'playing' \| 'paused' \| 'stopped' \| 'error';
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayerState |@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: media
Method or attribute name: function createAudioPlayer(): AudioPlayer;
Deprecated version: N/A|Class name: media
Method or attribute name: function createAudioPlayer(): AudioPlayer;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: media
Method or attribute name: function createAudioRecorder(): AudioRecorder;
Deprecated version: N/A|Class name: media
Method or attribute name: function createAudioRecorder(): AudioRecorder;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: media
Method or attribute name: function createVideoPlayer(callback: AsyncCallback): void;
Deprecated version: N/A|Class name: media
Method or attribute name: function createVideoPlayer(callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: media
Method or attribute name: function createVideoPlayer() : Promise;
Deprecated version: N/A|Class name: media
Method or attribute name: function createVideoPlayer() : Promise;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioPlayer
Deprecated version: N/A|Class name: AudioPlayer
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer |@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioPlayer
Method or attribute name: play(): void;
Deprecated version: N/A|Class name: AudioPlayer
Method or attribute name: play(): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioPlayer
Method or attribute name: pause(): void;
Deprecated version: N/A|Class name: AudioPlayer
Method or attribute name: pause(): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioPlayer
Method or attribute name: stop(): void;
Deprecated version: N/A|Class name: AudioPlayer
Method or attribute name: stop(): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioPlayer
Method or attribute name: reset(): void;
Deprecated version: N/A|Class name: AudioPlayer
Method or attribute name: reset(): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioPlayer
Method or attribute name: seek(timeMs: number): void;
Deprecated version: N/A|Class name: AudioPlayer
Method or attribute name: seek(timeMs: number): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioPlayer
Method or attribute name: setVolume(vol: number): void;
Deprecated version: N/A|Class name: AudioPlayer
Method or attribute name: setVolume(vol: number): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioPlayer
Method or attribute name: release(): void;
Deprecated version: N/A|Class name: AudioPlayer
Method or attribute name: release(): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioPlayer
Method or attribute name: getTrackDescription(callback: AsyncCallback>): void;
Deprecated version: N/A|Class name: AudioPlayer
Method or attribute name: getTrackDescription(callback: AsyncCallback>): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioPlayer
Method or attribute name: getTrackDescription() : Promise>;
Deprecated version: N/A|Class name: AudioPlayer
Method or attribute name: getTrackDescription() : Promise>;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioPlayer
Method or attribute name: on(type: 'bufferingUpdate', callback: (infoType: BufferingInfoType, value: number) => void): void;
Deprecated version: N/A|Class name: AudioPlayer
Method or attribute name: on(type: 'bufferingUpdate', callback: (infoType: BufferingInfoType, value: number) => void): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioPlayer
Method or attribute name: src: string;
Deprecated version: N/A|Class name: AudioPlayer
Method or attribute name: src: string;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioPlayer
Method or attribute name: fdSrc: AVFileDescriptor;
Deprecated version: N/A|Class name: AudioPlayer
Method or attribute name: fdSrc: AVFileDescriptor;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioPlayer
Method or attribute name: loop: boolean;
Deprecated version: N/A|Class name: AudioPlayer
Method or attribute name: loop: boolean;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioPlayer
Method or attribute name: audioInterruptMode ?: audio.InterruptMode;
Deprecated version: N/A|Class name: AudioPlayer
Method or attribute name: audioInterruptMode ?: audio.InterruptMode;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioPlayer
Method or attribute name: readonly currentTime: number;
Deprecated version: N/A|Class name: AudioPlayer
Method or attribute name: readonly currentTime: number;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioPlayer
Method or attribute name: readonly duration: number;
Deprecated version: N/A|Class name: AudioPlayer
Method or attribute name: readonly duration: number;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioPlayer
Method or attribute name: readonly state: AudioState;
Deprecated version: N/A|Class name: AudioPlayer
Method or attribute name: readonly state: AudioState;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioPlayer
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'reset' \| 'dataLoad' \| 'finish' \| 'volumeChange', callback: () => void): void;
Deprecated version: N/A|Class name: AudioPlayer
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'reset' \| 'dataLoad' \| 'finish' \| 'volumeChange', callback: () => void): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioPlayer
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'reset' \| 'dataLoad' \| 'finish' \| 'volumeChange', callback: () => void): void;
Deprecated version: N/A|Class name: AudioPlayer
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'reset' \| 'dataLoad' \| 'finish' \| 'volumeChange', callback: () => void): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioPlayer
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'reset' \| 'dataLoad' \| 'finish' \| 'volumeChange', callback: () => void): void;
Deprecated version: N/A|Class name: AudioPlayer
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'reset' \| 'dataLoad' \| 'finish' \| 'volumeChange', callback: () => void): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioPlayer
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'reset' \| 'dataLoad' \| 'finish' \| 'volumeChange', callback: () => void): void;
Deprecated version: N/A|Class name: AudioPlayer
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'reset' \| 'dataLoad' \| 'finish' \| 'volumeChange', callback: () => void): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioPlayer
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'reset' \| 'dataLoad' \| 'finish' \| 'volumeChange', callback: () => void): void;
Deprecated version: N/A|Class name: AudioPlayer
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'reset' \| 'dataLoad' \| 'finish' \| 'volumeChange', callback: () => void): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioPlayer
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'reset' \| 'dataLoad' \| 'finish' \| 'volumeChange', callback: () => void): void;
Deprecated version: N/A|Class name: AudioPlayer
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'reset' \| 'dataLoad' \| 'finish' \| 'volumeChange', callback: () => void): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioPlayer
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'reset' \| 'dataLoad' \| 'finish' \| 'volumeChange', callback: () => void): void;
Deprecated version: N/A|Class name: AudioPlayer
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'reset' \| 'dataLoad' \| 'finish' \| 'volumeChange', callback: () => void): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioPlayer
Method or attribute name: on(type: 'timeUpdate', callback: Callback): void;
Deprecated version: N/A|Class name: AudioPlayer
Method or attribute name: on(type: 'timeUpdate', callback: Callback): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioPlayer
Method or attribute name: on(type: 'audioInterrupt', callback: (info: audio.InterruptEvent) => void): void;
Deprecated version: N/A|Class name: AudioPlayer
Method or attribute name: on(type: 'audioInterrupt', callback: (info: audio.InterruptEvent) => void): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioPlayer
Method or attribute name: on(type: 'error', callback: ErrorCallback): void;
Deprecated version: N/A|Class name: AudioPlayer
Method or attribute name: on(type: 'error', callback: ErrorCallback): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioRecorderConfig
Deprecated version: N/A|Class name: AudioRecorderConfig
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVRecorderConfig |@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioRecorderConfig
Method or attribute name: audioEncodeBitRate?: number;
Deprecated version: N/A|Class name: AudioRecorderConfig
Method or attribute name: audioEncodeBitRate?: number;
Deprecated version: 9
Substitute API: N/A|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioRecorderConfig
Method or attribute name: audioSampleRate?: number;
Deprecated version: N/A|Class name: AudioRecorderConfig
Method or attribute name: audioSampleRate?: number;
Deprecated version: 9
Substitute API: N/A|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioRecorderConfig
Method or attribute name: numberOfChannels?: number;
Deprecated version: N/A|Class name: AudioRecorderConfig
Method or attribute name: numberOfChannels?: number;
Deprecated version: 9
Substitute API: N/A|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioRecorderConfig
Method or attribute name: uri: string;
Deprecated version: N/A|Class name: AudioRecorderConfig
Method or attribute name: uri: string;
Deprecated version: 9
Substitute API: N/A|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioRecorderConfig
Method or attribute name: location?: Location;
Deprecated version: N/A|Class name: AudioRecorderConfig
Method or attribute name: location?: Location;
Deprecated version: 9
Substitute API: N/A|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioRecorderConfig
Method or attribute name: audioEncoderMime?: CodecMimeType;
Deprecated version: N/A|Class name: AudioRecorderConfig
Method or attribute name: audioEncoderMime?: CodecMimeType;
Deprecated version: 9
Substitute API: N/A|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioRecorderConfig
Method or attribute name: fileFormat?: ContainerFormatType;
Deprecated version: N/A|Class name: AudioRecorderConfig
Method or attribute name: fileFormat?: ContainerFormatType;
Deprecated version: 9
Substitute API: N/A|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioRecorder
Deprecated version: N/A|Class name: AudioRecorder
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVRecorder |@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioRecorder
Method or attribute name: prepare(config: AudioRecorderConfig): void;
Deprecated version: N/A|Class name: AudioRecorder
Method or attribute name: prepare(config: AudioRecorderConfig): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVRecorder|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioRecorder
Method or attribute name: start(): void;
Deprecated version: N/A|Class name: AudioRecorder
Method or attribute name: start(): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVRecorder|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioRecorder
Method or attribute name: pause(): void;
Deprecated version: N/A|Class name: AudioRecorder
Method or attribute name: pause(): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVRecorder|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioRecorder
Method or attribute name: resume(): void;
Deprecated version: N/A|Class name: AudioRecorder
Method or attribute name: resume(): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVRecorder|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioRecorder
Method or attribute name: stop(): void;
Deprecated version: N/A|Class name: AudioRecorder
Method or attribute name: stop(): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVRecorder|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioRecorder
Method or attribute name: release(): void;
Deprecated version: N/A|Class name: AudioRecorder
Method or attribute name: release(): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVRecorder|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioRecorder
Method or attribute name: reset(): void;
Deprecated version: N/A|Class name: AudioRecorder
Method or attribute name: reset(): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVRecorder|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioRecorder
Method or attribute name: on(type: 'prepare' \| 'start' \| 'pause' \| 'resume' \| 'stop' \| 'release' \| 'reset', callback: () => void): void;
Deprecated version: N/A|Class name: AudioRecorder
Method or attribute name: on(type: 'prepare' \| 'start' \| 'pause' \| 'resume' \| 'stop' \| 'release' \| 'reset', callback: () => void): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVRecorder|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioRecorder
Method or attribute name: on(type: 'prepare' \| 'start' \| 'pause' \| 'resume' \| 'stop' \| 'release' \| 'reset', callback: () => void): void;
Deprecated version: N/A|Class name: AudioRecorder
Method or attribute name: on(type: 'prepare' \| 'start' \| 'pause' \| 'resume' \| 'stop' \| 'release' \| 'reset', callback: () => void): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVRecorder|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioRecorder
Method or attribute name: on(type: 'prepare' \| 'start' \| 'pause' \| 'resume' \| 'stop' \| 'release' \| 'reset', callback: () => void): void;
Deprecated version: N/A|Class name: AudioRecorder
Method or attribute name: on(type: 'prepare' \| 'start' \| 'pause' \| 'resume' \| 'stop' \| 'release' \| 'reset', callback: () => void): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVRecorder|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioRecorder
Method or attribute name: on(type: 'prepare' \| 'start' \| 'pause' \| 'resume' \| 'stop' \| 'release' \| 'reset', callback: () => void): void;
Deprecated version: N/A|Class name: AudioRecorder
Method or attribute name: on(type: 'prepare' \| 'start' \| 'pause' \| 'resume' \| 'stop' \| 'release' \| 'reset', callback: () => void): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVRecorder|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioRecorder
Method or attribute name: on(type: 'prepare' \| 'start' \| 'pause' \| 'resume' \| 'stop' \| 'release' \| 'reset', callback: () => void): void;
Deprecated version: N/A|Class name: AudioRecorder
Method or attribute name: on(type: 'prepare' \| 'start' \| 'pause' \| 'resume' \| 'stop' \| 'release' \| 'reset', callback: () => void): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVRecorder|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioRecorder
Method or attribute name: on(type: 'prepare' \| 'start' \| 'pause' \| 'resume' \| 'stop' \| 'release' \| 'reset', callback: () => void): void;
Deprecated version: N/A|Class name: AudioRecorder
Method or attribute name: on(type: 'prepare' \| 'start' \| 'pause' \| 'resume' \| 'stop' \| 'release' \| 'reset', callback: () => void): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVRecorder|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioRecorder
Method or attribute name: on(type: 'prepare' \| 'start' \| 'pause' \| 'resume' \| 'stop' \| 'release' \| 'reset', callback: () => void): void;
Deprecated version: N/A|Class name: AudioRecorder
Method or attribute name: on(type: 'prepare' \| 'start' \| 'pause' \| 'resume' \| 'stop' \| 'release' \| 'reset', callback: () => void): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVRecorder|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: AudioRecorder
Method or attribute name: on(type: 'error', callback: ErrorCallback): void;
Deprecated version: N/A|Class name: AudioRecorder
Method or attribute name: on(type: 'error', callback: ErrorCallback): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVRecorder|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayer
Deprecated version: N/A|Class name: VideoPlayer
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer |@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayer
Method or attribute name: setDisplaySurface(surfaceId: string, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: VideoPlayer
Method or attribute name: setDisplaySurface(surfaceId: string, callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayer
Method or attribute name: setDisplaySurface(surfaceId: string): Promise;
Deprecated version: N/A|Class name: VideoPlayer
Method or attribute name: setDisplaySurface(surfaceId: string): Promise;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayer
Method or attribute name: prepare(callback: AsyncCallback): void;
Deprecated version: N/A|Class name: VideoPlayer
Method or attribute name: prepare(callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayer
Method or attribute name: prepare(): Promise;
Deprecated version: N/A|Class name: VideoPlayer
Method or attribute name: prepare(): Promise;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayer
Method or attribute name: play(callback: AsyncCallback): void;
Deprecated version: N/A|Class name: VideoPlayer
Method or attribute name: play(callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayer
Method or attribute name: play(): Promise;
Deprecated version: N/A|Class name: VideoPlayer
Method or attribute name: play(): Promise;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayer
Method or attribute name: pause(callback: AsyncCallback): void;
Deprecated version: N/A|Class name: VideoPlayer
Method or attribute name: pause(callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayer
Method or attribute name: pause(): Promise;
Deprecated version: N/A|Class name: VideoPlayer
Method or attribute name: pause(): Promise;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayer
Method or attribute name: stop(callback: AsyncCallback): void;
Deprecated version: N/A|Class name: VideoPlayer
Method or attribute name: stop(callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayer
Method or attribute name: stop(): Promise;
Deprecated version: N/A|Class name: VideoPlayer
Method or attribute name: stop(): Promise;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayer
Method or attribute name: reset(callback: AsyncCallback): void;
Deprecated version: N/A|Class name: VideoPlayer
Method or attribute name: reset(callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayer
Method or attribute name: reset(): Promise;
Deprecated version: N/A|Class name: VideoPlayer
Method or attribute name: reset(): Promise;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayer
Method or attribute name: seek(timeMs: number, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: VideoPlayer
Method or attribute name: seek(timeMs: number, callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayer
Method or attribute name: seek(timeMs: number, mode:SeekMode, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: VideoPlayer
Method or attribute name: seek(timeMs: number, mode:SeekMode, callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayer
Method or attribute name: seek(timeMs: number, mode?:SeekMode): Promise;
Deprecated version: N/A|Class name: VideoPlayer
Method or attribute name: seek(timeMs: number, mode?:SeekMode): Promise;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayer
Method or attribute name: setVolume(vol: number, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: VideoPlayer
Method or attribute name: setVolume(vol: number, callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayer
Method or attribute name: setVolume(vol: number): Promise;
Deprecated version: N/A|Class name: VideoPlayer
Method or attribute name: setVolume(vol: number): Promise;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayer
Method or attribute name: release(callback: AsyncCallback): void;
Deprecated version: N/A|Class name: VideoPlayer
Method or attribute name: release(callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayer
Method or attribute name: release(): Promise;
Deprecated version: N/A|Class name: VideoPlayer
Method or attribute name: release(): Promise;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayer
Method or attribute name: getTrackDescription(callback: AsyncCallback>): void;
Deprecated version: N/A|Class name: VideoPlayer
Method or attribute name: getTrackDescription(callback: AsyncCallback>): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayer
Method or attribute name: getTrackDescription() : Promise>;
Deprecated version: N/A|Class name: VideoPlayer
Method or attribute name: getTrackDescription() : Promise>;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayer
Method or attribute name: url: string;
Deprecated version: N/A|Class name: VideoPlayer
Method or attribute name: url: string;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayer
Method or attribute name: fdSrc: AVFileDescriptor;
Deprecated version: N/A|Class name: VideoPlayer
Method or attribute name: fdSrc: AVFileDescriptor;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayer
Method or attribute name: loop: boolean;
Deprecated version: N/A|Class name: VideoPlayer
Method or attribute name: loop: boolean;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayer
Method or attribute name: readonly currentTime: number;
Deprecated version: N/A|Class name: VideoPlayer
Method or attribute name: readonly currentTime: number;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayer
Method or attribute name: readonly duration: number;
Deprecated version: N/A|Class name: VideoPlayer
Method or attribute name: readonly duration: number;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayer
Method or attribute name: readonly state: VideoPlayState;
Deprecated version: N/A|Class name: VideoPlayer
Method or attribute name: readonly state: VideoPlayState;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayer
Method or attribute name: readonly width: number;
Deprecated version: N/A|Class name: VideoPlayer
Method or attribute name: readonly width: number;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayer
Method or attribute name: readonly height: number;
Deprecated version: N/A|Class name: VideoPlayer
Method or attribute name: readonly height: number;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayer
Method or attribute name: audioInterruptMode ?: audio.InterruptMode;
Deprecated version: N/A|Class name: VideoPlayer
Method or attribute name: audioInterruptMode ?: audio.InterruptMode;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayer
Method or attribute name: videoScaleType ?: VideoScaleType;
Deprecated version: N/A|Class name: VideoPlayer
Method or attribute name: videoScaleType ?: VideoScaleType;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayer
Method or attribute name: setSpeed(speed:number, callback: AsyncCallback): void;
Deprecated version: N/A|Class name: VideoPlayer
Method or attribute name: setSpeed(speed:number, callback: AsyncCallback): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayer
Method or attribute name: setSpeed(speed:number): Promise;
Deprecated version: N/A|Class name: VideoPlayer
Method or attribute name: setSpeed(speed:number): Promise;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayer
Method or attribute name: on(type: 'playbackCompleted', callback: Callback): void;
Deprecated version: N/A|Class name: VideoPlayer
Method or attribute name: on(type: 'playbackCompleted', callback: Callback): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayer
Method or attribute name: on(type: 'bufferingUpdate', callback: (infoType: BufferingInfoType, value: number) => void): void;
Deprecated version: N/A|Class name: VideoPlayer
Method or attribute name: on(type: 'bufferingUpdate', callback: (infoType: BufferingInfoType, value: number) => void): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayer
Method or attribute name: on(type: 'startRenderFrame', callback: Callback): void;
Deprecated version: N/A|Class name: VideoPlayer
Method or attribute name: on(type: 'startRenderFrame', callback: Callback): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayer
Method or attribute name: on(type: 'videoSizeChanged', callback: (width: number, height: number) => void): void;
Deprecated version: N/A|Class name: VideoPlayer
Method or attribute name: on(type: 'videoSizeChanged', callback: (width: number, height: number) => void): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayer
Method or attribute name: on(type: 'audioInterrupt', callback: (info: audio.InterruptEvent) => void): void;
Deprecated version: N/A|Class name: VideoPlayer
Method or attribute name: on(type: 'audioInterrupt', callback: (info: audio.InterruptEvent) => void): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Deprecated version changed|Class name: VideoPlayer
Method or attribute name: on(type: 'error', callback: ErrorCallback): void;
Deprecated version: N/A|Class name: VideoPlayer
Method or attribute name: on(type: 'error', callback: ErrorCallback): void;
Deprecated version: 9
Substitute API: ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|Initial version changed|Class name: AVSessionType
Method or attribute name: type AVSessionType = 'audio' \| 'video';
Initial version: N/A|Class name: AVSessionType
Method or attribute name: type AVSessionType = 'audio' \| 'video';
Initial version: 9|@ohos.multimedia.avsession.d.ts| +|Initial version changed|Class name: AVSessionType
Method or attribute name: type AVSessionType = 'audio' \| 'video';
Initial version: N/A|Class name: AVSessionType
Method or attribute name: type AVSessionType = 'audio' \| 'video';
Initial version: 9|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionType
Method or attribute name: type AVSessionType = 'audio' \| 'video';
Access level: public API|Class name: AVSessionType
Method or attribute name: type AVSessionType = 'audio' \| 'video';
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionType
Method or attribute name: type AVSessionType = 'audio' \| 'video';
Access level: public API|Class name: AVSessionType
Method or attribute name: type AVSessionType = 'audio' \| 'video';
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: public API|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: public API|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: public API|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: public API|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: public API|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: public API|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: public API|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: public API|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: public API|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: public API|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: public API|Class name: AVControlCommandType
Method or attribute name: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|
'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: avSession
Method or attribute name: function createAVSession(context: Context, tag: string, type: AVSessionType, callback: AsyncCallback): void;
Access level: public API|Class name: avSession
Method or attribute name: function createAVSession(context: Context, tag: string, type: AVSessionType, callback: AsyncCallback): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: avSession
Method or attribute name: function createAVSession(context: Context, tag: string, type: AVSessionType): Promise;
Access level: public API|Class name: avSession
Method or attribute name: function createAVSession(context: Context, tag: string, type: AVSessionType): Promise;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: avSession
Method or attribute name: function on(type: 'sessionServiceDie', callback: () => void): void;
Access level: public API|Class name: avSession
Method or attribute name: function on(type: 'sessionServiceDie', callback: () => void): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Access level: public API|Class name: AVSession
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: readonly sessionId: string;
Access level: public API|Class name: AVSession
Method or attribute name: readonly sessionId: string;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: setAVMetadata(data: AVMetadata, callback: AsyncCallback): void;
Access level: public API|Class name: AVSession
Method or attribute name: setAVMetadata(data: AVMetadata, callback: AsyncCallback): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: setAVMetadata(data: AVMetadata): Promise;
Access level: public API|Class name: AVSession
Method or attribute name: setAVMetadata(data: AVMetadata): Promise;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: setAVPlaybackState(state: AVPlaybackState, callback: AsyncCallback): void;
Access level: public API|Class name: AVSession
Method or attribute name: setAVPlaybackState(state: AVPlaybackState, callback: AsyncCallback): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: setAVPlaybackState(state: AVPlaybackState): Promise;
Access level: public API|Class name: AVSession
Method or attribute name: setAVPlaybackState(state: AVPlaybackState): Promise;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: setLaunchAbility(ability: WantAgent, callback: AsyncCallback): void;
Access level: public API|Class name: AVSession
Method or attribute name: setLaunchAbility(ability: WantAgent, callback: AsyncCallback): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: setLaunchAbility(ability: WantAgent): Promise;
Access level: public API|Class name: AVSession
Method or attribute name: setLaunchAbility(ability: WantAgent): Promise;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: getController(callback: AsyncCallback): void;
Access level: public API|Class name: AVSession
Method or attribute name: getController(callback: AsyncCallback): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: getController(): Promise;
Access level: public API|Class name: AVSession
Method or attribute name: getController(): Promise;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: getOutputDevice(callback: AsyncCallback): void;
Access level: public API|Class name: AVSession
Method or attribute name: getOutputDevice(callback: AsyncCallback): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: getOutputDevice(): Promise;
Access level: public API|Class name: AVSession
Method or attribute name: getOutputDevice(): Promise;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback: () => void): void;
Access level: public API|Class name: AVSession
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback: () => void): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback: () => void): void;
Access level: public API|Class name: AVSession
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback: () => void): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback: () => void): void;
Access level: public API|Class name: AVSession
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback: () => void): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback: () => void): void;
Access level: public API|Class name: AVSession
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback: () => void): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback: () => void): void;
Access level: public API|Class name: AVSession
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback: () => void): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback: () => void): void;
Access level: public API|Class name: AVSession
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback: () => void): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback: () => void): void;
Access level: public API|Class name: AVSession
Method or attribute name: on(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback: () => void): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: on(type: 'seek', callback: (time: number) => void): void;
Access level: public API|Class name: AVSession
Method or attribute name: on(type: 'seek', callback: (time: number) => void): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: on(type: 'setSpeed', callback: (speed: number) => void): void;
Access level: public API|Class name: AVSession
Method or attribute name: on(type: 'setSpeed', callback: (speed: number) => void): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: on(type: 'setLoopMode', callback: (mode: LoopMode) => void): void;
Access level: public API|Class name: AVSession
Method or attribute name: on(type: 'setLoopMode', callback: (mode: LoopMode) => void): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: on(type: 'toggleFavorite', callback: (assetId: string) => void): void;
Access level: public API|Class name: AVSession
Method or attribute name: on(type: 'toggleFavorite', callback: (assetId: string) => void): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: on(type: 'handleKeyEvent', callback: (event: KeyEvent) => void): void;
Access level: public API|Class name: AVSession
Method or attribute name: on(type: 'handleKeyEvent', callback: (event: KeyEvent) => void): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: on(type: 'outputDeviceChange', callback: (device: OutputDeviceInfo) => void): void;
Access level: public API|Class name: AVSession
Method or attribute name: on(type: 'outputDeviceChange', callback: (device: OutputDeviceInfo) => void): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: activate(callback: AsyncCallback): void;
Access level: public API|Class name: AVSession
Method or attribute name: activate(callback: AsyncCallback): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: activate(): Promise;
Access level: public API|Class name: AVSession
Method or attribute name: activate(): Promise;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: deactivate(callback: AsyncCallback): void;
Access level: public API|Class name: AVSession
Method or attribute name: deactivate(callback: AsyncCallback): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: deactivate(): Promise;
Access level: public API|Class name: AVSession
Method or attribute name: deactivate(): Promise;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: destroy(callback: AsyncCallback): void;
Access level: public API|Class name: AVSession
Method or attribute name: destroy(callback: AsyncCallback): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSession
Method or attribute name: destroy(): Promise;
Access level: public API|Class name: AVSession
Method or attribute name: destroy(): Promise;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVMetadata
Access level: public API|Class name: AVMetadata
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVPlaybackState
Access level: public API|Class name: AVPlaybackState
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: PlaybackPosition
Access level: public API|Class name: PlaybackPosition
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: OutputDeviceInfo
Access level: public API|Class name: OutputDeviceInfo
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: LoopMode
Access level: public API|Class name: LoopMode
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: PlaybackState
Access level: public API|Class name: PlaybackState
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Access level: public API|Class name: AVSessionController
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: readonly sessionId: string;
Access level: public API|Class name: AVSessionController
Method or attribute name: readonly sessionId: string;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: getAVPlaybackState(callback: AsyncCallback): void;
Access level: public API|Class name: AVSessionController
Method or attribute name: getAVPlaybackState(callback: AsyncCallback): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: getAVPlaybackState(): Promise;
Access level: public API|Class name: AVSessionController
Method or attribute name: getAVPlaybackState(): Promise;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: getAVMetadata(callback: AsyncCallback): void;
Access level: public API|Class name: AVSessionController
Method or attribute name: getAVMetadata(callback: AsyncCallback): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: getAVMetadata(): Promise;
Access level: public API|Class name: AVSessionController
Method or attribute name: getAVMetadata(): Promise;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: getOutputDevice(callback: AsyncCallback): void;
Access level: public API|Class name: AVSessionController
Method or attribute name: getOutputDevice(callback: AsyncCallback): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: getOutputDevice(): Promise;
Access level: public API|Class name: AVSessionController
Method or attribute name: getOutputDevice(): Promise;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: sendAVKeyEvent(event: KeyEvent, callback: AsyncCallback): void;
Access level: public API|Class name: AVSessionController
Method or attribute name: sendAVKeyEvent(event: KeyEvent, callback: AsyncCallback): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: sendAVKeyEvent(event: KeyEvent): Promise;
Access level: public API|Class name: AVSessionController
Method or attribute name: sendAVKeyEvent(event: KeyEvent): Promise;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: getLaunchAbility(callback: AsyncCallback): void;
Access level: public API|Class name: AVSessionController
Method or attribute name: getLaunchAbility(callback: AsyncCallback): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: getLaunchAbility(): Promise;
Access level: public API|Class name: AVSessionController
Method or attribute name: getLaunchAbility(): Promise;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: getRealPlaybackPositionSync(): number;
Access level: public API|Class name: AVSessionController
Method or attribute name: getRealPlaybackPositionSync(): number;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: isActive(callback: AsyncCallback): void;
Access level: public API|Class name: AVSessionController
Method or attribute name: isActive(callback: AsyncCallback): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: isActive(): Promise;
Access level: public API|Class name: AVSessionController
Method or attribute name: isActive(): Promise;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: destroy(callback: AsyncCallback): void;
Access level: public API|Class name: AVSessionController
Method or attribute name: destroy(callback: AsyncCallback): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: destroy(): Promise;
Access level: public API|Class name: AVSessionController
Method or attribute name: destroy(): Promise;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: getValidCommands(callback: AsyncCallback>): void;
Access level: public API|Class name: AVSessionController
Method or attribute name: getValidCommands(callback: AsyncCallback>): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: getValidCommands(): Promise>;
Access level: public API|Class name: AVSessionController
Method or attribute name: getValidCommands(): Promise>;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: sendControlCommand(command: AVControlCommand, callback: AsyncCallback): void;
Access level: public API|Class name: AVSessionController
Method or attribute name: sendControlCommand(command: AVControlCommand, callback: AsyncCallback): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: sendControlCommand(command: AVControlCommand): Promise;
Access level: public API|Class name: AVSessionController
Method or attribute name: sendControlCommand(command: AVControlCommand): Promise;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: on(type: 'metadataChange', filter: Array \| 'all', callback: (data: AVMetadata) => void);
Access level: public API|Class name: AVSessionController
Method or attribute name: on(type: 'metadataChange', filter: Array \| 'all', callback: (data: AVMetadata) => void);
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: on(type: 'playbackStateChange', filter: Array \| 'all', callback: (state: AVPlaybackState) => void);
Access level: public API|Class name: AVSessionController
Method or attribute name: on(type: 'playbackStateChange', filter: Array \| 'all', callback: (state: AVPlaybackState) => void);
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: on(type: 'sessionDestroy', callback: () => void);
Access level: public API|Class name: AVSessionController
Method or attribute name: on(type: 'sessionDestroy', callback: () => void);
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: on(type: 'activeStateChange', callback: (isActive: boolean) => void);
Access level: public API|Class name: AVSessionController
Method or attribute name: on(type: 'activeStateChange', callback: (isActive: boolean) => void);
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: on(type: 'validCommandChange', callback: (commands: Array) => void);
Access level: public API|Class name: AVSessionController
Method or attribute name: on(type: 'validCommandChange', callback: (commands: Array) => void);
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionController
Method or attribute name: on(type: 'outputDeviceChange', callback: (device: OutputDeviceInfo) => void): void;
Access level: public API|Class name: AVSessionController
Method or attribute name: on(type: 'outputDeviceChange', callback: (device: OutputDeviceInfo) => void): void;
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVControlCommand
Access level: public API|Class name: AVControlCommand
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: AVSessionErrorCode
Access level: public API|Class name: AVSessionErrorCode
Access level: system API|@ohos.multimedia.avsession.d.ts| +|Access level changed|Class name: camera
Access level: public API|Class name: camera
Access level: system API|@ohos.multimedia.camera.d.ts| +|Access level changed|Class name: AudioSourceType
Access level: system API|Class name: AudioSourceType
Access level: public API|@ohos.multimedia.media.d.ts| +|Access level changed|Class name: AudioSourceType
Method or attribute name: AUDIO_SOURCE_TYPE_DEFAULT = 0
Access level: system API|Class name: AudioSourceType
Method or attribute name: AUDIO_SOURCE_TYPE_DEFAULT = 0
Access level: public API|@ohos.multimedia.media.d.ts| +|Access level changed|Class name: AudioSourceType
Method or attribute name: AUDIO_SOURCE_TYPE_MIC = 1
Access level: system API|Class name: AudioSourceType
Method or attribute name: AUDIO_SOURCE_TYPE_MIC = 1
Access level: public API|@ohos.multimedia.media.d.ts| +|Access level changed|Class name: VideoSourceType
Access level: system API|Class name: VideoSourceType
Access level: public API|@ohos.multimedia.media.d.ts| +|Access level changed|Class name: VideoSourceType
Method or attribute name: VIDEO_SOURCE_TYPE_SURFACE_YUV = 0
Access level: system API|Class name: VideoSourceType
Method or attribute name: VIDEO_SOURCE_TYPE_SURFACE_YUV = 0
Access level: public API|@ohos.multimedia.media.d.ts| +|Access level changed|Class name: VideoSourceType
Method or attribute name: VIDEO_SOURCE_TYPE_SURFACE_ES = 1
Access level: system API|Class name: VideoSourceType
Method or attribute name: VIDEO_SOURCE_TYPE_SURFACE_ES = 1
Access level: public API|@ohos.multimedia.media.d.ts| +|Function changed|Class name: CameraInput
Method or attribute name: on(type: 'error', camera: CameraDevice, callback: ErrorCallback): void;
|Class name: CameraInput
Method or attribute name: on(type: 'error', camera: CameraDevice, callback: ErrorCallback): void;
|@ohos.multimedia.camera.d.ts| +|Function changed|Class name: CaptureSession
Method or attribute name: on(type: 'error', callback: ErrorCallback): void;
|Class name: CaptureSession
Method or attribute name: on(type: 'error', callback: ErrorCallback): void;
|@ohos.multimedia.camera.d.ts| +|Function changed|Class name: PreviewOutput
Method or attribute name: on(type: 'error', callback: ErrorCallback): void;
|Class name: PreviewOutput
Method or attribute name: on(type: 'error', callback: ErrorCallback): void;
|@ohos.multimedia.camera.d.ts| +|Function changed|Class name: PhotoOutput
Method or attribute name: capture(setting?: PhotoCaptureSetting): Promise;
|Class name: PhotoOutput
Method or attribute name: capture(): Promise;
|@ohos.multimedia.camera.d.ts| +|Function changed|Class name: PhotoOutput
Method or attribute name: on(type: 'error', callback: ErrorCallback): void;
|Class name: PhotoOutput
Method or attribute name: on(type: 'error', callback: ErrorCallback): void;
|@ohos.multimedia.camera.d.ts| +|Function changed|Class name: VideoOutput
Method or attribute name: on(type: 'error', callback: ErrorCallback): void;
|Class name: VideoOutput
Method or attribute name: on(type: 'error', callback: ErrorCallback): void;
|@ohos.multimedia.camera.d.ts| +|Function changed|Class name: MetadataOutput
Method or attribute name: on(type: 'error', callback: ErrorCallback): void;
|Class name: MetadataOutput
Method or attribute name: on(type: 'error', callback: ErrorCallback): void;
|@ohos.multimedia.camera.d.ts| diff --git a/en/release-notes/api-change/v3.2-beta5/js-apidiff-notification.md b/en/release-notes/api-change/v3.2-beta5/js-apidiff-notification.md new file mode 100644 index 0000000000000000000000000000000000000000..edce403f4df9304c5fd33ca609d57e08223e3674 --- /dev/null +++ b/en/release-notes/api-change/v3.2-beta5/js-apidiff-notification.md @@ -0,0 +1,16 @@ +| Change Type | Old Version | New Version | d.ts File | +| ---- | ------ | ------ | -------- | +|Added|NA|Module name: ohos.commonEventManager
Class name: Support
Method or attribute name: COMMON_EVENT_USER_INFO_UPDATED = "usual.event.USER_INFO_UPDATED"|@ohos.commonEventManager.d.ts| +|Deleted|Module name: ohos.notification
Class name: notification
Method or attribute name: function publishAsBundle(request: NotificationRequest, representativeBundle: string, userId: number, callback: AsyncCallback): void;|NA|@ohos.notification.d.ts| +|Deleted|Module name: ohos.notification
Class name: notification
Method or attribute name: function publishAsBundle(request: NotificationRequest, representativeBundle: string, userId: number): Promise;|NA|@ohos.notification.d.ts| +|Deleted|Module name: ohos.notification
Class name: notification
Method or attribute name: function cancelAsBundle(id: number, representativeBundle: string, userId: number, callback: AsyncCallback): void;|NA|@ohos.notification.d.ts| +|Deleted|Module name: ohos.notification
Class name: notification
Method or attribute name: function cancelAsBundle(id: number, representativeBundle: string, userId: number): Promise;|NA|@ohos.notification.d.ts| +|Deleted|Module name: ohos.notification
Class name: notification
Method or attribute name: function enableNotificationSlot(bundle: BundleOption, type: SlotType, enable: boolean, callback: AsyncCallback): void;|NA|@ohos.notification.d.ts| +|Deleted|Module name: ohos.notification
Class name: notification
Method or attribute name: function enableNotificationSlot(bundle: BundleOption, type: SlotType, enable: boolean): Promise;|NA|@ohos.notification.d.ts| +|Deleted|Module name: ohos.notification
Class name: notification
Method or attribute name: function isNotificationSlotEnabled(bundle: BundleOption, type: SlotType, callback: AsyncCallback): void;|NA|@ohos.notification.d.ts| +|Deleted|Module name: ohos.notification
Class name: notification
Method or attribute name: function isNotificationSlotEnabled(bundle: BundleOption, type: SlotType): Promise;|NA|@ohos.notification.d.ts| +|Deleted|Module name: ohos.notification
Class name: notification
Method or attribute name: function setSyncNotificationEnabledWithoutApp(userId: number, enable: boolean, callback: AsyncCallback): void;|NA|@ohos.notification.d.ts| +|Deleted|Module name: ohos.notification
Class name: notification
Method or attribute name: function setSyncNotificationEnabledWithoutApp(userId: number, enable: boolean): Promise;|NA|@ohos.notification.d.ts| +|Deleted|Module name: ohos.notification
Class name: notification
Method or attribute name: function getSyncNotificationEnabledWithoutApp(userId: number, callback: AsyncCallback): void;|NA|@ohos.notification.d.ts| +|Deleted|Module name: ohos.notification
Class name: notification
Method or attribute name: function getSyncNotificationEnabledWithoutApp(userId: number): Promise;|NA|@ohos.notification.d.ts| +|Initial version changed|Class name: RemoveReason
Initial version: 9|Class name: RemoveReason
Initial version: N/A|@ohos.notification.d.ts| diff --git a/en/release-notes/api-change/v3.2-beta5/js-apidiff-resource-scheduler.md b/en/release-notes/api-change/v3.2-beta5/js-apidiff-resource-scheduler.md new file mode 100644 index 0000000000000000000000000000000000000000..1617cb017ec7adeffd9f066195b5dd21fb53176f --- /dev/null +++ b/en/release-notes/api-change/v3.2-beta5/js-apidiff-resource-scheduler.md @@ -0,0 +1,66 @@ +| Change Type | Old Version | New Version | d.ts File | +| ---- | ------ | ------ | -------- | +|Deleted|Module name: ohos.backgroundTaskManager
Class name: backgroundTaskManager
Method or attribute name: function applyEfficiencyResources(request: EfficiencyResourcesRequest): boolean;|NA|@ohos.backgroundTaskManager.d.ts| +|Deleted|Module name: ohos.backgroundTaskManager
Class name: backgroundTaskManager
Method or attribute name: function resetAllEfficiencyResources(): void;|NA|@ohos.backgroundTaskManager.d.ts| +|Deleted|Module name: ohos.backgroundTaskManager
Class name: ResourceType|NA|@ohos.backgroundTaskManager.d.ts| +|Deleted|Module name: ohos.backgroundTaskManager
Class name: ResourceType
Method or attribute name: CPU = 1|NA|@ohos.backgroundTaskManager.d.ts| +|Deleted|Module name: ohos.backgroundTaskManager
Class name: ResourceType
Method or attribute name: COMMON_EVENT = 1 << 1|NA|@ohos.backgroundTaskManager.d.ts| +|Deleted|Module name: ohos.backgroundTaskManager
Class name: ResourceType
Method or attribute name: TIMER = 1 << 2|NA|@ohos.backgroundTaskManager.d.ts| +|Deleted|Module name: ohos.backgroundTaskManager
Class name: ResourceType
Method or attribute name: WORK_SCHEDULER = 1 << 3|NA|@ohos.backgroundTaskManager.d.ts| +|Deleted|Module name: ohos.backgroundTaskManager
Class name: ResourceType
Method or attribute name: BLUETOOTH = 1 << 4|NA|@ohos.backgroundTaskManager.d.ts| +|Deleted|Module name: ohos.backgroundTaskManager
Class name: ResourceType
Method or attribute name: GPS = 1 << 5|NA|@ohos.backgroundTaskManager.d.ts| +|Deleted|Module name: ohos.backgroundTaskManager
Class name: ResourceType
Method or attribute name: AUDIO = 1 << 6|NA|@ohos.backgroundTaskManager.d.ts| +|Deleted|Module name: ohos.backgroundTaskManager
Class name: EfficiencyResourcesRequest|NA|@ohos.backgroundTaskManager.d.ts| +|Deleted|Module name: ohos.backgroundTaskManager
Class name: EfficiencyResourcesRequest
Method or attribute name: resourceTypes: number;|NA|@ohos.backgroundTaskManager.d.ts| +|Deleted|Module name: ohos.backgroundTaskManager
Class name: EfficiencyResourcesRequest
Method or attribute name: isApply: boolean;|NA|@ohos.backgroundTaskManager.d.ts| +|Deleted|Module name: ohos.backgroundTaskManager
Class name: EfficiencyResourcesRequest
Method or attribute name: timeOut: number;|NA|@ohos.backgroundTaskManager.d.ts| +|Deleted|Module name: ohos.backgroundTaskManager
Class name: EfficiencyResourcesRequest
Method or attribute name: isPersist?: boolean;|NA|@ohos.backgroundTaskManager.d.ts| +|Deleted|Module name: ohos.backgroundTaskManager
Class name: EfficiencyResourcesRequest
Method or attribute name: isProcess?: boolean;|NA|@ohos.backgroundTaskManager.d.ts| +|Deleted|Module name: ohos.backgroundTaskManager
Class name: EfficiencyResourcesRequest
Method or attribute name: reason: string;|NA|@ohos.backgroundTaskManager.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: workScheduler|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: WorkInfo|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: WorkInfo
Method or attribute name: workId: number;|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: WorkInfo
Method or attribute name: bundleName: string;|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: WorkInfo
Method or attribute name: abilityName: string;|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: WorkInfo
Method or attribute name: isPersisted?: boolean;|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: WorkInfo
Method or attribute name: networkType?: NetworkType;|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: WorkInfo
Method or attribute name: isCharging?: boolean;|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: WorkInfo
Method or attribute name: chargerType?: ChargingType;|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: WorkInfo
Method or attribute name: batteryLevel?: number;|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: WorkInfo
Method or attribute name: batteryStatus?: BatteryStatus;|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: WorkInfo
Method or attribute name: storageRequest?: StorageRequest;|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: WorkInfo
Method or attribute name: repeatCycleTime?: number;|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: WorkInfo
Method or attribute name: isRepeat?: boolean;|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: WorkInfo
Method or attribute name: repeatCount?: number;|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: WorkInfo
Method or attribute name: isDeepIdle?: boolean;|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: WorkInfo
Method or attribute name: idleWaitTime?: number;|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: WorkInfo
Method or attribute name: parameters?: {[key: string]: any};|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: workScheduler
Method or attribute name: function startWork(work: WorkInfo): boolean;|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: workScheduler
Method or attribute name: function stopWork(work: WorkInfo, needCancel?: boolean): boolean;|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: workScheduler
Method or attribute name: function getWorkStatus(workId: number, callback: AsyncCallback): void;|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: workScheduler
Method or attribute name: function getWorkStatus(workId: number): Promise;|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: workScheduler
Method or attribute name: function obtainAllWorks(callback: AsyncCallback): Array;|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: workScheduler
Method or attribute name: function obtainAllWorks(): Promise>;|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: workScheduler
Method or attribute name: function stopAndClearWorks(): boolean;|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: workScheduler
Method or attribute name: function isLastWorkTimeOut(workId: number, callback: AsyncCallback): boolean;|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: workScheduler
Method or attribute name: function isLastWorkTimeOut(workId: number): Promise;|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: NetworkType|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: NetworkType
Method or attribute name: NETWORK_TYPE_ANY = 0|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: NetworkType
Method or attribute name: NETWORK_TYPE_MOBILE|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: NetworkType
Method or attribute name: NETWORK_TYPE_WIFI|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: NetworkType
Method or attribute name: NETWORK_TYPE_BLUETOOTH|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: NetworkType
Method or attribute name: NETWORK_TYPE_WIFI_P2P|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: NetworkType
Method or attribute name: NETWORK_TYPE_ETHERNET|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: ChargingType|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: ChargingType
Method or attribute name: CHARGING_PLUGGED_ANY = 0|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: ChargingType
Method or attribute name: CHARGING_PLUGGED_AC|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: ChargingType
Method or attribute name: CHARGING_PLUGGED_USB|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: ChargingType
Method or attribute name: CHARGING_PLUGGED_WIRELESS|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: BatteryStatus|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: BatteryStatus
Method or attribute name: BATTERY_STATUS_LOW = 0|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: BatteryStatus
Method or attribute name: BATTERY_STATUS_OKAY|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: BatteryStatus
Method or attribute name: BATTERY_STATUS_LOW_OR_OKAY|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: StorageRequest|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: StorageRequest
Method or attribute name: STORAGE_LEVEL_LOW = 0|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: StorageRequest
Method or attribute name: STORAGE_LEVEL_OKAY|NA|@ohos.workScheduler.d.ts| +|Deleted|Module name: ohos.workScheduler
Class name: StorageRequest
Method or attribute name: STORAGE_LEVEL_LOW_OR_OKAY|NA|@ohos.workScheduler.d.ts| diff --git a/en/release-notes/api-change/v3.2-beta5/js-apidiff-security.md b/en/release-notes/api-change/v3.2-beta5/js-apidiff-security.md new file mode 100644 index 0000000000000000000000000000000000000000..57f7cc21ab108fab763bb8e20068864a65efd5aa --- /dev/null +++ b/en/release-notes/api-change/v3.2-beta5/js-apidiff-security.md @@ -0,0 +1,257 @@ +| Change Type | Old Version | New Version | d.ts File | +| ---- | ------ | ------ | -------- | +|Added|NA|Module name: ohos.abilityAccessCtrl
Class name: AtManager
Method or attribute name: requestPermissionsFromUser(context: Context, permissions: Array, requestCallback: AsyncCallback) : void;|@ohos.abilityAccessCtrl.d.ts| +|Added|NA|Module name: ohos.abilityAccessCtrl
Class name: AtManager
Method or attribute name: requestPermissionsFromUser(context: Context, permissions: Array) : Promise;|@ohos.abilityAccessCtrl.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: cert|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: CertResult|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: CertResult
Method or attribute name: INVALID_PARAMS = 401|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: CertResult
Method or attribute name: NOT_SUPPORT = 801|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: CertResult
Method or attribute name: ERR_OUT_OF_MEMORY = 19020001|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: CertResult
Method or attribute name: ERR_RUNTIME_ERROR = 19020002|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: CertResult
Method or attribute name: ERR_CRYPTO_OPERATION = 19030001|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: CertResult
Method or attribute name: ERR_CERT_SIGNATURE_FAILURE = 19030002|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: CertResult
Method or attribute name: ERR_CERT_NOT_YET_VALID = 19030003|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: CertResult
Method or attribute name: ERR_CERT_HAS_EXPIRED = 19030004|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: CertResult
Method or attribute name: ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY = 19030005|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: CertResult
Method or attribute name: ERR_KEYUSAGE_NO_CERTSIGN = 19030006|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: CertResult
Method or attribute name: ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE = 19030007|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: DataBlob|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: DataBlob
Method or attribute name: data : Uint8Array;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: DataArray|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: DataArray
Method or attribute name: data : Array;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: EncodingFormat|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: EncodingFormat
Method or attribute name: FORMAT_DER = 0|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: EncodingFormat
Method or attribute name: FORMAT_PEM = 1|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: EncodingBlob|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: EncodingBlob
Method or attribute name: data : Uint8Array;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: EncodingBlob
Method or attribute name: encodingFormat : EncodingFormat;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: CertChainData|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: CertChainData
Method or attribute name: data: Uint8Array;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: CertChainData
Method or attribute name: count : number;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: CertChainData
Method or attribute name: encodingFormat: EncodingFormat;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Cert|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Cert
Method or attribute name: verify(key : cryptoFramework.PubKey, callback : AsyncCallback) : void;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Cert
Method or attribute name: verify(key : cryptoFramework.PubKey) : Promise;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Cert
Method or attribute name: getEncoded(callback : AsyncCallback) : void;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Cert
Method or attribute name: getEncoded() : Promise;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Cert
Method or attribute name: getPublicKey() : cryptoFramework.PubKey;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Cert
Method or attribute name: checkValidityWithDate(date: string) : void;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Cert
Method or attribute name: getVersion() : number;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Cert
Method or attribute name: getSerialNumber() : number;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Cert
Method or attribute name: getIssuerName() : DataBlob;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Cert
Method or attribute name: getSubjectName() : DataBlob;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Cert
Method or attribute name: getNotBeforeTime() : string;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Cert
Method or attribute name: getNotAfterTime() : string;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Cert
Method or attribute name: getSignature() : DataBlob;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Cert
Method or attribute name: getSignatureAlgName() : string;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Cert
Method or attribute name: getSignatureAlgOid() : string;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Cert
Method or attribute name: getSignatureAlgParams() : DataBlob;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Cert
Method or attribute name: getKeyUsage() : DataBlob;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Cert
Method or attribute name: getExtKeyUsage() : DataArray;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Cert
Method or attribute name: getBasicConstraints() : number;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Cert
Method or attribute name: getSubjectAltNames() : DataArray;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Cert
Method or attribute name: getIssuerAltNames() : DataArray;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: cert
Method or attribute name: function createX509Cert(inStream : EncodingBlob, callback : AsyncCallback) : void;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: cert
Method or attribute name: function createX509Cert(inStream : EncodingBlob) : Promise;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509CrlEntry|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509CrlEntry
Method or attribute name: getEncoded(callback : AsyncCallback) : void;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509CrlEntry
Method or attribute name: getEncoded() : Promise;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509CrlEntry
Method or attribute name: getSerialNumber() : number;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509CrlEntry
Method or attribute name: getCertIssuer() : DataBlob;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509CrlEntry
Method or attribute name: getRevocationDate() : string;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Crl|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Crl
Method or attribute name: isRevoked(cert : X509Cert) : boolean;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Crl
Method or attribute name: getType() : string;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Crl
Method or attribute name: getEncoded(callback : AsyncCallback) : void;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Crl
Method or attribute name: getEncoded() : Promise;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Crl
Method or attribute name: verify(key : cryptoFramework.PubKey, callback : AsyncCallback) : void;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Crl
Method or attribute name: verify(key : cryptoFramework.PubKey) : Promise;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Crl
Method or attribute name: getVersion() : number;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Crl
Method or attribute name: getIssuerName() : DataBlob;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Crl
Method or attribute name: getLastUpdate() : string;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Crl
Method or attribute name: getNextUpdate() : string;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Crl
Method or attribute name: getRevokedCert(serialNumber : number) : X509CrlEntry;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Crl
Method or attribute name: getRevokedCertWithCert(cert : X509Cert) : X509CrlEntry;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Crl
Method or attribute name: getRevokedCerts(callback : AsyncCallback>) : void;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Crl
Method or attribute name: getRevokedCerts() : Promise>;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Crl
Method or attribute name: getTbsInfo() : DataBlob;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Crl
Method or attribute name: getSignature() : DataBlob;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Crl
Method or attribute name: getSignatureAlgName() : string;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Crl
Method or attribute name: getSignatureAlgOid() : string;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: X509Crl
Method or attribute name: getSignatureAlgParams() : DataBlob;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: cert
Method or attribute name: function createX509Crl(inStream : EncodingBlob, callback : AsyncCallback) : void;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: cert
Method or attribute name: function createX509Crl(inStream : EncodingBlob) : Promise;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: CertChainValidator|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: CertChainValidator
Method or attribute name: validate(certChain : CertChainData, callback : AsyncCallback) : void;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: CertChainValidator
Method or attribute name: validate(certChain : CertChainData) : Promise;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: CertChainValidator
Method or attribute name: readonly algorithm : string;|@ohos.security.cert.d.ts| +|Added|NA|Module name: ohos.security.cert
Class name: cert
Method or attribute name: function createCertChainValidator(algorithm :string) : CertChainValidator;|@ohos.security.cert.d.ts| +|Added|NA|Class name: Random
Method or attribute name: setSeed(seed : DataBlob) : void;|@ohos.security.cryptoFramework.d.ts| +|Added|NA|Module name: PermissionRequestResult
Class name: PermissionRequestResult|PermissionRequestResult.d.ts| +|Added|NA|Module name: PermissionRequestResult
Class name: PermissionRequestResult
Method or attribute name: permissions: Array;|PermissionRequestResult.d.ts| +|Added|NA|Module name: PermissionRequestResult
Class name: PermissionRequestResult
Method or attribute name: authResults: Array;|PermissionRequestResult.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: Result
Method or attribute name: ERR_CERT_SIGNATURE_FAILURE = 17630002|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: Result
Method or attribute name: ERR_CERT_NOT_YET_VALID = 17630003|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: Result
Method or attribute name: ERR_CERT_HAS_EXPIRED = 17630004|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: Result
Method or attribute name: ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY = 17630005|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: Result
Method or attribute name: ERR_KEYUSAGE_NO_CERTSIGN = 17630006|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: Result
Method or attribute name: ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE = 17630007|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: DataArray|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: DataArray
Method or attribute name: data : Array;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: EncodingFormat|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: EncodingFormat
Method or attribute name: FORMAT_DER = 0|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: EncodingFormat
Method or attribute name: FORMAT_PEM = 1|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: EncodingBlob|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: EncodingBlob
Method or attribute name: data : Uint8Array;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: EncodingBlob
Method or attribute name: encodingFormat : EncodingFormat;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: CertChainData|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: CertChainData
Method or attribute name: data: Uint8Array;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: CertChainData
Method or attribute name: count : number;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: CertChainData
Method or attribute name: encodingFormat: EncodingFormat;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Cert|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Cert
Method or attribute name: verify(key : PubKey, callback : AsyncCallback) : void;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Cert
Method or attribute name: verify(key : PubKey) : Promise;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Cert
Method or attribute name: getEncoded(callback : AsyncCallback) : void;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Cert
Method or attribute name: getEncoded() : Promise;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Cert
Method or attribute name: getPublicKey(callback : AsyncCallback) : void;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Cert
Method or attribute name: getPublicKey() : Promise;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Cert
Method or attribute name: checkValidityWithDate(date: string, callback : AsyncCallback) : void;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Cert
Method or attribute name: checkValidityWithDate(date: string) : Promise;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Cert
Method or attribute name: getVersion() : number;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Cert
Method or attribute name: getSerialNumber() : number;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Cert
Method or attribute name: getIssuerName() : DataBlob;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Cert
Method or attribute name: getSubjectName() : DataBlob;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Cert
Method or attribute name: getNotBeforeTime() : string;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Cert
Method or attribute name: getNotAfterTime() : string;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Cert
Method or attribute name: getSignature() : DataBlob;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Cert
Method or attribute name: getSignatureAlgName() : string;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Cert
Method or attribute name: getSignatureAlgOid() : string;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Cert
Method or attribute name: getSignatureAlgParams() : DataBlob;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Cert
Method or attribute name: getKeyUsage() : DataBlob;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Cert
Method or attribute name: getExtKeyUsage() : DataArray;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Cert
Method or attribute name: getBasicConstraints() : number;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Cert
Method or attribute name: getSubjectAltNames() : DataArray;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Cert
Method or attribute name: getIssuerAltNames() : DataArray;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: cryptoFramework
Method or attribute name: function createX509Cert(inStream : EncodingBlob, callback : AsyncCallback) : void;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: cryptoFramework
Method or attribute name: function createX509Cert(inStream : EncodingBlob) : Promise;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509CrlEntry|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509CrlEntry
Method or attribute name: getEncoded(callback : AsyncCallback) : void;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509CrlEntry
Method or attribute name: getEncoded() : Promise;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509CrlEntry
Method or attribute name: getSerialNumber() : number;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509CrlEntry
Method or attribute name: getCertIssuer(callback : AsyncCallback) : void;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509CrlEntry
Method or attribute name: getCertIssuer() : Promise;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509CrlEntry
Method or attribute name: getRevocationDate(callback : AsyncCallback) : void;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509CrlEntry
Method or attribute name: getRevocationDate() : Promise;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Crl|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Crl
Method or attribute name: isRevoked(cert : X509Cert, callback : AsyncCallback) : void;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Crl
Method or attribute name: isRevoked(cert : X509Cert) : Promise;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Crl
Method or attribute name: getType() : string;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Crl
Method or attribute name: getEncoded(callback : AsyncCallback) : void;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Crl
Method or attribute name: getEncoded() : Promise;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Crl
Method or attribute name: verify(key : PubKey, callback : AsyncCallback) : void;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Crl
Method or attribute name: verify(key : PubKey) : Promise;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Crl
Method or attribute name: getVersion() : number;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Crl
Method or attribute name: getIssuerName() : DataBlob;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Crl
Method or attribute name: getLastUpdate() : string;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Crl
Method or attribute name: getNextUpdate() : string;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Crl
Method or attribute name: getRevokedCert(serialNumber : number, callback : AsyncCallback) : void;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Crl
Method or attribute name: getRevokedCert(serialNumber : number) : Promise;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Crl
Method or attribute name: getRevokedCertWithCert(cert : X509Cert, callback : AsyncCallback) : void;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Crl
Method or attribute name: getRevokedCertWithCert(cert : X509Cert) : Promise;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Crl
Method or attribute name: getRevokedCerts(callback : AsyncCallback>) : void;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Crl
Method or attribute name: getRevokedCerts() : Promise>;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Crl
Method or attribute name: getTbsInfo(callback : AsyncCallback) : void;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Crl
Method or attribute name: getTbsInfo() : Promise;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Crl
Method or attribute name: getSignature() : DataBlob;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Crl
Method or attribute name: getSignatureAlgName() : string;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Crl
Method or attribute name: getSignatureAlgOid() : string;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: X509Crl
Method or attribute name: getSignatureAlgParams() : DataBlob;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: cryptoFramework
Method or attribute name: function createX509Crl(inStream : EncodingBlob, callback : AsyncCallback) : void;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: cryptoFramework
Method or attribute name: function createX509Crl(inStream : EncodingBlob) : Promise;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: CertChainValidator|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: CertChainValidator
Method or attribute name: validate(certChain : CertChainData, callback : AsyncCallback) : void;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: CertChainValidator
Method or attribute name: validate(certChain : CertChainData) : Promise;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: CertChainValidator
Method or attribute name: readonly algorithm : string;|NA|@ohos.security.cryptoFramework.d.ts| +|Deleted|Module name: ohos.security.cryptoFramework
Class name: cryptoFramework
Method or attribute name: function createCertChainValidator(algorithm :string) : CertChainValidator;|NA|@ohos.security.cryptoFramework.d.ts| +|Deprecated version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_INVALID = HuksTagType.HUKS_TAG_TYPE_INVALID \| 0
Deprecated version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_INVALID = HuksTagType.HUKS_TAG_TYPE_INVALID \| 0
Deprecated version: 9
Substitute API: N/A|@ohos.security.huks.d.ts| +|Deprecated version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_PWD = HuksTagType.HUKS_TAG_TYPE_BYTES \| 13
Deprecated version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_PWD = HuksTagType.HUKS_TAG_TYPE_BYTES \| 13
Deprecated version: 9
Substitute API: N/A|@ohos.security.huks.d.ts| +|Deprecated version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_DERIVE_MAIN_KEY = HuksTagType.HUKS_TAG_TYPE_BYTES \| 16
Deprecated version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_DERIVE_MAIN_KEY = HuksTagType.HUKS_TAG_TYPE_BYTES \| 16
Deprecated version: 9
Substitute API: N/A|@ohos.security.huks.d.ts| +|Deprecated version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_DERIVE_FACTOR = HuksTagType.HUKS_TAG_TYPE_BYTES \| 17
Deprecated version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_DERIVE_FACTOR = HuksTagType.HUKS_TAG_TYPE_BYTES \| 17
Deprecated version: 9
Substitute API: N/A|@ohos.security.huks.d.ts| +|Deprecated version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_DERIVE_ALG = HuksTagType.HUKS_TAG_TYPE_UINT \| 18
Deprecated version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_DERIVE_ALG = HuksTagType.HUKS_TAG_TYPE_UINT \| 18
Deprecated version: 9
Substitute API: N/A|@ohos.security.huks.d.ts| +|Deprecated version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_ACTIVE_DATETIME = HuksTagType.HUKS_TAG_TYPE_ULONG \| 201
Deprecated version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_ACTIVE_DATETIME = HuksTagType.HUKS_TAG_TYPE_ULONG \| 201
Deprecated version: 9
Substitute API: N/A|@ohos.security.huks.d.ts| +|Deprecated version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_ORIGINATION_EXPIRE_DATETIME = HuksTagType.HUKS_TAG_TYPE_ULONG \| 202
Deprecated version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_ORIGINATION_EXPIRE_DATETIME = HuksTagType.HUKS_TAG_TYPE_ULONG \| 202
Deprecated version: 9
Substitute API: N/A|@ohos.security.huks.d.ts| +|Deprecated version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_USAGE_EXPIRE_DATETIME = HuksTagType.HUKS_TAG_TYPE_ULONG \| 203
Deprecated version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_USAGE_EXPIRE_DATETIME = HuksTagType.HUKS_TAG_TYPE_ULONG \| 203
Deprecated version: 9
Substitute API: N/A|@ohos.security.huks.d.ts| +|Deprecated version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_CREATION_DATETIME = HuksTagType.HUKS_TAG_TYPE_ULONG \| 204
Deprecated version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_CREATION_DATETIME = HuksTagType.HUKS_TAG_TYPE_ULONG \| 204
Deprecated version: 9
Substitute API: N/A|@ohos.security.huks.d.ts| +|Deprecated version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_ATTESTATION_ID_BRAND = HuksTagType.HUKS_TAG_TYPE_BYTES \| 503
Deprecated version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_ATTESTATION_ID_BRAND = HuksTagType.HUKS_TAG_TYPE_BYTES \| 503
Deprecated version: 9
Substitute API: N/A|@ohos.security.huks.d.ts| +|Deprecated version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_ATTESTATION_ID_DEVICE = HuksTagType.HUKS_TAG_TYPE_BYTES \| 504
Deprecated version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_ATTESTATION_ID_DEVICE = HuksTagType.HUKS_TAG_TYPE_BYTES \| 504
Deprecated version: 9
Substitute API: N/A|@ohos.security.huks.d.ts| +|Deprecated version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_ATTESTATION_ID_PRODUCT = HuksTagType.HUKS_TAG_TYPE_BYTES \| 505
Deprecated version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_ATTESTATION_ID_PRODUCT = HuksTagType.HUKS_TAG_TYPE_BYTES \| 505
Deprecated version: 9
Substitute API: N/A|@ohos.security.huks.d.ts| +|Deprecated version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_ATTESTATION_ID_SERIAL = HuksTagType.HUKS_TAG_TYPE_BYTES \| 506
Deprecated version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_ATTESTATION_ID_SERIAL = HuksTagType.HUKS_TAG_TYPE_BYTES \| 506
Deprecated version: 9
Substitute API: N/A|@ohos.security.huks.d.ts| +|Deprecated version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_ATTESTATION_ID_IMEI = HuksTagType.HUKS_TAG_TYPE_BYTES \| 507
Deprecated version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_ATTESTATION_ID_IMEI = HuksTagType.HUKS_TAG_TYPE_BYTES \| 507
Deprecated version: 9
Substitute API: N/A|@ohos.security.huks.d.ts| +|Deprecated version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_ATTESTATION_ID_MEID = HuksTagType.HUKS_TAG_TYPE_BYTES \| 508
Deprecated version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_ATTESTATION_ID_MEID = HuksTagType.HUKS_TAG_TYPE_BYTES \| 508
Deprecated version: 9
Substitute API: N/A|@ohos.security.huks.d.ts| +|Deprecated version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_ATTESTATION_ID_MANUFACTURER = HuksTagType.HUKS_TAG_TYPE_BYTES \| 509
Deprecated version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_ATTESTATION_ID_MANUFACTURER = HuksTagType.HUKS_TAG_TYPE_BYTES \| 509
Deprecated version: 9
Substitute API: N/A|@ohos.security.huks.d.ts| +|Deprecated version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_ATTESTATION_ID_MODEL = HuksTagType.HUKS_TAG_TYPE_BYTES \| 510
Deprecated version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_ATTESTATION_ID_MODEL = HuksTagType.HUKS_TAG_TYPE_BYTES \| 510
Deprecated version: 9
Substitute API: N/A|@ohos.security.huks.d.ts| +|Deprecated version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_ATTESTATION_ID_SOCID = HuksTagType.HUKS_TAG_TYPE_BYTES \| 512
Deprecated version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_ATTESTATION_ID_SOCID = HuksTagType.HUKS_TAG_TYPE_BYTES \| 512
Deprecated version: 9
Substitute API: N/A|@ohos.security.huks.d.ts| +|Deprecated version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_ATTESTATION_ID_UDID = HuksTagType.HUKS_TAG_TYPE_BYTES \| 513
Deprecated version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_ATTESTATION_ID_UDID = HuksTagType.HUKS_TAG_TYPE_BYTES \| 513
Deprecated version: 9
Substitute API: N/A|@ohos.security.huks.d.ts| +|Deprecated version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_SECURE_KEY_ALIAS = HuksTagType.HUKS_TAG_TYPE_BOOL \| 1009
Deprecated version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_SECURE_KEY_ALIAS = HuksTagType.HUKS_TAG_TYPE_BOOL \| 1009
Deprecated version: 9
Substitute API: N/A|@ohos.security.huks.d.ts| +|Deprecated version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_SECURE_KEY_UUID = HuksTagType.HUKS_TAG_TYPE_BYTES \| 1010
Deprecated version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_SECURE_KEY_UUID = HuksTagType.HUKS_TAG_TYPE_BYTES \| 1010
Deprecated version: 9
Substitute API: N/A|@ohos.security.huks.d.ts| +|Deprecated version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_PROCESS_NAME = HuksTagType.HUKS_TAG_TYPE_BYTES \| 10001
Deprecated version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_PROCESS_NAME = HuksTagType.HUKS_TAG_TYPE_BYTES \| 10001
Deprecated version: 9
Substitute API: N/A|@ohos.security.huks.d.ts| +|Deprecated version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_PACKAGE_NAME = HuksTagType.HUKS_TAG_TYPE_BYTES \| 10002
Deprecated version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_PACKAGE_NAME = HuksTagType.HUKS_TAG_TYPE_BYTES \| 10002
Deprecated version: 9
Substitute API: N/A|@ohos.security.huks.d.ts| +|Deprecated version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_ACCESS_TIME = HuksTagType.HUKS_TAG_TYPE_UINT \| 10003
Deprecated version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_ACCESS_TIME = HuksTagType.HUKS_TAG_TYPE_UINT \| 10003
Deprecated version: 9
Substitute API: N/A|@ohos.security.huks.d.ts| +|Deprecated version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_USES_TIME = HuksTagType.HUKS_TAG_TYPE_UINT \| 10004
Deprecated version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_USES_TIME = HuksTagType.HUKS_TAG_TYPE_UINT \| 10004
Deprecated version: 9
Substitute API: N/A|@ohos.security.huks.d.ts| +|Deprecated version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_CRYPTO_CTX = HuksTagType.HUKS_TAG_TYPE_ULONG \| 10005
Deprecated version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_CRYPTO_CTX = HuksTagType.HUKS_TAG_TYPE_ULONG \| 10005
Deprecated version: 9
Substitute API: N/A|@ohos.security.huks.d.ts| +|Deprecated version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_KEY_VERSION = HuksTagType.HUKS_TAG_TYPE_UINT \| 10007
Deprecated version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_KEY_VERSION = HuksTagType.HUKS_TAG_TYPE_UINT \| 10007
Deprecated version: 9
Substitute API: N/A|@ohos.security.huks.d.ts| +|Deprecated version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_PAYLOAD_LEN = HuksTagType.HUKS_TAG_TYPE_UINT \| 10008
Deprecated version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_PAYLOAD_LEN = HuksTagType.HUKS_TAG_TYPE_UINT \| 10008
Deprecated version: 9
Substitute API: N/A|@ohos.security.huks.d.ts| +|Deprecated version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_IS_KEY_HANDLE = HuksTagType.HUKS_TAG_TYPE_ULONG \| 10010
Deprecated version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_IS_KEY_HANDLE = HuksTagType.HUKS_TAG_TYPE_ULONG \| 10010
Deprecated version: 9
Substitute API: N/A|@ohos.security.huks.d.ts| +|Deprecated version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_OS_VERSION = HuksTagType.HUKS_TAG_TYPE_UINT \| 10101
Deprecated version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_OS_VERSION = HuksTagType.HUKS_TAG_TYPE_UINT \| 10101
Deprecated version: 9
Substitute API: N/A|@ohos.security.huks.d.ts| +|Deprecated version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_OS_PATCHLEVEL = HuksTagType.HUKS_TAG_TYPE_UINT \| 10102
Deprecated version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_OS_PATCHLEVEL = HuksTagType.HUKS_TAG_TYPE_UINT \| 10102
Deprecated version: 9
Substitute API: N/A|@ohos.security.huks.d.ts| +|Initial version changed|Class name: SymKey
Initial version: N/A|Class name: SymKey
Initial version: 9|@ohos.security.cryptoFramework.d.ts| +|Initial version changed|Class name: SymKey
Method or attribute name: clearMem() : void;
Initial version: N/A|Class name: SymKey
Method or attribute name: clearMem() : void;
Initial version: 9|@ohos.security.cryptoFramework.d.ts| +|Initial version changed|Class name: Random
Initial version: N/A|Class name: Random
Initial version: 9|@ohos.security.cryptoFramework.d.ts| +|Initial version changed|Class name: Cipher
Initial version: N/A|Class name: Cipher
Initial version: 9|@ohos.security.cryptoFramework.d.ts| +|Initial version changed|Class name: KeyAgreement
Initial version: N/A|Class name: KeyAgreement
Initial version: 9|@ohos.security.cryptoFramework.d.ts| +|Initial version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_INVALID = HuksTagType.HUKS_TAG_TYPE_INVALID \| 0
Initial version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_INVALID = HuksTagType.HUKS_TAG_TYPE_INVALID \| 0
Initial version: 8|@ohos.security.huks.d.ts| +|Initial version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_PWD = HuksTagType.HUKS_TAG_TYPE_BYTES \| 13
Initial version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_PWD = HuksTagType.HUKS_TAG_TYPE_BYTES \| 13
Initial version: 8|@ohos.security.huks.d.ts| +|Initial version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_DERIVE_MAIN_KEY = HuksTagType.HUKS_TAG_TYPE_BYTES \| 16
Initial version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_DERIVE_MAIN_KEY = HuksTagType.HUKS_TAG_TYPE_BYTES \| 16
Initial version: 8|@ohos.security.huks.d.ts| +|Initial version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_DERIVE_FACTOR = HuksTagType.HUKS_TAG_TYPE_BYTES \| 17
Initial version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_DERIVE_FACTOR = HuksTagType.HUKS_TAG_TYPE_BYTES \| 17
Initial version: 8|@ohos.security.huks.d.ts| +|Initial version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_DERIVE_ALG = HuksTagType.HUKS_TAG_TYPE_UINT \| 18
Initial version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_DERIVE_ALG = HuksTagType.HUKS_TAG_TYPE_UINT \| 18
Initial version: 8|@ohos.security.huks.d.ts| +|Initial version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_ACTIVE_DATETIME = HuksTagType.HUKS_TAG_TYPE_ULONG \| 201
Initial version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_ACTIVE_DATETIME = HuksTagType.HUKS_TAG_TYPE_ULONG \| 201
Initial version: 8|@ohos.security.huks.d.ts| +|Initial version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_ORIGINATION_EXPIRE_DATETIME = HuksTagType.HUKS_TAG_TYPE_ULONG \| 202
Initial version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_ORIGINATION_EXPIRE_DATETIME = HuksTagType.HUKS_TAG_TYPE_ULONG \| 202
Initial version: 8|@ohos.security.huks.d.ts| +|Initial version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_USAGE_EXPIRE_DATETIME = HuksTagType.HUKS_TAG_TYPE_ULONG \| 203
Initial version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_USAGE_EXPIRE_DATETIME = HuksTagType.HUKS_TAG_TYPE_ULONG \| 203
Initial version: 8|@ohos.security.huks.d.ts| +|Initial version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_CREATION_DATETIME = HuksTagType.HUKS_TAG_TYPE_ULONG \| 204
Initial version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_CREATION_DATETIME = HuksTagType.HUKS_TAG_TYPE_ULONG \| 204
Initial version: 8|@ohos.security.huks.d.ts| +|Initial version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_ATTESTATION_ID_BRAND = HuksTagType.HUKS_TAG_TYPE_BYTES \| 503
Initial version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_ATTESTATION_ID_BRAND = HuksTagType.HUKS_TAG_TYPE_BYTES \| 503
Initial version: 8|@ohos.security.huks.d.ts| +|Initial version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_ATTESTATION_ID_DEVICE = HuksTagType.HUKS_TAG_TYPE_BYTES \| 504
Initial version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_ATTESTATION_ID_DEVICE = HuksTagType.HUKS_TAG_TYPE_BYTES \| 504
Initial version: 8|@ohos.security.huks.d.ts| +|Initial version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_ATTESTATION_ID_PRODUCT = HuksTagType.HUKS_TAG_TYPE_BYTES \| 505
Initial version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_ATTESTATION_ID_PRODUCT = HuksTagType.HUKS_TAG_TYPE_BYTES \| 505
Initial version: 8|@ohos.security.huks.d.ts| +|Initial version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_ATTESTATION_ID_SERIAL = HuksTagType.HUKS_TAG_TYPE_BYTES \| 506
Initial version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_ATTESTATION_ID_SERIAL = HuksTagType.HUKS_TAG_TYPE_BYTES \| 506
Initial version: 8|@ohos.security.huks.d.ts| +|Initial version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_ATTESTATION_ID_IMEI = HuksTagType.HUKS_TAG_TYPE_BYTES \| 507
Initial version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_ATTESTATION_ID_IMEI = HuksTagType.HUKS_TAG_TYPE_BYTES \| 507
Initial version: 8|@ohos.security.huks.d.ts| +|Initial version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_ATTESTATION_ID_MEID = HuksTagType.HUKS_TAG_TYPE_BYTES \| 508
Initial version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_ATTESTATION_ID_MEID = HuksTagType.HUKS_TAG_TYPE_BYTES \| 508
Initial version: 8|@ohos.security.huks.d.ts| +|Initial version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_ATTESTATION_ID_MANUFACTURER = HuksTagType.HUKS_TAG_TYPE_BYTES \| 509
Initial version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_ATTESTATION_ID_MANUFACTURER = HuksTagType.HUKS_TAG_TYPE_BYTES \| 509
Initial version: 8|@ohos.security.huks.d.ts| +|Initial version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_ATTESTATION_ID_MODEL = HuksTagType.HUKS_TAG_TYPE_BYTES \| 510
Initial version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_ATTESTATION_ID_MODEL = HuksTagType.HUKS_TAG_TYPE_BYTES \| 510
Initial version: 8|@ohos.security.huks.d.ts| +|Initial version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_ATTESTATION_ID_SOCID = HuksTagType.HUKS_TAG_TYPE_BYTES \| 512
Initial version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_ATTESTATION_ID_SOCID = HuksTagType.HUKS_TAG_TYPE_BYTES \| 512
Initial version: 8|@ohos.security.huks.d.ts| +|Initial version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_ATTESTATION_ID_UDID = HuksTagType.HUKS_TAG_TYPE_BYTES \| 513
Initial version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_ATTESTATION_ID_UDID = HuksTagType.HUKS_TAG_TYPE_BYTES \| 513
Initial version: 8|@ohos.security.huks.d.ts| +|Initial version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_SECURE_KEY_ALIAS = HuksTagType.HUKS_TAG_TYPE_BOOL \| 1009
Initial version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_SECURE_KEY_ALIAS = HuksTagType.HUKS_TAG_TYPE_BOOL \| 1009
Initial version: 8|@ohos.security.huks.d.ts| +|Initial version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_SECURE_KEY_UUID = HuksTagType.HUKS_TAG_TYPE_BYTES \| 1010
Initial version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_SECURE_KEY_UUID = HuksTagType.HUKS_TAG_TYPE_BYTES \| 1010
Initial version: 8|@ohos.security.huks.d.ts| +|Initial version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_PROCESS_NAME = HuksTagType.HUKS_TAG_TYPE_BYTES \| 10001
Initial version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_PROCESS_NAME = HuksTagType.HUKS_TAG_TYPE_BYTES \| 10001
Initial version: 8|@ohos.security.huks.d.ts| +|Initial version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_PACKAGE_NAME = HuksTagType.HUKS_TAG_TYPE_BYTES \| 10002
Initial version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_PACKAGE_NAME = HuksTagType.HUKS_TAG_TYPE_BYTES \| 10002
Initial version: 8|@ohos.security.huks.d.ts| +|Initial version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_ACCESS_TIME = HuksTagType.HUKS_TAG_TYPE_UINT \| 10003
Initial version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_ACCESS_TIME = HuksTagType.HUKS_TAG_TYPE_UINT \| 10003
Initial version: 8|@ohos.security.huks.d.ts| +|Initial version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_USES_TIME = HuksTagType.HUKS_TAG_TYPE_UINT \| 10004
Initial version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_USES_TIME = HuksTagType.HUKS_TAG_TYPE_UINT \| 10004
Initial version: 8|@ohos.security.huks.d.ts| +|Initial version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_CRYPTO_CTX = HuksTagType.HUKS_TAG_TYPE_ULONG \| 10005
Initial version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_CRYPTO_CTX = HuksTagType.HUKS_TAG_TYPE_ULONG \| 10005
Initial version: 8|@ohos.security.huks.d.ts| +|Initial version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_KEY_VERSION = HuksTagType.HUKS_TAG_TYPE_UINT \| 10007
Initial version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_KEY_VERSION = HuksTagType.HUKS_TAG_TYPE_UINT \| 10007
Initial version: 8|@ohos.security.huks.d.ts| +|Initial version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_PAYLOAD_LEN = HuksTagType.HUKS_TAG_TYPE_UINT \| 10008
Initial version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_PAYLOAD_LEN = HuksTagType.HUKS_TAG_TYPE_UINT \| 10008
Initial version: 8|@ohos.security.huks.d.ts| +|Initial version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_IS_KEY_HANDLE = HuksTagType.HUKS_TAG_TYPE_ULONG \| 10010
Initial version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_IS_KEY_HANDLE = HuksTagType.HUKS_TAG_TYPE_ULONG \| 10010
Initial version: 8|@ohos.security.huks.d.ts| +|Initial version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_OS_VERSION = HuksTagType.HUKS_TAG_TYPE_UINT \| 10101
Initial version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_OS_VERSION = HuksTagType.HUKS_TAG_TYPE_UINT \| 10101
Initial version: 8|@ohos.security.huks.d.ts| +|Initial version changed|Class name: HuksTag
Method or attribute name: HUKS_TAG_OS_PATCHLEVEL = HuksTagType.HUKS_TAG_TYPE_UINT \| 10102
Initial version: N/A|Class name: HuksTag
Method or attribute name: HUKS_TAG_OS_PATCHLEVEL = HuksTagType.HUKS_TAG_TYPE_UINT \| 10102
Initial version: 8|@ohos.security.huks.d.ts| +|Error code added|NA|Class name: AsyKeyGenerator
Method or attribute name: generateKeyPair() : Promise;
Error code: 401, 17620001|@ohos.security.cryptoFramework.d.ts| +|Error code added|NA|Class name: AsyKeyGenerator
Method or attribute name: convertKey(pubKey : DataBlob, priKey : DataBlob) : Promise;
Error code: 401, 17620001|@ohos.security.cryptoFramework.d.ts| +|Error code added|NA|Class name: Cipher
Method or attribute name: init(opMode : CryptoMode, key : Key, params : ParamsSpec) : Promise;
Error code: 401, 17620001, 17620002, 17630001|@ohos.security.cryptoFramework.d.ts| +|Error code added|NA|Class name: Cipher
Method or attribute name: update(data : DataBlob) : Promise;
Error code: 401, 17620001, 17620002, 17630001|@ohos.security.cryptoFramework.d.ts| +|Error code added|NA|Class name: Cipher
Method or attribute name: doFinal(data : DataBlob) : Promise;
Error code: 401, 17620001, 17620002, 17630001|@ohos.security.cryptoFramework.d.ts| +|Error code added|NA|Class name: Sign
Method or attribute name: init(priKey : PriKey) : Promise;
Error code: 401, 17620001, 17620002, 17630001|@ohos.security.cryptoFramework.d.ts| +|Error code added|NA|Class name: Sign
Method or attribute name: update(data : DataBlob) : Promise;
Error code: 401, 17620001, 17620002, 17630001|@ohos.security.cryptoFramework.d.ts| +|Error code added|NA|Class name: Sign
Method or attribute name: sign(data : DataBlob) : Promise;
Error code: 401, 17620001, 17620002, 17630001|@ohos.security.cryptoFramework.d.ts| +|Error code added|NA|Class name: Verify
Method or attribute name: init(pubKey : PubKey) : Promise;
Error code: 401, 17620001, 17620002, 17630001|@ohos.security.cryptoFramework.d.ts| +|Error code added|NA|Class name: Verify
Method or attribute name: update(data : DataBlob) : Promise;
Error code: 401, 17620001, 17620002, 17630001|@ohos.security.cryptoFramework.d.ts| +|Error code added|NA|Class name: Verify
Method or attribute name: verify(data : DataBlob, signatureData : DataBlob) : Promise;
Error code: 401, 17620001, 17620002, 17630001|@ohos.security.cryptoFramework.d.ts| +|Error code added|NA|Class name: KeyAgreement
Method or attribute name: generateSecret(priKey : PriKey, pubKey : PubKey) : Promise;
Error code: 401, 17620001, 17620002, 17630001|@ohos.security.cryptoFramework.d.ts| +|Function changed|Class name: huks
Method or attribute name: function update(handle: number, options: HuksOptions, callback: AsyncCallback) : void;
|Class name: huks
Method or attribute name: function update(handle: number, token?: Uint8Array, options: HuksOptions, callback: AsyncCallback) : void;
|@ohos.security.huks.d.ts| +|Function changed|Class name: huks
Method or attribute name: function update(handle: number, options: HuksOptions, token: Uint8Array, callback: AsyncCallback) : void;
|Class name: huks
Method or attribute name: function update(handle: number, token?: Uint8Array, options: HuksOptions, callback: AsyncCallback) : void;
|@ohos.security.huks.d.ts| +|Function changed|Class name: huks
Method or attribute name: function update(handle: number, options: HuksOptions, token?: Uint8Array) : Promise;
|Class name: huks
Method or attribute name: function update(handle: number, token?: Uint8Array, options: HuksOptions) : Promise;
|@ohos.security.huks.d.ts| diff --git a/en/release-notes/api-change/v3.2-beta5/js-apidiff-start-up.md b/en/release-notes/api-change/v3.2-beta5/js-apidiff-start-up.md new file mode 100644 index 0000000000000000000000000000000000000000..f514b78994fcf92bea0df943efdf58e6a589ed4c --- /dev/null +++ b/en/release-notes/api-change/v3.2-beta5/js-apidiff-start-up.md @@ -0,0 +1,4 @@ +| Change Type | Old Version | New Version | d.ts File | +| ---- | ------ | ------ | -------- | +|Permission added|Class name: deviceInfo
Method or attribute name: const serial: string;
Permission: N/A|Class name: deviceInfo
Method or attribute name: const serial: string;
Permission: ohos.permission.sec.ACCESS_UDID|@ohos.deviceInfo.d.ts| +|Permission added|Class name: deviceInfo
Method or attribute name: const udid: string;
Permission: N/A|Class name: deviceInfo
Method or attribute name: const udid: string;
Permission: ohos.permission.sec.ACCESS_UDID|@ohos.deviceInfo.d.ts| diff --git a/en/release-notes/api-change/v3.2-beta5/js-apidiff-telephony.md b/en/release-notes/api-change/v3.2-beta5/js-apidiff-telephony.md new file mode 100644 index 0000000000000000000000000000000000000000..c61a79bcb30711cfcc336f33850d56a6c9bfe0fe --- /dev/null +++ b/en/release-notes/api-change/v3.2-beta5/js-apidiff-telephony.md @@ -0,0 +1,243 @@ +| Change Type | Old Version | New Version | d.ts File | +| ---- | ------ | ------ | -------- | +|Added|NA|Class name: CallTransferInfo
Method or attribute name: startHour?: number;|@ohos.telephony.call.d.ts| +|Added|NA|Class name: CallTransferInfo
Method or attribute name: startMinute?: number;|@ohos.telephony.call.d.ts| +|Added|NA|Class name: CallTransferInfo
Method or attribute name: endHour?: number;|@ohos.telephony.call.d.ts| +|Added|NA|Class name: CallTransferInfo
Method or attribute name: endMinute?: number;|@ohos.telephony.call.d.ts| +|Added|NA|Class name: CallTransferResult
Method or attribute name: startHour: number;|@ohos.telephony.call.d.ts| +|Added|NA|Class name: CallTransferResult
Method or attribute name: startMinute: number;|@ohos.telephony.call.d.ts| +|Added|NA|Class name: CallTransferResult
Method or attribute name: endHour: number;|@ohos.telephony.call.d.ts| +|Added|NA|Class name: CallTransferResult
Method or attribute name: endMinute: number;|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: |@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: UNASSIGNED_NUMBER = 1|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: UNASSIGNED_NUMBER = 1|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: NO_ROUTE_TO_DESTINATION = 3|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: NO_ROUTE_TO_DESTINATION = 3|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: CHANNEL_UNACCEPTABLE = 6|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: CHANNEL_UNACCEPTABLE = 6|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: OPERATOR_DETERMINED_BARRING = 8|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: OPERATOR_DETERMINED_BARRING = 8|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: CALL_COMPLETED_ELSEWHERE = 13|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: CALL_COMPLETED_ELSEWHERE = 13|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: NORMAL_CALL_CLEARING = 16|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: NORMAL_CALL_CLEARING = 16|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: USER_BUSY = 17|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: USER_BUSY = 17|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: NO_USER_RESPONDING = 18|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: NO_USER_RESPONDING = 18|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: USER_ALERTING_NO_ANSWER = 19|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: USER_ALERTING_NO_ANSWER = 19|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: CALL_REJECTED = 21|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: CALL_REJECTED = 21|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: NUMBER_CHANGED = 22|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: NUMBER_CHANGED = 22|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: CALL_REJECTED_DUE_TO_FEATURE_AT_THE_DESTINATION = 24|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: CALL_REJECTED_DUE_TO_FEATURE_AT_THE_DESTINATION = 24|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: FAILED_PRE_EMPTION = 25|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: FAILED_PRE_EMPTION = 25|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: NON_SELECTED_USER_CLEARING = 26|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: NON_SELECTED_USER_CLEARING = 26|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: DESTINATION_OUT_OF_ORDER = 27|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: DESTINATION_OUT_OF_ORDER = 27|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: INVALID_NUMBER_FORMAT = 28|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: INVALID_NUMBER_FORMAT = 28|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: FACILITY_REJECTED = 29|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: FACILITY_REJECTED = 29|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: RESPONSE_TO_STATUS_ENQUIRY = 30|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: RESPONSE_TO_STATUS_ENQUIRY = 30|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: NORMAL_UNSPECIFIED = 31|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: NORMAL_UNSPECIFIED = 31|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: NO_CIRCUIT_CHANNEL_AVAILABLE = 34|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: NO_CIRCUIT_CHANNEL_AVAILABLE = 34|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: NETWORK_OUT_OF_ORDER = 38|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: NETWORK_OUT_OF_ORDER = 38|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: TEMPORARY_FAILURE = 41|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: TEMPORARY_FAILURE = 41|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: SWITCHING_EQUIPMENT_CONGESTION = 42|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: SWITCHING_EQUIPMENT_CONGESTION = 42|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: ACCESS_INFORMATION_DISCARDED = 43|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: ACCESS_INFORMATION_DISCARDED = 43|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: REQUEST_CIRCUIT_CHANNEL_NOT_AVAILABLE = 44|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: REQUEST_CIRCUIT_CHANNEL_NOT_AVAILABLE = 44|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: RESOURCES_UNAVAILABLE_UNSPECIFIED = 47|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: RESOURCES_UNAVAILABLE_UNSPECIFIED = 47|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: QUALITY_OF_SERVICE_UNAVAILABLE = 49|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: QUALITY_OF_SERVICE_UNAVAILABLE = 49|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: REQUESTED_FACILITY_NOT_SUBSCRIBED = 50|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: REQUESTED_FACILITY_NOT_SUBSCRIBED = 50|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: INCOMING_CALLS_BARRED_WITHIN_THE_CUG = 55|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: INCOMING_CALLS_BARRED_WITHIN_THE_CUG = 55|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: BEARER_CAPABILITY_NOT_AUTHORIZED = 57|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: BEARER_CAPABILITY_NOT_AUTHORIZED = 57|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: BEARER_CAPABILITY_NOT_PRESENTLY_AVAILABLE = 58|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: BEARER_CAPABILITY_NOT_PRESENTLY_AVAILABLE = 58|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: SERVICE_OR_OPTION_NOT_AVAILABLE_UNSPECIFIED = 63|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: SERVICE_OR_OPTION_NOT_AVAILABLE_UNSPECIFIED = 63|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: BEARER_SERVICE_NOT_IMPLEMENTED = 65|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: BEARER_SERVICE_NOT_IMPLEMENTED = 65|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: ACM_EQUALTO_OR_GREATER_THAN_THE_MAXIMUM_VALUE = 68|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: ACM_EQUALTO_OR_GREATER_THAN_THE_MAXIMUM_VALUE = 68|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: REQUESTED_FACILITY_NOT_IMPLEMENTED = 69|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: REQUESTED_FACILITY_NOT_IMPLEMENTED = 69|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: ONLY_RESTRICTED_DIGITAL_INFO_BEARER_CAPABILITY_IS_AVAILABLE = 70|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: ONLY_RESTRICTED_DIGITAL_INFO_BEARER_CAPABILITY_IS_AVAILABLE = 70|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: SERVICE_OR_OPTION_NOT_IMPLEMENTED_UNSPECIFIED = 79|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: SERVICE_OR_OPTION_NOT_IMPLEMENTED_UNSPECIFIED = 79|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: INVALID_TRANSACTION_IDENTIFIER_VALUE = 81|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: INVALID_TRANSACTION_IDENTIFIER_VALUE = 81|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: USER_NOT_MEMBER_OF_CUG = 87|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: USER_NOT_MEMBER_OF_CUG = 87|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: INCOMPATIBLE_DESTINATION = 88|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: INCOMPATIBLE_DESTINATION = 88|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: INVALID_TRANSIT_NETWORK_SELECTION = 91|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: INVALID_TRANSIT_NETWORK_SELECTION = 91|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: SEMANTICALLY_INCORRECT_MESSAGE = 95|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: SEMANTICALLY_INCORRECT_MESSAGE = 95|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: INVALID_MANDATORY_INFORMATION = 96|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: INVALID_MANDATORY_INFORMATION = 96|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: MESSAGE_TYPE_NON_EXISTENT_OR_NOT_IMPLEMENTED = 97|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: MESSAGE_TYPE_NON_EXISTENT_OR_NOT_IMPLEMENTED = 97|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE = 98|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE = 98|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: INFORMATION_ELEMENT_NON_EXISTENT_OR_NOT_IMPLEMENTED = 99|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: INFORMATION_ELEMENT_NON_EXISTENT_OR_NOT_IMPLEMENTED = 99|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: CONDITIONAL_IE_ERROR = 100|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: CONDITIONAL_IE_ERROR = 100|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE = 101|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE = 101|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: RECOVERY_ON_TIMER_EXPIRED = 102|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: RECOVERY_ON_TIMER_EXPIRED = 102|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: PROTOCOL_ERROR_UNSPECIFIED = 111|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: PROTOCOL_ERROR_UNSPECIFIED = 111|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: INTERWORKING_UNSPECIFIED = 127|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: INTERWORKING_UNSPECIFIED = 127|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: CALL_BARRED = 240|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: CALL_BARRED = 240|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: FDN_BLOCKED = 241|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: FDN_BLOCKED = 241|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: IMSI_UNKNOWN_IN_VLR = 242|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: IMSI_UNKNOWN_IN_VLR = 242|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: IMEI_NOT_ACCEPTED = 243|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: IMEI_NOT_ACCEPTED = 243|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: DIAL_MODIFIED_TO_USSD = 244|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: DIAL_MODIFIED_TO_USSD = 244|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: DIAL_MODIFIED_TO_SS = 245|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: DIAL_MODIFIED_TO_SS = 245|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: DIAL_MODIFIED_TO_DIAL = 246|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: DIAL_MODIFIED_TO_DIAL = 246|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: RADIO_OFF = 247|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: RADIO_OFF = 247|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: OUT_OF_SERVICE = 248|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: OUT_OF_SERVICE = 248|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: NO_VALID_SIM = 249|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: NO_VALID_SIM = 249|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: RADIO_INTERNAL_ERROR = 250|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: RADIO_INTERNAL_ERROR = 250|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: NETWORK_RESP_TIMEOUT = 251|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: NETWORK_RESP_TIMEOUT = 251|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: NETWORK_REJECT = 252|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: NETWORK_REJECT = 252|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: RADIO_ACCESS_FAILURE = 253|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: RADIO_ACCESS_FAILURE = 253|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: RADIO_LINK_FAILURE = 254|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: RADIO_LINK_FAILURE = 254|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: RADIO_LINK_LOST = 255|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: RADIO_LINK_LOST = 255|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: RADIO_UPLINK_FAILURE = 256|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: RADIO_UPLINK_FAILURE = 256|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: RADIO_SETUP_FAILURE = 257|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: RADIO_SETUP_FAILURE = 257|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: RADIO_RELEASE_NORMAL = 258|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: RADIO_RELEASE_NORMAL = 258|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: RADIO_RELEASE_ABNORMAL = 259|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: RADIO_RELEASE_ABNORMAL = 259|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: ACCESS_CLASS_BLOCKED = 260|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: ACCESS_CLASS_BLOCKED = 260|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: NETWORK_DETACH = 261|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: NETWORK_DETACH = 261|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: INVALID_PARAMETER = 1025|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: INVALID_PARAMETER = 1025|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: SIM_NOT_EXIT = 1026|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: SIM_NOT_EXIT = 1026|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: SIM_PIN_NEED = 1027|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: SIM_PIN_NEED = 1027|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: CALL_NOT_ALLOW = 1029|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: CALL_NOT_ALLOW = 1029|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: SIM_INVALID = 1045|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: SIM_INVALID = 1045|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.call
Class name: DisconnectedReason
Method or attribute name: UNKNOWN = 1279|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedReason
Method or attribute name: UNKNOWN = 1279|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedDetails
Method or attribute name: reason: DisconnectedReason;|@ohos.telephony.call.d.ts| +|Added|NA|Class name: DisconnectedDetails
Method or attribute name: message: string;|@ohos.telephony.call.d.ts| +|Added|NA|Module name: ohos.telephony.sim
Class name: OperatorConfigKey|@ohos.telephony.sim.d.ts| +|Added|NA|Module name: ohos.telephony.sim
Class name: OperatorConfigKey
Method or attribute name: KEY_VOICE_MAIL_NUMBER_STRING = "voice_mail_number_string"|@ohos.telephony.sim.d.ts| +|Added|NA|Module name: ohos.telephony.sim
Class name: OperatorConfigKey
Method or attribute name: KEY_IMS_SWITCH_ON_BY_DEFAULT_BOOL = "ims_switch_on_by_default_bool"|@ohos.telephony.sim.d.ts| +|Added|NA|Module name: ohos.telephony.sim
Class name: OperatorConfigKey
Method or attribute name: KEY_HIDE_IMS_SWITCH_BOOL = "hide_ims_switch_bool"|@ohos.telephony.sim.d.ts| +|Added|NA|Module name: ohos.telephony.sim
Class name: OperatorConfigKey
Method or attribute name: KEY_VOLTE_SUPPORTED_BOOL = "volte_supported_bool"|@ohos.telephony.sim.d.ts| +|Added|NA|Module name: ohos.telephony.sim
Class name: OperatorConfigKey
Method or attribute name: KEY_NR_MODE_SUPPORTED_LIST_INT_ARRAY = "nr_mode_supported_list_int_array"|@ohos.telephony.sim.d.ts| +|Added|NA|Module name: ohos.telephony.sim
Class name: OperatorConfigKey
Method or attribute name: KEY_VOLTE_PROVISIONING_SUPPORTED_BOOL = "volte_provisioning_supported_bool"|@ohos.telephony.sim.d.ts| +|Added|NA|Module name: ohos.telephony.sim
Class name: OperatorConfigKey
Method or attribute name: KEY_SS_OVER_UT_SUPPORTED_BOOL = "ss_over_ut_supported_bool"|@ohos.telephony.sim.d.ts| +|Added|NA|Module name: ohos.telephony.sim
Class name: OperatorConfigKey
Method or attribute name: KEY_IMS_GBA_REQUIRED_BOOL = "ims_gba_required_bool"|@ohos.telephony.sim.d.ts| +|Added|NA|Module name: ohos.telephony.sim
Class name: OperatorConfigKey
Method or attribute name: KEY_UT_PROVISIONING_SUPPORTED_BOOL = "ut_provisioning_supported_bool"|@ohos.telephony.sim.d.ts| +|Added|NA|Module name: ohos.telephony.sim
Class name: OperatorConfigKey
Method or attribute name: KEY_IMS_PREFER_FOR_EMERGENCY_BOOL = "ims_prefer_for_emergency_bool"|@ohos.telephony.sim.d.ts| +|Added|NA|Module name: ohos.telephony.sim
Class name: OperatorConfigKey
Method or attribute name: KEY_CALL_WAITING_SERVICE_CLASS_INT = "call_waiting_service_class_int"|@ohos.telephony.sim.d.ts| +|Added|NA|Module name: ohos.telephony.sim
Class name: OperatorConfigKey
Method or attribute name: KEY_CALL_TRANSFER_VISIBILITY_BOOL = "call_transfer_visibility_bool"|@ohos.telephony.sim.d.ts| +|Added|NA|Module name: ohos.telephony.sim
Class name: OperatorConfigKey
Method or attribute name: KEY_IMS_CALL_DISCONNECT_REASONINFO_MAPPING_STRING_ARRAY = "ims_call_disconnect_reasoninfo_mapping_string_array"|@ohos.telephony.sim.d.ts| +|Added|NA|Module name: ohos.telephony.sim
Class name: OperatorConfigKey
Method or attribute name: KEY_FORCE_VOLTE_SWITCH_ON_BOOL = "force_volte_switch_on_bool"|@ohos.telephony.sim.d.ts| +|Added|NA|Module name: ohos.telephony.sim
Class name: OperatorConfigKey
Method or attribute name: KEY_ENABLE_OPERATOR_NAME_CUST_BOOL = "enable_operator_name_cust_bool"|@ohos.telephony.sim.d.ts| +|Added|NA|Module name: ohos.telephony.sim
Class name: OperatorConfigKey
Method or attribute name: KEY_OPERATOR_NAME_CUST_STRING = "operator_name_cust_string"|@ohos.telephony.sim.d.ts| +|Added|NA|Module name: ohos.telephony.sim
Class name: OperatorConfigKey
Method or attribute name: KEY_SPN_DISPLAY_CONDITION_CUST_INT = "spn_display_condition_cust_int"|@ohos.telephony.sim.d.ts| +|Added|NA|Module name: ohos.telephony.sim
Class name: OperatorConfigKey
Method or attribute name: KEY_PNN_CUST_STRING_ARRAY = "pnn_cust_string_array"|@ohos.telephony.sim.d.ts| +|Added|NA|Module name: ohos.telephony.sim
Class name: OperatorConfigKey
Method or attribute name: KEY_OPL_CUST_STRING_ARRAY = "opl_cust_string_array"|@ohos.telephony.sim.d.ts| +|Added|NA|Module name: ohos.telephony.sim
Class name: OperatorConfigKey
Method or attribute name: KEY_EMERGENCY_CALL_STRING_ARRAY = "emergency_call_string_array"|@ohos.telephony.sim.d.ts| +|Deleted|Module name: ohos.telephony.call
Class name: DisconnectedDetails|NA|@ohos.telephony.call.d.ts| +|Deleted|Module name: ohos.telephony.call
Class name: DisconnectedDetails
Method or attribute name: UNASSIGNED_NUMBER = 1|NA|@ohos.telephony.call.d.ts| +|Deleted|Module name: ohos.telephony.call
Class name: DisconnectedDetails
Method or attribute name: NO_ROUTE_TO_DESTINATION = 3|NA|@ohos.telephony.call.d.ts| +|Deleted|Module name: ohos.telephony.call
Class name: DisconnectedDetails
Method or attribute name: CHANNEL_UNACCEPTABLE = 6|NA|@ohos.telephony.call.d.ts| +|Deleted|Module name: ohos.telephony.call
Class name: DisconnectedDetails
Method or attribute name: OPERATOR_DETERMINED_BARRING = 8|NA|@ohos.telephony.call.d.ts| +|Deleted|Module name: ohos.telephony.call
Class name: DisconnectedDetails
Method or attribute name: NORMAL_CALL_CLEARING = 16|NA|@ohos.telephony.call.d.ts| +|Deleted|Module name: ohos.telephony.call
Class name: DisconnectedDetails
Method or attribute name: USER_BUSY = 17|NA|@ohos.telephony.call.d.ts| +|Deleted|Module name: ohos.telephony.call
Class name: DisconnectedDetails
Method or attribute name: NO_USER_RESPONDING = 18|NA|@ohos.telephony.call.d.ts| +|Deleted|Module name: ohos.telephony.call
Class name: DisconnectedDetails
Method or attribute name: USER_ALERTING_NO_ANSWER = 19|NA|@ohos.telephony.call.d.ts| +|Deleted|Module name: ohos.telephony.call
Class name: DisconnectedDetails
Method or attribute name: CALL_REJECTED = 21|NA|@ohos.telephony.call.d.ts| +|Deleted|Module name: ohos.telephony.call
Class name: DisconnectedDetails
Method or attribute name: NUMBER_CHANGED = 22|NA|@ohos.telephony.call.d.ts| +|Deleted|Module name: ohos.telephony.call
Class name: DisconnectedDetails
Method or attribute name: DESTINATION_OUT_OF_ORDER = 27|NA|@ohos.telephony.call.d.ts| +|Deleted|Module name: ohos.telephony.call
Class name: DisconnectedDetails
Method or attribute name: INVALID_NUMBER_FORMAT = 28|NA|@ohos.telephony.call.d.ts| +|Deleted|Module name: ohos.telephony.call
Class name: DisconnectedDetails
Method or attribute name: NETWORK_OUT_OF_ORDER = 38|NA|@ohos.telephony.call.d.ts| +|Deleted|Module name: ohos.telephony.call
Class name: DisconnectedDetails
Method or attribute name: TEMPORARY_FAILURE = 41|NA|@ohos.telephony.call.d.ts| +|Deleted|Module name: ohos.telephony.call
Class name: DisconnectedDetails
Method or attribute name: INVALID_PARAMETER = 1025|NA|@ohos.telephony.call.d.ts| +|Deleted|Module name: ohos.telephony.call
Class name: DisconnectedDetails
Method or attribute name: SIM_NOT_EXIT = 1026|NA|@ohos.telephony.call.d.ts| +|Deleted|Module name: ohos.telephony.call
Class name: DisconnectedDetails
Method or attribute name: SIM_PIN_NEED = 1027|NA|@ohos.telephony.call.d.ts| +|Deleted|Module name: ohos.telephony.call
Class name: DisconnectedDetails
Method or attribute name: CALL_NOT_ALLOW = 1029|NA|@ohos.telephony.call.d.ts| +|Deleted|Module name: ohos.telephony.call
Class name: DisconnectedDetails
Method or attribute name: SIM_INVALID = 1045|NA|@ohos.telephony.call.d.ts| +|Deleted|Module name: ohos.telephony.call
Class name: DisconnectedDetails
Method or attribute name: UNKNOWN = 1279|NA|@ohos.telephony.call.d.ts| +|Initial version changed|Class name: CallTransferInfo
Method or attribute name: transferNum: string;
Initial version: N/A|Class name: CallTransferInfo
Method or attribute name: transferNum: string;
Initial version: 8|@ohos.telephony.call.d.ts| +|Initial version changed|Class name: CallTransferInfo
Method or attribute name: type: CallTransferType;
Initial version: N/A|Class name: CallTransferInfo
Method or attribute name: type: CallTransferType;
Initial version: 8|@ohos.telephony.call.d.ts| +|Initial version changed|Class name: CallTransferInfo
Method or attribute name: settingType: CallTransferSettingType;
Initial version: N/A|Class name: CallTransferInfo
Method or attribute name: settingType: CallTransferSettingType;
Initial version: 8|@ohos.telephony.call.d.ts| +|Initial version changed|Class name: CallTransferResult
Method or attribute name: status: TransferStatus;
Initial version: N/A|Class name: CallTransferResult
Method or attribute name: status: TransferStatus;
Initial version: 8|@ohos.telephony.call.d.ts| +|Initial version changed|Class name: CallTransferResult
Method or attribute name: number: string;
Initial version: N/A|Class name: CallTransferResult
Method or attribute name: number: string;
Initial version: 8|@ohos.telephony.call.d.ts| +|Initial version changed|Class name: CallWaitingStatus
Method or attribute name: CALL_WAITING_DISABLE = 0
Initial version: N/A|Class name: CallWaitingStatus
Method or attribute name: CALL_WAITING_DISABLE = 0
Initial version: 7|@ohos.telephony.call.d.ts| +|Initial version changed|Class name: CallWaitingStatus
Method or attribute name: CALL_WAITING_ENABLE = 1
Initial version: N/A|Class name: CallWaitingStatus
Method or attribute name: CALL_WAITING_ENABLE = 1
Initial version: 7|@ohos.telephony.call.d.ts| +|Initial version changed|Class name: RestrictionStatus
Method or attribute name: RESTRICTION_DISABLE = 0
Initial version: N/A|Class name: RestrictionStatus
Method or attribute name: RESTRICTION_DISABLE = 0
Initial version: 8|@ohos.telephony.call.d.ts| +|Initial version changed|Class name: RestrictionStatus
Method or attribute name: RESTRICTION_ENABLE = 1
Initial version: N/A|Class name: RestrictionStatus
Method or attribute name: RESTRICTION_ENABLE = 1
Initial version: 8|@ohos.telephony.call.d.ts| +|Initial version changed|Class name: TransferStatus
Method or attribute name: TRANSFER_DISABLE = 0
Initial version: N/A|Class name: TransferStatus
Method or attribute name: TRANSFER_DISABLE = 0
Initial version: 8|@ohos.telephony.call.d.ts| +|Initial version changed|Class name: TransferStatus
Method or attribute name: TRANSFER_ENABLE = 1
Initial version: N/A|Class name: TransferStatus
Method or attribute name: TRANSFER_ENABLE = 1
Initial version: 8|@ohos.telephony.call.d.ts| +|Initial version changed|Class name: EmergencyNumberOptions
Method or attribute name: slotId?: number;
Initial version: N/A|Class name: EmergencyNumberOptions
Method or attribute name: slotId?: number;
Initial version: 7|@ohos.telephony.call.d.ts| +|Initial version changed|Class name: NumberFormatOptions
Method or attribute name: countryCode?: string;
Initial version: N/A|Class name: NumberFormatOptions
Method or attribute name: countryCode?: string;
Initial version: 7|@ohos.telephony.call.d.ts| +|Initial version changed|Class name: AudioDeviceOptions
Method or attribute name: bluetoothAddress?: string;
Initial version: N/A|Class name: AudioDeviceOptions
Method or attribute name: bluetoothAddress?: string;
Initial version: 9|@ohos.telephony.call.d.ts| +|Initial version changed|Class name: MmiCodeResults
Method or attribute name: result: MmiCodeResult;
Initial version: N/A|Class name: MmiCodeResults
Method or attribute name: result: MmiCodeResult;
Initial version: 9|@ohos.telephony.call.d.ts| +|Initial version changed|Class name: MmiCodeResults
Method or attribute name: message: string;
Initial version: N/A|Class name: MmiCodeResults
Method or attribute name: message: string;
Initial version: 9|@ohos.telephony.call.d.ts| +|Initial version changed|Class name: MmiCodeResult
Method or attribute name: MMI_CODE_SUCCESS = 0
Initial version: N/A|Class name: MmiCodeResult
Method or attribute name: MMI_CODE_SUCCESS = 0
Initial version: 9|@ohos.telephony.call.d.ts| +|Initial version changed|Class name: MmiCodeResult
Method or attribute name: MMI_CODE_FAILED = 1
Initial version: N/A|Class name: MmiCodeResult
Method or attribute name: MMI_CODE_FAILED = 1
Initial version: 9|@ohos.telephony.call.d.ts| +|Permission changed|Class name: observer
Method or attribute name: function on(type: 'cellInfoChange', callback: Callback>): void;
Permission: ohos.permission.LOCATION|Class name: observer
Method or attribute name: function on(type: 'cellInfoChange', callback: Callback>): void;
Permission: ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION|@ohos.telephony.observer.d.ts| +|Permission changed|Class name: observer
Method or attribute name: function on(type: 'cellInfoChange', options: { slotId: number },
callback: Callback>): void;
Permission: ohos.permission.LOCATION|Class name: observer
Method or attribute name: function on(type: 'cellInfoChange', options: { slotId: number },
callback: Callback>): void;
Permission: ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION|@ohos.telephony.observer.d.ts| +|Permission changed|Class name: radio
Method or attribute name: function sendUpdateCellLocationRequest(callback: AsyncCallback): void;
Permission: ohos.permission.LOCATION|Class name: radio
Method or attribute name: function sendUpdateCellLocationRequest(callback: AsyncCallback): void;
Permission: ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION|@ohos.telephony.radio.d.ts| +|Permission changed|Class name: radio
Method or attribute name: function sendUpdateCellLocationRequest(slotId: number, callback: AsyncCallback): void;
Permission: ohos.permission.LOCATION|Class name: radio
Method or attribute name: function sendUpdateCellLocationRequest(slotId: number, callback: AsyncCallback): void;
Permission: ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION|@ohos.telephony.radio.d.ts| +|Permission changed|Class name: radio
Method or attribute name: function sendUpdateCellLocationRequest(slotId?: number): Promise;
Permission: ohos.permission.LOCATION|Class name: radio
Method or attribute name: function sendUpdateCellLocationRequest(slotId?: number): Promise;
Permission: ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION|@ohos.telephony.radio.d.ts| +|Permission changed|Class name: radio
Method or attribute name: function getCellInformation(callback: AsyncCallback>): void;
Permission: ohos.permission.LOCATION|Class name: radio
Method or attribute name: function getCellInformation(callback: AsyncCallback>): void;
Permission: ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION|@ohos.telephony.radio.d.ts| +|Permission changed|Class name: radio
Method or attribute name: function getCellInformation(slotId: number, callback: AsyncCallback>): void;
Permission: ohos.permission.LOCATION|Class name: radio
Method or attribute name: function getCellInformation(slotId: number, callback: AsyncCallback>): void;
Permission: ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION|@ohos.telephony.radio.d.ts| +|Permission changed|Class name: radio
Method or attribute name: function getCellInformation(slotId?: number): Promise>;
Permission: ohos.permission.LOCATION|Class name: radio
Method or attribute name: function getCellInformation(slotId?: number): Promise>;
Permission: ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION|@ohos.telephony.radio.d.ts| +|Permission added|Class name: call
Method or attribute name: function hangup(callback: AsyncCallback): void;
Permission: N/A|Class name: call
Method or attribute name: function hangup(callback: AsyncCallback): void;
Permission: ohos.permission.ANSWER_CALL|@ohos.telephony.call.d.ts| +|Function changed|Class name: sms
Method or attribute name: function isImsSmsSupported(callback: AsyncCallback): void;
|Class name: sms
Method or attribute name: function isImsSmsSupported(slotId: number, callback: AsyncCallback): void;
|@ohos.telephony.sms.d.ts| +|Function changed|Class name: sms
Method or attribute name: function isImsSmsSupported(): Promise;
|Class name: sms
Method or attribute name: function isImsSmsSupported(slotId: number): Promise;
|@ohos.telephony.sms.d.ts| diff --git a/en/release-notes/api-change/v3.2-beta5/js-apidiff-unitest.md b/en/release-notes/api-change/v3.2-beta5/js-apidiff-unitest.md new file mode 100644 index 0000000000000000000000000000000000000000..57088a127b3def4b3ee8715625062a359bd858f7 --- /dev/null +++ b/en/release-notes/api-change/v3.2-beta5/js-apidiff-unitest.md @@ -0,0 +1,10 @@ +| Change Type | Old Version | New Version | d.ts File | +| ---- | ------ | ------ | -------- | +|Added|NA|Class name: Rect
Method or attribute name: readonly left: number;|@ohos.uitest.d.ts| +|Added|NA|Class name: Rect
Method or attribute name: readonly top: number;|@ohos.uitest.d.ts| +|Added|NA|Class name: Rect
Method or attribute name: readonly right: number;|@ohos.uitest.d.ts| +|Added|NA|Class name: Rect
Method or attribute name: readonly bottom: number;|@ohos.uitest.d.ts| +|Deleted|Module name: ohos.uitest
Class name: Rect
Method or attribute name: readonly leftX: number;|NA|@ohos.uitest.d.ts| +|Deleted|Module name: ohos.uitest
Class name: Rect
Method or attribute name: readonly topY: number;|NA|@ohos.uitest.d.ts| +|Deleted|Module name: ohos.uitest
Class name: Rect
Method or attribute name: readonly rightX: number;|NA|@ohos.uitest.d.ts| +|Deleted|Module name: ohos.uitest
Class name: Rect
Method or attribute name: readonly bottomY: number;|NA|@ohos.uitest.d.ts| diff --git a/en/release-notes/api-change/v3.2-beta5/js-apidiff-user-iam.md b/en/release-notes/api-change/v3.2-beta5/js-apidiff-user-iam.md new file mode 100644 index 0000000000000000000000000000000000000000..4b538a99e295de42660b0fba18b3e385e30a3d91 --- /dev/null +++ b/en/release-notes/api-change/v3.2-beta5/js-apidiff-user-iam.md @@ -0,0 +1,35 @@ +| Change Type | Old Version | New Version | d.ts File | +| ---- | ------ | ------ | -------- | +|Added|NA|Module name: ohos.userIAM.userAuth
Class name: UserAuthResultCode|@ohos.userIAM.userAuth.d.ts| +|Added|NA|Class name: UserAuthResultCode
Method or attribute name: |@ohos.userIAM.userAuth.d.ts| +|Added|NA|Module name: ohos.userIAM.userAuth
Class name: UserAuthResultCode
Method or attribute name: SUCCESS = 12500000|@ohos.userIAM.userAuth.d.ts| +|Added|NA|Class name: UserAuthResultCode
Method or attribute name: SUCCESS = 12500000|@ohos.userIAM.userAuth.d.ts| +|Added|NA|Module name: ohos.userIAM.userAuth
Class name: UserAuthResultCode
Method or attribute name: FAIL = 12500001|@ohos.userIAM.userAuth.d.ts| +|Added|NA|Class name: UserAuthResultCode
Method or attribute name: FAIL = 12500001|@ohos.userIAM.userAuth.d.ts| +|Added|NA|Module name: ohos.userIAM.userAuth
Class name: UserAuthResultCode
Method or attribute name: GENERAL_ERROR = 12500002|@ohos.userIAM.userAuth.d.ts| +|Added|NA|Class name: UserAuthResultCode
Method or attribute name: GENERAL_ERROR = 12500002|@ohos.userIAM.userAuth.d.ts| +|Added|NA|Module name: ohos.userIAM.userAuth
Class name: UserAuthResultCode
Method or attribute name: CANCELED = 12500003|@ohos.userIAM.userAuth.d.ts| +|Added|NA|Class name: UserAuthResultCode
Method or attribute name: CANCELED = 12500003|@ohos.userIAM.userAuth.d.ts| +|Added|NA|Module name: ohos.userIAM.userAuth
Class name: UserAuthResultCode
Method or attribute name: TIMEOUT = 12500004|@ohos.userIAM.userAuth.d.ts| +|Added|NA|Class name: UserAuthResultCode
Method or attribute name: TIMEOUT = 12500004|@ohos.userIAM.userAuth.d.ts| +|Added|NA|Module name: ohos.userIAM.userAuth
Class name: UserAuthResultCode
Method or attribute name: TYPE_NOT_SUPPORT = 12500005|@ohos.userIAM.userAuth.d.ts| +|Added|NA|Class name: UserAuthResultCode
Method or attribute name: TYPE_NOT_SUPPORT = 12500005|@ohos.userIAM.userAuth.d.ts| +|Added|NA|Module name: ohos.userIAM.userAuth
Class name: UserAuthResultCode
Method or attribute name: TRUST_LEVEL_NOT_SUPPORT = 12500006|@ohos.userIAM.userAuth.d.ts| +|Added|NA|Class name: UserAuthResultCode
Method or attribute name: TRUST_LEVEL_NOT_SUPPORT = 12500006|@ohos.userIAM.userAuth.d.ts| +|Added|NA|Module name: ohos.userIAM.userAuth
Class name: UserAuthResultCode
Method or attribute name: BUSY = 12500007|@ohos.userIAM.userAuth.d.ts| +|Added|NA|Class name: UserAuthResultCode
Method or attribute name: BUSY = 12500007|@ohos.userIAM.userAuth.d.ts| +|Added|NA|Module name: ohos.userIAM.userAuth
Class name: UserAuthResultCode
Method or attribute name: LOCKED = 12500009|@ohos.userIAM.userAuth.d.ts| +|Added|NA|Class name: UserAuthResultCode
Method or attribute name: LOCKED = 12500009|@ohos.userIAM.userAuth.d.ts| +|Added|NA|Module name: ohos.userIAM.userAuth
Class name: UserAuthResultCode
Method or attribute name: NOT_ENROLLED = 12500010|@ohos.userIAM.userAuth.d.ts| +|Added|NA|Class name: UserAuthResultCode
Method or attribute name: NOT_ENROLLED = 12500010|@ohos.userIAM.userAuth.d.ts| +|Deleted|Module name: ohos.userIAM.userAuth
Class name: ResultCodeV9|NA|@ohos.userIAM.userAuth.d.ts| +|Deleted|Module name: ohos.userIAM.userAuth
Class name: ResultCodeV9
Method or attribute name: SUCCESS = 12500000|NA|@ohos.userIAM.userAuth.d.ts| +|Deleted|Module name: ohos.userIAM.userAuth
Class name: ResultCodeV9
Method or attribute name: FAIL = 12500001|NA|@ohos.userIAM.userAuth.d.ts| +|Deleted|Module name: ohos.userIAM.userAuth
Class name: ResultCodeV9
Method or attribute name: GENERAL_ERROR = 12500002|NA|@ohos.userIAM.userAuth.d.ts| +|Deleted|Module name: ohos.userIAM.userAuth
Class name: ResultCodeV9
Method or attribute name: CANCELED = 12500003|NA|@ohos.userIAM.userAuth.d.ts| +|Deleted|Module name: ohos.userIAM.userAuth
Class name: ResultCodeV9
Method or attribute name: TIMEOUT = 12500004|NA|@ohos.userIAM.userAuth.d.ts| +|Deleted|Module name: ohos.userIAM.userAuth
Class name: ResultCodeV9
Method or attribute name: TYPE_NOT_SUPPORT = 12500005|NA|@ohos.userIAM.userAuth.d.ts| +|Deleted|Module name: ohos.userIAM.userAuth
Class name: ResultCodeV9
Method or attribute name: TRUST_LEVEL_NOT_SUPPORT = 12500006|NA|@ohos.userIAM.userAuth.d.ts| +|Deleted|Module name: ohos.userIAM.userAuth
Class name: ResultCodeV9
Method or attribute name: BUSY = 12500007|NA|@ohos.userIAM.userAuth.d.ts| +|Deleted|Module name: ohos.userIAM.userAuth
Class name: ResultCodeV9
Method or attribute name: LOCKED = 12500009|NA|@ohos.userIAM.userAuth.d.ts| +|Deleted|Module name: ohos.userIAM.userAuth
Class name: ResultCodeV9
Method or attribute name: NOT_ENROLLED = 12500010|NA|@ohos.userIAM.userAuth.d.ts| diff --git a/en/release-notes/api-change/v3.2-beta5/js-apidiff-web.md b/en/release-notes/api-change/v3.2-beta5/js-apidiff-web.md new file mode 100644 index 0000000000000000000000000000000000000000..1ff64980b5f1067e56622a8d7ed7b016897f8157 --- /dev/null +++ b/en/release-notes/api-change/v3.2-beta5/js-apidiff-web.md @@ -0,0 +1,64 @@ +| Change Type | Old Version | New Version | d.ts File | +| ---- | ------ | ------ | -------- | +|Added|NA|Module name: ohos.web.webview
Class name: WebCustomScheme|@ohos.web.webview.d.ts| +|Added|NA|Class name: WebCustomScheme
Method or attribute name: |@ohos.web.webview.d.ts| +|Added|NA|Module name: ohos.web.webview
Class name: WebCustomScheme
Method or attribute name: schemeName: string;|@ohos.web.webview.d.ts| +|Added|NA|Class name: WebCustomScheme
Method or attribute name: schemeName: string;|@ohos.web.webview.d.ts| +|Added|NA|Module name: ohos.web.webview
Class name: WebCustomScheme
Method or attribute name: isSupportCORS: boolean;|@ohos.web.webview.d.ts| +|Added|NA|Class name: WebCustomScheme
Method or attribute name: isSupportCORS: boolean;|@ohos.web.webview.d.ts| +|Added|NA|Module name: ohos.web.webview
Class name: WebCustomScheme
Method or attribute name: isSupportFetch: boolean;|@ohos.web.webview.d.ts| +|Added|NA|Class name: WebCustomScheme
Method or attribute name: isSupportFetch: boolean;|@ohos.web.webview.d.ts| +|Added|NA|Module name: ohos.web.webview
Class name: webview
Method or attribute name: function once(type: string, callback: Callback): void;|@ohos.web.webview.d.ts| +|Added|NA|Class name: webview
Method or attribute name: function once(type: string, callback: Callback): void;|@ohos.web.webview.d.ts| +|Added|NA|Module name: ohos.web.webview
Class name: HistoryItem|@ohos.web.webview.d.ts| +|Added|NA|Class name: HistoryItem
Method or attribute name: |@ohos.web.webview.d.ts| +|Added|NA|Module name: ohos.web.webview
Class name: HistoryItem
Method or attribute name: icon: image.PixelMap;|@ohos.web.webview.d.ts| +|Added|NA|Class name: HistoryItem
Method or attribute name: icon: image.PixelMap;|@ohos.web.webview.d.ts| +|Added|NA|Module name: ohos.web.webview
Class name: HistoryItem
Method or attribute name: historyUrl: string;|@ohos.web.webview.d.ts| +|Added|NA|Class name: HistoryItem
Method or attribute name: historyUrl: string;|@ohos.web.webview.d.ts| +|Added|NA|Module name: ohos.web.webview
Class name: HistoryItem
Method or attribute name: historyRawUrl: string;|@ohos.web.webview.d.ts| +|Added|NA|Class name: HistoryItem
Method or attribute name: historyRawUrl: string;|@ohos.web.webview.d.ts| +|Added|NA|Module name: ohos.web.webview
Class name: HistoryItem
Method or attribute name: title: string;|@ohos.web.webview.d.ts| +|Added|NA|Class name: HistoryItem
Method or attribute name: title: string;|@ohos.web.webview.d.ts| +|Added|NA|Module name: ohos.web.webview
Class name: BackForwardList|@ohos.web.webview.d.ts| +|Added|NA|Class name: BackForwardList
Method or attribute name: |@ohos.web.webview.d.ts| +|Added|NA|Module name: ohos.web.webview
Class name: BackForwardList
Method or attribute name: currentIndex: number;|@ohos.web.webview.d.ts| +|Added|NA|Class name: BackForwardList
Method or attribute name: currentIndex: number;|@ohos.web.webview.d.ts| +|Added|NA|Module name: ohos.web.webview
Class name: BackForwardList
Method or attribute name: size: number;|@ohos.web.webview.d.ts| +|Added|NA|Class name: BackForwardList
Method or attribute name: size: number;|@ohos.web.webview.d.ts| +|Added|NA|Module name: ohos.web.webview
Class name: BackForwardList
Method or attribute name: getItemAtIndex(index: number): HistoryItem;|@ohos.web.webview.d.ts| +|Added|NA|Class name: BackForwardList
Method or attribute name: getItemAtIndex(index: number): HistoryItem;|@ohos.web.webview.d.ts| +|Added|NA|Module name: ohos.web.webview
Class name: WebviewController
Method or attribute name: static initializeWebEngine(): void;|@ohos.web.webview.d.ts| +|Added|NA|Class name: WebviewController
Method or attribute name: static initializeWebEngine(): void;|@ohos.web.webview.d.ts| +|Added|NA|Module name: ohos.web.webview
Class name: WebviewController
Method or attribute name: pageUp(top:boolean): void;|@ohos.web.webview.d.ts| +|Added|NA|Class name: WebviewController
Method or attribute name: pageUp(top:boolean): void;|@ohos.web.webview.d.ts| +|Added|NA|Module name: ohos.web.webview
Class name: WebviewController
Method or attribute name: pageDown(bottom:boolean): void;|@ohos.web.webview.d.ts| +|Added|NA|Class name: WebviewController
Method or attribute name: pageDown(bottom:boolean): void;|@ohos.web.webview.d.ts| +|Added|NA|Module name: ohos.web.webview
Class name: WebviewController
Method or attribute name: getOriginalUrl(): string;|@ohos.web.webview.d.ts| +|Added|NA|Class name: WebviewController
Method or attribute name: getOriginalUrl(): string;|@ohos.web.webview.d.ts| +|Added|NA|Module name: ohos.web.webview
Class name: WebviewController
Method or attribute name: getFavicon(): image.PixelMap;|@ohos.web.webview.d.ts| +|Added|NA|Class name: WebviewController
Method or attribute name: getFavicon(): image.PixelMap;|@ohos.web.webview.d.ts| +|Added|NA|Module name: ohos.web.webview
Class name: WebviewController
Method or attribute name: setNetworkAvailable(enable: boolean): void;|@ohos.web.webview.d.ts| +|Added|NA|Class name: WebviewController
Method or attribute name: setNetworkAvailable(enable: boolean): void;|@ohos.web.webview.d.ts| +|Added|NA|Module name: ohos.web.webview
Class name: WebviewController
Method or attribute name: hasImage(): Promise;|@ohos.web.webview.d.ts| +|Added|NA|Class name: WebviewController
Method or attribute name: hasImage(): Promise;|@ohos.web.webview.d.ts| +|Added|NA|Module name: ohos.web.webview
Class name: WebviewController
Method or attribute name: hasImage(callback: AsyncCallback): void;|@ohos.web.webview.d.ts| +|Added|NA|Class name: WebviewController
Method or attribute name: hasImage(callback: AsyncCallback): void;|@ohos.web.webview.d.ts| +|Added|NA|Module name: ohos.web.webview
Class name: WebviewController
Method or attribute name: getBackForwardEntries(): BackForwardList;|@ohos.web.webview.d.ts| +|Added|NA|Class name: WebviewController
Method or attribute name: getBackForwardEntries(): BackForwardList;|@ohos.web.webview.d.ts| +|Added|NA|Module name: ohos.web.webview
Class name: WebviewController
Method or attribute name: removeCache(clearRom: boolean): void;|@ohos.web.webview.d.ts| +|Added|NA|Class name: WebviewController
Method or attribute name: removeCache(clearRom: boolean): void;|@ohos.web.webview.d.ts| +|Added|NA|Module name: ohos.web.webview
Class name: WebviewController
Method or attribute name: scrollTo(x:number, y:number): void;|@ohos.web.webview.d.ts| +|Added|NA|Class name: WebviewController
Method or attribute name: scrollTo(x:number, y:number): void;|@ohos.web.webview.d.ts| +|Added|NA|Module name: ohos.web.webview
Class name: WebviewController
Method or attribute name: scrollBy(deltaX:number, deltaY:number): void;|@ohos.web.webview.d.ts| +|Added|NA|Class name: WebviewController
Method or attribute name: scrollBy(deltaX:number, deltaY:number): void;|@ohos.web.webview.d.ts| +|Added|NA|Module name: ohos.web.webview
Class name: WebviewController
Method or attribute name: slideScroll(vx:number, vy:number): void;|@ohos.web.webview.d.ts| +|Added|NA|Class name: WebviewController
Method or attribute name: slideScroll(vx:number, vy:number): void;|@ohos.web.webview.d.ts| +|Added|NA|Module name: ohos.web.webview
Class name: WebviewController
Method or attribute name: serializeWebState() : Uint8Array;|@ohos.web.webview.d.ts| +|Added|NA|Class name: WebviewController
Method or attribute name: serializeWebState() : Uint8Array;|@ohos.web.webview.d.ts| +|Added|NA|Module name: ohos.web.webview
Class name: WebviewController
Method or attribute name: restoreWebState(state: Uint8Array) : void;|@ohos.web.webview.d.ts| +|Added|NA|Class name: WebviewController
Method or attribute name: restoreWebState(state: Uint8Array) : void;|@ohos.web.webview.d.ts| +|Added|NA|Module name: ohos.web.webview
Class name: WebviewController
Method or attribute name: static customizeSchemes(schemes: Array): void;|@ohos.web.webview.d.ts| +|Added|NA|Class name: WebviewController
Method or attribute name: static customizeSchemes(schemes: Array): void;|@ohos.web.webview.d.ts| +|Function changed|Class name: WebMessagePort
Method or attribute name: postMessageEvent(message: string): void;
|Class name: WebMessagePort
Method or attribute name: postMessageEvent(message: WebMessage): void;
|@ohos.web.webview.d.ts| +|Function changed|Class name: WebMessagePort
Method or attribute name: onMessageEvent(callback: (result: string) => void): void;
|Class name: WebMessagePort
Method or attribute name: onMessageEvent(callback: (result: WebMessage) => void): void;
|@ohos.web.webview.d.ts| diff --git a/en/release-notes/api-change/v3.2-beta5/js-apidiff-window.md b/en/release-notes/api-change/v3.2-beta5/js-apidiff-window.md new file mode 100644 index 0000000000000000000000000000000000000000..adf3dc5f46b240274ff525dc2c47561a7281aaae --- /dev/null +++ b/en/release-notes/api-change/v3.2-beta5/js-apidiff-window.md @@ -0,0 +1,6 @@ +| Change Type | Old Version | New Version | d.ts File | +| ---- | ------ | ------ | -------- | +|Added|NA|Class name: WindowStageEventType
Method or attribute name: SHOWN = 1|@ohos.window.d.ts| +|Added|NA|Class name: WindowStageEventType
Method or attribute name: HIDDEN|@ohos.window.d.ts| +|Deleted|Module name: ohos.window
Class name: WindowStageEventType
Method or attribute name: FOREGROUND = 1|NA|@ohos.window.d.ts| +|Deleted|Module name: ohos.window
Class name: WindowStageEventType
Method or attribute name: BACKGROUND|NA|@ohos.window.d.ts| diff --git a/en/release-notes/changelogs/OpenHarmony_3.2.10.1/changelogs-distributeddatamgr.md b/en/release-notes/changelogs/OpenHarmony_3.2.10.1/changelogs-distributeddatamgr.md deleted file mode 100644 index a08c5a6f98327d255d722a2104a93c7e6be91733..0000000000000000000000000000000000000000 --- a/en/release-notes/changelogs/OpenHarmony_3.2.10.1/changelogs-distributeddatamgr.md +++ /dev/null @@ -1,180 +0,0 @@ -# ChangeLog of JS API Changes of the Distributed Data Management Subsystem - -Compared with OpenHarmony 3.2 Beta4, OpenHarmony 3.2.10.1(Mr) has the following API changes in the distributed data management subsystem: - -## cl.distributeddatamgr.1 API Change -APIs in the **kv_store** component of the distributed data management subsystem are changed: - -**createKVManager** is changed from asynchronous to synchronous, because the execution duration is fixed and short and there is no need to asynchronously wait for the execution result. Therefore, the original APIs **function createKVManager(config: KVManagerConfig): Promise\;** and **function createKVManager(config: KVManagerConfig, callback: AsyncCallback): void;** are changed to **function createKVManager(config: KVManagerConfig): KVManager;**. - -You need to adapt your applications based on the following information: - -**Change Impacts** - -JS APIs in API version 9 are affected. The application needs to adapt these APIs so that it can properly implement functions in the SDK environment of the new version. - -**Key API/Component Changes** - -| Module | Class | Method/Attribute/Enumeration/Constant | Change Type| -| ------------------------ | ------------------ | ------------------------------------------------------------ | -------- | -| @ohos.distributedKVStore | distributedKVStore | function createKVManager(config: KVManagerConfig): Promise\; | Deleted | -| @ohos.distributedKVStore | distributedKVStore | function createKVManager(config: KVManagerConfig): KVManager; | Changed | - - -**Adaptation Guide** - -The following illustrates how to call **createKVManager** to create a **KVManager** object. - -Stage model: - -```ts -import AbilityStage from '@ohos.application.Ability' -let kvManager; -export default class MyAbilityStage extends AbilityStage { - onCreate() { - console.log("MyAbilityStage onCreate") - let context = this.context - const kvManagerConfig = { - context: context, - bundleName: 'com.example.datamanagertest', - } - try { - kvManager = distributedKVStore.createKVManager(kvManagerConfig); - } catch (e) { - console.error(`Failed to create KVManager.code is ${e.code},message is ${e.message}`); - } - } -} -``` - -FA model: - -```ts -import featureAbility from '@ohos.ability.featureAbility' -let kvManager; -let context = featureAbility.getContext() -const kvManagerConfig = { - context: context, - bundleName: 'com.example.datamanagertest', -} -try { - kvManager = distributedKVStore.createKVManager(kvManagerConfig); -} catch (e) { - console.error(`Failed to create KVManager.code is ${e.code},message is ${e.message}`); -} -``` - -## cl.distributeddatamgr.2 Migration of function getRdbStoreV9 from @ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts. -**Change Impacts** - -The **getRdbStoreV9()** API is deprecated, and the applications that use it need to make adjustment. - -**Key API/Component Changes** - -APIs: - -```ts -function getRdbStoreV9(context: Context, config: StoreConfigV9, version: number, callback: AsyncCallback): void; -function getRdbStoreV9(context: Context, config: StoreConfigV9, version: number): Promise; -``` -The APIs are migrated from **@ohos.data.rdb.d.ts** to **@ohos.data.relationalStore.d.ts**. -``` -function getRdbStore(context: Context, config: StoreConfig, callback: AsyncCallback): void; -function getRdbStore(context: Context, config: StoreConfig): Promise; -``` - -**Adaptation Guide** - - * `import rdb from "@ohos.data.rdb"` is changed to `import rdb from "@ohos.data.relationalStore"`. - * The names of relevant methods should be changed according to the preceding changes. - -## cl.distributeddatamgr.3 Migration of function deleteRdbStoreV9 from @ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts -**Change Impacts** - -The **deleteRdbStoreV9()** API is deprecated, and the applications that use it need to make adjustment. - -**Key API/Component Changes** - -APIs: - -```ts -function deleteRdbStoreV9(context: Context, name: string, callback: AsyncCallback): void; -function deleteRdbStoreV9(context: Context, name: string): Promise; -``` -The APIs are migrated from **@ohos.data.rdb.d.ts** to **@ohos.data.relationalStore.d.ts**. -``` -function deleteRdbStoreV9(context: Context, name: string, callback: AsyncCallback): void; -function deleteRdbStoreV9(context: Context, name: string): Promise; -``` - -**Adaptation Guide** - * `import rdb from "@ohos.data.rdb"` is changed to `import rdb from "@ohos.data.relationalStore"`. - * The names of relevant methods should be changed according to the preceding changes. - -## cl.distributeddatamgr.4 Migration of interface StoreConfigV9 from @ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts -**Change Impacts** - -The **StoreConfigV9()** API is deprecated, and the applications that use it need to make adjustment. - -**Key API/Component Changes** - -**interface StoreConfigV9** is migrated from **@ohos.data.rdb.d.ts** to **@ohos.data.relationalStore.d.ts** and is renamed as **interface StoreConfig**. - -**Adaptation Guide** - - * `import rdb from "@ohos.data.rdb"` is changed to `import rdb from "@ohos.data.relationalStore"`. - * The names of relevant APIs should be changed according to the preceding changes. - -## cl.distributeddatamgr.5 Migration of enum SecurityLevel from @ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts -**Change Impacts** - -The **SecurityLevel** object is deprecated, and the applications that use it need to make adjustment. - -**Key API/Component Changes** - -**enum SecurityLevel** is migrated from **ohos.data.rdb.d.ts** to **@ohos.data.relationalStore.d.ts**. - -**Adaptation Guide** - * `import rdb from "@ohos.data.rdb"` is changed to `import rdb from "@ohos.data.relationalStore"`. - * The names of relevant APIs should be changed according to the preceding changes. - -## cl.distributeddatamgr.6 Migration of interface RdbStoreV9 from @ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts -**Change Impacts** - -The **RdbStoreV9()** interface is deprecated, and the applications that use it need to make adjustment. - -**Key API/Component Changes** - -**RdbStoreV9()** is migrated from **@ohos.data.rdb.d.ts** to **@ohos.data.relationalStore.d.ts** and is renamed as **interface RdbStore**. - -**Adaptation Guide** - - * `import rdb from "@ohos.data.rdb"` is changed to `import rdb from "@ohos.data.relationalStore"`. - * The names of relevant APIs should be changed according to the preceding changes. - -## cl.distributeddatamgr.7 Migration of class RdbPredicatesV9 from ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts -**Change Impacts** - -The **RdbPredicatesV9** class is deprecated, and the applications that use it need to make adjustment. - -**Key API/Component Changes** - -**RdbPredicatesV9** is migrated from **ohos.data.rdb.d.ts** to **@ohos.data.relationalStore.d.ts** and is renamed as **interface RdbPredicates**. - -**Adaptation Guide** - * `import rdb from "@ohos.data.rdb"` is changed to `import rdb from "@ohos.data.relationalStore"`. - * The names of relevant APIs should be changed according to the preceding changes. - -## cl.distributeddatamgr.8 Migration of interface ResultSetV9 from api/@ohos.data.relationalStore.d.ts to @ohos.data.relationalStore.d.ts -**Change Impacts** - -The **ResultSetV9** object is deprecated, and the applications that use it need to make adjustment. - -**Key API/Component Changes** - -**ResultSetV9** is migrated from **api/data/rdb/resultSet.d.ts** to **@ohos.data.relationalStore.d.ts** and is renamed as **interface ResultSet**. - -**Adaptation Guide** - - * `import rdb from "@ohos.data.rdb"` is changed to `import rdb from "@ohos.data.relationalStore"`. - * The **ResultSetV9** instance is obtained only via **getRdbStoreV9**. After modifications are made according to cl.distributeddatamgr.2, the code can automatically adapt to **ResultSet**. diff --git a/en/release-notes/changelogs/OpenHarmony_3.2.10.1/changelogs-multimedia.md b/en/release-notes/changelogs/OpenHarmony_3.2.10.1/changelogs-multimedia.md deleted file mode 100644 index 4b223c8ac73a16fceaa2002167640f8aeb94fabd..0000000000000000000000000000000000000000 --- a/en/release-notes/changelogs/OpenHarmony_3.2.10.1/changelogs-multimedia.md +++ /dev/null @@ -1,53 +0,0 @@ -## cl.multimedia.av_session.001 Change of All av_session APIs to System APIs - -All av_session APIs are changed to system APIs. - -**Change Impacts** - -Non-system applications and applications without system API permission cannot call system APIs. - -**Key API/Component Changes** - -All APIs are changed to system APIs. The table below describes the APIs. - -| API, Enumeration, or Variable| Type| Is System API| -| -------- | -------- | ------- | -| SessionToken | interface | Yes| -| AVMetadata | interface | Yes| -| AVPlaybackState | interface | Yes| -| PlaybackPosition | interface | Yes| -| OutputDeviceInfo | interface | Yes| -| AVSessionDescriptor | interface | Yes| -| AVSessionController | interface | Yes| -| AVControlCommand | interface | Yes| -| createAVSession | function | Yes| -| getAllSessionDescriptors | function | Yes| -| createController | function | Yes| -| castAudio | function | Yes| -| on | function | Yes| -| off | function | Yes| -| sendSystemAVKeyEvent | function | Yes| -| sendSystemControlCommand | function | Yes| -| sessionId | variable | Yes| -| setAVMetadata | function | Yes| -| setAVPlaybackState | function | Yes| -| setLaunchAbility | function | Yes| -| getController | function | Yes| -| getOutputDevice | function | Yes| -| activate | function | Yes| -| deactivate | function | Yes| -| destroy | function | Yes| -| getAVPlaybackState | function | Yes| -| getAVMetadata | function | Yes| -| getOutputDevice | function | Yes| -| sendAVKeyEvent | function | Yes| -| getLaunchAbility | function | Yes| -| getRealPlaybackPositionSync | function | Yes| -| isActive | function | Yes| -| getValidCommands | function | Yes| -| sendControlCommand | function | Yes| -| AVSessionType | type | Yes| -| AVControlCommandType | type | Yes| -| LoopMode | enum | Yes| -| PlaybackState | enum | Yes| -| AVSessionErrorCode | enum | Yes| diff --git a/en/release-notes/changelogs/OpenHarmony_3.2.10.3/changelogs-camera-sync.md b/en/release-notes/changelogs/OpenHarmony_3.2.10.3/changelogs-camera-sync.md deleted file mode 100644 index c20c9e4c50f8de7ba2c8a0323f19d2000e4007ad..0000000000000000000000000000000000000000 --- a/en/release-notes/changelogs/OpenHarmony_3.2.10.3/changelogs-camera-sync.md +++ /dev/null @@ -1,522 +0,0 @@ -# Multimedia Subsystem ChangeLog - -Compared with OpenHarmony 3.2 Beta4, OpenHarmony3.2.10.3 has the following changes in APIs of the camera component in the multimedia subsystem. - -## cl.subsystemname.1 Camera API Changed -1. All the APIs of the camera component are changed to system APIs in the API version 9. -2. Some functional APIs are added and some others are deprecated to: - -- Improve the usability of camera APIs. -- Help you quickly understand camera APIs and use them for development. -- Facilitate expansion of framework functions in later versions, and reduce coupling between framework modules. - -You need to refer to the following change description to adapt your application. - -**Change Impacts** - -JS APIs in API version 9 are affected. Your application needs to adapt these APIs so that it can properly implement features in the SDK environment of the new version. - -**Key API/Component Changes** - -| Module | Class | Method/Attribute/Enum/Constant | Is System API| Change Type| -| ---------------------- | ----------------------- | ------------------------------------------------------------ | --------------- | -------- | -| ohos.multimedia.camera | camera | function getCameraManager(context: Context): CameraManager; | Yes | Added | -| ohos.multimedia.camera | camera | function getCameraManager(context: Context, callback: AsyncCallback): void;
function getCameraManager(context: Context): Promise; | Yes | Deprecated | -| ohos.multimedia.camera | CameraErrorCode | INVALID_ARGUMENT = 7400101,
OPERATION_NOT_ALLOWED = 7400102,
SESSION_NOT_CONFIG = 7400103,
SESSION_NOT_RUNNING = 7400104,
SESSION_CONFIG_LOCKED = 7400105,
DEVICE_SETTING_LOCKED = 7400106,
CONFILICT_CAMERA = 7400107,
DEVICE_DISABLED = 7400108,
SERVICE_FATAL_ERROR = 7400201 | Yes | Added | -| ohos.multimedia.camera | CameraManager | getSupportedCameras(): Array;
getSupportedOutputCapability(camera: CameraDevice): CameraOutputCapability;
createCameraInput(camera: CameraDevice): CameraInput;
createCameraInput(position: CameraPosition, type: CameraType): CameraInput;
createPreviewOutput(profile: Profile, surfaceId: string): PreviewOutput;
createPhotoOutput(profile: Profile, surfaceId: string): PhotoOutput;
createVideoOutput(profile: VideoProfile, surfaceId: string): VideoOutput;
createMetadataOutput(metadataObjectTypes: Array): MetadataOutput;
createCaptureSession(): CaptureSession; | Yes | Added | -| ohos.multimedia.camera | CameraManager | getSupportedCameras(callback: AsyncCallback>): void;
getSupportedCameras(): Promise>;
getSupportedOutputCapability(camera: CameraDevice, callback: AsyncCallback): void;
getSupportedOutputCapability(camera: CameraDevice): Promise;
createCameraInput(camera: CameraDevice, callback: AsyncCallback): void;
createCameraInput(camera: CameraDevice): Promise;
createCameraInput(position: CameraPosition, type: CameraType, callback: AsyncCallback): void;
createCameraInput(position: CameraPosition, type: CameraType): Promise;
createPreviewOutput(profile: Profile, surfaceId: string, callback: AsyncCallback): void;
createPreviewOutput(profile: Profile, surfaceId: string): Promise;
createPhotoOutput(profile: Profile, surfaceId: string, callback: AsyncCallback): void;
createPhotoOutput(profile: Profile, surfaceId: string): Promise;
createVideoOutput(profile: VideoProfile, surfaceId: string, callback: AsyncCallback): void;
createVideoOutput(profile: VideoProfile, surfaceId: string): Promise;
createMetadataOutput(metadataObjectTypes: Array, callback: AsyncCallback): void;
createMetadataOutput(metadataObjectTypes: Array): Promise;
createCaptureSession(callback: AsyncCallback): void;
createCaptureSession(): Promise; | Yes | Deprecated | -| ohos.multimedia.camera | CameraType | CAMERA_TYPE_DEFAULT = 0 | Yes | Added | -| ohos.multimedia.camera | CameraType | CAMERA_TYPE_UNSPECIFIED = 0 | Yes | Deprecated | -| ohos.multimedia.camera | CameraInput | on(type: 'error', camera: CameraDevice, callback: ErrorCallback): void; | Yes | Added | -| ohos.multimedia.camera | CameraInput | release(callback: AsyncCallback): void;
release(): Promise;
on(type: 'error', camera: CameraDevice, callback: ErrorCallback): void; | Yes | Deprecated | -| ohos.multimedia.camera | CameraInputErrorCode | ERROR_UNKNOWN = -1
ERROR_NO_PERMISSION = 0
ERROR_DEVICE_PREEMPTED = 1
ERROR_DEVICE_DISCONNECTED = 2
ERROR_DEVICE_IN_USE = 3
ERROR_DRIVER_ERROR = 4 | Yes | Deprecated | -| ohos.multimedia.camera | CameraInputError | code: CameraInputErrorCode | Yes | Deprecated | -| ohos.multimedia.camera | CaptureSession | beginConfig(): void;
addInput(cameraInput: CameraInput): void;
removeInput(cameraInput: CameraInput): void;
addOutput(cameraOutput: CameraOutput): void;
removeOutput(cameraOutput: CameraOutput): void;
hasFlash(): boolean;
isFlashModeSupported(flashMode: FlashMode): boolean;
getFlashMode(): FlashMode;
setFlashMode(flashMode: FlashMode): void;
isExposureModeSupported(aeMode: ExposureMode): boolean;
getExposureMode(): ExposureMode;
setExposureMode(aeMode: ExposureMode): void;
getMeteringPoint(): Point;
setMeteringPoint(point: Point): void;
getExposureBiasRange(): Array;
setExposureBias(exposureBias: number): void;
getExposureValue(): number;
isFocusModeSupported(afMode: FocusMode): boolean;
getFocusMode(): FocusMode;
setFocusMode(afMode: FocusMode): void;
setFocusPoint(point: Point): void;
getFocusPoint(): Point;
getFocalLength(): number;
getZoomRatioRange(): Array;
getZoomRatio(): number;
setZoomRatio(zoomRatio: number): void;
isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): boolean;
getActiveVideoStabilizationMode(): VideoStabilizationMode;
setVideoStabilizationMode(mode: VideoStabilizationMode): void;
on(type: 'error', callback: ErrorCallback): void; | Yes | Added | -| ohos.multimedia.camera | CaptureSession | beginConfig(callback: AsyncCallback): void;
beginConfig(): Promise;
addInput(cameraInput: CameraInput, callback: AsyncCallback): void;
addInput(cameraInput: CameraInput): Promise;
removeInput(cameraInput: CameraInput, callback: AsyncCallback): void;
removeInput(cameraInput: CameraInput): Promise;
addOutput(cameraOutput: CameraOutput, callback: AsyncCallback): void;
addOutput(cameraOutput: CameraOutput): Promise;
removeOutput(cameraOutput: CameraOutput, callback: AsyncCallback): void;
removeOutput(cameraOutput: CameraOutput): Promise;
hasFlash(callback: AsyncCallback): void;
hasFlash(): Promise;
isFlashModeSupported(flashMode: FlashMode, callback: AsyncCallback): void;
isFlashModeSupported(flashMode: FlashMode): Promise;
getFlashMode(callback: AsyncCallback): void;
getFlashMode(): Promise;
setFlashMode(flashMode: FlashMode, callback: AsyncCallback): void;
setFlashMode(flashMode: FlashMode): Promise;
isExposureModeSupported(aeMode: ExposureMode, callback: AsyncCallback): void;
isExposureModeSupported(aeMode: ExposureMode): Promise;
getExposureMode(callback: AsyncCallback): void;
getExposureMode(): Promise;
setExposureMode(aeMode: ExposureMode, callback: AsyncCallback): void;
setExposureMode(aeMode: ExposureMode): Promise;
getMeteringPoint(callback: AsyncCallback): void;
getMeteringPoint(): Promise;
setMeteringPoint(point: Point, callback: AsyncCallback): void;
setMeteringPoint(point: Point): Promise;
getExposureBiasRange(callback: AsyncCallback>): void;
getExposureBiasRange(): Promise>;
setExposureBias(exposureBias: number, callback: AsyncCallback): void;
setExposureBias(exposureBias: number): Promise;
getExposureValue(callback: AsyncCallback): void;
getExposureValue(): Promise;
isFocusModeSupported(afMode: FocusMode, callback: AsyncCallback): void;
isFocusModeSupported(afMode: FocusMode): Promise;
getFocusMode(callback: AsyncCallback): void;
getFocusMode(): Promise;
setFocusMode(afMode: FocusMode, callback: AsyncCallback): void;
setFocusMode(afMode: FocusMode): Promise;
setFocusPoint(point: Point, callback: AsyncCallback): void;
setFocusPoint(point: Point): Promise;
getFocusPoint(callback: AsyncCallback): void;
getFocusPoint(): Promise;
getFocalLength(callback: AsyncCallback): void;
getFocalLength(): Promise;
getZoomRatioRange(callback: AsyncCallback>): void;
getZoomRatioRange(): Promise>;
getZoomRatio(callback: AsyncCallback): void;
getZoomRatio(): Promise;
setZoomRatio(zoomRatio: number, callback: AsyncCallback): void;
setZoomRatio(zoomRatio: number): Promise;
isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode, callback: AsyncCallback): void;
isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): Promise;
getActiveVideoStabilizationMode(callback: AsyncCallback): void;
getActiveVideoStabilizationMode(): Promise;
setVideoStabilizationMode(mode: VideoStabilizationMode, callback: AsyncCallback): void;
setVideoStabilizationMode(mode: VideoStabilizationMode): Promise;
on(type: 'error', callback: ErrorCallback): void; | Yes | Deprecated | -| ohos.multimedia.camera | CaptureSessionErrorCode | ERROR_UNKNOWN = -1
ERROR_INSUFFICIENT_RESOURCES = 0
ERROR_TIMEOUT = 1 | Yes | Deprecated | -| ohos.multimedia.camera | CaptureSessionError | code: CaptureSessionErrorCode | Yes | Deprecated | -| ohos.multimedia.camera | PreviewOutput | on(type: 'error', callback: ErrorCallback): void; | Yes | Added | -| ohos.multimedia.camera | PreviewOutput | on(type: 'error', callback: ErrorCallback): void; | Yes | Deprecated | -| ohos.multimedia.camera | PreviewOutputErrorCode | ERROR_UNKNOWN = -1 | Yes | Deprecated | -| ohos.multimedia.camera | PreviewOutputError | code: PreviewOutputErrorCode | Yes | Deprecated | -| ohos.multimedia.camera | PhotoOutput | capture(): Promise;
isMirrorSupported(): boolean;
on(type: 'error', callback: ErrorCallback): void; | Yes | Added | -| ohos.multimedia.camera | PhotoOutput | isMirrorSupported(callback: AsyncCallback): void;
isMirrorSupported(): Promise;
on(type: 'error', callback: ErrorCallback): void; | Yes | Deprecated | -| ohos.multimedia.camera | PhotoOutputErrorCode | ERROR_UNKNOWN = -1
ERROR_DRIVER_ERROR = 0
ERROR_INSUFFICIENT_RESOURCES = 1
ERROR_TIMEOUT = 2 | Yes | Deprecated | -| ohos.multimedia.camera | PhotoOutputError | code: PhotoOutputErrorCode | Yes | Deprecated | -| ohos.multimedia.camera | VideoOutput | on(type: 'error', callback: ErrorCallback): void; | Yes | Added | -| ohos.multimedia.camera | VideoOutput | on(type: 'error', callback: ErrorCallback): void; | Yes | Deprecated | -| ohos.multimedia.camera | VideoOutputErrorCode | ERROR_UNKNOWN = -1
ERROR_DRIVER_ERROR = 0 | Yes | Deprecated | -| ohos.multimedia.camera | VideoOutputError | code: VideoOutputErrorCode | Yes | Deprecated | -| ohos.multimedia.camera | MetadataObject | readonly type: MetadataObjectType;
readonly timestamp: number; | Yes | Added | -| ohos.multimedia.camera | MetadataObject | getType(callback: AsyncCallback): void;
getType(): Promise;
getTimestamp(callback: AsyncCallback): void;
getTimestamp(): Promise;
getBoundingBox(callback: AsyncCallback): void;
getBoundingBox(): Promise; | Yes | Deprecated | -| ohos.multimedia.camera | MetadataFaceObject | readonly boundingBox: Rect | Yes | Added | -| ohos.multimedia.camera | MetadataOutput | on(type: 'error', callback: ErrorCallback): void; | Yes | Added | -| ohos.multimedia.camera | MetadataOutput | on(type: 'error', callback: ErrorCallback): void; | Yes | Deprecated | -| ohos.multimedia.camera | MetadataOutputErrorCode | ERROR_UNKNOWN = -1
ERROR_INSUFFICIENT_RESOURCES = 0 | Yes | Deprecated | -| ohos.multimedia.camera | MetadataOutputError | code: MetadataOutputErrorCode | Yes | Deprecated | - -**Adaptation Guide** - -In addition to the new APIs and deprecated APIs, you need to adapt your application to the changed APIs. - -In Beta4 and later versions, the following APIs are changed. - -**New APIs** - -1. **CameraErrorCode** enums - - Enum: INVALID_ARGUMENT; value: 7400101 - - Enum: OPERATION_NOT_ALLOWED; value: 7400102 - - Enum: SESSION_NOT_CONFIG; value: 7400103 - - Enum: SESSION_NOT_RUNNING; value: 7400104 - - Enum: SESSION_CONFIG_LOCKED; value: 7400105 - - Enum: DEVICE_SETTING_LOCKED; value: 7400106 - - Enum: CONFILICT_CAMERA; value: 7400107 - - Enum: DEVICE_DISABLED; value: 7400108 - - Enum: SERVICE_FATAL_ERROR; value: 7400201 - -2. Added **capture(): Promise** to the **PhotoOutput** API. - -3. Added the readonly type **MetadataObjectType** to the **MetadataObject** API. - -4. Added **readonly timestamp: number** to the **MetadataObject** API. - -5. Added **readonly boundingBox: Rect** to the **MetadataObject** API. - -**Deprecated APIs** - -1. Deprecated the **release(callback: AsyncCallback): void** and **release(): Promise** APIs in **CameraInput**. - -2. Deprecated the **CameraInputErrorCode** enums and all their values: **ERROR_UNKNOWN** = **-1**, **ERROR_NO_PERMISSION** = **0**, **ERROR_DEVICE_PREEMPTED** = **1**, **ERROR_DEVICE_DISCONNECTED** = **2**, **ERROR_DEVICE_IN_USE** = **3**, **ERROR_DRIVER_ERROR** = **4** - -3. Deprecated the **CameraInputError** API and its attribute **CameraInputErrorCode**. - -4. Deprecated the **CaptureSessionErrorCode** enums and all their values: **ERROR_UNKNOWN** = **-1**, **ERROR_INSUFFICIENT_RESOURCES** = **0**, **ERROR_TIMEOUT** = **1** - -5. Deprecated the **CaptureSessionError** API and its attribute **CaptureSessionErrorCode**. - -6. Deprecated the **PreviewOutputErrorCode** enum and its value: **ERROR_UNKNOWN** = **-1** - -7. Deprecated the **PreviewOutputError** API and its attribute **PreviewOutputErrorCode**. - -8. Deprecated the **PhotoOutputErrorCode** enums and all their values: **ERROR_UNKNOWN** = **-1**, **ERROR_DRIVER_ERROR** = **0**, **ERROR_INSUFFICIENT_RESOURCES** = **1**, **ERROR_TIMEOUT** = **2** - -9. Deprecated the **PhotoOutputError** API and its attribute **PhotoOutputErrorCode**. - -10. Deprecated the **VideoOutputErrorCode** enums and all their values: **ERROR_UNKNOWN** = **-1**, **ERROR_DRIVER_ERROR** = **0** - -11. Deprecated the **VideoOutputError** API and its attribute **VideoOutputErrorCode**. - -12. Deprecated **getType(callback: AsyncCallback): void** in the **MetadataObject** API. - -13. Deprecated **getType(): Promise** in the **MetadataObject** API. - -14. Deprecated **getTimestamp(callback: AsyncCallback): void** in the **MetadataObject** API. - -15. Deprecated **getTimestamp(): Promise** in the **MetadataObject** API. - -16. Deprecated **getBoundingBox(callback: AsyncCallback): void** in the **MetadataObject** API. - -17. Deprecated **getBoundingBox(): Promise** in the **MetadataObject** API. - -18. Deprecated the **MetadataOutputErrorCode** enums and all their values: **ERROR_UNKNOWN** = **-1**, **ERROR_INSUFFICIENT_RESOURCES** = **0** - -19. Deprecated the **MetadataOutputError** API and its attribute **MetadataOutputErrorCode**. - -**Changed APIs** - -1. Changed the return modes of the **getCameraManager** API in the camera module from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getCameraManager(context: Context, callback: AsyncCallback): void** and **getCameraManager(context: Context): Promise** are changed to **getCameraManager(context: Context): CameraManager**. - - The sample code is as follows: - - ``` - let cameraManager = camera.getCameraManager(context); - ``` - -2. Changed the return modes of the **getSupportedCameras** API in CameraManager from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getSupportedCameras(callback: AsyncCallback>): void** and **getSupportedCameras(): Promise>** are changed to **getSupportedCameras(): Array**. - - The sample code is as follows: - - ``` - let cameras = cameraManager.getSupportedCameras(); - ``` - -3. Changed the return modes of the **getSupportedOutputCapability** API in CameraManager from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getSupportedOutputCapability(camera: CameraDevice, callback: AsyncCallback): void** and **getSupportedOutputCapability(camera: CameraDevice): Promise** are changed to **getSupportedOutputCapability(camera: CameraDevice): CameraOutputCapability**. - - The sample code is as follows: - - ``` - let cameraDevice = cameras[0]; - let CameraOutputCapability = cameraManager.getSupportedOutputCapability(cameraDevice); - ``` - -4. Changed the return modes of the **createCameraInput(camera: CameraDevice)** API in CameraManager from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **createCameraInput(camera: CameraDevice, callback: AsyncCallback): void** and **createCameraInput(camera: CameraDevice): Promise** are changed to **createCameraInput(camera: CameraDevice): CameraInput**. - - The sample code is as follows: - - ``` - let cameraDevice = cameras[0]; - let cameraInput = cameraManager.createCameraInput(cameraDevice); - ``` - -5. Changed the return modes of the **createCameraInput(position: CameraPosition, type: CameraType)** API in CameraManager from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **createCameraInput(position: CameraPosition, type: CameraType, callback: AsyncCallback): void** and **createCameraInput(position: CameraPosition, type: CameraType): Promise** are changed to **createCameraInput(position: CameraPosition, type: CameraType): CameraInput**. - - The sample code is as follows: - - ``` - let cameraDevice = cameras[0]; - let position = cameraDevice.cameraPosition; - let type = cameraDevice.cameraType; - let cameraInput = cameraManager.createCameraInput(position, type); - ``` - -6. Changed the return modes of the **createPreviewOutput** API in CameraManager from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **createPreviewOutput(profile: Profile, surfaceId: string, callback: AsyncCallback): void** and **createPreviewOutput(profile: Profile, surfaceId: string): Promise** are changed to **createPreviewOutput(profile: Profile, surfaceId: string): PreviewOutput**. - - The sample code is as follows: - - ``` - let profile = cameraoutputcapability.previewProfiles[0]; - let previewOutput = cameraManager.createPreviewOutput(profile, surfaceId); - ``` - -7. Changed the return modes of the **createPhotoOutput** API in CameraManager from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **createPhotoOutput(profile: Profile, surfaceId: string, callback: AsyncCallback): void** and **createPhotoOutput(profile: Profile, surfaceId: string): Promise** are changed to **createPhotoOutput(profile: Profile, surfaceId: string): PhotoOutput**. - - The sample code is as follows: - - ``` - let profile = cameraoutputcapability.photoProfiles[0]; - let photoOutput = cameraManager.createPhotoOutput(profile, surfaceId); - ``` - -8. Changed the return modes of the **createVideoOutput** API in CameraManager from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **createVideoOutput(profile: VideoProfile, surfaceId: string, callback: AsyncCallback): void** and **createVideoOutput(profile: VideoProfile, surfaceId: string): Promise** are changed to **createVideoOutput(profile: VideoProfile, surfaceId: string): VideoOutput**. - - The sample code is as follows: - - ``` - let profile = cameraoutputcapability.videoProfiles[0]; - let videoOutput = cameraManager.createVideoOutput(profile, surfaceId); - ``` - -9. Changed the return modes of the **createMetadataOutput** API in CameraManager from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **createMetadataOutput(metadataObjectTypes: Array, callback: AsyncCallback): void** and **createMetadataOutput(metadataObjectTypes: Array): Promise** are changed to **createMetadataOutput(metadataObjectTypes: Array): MetadataOutput**. - - The sample code is as follows: - - ``` - let metadataObjectTypes = cameraoutputcapability.supportedMetadataObjectTypes; - let metadataOutput = cameraManager.createMetadataOutput(metadataObjectTypes); - ``` - -10. Changed the return modes of the **createCaptureSession** API in CameraManager from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **createCaptureSession(callback: AsyncCallback): void** and **createCaptureSession(): Promise** are changed to **createCaptureSession(): CaptureSession**. - - The sample code is as follows: - - ``` - let captureSession = cameraManager.createCaptureSession(); - ``` - -11. Changed the enum **CAMERA_TYPE_UNSPECIFIED** of **CameraType** to **CAMERA_TYPE_DEFAULT**. - -12. Changed the return value type of the **on** API in CameraInput from **CameraInputError** to **BusinessError**. Therefore, the original API **on(type: 'error', camera: CameraDevice, callback: ErrorCallback): void** is changed to **on(type: 'error', camera: CameraDevice, callback: ErrorCallback): void**. - - The sample code is as follows: - - ``` - let cameraDevice = cameras[0]; - cameraInput.on('error', cameraDevice, (BusinessError) => { - - }) - ``` - -13. Changed the return modes of the **beginConfig** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **beginConfig(callback: AsyncCallback): void** and **beginConfig(): Promise** are changed to **beginConfig(): void**. - - The sample code is as follows: - - ``` - captureSession.beginConfig(); - ``` - -14. Changed the return modes of the **addInput** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **addInput(cameraInput: CameraInput, callback: AsyncCallback): void** and **addInput(cameraInput: CameraInput): Promise** are changed to **addInput(cameraInput: CameraInput): void**. - - The sample code is as follows: - - ``` - captureSession.addInput(cameraInput); - ``` - -15. Changed the return modes of the **removeInput** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **removeInput(cameraInput: CameraInput, callback: AsyncCallback): void** and **removeInput(cameraInput: CameraInput): Promise** are changed to **removeInput(cameraInput: CameraInput): void**. - - The sample code is as follows: - - ``` - captureSession.removeInput(cameraInput); - ``` - -16. Changed the return modes of the **addOutput** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **addOutput(cameraOutput: CameraOutput, callback: AsyncCallback): void** and **addOutput(cameraOutput: CameraOutput): Promise** are changed to **addOutput(cameraOutput: CameraOutput): void**. - - The sample code is as follows: - - ``` - captureSession.addOutput(previewOutput); - ``` - -17. Changed the return modes of the **removeOutput** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **removeOutput(cameraOutput: CameraOutput, callback: AsyncCallback): void** and **removeOutput(cameraOutput: CameraOutput): Promise** are changed to **removeOutput(cameraOutput: CameraOutput): void**. - - The sample code is as follows: - - ``` - captureSession.removeOutput(previewOutput); - ``` - -18. Changed the return modes of the **hasFlash** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **hasFlash(callback: AsyncCallback): void** and **hasFlash(): Promise** are changed to **hasFlash(): boolean**. - - The sample code is as follows: - - ``` - let status = captureSession.hasFlash(); - ``` - -19. Changed the return modes of the **isFlashModeSupported** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **isFlashModeSupported(flashMode: FlashMode, callback: AsyncCallback): void** and **isFlashModeSupported(flashMode: FlashMode): Promise** are changed to **isFlashModeSupported(flashMode: FlashMode): boolean**. - - The sample code is as follows: - - ``` - let status = captureSession.isFlashModeSupported(camera.FlashMode.FLASH_MODE_AUTO); - ``` - -20. Changed the return modes of the **getFlashMode** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getFlashMode(callback: AsyncCallback): void** and **getFlashMode(): Promise** are changed to **getFlashMode(): FlashMode**. - - The sample code is as follows: - - ``` - let flashMode = captureSession.getFlashMode(); - ``` - -21. Changed the return modes of the **isExposureModeSupported** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **isExposureModeSupported(aeMode: ExposureMode, callback: AsyncCallback): void** and **isExposureModeSupported(aeMode: ExposureMode): Promise** are changed to **isExposureModeSupported(aeMode: ExposureMode): boolean**. - - The sample code is as follows: - - ``` - let isSupported = captureSession.isExposureModeSupported(camera.ExposureMode.EXPOSURE_MODE_LOCKED); - ``` - -22. Changed the return modes of the **getExposureMode** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getExposureMode(callback: AsyncCallback): void** and **getExposureMode(): Promise** are changed to **getExposureMode(): ExposureMode**. - - The sample code is as follows: - - ``` - let exposureMode = captureSession.getExposureMode(); - ``` - -23. Changed the return modes of the **setExposureMode** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **setExposureMode(aeMode: ExposureMode, callback: AsyncCallback): void** and **setExposureMode(aeMode: ExposureMode): Promise** are changed to **setExposureMode(aeMode: ExposureMode): void**. - - The sample code is as follows: - - ``` - captureSession.setExposureMode(camera.ExposureMode.EXPOSURE_MODE_LOCKED); - ``` - -24. Changed the return modes of the **getMeteringPoint** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getMeteringPoint(callback: AsyncCallback): void** and **getMeteringPoint(): Promise** are changed to **getMeteringPoint(): Point**. - - The sample code is as follows: - - ``` - let exposurePoint = captureSession.getMeteringPoint(); - ``` - -25. Changed the return modes of the **setMeteringPoint** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **setMeteringPoint(point: Point, callback: AsyncCallback): void** and **setMeteringPoint(point: Point): Promise** are changed to **setMeteringPoint(point: Point): void**. - - The sample code is as follows: - - ``` - let Point2 = {x: 2, y: 2}; - captureSession.setMeteringPoint(Point2); - ``` - -26. Changed the return modes of the **getExposureBiasRange** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getExposureBiasRange(callback: AsyncCallback>): void** and **getExposureBiasRange(): Promise>** are changed to **getExposureBiasRange(): Array**. - - The sample code is as follows: - - ``` - let biasRangeArray = captureSession.getExposureBiasRange(); - ``` - -27. Changed the return modes of the **setExposureBias** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **setExposureBias(exposureBias: number, callback: AsyncCallback): void** and **setExposureBias(exposureBias: number): Promise** are changed to **setExposureBias(exposureBias: number): void**. - - The sample code is as follows: - - ``` - let exposureBias = biasRangeArray[0]; - captureSession.setExposureBias(exposureBias); - ``` - -28. Changed the return modes of the **getExposureValue** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getExposureValue(callback: AsyncCallback): void** and **getExposureValue(): Promise** are changed to **getExposureValue(): number**. - - The sample code is as follows: - - ``` - let exposureValue = captureSession.getExposureValue(); - ``` - -29. Changed the return modes of the **isFocusModeSupported** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **isFocusModeSupported(afMode: FocusMode, callback: AsyncCallback): void** and **isFocusModeSupported(afMode: FocusMode): Promise** are changed to **isFocusModeSupported(afMode: FocusMode): boolean**. - - The sample code is as follows: - - ``` - let status = captureSession.isFocusModeSupported(camera.FocusMode.FOCUS_MODE_AUTO); - ``` - -30. Changed the return modes of the **getFocusMode** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getFocusMode(callback: AsyncCallback): void** and **getFocusMode(): Promise** are changed to **getFocusMode(): FocusMode**. - - The sample code is as follows: - - ``` - let afMode = captureSession.getFocusMode(); - ``` - -31. Changed the return modes of the **setFocusMode** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **setFocusMode(afMode: FocusMode, callback: AsyncCallback): void** and **setFocusMode(afMode: FocusMode): Promise** are changed to **setFocusMode(afMode: FocusMode): void**. - - The sample code is as follows: - - ``` - captureSession.setFocusMode(camera.FocusMode.FOCUS_MODE_AUTO); - ``` - -32. Changed the return modes of the **setFocusPoint** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **setFocusPoint(point: Point, callback: AsyncCallback): void** and **setFocusPoint(point: Point): Promise** are changed to **setFocusPoint(point: Point): void**. - - The sample code is as follows: - - ``` - let Point2 = {x: 2, y: 2}; - captureSession.setFocusPoint(Point2); - ``` - -33. Changed the return modes of the **getFocusPoint** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getFocusPoint(callback: AsyncCallback): void** and **getFocusPoint(): Promise** are changed to **getFocusPoint(): Point**. - - The sample code is as follows: - - ``` - let point = captureSession.getFocusPoint(); - ``` - -34. Changed the return modes of the **getFocalLength** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getFocalLength(callback: AsyncCallback): void** and **getFocalLength(): Promise** are changed to **getFocalLength(): number**. - - The sample code is as follows: - - ``` - let focalLength = captureSession.getFocalLength(); - ``` - -35. Changed the return modes of the **getZoomRatioRange** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getZoomRatioRange(callback: AsyncCallback>): void** and **getZoomRatioRange(): Promise>** are changed to **getZoomRatioRange(): Array**. - - The sample code is as follows: - - ``` - let zoomRatioRange = captureSession.getZoomRatioRange(); - ``` - -36. Changed the return modes of the **getZoomRatio** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getZoomRatio(callback: AsyncCallback): void** and **getZoomRatio(): Promise** are changed to **getZoomRatio(): number**. - - The sample code is as follows: - - ``` - let zoomRatio = captureSession.getZoomRatio(); - ``` - -37. Changed the return modes of the **setZoomRatio** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **setZoomRatio(zoomRatio: number, callback: AsyncCallback): void** and **setZoomRatio(zoomRatio: number): Promise** are changed to **setZoomRatio(zoomRatio: number): void**. - - The sample code is as follows: - - ``` - let zoomRatio = zoomRatioRange[0]; - captureSession.setZoomRatio(zoomRatio); - ``` - -38. Changed the return modes of the **isVideoStabilizationModeSupported** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode, callback: AsyncCallback): void** and **isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): Promise** are changed to **isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): boolean**. - - The sample code is as follows: - - ``` - let isSupported = captureSession.isVideoStabilizationModeSupported(camera.VideoStabilizationMode.OFF); - ``` - -39. Changed the return modes of the **getActiveVideoStabilizationMode** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **getActiveVideoStabilizationMode(callback: AsyncCallback): void** and **getActiveVideoStabilizationMode(): Promise** are changed to **getActiveVideoStabilizationMode(): VideoStabilizationMode**. - - The sample code is as follows: - - ``` - let vsMode = captureSession.getActiveVideoStabilizationMode(); - ``` - -40. Changed the return modes of the **setVideoStabilizationMode** API in CaptureSession from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **setVideoStabilizationMode(mode: VideoStabilizationMode, callback: AsyncCallback): void** and **setVideoStabilizationMode(mode: VideoStabilizationMode): Promise** are changed to **setVideoStabilizationMode(mode: VideoStabilizationMode): void**. - - The sample code is as follows: - - ``` - captureSession.setVideoStabilizationMode(camera.VideoStabilizationMode.OFF); - ``` - -41. Changed the **on(type:'error') callback** type in CaptureSession from **ErrorCallback** to **ErrorCallback**. Therefore, the original API **on(type: 'error', callback: ErrorCallback): void** is changed to **on(type: 'error', callback: ErrorCallback): void**. - - The sample code is as follows: - - ``` - captureSession.on('error', (BusinessError) => { - - }) - ``` - -42. Changed the **on(type:'error') callback** type in PreviewOutput, from **ErrorCallback** to **ErrorCallback**. Therefore, the original API **on(type: 'error', callback: ErrorCallback): void** is changed to **on(type: 'error', callback: ErrorCallback): void**. - - The sample code is as follows: - - ``` - previewOutput.on('error', (BusinessError) => { - - }) - ``` - -43. Changed the return modes of the **isMirrorSupported** API in PhotoOutput from asynchronous callback and asynchronous promise to the synchronous mode. Therefore, the original APIs **isMirrorSupported(callback: AsyncCallback): void** and **isMirrorSupported(): Promise** are changed to **isMirrorSupported(): boolean**. - - The sample code is as follows: - - ``` - let isSupported = photoOutput.isMirrorSupported(); - ``` - -44. Changed the **on(type:'error') callback** type in PhotoOutput, from **ErrorCallback** to **ErrorCallback**. Therefore, the original API **on(type: 'error', callback: ErrorCallback): void** is changed to **on(type: 'error', callback: ErrorCallback): void**. - - The sample code is as follows: - - ``` - PhotoOutput.on('error', (BusinessError) => { - - }) - ``` - -45. Changed the **on(type:'error') callback** type in VideoOutput, from **ErrorCallback** to **ErrorCallback**. Therefore, the original API **on(type: 'error', callback: ErrorCallback): void** is changed to **on(type: 'error', callback: ErrorCallback): void**. - - The sample code is as follows: - - ``` - VideoOutput.on('error', (BusinessError) => { - - }) - ``` - -46. Changed the **on(type:'error') callback** type in MetadataOutput, from **ErrorCallback** to **ErrorCallback**. Therefore, the original API **on(type: 'error', callback: ErrorCallback): void** is changed to **on(type: 'error', callback: ErrorCallback): void**. - - The sample code is as follows: - - ``` - MetadataOutput.on('error', (BusinessError) => { - - }) - ``` \ No newline at end of file diff --git a/en/release-notes/changelogs/OpenHarmony_3.2.10.5/changelogs-arkui.md b/en/release-notes/changelogs/OpenHarmony_3.2.10.5/changelogs-arkui.md deleted file mode 100644 index 3e4d9a57601c4d8b930451927c91bb209c4954b9..0000000000000000000000000000000000000000 --- a/en/release-notes/changelogs/OpenHarmony_3.2.10.5/changelogs-arkui.md +++ /dev/null @@ -1,217 +0,0 @@ -# ArkUI Subsystem ChangeLog - -## cl.arkui.1 Restrictions on Data Type Declarations of State Variables - -1. The data types of state variables decorated by state decorators must be explicitly declared. They cannot be declared as **any** or **Date**. - - Example: - - ```ts - // xxx.ets - @Entry - @Component - struct DatePickerExample { - // Incorrect: @State isLunar: any = false - @State isLunar: boolean = false - // Incorrect: @State selectedDate: Date = new Date('2021-08-08') - private selectedDate: Date = new Date('2021-08-08') - - build() { - Column() { - Button('Switch Calendar') - .margin({ top: 30 }) - .onClick(() => { - this.isLunar = !this.isLunar - }) - DatePicker({ - start: new Date('1970-1-1'), - end: new Date('2100-1-1'), - selected: this.selectedDate - }) - .lunar(this.isLunar) - .onChange((value: DatePickerResult) => { - this.selectedDate.setFullYear(value.year, value.month, value.day) - console.info('select current date is: ' + JSON.stringify(value)) - }) - - }.width('100%') - } - } - ``` - - ![datePicker](../../../application-dev/reference/arkui-ts/figures/datePicker.gif) - -2. The data type declaration of the **@State**, **@Provide**, **@Link**, or **@Consume** decorated state variables can consist of only one of the primitive data types or reference data types. - - The **Length**, **ResourceStr**, and **ResourceColor** types are combinations of primitive data types or reference data types. Therefore, they cannot be used by the aforementioned types of state variables. - For details about the definitions of **Length**, **ResourceStr**, and **ResourceColor**, see [Types](../../../application-dev/reference/arkui-ts/ts-types.md). - - Example: - - ```ts - // xxx.ets - @Entry - @Component - struct IndexPage { - // Incorrect: @State message: string | Resource = 'Hello World' - @State message: string = 'Hello World' - // Incorrect: @State message: ResourceStr = $r('app.string.hello') - @State resourceStr: Resource = $r('app.string.hello') - - build() { - Row() { - Column() { - Text(`${this.message}`) - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - } - .height('100%') - } - } - ``` - - ![hello](../../../application-dev/quick-start/figures/hello.PNG) - -**Change Impacts** - -1. If the data type of a state variable decorated by a state decorator is declared as **any**, a build error will occur. - ```ts - // ArkTS:ERROR Please define an explicit type, not any. - @State isLunar: any = false - ``` -2. If the data type of a state variable decorated by a state decorator is declared as **Date**, a build error will occur. - ```ts - // ArkTS:ERROR The @State property 'selectedDate' cannot be a 'Date' object. - @State selectedDate: Date = new Date('2021-08-08') - ``` -3. If the data type of a **@State**, **@Provide**, **@Link**, and or **@Consume** decorated state variable is Length, **ResourceStr**, or **ResourceColor**, a build error will occur. - ```ts - /* ArkTS:ERROR The state variable type here is 'ResourceStr', it contains both a simple type and an object type, - which are not allowed to be defined for state variable of a struct.*/ - @State message: ResourceStr = $r('app.string.hello') - ``` - -**Key API/Component Changes** - -N/A - -**Adaptation Guide** - -1. Explicitly declare the data type for state variables decorated by state decorators. -2. If a state variable decorated by a state decorator uses the **Date** object, change it to a regular variable – a variable not decorated by any decorator. -3. Adapt the **@State**, **@Provide**, **@Link**, and **@Consume** decorated variables based on the following code snippet so that they do not use the **Length(string|number|Resource)**, **ResourceStr(string|Resource)**, and **ResourceColor(string|number|Color|Resource)** types: - - ```ts - // Incorrect: - @State message: ResourceStr = $r('app.string.hello') - // Corrected: - @State resourceStr: Resource = $r('app.string.hello') - ``` - -## cl.arkui.2 Initialization Rules and Restrictions of Custom Components' Member Variables - -Comply with the following rules when using constructors to initialize member variables: - -| **From the Variable in the Parent Component (Right) to the Variable in the Child Component (Below)**| **regular** | **@State** | **@Link** | **@Prop** | **@Provide** | **@Consume** | **@ObjectLink** | -|---------------------------------|----------------------------|------------|-----------|-----------|--------------|--------------|------------------| -| **regular** | Supported | Supported | Supported | Supported | Not supported | Not supported | Supported | -| **@State** | Supported | Supported | Supported | Supported | Supported | Supported | Supported | -| **@Link** | Not supported | Supported (1) | Supported (1) | Supported (1) | Supported (1) | Supported (1) | Supported (1) | -| **@Prop** | Supported | Supported | Supported | Supported | Supported | Supported | Supported | -| **@Provide** | Supported | Supported | Supported | Supported | Supported | Supported | Supported | -| **@Consume** | Not supported | Not supported | Not supported | Not supported | Not supported | Not supported | Not supported | -| **@ObjectLink** | Not supported | Not supported | Not supported | Not supported | Not supported | Not supported | Not supported | - -| **From the Variable in the Parent Component (Right) to the Variable in the Child Component (Below)**| **@StorageLink** | **@StorageProp** | **@LocalStorageLink** | **@LocalStorageProp** | -|------------------|------------------|------------------|-----------------------|------------------------| -| **regular** | Supported | Not supported | Not supported | Not supported | -| **@State** | Supported | Supported | Supported | Supported | -| **@Link** | Supported (1) | Supported (1) | Supported (1) | Supported (1) | -| **@Prop** | Supported | Supported | Supported | Supported | -| **@Provide** | Supported | Supported | Supported | Supported | -| **@Consume** | Not supported | Not supported | Not supported | Not supported | -| **@ObjectLink** | Not supported | Not supported | Not supported | Not supported | - -> **NOTE** -> -> **Supported (1)**: The dollar sign ($) must be used, for example, **this.$varA**. -> -> **regular**: refers to a regular variable that is not decorated by any decorator. - -**@StorageLink**, **@StorageProp**, **@LocalStorageLink**, and **@LocalStorageProp** variables cannot be initialized from the parent component. - -**Change Impacts** - -1. Variables decorated by **@LocalStorageLink** and **@LocalStorageProp** cannot be initialized from the parent component. - ```ts - @Entry - @Component - struct LocalStorageComponent { - build() { - Column() { - Child({ - /* ArkTS:ERROR Property 'simpleVarName' in the custom component 'Child' cannot - initialize here (forbidden to specify). */ - simpleVarName: 1, - /* ArkTS:ERROR Property 'objectName' in the custom component 'Child' cannot - initialize here (forbidden to specify). */ - objectName: new ClassA("x") - }) - } - } - } - @Component - struct Child { - @LocalStorageLink("storageSimpleProp") simpleVarName: number = 0; - @LocalStorageProp("storageObjectProp") objectName: ClassA = new ClassA("x"); - build() {} - } - ``` -2. The **@ObjectLink** decorated variable cannot be directly initialized from a decorated variable in the parent component. The source of the parent component must be an array item or object attribute decorated by **@State**, **@Link**, **@Provide**, **@Consume**, or **@ObjectLink**. - ```ts - let NextID : number = 0; - - @Observed class ClassA { - public id : number; - public c: number; - constructor(c: number) { - this.id = NextID++; - this.c = c; - } - } - - @Component - struct Child { - @ObjectLink varA : ClassA; - build() { - Row() { - Text('ViewA-' + this.varA.id) - } - } - } - - @Component - struct Parent { - @Link linkValue: ClassA - build() { - Column() { - /* ArkTS:ERROR The @Link property 'linkValue' cannot be assigned to - the @ObjectLink property 'varA'.*/ - Child({ varA: this.linkValue }) - } - } - } - ``` - -**Key API/Component Changes** - -N/A - -**Adaptation Guide** -1. When building a child component, do not perform the build on the variables decorated by **@LocalStorageLink** and **@LocalStorageProp** in the child component. - - To change these variables from the parent component, use the API provided by the **LocalStorage** (such as the **set** API) to assign values to them. - -2. For details about how to use **@ObjectLink**, see [@Observed and @ObjectLink](../../../application-dev/quick-start/arkts-state-mgmt-page-level.md). diff --git a/en/release-notes/changelogs/OpenHarmony_3.2.10.5/changelogs-bundlemanager.md b/en/release-notes/changelogs/OpenHarmony_3.2.10.5/changelogs-bundlemanager.md deleted file mode 100644 index e0f29bcac24ac3261ae12ea6810ab5da6c4907b8..0000000000000000000000000000000000000000 --- a/en/release-notes/changelogs/OpenHarmony_3.2.10.5/changelogs-bundlemanager.md +++ /dev/null @@ -1,41 +0,0 @@ -# Bundle Manager Subsystem ChangeLog - -## cl.bundlemanager.1 Field Change of the ApplicationInfo Struct in API Version 9 - -The **entryDir** field is deleted from the **ApplicationInfo** struct [[bundleManager/applicationInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/monthly_20221018/api/bundleManager/applicationInfo.d.ts)] in API version 9. - -**Change Impacts** - -There is no impact on applications that use the APIs of versions earlier than 9. The applications that use the APIs of version 9 must adapt to the new modules and APIs. - -**Key API/Component Changes** - -The following table describes the changed fields in the **ApplicationInfo** struct. - -| Deleted Field| Added or Changed Field in API Version 9| Type| -| --- | --- | --- | -| entryDir | None | string | - -**Adaptation Guide** - -When importing the bundle management query module, delete the **entryDir** field from the **ApplicationInfo** struct of API version 9. - -## cl.bundlemanager.2 Field Change of the HapModuleInfo Struct in API Version 9 - -The **moduleSourceDir** field is deleted from the **HapModuleInfo** struct [[bundleManager/hapModuleInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/monthly_20221018/api/bundleManager/hapModuleInfo.d.ts)] in API version 9. - -**Change Impacts** - -There is no impact on applications that use the APIs of versions earlier than 9. The applications that use the APIs of version 9 must adapt to the new modules and APIs. - -**Key API/Component Changes** - -The following table describes the changed fields in the **HapModuleInfo** struct. - -| Deleted Field| Added or Changed Field in API Version 9| Type| -| --- | --- | --- | -| moduleSourceDir | None | string | - -**Adaptation Guide** - -When importing the bundle manager query module, delete the **moduleSourceDir** field from the **HapModuleInfo** struct of API version 9. \ No newline at end of file diff --git a/en/release-notes/changelogs/OpenHarmony_3.2.10.5/changelogs-media.md b/en/release-notes/changelogs/OpenHarmony_3.2.10.5/changelogs-media.md deleted file mode 100644 index 01455e8774555943174a21a80f343b607a4a0069..0000000000000000000000000000000000000000 --- a/en/release-notes/changelogs/OpenHarmony_3.2.10.5/changelogs-media.md +++ /dev/null @@ -1,314 +0,0 @@ -# Media Subsystem ChangeLog - -## cl.media.1 API Change of the Playback Function - -Added the [AVPlayer](../../../application-dev/reference/apis/js-apis-media.md#avplayer9)9+ API for audio and video playback, with the updated state machine and error codes, which is recommended. The following APIs for audio playback and video playback are no longer maintained: [AudioPlayer](../../../application-dev/reference/apis/js-apis-media.md#audioplayer)6+ and [VideoPlayer](../../../application-dev/reference/apis/js-apis-media.md#videoplayer)8+. - -**Change Impacts** - -The original APIs can still be used but are no longer maintained. You are advised to use the new API instead. - -**Key API/Component Changes** - -Added APIs - -| Class | Declaration | -| -------------- | ------------------------------------------------------------ | -| media | createAVPlayer(callback: AsyncCallback\): void | -| media | createAVPlayer() : Promise\ | -| media.AVPlayer | interface AVPlayer | -| media.AVPlayer | videoScaleType ?: VideoScaleType | -| media.AVPlayer | url ?: string | -| media.AVPlayer | surfaceId ?: string | -| media.AVPlayer | stop(callback: AsyncCallback\): void | -| media.AVPlayer | stop(): Promise\ | -| media.AVPlayer | setVolume(volume: number): void | -| media.AVPlayer | setSpeed(speed: PlaybackSpeed): void | -| media.AVPlayer | setBitrate(bitrate: number): void | -| media.AVPlayer | seek(timeMs: number, mode?:SeekMode): void | -| media.AVPlayer | reset(callback: AsyncCallback\): void | -| media.AVPlayer | reset(): Promise\ | -| media.AVPlayer | release(callback: AsyncCallback\): void | -| media.AVPlayer | release(): Promise\ | -| media.AVPlayer | readonly width: number | -| media.AVPlayer | readonly state: AVPlayerState | -| media.AVPlayer | readonly height: number | -| media.AVPlayer | readonly duration: number | -| media.AVPlayer | readonly currentTime: number | -| media.AVPlayer | prepare(callback: AsyncCallback\): void | -| media.AVPlayer | prepare(): Promise\ | -| media.AVPlayer | play(callback: AsyncCallback\): void | -| media.AVPlayer | play(): Promise\ | -| media.AVPlayer | pause(callback: AsyncCallback\): void | -| media.AVPlayer | pause(): Promise\ | -| media.AVPlayer | on(type: 'volumeChange', callback: Callback\): void | -| media.AVPlayer | on(type: 'videoSizeChange', callback: (width: number, height: number) => void): void | -| media.AVPlayer | on(type: 'timeUpdate', callback: Callback\): void | -| media.AVPlayer | on(type: 'stateChange', callback: (state: AVPlayerState, reason: StateChangeReason) => void): void | -| media.AVPlayer | on(type: 'startRenderFrame', callback: Callback\): void | -| media.AVPlayer | on(type: 'speedDone', callback: Callback\): void | -| media.AVPlayer | on(type: 'seekDone', callback: Callback\): void | -| media.AVPlayer | on(type: 'error', callback: ErrorCallback): void | -| media.AVPlayer | on(type: 'endOfStream', callback: Callback\): void | -| media.AVPlayer | on(type: 'durationUpdate', callback: Callback\): void | -| media.AVPlayer | on(type: 'bufferingUpdate', callback: (infoType: BufferingInfoType, value: number) => void): void | -| media.AVPlayer | on(type: 'bitrateDone', callback: Callback\): void | -| media.AVPlayer | on(type: 'availableBitrates', callback: (bitrates: Array\) => void): void | -| media.AVPlayer | on(type: 'audioInterrupt', callback: (info: audio.InterruptEvent) => void): void | -| media.AVPlayer | off(type: 'volumeChange'): void | -| media.AVPlayer | off(type: 'videoSizeChange'): void | -| media.AVPlayer | off(type: 'timeUpdate'): void | -| media.AVPlayer | off(type: 'stateChange'): void | -| media.AVPlayer | off(type: 'startRenderFrame'): void | -| media.AVPlayer | off(type: 'speedDone'): void | -| media.AVPlayer | off(type: 'seekDone'): void | -| media.AVPlayer | off(type: 'error'): void | -| media.AVPlayer | off(type: 'endOfStream'): void | -| media.AVPlayer | off(type: 'durationUpdate'): void | -| media.AVPlayer | off(type: 'bufferingUpdate'): void | -| media.AVPlayer | off(type: 'bitrateDone'): void | -| media.AVPlayer | off(type: 'availableBitrates'): void | -| media.AVPlayer | off(type: 'audioInterrupt'): void | -| media.AVPlayer | loop: boolean | -| media.AVPlayer | getTrackDescription(callback: AsyncCallback\>): void | -| media.AVPlayer | getTrackDescription() : Promise\> | -| media.AVPlayer | fdSrc ?: AVFileDescriptor | -| media.AVPlayer | audioInterruptMode ?: audio.InterruptMode | -| unnamed | type AVPlayerState = 'idle' \| 'initialized' \| 'prepared' \| 'playing' \| 'paused' \| 'completed' \| 'stopped' \| 'released' \| 'error' | - -APIs no longer maintained - -| Class | Declaration | -| ----------------- | ------------------------------------------------------------ | -| media | createVideoPlayer(callback: AsyncCallback\): void | -| media | createVideoPlayer() : Promise\ | -| media | createAudioPlayer(): AudioPlayer | -| media.AudioPlayer | interface AudioPlayer | -| media.AudioPlayer | play(): void | -| media.AudioPlayer | release(): void | -| media.AudioPlayer | audioInterruptMode ?: audio.InterruptMode | -| media.AudioPlayer | fdSrc: AVFileDescriptor | -| media.AudioPlayer | seek(timeMs: number): void | -| media.AudioPlayer | readonly duration: number | -| media.AudioPlayer | loop: boolean | -| media.AudioPlayer | readonly state: AudioState | -| media.AudioPlayer | getTrackDescription(callback: AsyncCallback\>): void | -| media.AudioPlayer | getTrackDescription() : Promise\> | -| media.AudioPlayer | on(type: 'bufferingUpdate', callback: (infoType: BufferingInfoType, value: number) => void): void | -| media.AudioPlayer | on(type: 'play' \| 'pause' \| 'stop' \| 'reset' \| 'dataLoad' \| 'finish' \| 'volumeChange', callback: () => void): void | -| media.AudioPlayer | on(type: 'timeUpdate', callback: Callback\): void | -| media.AudioPlayer | on(type: 'audioInterrupt', callback: (info: audio.InterruptEvent) => void): void | -| media.AudioPlayer | on(type: 'error', callback: ErrorCallback): void | -| media.AudioPlayer | setVolume(vol: number): void | -| media.AudioPlayer | pause(): void | -| media.AudioPlayer | readonly currentTime: number | -| media.AudioPlayer | stop(): void | -| media.AudioPlayer | reset(): void | -| media.AudioPlayer | src: string | -| media.VideoPlayer | interface VideoPlayer | -| media.VideoPlayer | play(callback: AsyncCallback\): void | -| media.VideoPlayer | play(): Promise\ | -| media.VideoPlayer | prepare(callback: AsyncCallback\): void | -| media.VideoPlayer | prepare(): Promise\ | -| media.VideoPlayer | release(callback: AsyncCallback\): void | -| media.VideoPlayer | release(): Promise\ | -| media.VideoPlayer | audioInterruptMode ?: audio.InterruptMode | -| media.VideoPlayer | fdSrc: AVFileDescriptor | -| media.VideoPlayer | seek(timeMs: number, callback: AsyncCallback\): void | -| media.VideoPlayer | seek(timeMs: number, mode:SeekMode, callback: AsyncCallback\): void | -| media.VideoPlayer | seek(timeMs: number, mode?:SeekMode): Promise\ | -| media.VideoPlayer | readonly duration: number | -| media.VideoPlayer | loop: boolean | -| media.VideoPlayer | videoScaleType ?: VideoScaleType | -| media.VideoPlayer | readonly state: VideoPlayState | -| media.VideoPlayer | getTrackDescription(callback: AsyncCallback\>): void | -| media.VideoPlayer | getTrackDescription() : Promise\> | -| media.VideoPlayer | readonly height: number | -| media.VideoPlayer | on(type: 'playbackCompleted', callback: Callback\): void | -| media.VideoPlayer | on(type: 'bufferingUpdate', callback: (infoType: BufferingInfoType, value: number) => void): void | -| media.VideoPlayer | on(type: 'startRenderFrame', callback: Callback\): void | -| media.VideoPlayer | on(type: 'videoSizeChanged', callback: (width: number, height: number) => void): void | -| media.VideoPlayer | on(type: 'audioInterrupt', callback: (info: audio.InterruptEvent) => void): void | -| media.VideoPlayer | on(type: 'error', callback: ErrorCallback): void | -| media.VideoPlayer | setDisplaySurface(surfaceId: string, callback: AsyncCallback\): void | -| media.VideoPlayer | setDisplaySurface(surfaceId: string): Promise\ | -| media.VideoPlayer | setVolume(vol: number, callback: AsyncCallback\): void | -| media.VideoPlayer | setVolume(vol: number): Promise\ | -| media.VideoPlayer | url: string | -| media.VideoPlayer | pause(callback: AsyncCallback\): void | -| media.VideoPlayer | pause(): Promise\ | -| media.VideoPlayer | readonly currentTime: number | -| media.VideoPlayer | setSpeed(speed:number, callback: AsyncCallback\): void | -| media.VideoPlayer | setSpeed(speed:number): Promise\ | -| media.VideoPlayer | stop(callback: AsyncCallback\): void | -| media.VideoPlayer | stop(): Promise\ | -| media.VideoPlayer | readonly width: number | -| media.VideoPlayer | reset(callback: AsyncCallback\): void | -| media.VideoPlayer | reset(): Promise\ | -| unnamed | type AudioState = 'idle' \| 'playing' \| 'paused' \| 'stopped' \| 'error' | -| unnamed | type VideoPlayState = 'idle' \| 'prepared' \| 'playing' \| 'paused' \| 'stopped' \| 'error' | - -**Adaptation Guide** - -For details, see the [reference](../../../application-dev/reference/apis/js-apis-media.md) for each API. - -## cl.media.2 API Change of the Recording Function - -Added the [AVRecorder](../../../application-dev/reference/apis/js-apis-media.md#avrecorder9)9+ API for audio and video recording, with the updated state machine and error codes, which is recommended. The following APIs for audio recording and video recording are no longer maintained: [AudioRecorder](../../../application-dev/reference/apis/js-apis-media.md#audiorecorder)6+ and [VideoRecorder](../../../application-dev/reference/apis/js-apis-media.md#videorecorder9)9+. - -The [AudioSourceType](../../../application-dev/reference/apis/js-apis-media.md#audiosourcetype9) and [VideoSourceType](../../../application-dev/reference/apis/js-apis-media.md#videosourcetype9) APIs shared by the old and new recording APIs are changed to non-system APIs. - -**Change Impacts** - -The [AudioRecorder](../../../application-dev/reference/apis/js-apis-media.md#audiorecorder)6+ and [VideoRecorder](../../../application-dev/reference/apis/js-apis-media.md#videorecorder9)9+ APIs can still be used but are no longer maintained. You are advised to use the [AVRecorder](../../../application-dev/reference/apis/js-apis-media.md#avrecorder9)9+ API instead. - -**Key API/Component Changes** - -Added APIs - -| Class | Declaration | -| ----------------------- | ------------------------------------------------------------ | -| media | createAVRecorder(callback: AsyncCallback\): void | -| media | createAVRecorder() : Promise\ | -| media.AVRecorder | interface AVRecorder | -| media.AVRecorder | prepare(config: AVRecorderConfig, callback: AsyncCallback\): void | -| media.AVRecorder | prepare(config: AVRecorderConfig): Promise\ | -| media.AVRecorder | release(callback: AsyncCallback\): void | -| media.AVRecorder | release(): Promise\ | -| media.AVRecorder | readonly state: AVRecorderState | -| media.AVRecorder | on(type: 'stateChange', callback: (state: AVRecorderState, reason: StateChangeReason) => void): void | -| media.AVRecorder | on(type: 'error', callback: ErrorCallback): void | -| media.AVRecorder | resume(callback: AsyncCallback\): void | -| media.AVRecorder | resume(): Promise\ | -| media.AVRecorder | start(callback: AsyncCallback\): void | -| media.AVRecorder | start(): Promise\ | -| media.AVRecorder | off(type: 'stateChange'): void | -| media.AVRecorder | off(type: 'error'): void | -| media.AVRecorder | pause(callback: AsyncCallback\): void | -| media.AVRecorder | pause(): Promise\ | -| media.AVRecorder | stop(callback: AsyncCallback\): void | -| media.AVRecorder | stop(): Promise\ | -| media.AVRecorder | reset(callback: AsyncCallback\): void | -| media.AVRecorder | reset(): Promise\ | -| media.AVRecorder | getInputSurface(callback: AsyncCallback\): void | -| media.AVRecorder | getInputSurface(): Promise\ | -| media.AVRecorderConfig | videoSourceType?: VideoSourceType | -| media.AVRecorderConfig | audioSourceType?: AudioSourceType | -| media.AVRecorderConfig | profile: AVRecorderProfile | -| media.AVRecorderConfig | rotation?: number | -| media.AVRecorderConfig | url: string | -| media.AVRecorderConfig | location?: Location | -| media.AVRecorderConfig | interface AVRecorderConfig | -| media.AVRecorderProfile | videoBitrate?: number | -| media.AVRecorderProfile | videoCodec?: CodecMimeType | -| media.AVRecorderProfile | audioCodec?: CodecMimeType | -| media.AVRecorderProfile | videoFrameRate?: number | -| media.AVRecorderProfile | videoFrameHeight?: number | -| media.AVRecorderProfile | audioSampleRate?: number | -| media.AVRecorderProfile | audioBitrate?: number | -| media.AVRecorderProfile | videoFrameWidth?: number | -| media.AVRecorderProfile | audioChannels?: number | -| media.AVRecorderProfile | fileFormat: ContainerFormatType | -| media.AVRecorderProfile | interface AVRecorderProfile | -| unnamed | type AVRecorderState = 'idle' \| 'prepared' \| 'started' \| 'paused' \| 'stopped' \| 'released' \| 'error' | - -APIs no longer maintained - -| Class | Declaration | -| -------------------------- | ------------------------------------------------------------ | -| media | createVideoRecorder(callback: AsyncCallback\): void | -| media | createVideoRecorder(): Promise\ | -| media | createAudioRecorder(): AudioRecorder | -| media.AudioRecorder | interface AudioRecorder | -| media.AudioRecorder | prepare(config: AudioRecorderConfig): void | -| media.AudioRecorder | release(): void | -| media.AudioRecorder | on(type: 'prepare' \| 'start' \| 'pause' \| 'resume' \| 'stop' \| 'release' \| 'reset', callback: () => void): void | -| media.AudioRecorder | on(type: 'error', callback: ErrorCallback): void | -| media.AudioRecorder | resume(): void | -| media.AudioRecorder | start(): void | -| media.AudioRecorder | pause(): void | -| media.AudioRecorder | stop(): void | -| media.AudioRecorder | reset(): void | -| media.AudioRecorderConfig | audioSampleRate?: number | -| media.AudioRecorderConfig | location?: Location | -| media.AudioRecorderConfig | fileFormat?: ContainerFormatType | -| media.AudioRecorderConfig | interface AudioRecorderConfig | -| media.AudioRecorderConfig | audioEncoder?: AudioEncoder | -| media.AudioRecorderConfig | audioEncodeBitRate?: number | -| media.AudioRecorderConfig | numberOfChannels?: number | -| media.AudioRecorderConfig | format?: AudioOutputFormat | -| media.AudioRecorderConfig | uri: string | -| media.AudioRecorderConfig | audioEncoderMime?: CodecMimeType | -| media.VideoRecorder | interface VideoRecorder | -| media.VideoRecorder | prepare(config: VideoRecorderConfig, callback: AsyncCallback\): void | -| media.VideoRecorder | prepare(config: VideoRecorderConfig): Promise\ | -| media.VideoRecorder | release(callback: AsyncCallback\): void | -| media.VideoRecorder | release(): Promise\ | -| media.VideoRecorder | readonly state: VideoRecordState | -| media.VideoRecorder | on(type: 'error', callback: ErrorCallback): void | -| media.VideoRecorder | resume(callback: AsyncCallback\): void | -| media.VideoRecorder | resume(): Promise\ | -| media.VideoRecorder | start(callback: AsyncCallback\): void | -| media.VideoRecorder | start(): Promise\ | -| media.VideoRecorder | pause(callback: AsyncCallback\): void | -| media.VideoRecorder | pause(): Promise\ | -| media.VideoRecorder | stop(callback: AsyncCallback\): void | -| media.VideoRecorder | stop(): Promise\ | -| media.VideoRecorder | reset(callback: AsyncCallback\): void | -| media.VideoRecorder | reset(): Promise\ | -| media.VideoRecorder | getInputSurface(callback: AsyncCallback\): void | -| media.VideoRecorder | getInputSurface(): Promise\ | -| media.VideoRecorderConfig | videoSourceType: VideoSourceType | -| media.VideoRecorderConfig | audioSourceType?: AudioSourceType | -| media.VideoRecorderConfig | profile: VideoRecorderProfile | -| media.VideoRecorderConfig | rotation?: number | -| media.VideoRecorderConfig | url: string | -| media.VideoRecorderConfig | location?: Location | -| media.VideoRecorderConfig | interface VideoRecorderConfig | -| media.VideoRecorderProfile | readonly videoBitrate: number | -| media.VideoRecorderProfile | readonly videoCodec: CodecMimeType | -| media.VideoRecorderProfile | readonly audioCodec: CodecMimeType | -| media.VideoRecorderProfile | readonly videoFrameRate: number | -| media.VideoRecorderProfile | readonly videoFrameHeight: number | -| media.VideoRecorderProfile | readonly audioSampleRate: number | -| media.VideoRecorderProfile | readonly audioBitrate: number | -| media.VideoRecorderProfile | readonly videoFrameWidth: number | -| media.VideoRecorderProfile | readonly audioChannels: number | -| media.VideoRecorderProfile | readonly fileFormat: ContainerFormatType | -| media.VideoRecorderProfile | interface VideoRecorderProfile | -| unnamed | type VideoRecordState = 'idle' \| 'prepared' \| 'playing' \| 'paused' \| 'stopped' \| 'error' | - -Changed APIs - -| Class | Declaration | Capability Before Change | Capability After Change | Whether a System API Before Change| Whether a System API After Change| -| --------------------- | ------------------------------------------------------------ | ----------------------------------------------- | -------------------------------------------- | -------------------- | -------------------- | -| media.AudioSourceType | enum AudioSourceType { /** * default audio source type. * @since 9 * @syscap SystemCapability.Multimedia.Media.AVRecorder */ AUDIO_SOURCE_TYPE_DEFAULT = 0, /** * source type mic. * @since 9 * @syscap SystemCapability.Multimedia.Media.AVRecorder */ AUDIO_SOURCE_TYPE_MIC = 1, } | SystemCapability.Multimedia.Media.VideoRecorder | SystemCapability.Multimedia.Media.AVRecorder | Yes | No | -| media.VideoSourceType | enum VideoSourceType { /** * surface raw data. * @since 9 * @syscap SystemCapability.Multimedia.Media.AVRecorder */ VIDEO_SOURCE_TYPE_SURFACE_YUV = 0, /** * surface ES data. * @since 9 * @syscap SystemCapability.Multimedia.Media.AVRecorder */ VIDEO_SOURCE_TYPE_SURFACE_ES = 1, } | SystemCapability.Multimedia.Media.VideoRecorder | SystemCapability.Multimedia.Media.AVRecorder | Yes | No | - -**Adaptation Guide** - -For details, see the [reference](../../../application-dev/reference/apis/js-apis-media.md) for each API. - -## cl.media.3 Error Code Change - -Added the standard error code enumeration type [AVErrorCode9](../../../application-dev/reference/apis/js-apis-media.md#averrorcode)9+ that replaces the original error code enumeration type [MediaErrorCode](../../../application-dev/reference/apis/js-apis-media.md#mediaerrorcode)8+. - -**Change Impacts** - -The error code enumeration type [MediaErrorCode](../../../application-dev/reference/apis/js-apis-media.md#mediaerrorcode)8+ is still used for original APIs. [AVErrorCode9](../../../application-dev/reference/apis/js-apis-media.md#averrorcode)9+ is used for newly added APIs. - -**Key API/Component Changes** - -Added API - -| Class | Declaration | -| ----------------- | ------------------------------------------------------------ | -| media.AVErrorCode | enum AVErrorCode { /** * operation success. * @since 9 * @syscap SystemCapability.Multimedia.Media.Core */ AVERR_OK = 0, /** * permission denied. * @since 9 * @syscap SystemCapability.Multimedia.Media.Core */ AVERR_NO_PERMISSION = 201, /** * invalid parameter. * @since 9 * @syscap SystemCapability.Multimedia.Media.Core */ AVERR_INVALID_PARAMETER = 401, /** * the api is not supported in the current version * @since 9 * @syscap SystemCapability.Multimedia.Media.Core */ AVERR_UNSUPPORT_CAPABILITY = 801, /** * the system memory is insufficient or the number of services reaches the upper limit * @since 9 * @syscap SystemCapability.Multimedia.Media.Core */ AVERR_NO_MEMORY = 5400101, /** * current status does not allow or do not have permission to perform this operation * @since 9 * @syscap SystemCapability.Multimedia.Media.Core */ AVERR_OPERATE_NOT_PERMIT = 5400102, /** * data flow exception information * @since 9 * @syscap SystemCapability.Multimedia.Media.Core */ AVERR_IO = 5400103, /** * system or network response timeout. * @since 9 * @syscap SystemCapability.Multimedia.Media.Core */ AVERR_TIMEOUT = 5400104, /** * service process died. * @since 9 * @syscap SystemCapability.Multimedia.Media.Core */ AVERR_SERVICE_DIED = 5400105, /** * unsupported media format * @since 9 * @syscap SystemCapability.Multimedia.Media.Core */ AVERR_UNSUPPORT_FORMAT = 5400106, } | - -API no longer maintained - -| Class | Declaration | -| -------------------- | ------------------------------------------------------------ | -| media.MediaErrorCode | enum MediaErrorCode { /** * operation success. * @since 8 * @syscap SystemCapability.Multimedia.Media.Core */ MSERR_OK = 0, /** * malloc or new memory failed. maybe system have no memory. * @since 8 * @syscap SystemCapability.Multimedia.Media.Core */ MSERR_NO_MEMORY = 1, /** * no permission for the operation. * @since 8 * @syscap SystemCapability.Multimedia.Media.Core */ MSERR_OPERATION_NOT_PERMIT = 2, /** * invalid argument. * @since 8 * @syscap SystemCapability.Multimedia.Media.Core */ MSERR_INVALID_VAL = 3, /** * an I/O error occurred. * @since 8 * @syscap SystemCapability.Multimedia.Media.Core */ MSERR_IO = 4, /** * operation time out. * @since 8 * @syscap SystemCapability.Multimedia.Media.Core */ MSERR_TIMEOUT = 5, /** * unknown error. * @since 8 * @syscap SystemCapability.Multimedia.Media.Core */ MSERR_UNKNOWN = 6, /** * media service died. * @since 8 * @syscap SystemCapability.Multimedia.Media.Core */ MSERR_SERVICE_DIED = 7, /** * operation is not permit in current state. * @since 8 * @syscap SystemCapability.Multimedia.Media.Core */ MSERR_INVALID_STATE = 8, /** * operation is not supported in current version. * @since 8 * @syscap SystemCapability.Multimedia.Media.Core */ MSERR_UNSUPPORTED = 9, } | - - \ No newline at end of file diff --git a/en/release-notes/changelogs/OpenHarmony_3.2.10.5/changelogs-useriam.md b/en/release-notes/changelogs/OpenHarmony_3.2.10.5/changelogs-useriam.md deleted file mode 100644 index a3abb3143332e234f4583eaffc95aed632cb5260..0000000000000000000000000000000000000000 --- a/en/release-notes/changelogs/OpenHarmony_3.2.10.5/changelogs-useriam.md +++ /dev/null @@ -1,17 +0,0 @@ -# User IAM Subsystem ChangeLog - -## cl.useriam.1 API9 Authentication Result Code Class Name Change - -The name of the authentication result code class of user IAM API version 9 is changed from **ResultCode** to **UserAuthResultCode**. - -**Change Impacts** - -Applications developed based on earlier versions are not affected. For the applications developed from this version, the class name of the error code needs to be adapted. Otherwise, the service logic is affected. - -**Key API/Component Changes** - -N/A - -**Adaptation Guide** - -Change the class name for invoking the authentication result code from **ResultCode** to **UserAuthResultCode**. diff --git a/en/release-notes/changelogs/OpenHarmony_3.2.10.5/changelogs-window.md b/en/release-notes/changelogs/OpenHarmony_3.2.10.5/changelogs-window.md deleted file mode 100644 index b3514e82cca44c154a70b999e6cc62a54d47ff92..0000000000000000000000000000000000000000 --- a/en/release-notes/changelogs/OpenHarmony_3.2.10.5/changelogs-window.md +++ /dev/null @@ -1,63 +0,0 @@ -# Window Subsystem ChangeLog - -## cl.window.1 Change of Window Stage Lifecycle Listener Types - -Changed the enumerated listener types of the window stage lifecycle in version 3.2.10.5 and later. - -**Change Impacts** - -Application lifecycle listeners developed using **FOREGROUND** and **BACKGROUND** in versions earlier than 3.2.10.5 will be invalidated in version 3.2.10.5 and later. - -**Key API/Component Changes** - -## WindowStageEventType9+ - -Before change - -| Name | Value | Description | -| ---------- | ---- | ---------- | -| FOREGROUND | 1 | The window stage is running in the foreground.| -| BACKGROUND | 4 | The window stage is running in the background.| - -After change -| Name | Value | Description | -| ------ | ---- | ---------- | -| SHOWN | 1 | The window stage is running in the foreground.| -| HIDDEN | 4 | The window stage is running in the background.| - -**Adaptation Guide** - -When registering lifecycle listeners, change the foreground and background event types to **SHOWN** and **HIDDEN**, respectively. - -``` -import Ability from '@ohos.application.Ability'; - -class myAbility extends Ability { - onWindowStageCreate(windowStage) { - console.log('onWindowStageCreate'); - try { - windowStage.on('windowStageEvent', (stageEventType) => { - switch (stageEventType) { - case window.WindowStageEventType.SHOWN: - console.log("windowStage shown"); - break; - case window.WindowStageEventType.ACTIVE: - console.log("windowStage active"); - break; - case window.WindowStageEventType.INACTIVE: - console.log("windowStage inActive"); - break; - case window.WindowStageEventType.HIDDEN: - console.log("windowStage hidden"); - break; - default: - break; - } - } ) - } catch (exception) { - console.error('Failed to enable the listener for window stage event changes. Cause:' + - JSON.stringify(exception)); - }; - } -}; -``` diff --git a/en/release-notes/changelogs/OpenHarmony_3.2.10.6/changelogs-request.md b/en/release-notes/changelogs/OpenHarmony_3.2.10.6/changelogs-request.md deleted file mode 100644 index f5d0e2eb9849c362fc25c6c106c127aeacfdd471..0000000000000000000000000000000000000000 --- a/en/release-notes/changelogs/OpenHarmony_3.2.10.6/changelogs-request.md +++ /dev/null @@ -1,42 +0,0 @@ -# Upload and Download Subsystem Changelog - - -## cl.request.2 request API Change - -Deleted the beta APIs in API version 9: - -1. function download(context: BaseContext, config: DownloadConfig, callback: AsyncCallback\): void; -2. function download(context: BaseContext, config: DownloadConfig): Promise\; -3. function upload(context: BaseContext, config: UploadConfig, callback: AsyncCallback\): void; -4. function upload(context: BaseContext, config: UploadConfig): Promise\; - -**Change Impact** - -The application developed based on an earlier version in the stage model needs to be adapted to the new APIs. Otherwise, the original service logic will be affected. - -**Key API/Component Changes** - -| Module | Class | Method/Attribute/Enum/Constant | Change Type| -|--------------|--------------|-------------------------------------------------------------------------------------------------------------------|------| -| ohos.request | request | function download(context: BaseContext, config: DownloadConfig, callback: AsyncCallback\): void; | Deleted | -| ohos.request | request | function download(context: BaseContext, config: DownloadConfig): Promise\; | Deleted | -| ohos.request | request | function upload(context: BaseContext, config: UploadConfig, callback: AsyncCallback\): void; | Deleted | -| ohos.request | request | function upload(context: BaseContext, config: UploadConfig): Promise\; | Deleted | - -**Adaptation Guide** - -Call the new APIs. The following uses **downloadFile** as an example to show how it is called in the new version: - -```ts -try { - request.downloadFile(globalThis.abilityContext, { url: 'https://xxxx/xxxxx.hap', - filePath: 'xxx/xxxxx.hap'}, (err, data) => { - if (err) { - console.error('Failed to request the download. Cause: ' + JSON.stringify(err)); - return; - } - }); -} catch (err) { - console.log("downloadFile callback fail." + "errCode:" + err.code + ",errMessage:" + err.message); -} -``` diff --git a/en/release-notes/changelogs/OpenHarmony_3.2.10.6/changelogs-telephony.md b/en/release-notes/changelogs/OpenHarmony_3.2.10.6/changelogs-telephony.md deleted file mode 100644 index f01e76ad64807d79f1c84f249d01df9b9afdddd4..0000000000000000000000000000000000000000 --- a/en/release-notes/changelogs/OpenHarmony_3.2.10.6/changelogs-telephony.md +++ /dev/null @@ -1,59 +0,0 @@ -# Telephony Subsystem Changelog - - - -## cl.telephony.1 Radio Module API Change - - -### `isNrSupported` API Change for the Radio Module of Telephony Subsystem - -NR is a proper noun and must be capitalized. - -You need to adapt your application. - - - -**Change Impacts** - -The JS API needs to be adapted for applications developed based on earlier versions. Otherwise, relevant functions will be affected. - - - -**Key API/Component Changes** - -- Involved APIs: - - isNrSupported(): boolean; - isNrSupported(slotId: number): boolean; - -- Before change: - -```js -function isNrSupported(): boolean; -function isNrSupported(slotId: number): boolean; -``` - -- After change: - -```js -function isNRSupported(): boolean; -function isNRSupported(slotId: number): boolean; -``` - - - -**Adaptation Guide** - -Use the new API. The sample code is as follows: - -```js -let result = radio.isNrSupported(); -console.log("Result: "+ result); -``` - - -```js -let slotId = 0; -let result = radio.isNRSupported(slotId); -console.log("Result: "+ result); -``` diff --git a/en/release-notes/changelogs/OpenHarmony_3.2.10.7/changelog-security.md b/en/release-notes/changelogs/OpenHarmony_3.2.10.7/changelog-security.md deleted file mode 100644 index caf1866f3a5caec4bb78d7f7991208f8c9da46e9..0000000000000000000000000000000000000000 --- a/en/release-notes/changelogs/OpenHarmony_3.2.10.7/changelog-security.md +++ /dev/null @@ -1,86 +0,0 @@ -# Security Subsystem Changelog - -## cl.security.1 ParamsSpec Attribute Name Change -Changed **algoName** of the **ParamsSpec** structure to **algName**. - -**Change Impact** - -For the released JavaScript APIs that use **ParamsSpec** and its child classes **IvParamsSpec**, **GcmParamsSpec**, and **CcmParamsSpec** as parameters or return values, **algoName** must be changed to **algName**. -The change must be made for all the applications that use these APIs. Otherwise, the compilation in the SDK of the new version cannot be successful. - -**Key API/Component Changes** - -API prototype before the change: - - ```ts -interface ParamsSpec { - /** - * Indicates the algorithm name. Should be set before initialization of a cipher object. - * @type { string } - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - algoName : string; -} - ``` -API prototype after the change: - - ```ts -interface ParamsSpec { - /** - * Indicates the algorithm name. Should be set before initialization of a cipher object. - * @type { string } - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - algName : string; -} - ``` - -**Adaptation Guide** - -Change **algoName** to **algName** in **ParamsSpec** and its child classes **IvParamsSpec**, **GcmParamsSpec**, and **CcmParamsSpec**. - ```ts -function genGcmParamsSpec() { - let arr = [0, 0, 0, 0 , 0, 0, 0, 0, 0, 0 , 0, 0]; // 12 bytes - let dataIv = new Uint8Array(arr); - let ivBlob = {data : dataIv}; - - arr = [0, 0, 0, 0 , 0, 0, 0, 0]; // 8 bytes - let dataAad = new Uint8Array(arr); - let aadBlob = {data : dataAad}; - - arr = [0, 0, 0, 0 , 0, 0, 0, 0, 0, 0, 0, 0 , 0, 0, 0, 0]; // 16 bytes - let dataTag = new Uint8Array(arr); - let tagBlob = {data : dataTag}; - let gcmParamsSpec = {iv : ivBlob, aad : aadBlob, authTag : tagBlob, algName : "GcmParamsSpec"}; - return gcmParamsSpec; -} - ``` -For details, see the APIs of **ParamsSpec** in [Crypto Framework](../../../application-dev/reference/apis/js-apis-cryptoFramework.md#paramsspec). - -## Change of cl.security.2 ECC Algorithm Parameter Name from ECC512 to ECC521 - -**Change Impact** - -Behavior of released JavaScript APIs will be changed. -The application needs to be adapted to obtain the correct result in the SDK of the new version. - -**Key API/Component Changes** -The parameter passed in the APIs is changed from **ECC512** to **ECC521**. The related APIs remain unchanged. For details, see [Key Generation Specifications](../../../application-dev/security/cryptoFramework-overview.md#key-generation-specifications). The following APIs are involved: - -cryptoFramework.createAsyKeyGenerator - -cryptoFramework.createSign - -cryptoFramework.createVerify - -cryptoFramework.createKeyAgreement - -**Adaptation Guide** - -```js -import cryptoFramework from "@ohos.security.cryptoFramework" - -let asyKeyGenerator = cryptoFramework.createAsyKeyGenerator("ECC521"); -``` diff --git a/en/release-notes/changelogs/OpenHarmony_3.2.10.7/changelog-telephony.md b/en/release-notes/changelogs/OpenHarmony_3.2.10.7/changelog-telephony.md deleted file mode 100644 index cbf132c8c2740d900ccd9582eb317321f6b27190..0000000000000000000000000000000000000000 --- a/en/release-notes/changelogs/OpenHarmony_3.2.10.7/changelog-telephony.md +++ /dev/null @@ -1,223 +0,0 @@ -# Telephony Subsystem Changelog - - - -## cl.telephony.1 Call Module reject API Change -Changed the `reject` API to the `rejectCall` API in the call module of the telephony subsystem since API version 9. - -You need to adapt your application. - -**Change Impact** - -The `reject` API is deprecated and cannot be used anymore. Use the `rejectCall` API instead. Otherwise, relevant functions will be affected. - -- Involved APIs: - -```js - function reject(callId: number, callback: AsyncCallback): void; - function reject(callId: number, options: RejectMessageOptions, callback: AsyncCallback): void; - function reject(callId?: number, options?: RejectMessageOptions): Promise; - function reject(callback: AsyncCallback): void; - function reject(options: RejectMessageOptions, callback: AsyncCallback): void; -``` - -- Before change: - -```js - function reject(callId: number, callback: AsyncCallback): void; - function reject(callId: number, options: RejectMessageOptions, callback: AsyncCallback): void; - function reject(callId?: number, options?: RejectMessageOptions): Promise; - function reject(callback: AsyncCallback): void; - function reject(options: RejectMessageOptions, callback: AsyncCallback): void; -``` - -- After change: - -```js - function rejectCall(callId: number, callback: AsyncCallback): void; - function rejectCall(callId: number, options: RejectMessageOptions, callback: AsyncCallback): void; - function rejectCall(callId?: number, options?: RejectMessageOptions): Promise; - function rejectCall(callback: AsyncCallback): void; - function rejectCall(options: RejectMessageOptions, callback: AsyncCallback): void; -``` - - -**Adaptation Guide** - -The `reject` API is deprecated and cannot be used anymore. Use the `rejectCall` API instead. -The sample code is as follows: - -```js -call.rejectCall("138xxxxxxxx", (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); -}); -``` - - -```js -let rejectMessageOptions={ - messageContent: "Unknown number blocked" -} -let promise = call.rejectCall(1, rejectMessageOptions); -promise.then(data => { - console.log(`rejectCall success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { - console.error(`rejectCall fail, promise: err->${JSON.stringify(err)}`); -}); -``` - - -```js -let rejectMessageOptions={ - messageContent: "Unknown number blocked" -} -let promise = call.rejectCall(1, rejectMessageOptions); -promise.then(data => { - console.log(`rejectCall success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { - console.error(`rejectCall fail, promise: err->${JSON.stringify(err)}`); -}); -``` - - -```js -call.rejectCall((err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); -}); -``` - - -```js -let rejectMessageOptions={ - messageContent: "Unknown number blocked" -} -call.rejectCall(rejectMessageOptions, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); -}); -``` - - -## cl.telephony.2 Call Module answer API Change -Changed the `answer` API to the `answerCall` API in the call module of the telephony subsystem since API version 9. - -You need to adapt your application. - -**Change Impact** - -The `answer` API is deprecated and cannot be used anymore. Use the `answerCall` API instead. Otherwise, relevant functions will be affected. - -- Involved APIs: - -```js - function answer(callId: number, callback: AsyncCallback): void; - function answer(callId?: number): Promise; - function answer(callback: AsyncCallback): void; -``` - -- Before change: - -```js - function answer(callId: number, callback: AsyncCallback): void; - function answer(callId?: number): Promise; - function answer(callback: AsyncCallback): void; -``` - -- After change: - -```js - function answerCall(callId: number, callback: AsyncCallback): void; - function answerCall(callId?: number): Promise; - function answerCall(callback: AsyncCallback): void; -``` - - -**Adaptation Guide** - -The `answer` API is deprecated and cannot be used anymore. Use the `answerCall` API instead. -The sample code is as follows: - -```js -call.answerCall(1, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); -}); -``` - - -```js -let promise = call.answerCall(1); -promise.then(data => { - console.log(`answerCall success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { - console.error(`answerCall fail, promise: err->${JSON.stringify(err)}`); -}); -``` - - -```js -call.answerCall((err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); -}); -``` - - -## cl.telephony.1 Call Module hangup API Change -Changed the `hangup` API to the `hangUpCall` API in the call module of the telephony subsystem since API version 9. - -You need to adapt your application. - -**Change Impact** - -The `hangup` API is deprecated and cannot be used anymore. Use the `hangUpCall` API instead. Otherwise, relevant functions will be affected. - -- Involved APIs: - -```js - function hangup(callId: number, callback: AsyncCallback): void; - function hangup(callId?: number): Promise; - function hangup(callback: AsyncCallback): void; -``` - -- Before change: - -```js - function hangup(callId: number, callback: AsyncCallback): void; - function hangup(callId?: number): Promise; - function hangup(callback: AsyncCallback): void; -``` - -- After change: - -```js - function hangUpCall(callId: number, callback: AsyncCallback): void; - function hangUpCall(callId?: number): Promise; - function hangUpCall(callback: AsyncCallback): void; -``` - - -**Adaptation Guide** - -The `hangup` API is deprecated and cannot be used anymore. Use the `hangUpCall` API instead. -The sample code is as follows: - -```js -call.hangUpCall(1, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); -}); -``` - - -```js -let promise = call.hangUpCall(1); -promise.then(data => { - console.log(`hangUpCall success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { - console.error(`hangUpCall fail, promise: err->${JSON.stringify(err)}`); -}); -``` - - -```js -call.hangUpCall((err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); -}); -``` diff --git a/en/release-notes/changelogs/OpenHarmony_3.2.10.7/changelog-web.md b/en/release-notes/changelogs/OpenHarmony_3.2.10.7/changelog-web.md deleted file mode 100644 index 806f1270619d8aec7e7efcf95f41b7a45cc602e8..0000000000000000000000000000000000000000 --- a/en/release-notes/changelogs/OpenHarmony_3.2.10.7/changelog-web.md +++ /dev/null @@ -1,467 +0,0 @@ -# Web Subsystem Changelog - -Compared with earlier versions, OpenHarmony 3.2.10.7 has the following API changes in its web subsystem: - -## cl.web.1 HitTestTypeV9 Name Change - -Renamed the enum class **HitTestTypeV9** **WebHitTestType** to meet the naming conventions. - -**Change Impact** - -The enum class **HitTestTypeV9** and APIs that use **HitTestTypeV9** as a parameter or return value cannot be used in OpenHarmony 3.2.10.7 and later versions. - -**Key API/Component Changes** - -- Involved APIs: - - enum HitTestTypeV9 - -- Before change: - - ```ts - enum HitTestTypeV9 - ``` - -- After change: - - ```ts - enum WebHitTestType - ``` - -**Adaptation Guide** - -Replace **HitTestTypeV9** with **WebHitTestType**. - -## cl.web.2 HeaderV9 Name Change - -Renamed the struct **HeaderV9** **WebHeader** to meet the naming conventions. - -**Change Impact** - -The struct **HeaderV9** and APIs that use **HeaderV9** as a parameter or return value cannot be used in OpenHarmony 3.2.10.7 and later versions. - -**Key API/Component Changes** - -- Involved APIs: - - interface HeaderV9 - -- Before change: - - ```ts - interface HeaderV9 - ``` - -- After change: - - ```ts - interface WebHeader - ``` - -**Adaptation Guide** - -Replace **HeaderV9** with **WebHeader**. - -## cl.web.3 Member Change of HitTestValue - -Rename the member variable **HitTestTypeV9** in the **HitTestValue** struct **WebHitTestType** to meet the naming conventions. - -**Change Impact** - -The struct **HitTestValue** and APIs that use **HitTestValue** as a parameter or return value cannot be used in OpenHarmony 3.2.10.7 and later versions. - -**Key API/Component Changes** - -- Involved APIs: - - interface HitTestValue - -- Before change: - - ```ts - interface HitTestValue { - - /** - * Get the hit test type. - * - * @since 9 - */ - type: HitTestTypeV9; - - /** - * Get the hit test extra data. - * - * @since 9 - */ - extra: string; - } - ``` - -- After change: - - ```ts - interface HitTestValue { - - /** - * Get the hit test type. - * - * @since 9 - */ - type: WebHitTestType; - - /** - * Get the hit test extra data. - * - * @since 9 - */ - extra: string; - } - ``` - -**Adaptation Guide** - -Replace **HitTestTypeV9** with **WebHitTestType**. - -## cl.web.4 Parameter Type Change of loadUrl - -Changed the type of the **headers** parameter in **loadUrl** to **WebHeader** to meet the naming conventions. - -**Change Impact** - -The **loadUrl** API that uses the **headers** parameter cannot be used in OpenHarmony 3.2.10.7 and later versions. - -**Key API/Component Changes** - -- Involved APIs: - - loadUrl(url: string | Resource, headers?: Array\): void - -- Before change: - - ```ts - loadUrl(url: string | Resource, headers?: Array): void - ``` - -- After change: - - ```ts - loadUrl(url: string | Resource, headers?: Array): void - ``` - -**Adaptation Guide** - -Change the type of the **headers** parameter in **loadUrl** from **HeaderV9** to **WebHeader**. - -## cl.web.5 Return Value Type Change of getHitTest - -Changed the return value type of the **getHitTest** API to **WebHitTest** to meet the naming conventions. - -**Change Impact** - -The **getHitTest** API cannot be used in OpenHarmony 3.2.10.7 and later versions. - -**Key API/Component Changes** - -- Involved APIs: - - getHitTest(): HitTestTypeV9 - -- Before change: - - ```ts - getHitTest(): HitTestTypeV9 - ``` - -- After change: - - ```ts - getHitTest(): WebHitTestType - ``` - -**Adaptation Guide** - -Change the return value type of the **getHitTest** API from **HitTestTypeV9** to **WebHitTestType**. - -## cl.web.6 Moving of the WebMessagePort Class - -Moved the **WebMessagePort** class to **@ohos.web.webview.d.ts** and added error throwing. - -**Change Impact** - -If your application is developed based on earlier versions, note that the **d.ts** file storage location and the name of the module to be imported are changed. In addition, be mindful of the error codes now that the APIs in the class support error code processing. - -**Key API/Component Changes** - -- Involved APIs: - - postMessageEvent(message: WebMessageEvent): void; - onMessageEvent(callback: (result: string) => void): void; - -- Before change: - - ```ts - postMessageEvent(message: WebMessageEvent): void; - onMessageEvent(callback: (result: string) => void): void; - ``` - -- After change: - - ```ts - postMessageEvent(message: WebMessage): void; - onMessageEvent(callback: (result: WebMessage) => void): void; - ``` - -**Adaptation Guide** - -Instead of importing APIs from the original **WebMessagePort** class, import APIs from **@ohos.web.webview** as follows: - - ```ts - import web_webview from '@ohos.web.webview'; - ``` - -## cl.web.7 Moving of the HitTestValue Class - -Moved the **HitTestValue** class to **@ohos.web.webview.d.ts**; changed **HitTestValue** from a class to an API; changed the **getType** and **getExtra** from APIs to attributes. - -**Change Impact** - -If your application is developed based on earlier versions, note that the **d.ts** file storage location and the name of the module to be imported are changed. - -**Key API/Component Changes** - -- Involved APIs: - - getType(): HitTestType; - getExtra(): string; - -- Before change: - - ```ts - getType(): HitTestType; - getExtra(): string; - ``` - -- After change: - - ```ts - type: WebHitTestType; - extra: string; - ``` - -**Adaptation Guide** - -Instead of importing APIs from the original **HitTestValue** class, import APIs from **@ohos.web.webview** as follows: - - ```ts - import web_webview from '@ohos.web.webview'; - ``` - -## cl.web.8 Moving of API Version 9 APIs Under WebCookie - -Moved APIs of API version 9 in the **WebCookie** class to **web.webview.webview.WebCookieManager** -and added error throwing. - -**Change Impact** - -If your application is developed based on earlier versions, note that the **d.ts** file storage location and the name of the module to be imported are changed. In addition, be mindful of the error codes now that the APIs in the class support error code processing. -The APIs in the class are static. - -**Key API/Component Changes** - -- Involved APIs: - - isCookieAllowed(): boolean; - isThirdPartyCookieAllowed(): boolean; - putAcceptCookieEnabled(accept: boolean): void; - putAcceptThirdPartyCookieEnabled(accept: boolean): void; - setCookie(url: string, value: string): boolean; - saveCookieSync(): boolean; - getCookie(url: string): string; - existCookie(): boolean; - deleteEntireCookie(): void; - deleteSessionCookie(): void; - -- Before change: - - ```ts - isCookieAllowed(): boolean; - isThirdPartyCookieAllowed(): boolean; - putAcceptCookieEnabled(accept: boolean): void; - putAcceptThirdPartyCookieEnabled(accept: boolean): void; - setCookie(url: string, value: string): boolean; - saveCookieSync(): boolean; - getCookie(url: string): string; - existCookie(): boolean; - deleteEntireCookie(): void; - deleteSessionCookie(): void; - ``` - -- After change: - - ```ts - static isCookieAllowed(): boolean; - static isThirdPartyCookieAllowed(): boolean; - static putAcceptCookieEnabled(accept: boolean): void; - static putAcceptThirdPartyCookieEnabled(accept: boolean): void; - static setCookie(url: string, value: string): void; - static saveCookieAsync(): Promise; - static saveCookieAsync(callback: AsyncCallback): void; - static getCookie(url: string): string; - static existCookie(): boolean; - static deleteEntireCookie(): void; - static deleteSessionCookie(): void; - ``` - -**Adaptation Guide** - -Instead of importing APIs from the original **WebCookie** class, import APIs from **@ohos.web.webview** as follows: - - ```ts - import web_webview from '@ohos.web.webview'; - ``` - -## cl.web.9 Moving of API Version 9 APIs Under WebController - -Moved APIs of API version 9 in the **WebController** class to **web.webview.webview.WebviewController** and added error throwing. - -**Change Impact** - -If your application is developed based on earlier versions, note that the **d.ts** file storage location and the name of the module to be imported are changed. In addition, be mindful of the error codes now that the APIs in the class support error code processing. -The **getDefaultUserAgent** API is renamed **getUserAgent**. - -**Key API/Component Changes** - -- Involved APIs: - - zoomIn(): boolean; - zoomOut(): boolean; - createWebMessagePorts(): Array\; - postMessage(options: { message: WebMessageEvent, uri: string}): void; - getHitTestValue(): HitTestValue; - getWebId(): number; - getDefaultUserAgent(): string; - getTitle(): string; - getPageHeight(): number; - backOrForward(step: number): void; - searchAllAsync(searchString: string): void; - clearMatches(): void; - searchNext(forward: boolean): void; - clearSslCache(): void; - clearClientAuthenticationCache(): void; - getUrl(): string; - -- Before change: - - ```ts - zoomIn(): boolean; - zoomOut(): boolean; - createWebMessagePorts(): Array; - postMessage(options: { message: WebMessageEvent, uri: string}): void; - getHitTestValue(): HitTestValue; - getWebId(): number; - getDefaultUserAgent(): string; - getTitle(): string; - getPageHeight(): number; - backOrForward(step: number): void; - searchAllAsync(searchString: string): void; - clearMatches(): void; - searchNext(forward: boolean): void; - clearSslCache(): void; - clearClientAuthenticationCache(): void; - getUrl(): string; - ``` - -- After change: - - ```ts - zoomIn(): void; - zoomOut(): void; - createWebMessagePorts(): Array; - postMessage(name: string, ports: Array, uri: string): void; - getHitTestValue(): HitTestValue; - getWebId(): number; - getUserAgent(): string; - getTitle(): string; - getPageHeight(): number; - backOrForward(step: number): void; - searchAllAsync(searchString: string): void; - clearMatches(): void; - searchNext(forward: boolean): void; - clearSslCache(): void; - clearClientAuthenticationCache(): void; - getUrl(): string; - ``` - -**Adaptation Guide** - -Instead of importing APIs from the original **WebController** class, import APIs from **@ohos.web.webview** as follows: - - ```ts - import web_webview from '@ohos.web.webview'; - ``` - -## cl.web.10 Moving of the WebAsyncController Class - -Moved the APIs in the **WebAsyncController** class to the **web.webview.webview.WebviewController** class and added error throwing. - -**Change Impact** - -If your application is developed based on earlier versions, pay attention to error code processing. - -**Key API/Component Changes** - -- Involved APIs: - - storeWebArchive(baseName: string, autoName: boolean): Promise\; - storeWebArchive(baseName: string, autoName: boolean, callback : AsyncCallback\): void; - -- Before change: - - ```ts - storeWebArchive(baseName: string, autoName: boolean): Promise; - storeWebArchive(baseName: string, autoName: boolean, callback : AsyncCallback): void; - ``` - -- After change: - - ```ts - storeWebArchive(baseName: string, autoName: boolean): Promise; - storeWebArchive(baseName: string, autoName: boolean, callback : AsyncCallback): void; - ``` - -**Adaptation Guide** - -Example: - - ```ts - // xxx.ets - import web_webview from '@ohos.web.webview' - - @Entry - @Component - struct WebComponent { - controller: web_webview.WebviewController = new web_webview.WebviewController(); - - build() { - Column() { - Button('saveWebArchive') - .onClick(() => { - try { - this.controller.storeWebArchive("/data/storage/el2/base/", true, (error, filename) => { - if (error) { - console.info(`save web archive error: ` + JSON.stringify(error)) - return; - } - if (filename != null) { - console.info(`save web archive success: ${filename}`) - } - }); - } catch (error) { - console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); - } - }) - Web({ src: 'www.example.com', controller: this.controller }) - } - } - } - ``` diff --git a/en/release-notes/changelogs/OpenHarmony_3.2.10.7/changelogs-telephony.md b/en/release-notes/changelogs/OpenHarmony_3.2.10.7/changelogs-telephony.md deleted file mode 100644 index 7a5866bc47b955ff9c8ac00e8a1d9c4043c67b3a..0000000000000000000000000000000000000000 --- a/en/release-notes/changelogs/OpenHarmony_3.2.10.7/changelogs-telephony.md +++ /dev/null @@ -1,76 +0,0 @@ -# Telephony Subsystem Changelog - - - -## cl.telephony.1 Call Module dial API Change - -Changed the `dial` API to the `dialCall` API in the call module of the telephony subsystem since API version 9. - -You need to adapt your application. - - -**Change Impact** - -The `dial` API is deprecated and cannot be used anymore. Use the `dialCall` API instead. Otherwise, relevant functions will be affected. - - -**Key API/Component Changes** - -- Involved APIs: - -```js - dial(phoneNumber: string, callback: AsyncCallback): void; - dial(phoneNumber: string, options: DialOptions, callback: AsyncCallback): void; - dial(phoneNumber: string, options?: DialOptions): Promise; -``` - -- Before change: - -```js -function dial(phoneNumber: string, callback: AsyncCallback): void; -function dial(phoneNumber: string, options: DialOptions, callback: AsyncCallback): void; -function dial(phoneNumber: string, options?: DialOptions): Promise; -``` - -- After change: - -```js -function dialCall(phoneNumber: string, callback: AsyncCallback): void; -function dialCall(phoneNumber: string, options: DialCallOptions, callback: AsyncCallback): void; -function dialCall(phoneNumber: string, options?: DialCallOptions): Promise; -``` - - - -**Adaptation Guide** - -The `dial` API is deprecated and cannot be used anymore. Use the `dialCall` API instead. Otherwise, relevant functions will be affected. -Use the new API. The sample code is as follows: - -```js -call.dialCall("138xxxxxxxx", (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); -}); -``` - - -```js -call.dialCall("138xxxxxxxx", { - accountId: 0, - videoState: 0, - dialScene: 0, - dialType: 0, -}, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); -}); -``` - - -```js -try { - call.dialCall('138xxxxxxxx'); - console.log(`dialCall success, promise: data->${JSON.stringify(data)}`); -} catch (error) { - console.log(`dialCall fail, promise: err->${JSON.stringify(error)}`); -} -``` diff --git a/en/release-notes/changelogs/OpenHarmony_3.2.8.1/changelogs-multimodalinput.md b/en/release-notes/changelogs/OpenHarmony_3.2.8.1/changelogs-multimodalinput.md deleted file mode 100644 index c9514a515412e1d6b765558272650f2c20cac5af..0000000000000000000000000000000000000000 --- a/en/release-notes/changelogs/OpenHarmony_3.2.8.1/changelogs-multimodalinput.md +++ /dev/null @@ -1,103 +0,0 @@ -# Multimodal Input ChangeLog - -## cl.multimodalinput.1 Error Information Return Method Change of APIs - -The internal APIs of the following modules used service logic return values to indicate error information, which did not comply with the error code specifications of OpenHarmony. Therefore, they are modified in API version 9 and later. - - Input device management module (**@ohos.multimodalInput.inputDevice.d.ts**): third-party APIs - - - Input consumer module (**@ohos.multimodalInput.inputConsumer.d.ts**): system APIs - - - Screen hopping module (**@ohos.multimodalInput.inputDeviceCooperate.d.ts**): system APIs - - - Key injection module (**@ohos.multimodalInput.inputEventClient.d.ts**): system APIs - - - Input listening module (**@ohos.multimodalInput.inputMonitor.d.ts**): system APIs - - - Mouse pointer module (**@ohos.multimodalInput.pointer.d.ts**): system APIs and third-party APIs - -Asynchronous APIs in the preceding modules have the following changes: A parameter check error is returned synchronously; a service logic error is returned via **AsyncCallback** or the **error** object of **Promise**. No change is made to synchronous APIs. - -**Change Impacts** - -The application developed based on earlier versions needs to adapt the method for returning API error information. Otherwise, the original service logic will be affected. - -**Key API/Component Changes** - - - supportKeys(deviceId: number, keys: Array<KeyCode>, callback: AsyncCallback<Array<boolean>>): void; - - supportKeys(deviceId: number, keys: Array<KeyCode>): Promise<Array<boolean>>; - - getKeyboardType(deviceId: number, callback: AsyncCallback<KeyboardType>): void; > - - getKeyboardType(deviceId: number): Promise<KeyboardType>; - - setPointerSpeed(speed: number, callback: AsyncCallback<void>): void; - - setPointerSpeed(speed: number): Promise<void>; - - getPointerSpeed(callback: AsyncCallback<number>): void; - - getPointerSpeed(): Promise<number>; - - setPointerStyle(windowId: number, pointerStyle: PointerStyle, callback: AsyncCallback<void>): void; - - setPointerStyle(windowId: number, pointerStyle: PointerStyle): Promise<void>; - - getPointerStyle(windowId: number, callback: AsyncCallback<PointerStyle>): void; - - getPointerStyle(windowId: number): Promise<PointerStyle>; - - setPointerVisible(visible: boolean, callback: AsyncCallback<void>): void; - - setPointerVisible(visible: boolean): Promise<void>; - - isPointerVisible(callback: AsyncCallback<boolean>): void; - - isPointerVisible(): Promise<boolean>; - - on(type:"touch", receiver:TouchEventReceiver):void; - - on(type:"mouse", receiver:Callback<MouseEvent>):void; - - off(type:"touch", receiver?:TouchEventReceiver):void; - - off(type:"mouse", receiver?:Callback<MouseEvent>):void; - - injectEvent({KeyEvent: KeyEvent}): void; - - enable(enable: boolean, callback: AsyncCallback<void>): void; - - enable(enable: boolean): Promise<void>; - - start(sinkDeviceDescriptor: string, srcInputDeviceId: number, callback: AsyncCallback<void>): void; - - start(sinkDeviceDescriptor: string, srcInputDeviceId: number): Promise<void>; - - stop(callback: AsyncCallback<void>): void; - - stop(): Promise<void>; - - getState(deviceDescriptor: string, callback: AsyncCallback<{ state: boolean }>): void; - - getState(deviceDescriptor: string): Promise<{ state: boolean }>; - - on(type: 'cooperation', callback: AsyncCallback<{ deviceDescriptor: string, eventMsg: EventMsg }>): void; - - off(type: 'cooperation', callback?: AsyncCallback<void>): void; - - on(type: "key", keyOptions: KeyOptions, callback: Callback<KeyOptions>): void; - - off(type: "key", keyOptions: KeyOptions, callback?: Callback<KeyOptions>): void; - -Deprecated APIs: - - getDeviceIds(callback: AsyncCallback<Array<number>>): void; - - getDeviceIds(): Promise<Array<number>>; - - getDevice(deviceId: number, callback: AsyncCallback<InputDeviceData>): void; - - getDevice(deviceId: number): Promise<InputDeviceData>; - -Substitute APIs: - - getDeviceList(callback: AsyncCallback<Array<number>>): void; - - getDeviceList(): Promise<Array<number>>; - - getDeviceInfo(deviceId: number, callback: AsyncCallback<InputDeviceData>): void; - - getDeviceInfo(deviceId: number): Promise<InputDeviceData>; - -Changed APIs: - -Before change: - - supportKeys(deviceId: number, keys: Array<KeyCode>, callback: Callback<Array<boolean>>): void; - - getKeyboardType(deviceId: number, callback: Callback<KeyboardType>): void; - -After change: - - supportKeys(deviceId: number, keys: Array<KeyCode>, callback: AsyncCallback<Array<boolean>>): void; - - getKeyboardType(deviceId: number, callback: AsyncCallback<KeyboardType>): void; - -**Adaptation Guide** - -The following uses **setPointerVisible** as an example: - -```ts -import pointer from '@ohos.multimodalInput.pointer'; -pointer.setPointerVisible(true, (error) => { - console.log(`Set pointer visible success`); - }); - -try { - pointer.setPointerVisible(true, (error) => { - if (error) { - console.log(`Set pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`); - return; - } - console.log(`Set pointer visible success`); - }); -} catch (error) { - console.log(`Set pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`); -} -``` diff --git a/en/release-notes/changelogs/OpenHarmony_3.2.8.3/changelogs-ability.md b/en/release-notes/changelogs/OpenHarmony_3.2.8.3/changelogs-ability.md deleted file mode 100644 index ae3d6a17cce9d488dff3f84765ca9f2cfc2260fe..0000000000000000000000000000000000000000 --- a/en/release-notes/changelogs/OpenHarmony_3.2.8.3/changelogs-ability.md +++ /dev/null @@ -1,373 +0,0 @@ -# Ability Subsystem ChangeLog - -## cl.ability.1 Application Component Startup Rule Change - -The rules for starting application components of the ability subsystem are changed in the following scenarios: - - - Start application components when the application is in the background. - - Start invisible application components across applications. - - Start **serviceAbility** and **dataAbility** of the FA model across applications. - - Use the **startAbilityByCall** API. - -You need to adapt your application based on the following information. - -**Change Impacts** - -If new rules are not adapted, application components cannot be started in the previous scenarios. -> **NOTE** -> -> Starting application components refers to any behavior starting or connecting to an ability. -> -> 1. Start an ability using APIs such as **startAbility**, **startServiceExtensionAbility**, and **startAbilityByCall**. -> 2. Connect to an ability using APIs such as **connectAbility**, **connectServiceExtensionAbility**, **acquireDataAbilityHelper**, and **createDataShareHelper**. - -**Key API/Component Changes** - - - Involved application components - - Stage model - - Ability - - ServiceExtension - - DataShareExtension - - FA model - - PageAbility - - ServiceAbility - - DataAbility - - Involved APIs - - Stage model - - startAbility(want: Want, callback: AsyncCallback): void; - - startAbility(want: Want, options: StartOptions, callback: AsyncCallback): void; - - startAbility(want: Want, options?: StartOptions): Promise; - - startAbilityByCall(want: Want): Promise; - - startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; - - startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback): void; - - startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): Promise; - - startAbilityForResult(want: Want, callback: AsyncCallback): void; - - startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback): void; - - startAbilityForResult(want: Want, options?: StartOptions): Promise; - - startAbilityForResultWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; - - startAbilityForResultWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback): void; - - startAbilityForResultWithAccount(want: Want, accountId: number, options?: StartOptions): Promise; - - startServiceExtensionAbility(want: Want, callback: AsyncCallback): void; - - startServiceExtensionAbility(want: Want): Promise; - - startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; - - startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise; - - stopServiceExtensionAbility(want: Want, callback: AsyncCallback): void; - - stopServiceExtensionAbility(want: Want): Promise; - - stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; - - stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise; - - connectAbility(want: Want, options: ConnectOptions): number; - - connectAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number; - - createDataShareHelper(context: Context, uri: string, callback: AsyncCallback): void - - FA model - - startAbility(parameter: StartAbilityParameter, callback: AsyncCallback): void; - - startAbility(parameter: StartAbilityParameter): Promise; - - startAbilityForResult(parameter: StartAbilityParameter, callback: AsyncCallback): void; - - startAbilityForResult(parameter: StartAbilityParameter): Promise; - - acquireDataAbilityHelper(uri: string): DataAbilityHelper; - - connectAbility(request: Want, options:ConnectOptions ): number; - -**Adaptation Guide** - -Startup rules for different scenarios are as follows: - - **Start application components when the application is in the background.** - - OpenHarmony 3.2 Beta3 rules: - - - Starting application components when the application is in the background is not restricted. - - OpenHarmony 3.2 Beta4 rules: - - When the application is in the background, starting application components requires authentication. The following permission needs to be applied for: - ```json - { - "name": "ohos.permission.START_ABILITIES_FROM_BACKGROUND", - "grantMode": "system_grant", - "availableLevel": "system_basic", - "provisionEnable": true, - "distributedSceneEnable": false - } - ``` - > **NOTE** - > - > 1. Starting components of the same application is also restricted by this rule. - > 2. For SDKs of API version 8 or earlier, starting **serviceAbility** and **dataAbility** is not restricted by this rule. - - - **Start invisible application components across applications.** - - OpenHarmony 3.2 Beta3 rules: - - - For applications whose APL is normal, invisible application components cannot be started across applications. - - OpenHarmony 3.2 Beta4 rules: - - For all applications, starting invisible application components across applications requires authentication. The following permission needs to be applied for: - ```json - { - "name": "ohos.permission.START_INVISIBLE_ABILITY", - "grantMode": "system_grant", - "availableLevel": "system_core", - "provisionEnable": true, - "distributedSceneEnable": false - } - ``` - - - **Start serviceAbility and dataAbility of the FA model across applications.** - - - OpenHarmony 3.2 Beta3 rules: - - Starting **serviceAbility** and **dataAbility** across applications is not restricted. - - OpenHarmony 3.2 Beta4 rules: - - Associated startup needs to be configured for the provider of **serviceAbility** and **dataAbility**. Otherwise, **serviceAbility** and **dataAbility** cannot be started across applications. (Associated startup cannot be configured for common applications.) - - - - **Use the startAbilityByCall API.** - - OpenHarmony 3.2 Beta3 rules: - - - The API call is not restricted. - - OpenHarmony 3.2 Beta4 rules: - - - The **startAbilityByCall** API cannot be called by the same application. - - Calling the **startAbilityByCall** API across applications requires authentication. The following permission needs to be applied for: - - ```json - { - "name": "ohos.permission.ABILITY_BACKGROUND_COMMUNICATION", - "grantMode": "system_grant", - "availableLevel": "system_basic", - "provisionEnable": true, - "distributedSceneEnable": false - } - ``` - > **NOTE** - > - > Using the **startAbilityByCall** API is also restricted by the background startup and across-application invisible component startup rules. - -## cl.ability.2 Cross-Device Application Component Startup Rule Change (for System Applications Only) - -The rules for starting cross-device application components of the ability subsystem are changed in the following scenarios: - - - Start application components when the application is in the background. - - Start invisible application components across applications. - - Start **serviceAbility** of the FA model across applications. - -You need to adapt your application based on the following information. - - -**Change Impacts** - -If new rules are not adapted, application components cannot be started in the previous scenarios. ->**NOTE** -> ->Starting application components refers to any behavior starting or connecting to an ability. -> ->1. Start an ability using APIs such as **startAbility**, **startAbilityForResult**, and **startAbilityByCall**. ->2. Connect to an ability using APIs such as **connectAbility**. - -**Key API/Component Changes** - - - Involved application components - - Stage model - - Ability - - ServiceExtension - - FA model - - PageAbility - - ServiceAbility - - Involved APIs - - Stage model - - startAbility(want: Want, callback: AsyncCallback): void; - - startAbilityByCall(want: Want): Promise; - - startAbilityForResult(want: Want, callback: AsyncCallback): void; - - connectAbility(want: Want, options: ConnectOptions): number; - - FA model - - startAbility(parameter: StartAbilityParameter, callback: AsyncCallback): void; - - startAbility(parameter: StartAbilityParameter): Promise; - - startAbilityForResult(parameter: StartAbilityParameter, callback: AsyncCallback): void; - - startAbilityForResult(parameter: StartAbilityParameter): Promise; - - connectAbility(request: Want, options:ConnectOptions ): number; - -**Adaptation Guide** - -Startup rules for different scenarios are as follows: - - **Start application components when the application is in the background.** - - OpenHarmony 3.2 Beta3 rules: - - - Starting application components when the application is in the background is not restricted. - - OpenHarmony 3.2 Beta4 rules: - - When the application is in the background, starting application components requires authentication. The following permission needs to be applied for: - ```json - { - "name": "ohos.permission.START_ABILITIES_FROM_BACKGROUND", - "grantMode": "system_grant", - "availableLevel": "system_basic", - "provisionEnable": true, - "distributedSceneEnable": false - } - ``` - > **NOTE** - > - > 1. Starting components of the same application is also restricted by this rule. - > 2. For SDKs of API version 8 or earlier, starting **serviceAbility** is not restricted by this rule. - - - **Start invisible application components across applications.** - - OpenHarmony 3.2 Beta3 rules: - - - Invisible application components cannot be started across applications. - - OpenHarmony 3.2 Beta4 rules: - - Starting invisible application components across applications requires authentication. The following permission needs to be applied for: - ```json - { - "name": "ohos.permission.START_INVISIBLE_ABILITY", - "grantMode": "system_grant", - "availableLevel": "system_core", - "provisionEnable": true, - "distributedSceneEnable": false - } - ``` - - - **Start serviceAbility of the FA model across applications.** - - - OpenHarmony 3.2 Beta3 rules: - - - Starting **serviceAbility** across applications is not restricted. - - OpenHarmony 3.2 Beta4 rules: - - Associated startup needs to be configured for the **serviceAbility** provider application. Otherwise, **serviceAbility** cannot be started across applications. (Associated startup cannot be configured for common applications.) - - Configure associated startup as follows: - ```json - { - "bundleName": "", - "app_signature": ["xxxxxxxxxxxxxxxxxxx"], - "associatedWakeUp": true - } - ``` - -## cl.ability.3 API Exception Handling Method Change - -Certain APIs of the ability subsystem use service logic return values to indicate error information, which does not comply with the API error code specifications of OpenHarmony. - -**Change Impacts** - -The application developed based on earlier versions needs to adapt the new APIs and their method for returning API error information. Otherwise, the original service logic will be affected. - -**Key API/Component Changes** - -For adaptation to the unified API exception handling mode, certain ability subsystem APIs are deprecated (original APIs in the following table) and corresponding new APIs in the following table are added. (In the following table, original APIs in API version 9 will be deleted, and APIs in API version 8 and earlier will be deprecated.) The newly added APIs support unified error code handling specifications and function the same as the original APIs. - -| Original API | New API | -| ----------------------------------------------- | ----------------------------------------------- | -| @ohos.ability.wantConstant.d.ts | @ohos.app.ability.wantConstant.d.ts | -| @ohos.application.Ability.d.ts | @ohos.app.ability.UIAbility.d.ts | -| @ohos.application.AbilityConstant.d.ts | @ohos.app.ability.AbilityConstant.d.ts | -| @ohos.application.abilityDelegatorRegistry.d.ts | @ohos.app.ability.abilityDelegatorRegistry.d.ts | -| @ohos.application.AbilityLifecycleCallback.d.ts | @ohos.app.ability.AbilityLifecycleCallback.d.ts | -| @ohos.application.abilityManager.d.ts | @ohos.app.ability.abilityManager.d.ts | -| @ohos.application.AbilityStage.d.ts | @ohos.app.ability.AbilityStage.d.ts | -| @ohos.application.appManager.d.ts | @ohos.app.ability.appManager.d.ts | -| @ohos.application.Configuration.d.ts | @ohos.app.ability.Configuration.d.ts | -| @ohos.application.ConfigurationConstant.d.ts | @ohos.app.ability.ConfigurationConstant.d.ts | -| @ohos.application.context.d.ts | @ohos.app.ability.common.d.ts | -| @ohos.application.EnvironmentCallback.d.ts | @ohos.app.ability.EnvironmentCallback.d.ts | -| @ohos.application.errorManager.d.ts | @ohos.app.ability.errorManager.d.ts | -| @ohos.application.ExtensionAbility.d.ts | @ohos.app.ability.ExtensionAbility.d.ts | -| @ohos.application.formBindingData.d.ts | @ohos.app.form.formBindingData.d.ts | -| @ohos.application.FormExtension.d.ts | @ohos.app.form.FormExtensionAbility.d.ts | -| @ohos.application.formHost.d.ts | @ohos.app.form.formHost.d.ts | -| @ohos.application.formInfo.d.ts | @ohos.app.form.formInfo.d.ts | -| @ohos.application.formProvider.d.ts | @ohos.app.form.formProvider.d.ts | -| @ohos.application.missionManager.d.ts | @ohos.app.ability.missionManager.d.ts | -| @ohos.application.quickFixManager.d.ts | @ohos.app.ability.quickFixManager.d.ts | -| @ohos.application.ServiceExtensionAbility.d.ts | @ohos.app.ability.ServiceExtensionAbility.d.ts | -| @ohos.application.StartOptions.d.ts | @ohos.app.ability.StartOptions.d.ts | -| @ohos.application.Want.d.ts | @ohos.app.ability.Want.d.ts | -| @ohos.wantAgent.d.ts | @ohos.app.ability.wantAgent.d.ts | - -**Adaptation Guide** - -The original APIs are only migrated to the new namespace. Therefore, you can modify **import** to solve the adaptation problem. - -If the original API uses **@ohos.application.missionManager**: - -```js -import missionManager from '@ohos.application.missionManager'; -``` - -You can directly modify **import** to switch to the new namespace: - -```js -import missionManager from '@ohos.app.ability.missionManager'; -``` - -In addition, exception handling is needed. For details, see the API reference for the new APIs. - -## cl.ability.4 API Change - -The names of some ability subsystem APIs are changed. - -**Key API/Component Changes** - -| Module | Class | Method/Attribute/Enumeration/Constant | Change Type| -| ----------------------------------------- | ----------------------- | ------------------------------------------------------------ | -------- | -| @ohos.application.Ability | Caller | onRelease(callback: OnReleaseCallBack): **void**; | Deprecated | -| @ohos.app.ability.UIAbility | Caller | on(**type**: "release", callback: OnReleaseCallBack): **void**; | Added | -| @ohos.application.Ability | Ability | dump(params: Array<**string**>): Array<**string**>; | Deprecated | -| @ohos.app.ability.UIAbility | UIAbility | onDump(params: Array<**string**>): Array<**string**>; | Added | -| @ohos.application.appManager | appManager | **function** registerApplicationStateObserver(observer: ApplicationStateObserver): **number**; | Deprecated | -| @ohos.application.appManager | appManager | **function** registerApplicationStateObserver(observer: ApplicationStateObserver, bundleNameList: Array<**string**>): **number**; | Deprecated | -| @ohos.application.appManager | appManager | **function** unregisterApplicationStateObserver(observerId: **number**, callback: AsyncCallback<**void**>): **void**; | Deprecated | -| @ohos.application.appManager | appManager | **function** unregisterApplicationStateObserver(observerId: **number**): Promise<**void**>; | Deprecated | -| @ohos.app.ability.appManager | appManager | **function** on(**type**: "applicationState", observer: ApplicationStateObserver): **number**; | Added | -| @ohos.app.ability.appManager | appManager | **function** on(**type**: "applicationState", observer: ApplicationStateObserver, bundleNameList: Array<**string**>): **number**; | Added | -| @ohos.app.ability.appManager | appManager | **function** off(**type**: "applicationState", observerId: **number**, callback: AsyncCallback<**void**>): **void**; | Added | -| @ohos.app.ability.appManager | appManager | **function** off(**type**: "applicationState", observerId: **number**): Promise<**void**>; | Added | -| @ohos.application.errorManager | errorManager | **function** registerErrorObserver(observer: ErrorObserver): **number**; | Deprecated | -| @ohos.application.errorManager | errorManager | **function** unregisterErrorObserver(observerId: **number**, callback: AsyncCallback<**void**>): **void**; | Deprecated | -| @ohos.application.errorManager | errorManager | **function** unregisterErrorObserver(observerId: **number**): Promise<**void**>; | Deprecated | -| @ohos.app.ability.errorManager | errorManager | **function** on(**type**: "error", observer: ErrorObserver): **number**; | Added | -| @ohos.app.ability.errorManager | errorManager | **function** off(**type**: "error", observerId: **number**, callback: AsyncCallback<**void**>): **void**; | Added | -| @ohos.app.ability.errorManager | errorManager | **function** off(**type**: "error", observerId: **number**): Promise<**void**>; | Added | -| @ohos.application.missionManager | missionManager | **function** registerMissionListener(listener: MissionListener): **number**; | Deprecated | -| @ohos.application.missionManager | missionManager | **function** unregisterMissionListener(listenerId: **number**, callback: AsyncCallback<**void**>): **void**; | Deprecated | -| @ohos.application.missionManager | missionManager | **function** unregisterMissionListener(listenerId: **number**): Promise<**void**>; | Deprecated | -| @ohos.app.ability.missionManager | missionManager | **function** on(**type**: "mission", listener: MissionListener): **number**; | Added | -| @ohos.app.ability.missionManager | missionManager | **function** off(**type**: "mission", listenerId: **number**, callback: AsyncCallback<**void**>): **void**; | Added | -| @ohos.app.ability.missionManager | missionManager | **function** off(**type**: "mission", listenerId: **number**): Promise<**void**>; | Added | -| @ohos.application.FormExtension | FormExtension | onCreate(want: Want): formBindingData.FormBindingData; | Deprecated | -| @ohos.application.FormExtension | FormExtension | onCastToNormal(formId: **string**): **void**; | Deprecated | -| @ohos.application.FormExtension | FormExtension | onUpdate(formId: **string**): **void**; | Deprecated | -| @ohos.application.FormExtension | FormExtension | onVisibilityChange(newStatus: { [key: **string**]: **number** }): **void**; | Deprecated | -| @ohos.application.FormExtension | FormExtension | onEvent(formId: **string**, message: **string**): **void**; | Deprecated | -| @ohos.application.FormExtension | FormExtension | onDestroy(formId: **string**): **void**; | Deprecated | -| @ohos.application.FormExtension | FormExtension | onShare?(formId: **string**): {[key: **string**]: **any**}; | Deprecated | -| @ohos.app.form.FormExtensionAbility | FormExtensionAbility | onAddForm(want: Want): formBindingData.FormBindingData; | Added | -| @ohos.app.form.FormExtensionAbility | FormExtensionAbility | onCastToNormalForm(formId: **string**): **void**; | Added | -| @ohos.app.form.FormExtensionAbility | FormExtensionAbility | onUpdateForm(formId: **string**): **void**; | Added | -| @ohos.app.form.FormExtensionAbility | FormExtensionAbility | onChangeFormVisibility(newStatus: { [key: **string**]: **number** }): **void**; | Added | -| @ohos.app.form.FormExtensionAbility | FormExtensionAbility | onFormEvent(formId: **string**, message: **string**): **void**; | Added | -| @ohos.app.form.FormExtensionAbility | FormExtensionAbility | onRemoveForm(formId: **string**): **void**; | Added | -| @ohos.app.form.FormExtensionAbility | FormExtensionAbility | onShareForm?(formId: **string**): {[key: **string**]: **any**}; | Added | -| @ohos.application.formHost.d.ts | formHost | **function** castTempForm(formId: **string**, callback: AsyncCallback<**void**>): **void**; | Deprecated | -| @ohos.application.formHost.d.ts | formHost | **function** castTempForm(formId: **string**): Promise<**void**>; | Deprecated | -| @ohos.app.form.formHost.d.ts | formHost | **function** castToNormalForm(formId: **string**, callback: AsyncCallback<**void**>): **void**; | Added | -| @ohos.app.form.formHost.d.ts | formHost | **function** castToNormalForm(formId: **string**): Promise<**void**>; | Added | -| @ohos.application.ServiceExtensionAbility | ServiceExtensionAbility | dump(params: Array<**string**>): Array<**string**>; | Deprecated | -| @ohos.app.ability.ServiceExtensionAbility | ServiceExtensionAbility | onDump(params: Array<**string**>): Array<**string**>; | Added | -| application/AbilityContext | AbilityContext | connectAbility(want: Want, options: ConnectOptions): **number**; | Deprecated | -| application/AbilityContext | AbilityContext | connectAbilityWithAccount(want: Want, accountId: **number**, options: ConnectOptions): **number**; | Deprecated | -| application/AbilityContext | AbilityContext | disconnectAbility(connection: **number**, callback: AsyncCallback<**void**>): **void**; | Deprecated | -| application/AbilityContext | AbilityContext | disconnectAbility(connection: **number**): Promise<**void**>; | Deprecated | -| application/UIAbilityContext | UIAbilityContext | connectServiceExtensionAbilityWithAccount(want: Want, accountId: **number**, options: ConnectOptions): **number**; | Added | -| application/UIAbilityContext | UIAbilityContext | connectServiceExtensionAbilityWithAccount(want: Want, accountId: **number**, options: ConnectOptions): **number**; | Added | -| application/UIAbilityContext | UIAbilityContext | disconnectServiceExtensionAbility(connection: **number**, callback: AsyncCallback<**void**>): **void**; | Added | -| application/UIAbilityContext | UIAbilityContext | disconnectServiceExtensionAbility(connection: **number**): Promise<**void**>; | Added | -| application/ApplicationContext | ApplicationContext | registerAbilityLifecycleCallback(callback: AbilityLifecycleCallback): **number**; | Deprecated | -| application/ApplicationContext | ApplicationContext | unregisterAbilityLifecycleCallback(callbackId: **number**, callback: AsyncCallback<**void**>): **void**; | Deprecated | -| application/ApplicationContext | ApplicationContext | unregisterAbilityLifecycleCallback(callbackId: **number**): Promise<**void**>; | Deprecated | -| application/ApplicationContext | ApplicationContext | registerEnvironmentCallback(callback: EnvironmentCallback): **number**; | Deprecated | -| application/ApplicationContext | ApplicationContext | unregisterEnvironmentCallback(callbackId: **number**, callback: AsyncCallback<**void**>): **void**; | Deprecated | -| application/ApplicationContext | ApplicationContext | unregisterEnvironmentCallback(callbackId: **number**): Promise<**void**>; | Deprecated | -| application/ApplicationContext | ApplicationContext | on(**type**: "abilityLifecycle", callback: AbilityLifecycleCallback): **number**; | Added | -| application/ApplicationContext | ApplicationContext | off(**type**: "abilityLifecycle", callbackId: **number**, callback: AsyncCallback<**void**>): **void**; | Added | -| application/ApplicationContext | ApplicationContext | off(**type**: "abilityLifecycle", callbackId: **number**): Promise<**void**>; | Added | -| application/ApplicationContext | ApplicationContext | on(**type**: "environment", callback: EnvironmentCallback): **number**; | Added | -| application/ApplicationContext | ApplicationContext | off(**type**: "environment", callbackId: **number**, callback: AsyncCallback<**void**>): **void**; | Added | -| application/ApplicationContext | ApplicationContext | off(**type**: "environment", callbackId: **number**): Promise<**void**>; | Added | -| application/ServiceExtensionContext | ServiceExtensionContext | connectAbility(want: Want, options: ConnectOptions): **number**; | Deprecated | -| application/ServiceExtensionContext | ServiceExtensionContext | connectAbilityWithAccount(want: Want, accountId: **number**, options: ConnectOptions): **number**; | Deprecated | -| application/ServiceExtensionContext | ServiceExtensionContext | disconnectAbility(connection: **number**, callback: AsyncCallback<**void**>): **void**; | Deprecated | -| application/ServiceExtensionContext | ServiceExtensionContext | disconnectAbility(connection: **number**): Promise<**void**>; | Deprecated | -| application/ServiceExtensionContext | ServiceExtensionContext | connectServiceExtensionAbility(want: Want, options: ConnectOptions): **number**; | Added | -| application/ServiceExtensionContext | ServiceExtensionContext | connectServiceExtensionAbilityWithAccount(want: Want, accountId: **number**, options: ConnectOptions): **number**; | Added | -| application/ServiceExtensionContext | ServiceExtensionContext | disconnectServiceExtensionAbility(connection: **number**, callback: AsyncCallback<**void**>): **void**; | Added | -| application/ServiceExtensionContext | ServiceExtensionContext | disconnectServiceExtensionAbility(connection: **number**): Promise<**void**>; | Added | diff --git a/en/release-notes/changelogs/OpenHarmony_3.2.8.3/changelogs-account_os_account.md b/en/release-notes/changelogs/OpenHarmony_3.2.8.3/changelogs-account_os_account.md deleted file mode 100644 index df7cbf93cd13a7cc4dfc04fb9aec4b112633035a..0000000000000000000000000000000000000000 --- a/en/release-notes/changelogs/OpenHarmony_3.2.8.3/changelogs-account_os_account.md +++ /dev/null @@ -1,124 +0,0 @@ -# Account Subsystem ChangeLog - -## cl.account_os_account.1 Change in Error Information Return Method of Account System APIs - -Certain system APIs of the account subsystem use service logic return values to indicate error information, which does not comply with the API error code specifications of OpenHarmony. The following changes are made in API version 9 and later: - -Asynchronous API: An error message is returned via **AsyncCallback** or the **error** object of **Promise**. - -Synchronous API: An error message is returned via an exception. - -**Change Impacts** - -The application developed based on earlier versions needs to adapt the new APIs and their method for returning API error information. Otherwise, the original service logic will be affected. - -**Key API/Component Changes** - -Before change: - - class UserAuth - - setProperty(request: SetPropertyRequest, callback: AsyncCallback<number>): void; - - setProperty(request: SetPropertyRequest): Promise<number>; - - cancelAuth(contextID: Uint8Array): number; - - class PINAuth - - registerInputer(inputer: Inputer): boolean; - - UserIdentityManager - - cancel(challenge: Uint8Array): number; - -After change: - - class UserAuth - - setProperty(request: SetPropertyRequest, callback: AsyncCallback<void>): void; - - setProperty(request: SetPropertyRequest): Promise<void>; - - cancelAuth(contextID: Uint8Array): void; - - class PINAuth - - registerInputer(inputer: Inputer): void; - - UserIdentityManager - - cancel(challenge: Uint8Array): void; - -**Adaptation Guide** - -The following uses **setProperty** as an example for asynchronous APIs: - -``` -import account_osAccount from "@ohos.account.osAccount" -userAuth.setProperty({ - authType: account_osAccount.AuthType.PIN, - key: account_osAccount.SetPropertyType.INIT_ALGORITHM, - setInfo: new Uint8Array([0]) -}, (err) => { - if (err) { - console.log("setProperty failed, error: " + JSON.stringify(err)); - } else { - console.log("setProperty successfully"); - } -}); - -userAuth.setProperty({ - authType: account_osAccount.AuthType.PIN, - key: account_osAccount.SetPropertyType.INIT_ALGORITHM, - setInfo: new Uint8Array([0]) -}).catch((err) => { - if (err) { - console.log("setProperty failed, error: " + JSON.stringify(err)); - } else { - console.log("setProperty successfully"); - } -}); -``` - -The following uses **registerInputer** as an example for synchronous APIs: - -``` -import account_osAccount from "@ohos.account.osAccount" -let pinAuth = new account_osAccount.PINAuth() -let inputer = { - onGetData: (authType, passwordRecipient) => { - let password = new Uint8Array([0]); - passwordRecipient.onSetData(authType, password); - } -} -try { - pinAuth.registerInputer(inputer); -} catch (err) { - console.log("registerInputer failed, error: " + JSON.stringify(err)); -} -``` - -## cl.account_os_account.2 ACTION Definition Change for the Application Account Authentication Service - -**Change Impacts** - -For the application developed based on an earlier version, you need to modify **ACTION** in the application configuration file (**config.json** for the FA model and **module.json5** for the Stage model) to normally provide the application authentication service. - -**Key API/Component Changes** - -Involved constant: - -@ohos.ability.wantConstant.ACTION_APP_ACCOUNT_AUTH - -Before change: - -ACTION_APP_ACCOUNT_AUTH = "account.appAccount.action.auth" - -After change: - -ACTION_APP_ACCOUNT_AUTH = "ohos.appAccount.action.auth" - -**Adaptation Guide** - -For a third-party application providing the account authentication service, adapt the changed application account authentication **ACTION** in the **ServiceAbility** configuration file (**config.json** for the FA module or **module.json5** for the Stage module). -``` -"abilities": [ - { - "name": "ServiceAbility", - "srcEntrance": "./ets/ServiceAbility/ServiceAbility.ts", - ... - "visible": true, - "skills": { - { - "actions": [ - "ohos.appAccount.action.auth" - ] - } - } - }] -} diff --git a/en/release-notes/changelogs/OpenHarmony_3.2.8.3/changelogs-notification.md b/en/release-notes/changelogs/OpenHarmony_3.2.8.3/changelogs-notification.md deleted file mode 100644 index b7a670a8a4de3f8674194bd2dcc0cdc13e2e2d17..0000000000000000000000000000000000000000 --- a/en/release-notes/changelogs/OpenHarmony_3.2.8.3/changelogs-notification.md +++ /dev/null @@ -1,64 +0,0 @@ -# Common Event and Notification Subsystem ChangeLog - -## cl.notification.1 API Exception Handling Method Changes - -Certain event notification APIs use service logic return values to indicate error information, which does not comply with the API error code specifications of OpenHarmony. - -**Change Impacts** - -The application developed based on earlier versions needs to adapt the new APIs and their method for returning API error information. Otherwise, the original service logic will be affected. - -**Key API/Component Changes** - -For adaptation to the unified API exception handling mode, certain event notification APIs are deprecated (original APIs in the following table) and corresponding new APIs in the following table are added. The newly added APIs support unified error code handling specifications and function the same as the original APIs. - -| Original API | New API | -| ----------------------- | -------------------------------- | -| @ohos.commonEvent.d.ts | @ohos.commonEventManager.d.ts | -| @ohos.notification.d.ts | @ohos.notificationManager.d.ts | -| @ohos.notification.d.ts | @ohos.notificationSubscribe.d.ts | - -**Adaptation Guide** - -The original APIs are only migrated to the new namespace. Therefore, you can modify **import** to solve the adaptation problem. - -If the original API uses **@ohos.commonEvent**: - -```js -import commonEvent from '@ohos.commonEvent'; -``` - -You can directly modify **import** to switch to the new namespace: - -```js -import commonEvent from '@ohos.commonEventManager'; -``` - -**@ohos.notification** is split into two namespaces. You need to select a new namespace for adaptation. - -In addition, exception handling is needed. For details, see the API reference for the new APIs. - -## cl.notification.2 API Changes - -The names of some event notification APIs are changed. - -**Key API/Component Changes** - -| Module | Class | Method/Attribute/Enumeration/Constant | Change Type| -| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- | -| @ohos.notification | notification | **function** enableNotification(bundle: BundleOption, enable: boolean, callback: AsyncCallback<**void**>): **void**; | Deprecated | -| @ohos.notification | notification | **function** enableNotification(bundle: BundleOption, enable: boolean): Promise<**void**>; | Deprecated | -| @ohos.notificationManager | notificationManager | **function** setNotificationEnable(bundle: BundleOption, enable: boolean, callback: AsyncCallback<**void**>): **void**; | Added | -| @ohos.notificationManager | notificationManager | **function** setNotificationEnable(bundle: BundleOption, enable: boolean): Promise<**void**>; | Added | -| @ohos.notification | notification | **function** enableNotificationSlot(bundle: BundleOption, **type**: SlotType, enable: boolean, callback: AsyncCallback<**void**>): **void**; | Deprecated | -| @ohos.notification | notification | **function** enableNotificationSlot(bundle: BundleOption, **type**: SlotType, enable: boolean): Promise<**void**>; | Deprecated | -| @ohos.notificationManager | notificationManager | **function** setNotificationEnableSlot(bundle: BundleOption, **type**: SlotType, enable: boolean, callback: AsyncCallback<**void**>): **void**; | Added | -| @ohos.notificationManager | notificationManager | **function** setNotificationEnableSlot(bundle: BundleOption, **type**: SlotType, enable: boolean): Promise<**void**>; | Added | -| @ohos.notification | notification | **function** enableDistributed(enable: boolean, callback: AsyncCallback<**void**>): **void**; | Deprecated | -| @ohos.notification | notification | **function** enableDistributed(enable: boolean, callback: AsyncCallback<**void**>): **void**; | Deprecated | -| @ohos.notificationManager | notificationManager | **function** setDistributedEnable(enable: boolean, callback: AsyncCallback<**void**>): **void**; | Added | -| @ohos.notificationManager | notificationManager | **function** setDistributedEnable(enable: boolean): Promise<**void**>; | Added | -| @ohos.notification | notification | **function** enableDistributedByBundle(bundle: BundleOption, enable: boolean, callback: AsyncCallback<**void**>): **void**; | Deprecated | -| @ohos.notification | notification | **function** enableDistributedByBundle(bundle: BundleOption, enable: boolean): Promise<**void**>; | Deprecated | -| @ohos.notificationManager | notificationManager | **function** setDistributedEnableByBundle(bundle: BundleOption, enable: boolean, callback: AsyncCallback<**void**>): **void**; | Added | -| @ohos.notificationManager | notificationManager | **function** setDistributedEnableByBundle(bundle: BundleOption, enable: boolean): Promise<**void**>; | Added | diff --git a/en/release-notes/changelogs/OpenHarmony_3.2.9.1/changelog-x-x.md b/en/release-notes/changelogs/OpenHarmony_3.2.9.1/changelog-x-x.md deleted file mode 100644 index 3ac3e83268d2ac247676cd313d5b5e45d195ea2b..0000000000000000000000000000000000000000 --- a/en/release-notes/changelogs/OpenHarmony_3.2.9.1/changelog-x-x.md +++ /dev/null @@ -1,33 +0,0 @@ -# *Example* Subsystem ChangeLog - -Changes that affect contract compatibility of the last version should be described in the ChangeLog. The changes include but are not limited to those related to API names, parameters, return values, required permissions, call sequence, enumerated values, configuration parameters, and paths. The last version can be an LTS, release, beta, or monthly version, or the like. Contract compatibility, also called semantic compatibility, means that the original program behavior should remain consistent over versions. - -## cl.subsystemname.x xxx Function Change (Example: DeviceType Attribute Change or Camera Permission Change. Use a short description.) - -Add the number **cl.*subsystemname*.*x*** before each change title, where **cl** is the abbreviation of ChangeLog, *subsystemname* is the standard English name of the subsystem, and *x* indicates the change sequence number (starting from 1 in ascending order). - -Describe the changes in terms of functions. Example: *n* and *m* of the *a* function are changed. Developers need to adapt their applications based on the change description. - -If there is a requirement or design document corresponding to the change, attach the requirement number or design document number in the description. - -**Change Impacts** - -Describe whether released APIs (JS or native APIs) are affected or API behavior is changed. - -Describe whether available applications are affected, that is, whether an adaptation is required for building the application code in the SDK environment of the new version. - -**Key API/Component Changes** - -List the API/component changes involved in the function change. - -**Adaptation Guide (Optional)** - -Provide guidance for developers on how to adapt their application to the changes to be compatible with the new version. - -Example: - -Change parameter *n* to *m* in the *a* file. - -``` -sample code -``` diff --git a/en/release-notes/changelogs/OpenHarmony_3.2.9.1/changelogs-arkui.md b/en/release-notes/changelogs/OpenHarmony_3.2.9.1/changelogs-arkui.md deleted file mode 100644 index 80e5645eba71f86ec75134e366d436164a961802..0000000000000000000000000000000000000000 --- a/en/release-notes/changelogs/OpenHarmony_3.2.9.1/changelogs-arkui.md +++ /dev/null @@ -1,126 +0,0 @@ -# ArkUI Subsystem ChangeLog - -## cl.arkui.1 xcomponent API Change - -The following APIs of the **xcomponent** component of the ArkUI subsystem are changed: - - - **getXComponentSurfaceId** and **setXComponentSurfaceSize**: The **@systemapi** tag is removed. - - **getXComponentSurfaceId**, **getXComponentContext**, and **setXComponentSurfaceSize**: The return value types are specified. - -You need to adapt your applications based on the following information. - - -**Change Impacts** - -Released JS APIs are affected. The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version. - -**Key API/Component Changes** - - - **getXComponentSurfaceId**: is changed to a public API, with its return value type specified as string. - - **setXComponentSurfaceSize**: is changed to a public API, with its return value type specified as void. - - **getXComponentContext**: has its return value type specified as object. - -**Adaptation Guide** - -Startup rules for different scenarios are as follows: - -Adaptions to be made: - - - **getXComponentSurfaceId** - - OpenHarmony 3.2 Beta3 rules: - - System API - - No specified return value - - OpenHarmony 3.2 Beta4 rules: - - Public API - - Return value type specified as string - - You need to process the return value as a string. - - **setXComponentSurfaceSize** - - OpenHarmony 3.2 Beta3 rules: - - System API - - No specified return value - - OpenHarmony 3.2 Beta4 rules: - - Public API - - Return value type specified as void - - You need to process the return value as a void. - - **getXComponentContext** - - OpenHarmony 3.2 Beta3 rules: - - No specified return value - - OpenHarmony 3.2 Beta4 rules: - - Return value type specified as object - - You need to process the return value as an object. - -## cl.arkui.2 Change of Styles of Popup Component and APIs - -The styles of the **alertDialog**, **actionSheet**, and **customDialog** components, as well as the **prompt** and **promptAction** APIs were changed. Specifically speaking: - -The popup background blurring effect is added to **promptAction.showDialog**, **promptAction.showActionMenu**, **alertDialog**, **actionSheet**, and **customDialog**. - -**Change Impacts** - -The popup background blurring effect is set by default. - -**Key API/Component Changes** - -APIs: **promptAction.showDialog** and **promptAction.showActionMenu;** -Components: **alertDialog**, **actionSheet**, and **customDialog** - -**Adaptation Guide** - -No adaptation is required. - -## cl.arkui.3 Supplementation of the Initialization Mode and Restriction Verification Scenarios of Custom Components' Member Variables - -For details, see [Restrictions and Extensions](../../../application-dev/quick-start/arkts-restrictions-and-extensions.md). - -**Change Impacts** - -If custom components' member variables are initialized or assigned with values not according to the document specifications, an error will be reported during compilation. - -**Key API/Component Changes** - -N/A - -**Adaptation Guide** - -Make modification according to specifications in the above document. - -## cl.arkui.4 Supplementation of Verification Scenarios of Value Assignment Restrictions on Member Variables of Custom Parent Components and Child Components - -For details, see [Restrictions and Extensions](../../../application-dev/quick-start/arkts-restrictions-and-extensions.md). - - -**Change Impacts** - -If member variables of the parent component or child component are initialized not according to the document specifications, an error will be reported during compilation. - -**Key API/Component Changes** - -N/A - -**Adaptation Guide** - -Make modification according to specifications in the above document, using other decorators or normal member variables for value assignment. - -## cl.arkui.5 Supplementation of Verification for a Single Subcomponent - -Verification for a single subcomponent is enabled for the following components: **Button**, **FlowItem**, **GridItem**, **GridCol**, **ListItem**, **Navigator**, **Refresh**, **RichText**, **ScrollBar**, **StepperItem**, and **TabContent**. - - -**Change Impacts** - -If one of the preceding components contains more than one subcomponent, an error will be reported during compilation. - -**Key API/Component Changes** - -```js -RichText('RichText') { - Text('Text1') - Text('Text2') -} -/* ArkTS:ERROR File: /root/newOH/developtools/ace-ets2bundle/compiler/sample/pages/home.ets:25:7 - The component 'RichText' can only have a single child component. */ -``` - -**Adaptation Guide** - -Make modification based on the error message. Make sure that the specified component contains only one subcomponent. diff --git a/en/release-notes/changelogs/OpenHarmony_3.2.9.1/changelogs-telephony.md b/en/release-notes/changelogs/OpenHarmony_3.2.9.1/changelogs-telephony.md deleted file mode 100644 index a2a022040a775eeae466e34cc61d26924073b395..0000000000000000000000000000000000000000 --- a/en/release-notes/changelogs/OpenHarmony_3.2.9.1/changelogs-telephony.md +++ /dev/null @@ -1,59 +0,0 @@ -# Telephony Subsystem ChangeLog - - - -## cl.telephony.1 Input Parameter Change of System APIs of the SMS Module - -Input parameters are changed for some released system APIs of the SMS module of the telephony subsystem, which do not comply with the API specifications of OpenHarmony. The following changes are made in API version 9 and later: - -The **slotId** parameter is added to the **isImsSmsSupported** API, indicating the slot ID. - -**Change Impacts** - -Input parameters of JavaScript APIs need to be adapted for applications developed based on earlier versions. Otherwise, relevant functions will be affected. - -**Key API/Component Changes** - -- Involved APIs - - isImsSmsSupported(callback: AsyncCallback): void; - isImsSmsSupported(): Promise; - -- Before change: - -```js -function isImsSmsSupported(callback: AsyncCallback): void; -function isImsSmsSupported(): Promise; -``` - -- After change: - -```js -function isImsSmsSupported(slotId: number, callback: AsyncCallback): void; -function isImsSmsSupported(slotId: number): Promise; -``` - -**Adaptation Guide** - -Add an input parameter. The sample code is as follows: - -Callback mode - -```js -let slotId = 0; -sms.isImsSmsSupported(slotId, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); -}); -``` - -Promise mode - -```js -let slotId = 0; -let promise = sms.isImsSmsSupported(slotId); -promise.then(data => { - console.log(`isImsSmsSupported success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { - console.error(`isImsSmsSupported failed, promise: err->${JSON.stringify(err)}`); -}); -``` diff --git a/en/release-notes/changelogs/OpenHarmony_3.2.9.2/changelog-x-x.md b/en/release-notes/changelogs/OpenHarmony_3.2.9.2/changelog-x-x.md deleted file mode 100644 index 3ac3e83268d2ac247676cd313d5b5e45d195ea2b..0000000000000000000000000000000000000000 --- a/en/release-notes/changelogs/OpenHarmony_3.2.9.2/changelog-x-x.md +++ /dev/null @@ -1,33 +0,0 @@ -# *Example* Subsystem ChangeLog - -Changes that affect contract compatibility of the last version should be described in the ChangeLog. The changes include but are not limited to those related to API names, parameters, return values, required permissions, call sequence, enumerated values, configuration parameters, and paths. The last version can be an LTS, release, beta, or monthly version, or the like. Contract compatibility, also called semantic compatibility, means that the original program behavior should remain consistent over versions. - -## cl.subsystemname.x xxx Function Change (Example: DeviceType Attribute Change or Camera Permission Change. Use a short description.) - -Add the number **cl.*subsystemname*.*x*** before each change title, where **cl** is the abbreviation of ChangeLog, *subsystemname* is the standard English name of the subsystem, and *x* indicates the change sequence number (starting from 1 in ascending order). - -Describe the changes in terms of functions. Example: *n* and *m* of the *a* function are changed. Developers need to adapt their applications based on the change description. - -If there is a requirement or design document corresponding to the change, attach the requirement number or design document number in the description. - -**Change Impacts** - -Describe whether released APIs (JS or native APIs) are affected or API behavior is changed. - -Describe whether available applications are affected, that is, whether an adaptation is required for building the application code in the SDK environment of the new version. - -**Key API/Component Changes** - -List the API/component changes involved in the function change. - -**Adaptation Guide (Optional)** - -Provide guidance for developers on how to adapt their application to the changes to be compatible with the new version. - -Example: - -Change parameter *n* to *m* in the *a* file. - -``` -sample code -``` diff --git a/en/release-notes/changelogs/OpenHarmony_3.2.9.3/changelog-x-x.md b/en/release-notes/changelogs/OpenHarmony_3.2.9.3/changelog-x-x.md deleted file mode 100644 index 3ac3e83268d2ac247676cd313d5b5e45d195ea2b..0000000000000000000000000000000000000000 --- a/en/release-notes/changelogs/OpenHarmony_3.2.9.3/changelog-x-x.md +++ /dev/null @@ -1,33 +0,0 @@ -# *Example* Subsystem ChangeLog - -Changes that affect contract compatibility of the last version should be described in the ChangeLog. The changes include but are not limited to those related to API names, parameters, return values, required permissions, call sequence, enumerated values, configuration parameters, and paths. The last version can be an LTS, release, beta, or monthly version, or the like. Contract compatibility, also called semantic compatibility, means that the original program behavior should remain consistent over versions. - -## cl.subsystemname.x xxx Function Change (Example: DeviceType Attribute Change or Camera Permission Change. Use a short description.) - -Add the number **cl.*subsystemname*.*x*** before each change title, where **cl** is the abbreviation of ChangeLog, *subsystemname* is the standard English name of the subsystem, and *x* indicates the change sequence number (starting from 1 in ascending order). - -Describe the changes in terms of functions. Example: *n* and *m* of the *a* function are changed. Developers need to adapt their applications based on the change description. - -If there is a requirement or design document corresponding to the change, attach the requirement number or design document number in the description. - -**Change Impacts** - -Describe whether released APIs (JS or native APIs) are affected or API behavior is changed. - -Describe whether available applications are affected, that is, whether an adaptation is required for building the application code in the SDK environment of the new version. - -**Key API/Component Changes** - -List the API/component changes involved in the function change. - -**Adaptation Guide (Optional)** - -Provide guidance for developers on how to adapt their application to the changes to be compatible with the new version. - -Example: - -Change parameter *n* to *m* in the *a* file. - -``` -sample code -``` diff --git a/en/release-notes/changelogs/OpenHarmony_4.0.2.1/changelogs-testfwk_arkxtest.md b/en/release-notes/changelogs/OpenHarmony_4.0.2.1/changelogs-testfwk_arkxtest.md deleted file mode 100644 index 1206d659402df80e9892ca3e7b4eba1e729c9357..0000000000000000000000000000000000000000 --- a/en/release-notes/changelogs/OpenHarmony_4.0.2.1/changelogs-testfwk_arkxtest.md +++ /dev/null @@ -1,42 +0,0 @@ -# Test Subsystem ChangeLog - -## cl.testfwk_arkxtest.1 API Name Change of Rect - -The definition of **Rect**, an enumeration type that indicates the component bound information, is changed since version 4.0.2.1. - -## Change Impacts - -This change affects the **Rect** API provided by **@ohos.uitest**. If you have used the **Rect** API of **@ohos.uitest-api9** during test case development, adaptation is required so that the compilation can be successful in the SDK environment of the new version. - -## Key API/Component Changes - -### Rect9+ - -Before change - -| Name | Value | Description | -| ------- | ---- | ------------------------- | -| leftX | 1 | X-coordinate of the upper left corner of the component bounds.| -| topY | 2 | Y-coordinate of the upper left corner of the component bounds.| -| rightX | 3 | X-coordinate of the lower right corner of the component bounds.| -| bottomY | 4 | Y-coordinate of the lower right corner of the component bounds.| - -After change - -| Name | Value | Description | -| ------ | ---- | ------------------------- | -| left | 1 | X-coordinate of the upper left corner of the component bounds.| -| top | 2 | Y-coordinate of the upper left corner of the component bounds.| -| right | 3 | X-coordinate of the lower right corner of the component bounds.| -| bottom | 4 | Y-coordinate of the lower right corner of the component bounds.| - -## Adaptation Guide - -### Adaptation to the API Name Change - -You can replace the class name according to the following rules: - -- `leftX-->left` -- `topY-->top` -- `rightX-->right` -- `bottomY-->bottom` diff --git a/en/release-notes/changelogs/OpenHarmony_4.0.2.3/changelogs-usb.md b/en/release-notes/changelogs/OpenHarmony_4.0.2.3/changelogs-usb.md deleted file mode 100644 index 909d8f69d6c116ced05232af8f3801de89282cfd..0000000000000000000000000000000000000000 --- a/en/release-notes/changelogs/OpenHarmony_4.0.2.3/changelogs-usb.md +++ /dev/null @@ -1,37 +0,0 @@ -# USB Subsystem API Changelog - -## cl.usb_manager.1 Bundle Name Change - -For applications developed based on earlier versions, you need to change the name of the imported bundle. Otherwise, the original service logic will be affected. - -**Key API/Component Changes** - -| Original Bundle Name | New Bundle Name | -|------------------ | ------------------- | -| ohos.usbV9.d.ts | ohos.usbManager.d.ts | - -**Adaptation Guide** - -Change **@ohos.usbV9** to **@ohos.usbManager** when importing the bundle. - -## cl.usb_manager.2 API Parameter Type Change - -For applications developed based on earlier versions, you need to modify the parameter type. Otherwise, the original service logic will be affected. - -**Key API/Component Changes** - -| Original Class Name | New Class Name | -|---------------| ------------- | -| interface USBConfig | interface USBConfiguration | - -| Original Namespace | New Namespace | -|---------------| ------------- | -| @namespace usbV9 | @namespace usbManager | - -| Bundle Name | Original API | New API | -| --------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | -| ohos.usbManager.d.ts | function setConfiguration(pipe: USBDevicePipe, config: USBConfig): number; | function setConfiguration(pipe: USBDevicePipe, config: USBConfiguration): number; | - -**Adaptation Guide** - -When calling **setConfiguration**, change the parameter type from **USBConfig** to **USBConfiguration**. diff --git a/en/release-notes/changelogs/OpenHarmony_4.0.3.2/changelog-security.md b/en/release-notes/changelogs/OpenHarmony_4.0.3.2/changelog-security.md deleted file mode 100644 index caf1866f3a5caec4bb78d7f7991208f8c9da46e9..0000000000000000000000000000000000000000 --- a/en/release-notes/changelogs/OpenHarmony_4.0.3.2/changelog-security.md +++ /dev/null @@ -1,86 +0,0 @@ -# Security Subsystem Changelog - -## cl.security.1 ParamsSpec Attribute Name Change -Changed **algoName** of the **ParamsSpec** structure to **algName**. - -**Change Impact** - -For the released JavaScript APIs that use **ParamsSpec** and its child classes **IvParamsSpec**, **GcmParamsSpec**, and **CcmParamsSpec** as parameters or return values, **algoName** must be changed to **algName**. -The change must be made for all the applications that use these APIs. Otherwise, the compilation in the SDK of the new version cannot be successful. - -**Key API/Component Changes** - -API prototype before the change: - - ```ts -interface ParamsSpec { - /** - * Indicates the algorithm name. Should be set before initialization of a cipher object. - * @type { string } - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - algoName : string; -} - ``` -API prototype after the change: - - ```ts -interface ParamsSpec { - /** - * Indicates the algorithm name. Should be set before initialization of a cipher object. - * @type { string } - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - algName : string; -} - ``` - -**Adaptation Guide** - -Change **algoName** to **algName** in **ParamsSpec** and its child classes **IvParamsSpec**, **GcmParamsSpec**, and **CcmParamsSpec**. - ```ts -function genGcmParamsSpec() { - let arr = [0, 0, 0, 0 , 0, 0, 0, 0, 0, 0 , 0, 0]; // 12 bytes - let dataIv = new Uint8Array(arr); - let ivBlob = {data : dataIv}; - - arr = [0, 0, 0, 0 , 0, 0, 0, 0]; // 8 bytes - let dataAad = new Uint8Array(arr); - let aadBlob = {data : dataAad}; - - arr = [0, 0, 0, 0 , 0, 0, 0, 0, 0, 0, 0, 0 , 0, 0, 0, 0]; // 16 bytes - let dataTag = new Uint8Array(arr); - let tagBlob = {data : dataTag}; - let gcmParamsSpec = {iv : ivBlob, aad : aadBlob, authTag : tagBlob, algName : "GcmParamsSpec"}; - return gcmParamsSpec; -} - ``` -For details, see the APIs of **ParamsSpec** in [Crypto Framework](../../../application-dev/reference/apis/js-apis-cryptoFramework.md#paramsspec). - -## Change of cl.security.2 ECC Algorithm Parameter Name from ECC512 to ECC521 - -**Change Impact** - -Behavior of released JavaScript APIs will be changed. -The application needs to be adapted to obtain the correct result in the SDK of the new version. - -**Key API/Component Changes** -The parameter passed in the APIs is changed from **ECC512** to **ECC521**. The related APIs remain unchanged. For details, see [Key Generation Specifications](../../../application-dev/security/cryptoFramework-overview.md#key-generation-specifications). The following APIs are involved: - -cryptoFramework.createAsyKeyGenerator - -cryptoFramework.createSign - -cryptoFramework.createVerify - -cryptoFramework.createKeyAgreement - -**Adaptation Guide** - -```js -import cryptoFramework from "@ohos.security.cryptoFramework" - -let asyKeyGenerator = cryptoFramework.createAsyKeyGenerator("ECC521"); -``` diff --git a/en/release-notes/changelogs/OpenHarmony_4.0.3.2/changelog-sensor.md b/en/release-notes/changelogs/OpenHarmony_4.0.3.2/changelog-sensor.md deleted file mode 100644 index 7a2e2946d69a0f116616152cd82eb8a2bae96c58..0000000000000000000000000000000000000000 --- a/en/release-notes/changelogs/OpenHarmony_4.0.3.2/changelog-sensor.md +++ /dev/null @@ -1,49 +0,0 @@ -# Pan-sensor Subsystem Changelog - -## cl.ability.1 Attribute Name Changed from venderName to vendorName in the Sensor API - -**venderName** is changed to **vendorName**. - -**Change Impact** - -The **venderName** attribute cannot be used anymore. Use **vendorName** instead. - -**Key API/Component Changes** - -- Before change: - -```js - interface Sensor { - sensorName:string; /**< Sensor name */ - venderName:string; /**< Sensor vendor version */ - firmwareVersion:string; /**< Sensor firmware version */ - hardwareVersion:string; /**< Sensor hardware version */ - sensorId:number; /**< Sensor type ID, {@code SensorType} */ - maxRange:number; /**< Maximum measurement range of the sensor */ - minSamplePeriod:number; /**< Minimum sample period allowed, in ns */ - maxSamplePeriod:number; /**< maximum sample period allowed, in ns */ - precision:number; /**< Sensor accuracy */ - power:number; /**< Sensor power */ - } -``` - -- After change: - -```js - interface Sensor { - sensorName:string; /**< Sensor name */ - vendorName:string; /**< Sensor vendor version */ - firmwareVersion:string; /**< Sensor firmware version */ - hardwareVersion:string; /**< Sensor hardware version */ - sensorId:number; /**< Sensor type ID, {@code SensorType} */ - maxRange:number; /**< Maximum measurement range of the sensor */ - minSamplePeriod:number; /**< Minimum sample period allowed, in ns */ - maxSamplePeriod:number; /**< maximum sample period allowed, in ns */ - precision:number; /**< Sensor accuracy */ - power:number; /**< Sensor power */ - } -``` - -**Adaptation Guide** - -Replace **venderName** with **vendorName**. diff --git a/en/release-notes/changelogs/OpenHarmony_4.0.3.2/changelog-web.md b/en/release-notes/changelogs/OpenHarmony_4.0.3.2/changelog-web.md deleted file mode 100644 index 44380d11950e3f018b719776edf08964d6b4c0af..0000000000000000000000000000000000000000 --- a/en/release-notes/changelogs/OpenHarmony_4.0.3.2/changelog-web.md +++ /dev/null @@ -1,467 +0,0 @@ -# Web Subsystem Changelog - -Compared with earlier versions, OpenHarmony 4.0.3.2 has the following API changes in its web subsystem: - -## cl.web.1 HitTestTypeV9 Name Change - -Renamed the enum class **HitTestTypeV9** **WebHitTestType** to meet the naming conventions. - -**Change Impact** - -The enum class **HitTestTypeV9** and APIs that use **HitTestTypeV9** as a parameter or return value cannot be used in OpenHarmony 4.0.3.2 and later versions. - -**Key API/Component Changes** - -- Involved APIs: - - enum HitTestTypeV9 - -- Before change: - - ```ts - enum HitTestTypeV9 - ``` - -- After change: - - ```ts - enum WebHitTestType - ``` - -**Adaptation Guide** - -Replace **HitTestTypeV9** with **WebHitTestType**. - -## cl.web.2 HeaderV9 Name Change - -Renamed the struct **HeaderV9** **WebHeader** to meet the naming conventions. - -**Change Impact** - -The struct **HeaderV9** and APIs that use **HeaderV9** as a parameter or return value cannot be used in OpenHarmony 4.0.3.2 and later versions. - -**Key API/Component Changes** - -- Involved APIs: - - interface HeaderV9 - -- Before change: - - ```ts - interface HeaderV9 - ``` - -- After change: - - ```ts - interface WebHeader - ``` - -**Adaptation Guide** - -Replace **HeaderV9** with **WebHeader**. - -## cl.web.3 Member Change of HitTestValue - -Rename the member variable **HitTestTypeV9** in the **HitTestValue** struct **WebHitTestType** to meet the naming conventions. - -**Change Impact** - -The struct **HitTestValue** and APIs that use **HitTestValue** as a parameter or return value cannot be used in OpenHarmony 4.0.3.2 and later versions. - -**Key API/Component Changes** - -- Involved APIs: - - interface HitTestValue - -- Before change: - - ```ts - interface HitTestValue { - - /** - * Get the hit test type. - * - * @since 9 - */ - type: HitTestTypeV9; - - /** - * Get the hit test extra data. - * - * @since 9 - */ - extra: string; - } - ``` - -- After change: - - ```ts - interface HitTestValue { - - /** - * Get the hit test type. - * - * @since 9 - */ - type: WebHitTestType; - - /** - * Get the hit test extra data. - * - * @since 9 - */ - extra: string; - } - ``` - -**Adaptation Guide** - -Replace **HitTestTypeV9** with **WebHitTestType**. - -## cl.web.4 Parameter Type Change of loadUrl - -Changed the type of the **headers** parameter in **loadUrl** to **WebHeader** to meet the naming conventions. - -**Change Impact** - -The **loadUrl** API that uses the **headers** parameter cannot be used in OpenHarmony 4.0.3.2 and later versions. - -**Key API/Component Changes** - -- Involved APIs: - - loadUrl(url: string | Resource, headers?: Array\): void - -- Before change: - - ```ts - loadUrl(url: string | Resource, headers?: Array): void - ``` - -- After change: - - ```ts - loadUrl(url: string | Resource, headers?: Array): void - ``` - -**Adaptation Guide** - -Change the type of the **headers** parameter in **loadUrl** from **HeaderV9** to **WebHeader**. - -## cl.web.5 Return Value Type Change of getHitTest - -Changed the return value type of the **getHitTest** API to **WebHitTest** to meet the naming conventions. - -**Change Impact** - -The **getHitTest** API cannot be used in OpenHarmony 4.0.3.2 and later versions. - -**Key API/Component Changes** - -- Involved APIs: - - getHitTest(): HitTestTypeV9 - -- Before change: - - ```ts - getHitTest(): HitTestTypeV9 - ``` - -- After change: - - ```ts - getHitTest(): WebHitTestType - ``` - -**Adaptation Guide** - -Change the return value type of the **getHitTest** API from **HitTestTypeV9** to **WebHitTestType**. - -## cl.web.6 Moving of the WebMessagePort Class - -Moved the **WebMessagePort** class to **@ohos.web.webview.d.ts** and added error throwing. - -**Change Impact** - -If your application is developed based on earlier versions, note that the **d.ts** file storage location and the name of the module to be imported are changed. In addition, be mindful of the error codes now that the APIs in the class support error code processing. - -**Key API/Component Changes** - -- Involved APIs: - - postMessageEvent(message: WebMessageEvent): void; - onMessageEvent(callback: (result: string) => void): void; - -- Before change: - - ```ts - postMessageEvent(message: WebMessageEvent): void; - onMessageEvent(callback: (result: string) => void): void; - ``` - -- After change: - - ```ts - postMessageEvent(message: WebMessage): void; - onMessageEvent(callback: (result: WebMessage) => void): void; - ``` - -**Adaptation Guide** - -Instead of importing APIs from the original **WebMessagePort** class, import APIs from **@ohos.web.webview** as follows: - - ```ts - import web_webview from '@ohos.web.webview'; - ``` - -## cl.web.7 Moving of the HitTestValue Class - -Moved the **HitTestValue** class to **@ohos.web.webview.d.ts**; changed **HitTestValue** from a class to an API; changed the **getType** and **getExtra** from APIs to attributes. - -**Change Impact** - -If your application is developed based on earlier versions, note that the **d.ts** file storage location and the name of the module to be imported are changed. - -**Key API/Component Changes** - -- Involved APIs: - - getType(): HitTestType; - getExtra(): string; - -- Before change: - - ```ts - getType(): HitTestType; - getExtra(): string; - ``` - -- After change: - - ```ts - type: WebHitTestType; - extra: string; - ``` - -**Adaptation Guide** - -Instead of importing APIs from the original **HitTestValue** class, import APIs from **@ohos.web.webview** as follows: - - ```ts - import web_webview from '@ohos.web.webview'; - ``` - -## cl.web.8 Moving of API Version 9 APIs Under WebCookie - -Moved APIs of API version 9 in the **WebCookie** class to **web.webview.webview.WebCookieManager** -and added error throwing. - -**Change Impact** - -If your application is developed based on earlier versions, note that the **d.ts** file storage location and the name of the module to be imported are changed. In addition, be mindful of the error codes now that the APIs in the class support error code processing. -The APIs in the class are static. - -**Key API/Component Changes** - -- Involved APIs: - - isCookieAllowed(): boolean; - isThirdPartyCookieAllowed(): boolean; - putAcceptCookieEnabled(accept: boolean): void; - putAcceptThirdPartyCookieEnabled(accept: boolean): void; - setCookie(url: string, value: string): boolean; - saveCookieSync(): boolean; - getCookie(url: string): string; - existCookie(): boolean; - deleteEntireCookie(): void; - deleteSessionCookie(): void; - -- Before change: - - ```ts - isCookieAllowed(): boolean; - isThirdPartyCookieAllowed(): boolean; - putAcceptCookieEnabled(accept: boolean): void; - putAcceptThirdPartyCookieEnabled(accept: boolean): void; - setCookie(url: string, value: string): boolean; - saveCookieSync(): boolean; - getCookie(url: string): string; - existCookie(): boolean; - deleteEntireCookie(): void; - deleteSessionCookie(): void; - ``` - -- After change: - - ```ts - static isCookieAllowed(): boolean; - static isThirdPartyCookieAllowed(): boolean; - static putAcceptCookieEnabled(accept: boolean): void; - static putAcceptThirdPartyCookieEnabled(accept: boolean): void; - static setCookie(url: string, value: string): void; - static saveCookieAsync(): Promise; - static saveCookieAsync(callback: AsyncCallback): void; - static getCookie(url: string): string; - static existCookie(): boolean; - static deleteEntireCookie(): void; - static deleteSessionCookie(): void; - ``` - -**Adaptation Guide** - -Instead of importing APIs from the original **WebCookie** class, import APIs from **@ohos.web.webview** as follows: - - ```ts - import web_webview from '@ohos.web.webview'; - ``` - -## cl.web.9 Moving of API Version 9 APIs Under WebController - -Moved APIs of API version 9 in the **WebController** class to **web.webview.webview.WebviewController** and added error throwing. - -**Change Impact** - -If your application is developed based on earlier versions, note that the **d.ts** file storage location and the name of the module to be imported are changed. In addition, be mindful of the error codes now that the APIs in the class support error code processing. -The **getDefaultUserAgent** API is renamed **getUserAgent**. - -**Key API/Component Changes** - -- Involved APIs: - - zoomIn(): boolean; - zoomOut(): boolean; - createWebMessagePorts(): Array\; - postMessage(options: { message: WebMessageEvent, uri: string}): void; - getHitTestValue(): HitTestValue; - getWebId(): number; - getDefaultUserAgent(): string; - getTitle(): string; - getPageHeight(): number; - backOrForward(step: number): void; - searchAllAsync(searchString: string): void; - clearMatches(): void; - searchNext(forward: boolean): void; - clearSslCache(): void; - clearClientAuthenticationCache(): void; - getUrl(): string; - -- Before change: - - ```ts - zoomIn(): boolean; - zoomOut(): boolean; - createWebMessagePorts(): Array; - postMessage(options: { message: WebMessageEvent, uri: string}): void; - getHitTestValue(): HitTestValue; - getWebId(): number; - getDefaultUserAgent(): string; - getTitle(): string; - getPageHeight(): number; - backOrForward(step: number): void; - searchAllAsync(searchString: string): void; - clearMatches(): void; - searchNext(forward: boolean): void; - clearSslCache(): void; - clearClientAuthenticationCache(): void; - getUrl(): string; - ``` - -- After change: - - ```ts - zoomIn(): void; - zoomOut(): void; - createWebMessagePorts(): Array; - postMessage(name: string, ports: Array, uri: string): void; - getHitTestValue(): HitTestValue; - getWebId(): number; - getUserAgent(): string; - getTitle(): string; - getPageHeight(): number; - backOrForward(step: number): void; - searchAllAsync(searchString: string): void; - clearMatches(): void; - searchNext(forward: boolean): void; - clearSslCache(): void; - clearClientAuthenticationCache(): void; - getUrl(): string; - ``` - -**Adaptation Guide** - -Instead of importing APIs from the original **WebController** class, import APIs from **@ohos.web.webview** as follows: - - ```ts - import web_webview from '@ohos.web.webview'; - ``` - -## cl.web.10 Moving of the WebAsyncController Class - -Moved the APIs in the **WebAsyncController** class to the **web.webview.webview.WebviewController** class and added error throwing. - -**Change Impact** - -If your application is developed based on earlier versions, pay attention to error code processing. - -**Key API/Component Changes** - -- Involved APIs: - - storeWebArchive(baseName: string, autoName: boolean): Promise\; - storeWebArchive(baseName: string, autoName: boolean, callback : AsyncCallback\): void; - -- Before change: - - ```ts - storeWebArchive(baseName: string, autoName: boolean): Promise; - storeWebArchive(baseName: string, autoName: boolean, callback : AsyncCallback): void; - ``` - -- After change: - - ```ts - storeWebArchive(baseName: string, autoName: boolean): Promise; - storeWebArchive(baseName: string, autoName: boolean, callback : AsyncCallback): void; - ``` - -**Adaptation Guide** - -Example: - - ```ts - // xxx.ets - import web_webview from '@ohos.web.webview' - - @Entry - @Component - struct WebComponent { - controller: web_webview.WebviewController = new web_webview.WebviewController(); - - build() { - Column() { - Button('saveWebArchive') - .onClick(() => { - try { - this.controller.storeWebArchive("/data/storage/el2/base/", true, (error, filename) => { - if (error) { - console.info(`save web archive error: ` + JSON.stringify(error)) - return; - } - if (filename != null) { - console.info(`save web archive success: ${filename}`) - } - }); - } catch (error) { - console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); - } - }) - Web({ src: 'www.example.com', controller: this.controller }) - } - } - } - ``` diff --git a/en/release-notes/changelogs/OpenHarmony_4.0.3.2/changelogs-account_os_account.md b/en/release-notes/changelogs/OpenHarmony_4.0.3.2/changelogs-account_os_account.md new file mode 100644 index 0000000000000000000000000000000000000000..8678507b6c8d8449e8cac47e6b8669611865bec2 --- /dev/null +++ b/en/release-notes/changelogs/OpenHarmony_4.0.3.2/changelogs-account_os_account.md @@ -0,0 +1,391 @@ +# Account Subsystem Changelog + +OpenHarmony 4.0.3.2 has the following changes in account module APIs: + +## cl.account_os_account.1 App Account API isAccountRemovable Renamed + +Changed **isAccountRemovable** in the **Authenticator** class to **checkAccountRemovable**. + +**Change Impact** + +The **isAccountRemovable** API in the **Authenticator** class cannot be used from 4.0.3.2. Use **checkAccountRemovable** instead. + +**Key API/Component Changes** + +- Involved APIs: + ```ts + class Authenticator { + ... + isAccountRemovable + ... + } + ``` +- Before change: + + ```ts + class Authenticator { + ... + /** + * Checks whether the specified account can be removed. + * @param name Indicates the account name. + * @param callback Indicates the authenticator callback. + * @returns void. + * @since 9 + */ + isAccountRemovable(name: string, callback: AuthCallback): void; + ... + } + ``` + +- After change: + + ```ts + class Authenticator { + ... + /** + * Checks whether the specified account can be removed. + * @param name Indicates the account name. + * @param callback Indicates the authenticator callback. + * @returns void. + * @since 9 + */ + checkAccountRemovable(name: string, callback: AuthCallback): void; + ... + } + ``` + +## cl.account_os_account.2 OS Account API checkConstraintEnabled Renamed + +Changed **checkConstraintEnabled** to **checkOsAccountConstraintEnabled**. + +**Change Impact** + +The **checkConstraintEnabled** API cannot be used from 4.0.3.2. Use **checkOsAccountConstraintEnabled** instead. + +**Key API/Component Changes** + +- Involved APIs: +``` +interface AccountManager { + ... + checkConstraintEnabled + ... +} +``` + +- Before change: + + ```ts + checkConstraintEnabled(localId: number, constraint: string, callback: AsyncCallback): void; + checkConstraintEnabled(localId: number, constraint: string): Promise; + ``` + +- After change: + + ```ts + checkOsAccountConstraintEnabled(localId: number, constraint: string, callback: AsyncCallback): void; + checkOsAccountConstraintEnabled(localId: number, constraint: string): Promise; + ``` + +## cl.account_os_account.3 OS Account API **checkOsAccountConstraintEnabled** Permission Scenario Change + +Added an optional permission **ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS** to the **checkOsAccountConstraintEnabled** API. + +**Change Impact** + +In 4.0.3.2 and later versions, an app with the **ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS** permission can also call **checkOsAccountConstraintEnabled**. +The use of **ohos.permission.MANAGE_LOCAL_ACCOUNTS** is not affected. + +**Key API/Component Changes** + +- Involved APIs: +``` +interface AccountManager { + ... + checkOsAccountConstraintEnabled + ... +} +``` + +- Before change: + + ```ts + ... + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS + ... + checkOsAccountConstraintEnabled(localId: number, constraint: string, callback: AsyncCallback): void; + checkOsAccountConstraintEnabled(localId: number, constraint: string): Promise; + ``` + +- After change: + + ```ts + ... + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + ... + checkOsAccountConstraintEnabled(localId: number, constraint: string, callback: AsyncCallback): void; + checkOsAccountConstraintEnabled(localId: number, constraint: string): Promise; + ``` + +## cl.account_os_account.4 OS Account API queryOsAccountLocalIdFromProcessd Renamed + +Changed **queryOsAccountLocalIdFromProcess** to **getOsAccountLocalId**. + +**Change Impact** + +The **queryOsAccountLocalIdFromProcess** API cannot be used from 4.0.3.2. Use **getOsAccountLocalId** instead. + +**Key API/Component Changes** + +- Involved APIs: +``` +interface AccountManager { + ... + queryOsAccountLocalIdFromProcess + ... +} +``` +- Before change: + + ```ts + queryOsAccountLocalIdFromProcess(callback: AsyncCallback): void; + queryOsAccountLocalIdFromProcess(): Promise; + ``` + +- After change: + + ```ts + getOsAccountLocalId(callback: AsyncCallback): void; + getOsAccountLocalId(): Promise; + ``` + +## cl.account_os_account.5 OS Account API queryOsAccountLocalIdFromUid Renamed + +Changed **queryOsAccountLocalIdFromUid** to **getOsAccountLocalIdForUid**. + +**Change Impact** + +The **queryOsAccountLocalIdFromUid** API cannot be used from 4.0.3.2. Use **getOsAccountLocalIdForUid** instead. + +**Key API/Component Changes** + +- Involved APIs: +``` +interface AccountManager { + ... + queryOsAccountLocalIdFromUid + ... +} +``` + +- Before change: + + ```ts + queryOsAccountLocalIdFromUid(uid: number, callback: AsyncCallback): void; + queryOsAccountLocalIdFromUid(uid: number): Promise; + ``` + +- After change: + + ```ts + getOsAccountLocalIdForUid(uid: number, callback: AsyncCallback): void; + getOsAccountLocalIdForUid(uid: number): Promise; + ``` + +## cl.account_os_account.6 OS Account API queryOsAccountLocalIdFromDomain Renamed + +Changed **queryOsAccountLocalIdFromDomain** to **getOsAccountLocalIdForDomain**. + +**Change Impact** + +The **queryOsAccountLocalIdFromDomain** API cannot be used from 4.0.3.2. Use **getOsAccountLocalIdForDomain** instead. + +**Key API/Component Changes** + +- Involved APIs: +``` +interface AccountManager { + ... + queryOsAccountLocalIdFromDomain + ... +} +``` + +- Before change: + + ```ts + queryOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo, callback: AsyncCallback): void; + queryOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo): Promise; + ``` + +- After change: + + ```ts + getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo, callback: AsyncCallback): void; + getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo): Promise; + ``` + +## cl.account_os_account.7 OS Account API getActivatedOsAccountIds Renamed + +Changed **getActivatedOsAccountIds** to **getActivatedOsAccountLocalIds**. + +**Change Impact** + +The **getActivatedOsAccountIds** API cannot be used from 4.0.3.2. Use **getActivatedOsAccountLocalIds** instead. + +**Key API/Component Changes** + +- Involved APIs: +``` +interface AccountManager { + ... + getActivatedOsAccountIds + ... +} +``` + +- Before change: + + ```ts + getActivatedOsAccountIds(callback: AsyncCallback>): void; + getActivatedOsAccountIds(): Promise>; + ``` + +- After change: + + ```ts + getActivatedOsAccountLocalIds(callback: AsyncCallback>): void; + getActivatedOsAccountLocalIds(): Promise>; + ``` + +## cl.account_os_account.8 OS Account API queryOsAccountLocalIdBySerialNumber Renamed + +Changed **queryOsAccountLocalIdBySerialNumber** to **getOsAccountLocalIdForSerialNumber**. + +**Change Impact** + +The **queryOsAccountLocalIdBySerialNumber** API cannot be used from 4.0.3.2. Use **getOsAccountLocalIdForSerialNumber** instead. + +**Key API/Component Changes** + +- Involved APIs: +``` +interface AccountManager { + ... + queryOsAccountLocalIdBySerialNumber + ... +} +``` + +- Before change: + + ```ts + queryOsAccountLocalIdBySerialNumber(serialNumber: number, callback: AsyncCallback): void; + queryOsAccountLocalIdBySerialNumber(serialNumber: number): Promise; + ``` + +- After change: + + ```ts + getOsAccountLocalIdForSerialNumber(serialNumber: number, callback: AsyncCallback): void; + getOsAccountLocalIdForSerialNumber(serialNumber: number): Promise; + ``` + +## cl.account_os_account.9 OS Account API querySerialNumberByOsAccountLocalId Renamed + +Changed **querySerialNumberByOsAccountLocalId** to **getSerialNumberForOsAccountLocalId**. + +**Change Impact** + +The **querySerialNumberByOsAccountLocalId** API cannot be used from 4.0.3.2. Use **getSerialNumberForOsAccountLocalId** instead. + +**Key API/Component Changes** + +- Involved APIs: +``` +interface AccountManager { + ... + querySerialNumberByOsAccountLocalId + ... +} +``` + +- Before change: + + ```ts + querySerialNumberByOsAccountLocalId(localId: number, callback: AsyncCallback): void; + querySerialNumberByOsAccountLocalId(localId: number): Promise; + ``` + +- After change: + + ```ts + getSerialNumberForOsAccountLocalId(localId: number, callback: AsyncCallback): void; + getSerialNumberForOsAccountLocalId(localId: number): Promise; + ``` + +## cl.account_os_account.10 OS Account API getBundleIdFromUid Renamed + +Changed **getBundleIdFromUid** to **getBundleIdForUid**. + +**Change Impact** + +The **getBundleIdFromUid** API cannot be used from 4.0.3.2. Use **getBundleIdForUid** instead. + +**Key API/Component Changes** + +- Involved APIs: +``` +interface AccountManager { + ... + getBundleIdFromUid + ... +} +``` + +- Before change: + + ```ts + getBundleIdFromUid(uid: number, callback: AsyncCallback): void; + getBundleIdFromUid(uid: number): Promise; + ``` + +- After change: + + ```ts + getBundleIdForUid(uid: number, callback: AsyncCallback): void; + getBundleIdForUid(uid: number): Promise; + ``` + +## cl.account_os_account.11 OS Account API queryOsAccountConstraintSourceTypes Renamed + +Changed **queryOsAccountConstraintSourceTypes** to **getOsAccountConstraintSourceTypes**. + +**Change Impact** + +The **queryOsAccountConstraintSourceTypes** API cannot be used from 4.0.3.2. Use **getOsAccountConstraintSourceTypes** instead. + +**Key API/Component Changes** + +- Involved APIs: +``` +interface AccountManager { + ... + queryOsAccountConstraintSourceTypes + ... +} +``` + +- Before change: + + ```ts + queryOsAccountConstraintSourceTypes(localId: number, constraint: string, callback: AsyncCallback>): void; + queryOsAccountConstraintSourceTypes(localId: number, constraint: string): Promise>; + ``` + +- After change: + + ```ts + getOsAccountConstraintSourceTypes(localId: number, constraint: string, callback: AsyncCallback>): void; + getOsAccountConstraintSourceTypes(localId: number, constraint: string): Promise>; + ``` diff --git a/en/release-notes/changelogs/OpenHarmony_4.0.3.2/changelogs-power.md b/en/release-notes/changelogs/OpenHarmony_4.0.3.2/changelogs-power.md deleted file mode 100644 index c4506242ea6b189ec9a403e0b5ce85d2490f1b34..0000000000000000000000000000000000000000 --- a/en/release-notes/changelogs/OpenHarmony_4.0.3.2/changelogs-power.md +++ /dev/null @@ -1,82 +0,0 @@ -# Power Subsystem Changelog - -## cl.powermgr.1 CommonEventBatteryChangedCode API Change - -Changed the **CommonEventBatteryChangedCode** enum class in [@ohos.batteryInfo](../../../application-dev/reference/apis/js-apis-battery-info.md) as follows: - -- Changed the class name to **CommonEventBatteryChangedKey**. -- Deleted **EXTRA_MAX_CURRENT**, **EXTRA_MAX_VOLTAGE**, and **EXTRA_CHARGE_COUNTER**. -- Changed the enum value type from numeric to string. - -#### Change Impact - -The JS API needs to be adapted for applications developed based on earlier versions. Otherwise, relevant functions will be affected. - -#### Key API/Component Changes - -Before change: - -| Name | Value | Description | -| -------------------- | ---- | -------------------------------------------------- | -| EXTRA_SOC | 0 | Remaining battery level in percentage. | -| EXTRA_VOLTAGE | 1 | Battery voltage of the device. | -| EXTRA_TEMPERATURE | 2 | Battery temperature of the device. | -| EXTRA_HEALTH_STATE | 3 | Battery health status of the device. | -| EXTRA_PLUGGED_TYPE | 4 | Type of the charger connected to the device. | -| EXTRA_MAX_CURRENT | 5 | Maximum battery current of the device. | -| EXTRA_MAX_VOLTAGE | 6 | Maximum battery voltage of the device. | -| EXTRA_CHARGE_STATE | 7 | Battery charging status of the device. | -| EXTRA_CHARGE_COUNTER | 8 | Number of battery charging times of the device. | -| EXTRA_PRESENT | 9 | Whether the battery is supported by the device or installed.| -| EXTRA_TECHNOLOGY | 10 | Battery technology of the device. | -| EXTRA_CAPACITY_LEVEL | 11 | Battery level of the device. | - -After change: - -| Name | Value | Description | -| -------------------- | --------------- | -------------------------------------------------- | -| EXTRA_SOC | "soc" | Remaining battery level in percentage. | -| EXTRA_CHARGE_STATE | "chargeState" | Battery charging status of the device. | -| EXTRA_HEALTH_STATE | "healthState" | Battery health status of the device. | -| EXTRA_PLUGGED_TYPE | "pluggedType" | Type of the charger connected to the device. | -| EXTRA_VOLTAGE | "voltage" | Battery voltage of the device. | -| EXTRA_TECHNOLOGY | "technology" | Battery technology of the device. | -| EXTRA_TEMPERATURE | "temperature" | Battery temperature of the device. | -| EXTRA_PRESENT | "present" | Whether the battery is supported by the device or installed.| -| EXTRA_CAPACITY_LEVEL | "capacityLevel" | Battery level of the device. | - -#### Adaptation Guide - -For details, see the API reference of the [@ohos.batteryInfo](../../../application-dev/reference/apis/js-apis-battery-info.md) API. -## cl.powermgr.2 estimatedRemainingChargeTime API Change - -Changed the **estimatedRemainingChargeTime** API in [@ohos.batteryInfo](../../../application-dev/reference/apis/js-apis-battery-info.md) to a system API. - -#### Change Impact - -The JS API needs to be adapted for applications developed based on earlier versions. Otherwise, relevant functions will be affected. - -#### Adaptation Guide - -For details, see the API reference of the [@ohos.batteryInfo](../../../application-dev/reference/apis/js-apis-battery-info.md) API. - -## cl.powermgr.3 System Common Event Behavior Change - -The following common events are provided in the battery information through [@ohos.commonEventManager (common event module)](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-commonEventManager.md): - -- COMMON_EVENT_BATTERY_LOW: common event for low battery level. It includes the remaining battery in percentage. -- COMMON_EVENT_BATTERY_OKAY: common event for normal battery level. It includes the remaining battery in percentage. -- COMMON_EVENT_POWER_CONNECTED: common event for connection to an external power supply. It includes the type of the power supply to which the device is connected. -- COMMON_EVENT_POWER_DISCONNECTED: common event for disconnection from an external power supply. It includes the type of the power supply from which the device is disconnected. -- COMMON_EVENT_CHARGING: common event for starting of battery charging. It includes the battery charging status. -- COMMON_EVENT_DISCHARGING: common event for ending of battery charging. It includes the battery charging status. - -Changed the method of obtaining data from common events from **CommonEventData.data** to **CommonEventData.code**. - -#### Change Impact - -The application developed based on earlier versions needs to adapt the method for obtaining common events in the battery information. Otherwise, the original service logic will be affected. - -#### Adaptation Guide - -For details, see the API reference of the [@ohos.commonEventManager (Common Event Manager)](../../../application-dev/reference/apis/js-apis-commonEventManager.md) API. diff --git a/en/release-notes/changelogs/OpenHarmony_4.0.3.2/changelogs-startup.md b/en/release-notes/changelogs/OpenHarmony_4.0.3.2/changelogs-startup.md deleted file mode 100644 index 506d8dccccf8f89a173b036c1bff4750af34b59d..0000000000000000000000000000000000000000 --- a/en/release-notes/changelogs/OpenHarmony_4.0.3.2/changelogs-startup.md +++ /dev/null @@ -1,15 +0,0 @@ -# Startup Subsystem JS API Changelog - -## cl.startup.1 Bundle Name Change - -**Change Impact** - -The original bundle name **@ohos.systemParameterV9** will be deleted and cannot be used anymore. Use the new bundle name **@ohos.systemParameterEnhance** instead. - -**Adaptation Guide** - -Change the bundle name from **@ohos.systemParameterV9** to **@ohos.systemParameterEnhance**. The APIs remain unchanged. The following is the sample code: - -```js -import @ohos.systemParameterEnhance -``` diff --git a/en/website.md b/en/website.md index bd17df8df5285aa96e4f4b1a850febae03bd5931..590ed23efcf6855c109ed1003a6f9f40a38c5b14 100644 --- a/en/website.md +++ b/en/website.md @@ -4,6 +4,8 @@ - [Glossary](glossary.md) - Release Notes - OpenHarmony 3.x Releases + - [OpenHarmony v3.2 Beta5 (2023-01-31)](release-notes/OpenHarmony-v3.2-beta5.md) + - [OpenHarmony v3.2 Beta4 (2022-11-30)](release-notes/OpenHarmony-v3.2-beta4.md) - [OpenHarmony v3.2 Beta3 (2022-09-30)](release-notes/OpenHarmony-v3.2-beta3.md) - [OpenHarmony v3.2 Beta2 (2022-07-30)](release-notes/OpenHarmony-v3.2-beta2.md) - [OpenHarmony v3.2 Beta1 (2022-05-31)](release-notes/OpenHarmony-v3.2-beta1.md) @@ -18,13 +20,13 @@ - [OpenHarmony v3.0.3 LTS (2022-04-08)](release-notes/OpenHarmony-v3.0.3-LTS.md) - [OpenHarmony v3.0.2 LTS (2022-03-18)](release-notes/OpenHarmony-v3.0.2-LTS.md) - [OpenHarmony v3.0.1 LTS (2022-01-12)](release-notes/OpenHarmony-v3.0.1-LTS.md) - + - OpenHarmony 2.x Releases - [OpenHarmony v2.2 beta2 (2021-08-04)](release-notes/OpenHarmony-v2.2-beta2.md) - [OpenHarmony 2.0 Canary (2021-06-01)](release-notes/OpenHarmony-2-0-Canary.md) - OpenHarmony 1.x Releases - + - [OpenHarmony 1.0 (2020-09-10)](release-notes/OpenHarmony-1-0.md) - [OpenHarmony v1.1.5 LTS (2022-08-24)](release-notes/OpenHarmony-v1.1.5-LTS.md) - [OpenHarmony v1.1.4 LTS (2022-02-11)](release-notes/OpenHarmony-v1-1-4-LTS.md) @@ -32,7 +34,7 @@ - [OpenHarmony v1.1.2 LTS (2021-08-04)](release-notes/OpenHarmony-v1.1.2-LTS.md) - [OpenHarmony v1.1.1 LTS (2021-06-22)](release-notes/OpenHarmony-1-1-1-LTS.md) - [OpenHarmony v1.1.0 LTS (2021-04-01)](release-notes/OpenHarmony-1-1-0-LTS.md) - + - API Differences - OpenHarmony 3.2 Beta3 - JS API Differences @@ -64,7 +66,7 @@ - [Web subsystem](release-notes/api-diff/v3.2-beta3/js-apidiff-web.md) - [Window manager subsystem](release-notes/api-diff/v3.2-beta3/js-apidiff-window.md) - [Updates (OpenHarmony 3.2 Beta2 -> OpenHarmony 3.2 Beta3)](release-notes/changelogs/v3.2-beta3/changelog-v3.2-beta3.md) - - OpenHarmony 3.2 Beta2 + - OpenHarmony 3.2 Beta2 - JS API Differences - [Ability framework](release-notes/api-diff/v3.2-beta2/js-apidiff-ability.md) - [Accessibility subsystem](release-notes/api-diff/v3.2-beta2/js-apidiff-accessibility.md) @@ -96,7 +98,7 @@ - ChangeLog - [Updates (OpenHarmony 3.2 Beta1 -> OpenHarmony 3.2 Beta2)](release-notes/changelogs/v3.2-beta2/changelog-v3.2-beta2.md) - [Adaptation Guide for the Application Sandbox](release-notes/changelogs/v3.2-beta2/application-sandbox-adaptation-guide.md) - - OpenHarmony 3.2 Beta1 + - OpenHarmony 3.2 Beta1 - JS API Differences - [Ability framework](release-notes/api-diff/v3.2-beta1/js-apidiff-ability.md) - [ArkUI development framework](release-notes/api-diff/v3.2-beta1/js-apidiff-arkui.md) @@ -117,7 +119,7 @@ - [Web subsystem](release-notes/api-diff/v3.2-beta1/js-apidiff-web.md) - [Window manager subsystem](release-notes/api-diff/v3.2-beta1/js-apidiff-window.md) - [Native API Differences](release-notes/api-diff/v3.2-beta1/native-apidiff-v3.2-beta.md) - - OpenHarmony 3.1 Release + - OpenHarmony 3.1 Release - JS API Differences (API Version 8) - [Ability framework](release-notes/api-diff/v3.1-Release/js-apidiff-ability.md) - [Accessibility subsystem](release-notes/api-diff/v3.1-Release/js-apidiff-accessibility.md) @@ -150,16 +152,16 @@ - [Window manager subsystem](release-notes/api-diff/v3.1-Release/js-apidiff-window.md) - [Native API Differences](release-notes/api-diff/v3.1-Release/native-apidiff-v3.1-release.md) - [Updates (OpenHarmony 3.1 Beta -> OpenHarmony 3.1 Release)](release-notes/changelogs/v3.1-Release/changelog-v3.1-release.md) - - OpenHarmony 3.1 Beta + - OpenHarmony 3.1 Beta - [JS API Differences](release-notes/api-diff/v3.1-beta/js-apidiff-v3.1-beta.md) - [Native API Differences](release-notes/api-diff/v3.1-beta/native-apidiff-v3.1-beta.md) - [Updates (OpenHarmony 3.0 -> OpenHarmony 3.1 Beta)](release-notes/api-diff/v3.1-beta/changelog-v3.1-beta.md) - - OpenHarmony 3.0 LTS + - OpenHarmony 3.0 LTS - [JS API Differences](release-notes/api-diff/v3.0-LTS/js-apidiff-v3.0-lts.md) - - OpenHarmony v2.2 Beta2 + - OpenHarmony v2.2 Beta2 - [JS API Differences](release-notes/api-diff/v2.2-beta2/js-apidiff-v2.2-beta2.md) - [Native API Differences](release-notes/api-diff/v2.2-beta2/native-apidiff-v2.2-beta2.md) - + - OpenHarmony Third-Party Components - [OpenHarmony Third-Party Components](third-party-components/third-party-components-introduction.md) - [Using OpenHarmony JS and TS Third-Party Components](third-party-components/npm-third-party-guide.md) diff --git a/zh-cn/application-dev/ability-deprecated/context-userguide.md b/zh-cn/application-dev/ability-deprecated/context-userguide.md index 4b0cf6267e87890beef84d37288d950c56386641..638560d71c397e84057a5130763ec315924fc669 100644 --- a/zh-cn/application-dev/ability-deprecated/context-userguide.md +++ b/zh-cn/application-dev/ability-deprecated/context-userguide.md @@ -249,9 +249,9 @@ Stage模型下,在Ability的`onWindowStageCreate`生命周期中,可以通 在ArkTS页面中通过以下全局方法获取当前页面关联的Context。 -| 接口名 | 描述 | -| :------------------------------------ | :--------------------------- | -| getContext(component: Object): Object | 获取页面中component所关联的Context对象。 | +| 接口名 | 描述 | +| :------------------------------------ | :----------------------------------------------------------- | +| getContext(component: Object): Object | 获取页面中component所关联的Context对象。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | **示例** diff --git a/zh-cn/application-dev/application-dev-guide-for-gitee.md b/zh-cn/application-dev/application-dev-guide-for-gitee.md index b56ef359b4067e574ef3cdbfe1e22357ae3e5bfa..a5a9a29a07e19dcac9157a9f88b195015f51a8ab 100644 --- a/zh-cn/application-dev/application-dev-guide-for-gitee.md +++ b/zh-cn/application-dev/application-dev-guide-for-gitee.md @@ -40,6 +40,8 @@ - [应用测试](application-test/Readme-CN.md) - [IDL工具规格及使用说明书](IDL/idl-guidelines.md) - [Native API的相关指导](napi/Readme-CN.md) +- [文件管理](file-management/medialibrary-overview.md) +- [一次开发,多端部署](key-features/multi-device-app-dev/foreword.md) ### 工具 diff --git a/zh-cn/application-dev/application-dev-guide.md b/zh-cn/application-dev/application-dev-guide.md index 240e74971cc6483ccff690038996e3175592f7a5..5bc20fe79f5a81cb35dabdfb805488f46ad9b2d8 100644 --- a/zh-cn/application-dev/application-dev-guide.md +++ b/zh-cn/application-dev/application-dev-guide.md @@ -40,6 +40,8 @@ - [应用测试](application-test/arkxtest-guidelines.md) - [IDL工具规格及使用说明书](IDL/idl-guidelines.md) - [Native API的相关指导](napi/napi-guidelines.md) +- [文件管理](file-management/medialibrary-overview.md) +- [一次开发,多端部署](key-features/multi-device-app-dev/foreword.md) ### 工具 diff --git a/zh-cn/application-dev/application-models/Readme-CN.md b/zh-cn/application-dev/application-models/Readme-CN.md index cb1157712636e8a7becac946830fdf673b2a62d3..d8a9c2dee97c04930ca01acb19bc5c0035246097 100644 --- a/zh-cn/application-dev/application-models/Readme-CN.md +++ b/zh-cn/application-dev/application-models/Readme-CN.md @@ -20,6 +20,7 @@ - [DataShareExtensionAbility(仅对系统应用开放)](datashareextensionability.md) - [FormExtensionAbility(服务卡片)](widget-development-stage.md) - [AccessibilityExtensionAbility](accessibilityextensionability.md) + - [EnterpriseAdminExtensionAbility](enterprise-extensionAbility.md) - [InputMethodExtensionAbility](inputmethodextentionability.md) - [WindowExtensionAbility](windowextensionability.md) - [AbilityStage组件容器](abilitystage.md) diff --git a/zh-cn/application-dev/application-models/enterprise-extensionAbility.md b/zh-cn/application-dev/application-models/enterprise-extensionAbility.md new file mode 100644 index 0000000000000000000000000000000000000000..e61b6d3c18f33fe766f897fef05f40fd39e7df82 --- /dev/null +++ b/zh-cn/application-dev/application-models/enterprise-extensionAbility.md @@ -0,0 +1,116 @@ +# EnterpriseAdminExtensionAbility开发指南 + +## EnterpriseAdminExtensionAbility简介 + +企业设备管理扩展能力,是MDM(Mobile Device Management)应用必备组件。当开发者为企业开发MDM应用时,需继承EnterpriseAdminExtensionAbility,在EnterpriseAdminExtensionAbility实例中实现MDM业务逻辑,EnterpriseAdminExtensionAbility实现了系统管理状态变化通知功能,并定义了管理应用激活、去激活、应用安装、卸载事件等回调接口。 + +## 约束与限制 + + 仅支持设备管理员应用使用。(功能限制) + + +## 场景:监听设备管理器激活、去激活、应用安装、卸载事件 + +### 概述 + +onAdminEnabled:由企业管理员或者员工部署MDM应用,激活设备管理器,系统通知MDM应用已激活DeviceAdmin权限。MDM应用可在onAdminEnabled回调函数中进行初始化策略设置。 + +onAdminDisabled:由系统或者员工去激活设备管理器,通知去激活DeviceAdmin权限,应用可以通知企业管理员设备已脱管。 + +onBundleAdded: 企业应用管理场景下,企业管理员订阅应用安装卸载事件,端侧应用安装和卸载事件通知MDM应用,MDM应用可以在回调函数中进行事件上报,通知企业管理员。 + +onBundleRemoved: 企业应用管理场景下,企业管理员取消订阅应用安装卸载事件。 + +### 接口说明 + +| 类名 | 接口名称 | 描述 | +| :------------------------------ | ----------------------------------------- | ---------------------------- | +| EnterpriseAdminExtensionAbility | onAdminDisabled(): void | 设备管理器应用去激活回调方法 | +| EnterpriseAdminExtensionAbility | onBundleAdded(bundleName: string): void | 应用安装回调方法 | +| EnterpriseAdminExtensionAbility | onAdminEnabled(): void | 设备管理器应用激活回调方法 | +| EnterpriseAdminExtensionAbility | onBundleRemoved(bundleName: string): void | 应用卸载回调方法 | + +### 开发步骤 + +开发者在实现EnterpriseAdminExtensionAbility的时候,需先激活设备管理员应用,并在设备管理员应用的代码目录下新建ExtensionAbility,具体步骤如下。 + +1. 在工程Module对应的ets目录下,右键选择“New > Directory”,新建一个目录并命名为EnterpriseExtAbility。 +2. 在EnterpriseExtAbility目录,右键选择“New > TypeScript File”,新建一个TypeScript文件并命名为EnterpriseExtAbility.ts。 +3. 打开EnterpriseExtAbility.ts文件,导入EnterpriseAdminExtensionAbility模块,自定义类继承EnterpriseAdminExtensionAbility并加上需要的应用通知回调方法,如onAdminEnabled()、onAdminDisabled()等回调方法。当设备管理员应用被激活或者去激活时,则可以在对应回调方法中接受系统发送通知。 + +```ts +import EnterpriseAdminExtensionAbility from '@ohos.enterprise.EnterpriseAdminExtensionAbility'; + +export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbility { + + onAdminEnabled() { + console.info("onAdminEnabled"); + } + + onAdminDisabled() { + console.info("onAdminDisabled"); + } + + onBundleAdded(bundleName: string) { + console.info("EnterpriseAdminAbility onBundleAdded bundleName:" + bundleName) + } + + onBundleRemoved(bundleName: string) { + console.info("EnterpriseAdminAbility onBundleRemoved bundleName" + bundleName) + } +}; +``` + +​ 4.在工程Module对应的[module.json5](../quick-start/module-configuration-file.md)配置文件中注册ServiceExtensionAbility,type标签需要设置为“enterpriseAdmin”,srcEntrance标签表示当前ExtensionAbility组件所对应的代码路径。 + +```ts +"extensionAbilities": [ + { + "name": "ohos.samples.enterprise_admin_ext_ability", + "type": "enterpriseAdmin", + "visible": true, + "srcEntrance": "./ets/enterpriseextability/EnterpriseAdminAbility.ts" + } + ] +``` + +## 使用示例 + +通过@ohos.enterprise.adminManager模块中的subscribeManagedEvent接口和unsubscribeManagedEvent接口进行企业设备管理事件的订阅,订阅应用安装、卸载事件。当订阅成功后,端侧应用安装和卸载事件通知MDM应用,MDM应用可以在回调函数中进行事件上报,通知企业管理员。 + +```ts + @State managedEvents: Array = [0,1] + @State subscribeManagedEventMsg: string = "" + @State unsubscribeManagedEventMsg: string = "" + + async subscribeManagedEventCallback() { + await adminManager.subscribeManagedEvent(this.admin, + [adminManager.ManagedEvent.MANAGED_EVENT_BUNDLE_ADDED, + adminManager.ManagedEvent.MANAGED_EVENT_BUNDLE_REMOVED], (error) => { + if (error) { + this.subscribeManagedEventMsg = 'subscribeManagedEvent Callback::errorCode: ' + error.code + ' errorMessage: ' + error.message + } else { + this.subscribeManagedEventMsg = 'subscribeManagedEvent Callback::success' + } + }) + } + + async unsubscribeManagedEventPromise() { + await adminManager.unsubscribeManagedEvent(this.admin, + [adminManager.ManagedEvent.MANAGED_EVENT_BUNDLE_ADDED, + adminManager.ManagedEvent.MANAGED_EVENT_BUNDLE_REMOVED]).then(() => { + this.unsubscribeManagedEventMsg = 'unsubscribeManagedEvent Promise::success' + }).catch((error) => { + this.unsubscribeManagedEventMsg = 'unsubscribeManagedEvent Promise::errorCode: ' + error.code + ' errorMessage: ' + error.message + }) + } +``` + + + +## 相关实例 + +针对EnterpriseAdminExtensionAbility开发,有以下相关示例可供参考: + +[EnterpriseAdminExtensionAbility:EnterpriseAdminExtensionAbility的创建与使用(ArkTS) (API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/customization/EnterpriseAdminExtensionAbility) + diff --git a/zh-cn/application-dev/application-models/extensionability-overview.md b/zh-cn/application-dev/application-models/extensionability-overview.md index 4fd8d44846a70422d89c0c7d062e05a4c5c494cc..cc7fd89d333fdd61fe40ff604a1215bc8dc1cb6d 100644 --- a/zh-cn/application-dev/application-models/extensionability-overview.md +++ b/zh-cn/application-dev/application-models/extensionability-overview.md @@ -9,7 +9,7 @@ ExtensionAbility组件是基于特定场景(例如服务卡片、输入法等 - [FormExtensionAbility](../reference/apis/js-apis-app-form-formExtensionAbility.md):FORM类型的ExtensionAbility组件,用于提供服务卡片场景相关能力。 -- [WorkSchedulerExtensionAbility](../reference/apis/js-apis-resourceschedule-workScheduler.md):WORK_SCHEDULER类型的ExtensionAbility组件,用于提供延迟任务注册、取消、查询的能力。 +- [WorkSchedulerExtensionAbility](../reference/apis/js-apis-WorkSchedulerExtensionAbility.md):WORK_SCHEDULER类型的ExtensionAbility组件,用于提供延迟任务注册、取消、查询的能力。 - [InputMethodExtensionAbility](../reference/apis/js-apis-inputmethod.md):INPUT_METHOD类型的ExtensionAbility组件,提供对输入法框架的管理,包括隐藏输入法、查询已安装的输入法列表和显示输入法选择对话框。 diff --git a/zh-cn/application-dev/connectivity/http-request.md b/zh-cn/application-dev/connectivity/http-request.md index 0c427cbb9e5bc3661f5f7957114aacc384aab32e..1c434797314fbccb751476ad6e9e3a58a252862d 100644 --- a/zh-cn/application-dev/connectivity/http-request.md +++ b/zh-cn/application-dev/connectivity/http-request.md @@ -18,32 +18,41 @@ HTTP数据请求功能主要由http模块提供。 | ----------------------------------------- | ----------------------------------- | | createHttp() | 创建一个http请求。 | | request() | 根据URL地址,发起HTTP网络请求。 | +| request2()10+ | 根据URL地址,发起HTTP网络请求并返回流式响应| | destroy() | 中断请求任务。 | | on(type: 'headersReceive') | 订阅HTTP Response Header 事件。 | | off(type: 'headersReceive') | 取消订阅HTTP Response Header 事件。 | +| once\('headersReceive'\)8+ | 订阅HTTP Response Header 事件,但是只触发一次。| +| on\('dataReceive'\)10+ | 订阅HTTP流式响应数据接收事件。 | +| off\('dataReceive'\)10+ | 取消订阅HTTP流式响应数据接收事件。 | +| on\('dataEnd'\)10+ | 订阅HTTP流式响应数据接收完毕事件。 | +| off\('dataEnd'\)10+ | 取消订阅HTTP流式响应数据接收完毕事件。 | +| on\('dataProgress'\)10+ | 订阅HTTP流式响应数据接收进度事件。 | +| off\('dataProgress'\)10+ | 取消订阅HTTP流式响应数据接收进度事件。 | -## 开发步骤 +## request接口开发步骤 -1. import需要的http模块。 -2. 创建一个HTTP请求,返回一个HttpRequest对象。 -3. (可选)订阅HTTP响应头。 -4. 根据URL地址,发起HTTP网络请求。 -5. (可选)处理HTTP响应头和HTTP网络请求的返回结果。 +1. 从@ohos.net.http.d.ts中导入http命名空间。 +2. 调用createHttp()方法,创建一个HttpRequest对象。 +3. 调用该对象的on()方法,订阅http响应头事件,此接口会比request请求先返回。可以根据业务需要订阅此消息。 +4. 调用该对象的request()方法,传入http请求的url地址和可选参数,发起网络请求。 +5. 按照实际业务需要,解析返回结果。 +6. 调用该对象的off()方法,取消订阅http响应头事件。 +7. 当该请求使用完毕时,调用destroy()方法主动销毁。 ```js +// 引入包名 import http from '@ohos.net.http'; -// 每一个httpRequest对应一个http请求任务,不可复用 +// 每一个httpRequest对应一个HTTP请求任务,不可复用 let httpRequest = http.createHttp(); - -// 用于订阅http响应头,此接口会比request请求先返回。可以根据业务需要订阅此消息 +// 用于订阅HTTP响应头,此接口会比request请求先返回。可以根据业务需要订阅此消息 // 从API 8开始,使用on('headersReceive', Callback)替代on('headerReceive', AsyncCallback)。 8+ httpRequest.on('headersReceive', (header) => { console.info('header: ' + JSON.stringify(header)); }); - httpRequest.request( - // 填写http请求的url地址,可以带参数也可以不带参数。URL地址需要开发者自定义。请求的参数可以在extraData中指定 + // 填写HTTP请求的URL地址,可以带参数也可以不带参数。URL地址需要开发者自定义。请求的参数可以在extraData中指定 "EXAMPLE_URL", { method: http.RequestMethod.POST, // 可选,默认为http.RequestMethod.GET @@ -55,26 +64,115 @@ httpRequest.request( extraData: { "data": "data to send", }, - connectTimeout: 60000, // 可选,默认为60s - readTimeout: 60000, // 可选,默认为60s + expectDataType: http.HttpDataType.STRING, // 可选,指定返回数据的类型 + usingCache: true, // 可选,默认为true + priority: 1, // 可选,默认为1 + connectTimeout: 60000, // 可选,默认为60000ms + readTimeout: 60000, // 可选,默认为60000ms + usingProtocol: http.HttpProtocol.HTTP1_1, // 可选,协议类型默认值由系统自动指定 + usingProxy: false, //可选,默认不使用网络代理,自API 10开始支持该属性 }, (err, data) => { if (!err) { - // data.result为http响应内容,可根据业务需要进行解析 - console.info('Result:' + data.result); - console.info('code:' + data.responseCode); - // data.header为http响应头,可根据业务需要进行解析 + // data.result为HTTP响应内容,可根据业务需要进行解析 + console.info('Result:' + JSON.stringify(data.result)); + console.info('code:' + JSON.stringify(data.responseCode)); + // data.header为HTTP响应头,可根据业务需要进行解析 console.info('header:' + JSON.stringify(data.header)); - console.info('cookies:' + data.cookies); // 8+ + console.info('cookies:' + JSON.stringify(data.cookies)); // 8+ } else { console.info('error:' + JSON.stringify(err)); - // 该请求不再使用,调用destroy方法主动销毁。 + // 取消订阅HTTP响应头事件 + httpRequest.off('headersReceive'); + // 当该请求使用完毕时,调用destroy方法主动销毁 httpRequest.destroy(); } } ); ``` +## request2接口开发步骤 + +1. 从@ohos.net.http.d.ts中导入http命名空间。 +2. 调用createHttp()方法,创建一个HttpRequest2对象。 +3. 调用该对象的on()方法,订阅HTTP流式响应相关事件,此接口会比request请求先返回。可以根据业务需要订阅此消息。 +4. 调用该对象的request2()方法,传入http请求的url地址和可选参数,发起网络请求。 +5. 调用该对象的off()方法,取消订阅http响应头事件。 +6. 当该请求使用完毕时,调用destroy()方法主动销毁。 + +```js +// 引入包名 +import http from '@ohos.net.http'; + +// 每一个httpRequest对应一个HTTP请求任务,不可复用 +let httpRequest2 = http.createHttp(); + +// 订阅HTTP流式响应数据接收事件的回调函数 +function dataReceive_on_callback(data) { + console.info("request2_dataReceive callback function receive len: " + JSON.stringify(data.byteLength)); +} +// 订阅HTTP流式响应数据接收进度事件的回调函数 +function dataEnd_on_callback() { + console.info(`request2_dataEnd callback function`); +} +// 订阅HTTP流式响应数据接收完毕事件的回调函数 +function dataProgress_on_callback(data) { + console.info("request2_dataProgress callback function receive dataProgress: " + JSON.stringify(data)); +} + +try { + // 用于订阅HTTP响应头,此接口会比request2请求先返回。可以根据业务需要订阅此消息 + // 从API 10开始,支持订阅HTTP流式响应相关事件 + + // 订阅HTTP流式响应数据接收事件 + httpRequest2.on("dataReceive", dataReceive_on_callback); + // 订阅HTTP流式响应数据接收进度事件 + httpRequest2.on("dataProgress", dataProgress_on_callback); + // 订阅HTTP流式响应数据接收完毕事件 + httpRequest2.on("dataEnd", dataEnd_on_callback); + + httpRequest2.request2( + // 填写HTTP请求的URL地址,可以带参数也可以不带参数。URL地址需要开发者自定义。请求的参数可以在extraData中指定 + "EXAMPLE_URL", + { + method: http.RequestMethod.POST, // 可选,默认为http.RequestMethod.GET + // 开发者根据自身业务需要添加header字段 + header: { + 'Content-Type': 'application/json' + }, + // 当使用POST请求时此字段用于传递内容 + extraData: { + "data": "data to send", + }, + expectDataType: http.HttpDataType.STRING, // 可选,指定返回数据的类型 + usingCache: true, // 可选,默认为true + priority: 1, // 可选,默认为1 + connectTimeout: 60000, // 可选,默认为60000ms + readTimeout: 60000, // 可选,默认为60000ms + usingProtocol: http.HttpProtocol.HTTP1_1, // 可选,协议类型默认值由系统自动指定 + usingProxy: false, //可选,默认不使用网络代理,自API 10开始支持该属性 + }).then(function () { + console.info("request2 OK!"); + // 订阅HTTP流式响应数据接收事件 + httpRequest2.off("dataReceive"); + console.info("off dataReceive success!"); + // 订阅HTTP流式响应数据接收进度事件 + httpRequest2.off("dataProgress"); + console.info("off dataProgress success!"); + // 订阅HTTP流式响应数据接收完毕事件 + httpRequest2.off("dataEnd"); + console.info("off dataEnd success!"); + // 当该请求使用完毕时,调用destroy方法主动销毁 + httpRequest2.destroy(); + }).catch(function (err) { + console.info("request2 ERROR : " + JSON.stringify(err)); + }); +} catch (error) { + console.info("request2 ERROR : " + JSON.stringify(error)); +} + +``` + ## 相关实例 针对HTTP数据请求,有以下相关实例可供参考: -- [`Http:`数据请求(ArkTS)(API9))](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/Network/Http) +- [`Http:`数据请求(ArkTS)(API9))](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Connectivity/Http) - [使用HTTP实现与服务端通信(ArkTS)(API9)](https://gitee.com/openharmony/codelabs/tree/master/NetworkManagement/SmartChatEtsOH) \ No newline at end of file diff --git a/zh-cn/application-dev/database/database-distributedobject-guidelines.md b/zh-cn/application-dev/database/database-distributedobject-guidelines.md index 8a8d499bb5cda3b850eb72023fc784f2b485f090..ebce36fce4e9e5f14ae0c128503e0fc9e1ff5eac 100644 --- a/zh-cn/application-dev/database/database-distributedobject-guidelines.md +++ b/zh-cn/application-dev/database/database-distributedobject-guidelines.md @@ -142,7 +142,7 @@ function grantPermission() { let permissions = ['ohos.permission.DISTRIBUTED_DATASYNC']; context.requestPermissionsFromUser(permissions).then((data) => { - console.log('success: ${data}'); + console.info('success: ${data}'); }).catch((error) => { console.error('failed: ${error}'); }); diff --git a/zh-cn/application-dev/database/database-mdds-guidelines.md b/zh-cn/application-dev/database/database-mdds-guidelines.md index e6102655da0efa40f76a787b24643410f337d073..8d2b6165f1f477fe3abf09396721d3f599a0de68 100644 --- a/zh-cn/application-dev/database/database-mdds-guidelines.md +++ b/zh-cn/application-dev/database/database-mdds-guidelines.md @@ -13,7 +13,7 @@ | 接口名称 | 描述 | | ------------------------------------------------------------ | ------------------------------------------------------------ | -| createKVManager(config: KVManagerConfig, callback: AsyncCallback<KVManager>): void
createKVManager(config: KVManagerConfig): Promise<KVManager> | 创建一个`KVManager`对象实例,用于管理数据库对象。 | +| createKVManager(config: KVManagerConfig): KVManager | 创建一个`KVManager`对象实例,用于管理数据库对象。 | | getKVStore<T extends KVStore>(storeId: string, options: Options, callback: AsyncCallback<T>): void
getKVStore<T extends KVStore>(storeId: string, options: Options): Promise<T> | 指定`Options`和`storeId`,创建并获取指定类型`KVStore`数据库。 | | put(key: string, value: Uint8Array\|string\|number\|boolean, callback: AsyncCallback<void>): void
put(key: string, value: Uint8Array\|string\|number\|boolean): Promise<void> | 插入和更新数据。 | | delete(key: string, callback: AsyncCallback<void>): void
delete(key: string): Promise<void> | 删除数据。 | @@ -117,16 +117,10 @@ bundleName: 'com.example.datamanagertest', context:context, } - distributedKVStore.createKVManager(kvManagerConfig, function (err, manager) { - if (err) { - console.error(`Failed to createKVManager.code is ${err.code},message is ${err.message}`); - return; - } - console.log('Succeeded in creating KVManager'); - kvManager = manager; - }); + kvManager = distributedKVStore.createKVManager(kvManagerConfig); + console.log("Succeeded in creating KVManager"); } catch (e) { - console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); + console.error(`Failed to create KVManager.code is ${e.code},message is ${e.message}`); } ``` diff --git a/zh-cn/application-dev/database/database-preference-guidelines.md b/zh-cn/application-dev/database/database-preference-guidelines.md index e2fdd2e055e4b8cd6340f6c67f4863be99b85bab..2ce239c7d37247f28afd1fc979cbd1583c1be6f9 100644 --- a/zh-cn/application-dev/database/database-preference-guidelines.md +++ b/zh-cn/application-dev/database/database-preference-guidelines.md @@ -113,22 +113,20 @@ ```ts // 获取context - import UIAbility from '@ohos.app.ability.UIAbility' - let context = null; + import UIAbility from '@ohos.app.ability.UIAbility'; let preferences = null; export default class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage){ - context = this.context; + onWindowStageCreate(windowStage) { + let promise = data_preferences.getPreferences(this.context, 'mystore'); + promise.then((pref) => { + preferences = pref; + }).catch((err) => { + console.info("Failed to get preferences."); + }) } } - let promise = data_preferences.getPreferences(context, 'mystore'); - promise.then((pref) => { - preferences = pref; - }).catch((err) => { - console.info("Failed to get preferences."); - }) ``` 3. 存入数据。 diff --git a/zh-cn/application-dev/device/pointerstyle-guidelines.md b/zh-cn/application-dev/device/pointerstyle-guidelines.md index cc5f3fd52ed14efacfad961345635e7588f9f8ac..f8c36332f0f473cb2f8248683866fa0270ef2826 100644 --- a/zh-cn/application-dev/device/pointerstyle-guidelines.md +++ b/zh-cn/application-dev/device/pointerstyle-guidelines.md @@ -77,43 +77,48 @@ try { 5. 设置鼠标光标样式为默认样式。 ```js +import pointer from '@ohos.multimodalInput.pointer'; import window from '@ohos.window'; // 1.开发者使能取色功能 // 2.调用窗口实例获取对应的窗口id -window.getTopWindow((error, windowClass) => { - windowClass.getProperties((error, data) => { - var windowId = data.id; - if (windowId < 0) { - console.log(`Invalid windowId`); - return; - } - try { - // 3.设置鼠标光标样式为取色器样式 - pointer.setPointerStyle(windowId, pointer.PointerStyle.COLOR_SUCKER).then(() => { - console.log(`Successfully set mouse pointer style`); - }); - } catch (error) { - console.log(`Failed to set the pointer style, error=${JSON.stringify(error)}, msg=${JSON.stringify(message)}`); - } - }); +window.getLastWindow(this.context, (error, windowClass) => { + if (error.code) { + console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(error)); + return; + } + var windowId = windowClass.getWindowProperties().id; + if (windowId < 0) { + console.log(`Invalid windowId`); + return; + } + try { + // 3.设置鼠标光标样式为取色器样式 + pointer.setPointerStyle(windowId, pointer.PointerStyle.COLOR_SUCKER).then(() => { + console.log(`Successfully set mouse pointer style`); + }); + } catch (error) { + console.log(`Failed to set the pointer style, error=${JSON.stringify(error)}, msg=${JSON.stringify(`message`)}`); + } }); // 4.取色结束 -window.getTopWindow((error, windowClass) => { - windowClass.getProperties((error, data) => { - var windowId = data.id; - if (windowId < 0) { - console.log(`Invalid windowId`); - return; - } - try { - // 5.设置鼠标光标样式为默认样式 - pointer.setPointerStyle(windowId, pointer.PointerStyle.DEFAULT).then(() => { - console.log(`Successfully set mouse pointer style`); - }); - } catch (error) { - console.log(`Failed to set the pointer style, error=${JSON.stringify(error)}, msg=${JSON.stringify(message)}`); - } - }); +window.getLastWindow(this.context, (error, windowClass) => { + if (error.code) { + console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(error)); + return; + } + var windowId = windowClass.getWindowProperties().id; + if (windowId < 0) { + console.log(`Invalid windowId`); + return; + } + try { + // 5.设置鼠标光标样式为默认样式 + pointer.setPointerStyle(windowId, pointer.PointerStyle.DEFAULT).then(() => { + console.log(`Successfully set mouse pointer style`); + }); + } catch (error) { + console.log(`Failed to set the pointer style, error=${JSON.stringify(error)}, msg=${JSON.stringify(`message`)}`); + } }); ``` diff --git a/zh-cn/application-dev/file-management/medialibrary-filepath-guidelines.md b/zh-cn/application-dev/file-management/medialibrary-filepath-guidelines.md index 9c6475e65ea02b0e62a3eb4578c1a81921eab6d6..74a844f946099633f0389ea383d135a48dbfa328 100644 --- a/zh-cn/application-dev/file-management/medialibrary-filepath-guidelines.md +++ b/zh-cn/application-dev/file-management/medialibrary-filepath-guidelines.md @@ -135,7 +135,7 @@ async function copySandbox2Public() { console.error('file asset get failed, message = ' + err); } let fdPub = await fileAsset.open('rw'); - let fdSand = await fs.open(sandboxDirPath + 'testFile.txt', OpenMode.READ_WRITE); + let fdSand = await fs.open(sandboxDirPath + 'testFile.txt', fs.OpenMode.READ_WRITE); await fs.copyFile(fdSand.fd, fdPub); await fileAsset.close(fdPub); await fs.close(fdSand.fd); @@ -173,7 +173,7 @@ async function example() { const context = getContext(this); let media = mediaLibrary.getMediaLibrary(context); const path = await media.getPublicDirectory(DIR_DOCUMENTS); - media.createAsset(mediaType, "testFile.text", path).then((asset) => { + media.createAsset(mediaType, "testFile.txt", path).then((asset) => { console.info("createAsset successfully:" + JSON.stringify(asset)); }).catch((err) => { console.error("createAsset failed with error: " + err); diff --git a/zh-cn/application-dev/file-management/medialibrary-resource-guidelines.md b/zh-cn/application-dev/file-management/medialibrary-resource-guidelines.md index f7ff385787524cb3209c2cc3b54bc427f84ca8b2..3d87b249e9d8b785b833f8cbd6f471f97f85b152 100644 --- a/zh-cn/application-dev/file-management/medialibrary-resource-guidelines.md +++ b/zh-cn/application-dev/file-management/medialibrary-resource-guidelines.md @@ -42,14 +42,11 @@ async function example() { const context = getContext(this); let media = mediaLibrary.getMediaLibrary(context); const fetchFileResult = await media.getFileAssets(option); - fetchFileResult.getFirstObject().then((fileAsset) => { + fetchFileResult.getFirstObject().then(async (fileAsset) => { console.log('getFirstObject.displayName : ' + fileAsset.displayName); for (let i = 1; i < fetchFileResult.getCount(); i++) { - fetchFileResult.getNextObject().then((fileAsset) => { - console.info('fileAsset.displayName ' + i + ': ' + fileAsset.displayName); - }).catch((err) => { - console.error('Failed to get next object: ' + err); - }); + let fileAsset = await fetchFileResult.getNextObject(); + console.info('fileAsset.displayName ' + i + ': ' + fileAsset.displayName); } }).catch((err) => { console.error('Failed to get first object: ' + err); @@ -75,14 +72,11 @@ async function example() { const context = getContext(this); let media = mediaLibrary.getMediaLibrary(context); const fetchFileResult = await media.getFileAssets(option); - fetchFileResult.getFirstObject().then((fileAsset) => { + fetchFileResult.getFirstObject().then(async (fileAsset) => { console.info('getFirstObject.displayName : ' + fileAsset.displayName); for (let i = 1; i < fetchFileResult.getCount(); i++) { - fetchFileResult.getNextObject().then((fileAsset) => { - console.info('fileAsset.displayName ' + i + ': ' + fileAsset.displayName); - }).catch((err) => { - console.error('Failed to get next object: ' + err); - }); + let fileAsset = await fetchFileResult.getNextObject(); + console.info('fileAsset.displayName ' + i + ': ' + fileAsset.displayName); } }).catch((err) => { console.error('Failed to get first object: ' + err); @@ -92,7 +86,7 @@ async function example() { ### 按指定顺序排列 -下面以查询图片并按文件添加日期降序排列为例。实际开发中可以设置升序(AESC)和降序(DESC)。 +下面以查询图片并按文件添加日期降序排列为例。实际开发中可以设置升序(ASC)和降序(DESC)。 order: FileKey.DATE_ADDED,根据文件添加日期排序;并设置排列顺序为DESC降序。 @@ -108,14 +102,11 @@ async function example() { const context = getContext(this); let media = mediaLibrary.getMediaLibrary(context); const fetchFileResult = await media.getFileAssets(option); - fetchFileResult.getFirstObject().then((fileAsset) => { + fetchFileResult.getFirstObject().then(async (fileAsset) => { console.info('getFirstObject.displayName : ' + fileAsset.displayName); for (let i = 1; i < fetchFileResult.getCount(); i++) { - fetchFileResult.getNextObject().then((fileAsset) => { - console.info('fileAsset.displayName ' + i + ': ' + fileAsset.displayName); - }).catch((err) => { - console.error('Failed to get next object: ' + err); - }); + let fileAsset = await fetchFileResult.getNextObject(); + console.info('fileAsset.displayName ' + i + ': ' + fileAsset.displayName); } }).catch((err) => { console.error('Failed to get first object: ' + err); diff --git a/zh-cn/application-dev/key-features/multi-device-app-dev/responsive-layout.md b/zh-cn/application-dev/key-features/multi-device-app-dev/responsive-layout.md index d823ccbc1ea37a17e0b42b3f6368ad0484c9db47..cc4fd0d13fd0a7177018194c994dd376b50d2272 100644 --- a/zh-cn/application-dev/key-features/multi-device-app-dev/responsive-layout.md +++ b/zh-cn/application-dev/key-features/multi-device-app-dev/responsive-layout.md @@ -316,7 +316,7 @@ struct GridRowSample1 { @State private currentBreakpoint: string = 'unknown' build() { // 修改断点的取值范围同时启用更多断点,注意,修改的断点值后面必须加上vp单位。 - GridRow(breakpoints: {value: ['600vp', '700vp', '800vp', '900vp', '1000vp'], + GridRow({breakpoints: {value: ['600vp', '700vp', '800vp', '900vp', '1000vp'], reference: BreakpointsReference.WindowSize}}) { GridCol({span:{xs: 12, sm: 12, md: 12, lg:12, xl: 12, xxl:12}}) { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { @@ -596,7 +596,7 @@ struct GridRowSample6 { **示例7:** -通过order属性,控制GridCol的顺序。在sm和md断点下,按照至6的顺序排列显示;在lg断点下,按照6至1的顺序排列显示。 +通过order属性,控制GridCol的顺序。在sm和md断点下,按照1至6的顺序排列显示;在lg断点下,按照6至1的顺序排列显示。 | sm | md | lg | diff --git a/zh-cn/application-dev/media/audio-capturer.md b/zh-cn/application-dev/media/audio-capturer.md index 74e09bf19f2d5e75acab07a2132bdf11a87556a6..451362be0bc16f24039f8aabea0c1bc7e12eb15f 100644 --- a/zh-cn/application-dev/media/audio-capturer.md +++ b/zh-cn/application-dev/media/audio-capturer.md @@ -21,38 +21,48 @@ AudioCapturer提供了用于获取原始音频文件的方法。开发者可以 ## 约束与限制 -开发者在进行音频数据采集功能开发前,需要先对所开发的应用配置麦克风权限(ohos.permission.MICROPHONE),权限配置相关内容可参考:[访问控制授权申请指导](../security/accesstoken-guidelines.md) +开发者在进行音频数据采集功能开发前,需要先对所开发的应用配置麦克风权限(ohos.permission.MICROPHONE),配置方式请参见[访问控制授权申请](../security/accesstoken-guidelines.md#配置文件权限声明)。 ## 开发指导 详细API含义可参考:[音频管理API文档AudioCapturer](../reference/apis/js-apis-audio.md#audiocapturer8) -1. 使用createAudioCapturer()创建一个AudioCapturer实例。 +1. 使用createAudioCapturer()创建一个全局的AudioCapturer实例。 在audioCapturerOptions中设置音频采集器的相关参数。该实例可用于音频采集、控制和获取采集状态,以及注册通知回调。 ```js - import audio from '@ohos.multimedia.audio'; - - let audioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - let audioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 // 0是音频采集器的扩展标志位,默认为0 - } - - let audioCapturerOptions = { - streamInfo: audioStreamInfo, - capturerInfo: audioCapturerInfo - } - - let audioCapturer = await audio.createAudioCapturer(audioCapturerOptions); - console.log('AudioRecLog: Create audio capturer success.'); + import audio from '@ohos.multimedia.audio'; + import fs from '@ohos.file.fs'; //便于步骤3 read函数调用 + + //音频渲染相关接口自测试 + @Entry + @Component + struct AudioRenderer { + @State message: string = 'Hello World' + private audioCapturer : audio.AudioCapturer; //供全局调用 + + async initAudioCapturer(){ + let audioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let audioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 // 0是音频采集器的扩展标志位,默认为0 + } + + let audioCapturerOptions = { + streamInfo: audioStreamInfo, + capturerInfo: audioCapturerInfo + } + + this.audioCapturer = await audio.createAudioCapturer(audioCapturerOptions); + console.log('AudioRecLog: Create audio capturer success.'); + } ``` 2. 调用start()方法来启动/恢复采集任务。 @@ -60,23 +70,18 @@ AudioCapturer提供了用于获取原始音频文件的方法。开发者可以 启动完成后,采集器状态将变更为STATE_RUNNING,然后应用可以开始读取缓冲区。 ```js - import audio from '@ohos.multimedia.audio'; - - async function startCapturer() { - let state = audioCapturer.state; + async startCapturer() { + let state = this.audioCapturer.state; // Capturer start时的状态应该是STATE_PREPARED、STATE_PAUSED和STATE_STOPPED之一. - if (state != audio.AudioState.STATE_PREPARED || state != audio.AudioState.STATE_PAUSED || - state != audio.AudioState.STATE_STOPPED) { - console.info('Capturer is not in a correct state to start'); - return; - } - await audioCapturer.start(); - - state = audioCapturer.state; - if (state == audio.AudioState.STATE_RUNNING) { - console.info('AudioRecLog: Capturer started'); - } else { - console.error('AudioRecLog: Capturer start failed'); + if (state == audio.AudioState.STATE_PREPARED || state == audio.AudioState.STATE_PAUSED || + state == audio.AudioState.STATE_STOPPED) { + await this.audioCapturer.start(); + state = this.audioCapturer.state; + if (state == audio.AudioState.STATE_RUNNING) { + console.info('AudioRecLog: Capturer started'); + } else { + console.error('AudioRecLog: Capturer start failed'); + } } } ``` @@ -86,91 +91,88 @@ AudioCapturer提供了用于获取原始音频文件的方法。开发者可以 参考以下示例,将采集到的数据写入文件。 ```js - import fs from '@ohos.file.fs'; - - let state = audioCapturer.state; - // 只有状态为STATE_RUNNING的时候才可以read. - if (state != audio.AudioState.STATE_RUNNING) { - console.info('Capturer is not in a correct state to read'); - return; - } - - const path = '/data/data/.pulse_dir/capture_js.wav'; // 采集到的音频文件存储路径 - let file = fs.openSync(filePath, 0o2); - let fd = file.fd; - if (file !== null) { - console.info('AudioRecLog: file created'); - } else { - console.info('AudioRecLog: file create : FAILED'); - return; - } - - if (fd !== null) { - console.info('AudioRecLog: file fd opened in append mode'); - } - - let numBuffersToCapture = 150; // 循环写入150次 - let count = 0; - while (numBuffersToCapture) { - let bufferSize = await audioCapturer.getBufferSize(); - let buffer = await audioCapturer.read(bufferSize, true); - let options = { - offset: count * this.bufferSize, - length: this.bufferSize + async readData(){ + let state = this.audioCapturer.state; + // 只有状态为STATE_RUNNING的时候才可以read. + if (state != audio.AudioState.STATE_RUNNING) { + console.info('Capturer is not in a correct state to read'); + return; } - if (typeof(buffer) == undefined) { - console.info('AudioRecLog: read buffer failed'); + const path = '/data/data/.pulse_dir/capture_js.wav'; // 采集到的音频文件存储路径 + let file = fs.openSync(path, 0o2); + let fd = file.fd; + if (file !== null) { + console.info('AudioRecLog: file created'); } else { - let number = fs.writeSync(fd, buffer, options); - console.info(`AudioRecLog: data written: ${number}`); - } - numBuffersToCapture--; - count++; + console.info('AudioRecLog: file create : FAILED'); + return; + } + if (fd !== null) { + console.info('AudioRecLog: file fd opened in append mode'); + } + let numBuffersToCapture = 150; // 循环写入150次 + let count = 0; + while (numBuffersToCapture) { + this.bufferSize = await this.audioCapturer.getBufferSize(); + let buffer = await this.audioCapturer.read(this.bufferSize, true); + let options = { + offset: count * this.bufferSize, + length: this.bufferSize + } + if (typeof(buffer) == undefined) { + console.info('AudioRecLog: read buffer failed'); + } else { + let number = fs.writeSync(fd, buffer, options); + console.info(`AudioRecLog: data written: ${number}`); + } + numBuffersToCapture--; + count++; + } } ``` 4. 采集完成后,调用stop方法,停止录制。 ```js - async function StopCapturer() { - let state = audioCapturer.state; - // 只有采集器状态为STATE_RUNNING或STATE_PAUSED的时候才可以停止 - if (state != audio.AudioState.STATE_RUNNING && state != audio.AudioState.STATE_PAUSED) { - console.info('AudioRecLog: Capturer is not running or paused'); - return; - } - - await audioCapturer.stop(); - - state = audioCapturer.state; - if (state == audio.AudioState.STATE_STOPPED) { - console.info('AudioRecLog: Capturer stopped'); - } else { - console.error('AudioRecLog: Capturer stop failed'); - } - } + async StopCapturer() { + let state = this.audioCapturer.state; + // 只有采集器状态为STATE_RUNNING或STATE_PAUSED的时候才可以停止 + if (state != audio.AudioState.STATE_RUNNING && state != audio.AudioState.STATE_PAUSED) { + console.info('AudioRecLog: Capturer is not running or paused'); + return; + } + + await this.audioCapturer.stop(); + + state = this.audioCapturer.state; + if (state == audio.AudioState.STATE_STOPPED) { + console.info('AudioRecLog: Capturer stopped'); + } else { + console.error('AudioRecLog: Capturer stop failed'); + } + } ``` 5. 任务结束,调用release()方法释放相关资源。 ```js - async function releaseCapturer() { - let state = audioCapturer.state; - // 采集器状态不是STATE_RELEASED或STATE_NEW状态,才能release - if (state == audio.AudioState.STATE_RELEASED || state == audio.AudioState.STATE_NEW) { - console.info('AudioRecLog: Capturer already released'); - return; - } - - await audioCapturer.release(); - - state = audioCapturer.state; - if (state == audio.AudioState.STATE_RELEASED) { - console.info('AudioRecLog: Capturer released'); - } else { - console.info('AudioRecLog: Capturer release failed'); - } - } + async releaseCapturer() { + let state = this.audioCapturer.state; + // 采集器状态不是STATE_RELEASED或STATE_NEW状态,才能release + if (state == audio.AudioState.STATE_RELEASED || state == audio.AudioState.STATE_NEW) { + console.info('AudioRecLog: Capturer already released'); + return; + } + + await this.audioCapturer.release(); + + state = this.audioCapturer.state; + if (state == audio.AudioState.STATE_RELEASED) { + console.info('AudioRecLog: Capturer released'); + } else { + console.info('AudioRecLog: Capturer release failed'); + } + } ``` 6. (可选)获取采集器相关信息 @@ -178,23 +180,20 @@ AudioCapturer提供了用于获取原始音频文件的方法。开发者可以 通过以下代码,可以获取采集器的相关信息。 ```js - // 获取当前采集器状态 - let state = audioCapturer.state; - - // 获取采集器信息 - let audioCapturerInfo : audio.AuduioCapturerInfo = await audioCapturer.getCapturerInfo(); - - // 获取音频流信息 - let audioStreamInfo : audio.AudioStreamInfo = await audioCapturer.getStreamInfo(); - - // 获取音频流ID - let audioStreamId : number = await audioCapturer.getAudioStreamId(); - - // 获取纳秒形式的Unix时间戳 - let audioTime : number = await audioCapturer.getAudioTime(); - - // 获取合理的最小缓冲区大小 - let bufferSize : number = await audioCapturer.getBufferSize(); + async getAudioCapturerInfo(){ + // 获取当前采集器状态 + let state = this.audioCapturer.state; + // 获取采集器信息 + let audioCapturerInfo : audio.AudioCapturerInfo = await this.audioCapturer.getCapturerInfo(); + // 获取音频流信息 + let audioStreamInfo : audio.AudioStreamInfo = await this.audioCapturer.getStreamInfo(); + // 获取音频流ID + let audioStreamId : number = await this.audioCapturer.getAudioStreamId(); + // 获取纳秒形式的Unix时间戳 + let audioTime : number = await this.audioCapturer.getAudioTime(); + // 获取合理的最小缓冲区大小 + let bufferSize : number = await this.audioCapturer.getBufferSize(); + } ``` 7. (可选)使用on('markReach')方法订阅采集器标记到达事件,使用off('markReach')取消订阅事件。 @@ -202,12 +201,13 @@ AudioCapturer提供了用于获取原始音频文件的方法。开发者可以 注册markReach监听后,当采集器采集的帧数到达设定值时,会触发回调并返回设定的值。 ```js - audioCapturer.on('markReach', (reachNumber) => { - console.info('Mark reach event Received'); - console.info(`The Capturer reached frame: ${reachNumber}`); - }); - - audioCapturer.off('markReach'); // 取消markReach事件的订阅,后续将无法监听到“标记到达”事件 + async markReach(){ + this.audioCapturer.on('markReach', 10, (reachNumber) => { + console.info('Mark reach event Received'); + console.info(`The Capturer reached frame: ${reachNumber}`); + }); + this.audioCapturer.off('markReach'); // 取消markReach事件的订阅,后续将无法监听到“标记到达”事件 + } ``` 8. (可选)使用on('periodReach')方法订阅采集器区间标记到达事件,使用off('periodReach')取消订阅事件。 @@ -215,40 +215,43 @@ AudioCapturer提供了用于获取原始音频文件的方法。开发者可以 注册periodReach监听后,**每当**采集器采集的帧数到达设定值时,会触发回调并返回设定的值。 ```js - audioCapturer.on('periodReach', (reachNumber) => { - console.info('Period reach event Received'); - console.info(`In this period, the Capturer reached frame: ${reachNumber}`); - }); - - audioCapturer.off('periodReach'); // 取消periodReach事件的订阅,后续将无法监听到“区间标记到达”事件 + async periodReach(){ + this.audioCapturer.on('periodReach', 10, (reachNumber) => { + console.info('Period reach event Received'); + console.info(`In this period, the Capturer reached frame: ${reachNumber}`); + }); + this.audioCapturer.off('periodReach'); // 取消periodReach事件的订阅,后续将无法监听到“区间标记到达”事件 + } ``` 9. 如果应用需要在采集器状态更新时进行一些操作,可以订阅该事件,当采集器状态更新时,会受到一个包含有事件类型的回调。 ```js - audioCapturer.on('stateChange', (state) => { - console.info(`AudioCapturerLog: Changed State to : ${state}`) - switch (state) { - case audio.AudioState.STATE_PREPARED: - console.info('--------CHANGE IN AUDIO STATE----------PREPARED--------------'); - console.info('Audio State is : Prepared'); - break; - case audio.AudioState.STATE_RUNNING: - console.info('--------CHANGE IN AUDIO STATE----------RUNNING--------------'); - console.info('Audio State is : Running'); - break; - case audio.AudioState.STATE_STOPPED: - console.info('--------CHANGE IN AUDIO STATE----------STOPPED--------------'); - console.info('Audio State is : stopped'); - break; - case audio.AudioState.STATE_RELEASED: - console.info('--------CHANGE IN AUDIO STATE----------RELEASED--------------'); - console.info('Audio State is : released'); - break; - default: - console.info('--------CHANGE IN AUDIO STATE----------INVALID--------------'); - console.info('Audio State is : invalid'); - break; - } - }); + async stateChange(){ + this.audioCapturer.on('stateChange', (state) => { + console.info(`AudioCapturerLog: Changed State to : ${state}`) + switch (state) { + case audio.AudioState.STATE_PREPARED: + console.info('--------CHANGE IN AUDIO STATE----------PREPARED--------------'); + console.info('Audio State is : Prepared'); + break; + case audio.AudioState.STATE_RUNNING: + console.info('--------CHANGE IN AUDIO STATE----------RUNNING--------------'); + console.info('Audio State is : Running'); + break; + case audio.AudioState.STATE_STOPPED: + console.info('--------CHANGE IN AUDIO STATE----------STOPPED--------------'); + console.info('Audio State is : stopped'); + break; + case audio.AudioState.STATE_RELEASED: + console.info('--------CHANGE IN AUDIO STATE----------RELEASED--------------'); + console.info('Audio State is : released'); + break; + default: + console.info('--------CHANGE IN AUDIO STATE----------INVALID--------------'); + console.info('Audio State is : invalid'); + break; + } + }); + } ``` \ No newline at end of file diff --git a/zh-cn/application-dev/media/audio-renderer.md b/zh-cn/application-dev/media/audio-renderer.md index 0599b33ab787febb7bfb7f3a38c0312d6cb35ba7..0f9436fc3b7d9e015d71869dc9739e7f5124e154 100644 --- a/zh-cn/application-dev/media/audio-renderer.md +++ b/zh-cn/application-dev/media/audio-renderer.md @@ -28,47 +28,59 @@ AudioRenderer提供了渲染音频文件和控制播放的接口,开发者可 详细API含义可参考:[音频管理API文档AudioRenderer](../reference/apis/js-apis-audio.md#audiorenderer8) -1. 使用createAudioRenderer()创建一个AudioRenderer实例。 +1. 使用createAudioRenderer()创建一个全局的AudioRenderer实例,以便后续步骤使用。 在audioRendererOptions中设置相关参数。该实例可用于音频渲染、控制和获取渲染状态,以及注册通知回调。 ```js - import audio from '@ohos.multimedia.audio'; - - let audioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - let audioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 0 // 0是音频渲染器的扩展标志位,默认为0 - } - let audioRendererOptions = { - streamInfo: audioStreamInfo, - rendererInfo: audioRendererInfo - } - - let audioRenderer = await audio.createAudioRenderer(audioRendererOptions); - console.log("Create audio renderer success."); + import audio from '@ohos.multimedia.audio'; + import fs from '@ohos.file.fs'; + + //音频渲染相关接口自测试 + @Entry + @Component + struct AudioRenderer1129 { + private audioRenderer: audio.AudioRenderer; + private bufferSize;//便于步骤3 write函数调用使用 + private audioRenderer1: audio.AudioRenderer; //便于步骤14 完整示例调用使用 + private audioRenderer2: audio.AudioRenderer; //便于步骤14 完整示例调用使用 + + async initAudioRender(){ + let audioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + let audioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 0 // 0是音频渲染器的扩展标志位,默认为0 + } + let audioRendererOptions = { + streamInfo: audioStreamInfo, + rendererInfo: audioRendererInfo + } + this.audioRenderer = await audio.createAudioRenderer(audioRendererOptions); + console.log("Create audio renderer success."); + } + } ``` 2. 调用start()方法来启动/恢复播放任务。 ```js - async function startRenderer() { - let state = audioRenderer.state; + async startRenderer() { + let state = this.audioRenderer.state; // Renderer start时的状态应该是STATE_PREPARED、STATE_PAUSED和STATE_STOPPED之一. if (state != audio.AudioState.STATE_PREPARED && state != audio.AudioState.STATE_PAUSED && - state != audio.AudioState.STATE_STOPPED) { + state != audio.AudioState.STATE_STOPPED) { console.info('Renderer is not in a correct state to start'); return; } - - await audioRenderer.start(); - - state = audioRenderer.state; + + await this.audioRenderer.start(); + + state = this.audioRenderer.state; if (state == audio.AudioState.STATE_RUNNING) { console.info('Renderer started'); } else { @@ -81,112 +93,97 @@ AudioRenderer提供了渲染音频文件和控制播放的接口,开发者可 3. 调用write()方法向缓冲区写入数据。 - 将需要播放的音频数据读入缓冲区,重复调用write()方法写入。 + 将需要播放的音频数据读入缓冲区,重复调用write()方法写入。请注意引入“import fs from '@ohos.file.fs';”,具体请参考步骤1。 ```js - import fs from '@ohos.file.fs'; - import audio from '@ohos.multimedia.audio'; - - async function writeBuffer(buf) { - // 写入数据时,渲染器的状态必须为STATE_RUNNING - if (audioRenderer.state != audio.AudioState.STATE_RUNNING) { - console.error('Renderer is not running, do not write'); - return; - } - let writtenbytes = await audioRenderer.write(buf); - console.info(`Actual written bytes: ${writtenbytes} `); - if (writtenbytes < 0) { - console.error('Write buffer failed. check the state of renderer'); - } - } - - // 此处是渲染器的合理的最小缓冲区大小(也可以选择其它大小的缓冲区) - const bufferSize = await audioRenderer.getBufferSize(); - let dir = globalThis.fileDir; //不可直接访问,没权限,切记!!!一定要使用沙箱路径 - const filePath = dir + '/file_example_WAV_2MG.wav'; // 需要渲染的音乐文件 实际路径为:/data/storage/el2/base/haps/entry/files/file_example_WAV_2MG.wav - console.info(`file filePath: ${ filePath}`); - - let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY); - let stat = await fs.stat(filePath); //音乐文件信息 - let buf = new ArrayBuffer(bufferSize); - let len = stat.size % this.bufferSize == 0 ? Math.floor(stat.size / this.bufferSize) : Math.floor(stat.size / this.bufferSize + 1); - for (let i = 0;i < len; i++) { - let options = { - offset: i * this.bufferSize, - length: this.bufferSize - } - let readsize = await fs.read(file.fd, buf, options) - let writeSize = await new Promise((resolve,reject)=>{ - this.audioRenderer.write(buf,(err,writeSize)=>{ - if(err){ - reject(err) - }else{ - resolve(writeSize) - } + async writeData(){ + // 此处是渲染器的合理的最小缓冲区大小(也可以选择其它大小的缓冲区) + this.bufferSize = await this.audioRenderer.getBufferSize(); + let dir = globalThis.fileDir; //不可直接访问,没权限,切记!!!一定要使用沙箱路径 + const filePath = dir + '/file_example_WAV_2MG.wav'; // 需要渲染的音乐文件 实际路径为:/data/storage/el2/base/haps/entry/files/file_example_WAV_2MG.wav + console.info(`file filePath: ${ filePath}`); + + let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY); + let stat = await fs.stat(filePath); //音乐文件信息 + let buf = new ArrayBuffer(this.bufferSize); + let len = stat.size % this.bufferSize == 0 ? Math.floor(stat.size / this.bufferSize) : Math.floor(stat.size / this.bufferSize + 1); + for (let i = 0;i < len; i++) { + let options = { + offset: i * this.bufferSize, + length: this.bufferSize + } + let readsize = await fs.read(file.fd, buf, options) + let writeSize = await new Promise((resolve,reject)=>{ + this.audioRenderer.write(buf,(err,writeSize)=>{ + if(err){ + reject(err) + }else{ + resolve(writeSize) + } + }) }) - }) + } + + fs.close(file) + await this.audioRenderer.stop(); //停止渲染 + await this.audioRenderer.release(); //释放资源 } - - fs.close(file) - await audioRenderer.stop(); //停止渲染 - await audioRenderer.release(); //释放资源 ``` 4. (可选)调用pause()方法或stop()方法暂停/停止渲染音频数据。 ```js - async function pauseRenderer() { - let state = audioRenderer.state; - // 只有渲染器状态为STATE_RUNNING的时候才能暂停 - if (state != audio.AudioState.STATE_RUNNING) { - console.info('Renderer is not running'); - return; - } - - await audioRenderer.pause(); - - state = audioRenderer.state; - if (state == audio.AudioState.STATE_PAUSED) { - console.info('Renderer paused'); - } else { - console.error('Renderer pause failed'); - } - } - - async function stopRenderer() { - let state = audioRenderer.state; - // 只有渲染器状态为STATE_RUNNING或STATE_PAUSED的时候才可以停止 - if (state != audio.AudioState.STATE_RUNNING && state != audio.AudioState.STATE_PAUSED) { - console.info('Renderer is not running or paused'); - return; - } - - await audioRenderer.stop(); - - state = audioRenderer.state; - if (state == audio.AudioState.STATE_STOPPED) { - console.info('Renderer stopped'); - } else { - console.error('Renderer stop failed'); - } - } + async pauseRenderer() { + let state = this.audioRenderer.state; + // 只有渲染器状态为STATE_RUNNING的时候才能暂停 + if (state != audio.AudioState.STATE_RUNNING) { + console.info('Renderer is not running'); + return; + } + + await this.audioRenderer.pause(); + + state = this.audioRenderer.state; + if (state == audio.AudioState.STATE_PAUSED) { + console.info('Renderer paused'); + } else { + console.error('Renderer pause failed'); + } + } + + async stopRenderer() { + let state = this.audioRenderer.state; + // 只有渲染器状态为STATE_RUNNING或STATE_PAUSED的时候才可以停止 + if (state != audio.AudioState.STATE_RUNNING && state != audio.AudioState.STATE_PAUSED) { + console.info('Renderer is not running or paused'); + return; + } + + await this.audioRenderer.stop(); + + state = this.audioRenderer.state; + if (state == audio.AudioState.STATE_STOPPED) { + console.info('Renderer stopped'); + } else { + console.error('Renderer stop failed'); + } + } ``` 5. (可选)调用drain()方法清空缓冲区。 ```js - async function drainRenderer() { - let state = audioRenderer.state; - // 只有渲染器状态为STATE_RUNNING的时候才能使用drain() - if (state != audio.AudioState.STATE_RUNNING) { - console.info('Renderer is not running'); - return; - } - - await audioRenderer.drain(); - - state = audioRenderer.state; + async drainRenderer() { + let state = this.audioRenderer.state; + // 只有渲染器状态为STATE_RUNNING的时候才能使用drain() + if (state != audio.AudioState.STATE_RUNNING) { + console.info('Renderer is not running'); + return; } + + await this.audioRenderer.drain(); + state = this.audioRenderer.state; + } ``` 6. 任务完成,调用release()方法释放相关资源。 @@ -194,23 +191,22 @@ AudioRenderer提供了渲染音频文件和控制播放的接口,开发者可 AudioRenderer会使用大量的系统资源,所以请确保完成相关任务后,进行资源释放。 ```js - async function releaseRenderer() { - let state = audioRenderer.state; - // 渲染器状态不是STATE_RELEASED或STATE_NEW状态,才能release - if (state == audio.AudioState.STATE_RELEASED || state == audio.AudioState.STATE_NEW) { - console.info('Renderer already released'); - return; - } - - await audioRenderer.release(); + async releaseRenderer() { + let state = this.audioRenderer.state; + // 渲染器状态不是STATE_RELEASED或STATE_NEW状态,才能release + if (state == audio.AudioState.STATE_RELEASED || state == audio.AudioState.STATE_NEW) { + console.info('Renderer already released'); + return; + } + await this.audioRenderer.release(); - state = audioRenderer.state; - if (state == audio.AudioState.STATE_RELEASED) { - console.info('Renderer released'); - } else { - console.info('Renderer release failed'); - } + state = this.audioRenderer.state; + if (state == audio.AudioState.STATE_RELEASED) { + console.info('Renderer released'); + } else { + console.info('Renderer release failed'); } + } ``` 7. (可选)获取渲染器相关信息 @@ -218,26 +214,22 @@ AudioRenderer提供了渲染音频文件和控制播放的接口,开发者可 通过以下代码,可以获取渲染器的相关信息。 ```js - // 获取当前渲染器状态 - let state = audioRenderer.state; - - // 获取渲染器信息 - let audioRendererInfo : audio.AudioRendererInfo = await audioRenderer.getRendererInfo(); - - // 获取音频流信息 - let audioStreamInfo : audio.AudioStreamInfo = await audioRenderer.getStreamInfo(); - - // 获取音频流ID - let audioStreamId : number = await audioRenderer.getAudioStreamId(); - - // 获取纳秒形式的Unix时间戳 - let audioTime : number = await audioRenderer.getAudioTime(); - - // 获取合理的最小缓冲区大小 - let bufferSize : number = await audioRenderer.getBufferSize(); - - // 获取渲染速率 - let renderRate : audio.AudioRendererRate = await audioRenderer.getRenderRate(); + async getRenderInfo(){ + // 获取当前渲染器状态 + let state = this.audioRenderer.state; + // 获取渲染器信息 + let audioRendererInfo : audio.AudioRendererInfo = await this.audioRenderer.getRendererInfo(); + // 获取音频流信息 + let audioStreamInfo : audio.AudioStreamInfo = await this.audioRenderer.getStreamInfo(); + // 获取音频流ID + let audioStreamId : number = await this.audioRenderer.getAudioStreamId(); + // 获取纳秒形式的Unix时间戳 + let audioTime : number = await this.audioRenderer.getAudioTime(); + // 获取合理的最小缓冲区大小 + let bufferSize : number = await this.audioRenderer.getBufferSize(); + // 获取渲染速率 + let renderRate : audio.AudioRendererRate = await this.audioRenderer.getRenderRate(); + } ``` 8. (可选)设置渲染器相关信息 @@ -245,17 +237,17 @@ AudioRenderer提供了渲染音频文件和控制播放的接口,开发者可 通过以下代码,可以设置渲染器的相关信息。 ```js - // 设置渲染速率为正常速度 - let renderRate : audio.AudioRendererRate = audio.AudioRendererRate.RENDER_RATE_NORMAL; - await audioRenderer.setRenderRate(renderRate); - - // 设置渲染器音频中断模式为SHARE_MODE - let interruptMode : audio.InterruptMode = audio.InterruptMode.SHARE_MODE; - await audioRenderer.setInterruptMode(interruptMode); - - // 设置一个流的音量为0.5 - let volume : number = 0.5; - await audioRenderer.setVolume(volume); + async setAudioRenderInfo(){ + // 设置渲染速率为正常速度 + let renderRate : audio.AudioRendererRate = audio.AudioRendererRate.RENDER_RATE_NORMAL; + await this.audioRenderer.setRenderRate(renderRate); + // 设置渲染器音频中断模式为SHARE_MODE + let interruptMode : audio.InterruptMode = audio.InterruptMode.SHARE_MODE; + await this.audioRenderer.setInterruptMode(interruptMode); + // 设置一个流的音量为0.5 + let volume : number = 0.5; + await this.audioRenderer.setVolume(volume); + } ``` 9. (可选)使用on('audioInterrupt')方法订阅渲染器音频中断事件,使用off('audioInterrupt')取消订阅事件。 @@ -269,45 +261,45 @@ AudioRenderer提供了渲染音频文件和控制播放的接口,开发者可 需要说明的是,本模块的订阅音频中断事件与[AudioManager](../reference/apis/js-apis-audio.md#audiomanager)模块中的on('interrupt')稍有不同。自api9以来,on('interrupt')和off('interrupt')均被废弃。在AudioRenderer模块,当开发者需要监听焦点变化事件时,只需要调用on('audioInterrupt')函数,当应用内部的AudioRenderer对象在start\stop\pause等动作发生时,会主动请求焦点,从而发生焦点转移,相关的AudioRenderer对象即可获取到对应的回调信息。但对除AudioRenderer的其他对象,例如FM、语音唤醒等,应用不会创建对象,此时可调用AudioManager中的on('interrupt')获取焦点变化通知。 ```js - audioRenderer.on('audioInterrupt', (interruptEvent) => { - console.info('InterruptEvent Received'); - console.info(`InterruptType: ${interruptEvent.eventType}`); - console.info(`InterruptForceType: ${interruptEvent.forceType}`); - console.info(`AInterruptHint: ${interruptEvent.hintType}`); - - if (interruptEvent.forceType == audio.InterruptForceType.INTERRUPT_FORCE) { - switch (interruptEvent.hintType) { + async subscribeAudioRender(){ + this.audioRenderer.on('audioInterrupt', (interruptEvent) => { + console.info('InterruptEvent Received'); + console.info(`InterruptType: ${interruptEvent.eventType}`); + console.info(`InterruptForceType: ${interruptEvent.forceType}`); + console.info(`AInterruptHint: ${interruptEvent.hintType}`); + + if (interruptEvent.forceType == audio.InterruptForceType.INTERRUPT_FORCE) { + switch (interruptEvent.hintType) { // 音频框架发起的强制暂停操作,为防止数据丢失,此时应该停止数据的写操作 - case audio.InterruptHint.INTERRUPT_HINT_PAUSE: - isPlay = false; - break; + case audio.InterruptHint.INTERRUPT_HINT_PAUSE: + console.info('isPlay is false'); + break; // 音频框架发起的强制停止操作,为防止数据丢失,此时应该停止数据的写操作 - case audio.InterruptHint.INTERRUPT_HINT_STOP: - isPlay = false; - break; + case audio.InterruptHint.INTERRUPT_HINT_STOP: + console.info('isPlay is false'); + break; // 音频框架发起的强制降低音量操作 - case audio.InterruptHint.INTERRUPT_HINT_DUCK: - break; + case audio.InterruptHint.INTERRUPT_HINT_DUCK: + break; // 音频框架发起的恢复音量操作 - case audio.InterruptHint.INTERRUPT_HINT_UNDUCK: - break; - } - } else if (interruptEvent.forceType == audio.InterruptForceType.INTERRUPT_SHARE) { - switch (interruptEvent.hintType) { + case audio.InterruptHint.INTERRUPT_HINT_UNDUCK: + break; + } + } else if (interruptEvent.forceType == audio.InterruptForceType.INTERRUPT_SHARE) { + switch (interruptEvent.hintType) { // 提醒App开始渲染 - case audio.InterruptHint.INTERRUPT_HINT_RESUME: - startRenderer(); - break; + case audio.InterruptHint.INTERRUPT_HINT_RESUME: + this.startRenderer(); + break; // 提醒App音频流被中断,由App自主决定是否继续(此处选择暂停) - case audio.InterruptHint.INTERRUPT_HINT_PAUSE: - isPlay = false; - pauseRenderer(); - break; + case audio.InterruptHint.INTERRUPT_HINT_PAUSE: + console.info('isPlay is false'); + this.pauseRenderer(); + break; + } } - } - }); - - audioRenderer.off('audioInterrupt'); // 取消音频中断事件的订阅,后续将无法监听到音频中断事件 + }); + } ``` 10. (可选)使用on('markReach')方法订阅渲染器标记到达事件,使用off('markReach')取消订阅事件。 @@ -315,12 +307,14 @@ AudioRenderer提供了渲染音频文件和控制播放的接口,开发者可 注册markReach监听后,当渲染器渲染的帧数到达设定值时,会触发回调并返回设定的值。 ```js - audioRenderer.on('markReach', (reachNumber) => { - console.info('Mark reach event Received'); - console.info(`The renderer reached frame: ${reachNumber}`); - }); - - audioRenderer.off('markReach'); // 取消markReach事件的订阅,后续将无法监听到“标记到达”事件 + async markReach(){ + this.audioRenderer.on('markReach', 50, (position) => { + if (position == 50) { + console.info('ON Triggered successfully'); + } + }); + this.audioRenderer.off('markReach'); // 取消markReach事件的订阅,后续将无法监听到“标记到达”事件 + } ``` 11. (可选)使用on('periodReach')方法订阅渲染器区间标记到达事件,使用off('periodReach')取消订阅事件。 @@ -328,12 +322,13 @@ AudioRenderer提供了渲染音频文件和控制播放的接口,开发者可 注册periodReach监听后,**每当**渲染器渲染的帧数到达设定值时,会触发回调并返回设定的值。 ```js - audioRenderer.on('periodReach', (reachNumber) => { - console.info('Period reach event Received'); - console.info(`In this period, the renderer reached frame: ${reachNumber} `); - }); - - audioRenderer.off('periodReach'); // 取消periodReach事件的订阅,后续将无法监听到“区间标记到达”事件 + async periodReach(){ + this.audioRenderer.on('periodReach',10, (reachNumber) => { + console.info(`In this period, the renderer reached frame: ${reachNumber} `); + }); + + this.audioRenderer.off('periodReach'); // 取消periodReach事件的订阅,后续将无法监听到“区间标记到达”事件 + } ``` 12. (可选)使用on('stateChange')方法订阅渲染器音频状态变化事件。 @@ -341,10 +336,12 @@ AudioRenderer提供了渲染音频文件和控制播放的接口,开发者可 注册stateChange监听后,当渲染器的状态发生改变时,会触发回调并返回当前渲染器的状态。 ```js - audioRenderer.on('stateChange', (audioState) => { - console.info('State change event Received'); - console.info(`Current renderer state is: ${audioState}`); - }); + async stateChange(){ + this.audioRenderer.on('stateChange', (audioState) => { + console.info('State change event Received'); + console.info(`Current renderer state is: ${audioState}`); + }); + } ``` 13. (可选)对on()方法的异常处理。 @@ -352,21 +349,24 @@ AudioRenderer提供了渲染音频文件和控制播放的接口,开发者可 在使用on()方法时,如果传入的字符串错误或传入的参数类型错误,程序会抛出异常,需要用try catch来捕获。 ```js - try { - audioRenderer.on('invalidInput', () => { // 字符串不匹配 - }) - } catch (err) { - console.info(`Call on function error, ${err}`); // 程序抛出401异常 - } - try { - audioRenderer.on(1, () => { // 入参类型错误 - }) - } catch (err) { - console.info(`Call on function error, ${err}`); // 程序抛出6800101异常 + async errorCall(){ + try { + this.audioRenderer.on('invalidInput', () => { // 字符串不匹配 + }) + } catch (err) { + console.info(`Call on function error, ${err}`); // 程序抛出401异常 + } + try { + this.audioRenderer.on(1, () => { // 入参类型错误 + }) + } catch (err) { + console.info(`Call on function error, ${err}`); // 程序抛出6800101异常 + } } ``` 14. (可选)on('audioInterrupt')方法完整示例。 + 请注意:在调用前声明audioRenderer1与audioRenderer2对象,具体请参考步骤1。 同一个应用中的AudioRender1和AudioRender2在创建时均设置了焦点模式为独立,并且调用on('audioInterrupt')监听焦点变化。刚开始AudioRender1拥有焦点,当AudioRender2获取到焦点时,audioRenderer1将收到焦点转移的通知,打印相关日志。如果AudioRender1和AudioRender2不将焦点模式设置为独立,则监听处理中的日志在应用运行过程中永远不会被打印。 ```js async runningAudioRender1(){ @@ -385,31 +385,31 @@ AudioRenderer提供了渲染音频文件和控制播放的接口,开发者可 streamInfo: audioStreamInfo, rendererInfo: audioRendererInfo } - + //1.1 创建对象 - audioRenderer1 = await audio.createAudioRenderer(audioRendererOptions); + this.audioRenderer1 = await audio.createAudioRenderer(audioRendererOptions); console.info("Create audio renderer 1 success."); - + //1.2 设置焦点模式为独立模式 :1 - audioRenderer1.setInterruptMode(1).then( data => { + this.audioRenderer1.setInterruptMode(1).then( data => { console.info('audioRenderer1 setInterruptMode Success!'); }).catch((err) => { console.error(`audioRenderer1 setInterruptMode Fail: ${err}`); }); - + //1.3 设置监听 - audioRenderer1.on('audioInterrupt', async(interruptEvent) => { + this.audioRenderer1.on('audioInterrupt', async(interruptEvent) => { console.info(`audioRenderer1 on audioInterrupt : ${JSON.stringify(interruptEvent)}`) }); - + //1.4 启动渲染 - await audioRenderer1.start(); + await this.audioRenderer1.start(); console.info('startAudioRender1 success'); - + //1.5 获取缓存区大小,此处是渲染器的合理的最小缓冲区大小(也可以选择其它大小的缓冲区) - const bufferSize = await audioRenderer1.getBufferSize(); + const bufferSize = await this.audioRenderer1.getBufferSize(); console.info(`audio bufferSize: ${bufferSize}`); - + //1.6 获取原始音频数据文件 let dir = globalThis.fileDir; //不可直接访问,没权限,切记!!!一定要使用沙箱路径 const path1 = dir + '/music001_48000_32_1.wav'; // 需要渲染的音乐文件 实际路径为:/data/storage/el2/base/haps/entry/files/music001_48000_32_1.wav @@ -418,14 +418,14 @@ AudioRenderer提供了渲染音频文件和控制播放的接口,开发者可 let stat = await fs.stat(path1); //音乐文件信息 let buf = new ArrayBuffer(bufferSize); let len = stat.size % this.bufferSize == 0 ? Math.floor(stat.size / this.bufferSize) : Math.floor(stat.size / this.bufferSize + 1); - + //1.7 通过audioRender对缓存区的原始音频数据进行渲染 for (let i = 0;i < len; i++) { let options = { offset: i * this.bufferSize, length: this.bufferSize } - let readsize = await fs.read(file.fd, buf, options) + let readsize = await fs.read(file1.fd, buf, options) let writeSize = await new Promise((resolve,reject)=>{ this.audioRenderer1.write(buf,(err,writeSize)=>{ if(err){ @@ -434,13 +434,13 @@ AudioRenderer提供了渲染音频文件和控制播放的接口,开发者可 resolve(writeSize) } }) - }) + }) } fs.close(file1) - await audioRenderer1.stop(); //停止渲染 - await audioRenderer1.release(); //释放资源 + await this.audioRenderer1.stop(); //停止渲染 + await this.audioRenderer1.release(); //释放资源 } - + async runningAudioRender2(){ let audioStreamInfo = { samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, @@ -457,31 +457,31 @@ AudioRenderer提供了渲染音频文件和控制播放的接口,开发者可 streamInfo: audioStreamInfo, rendererInfo: audioRendererInfo } - + //2.1 创建对象 - audioRenderer2 = await audio.createAudioRenderer(audioRendererOptions); + this.audioRenderer2 = await audio.createAudioRenderer(audioRendererOptions); console.info("Create audio renderer 2 success."); - + //2.2 设置焦点模式为独立模式 :1 - audioRenderer2.setInterruptMode(1).then( data => { + this.audioRenderer2.setInterruptMode(1).then( data => { console.info('audioRenderer2 setInterruptMode Success!'); }).catch((err) => { console.error(`audioRenderer2 setInterruptMode Fail: ${err}`); }); - + //2.3 设置监听 - audioRenderer2.on('audioInterrupt', async(interruptEvent) => { + this.audioRenderer2.on('audioInterrupt', async(interruptEvent) => { console.info(`audioRenderer2 on audioInterrupt : ${JSON.stringify(interruptEvent)}`) }); - + //2.4 启动渲染 - await audioRenderer2.start(); + await this.audioRenderer2.start(); console.info('startAudioRender2 success'); - + //2.5 获取缓存区大小 - const bufferSize = await audioRenderer2.getBufferSize(); + const bufferSize = await this.audioRenderer2.getBufferSize(); console.info(`audio bufferSize: ${bufferSize}`); - + //2.6 获取原始音频数据文件 let dir = globalThis.fileDir; //不可直接访问,没权限,切记!!!一定要使用沙箱路径 const path2 = dir + '/music002_48000_32_1.wav'; // 需要渲染的音乐文件 实际路径为:/data/storage/el2/base/haps/entry/files/music002_48000_32_1.wav @@ -490,14 +490,14 @@ AudioRenderer提供了渲染音频文件和控制播放的接口,开发者可 let stat = await fs.stat(path2); //音乐文件信息 let buf = new ArrayBuffer(bufferSize); let len = stat.size % this.bufferSize == 0 ? Math.floor(stat.size / this.bufferSize) : Math.floor(stat.size / this.bufferSize + 1); - + //2.7 通过audioRender对缓存区的原始音频数据进行渲染 for (let i = 0;i < len; i++) { let options = { offset: i * this.bufferSize, length: this.bufferSize } - let readsize = await fs.read(file.fd, buf, options) + let readsize = await fs.read(file2.fd, buf, options) let writeSize = await new Promise((resolve,reject)=>{ this.audioRenderer2.write(buf,(err,writeSize)=>{ if(err){ @@ -506,28 +506,17 @@ AudioRenderer提供了渲染音频文件和控制播放的接口,开发者可 resolve(writeSize) } }) - }) + }) } fs.close(file2) - await audioRenderer2.stop(); //停止渲染 - await audioRenderer2.release(); //释放资源 + await this.audioRenderer2.stop(); //停止渲染 + await this.audioRenderer2.release(); //释放资源 } - - async writeBuffer(buf, audioRender) { - let writtenbytes; - await audioRender.write(buf).then((value) => { - writtenbytes = value; - console.info(`Actual written bytes: ${writtenbytes} `); - }); - if (typeof(writtenbytes) != 'number' || writtenbytes < 0) { - console.error('get Write buffer failed. check the state of renderer'); - } - } - + //综合调用入口 async test(){ - await runningAudioRender1(); - await runningAudioRender2(); + await this.runningAudioRender1(); + await this.runningAudioRender2(); } - + ``` \ No newline at end of file diff --git a/zh-cn/application-dev/media/avplayer-playback.md b/zh-cn/application-dev/media/avplayer-playback.md index 950ccd19857cd5704b86d82828c522e45ddde4aa..760064f23a825a03c0de41737d84f91760ec2b3d 100644 --- a/zh-cn/application-dev/media/avplayer-playback.md +++ b/zh-cn/application-dev/media/avplayer-playback.md @@ -299,13 +299,13 @@ export class AVPlayerDemo { async avPlayerDemo() { // 创建avPlayer实例对象 this.avPlayer = await media.createAVPlayer() - let fdPath = 'fd://' - let pathDir = "/data/storage/el2/base/haps/entry/files" // pathDir在FA模型和Stage模型的获取方式不同,请参考开发步骤首行的说明,根据实际情况自行获取。 - // path路径的码流可通过"hdc file send D:\xxx\H264_AAC.mp4 /data/app/el2/100/base/ohos.acts.multimedia.media.avplayer/haps/entry/files" 命令,将其推送到设备上 - let path = pathDir + '/H264_AAC.mp4' - let file = await fs.open(path) - fdPath = fdPath + '' + file.fd - this.avPlayer.url = fdPath + let fileDescriptor = undefined + // 使用资源管理模块的getRawFileDescriptor获取集成在应用中的媒体资源,并使用AVPlayer的fdSrc属性完成媒体资源初始化 + // 其中的参数fd/offset/length定义请查看媒体API文档,globalThis.abilityContext参数为系统环境变量,在系统启动时在主界面保存为全局变量 + await globalThis.abilityContext.resourceManager.getRawFileDescriptor('H264_AAC.mp4').then((value) => { + fileDescriptor = {fd: value.fd, offset: value.offset, length: value.length} + }) + this.avPlayer.fdSrc = fileDescriptor } } ``` diff --git a/zh-cn/application-dev/quick-start/Readme-CN.md b/zh-cn/application-dev/quick-start/Readme-CN.md index 18c1de01dfb932ea9c41da7bde5e038e6bbad548..7a14810f21ec94b0986c5c62ca0bcb5a91593dde 100755 --- a/zh-cn/application-dev/quick-start/Readme-CN.md +++ b/zh-cn/application-dev/quick-start/Readme-CN.md @@ -19,6 +19,10 @@ - [多HAP使用规则](multi-hap-rules.md) - [多HAP运行机制及数据通信方式](multi-hap-principles.md) - [应用程序包安装和卸载流程](application-package-install-uninstall.md) + - [应用程序包更新流程](application-package-update.md) + - 应用程序包快速修复 + - [快速修复概述](quickfix-principles.md) + - [快速修复调试指导](quickfix-debug.md) - 应用配置文件(Stage模型) - [应用配置文件概述(Stage模型)](application-configuration-file-overview-stage.md) - [app.json5配置文件](app-configuration-file.md) diff --git a/zh-cn/application-dev/quick-start/application-package-update.md b/zh-cn/application-dev/quick-start/application-package-update.md new file mode 100644 index 0000000000000000000000000000000000000000..33f56af3c425f46a748ebab07dc7f127636d6368 --- /dev/null +++ b/zh-cn/application-dev/quick-start/application-package-update.md @@ -0,0 +1,5 @@ +# 应用程序包更新流程 +OpenHarmony包管理服务提供了应用程序包更新能力,更新方式如下。 + +1. 应用市场内更新:新版本应用通过应用市场上架后,应用市场通知终端用户该应用有新版本,终端用户可以根据通知到应用市场(客户端)进行应用升级。 +2. 应用内检测升级:终端用户启动应用时,应用市场检测到该应用有新版本会通知终端用户,可以到应用市场进行应用的下载更新。 \ No newline at end of file diff --git a/zh-cn/application-dev/quick-start/figures/quick-fix-debug.png b/zh-cn/application-dev/quick-start/figures/quick-fix-debug.png new file mode 100644 index 0000000000000000000000000000000000000000..2df0368a73c5cd7ce1da5469ee36b61cb1bf838f Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/quick-fix-debug.png differ diff --git a/zh-cn/application-dev/quick-start/figures/quick-fix-devel_release.png b/zh-cn/application-dev/quick-start/figures/quick-fix-devel_release.png new file mode 100644 index 0000000000000000000000000000000000000000..90730cdc8d87d728aa1f9ac14655e5b49453f4ff Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/quick-fix-devel_release.png differ diff --git a/zh-cn/application-dev/quick-start/figures/quick_fix_bundle_struct.png b/zh-cn/application-dev/quick-start/figures/quick_fix_bundle_struct.png new file mode 100644 index 0000000000000000000000000000000000000000..6cee893e55085b36e3115c03f9f8b9075ad32da3 Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/quick_fix_bundle_struct.png differ diff --git a/zh-cn/application-dev/quick-start/figures/quick_fix_gen_abc.png b/zh-cn/application-dev/quick-start/figures/quick_fix_gen_abc.png new file mode 100644 index 0000000000000000000000000000000000000000..a9076bdace9c944f8eccfbff319809c2cf5abe43 Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/quick_fix_gen_abc.png differ diff --git a/zh-cn/application-dev/quick-start/figures/quick_fix_gen_so.png b/zh-cn/application-dev/quick-start/figures/quick_fix_gen_so.png new file mode 100644 index 0000000000000000000000000000000000000000..627295863d2f8f2e790cc62fea19da2fffebb094 Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/quick_fix_gen_so.png differ diff --git a/zh-cn/application-dev/quick-start/full-sdk-compile-guide.md b/zh-cn/application-dev/quick-start/full-sdk-compile-guide.md index 655446886bf5dc1d872927cd0c07b35634a5716e..4d53d2d7be083d5d8d15cb7168de4f9bfdde242b 100644 --- a/zh-cn/application-dev/quick-start/full-sdk-compile-guide.md +++ b/zh-cn/application-dev/quick-start/full-sdk-compile-guide.md @@ -22,7 +22,7 @@ 4. 编译:./build.sh --product-name ohos-sdk -编译成功后导出即可 +编译成功后导出out/sdk/packages/ohos-sdk/目录下的文件即可 ## 替换SDK diff --git a/zh-cn/application-dev/quick-start/quickfix-debug.md b/zh-cn/application-dev/quick-start/quickfix-debug.md new file mode 100644 index 0000000000000000000000000000000000000000..331bdc5a451294ee952a3112f1c0902e5334b141 --- /dev/null +++ b/zh-cn/application-dev/quick-start/quickfix-debug.md @@ -0,0 +1,92 @@ +# 快速修复命令行调试开发指导 + +当前阶段,OpenHarmony为开发者提供了命令行的调试开发工具可供使用。比如,包名为com.ohos.quickfix的示例应用,版本号为1000000。该应用的当前版本运行中有某问题需要修复,此时,开发者可参考如下指导使用快速修复能力解决应用问题。 + +## 编写配置文件patch.json + +目前DevEco Studio中还不支持patch.json的配置,因此开发者可根据项目需要编写好该文件后,放到的项目任意目录,方便后续打包工具能够找到该文件即可。在本地新建一个patch.json文件,配置编写示例如下: +```json +{ + "app" : { + "bundleName" : "com.ohos.quickfix", + "versionCode" : 1000000, // 应用版本号 + "versionName" : "1.0.0.1", + "patchVersionCode" : 1000000, // 补丁版本号 + "patchVersionName" : "1.0.0.1" + }, + "module" : { + "name" : "entry", + "type" : "patch", + "deviceTypes" : [ + "default", + "tablet" + ], + "originalModuleHash" : "11223344556677889900" // 待修复hap包的sha256值 + } +} +``` + +## 生成快速修复文件 +### 快速修复TS文件的代码 +* 在DevEco Studio中修改TS文件后,编译HAP,可以在工程目录下找到对应的abc文件,如`build\default\cache\default\LegacyCompileETS\jsbundle\temporary\pages\index.abc`。 + +### 快速修复C++中的代码 + +* 在DevEco Studio中编译原C++的代码生成.so文件;修复原C++的代码,编译生成新的.so文件。可以在工程目录中找到该so,如`build\default\intermediates\libs\default\arm64-v8a\libentry.so`。 +* 在本地OpenHarmony SDK路径的`toolchains`文件夹下查看`diff.exe`。通过该工具,基于新.so文件和旧的.so文件,生成.so的快速修复文件,命令如下: +```shell +$ diff.exe -s Example.z.so -d Example.z.so -p Example.z.so.diff +``` +命令行参数含义: +- -s:旧so的路径 +- -d:新so的路径 +- -p:生成的差分文件的路径 + +## 生成.hqf的快速修复包 + +基于上述的patch.json、.abc快速修复文件和.so快速修复文件,可以通过本地OpenHarmony SDK路径的`toolchains`文件夹下的`app_packing_tool.jar`生成.hqf包,执行打包命令如下: +```shell +$ java -jar app_packing_tool.jar --mode hqf --json-path patch.json --lib-path libs --ets-patch patchs --out-path entry-default-unsigned.hqf --force true +``` + +命令行参数介绍: +| 命令 |说明 | 备注| +| --- | --- |---| +| mode |模式 | 必选| +| json-path|patch.json路径|必选| +| lib-path|.so快速修复文件路径,该路径可参考[快速修复包结构](quickfix-principles.md#快速修复包结构)|可选| +| ets-path|.abc快速修复文件路径|可选| + +## 快速修复包的签名 + +签名与hap签名相同,将上述生成的entry-default-unsigned.hqf包,通过[签名工具](../security/hapsigntool-guidelines.md)进行签名。可以使用本地OpenHarmony SDK路径的`toolchains`文件夹下的`hap-sign-tool.jar`,命令如下: + +```shell +$ java -jar hap-sign-tool.jar sign-app -keyAlias "OpenHarmony Application Release" -signAlg "SHA256withECDSA" -mode "localSign" -appCertFile "OpenHarmonyApplication.pem" -profileFile "ohos_provision_release.p7b" -inFile "entry-default-unsigned.hqf" -keystoreFile "OpenHarmony.p12" -outFile "entry-signed-release.hqf" -keyPwd "123456" -keystorePwd "123456" +``` + +## 安装快速修复包 + +将上述entry-signed-release.hqf包推送到设备上 +```shell +hdc.exe file send .\entry-signed-release.hqf /data/ +``` + +在设备上通过下述命令行安装补丁包 +```shell +$ bm quickfix -a -f /data/entry-signed-release.hqf +``` + +快速修复相关完整命令行参考如下: +``` +$ bm quickfix -h +usage: bm quickfix +options list: +-h, --help list available commands +-q, --query indicates query quickfix, used with -b or --bundle-name +-b, --bundle-name query quickfix status and information by a specified bundle name +-a, --apply indicates apply quickfix, used with -f or --file-path +-f, --file-path apply a quickfix file by a specified path +-f, --file-path ... apply some quickfix files of one bundle +-f, --file-path apply quickfix files by direction, under which are quickfix files +``` diff --git a/zh-cn/application-dev/quick-start/quickfix-principles.md b/zh-cn/application-dev/quick-start/quickfix-principles.md new file mode 100644 index 0000000000000000000000000000000000000000..1be3d8985b7fab4ebc49c69ef8c9599856e514c3 --- /dev/null +++ b/zh-cn/application-dev/quick-start/quickfix-principles.md @@ -0,0 +1,105 @@ +# 快速修复概述 + +快速修复是OpenHarmony系统提供给开发者的一种技术手段,支持开发者以远快于应用升级的方式对应用程序包进行缺陷修复。和全量应用升级软件版本相比,快速修复的主要优势在小、快和用户体验好。在较短的时间内不中断正在运行的应用的情况下(即不需要重启应用),修复应用的缺陷。 + +## 快速修复的使用规则 + +* 仅支持修复应用的TS和C++代码,对应的文件为.abc文件(TS编译后的文件)和.so文件(C++编译后的文件),不支持对资源的修复。 +* 不支持新增.abc文件和.so文件。 +* 快速修复包部署时要确保对应应用包已安装,如果未安装,则部署失败。 +* 快速修复包中配置的包名和应用版本号必须和已安装的包名和版本号应用相同,如果不同则部署失败。 +* 如果已经部署过快速修复包,新部署的快速修复包的版本号必须大于之前快速修复包的版本号,否则部署失败。 +* 快速修复包的签名信息和待修复的应用的签名信息必须一致,否则会部署失败。 +* 新的应用版本发布安装时,会清理掉快速修复包。 + +## 快速修复包结构 + +![快速修复包结构](figures/quick_fix_bundle_struct.png) +
上图是OpenHarmony应用程序发布的快速修复的包格式 +* 从图中可以看出包含两种包格式: + * appqf(Application Quick Fix) +
appqf与应用的app pack包是一一对应关系,具体可参考[应用程序包结构](application-package-structure-stage)的介绍。 + * appqf包是OpenHarmony应用用于发布到应用市场的单元,不能够直接安装到设备上。 + * 它是由一个或多个hqf(Harmony Ability Package Quick Fix)组成,这些hqf包在应用市场会从appqf包中拆分出来,再被分发到具体的设备上。 + * appqf包上架到应用市场前要有开发者的签名信息。签名方式可可参考[Hap包签名工具](../security/hapsigntool-overview.md)的介绍。 + * hqf(Harmony Ability Package Quick Fix) +
hqf包是修复HAP中问题的快速修复包,用于安装到设备上的快速修复单元。一个hqf可以包含.abc的快速修复文件,.so的快速修复文件和描述该包的配置文件。 + * `.abc`文件:应用中修改后的ts代码,编译后生成的字节码文件。 + * `libs`目录:存放.so库文件的差分文件,以`.so.diff`为后缀。区分的不同的系统cpu架构,例如arm平台、x86平台。 + * `patch.json`: +
该文件用于描述hqf包版本信息的配置文件,由开发者填写,具体内容如下: + ```json + { + "app" : { + "bundleName" : "com.ohos.quickfix", + "versionCode" : 1000000, + "versionName" : "1.0.0", + "patchVersionCode" : 1000000, + "patchVersionName" : "1.0.0" + }, + "module" : { + "name" : "entry", + "type" : "patch", + "deviceTypes" : [ + "default", + "tablet" + ], + "originalModuleHash" : "11223344556677889900" + } + } + ``` + 具体字段说明: + | 字段 |类型 |说明 |备注 | + | --- | --- | --- | --- | + |bundleName | string | 对应应用的包名 | 不可缺省 | + |versionCode | int |对应应用版本号 | 不可缺省 | + |versionName |string |对应应用的版本名称 | patch类型不可缺省 | + |patchVersionCode |int |补丁包的版本号 | 不可缺省 | + |patchVersionName |string |补丁包的版本名称 | patch类型不可缺省 | + |name |string |对应应用的moduleName,用来修复该module的 | 不可缺省 | + |type | string|对应补丁包的类型,当前可选择为patch | 不可缺省 | + |deviceTypes |array |补丁包支持的设备类型 | 不可缺省 | + |originalModuleHash| string |原始module Name对应包的哈希值 | 不可缺省 | + +## 快速修复TS编译后的文件 + +![快速修复生成abc](figures/quick_fix_gen_abc.png) + +上图是通过TS代码编译工具生成快速修复.abc文件的流程: +* 原始应用编译时,生成.abc文件和.map文件。.abc是TS代码编译后的字节码文件,应用运行时使用该文件。.map文件是通过TS代码编译工具编译TS代码时生成的中间文件,记录有代码中的函数、类等信息。 +* 修复问题后的应用编译时,根据上述的.map文件,结合当前的TS代码,得到差异部分,根据差异部分生成快速修复的.abc文件。该.abc文件也既是最终要放到hqf包中的快速修复文件。 + +## 快速修复C++编译后的文件 + +![快速修复差分so生成](figures/quick_fix_gen_so.png) + +上图是通过差分工具生成快速修复.so文件的流程: +* 原始应用C++源码通过编译工具生成.so文件,该.so文件供应用在运行时使用。 +* 修复问题后的C++源码通过编译工具生成.so文件,该.so文件和原应用的.so文件通过差分工具生成.so快速修复文件,该.so快速修复文件也既是最终要放到hqf包中的快速修复文件。 + +## 快速修复包的发布部署流程 + +![快速修复包的发布](figures/quick-fix-devel_release.png) + +上图涉及到的模块如下: +* DevEco Studio:用于开发代码的项目工程的集成开发环境。在快速修复的工程中能够给予原应用的代码和修复问题后的代码生成快速修复包,并完成快速修复包的签名。 +* 应用市场服务器端:开发者将开发完成的快速修复包上架到该平台,平台会对上架的包进行签名验证、风险扫描和拆包重签名等,然后分发到客户端。 +* 应用市场客户端:用于接收应用市场服务器端分发的快速修复包,并触发安装快速修复包。 +* 包管理服务:设备上用于管理应用包及快速修复包安装和卸载的系统服务程序。 +* 快速修复引擎:设备上用于管理应用切换使用快速修复包的系统服务程序。如果应用正在运行,快速修复引擎接收到有快速修复包部署完成会通知应用切换快速修复包,进而使得应用使能快速修复包。 +* 文件系统:应用及快速修复包部署在设备上的位置。 + +上图是快速修复包的端到端发布部署流程: +1. 开发者通过DevEco Studio,基于原应用的源码和修复后的源码编译打包生成快速修复包,并通过DevEco Studio完成快速修复包的签名。 +2. 将生成的带有签名的快速修复包上架到应用市场,应用市场通过验证签名、风险扫描和拆包重签名后进行分发。 +3. 设备侧的应用市场客户端检测到应用市场服务器端有新上架的快速修复包会下载最新版本的快速修复包,接着通过系统中的包管理服务来安装部署快速修复包。 +4. 快速修复包部署完成后,再由快速修复引擎触发应用使用快速修复包,进而保证用户使用到问题修复后的功能。 + +## 快速修复包的调试流程 + +![快速修复包的调试](figures/quick-fix-debug.png) + +* DevEco Studio中暂时还没有集成快速修复的能力。当前阶段,OpenHarmony为开发者提供了命令行的调试开发工具可供使用,具体的调试开发流程如下: +1. 基于原应用的源码和修复后的源码,通过命令行工具可以编译生成快速修复包,并通过命令行签名工具完成对快速修复的包的签名。通过命令行调试开发,要对.hqf包签名,并通过命令行工具将.hqf包安装到设备上,.appqf包不能直接安装到设备上。 +2. 通过快速修复的命令行工具,将.hqf包安装部署到设备上。 +3. .hqf包安装部署完成后,回调通知快速修复引擎触发应用使用快速修复包,进而保证用户使用到问题修复后的功能。 \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/Readme-CN.md b/zh-cn/application-dev/reference/apis/Readme-CN.md index 8db81eff1a36d7a5ddf938ae3299fe5401f8c23c..b65ca834fcd8a2540bd7fb6fcee69ff23f79bc98 100755 --- a/zh-cn/application-dev/reference/apis/Readme-CN.md +++ b/zh-cn/application-dev/reference/apis/Readme-CN.md @@ -126,9 +126,22 @@ - [@ohos.commonEvent (公共事件模块)(待停用)](js-apis-commonEvent.md) - [commonEvent-definitions (系统公共事件定义)(待停用)](commonEvent-definitions.md) - [@ohos.notification (Notification模块)(待停用)](js-apis-notification.md) -- application + - application - [EventHub](js-apis-inner-application-eventHub.md) - + - commonEvent + - [CommonEventData](js-apis-inner-commonEvent-commonEventData.md) + - [CommonEventPublishData](js-apis-inner-commonEvent-commonEventPublishData.md) + - [CommonEventSubscriber](js-apis-inner-commonEvent-commonEventSubscriber.md) + - [CommonEventSubscribeInfo](js-apis-inner-commonEvent-commonEventSubscribeInfo.md) + - notification + - [NotificationActionButton](js-apis-inner-notification-notificationActionButton.md) + - [NotificationCommonDef](js-apis-inner-notification-notificationCommonDef.md) + - [NotificationContent](js-apis-inner-notification-notificationContent.md) + - [NotificationFlags](js-apis-inner-notification-notificationFlags.md) + - [NotificationRequest](js-apis-inner-notification-notificationRequest.md) + - [NotificationSlot](js-apis-inner-notification-notificationSlot.md) + - [NotificationTemplate](js-apis-inner-notification-notificationTemplate.md) + - [NotificationUserInput](js-apis-inner-notification-notificationUserInput.md) - 包管理 - [@ohos.bundle.appControl (appControl模块)](js-apis-appControl.md) - [@ohos.bundle.bundleManager (bundleManager模块)](js-apis-bundleManager.md) @@ -188,7 +201,7 @@ - [@ohos.intl (国际化-Intl)](js-apis-intl.md) - [@ohos.resourceManager (资源管理)](js-apis-resource-manager.md) -- 资源调度 +- 后台任务 - [@ohos.distributedMissionManager (分布式任务管理)](js-apis-distributedMissionManager.md) - [@ohos.reminderAgentManager (后台代理提醒)](js-apis-reminderAgentManager.md) - [@ohos.resourceschedule.backgroundTaskManager (后台任务管理)](js-apis-resourceschedule-backgroundTaskManager.md) diff --git a/zh-cn/application-dev/reference/apis/js-apis-Bundle.md b/zh-cn/application-dev/reference/apis/js-apis-Bundle.md index b35be539bcbb12b2dc1b9d8d80879622aa8982e7..88a933f14307b125ddcd79a8a6e9921f9041ce8e 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-Bundle.md +++ b/zh-cn/application-dev/reference/apis/js-apis-Bundle.md @@ -156,7 +156,7 @@ bundle.getApplicationInfo(bundleName, bundleFlags, (err, data) => { > 从API version 9开始不再维护,建议使用[bundleManager.getAllBundleInfo](js-apis-bundleManager.md#bundlemanagergetallbundleinfo)替代。 -getAllBundleInfo(bundleFlag: BundleFlag, userId?: number): Promise> +getAllBundleInfo(bundleFlag: BundleFlag, userId?: number): Promise\\> 以异步方法获取指定用户所有的BundleInfo,使用Promise形式异步回调, @@ -199,7 +199,7 @@ bundle.getAllBundleInfo(bundleFlag, userId) > 从API version 9开始不再维护,建议使用[bundleManager.getAllBundleInfo](js-apis-bundleManager.md#bundlemanagergetallbundleinfo)替代。 -getAllBundleInfo(bundleFlag: BundleFlag, callback: AsyncCallback>): void +getAllBundleInfo(bundleFlag: BundleFlag, callback: AsyncCallback\\>): void 以异步方法获取当前用户所有的BundleInfo,使用callback形式返回结果。 @@ -236,7 +236,7 @@ bundle.getAllBundleInfo(bundleFlag, (err, data) => { > 从API version 9开始不再维护,建议使用[bundleManager.getAllBundleInfo](js-apis-bundleManager.md#bundlemanagergetallbundleinfo)替代。 -getAllBundleInfo(bundleFlag: BundleFlag, userId: number, callback: AsyncCallback>): void +getAllBundleInfo(bundleFlag: BundleFlag, userId: number, callback: AsyncCallback\\>): void 以异步方法获取系统中指定用户下所有的BundleInfo,使用callback形式返回结果。 @@ -822,7 +822,7 @@ bundle.getPermissionDef(permissionName).then((data) => { > 从API version 9开始不再维护,建议使用[bundleManager.getAllApplicationInfo](js-apis-bundleManager.md#bundlemanagergetallapplicationinfo)替代。 -getAllApplicationInfo(bundleFlags: number, userId?: number): Promise> +getAllApplicationInfo(bundleFlags: number, userId?: number): Promise\\> 获取指定用户下所有已安装的应用信息,使用promise异步回调。 @@ -864,7 +864,7 @@ bundle.getAllApplicationInfo(bundleFlags, userId) > 从API version 9开始不再维护,建议使用[bundleManager.getAllApplicationInfo](js-apis-bundleManager.md#bundlemanagergetallapplicationinfo)替代。 -getAllApplicationInfo(bundleFlags: number, userId: number, callback: AsyncCallback>): void +getAllApplicationInfo(bundleFlags: number, userId: number, callback: AsyncCallback\\>): void 获取指定用户下所有已安装的应用信息,使用callback异步回调。 @@ -1320,7 +1320,7 @@ bundle.isApplicationEnabled(bundleName, (err, data) => { > 从API version 9开始不再维护,建议使用[bundleManager.queryAbilityInfo](js-apis-bundleManager.md#bundlemanagerqueryabilityinfo)替代。 -queryAbilityByWant(want: Want, bundleFlags: number, userId?: number): Promise> +queryAbilityByWant(want: Want, bundleFlags: number, userId?: number): Promise\\> 以异步方法根据给定的意图获取Ability组件信息,使用Promise形式返回结果。 @@ -1371,7 +1371,7 @@ bundle.queryAbilityByWant(want, bundleFlags, userId) > 从API version 9开始不再维护,建议使用[bundleManager.queryAbilityInfo](js-apis-bundleManager.md#bundlemanagerqueryabilityinfo)替代。 -queryAbilityByWant(want: Want, bundleFlags: number, userId: number, callback: AsyncCallback>): void +queryAbilityByWant(want: Want, bundleFlags: number, userId: number, callback: AsyncCallback\\>): void 以异步方法根据给定的意图获取指定用户下Ability信息,使用callback形式返回结果。 @@ -1416,7 +1416,7 @@ bundle.queryAbilityByWant(want, bundleFlags, userId, (err, data) => { > 从API version 9开始不再维护,建议使用[bundleManager.queryAbilityInfo](js-apis-bundleManager.md#bundlemanagerqueryabilityinfo)替代。 -queryAbilityByWant(want: Want, bundleFlags: number, callback: AsyncCallback>): void; +queryAbilityByWant(want: Want, bundleFlags: number, callback: AsyncCallback\\>): void; 以异步方法根据给定的意图获取Ability信息,使用callback形式返回结果。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-abilityAccessCtrl.md b/zh-cn/application-dev/reference/apis/js-apis-abilityAccessCtrl.md index 3e93253480cb071eba7467c27ed02be3bb69c496..e9c6972cbf1a3f8e6ef84bf726c0b0c45636d64f 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-abilityAccessCtrl.md +++ b/zh-cn/application-dev/reference/apis/js-apis-abilityAccessCtrl.md @@ -123,7 +123,7 @@ console.log(`data->${JSON.stringify(data)}`); ### grantUserGrantedPermission -grantUserGrantedPermission(tokenID: number, permissionName: Permissions, permissionFlag: number): Promise<void> +grantUserGrantedPermission(tokenID: number, permissionName: Permissions, permissionFlags: number): Promise<void> 授予应用user grant权限。使用Promise异步回调。 @@ -139,7 +139,7 @@ grantUserGrantedPermission(tokenID: number, permissionName: Permissions, permiss | --------- | ------------------- | ---- | ------------------------------------------------------------ | | tokenID | number | 是 | 目标应用的身份标识。可通过应用的[ApplicationInfo](js-apis-bundleManager-applicationInfo.md)获得。 | | permissionName | Permissions | 是 | 被授予的权限名称,合法的权限名取值可在[系统权限定义列表](../../security/permission-list.md)中查询。 | -| permissionFlag | number | 是 | 授权选项,1表示下次仍需弹窗,2表示允许、禁止后不再提醒,3表示系统授权不允许更改。 | +| permissionFlags | number | 是 | 授权选项
- 0表示权限未经过用户主动设置。
- 1表示当次用户若选择禁止该权限,下次权限弹窗仍可以弹出申请用户授权。
- 2表示当次用户若选择禁止该权限,下次不会再弹出权限弹窗,需要用户在setting的权限管理中进行授权。
- 4表示当次权限设置为系统授权,用户不可更改这个权限授权状态。 | **返回值:** @@ -166,9 +166,9 @@ import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; let atManager = abilityAccessCtrl.createAtManager(); let tokenID = 0; // 系统应用可以通过bundleManager.getApplicationInfo获取,普通应用可以通过bundleManager.getBundleInfoForSelf获取 -let permissionFlag = 1; +let permissionFlags = 1; try { - atManager.grantUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", permissionFlag).then(() => { + atManager.grantUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", permissionFlags).then(() => { console.log('grantUserGrantedPermission success'); }).catch((err) => { console.log(`grantUserGrantedPermission fail, err->${JSON.stringify(err)}`); @@ -180,7 +180,7 @@ try { ### grantUserGrantedPermission -grantUserGrantedPermission(tokenID: number, permissionName: Permissions, permissionFlag: number, callback: AsyncCallback<void>): void +grantUserGrantedPermission(tokenID: number, permissionName: Permissions, permissionFlags: number, callback: AsyncCallback<void>): void 授予应用user grant权限。使用callback异步回调。 @@ -196,7 +196,7 @@ grantUserGrantedPermission(tokenID: number, permissionName: Permissions, permiss | --------- | ------------------- | ---- | ------------------------------------------------------------ | | tokenID | number | 是 | 目标应用的身份标识。可通过应用的[ApplicationInfo](js-apis-bundleManager-applicationInfo.md)获得。| | permissionName | Permissions | 是 | 被授予的权限名称,合法的权限名取值可在[系统权限定义列表](../../security/permission-list.md)中查询。 | -| permissionFlag | number | 是 | 授权选项,1表示下次仍需弹窗,2表示允许、禁止后不再提醒,3表示系统授权不允许更改。 | +| permissionFlags | number | 是 | 授权选项
- 0表示权限未经过用户主动设置。
- 1表示当次用户若选择禁止该权限,下次权限弹窗仍可以弹出申请用户授权。
- 2表示当次用户若选择禁止该权限,下次不会再弹出权限弹窗,需要用户在setting的权限管理中进行授权。
- 4表示当次权限设置为系统授权,用户不可更改这个权限授权状态。 | | callback | AsyncCallback<void> | 是 | 授予应用user grant权限。当授予权限成功时,err为undefine;否则为错误对象。 | **错误码:** @@ -218,9 +218,9 @@ import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; let atManager = abilityAccessCtrl.createAtManager(); let tokenID = 0; // 系统应用可以通过bundleManager.getApplicationInfo获取,普通应用可以通过bundleManager.getBundleInfoForSelf获取 -let permissionFlag = 1; +let permissionFlags = 1; try { - atManager.grantUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", permissionFlag, (err, data) => { + atManager.grantUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", permissionFlags, (err, data) => { if (err) { console.log(`grantUserGrantedPermission fail, err->${JSON.stringify(err)}`); } else { @@ -234,7 +234,7 @@ try { ### revokeUserGrantedPermission -revokeUserGrantedPermission(tokenID: number, permissionName: Permissions, permissionFlag: number): Promise<void> +revokeUserGrantedPermission(tokenID: number, permissionName: Permissions, permissionFlags: number): Promise<void> 撤销应用user grant权限。使用Promise异步回调。 @@ -250,7 +250,7 @@ revokeUserGrantedPermission(tokenID: number, permissionName: Permissions, permis | --------- | ------------------- | ---- | ------------------------------------------------------------ | | tokenID | number | 是 | 目标应用的身份标识。可通过应用的[ApplicationInfo](js-apis-bundleManager-applicationInfo.md)获得。 | | permissionName | Permissions | 是 | 被撤销的权限名称,合法的权限名取值可在[系统权限定义列表](../../security/permission-list.md)中查询。 | -| permissionFlag | number | 是 | 授权选项,1表示下次仍需弹窗,2表示允许、禁止后不再提醒,3表示系统授权不允许更改。 | +| permissionFlags | number | 是 | 授权选项
- 0表示权限未经过用户主动设置。
- 1表示当次用户若选择禁止该权限,下次权限弹窗仍可以弹出申请用户授权。
- 2表示当次用户若选择禁止该权限,下次不会再弹出权限弹窗,需要用户在setting的权限管理中进行授权。
- 4表示当次权限设置为系统授权,用户不可更改这个权限授权状态。 | **返回值:** @@ -277,9 +277,9 @@ import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; let atManager = abilityAccessCtrl.createAtManager(); let tokenID = 0; // 系统应用可以通过bundleManager.getApplicationInfo获取,普通应用可以通过bundleManager.getBundleInfoForSelf获取 -let permissionFlag = 1; +let permissionFlags = 1; try { - atManager.revokeUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", permissionFlag).then(() => { + atManager.revokeUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", permissionFlags).then(() => { console.log('revokeUserGrantedPermission success'); }).catch((err) => { console.log(`revokeUserGrantedPermission fail, err->${JSON.stringify(err)}`); @@ -291,7 +291,7 @@ try { ### revokeUserGrantedPermission -revokeUserGrantedPermission(tokenID: number, permissionName: Permissions, permissionFlag: number, callback: AsyncCallback<void>): void +revokeUserGrantedPermission(tokenID: number, permissionName: Permissions, permissionFlags: number, callback: AsyncCallback<void>): void 撤销应用user grant权限。使用callback异步回调。 @@ -307,7 +307,7 @@ revokeUserGrantedPermission(tokenID: number, permissionName: Permissions, permis | --------- | ------------------- | ---- | ------------------------------------------------------------ | | tokenID | number | 是 | 目标应用的身份标识。可通过应用的[ApplicationInfo](js-apis-bundleManager-applicationInfo.md)获得。 | | permissionName | Permissions | 是 | 被撤销的权限名称,合法的权限名取值可在[系统权限定义列表](../../security/permission-list.md)中查询。 | -| permissionFlag | number | 是 | 授权选项,1表示下次仍需弹窗,2表示允许、禁止后不再提醒,3表示系统授权不允许更改。 | +| permissionFlags | number | 是 | 授权选项
- 0表示权限未经过用户主动设置。
- 1表示当次用户若选择禁止该权限,下次权限弹窗仍可以弹出申请用户授权。
- 2表示当次用户若选择禁止该权限,下次不会再弹出权限弹窗,需要用户在setting的权限管理中进行授权。
- 4表示当次权限设置为系统授权,用户不可更改这个权限授权状态。 | | callback | AsyncCallback<void> | 是 | 撤销应用user grant权限。当撤销权限成功时,err为undefine;否则为错误对象。 | **错误码:** @@ -329,9 +329,9 @@ import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; let atManager = abilityAccessCtrl.createAtManager(); let tokenID = 0; // 系统应用可以通过bundleManager.getApplicationInfo获取,普通应用可以通过bundleManager.getBundleInfoForSelf获取 -let permissionFlag = 1; +let permissionFlags = 1; try { - atManager.revokeUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", permissionFlag, (err, data) => { + atManager.revokeUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", permissionFlags, (err, data) => { if (err) { console.log(`revokeUserGrantedPermission fail, err->${JSON.stringify(err)}`); } else { @@ -426,7 +426,7 @@ promise.then(data => { ### on9+ -on(type: 'permissionStateChange', tokenIDList: Array<number>, permissionNameList: Array<Permissions>, callback: Callback<PermissionStateChangeInfo>): void; +on(type: 'permissionStateChange', tokenIDList: Array<number>, permissionList: Array<Permissions>, callback: Callback<PermissionStateChangeInfo>): void; 订阅指定tokenId列表与权限列表的权限状态变更事件。 @@ -442,7 +442,7 @@ on(type: 'permissionStateChange', tokenIDList: Array<number>, permissionNa | ------------------ | --------------------- | ---- | ------------------------------------------------------------ | | type | string | 是 | 订阅事件类型,固定为'permissionStateChange',权限状态变更事件。 | | tokenIDList | Array<number> | 是 | 订阅的tokenId列表,为空时表示订阅所有的应用的权限状态变化。 | -| permissionNameList | Array<Permissions> | 是 | 订阅的权限名列表,为空时表示订阅所有的权限状态变化。 | +| permissionList | Array<Permissions> | 是 | 订阅的权限名列表,为空时表示订阅所有的权限状态变化。 | | callback | Callback<[PermissionStateChangeInfo](#permissionstatechangeinfo9)> | 是 | 订阅指定tokenId与指定权限名状态变更事件的回调。| **错误码:** @@ -461,13 +461,14 @@ on(type: 'permissionStateChange', tokenIDList: Array<number>, permissionNa ```js import abilityAccessCtrl, {Permissions} from '@ohos.abilityAccessCtrl'; +import bundle from '@ohos.bundle.bundleManager'; let atManager = abilityAccessCtrl.createAtManager(); let appInfo = bundle.getApplicationInfoSync('com.example.myapplication', 0, 100); let tokenIDList: Array = [appInfo.accessTokenId]; -let permissionNameList: Array = ["ohos.permission.DISTRIBUTED_DATASYNC"]; +let permissionList: Array = ["ohos.permission.DISTRIBUTED_DATASYNC"]; try { - atManager.on('permissionStateChange', tokenIDList, permissionNameList, (data) => { + atManager.on('permissionStateChange', tokenIDList, permissionList, (data) => { console.debug("receive permission state change, data:" + JSON.stringify(data)); }); } catch(err) { @@ -477,7 +478,7 @@ try { ### off9+ -off(type: 'permissionStateChange', tokenIDList: Array<number>, permissionNameList: Array<Permissions>, callback?: Callback<PermissionStateChangeInfo>): void; +off(type: 'permissionStateChange', tokenIDList: Array<number>, permissionList: Array<Permissions>, callback?: Callback<PermissionStateChangeInfo>): void; 取消订阅指定tokenId列表与权限列表的权限状态变更事件,使用callback回调异步返回结果。 @@ -493,7 +494,7 @@ off(type: 'permissionStateChange', tokenIDList: Array<number>, permissionN | ------------------ | --------------------- | ---- | ------------------------------------------------------------ | | type | string | 是 | 订阅事件类型,固定为'permissionStateChange',权限状态变更事件。 | | tokenIDList | Array<number> | 是 | 订阅的tokenId列表,为空时表示订阅所有的应用的权限状态变化,必须与on的输入一致。 | -| permissionNameList | Array<Permissions> | 是 | 订阅的权限名列表,为空时表示订阅所有的权限状态变化,必须与on的输入一致。 | +| permissionList | Array<Permissions> | 是 | 订阅的权限名列表,为空时表示订阅所有的权限状态变化,必须与on的输入一致。 | | callback | Callback<[PermissionStateChangeInfo](#permissionstatechangeinfo9)> | 否 | 取消订阅指定tokenId与指定权限名状态变更事件的回调。| **错误码:** @@ -502,8 +503,8 @@ off(type: 'permissionStateChange', tokenIDList: Array<number>, permissionN | 错误码ID | 错误信息 | | -------- | -------- | -| 12100001 | The parameter is invalid. The tokenID in list is all invalid | -| 12100004 | The interface is not used with | +| 12100001 | The parameter is invalid. The tokenID in list is all invalid. | +| 12100004 | The interface is not used together with "on". | | 12100007 | Service is abnormal. | | 12100008 | Out of memory. | @@ -511,13 +512,14 @@ off(type: 'permissionStateChange', tokenIDList: Array<number>, permissionN ```js import abilityAccessCtrl, {Permissions} from '@ohos.abilityAccessCtrl'; +import bundle from '@ohos.bundle.bundleManager'; let atManager = abilityAccessCtrl.createAtManager(); let appInfo = bundle.getApplicationInfoSync('com.example.myapplication', 0, 100); let tokenIDList: Array = [appInfo.accessTokenId]; -let permissionNameList: Array = ["ohos.permission.DISTRIBUTED_DATASYNC"]; +let permissionList: Array = ["ohos.permission.DISTRIBUTED_DATASYNC"]; try { - atManager.off('permissionStateChange', tokenIDList, permissionNameList); + atManager.off('permissionStateChange', tokenIDList, permissionList); } catch(err) { console.log(`catch err->${JSON.stringify(err)}`); } @@ -561,7 +563,7 @@ promise.then(data => { ### requestPermissionsFromUser9+ -requestPermissionsFromUser(context: Context, permissions: Array<Permissions>, requestCallback: AsyncCallback<PermissionRequestResult>) : void; +requestPermissionsFromUser(context: Context, permissionList: Array<Permissions>, requestCallback: AsyncCallback<PermissionRequestResult>) : void; 用于拉起弹框请求用户授权。使用callback异步回调。 @@ -574,7 +576,7 @@ requestPermissionsFromUser(context: Context, permissions: Array<Permissions&g | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | context | Context | 是 | 请求权限的应用ability上下文context。 | -| permissions | Array<Permissions> | 是 | 权限名列表,合法的权限名取值可在[系统权限定义列表](../../security/permission-list.md)中查询。 | +| permissionList | Array<Permissions> | 是 | 权限名列表,合法的权限名取值可在[系统权限定义列表](../../security/permission-list.md)中查询。 | | callback | AsyncCallback<[PermissionRequestResult](js-apis-permissionrequestresult.md)> | 是 | 回调函数,返回接口调用是否成功的结果。 | **错误码:** @@ -582,7 +584,7 @@ requestPermissionsFromUser(context: Context, permissions: Array<Permissions&g 以下错误码的详细介绍请参见[程序访问控制错误码](../errorcodes/errorcode-access-token.md)。 | 错误码ID | 错误信息 | | -------- | -------- | -| 12100001 | Parameter invalid. | +| 12100001 | The parameter is invalid. The context is invalid when it does not belong to the application itself. | **示例:** @@ -602,7 +604,7 @@ try { ### requestPermissionsFromUser9+ -requestPermissionsFromUser(context: Context, permissions: Array<Permissions>) : Promise<PermissionRequestResult>; +requestPermissionsFromUser(context: Context, permissionList: Array<Permissions>) : Promise<PermissionRequestResult>; 用于拉起弹框请求用户授权。使用promise异步回调。 @@ -615,7 +617,7 @@ requestPermissionsFromUser(context: Context, permissions: Array<Permissions&g | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | context | Context | 是 | 请求权限的应用ability上下文context。 | -| permissions | Array<Permissions> | 是 | 需要校验的权限名称,合法的权限名取值可在[系统权限定义列表](../../security/permission-list.md)中查询。 | +| permissionList | Array<Permissions> | 是 | 需要校验的权限名称,合法的权限名取值可在[系统权限定义列表](../../security/permission-list.md)中查询。 | **返回值:** @@ -628,7 +630,7 @@ requestPermissionsFromUser(context: Context, permissions: Array<Permissions&g 以下错误码的详细介绍请参见[程序访问控制错误码](../errorcodes/errorcode-access-token.md)。 | 错误码ID | 错误信息 | | -------- | -------- | -| 12100001 | Parameter invalid. | +| 12100001 | The parameter is invalid. The context is invalid when it does not belong to the application itself. | **示例:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-appAccount.md b/zh-cn/application-dev/reference/apis/js-apis-appAccount.md index 35992e253477606b3b98c1b5684e924f7f35b822..c07e542b03e6e319c220630562dd501b250825de 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-appAccount.md +++ b/zh-cn/application-dev/reference/apis/js-apis-appAccount.md @@ -4917,9 +4917,9 @@ checkAccountLabels(name: string, labels: Array<string>, callback: AuthCall | labels | Array<string> | 是 | 标签数组。 | | callback | [AuthCallback](#authcallback9) | 是 | 认证器回调,用于返回检查结果。 | -### isAccountRemovable9+ +### checkAccountRemovable9+ -isAccountRemovable(name: string, callback: AuthCallback): void; +checkAccountRemovable(name: string, callback: AuthCallback): void; 判断帐号是否可以删除,并使用callback异步回调返回结果。 @@ -4977,7 +4977,7 @@ getRemoteObject(): rpc.RemoteObject; callback.onResult(account_appAccount.ResultCode.SUCCESS, result); } - isAccountRemovable(name, callback) { + checkAccountRemovable(name, callback) { var result = {[account_appAccount.Constants.KEY_BOOLEAN_RESULT]: true}; callback.onResult(account_appAccount.ResultCode.SUCCESS, result); } diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-accessibilityExtensionAbility.md b/zh-cn/application-dev/reference/apis/js-apis-application-accessibilityExtensionAbility.md index bb37534a86ff2831456083701d8fd21d39e1389a..d83bfe08bb64c405f5ed4e5b3de2bde89c1a4399 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-accessibilityExtensionAbility.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-accessibilityExtensionAbility.md @@ -42,22 +42,22 @@ import AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtens | 名称 | 描述 | | ------------- | ------------ | -| left | 表示向左的手势。 | -| leftThenRight | 表示先向左再向右的手势。 | -| leftThenUp | 表示先向左再向上的手势。 | -| leftThenDown | 表示先向左再向下的手势。 | -| right | 表示向右的手势。 | -| rightThenLeft | 表示先向右再向左的手势。 | -| rightThenUp | 表示先向右再向上的手势。 | -| rightThenDown | 表示先向右再向下的手势。 | -| up | 表示向上的手势。 | -| upThenLeft | 表示先向上再向左的手势。 | -| upThenRight | 表示先向上再向右的手势。 | -| upThenDown | 表示先向上再向下的手势。 | -| down | 表示向下的手势。 | -| downThenLeft | 表示先向下再向左的手势。 | -| downThenRight | 表示先向下再向右的手势。 | -| downThenUp | 表示先向下再向上的手势。 | +| left | 类型为字符串,表示向左的手势。 | +| leftThenRight | 类型为字符串,表示先向左再向右的手势。 | +| leftThenUp | 类型为字符串,表示先向左再向上的手势。 | +| leftThenDown | 类型为字符串,表示先向左再向下的手势。 | +| right | 类型为字符串,表示向右的手势。 | +| rightThenLeft | 类型为字符串,表示先向右再向左的手势。 | +| rightThenUp | 类型为字符串,表示先向右再向上的手势。 | +| rightThenDown | 类型为字符串,表示先向右再向下的手势。 | +| up | 类型为字符串,表示向上的手势。 | +| upThenLeft | 类型为字符串,表示先向上再向左的手势。 | +| upThenRight | 类型为字符串,表示先向上再向右的手势。 | +| upThenDown | 类型为字符串,表示先向上再向下的手势。 | +| down | 类型为字符串,表示向下的手势。 | +| downThenLeft | 类型为字符串,表示先向下再向左的手势。 | +| downThenRight | 类型为字符串,表示先向下再向右的手势。 | +| downThenUp | 类型为字符串,表示先向下再向上的手势。 | ## PageUpdateType @@ -67,8 +67,8 @@ import AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtens | 名称 | 描述 | | ----------------- | --------- | -| pageContentUpdate | 表示页面内容刷新。 | -| pageStateUpdate | 表示页面状态刷新。 | +| pageContentUpdate | 类型为字符串,表示页面内容刷新。 | +| pageStateUpdate | 类型为字符串,表示页面状态刷新。 | ## TouchGuideType @@ -78,8 +78,8 @@ import AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtens | 名称 | 描述 | | ---------- | ------------ | -| touchBegin | 表示触摸浏览时开始触摸。 | -| touchEnd | 表示触摸浏览时结束触摸。 | +| touchBegin | 类型为字符串,表示触摸浏览时开始触摸。 | +| touchEnd | 类型为字符串,表示触摸浏览时结束触摸。 | ## AccessibilityExtensionAbility.onConnect diff --git a/zh-cn/application-dev/reference/apis/js-apis-audio.md b/zh-cn/application-dev/reference/apis/js-apis-audio.md index a147cdf9888d5fb9f2a864fc3745302c8bc04beb..da9ebd7910c30838f31cfa03dd995549846759cb 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-audio.md +++ b/zh-cn/application-dev/reference/apis/js-apis-audio.md @@ -4533,15 +4533,15 @@ let filePath = path + '/StarWars10s-2C-48000-4SW.wav'; let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY); let stat = await fs.stat(path); let buf = new ArrayBuffer(bufferSize); -let len = stat.size % this.bufferSize == 0 ? Math.floor(stat.size / this.bufferSize) : Math.floor(stat.size / this.bufferSize + 1); +let len = stat.size % bufferSize == 0 ? Math.floor(stat.size / bufferSize) : Math.floor(stat.size / bufferSize + 1); for (let i = 0;i < len; i++) { let options = { - offset: i * this.bufferSize, - length: this.bufferSize + offset: i * bufferSize, + length: bufferSize } let readsize = await fs.read(file.fd, buf, options) let writeSize = await new Promise((resolve,reject)=>{ - this.audioRenderer.write(buf,(err,writeSize)=>{ + audioRenderer.write(buf,(err,writeSize)=>{ if(err){ reject(err) }else{ @@ -4586,15 +4586,15 @@ let filePath = path + '/StarWars10s-2C-48000-4SW.wav'; let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY); let stat = await fs.stat(path); let buf = new ArrayBuffer(bufferSize); -let len = stat.size % this.bufferSize == 0 ? Math.floor(stat.size / this.bufferSize) : Math.floor(stat.size / this.bufferSize + 1); +let len = stat.size % bufferSize == 0 ? Math.floor(stat.size / bufferSize) : Math.floor(stat.size / bufferSize + 1); for (let i = 0;i < len; i++) { let options = { - offset: i * this.bufferSize, - length: this.bufferSize + offset: i * bufferSize, + length: bufferSize } let readsize = await fs.read(file.fd, buf, options) try{ - let writeSize = await this.audioRenderer.write(buf); + let writeSize = await audioRenderer.write(buf); } catch(err) { console.error(`audioRenderer.write err: ${err}`); } diff --git a/zh-cn/application-dev/reference/apis/js-apis-avsession.md b/zh-cn/application-dev/reference/apis/js-apis-avsession.md index 2c34a0244668b9b6bd9df550d095a47218f93f2d..c66da322f6c62a2e6746b440a60f29d18d80bfdc 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-avsession.md +++ b/zh-cn/application-dev/reference/apis/js-apis-avsession.md @@ -24,6 +24,8 @@ createAVSession(context: Context, tag: string, type: AVSessionType): Promise\ void): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -531,6 +537,8 @@ off(type: 'sessionServiceDie', callback?: () => void): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -763,6 +771,8 @@ avSession.sendSystemControlCommand(avcommand, function (err) { **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + | 名称 | 类型 | 可读 | 可写 | 说明 | | :-------- | :----- | :--- | :--- | :---------------------------- | @@ -782,6 +792,8 @@ setAVMetadata(data: AVMetadata): Promise\ **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -836,6 +848,8 @@ setAVMetadata(data: AVMetadata, callback: AsyncCallback\): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -887,6 +901,8 @@ setAVPlaybackState(state: AVPlaybackState): Promise\ **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -933,6 +949,8 @@ setAVPlaybackState(state: AVPlaybackState, callback: AsyncCallback\): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -976,6 +994,8 @@ setLaunchAbility(ability: WantAgent): Promise\ **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -1046,6 +1066,8 @@ setLaunchAbility(ability: WantAgent, callback: AsyncCallback\): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -1113,6 +1135,8 @@ getController(): Promise\ **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **返回值:** | 类型 | 说明 | @@ -1147,6 +1171,8 @@ getController(callback: AsyncCallback\): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -1183,6 +1209,8 @@ getOutputDevice(): Promise\ **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **返回值:** | 类型 | 说明 | @@ -1215,6 +1243,8 @@ getOutputDevice(callback: AsyncCallback\): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -1249,6 +1279,8 @@ activate(): Promise\ **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **返回值:** | 类型 | 说明 | @@ -1281,6 +1313,8 @@ activate(callback: AsyncCallback\): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -1315,6 +1349,8 @@ deactivate(): Promise\ **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **返回值:** | 类型 | 说明 | @@ -1349,6 +1385,8 @@ deactivate(callback: AsyncCallback\): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -1383,6 +1421,8 @@ destroy(): Promise\ **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **返回值:** | 类型 | 说明 | @@ -1413,9 +1453,10 @@ destroy(callback: AsyncCallback\): void 销毁当前会话,使当前会话完全失效。结果通过callback异步回调方式返回。 - **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -1450,6 +1491,8 @@ on(type: 'play'|'pause'|'stop'|'playNext'|'playPrevious'|'fastForward'|'rewind', **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -1499,6 +1542,8 @@ on(type: 'seek', callback: (time: number) => void): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -1530,6 +1575,8 @@ on(type: 'setSpeed', callback: (speed: number) => void): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -1561,6 +1608,8 @@ on(type: 'setLoopMode', callback: (mode: LoopMode) => void): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -1592,6 +1641,8 @@ on(type: 'toggleFavorite', callback: (assetId: string) => void): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -1623,6 +1674,8 @@ on(type: 'handleKeyEvent', callback: (event: KeyEvent) => void): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -1654,6 +1707,8 @@ on(type: 'outputDeviceChange', callback: (device: OutputDeviceInfo) => void): vo **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -1685,6 +1740,8 @@ off(type: 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -1720,6 +1777,8 @@ off(type: 'seek', callback?: (time: number) => void): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -1749,6 +1808,8 @@ off(type: 'setSpeed', callback?: (speed: number) => void): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -1778,6 +1839,8 @@ off(type: 'setLoopMode', callback?: (mode: LoopMode) => void): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -1807,6 +1870,8 @@ off(type: 'toggleFavorite', callback?: (assetId: string) => void): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -1836,6 +1901,8 @@ off(type: 'handleKeyEvent', callback?: (event: KeyEvent) => void): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -1865,6 +1932,8 @@ off(type: 'outputDeviceChange', callback?: (device: OutputDeviceInfo) => void): **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -1896,6 +1965,7 @@ session.off('outputDeviceChange'); **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 | 名称 | 类型 | 可读 | 可写 | 说明 | | :-------- | :----- | :--- | :--- | :-------------------------------------- | @@ -1920,6 +1990,8 @@ getAVPlaybackState(): Promise\ **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **返回值:** | 类型 | 说明 | @@ -1952,6 +2024,8 @@ getAVPlaybackState(callback: AsyncCallback\): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -1986,6 +2060,8 @@ getAVMetadata(): Promise\ **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **返回值:** | 类型 | 说明 | @@ -2018,6 +2094,8 @@ getAVMetadata(callback: AsyncCallback\): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2052,6 +2130,8 @@ getOutputDevice(): Promise\ **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **返回值:** | 类型 | 说明 | @@ -2083,6 +2163,8 @@ getOutputDevice(callback: AsyncCallback\): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2117,6 +2199,8 @@ sendAVKeyEvent(event: KeyEvent): Promise\ **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2161,6 +2245,8 @@ sendAVKeyEvent(event: KeyEvent, callback: AsyncCallback\): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2202,6 +2288,8 @@ getLaunchAbility(): Promise\ **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **返回值:** | 类型 | 说明 | @@ -2237,6 +2325,8 @@ getLaunchAbility(callback: AsyncCallback\): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2274,6 +2364,8 @@ getRealPlaybackPositionSync(): number **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **返回值:** | 类型 | 说明 | @@ -2302,6 +2394,8 @@ isActive(): Promise\ **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **返回值:** | 类型 | 说明 | @@ -2335,6 +2429,8 @@ isActive(callback: AsyncCallback\): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2370,6 +2466,8 @@ destroy(): Promise\ **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **返回值:** | 类型 | 说明 | @@ -2402,6 +2500,8 @@ destroy(callback: AsyncCallback\): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2436,6 +2536,8 @@ getValidCommands(): Promise\> **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **返回值:** | 类型 | 说明 | @@ -2469,6 +2571,8 @@ getValidCommands(callback: AsyncCallback\>): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2504,6 +2608,8 @@ sendControlCommand(command: AVControlCommand): Promise\ **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2557,6 +2663,8 @@ sendControlCommand(command: AVControlCommand, callback: AsyncCallback\): v **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2607,6 +2715,8 @@ on(type: 'metadataChange', filter: Array\ | 'all', callback: ( **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2644,6 +2754,8 @@ on(type: 'playbackStateChange', filter: Array\ | 'all', c **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2681,6 +2793,8 @@ on(type: 'sessionDestroy', callback: () => void) **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2712,6 +2826,8 @@ on(type: 'activeStateChange', callback: (isActive: boolean) => void) **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2743,6 +2859,8 @@ on(type: 'validCommandChange', callback: (commands: Array\ **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2775,6 +2893,8 @@ on(type: 'outputDeviceChange', callback: (device: OutputDeviceInfo) => void): vo **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2806,6 +2926,8 @@ off(type: 'metadataChange', callback?: (data: AVMetadata) => void) **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2834,6 +2956,8 @@ off(type: 'playbackStateChange', callback?: (state: AVPlaybackState) => void) **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2862,6 +2986,8 @@ off(type: 'sessionDestroy', callback?: () => void) **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2890,6 +3016,8 @@ off(type: 'activeStateChange', callback?: (isActive: boolean) => void) **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2918,6 +3046,8 @@ off(type: 'validCommandChange', callback?: (commands: Array\ void): **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2987,6 +3119,8 @@ controller.off('outputDeviceChange'); **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口。 + | 名称 | 类型 | 说明 | | ----- | ------ | ---- | | audio | string | 音频 | @@ -3016,6 +3150,8 @@ controller.off('outputDeviceChange'); **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + | 名称 | 类型 | 说明 | | -------------- | ------ | ------------ | | play | string | 播放 | @@ -3036,6 +3172,8 @@ controller.off('outputDeviceChange'); **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + | 名称 | 类型 | 必填 | 说明 | | --------- | ------------------------------------------------- | ---- | -------------- | | command | [AVControlCommandType](#avcontrolcommandtype) | 是 | 命令 | @@ -3047,6 +3185,8 @@ controller.off('outputDeviceChange'); **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + | 名称 | 类型 | 必填 | 说明 | | --------------- |-------------------------| ---- |---------------------------------------------------------------------| | assetId | string | 是 | 媒体ID。 | @@ -3071,6 +3211,8 @@ controller.off('outputDeviceChange'); **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + | 名称 | 类型 | 必填 | 说明 | | ------------ | ------------------------------------- | ---- | ------- | | state | [PlaybackState](#playbackstate) | 否 | 播放状态 | @@ -3086,6 +3228,8 @@ controller.off('outputDeviceChange'); **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + | 名称 | 类型 | 必填 | 说明 | | ----------- | ------ | ---- | ------------------ | | elapsedTime | number | 是 | 已用时间,单位毫秒(ms)。 | @@ -3097,6 +3241,8 @@ controller.off('outputDeviceChange'); **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + | 名称 | 类型 | 必填 | 说明 | | ---------- | -------------- | ---- | ---------------------- | | isRemote | boolean | 是 | 设备是否连接。 | @@ -3109,6 +3255,8 @@ controller.off('outputDeviceChange'); **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + | 名称 | 值 | 说明 | | --------------------------- | ---- | ----------- | | PLAYBACK_STATE_INITIAL | 0 | 初始状态 | @@ -3126,6 +3274,8 @@ controller.off('outputDeviceChange'); **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + | 名称 | 值 | 说明 | | ------------------ | ---- | -------- | | LOOP_MODE_SEQUENCE | 0 | 顺序播放 | @@ -3139,6 +3289,8 @@ controller.off('outputDeviceChange'); **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + | 名称 | 值 | 说明 | | ------------------------------ | ------- | ------------------------------- | | ERR_CODE_SERVICE_EXCEPTION | 6600101 | Session service exception. | diff --git a/zh-cn/application-dev/reference/apis/js-apis-batteryStatistics.md b/zh-cn/application-dev/reference/apis/js-apis-batteryStatistics.md index 95c477c34d8fecf0b0c1a51e2bb36490c4c677a6..5de930534fc4eb5263a316ea122fa23c60820b8e 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-batteryStatistics.md +++ b/zh-cn/application-dev/reference/apis/js-apis-batteryStatistics.md @@ -203,7 +203,7 @@ getHardwareUnitPowerValue(type: ConsumptionType): number ```js try { var value = batteryStats.getHardwareUnitPowerValue(ConsumptionType.CONSUMPTION_TYPE_SCREEN); - console.info('battery statistics percent of hardware is: ' + percent); + console.info('battery statistics value of hardware is: ' + value); } catch(err) { console.error('get battery statistics percent of hardware failed, err: ' + err); } @@ -243,7 +243,7 @@ getHardwareUnitPowerPercent(type: ConsumptionType): number ```js try { - var value = batteryStats.getHardwareUnitPowerPercent(ConsumptionType.CONSUMPTION_TYPE_SCREEN); + var percent = batteryStats.getHardwareUnitPowerPercent(ConsumptionType.CONSUMPTION_TYPE_SCREEN); console.info('battery statistics percent of hardware is: ' + percent); } catch(err) { console.error('get battery statistics percent of hardware failed, err: ' + err); diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundle-BundleInstaller.md b/zh-cn/application-dev/reference/apis/js-apis-bundle-BundleInstaller.md index c0d953dfd155000f859be1ad24b5d2fc1ecf1a5b..15103ae6cd763d2b54bb4c11955df34ad1be5325 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundle-BundleInstaller.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundle-BundleInstaller.md @@ -188,8 +188,8 @@ bundle.getBundleInstaller().then(installer => { **示例:** ``` ts // Stage模型 -import Ability from '@ohos.application.Ability'; -class MainAbility extends Ability { +import UIAbility from '@ohos.app.ability.UIAbility'; +export default class EntryAbility extends UIAbility { onWindowStageCreate(windowStage) { let context = this.context; let pathDir = context.filesDir; diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundleManager.md b/zh-cn/application-dev/reference/apis/js-apis-bundleManager.md index 41a5f9004569ddfb3ca89240c5a6e6df5431dd27..77bff268d7ce902a3572a427d72c2b74eb1f5340 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundleManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundleManager.md @@ -2214,7 +2214,7 @@ try { ### bundleManager.getProfileByAbility -getProfileByAbility(moduleName: string, abilityName: string, metadataName: string, callback: AsyncCallback>): void; +getProfileByAbility(moduleName: string, abilityName: string, metadataName: string, callback: AsyncCallback\\>): void; 以异步方法根据给定的moduleName、abilityName和metadataName获取相应配置文件的json格式字符串,使用callback形式返回结果。 @@ -2265,7 +2265,7 @@ try { ### bundleManager.getProfileByAbility -getProfileByAbility(moduleName: string, abilityName: string, metadataName?: string): Promise>; +getProfileByAbility(moduleName: string, abilityName: string, metadataName?: string): Promise\\>; 以异步方法根据给定的moduleName、abilityName和metadataName获取相应配置文件的json格式字符串,使用Promise形式返回结果。 @@ -2335,7 +2335,7 @@ try { ### bundleManager.getProfileByExtensionAbility -getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName: string, callback: AsyncCallback>): void; +getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName: string, callback: AsyncCallback\\>): void; 以异步方法根据给定的moduleName、extensionAbilityName和metadataName获取相应配置文件的json格式字符串,使用callback形式返回结果。 @@ -2385,7 +2385,7 @@ try { ### bundleManager.getProfileByExtensionAbility -getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName?: string): Promise>; +getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName?: string): Promise\\>; 以异步方法根据给定的moduleName、extensionAbilityName和metadataName获取相应配置文件的json格式字符串,使用Promise形式返回结果。 @@ -2657,7 +2657,6 @@ try { ### bundleManager.getApplicationInfoSync getApplicationInfoSync(bundleName: string, applicationFlags: number, userId: number) : [ApplicationInfo](js-apis-bundleManager-applicationInfo.md); -getApplicationInfoSync(bundleName: string, applicationFlags: number) : [ApplicationInfo](js-apis-bundleManager-applicationInfo.md); 以同步方法根据给定的bundleName、applicationFlags和userId获取ApplicationInfo。 @@ -2708,6 +2707,42 @@ try { } ``` +### bundleManager.getApplicationInfoSync + +getApplicationInfoSync(bundleName: string, applicationFlags: number) : [ApplicationInfo](js-apis-bundleManager-applicationInfo.md); + +以同步方法根据给定的bundleName、applicationFlags获取ApplicationInfo。 + +**系统接口:** 此接口为系统接口。 + +**需要权限:** ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ---------------- | -------------------------- | ---- | ----------------------------------------------------- | +| bundleName | string | 是 | 表示应用程序的bundleName。 | +| applicationFlags | [number](#applicationflag) | 是 | 表示用于指定将返回的ApplicationInfo对象中包含的信息。 | + +**返回值:** + +| 类型 | 说明 | +| ----------------------------------------------------------- | ------------------------- | +| [ApplicationInfo](js-apis-bundleManager-applicationInfo.md) | 返回ApplicationInfo对象。 | + +**错误码:** + +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + +| 错误码ID | 错误信息 | +| -------- | -------------------------------------- | +| 17700001 | The specified bundleName is not found. | +| 17700026 | The specified bundle is disabled. | + +**示例:** + ```ts import bundleManager from '@ohos.bundle.bundleManager'; import hilog from '@ohos.hilog'; @@ -2725,7 +2760,6 @@ try { ### bundleManager.getBundleInfoSync getBundleInfoSync(bundleName: string, bundleFlags: [number](#bundleflag), userId: number): [BundleInfo](js-apis-bundleManager-bundleInfo.md); -getBundleInfoSync(bundleName: string, bundleFlags: [number](#bundleflag)): [BundleInfo](js-apis-bundleManager-bundleInfo.md); 以同步方法根据给定的bundleName、bundleFlags和userId获取BundleInfo。 @@ -2741,7 +2775,7 @@ getBundleInfoSync(bundleName: string, bundleFlags: [number](#bundleflag)): [Bund | ----------- | ------ | ---- | -------------------------------------------------------- | | bundleName | string | 是 | 表示应用程序的bundleName。 | | bundleFlags | [number](#bundleflag) | 是 | 表示用于指定将返回的BundleInfo对象中包含的信息的标志。 | -| userId | number | 否 | 表示用户ID。 | +| userId | number | 是 | 表示用户ID。 | **返回值:** @@ -2776,6 +2810,42 @@ try { } ``` +### bundleManager.getBundleInfoSync + +getBundleInfoSync(bundleName: string, bundleFlags: [number](#bundleflag)): [BundleInfo](js-apis-bundleManager-bundleInfo.md); + +以同步方法根据给定的bundleName、bundleFlags获取BundleInfo。 + +**系统接口:** 此接口为系统接口。 + +**需要权限:** ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | --------------------- | ---- | ------------------------------------------------------ | +| bundleName | string | 是 | 表示应用程序的bundleName。 | +| bundleFlags | [number](#bundleflag) | 是 | 表示用于指定将返回的BundleInfo对象中包含的信息的标志。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------- | -------------------- | +| [BundleInfo](js-apis-bundleManager-bundleInfo.md) | 返回BundleInfo对象。 | + +**错误码:** + +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + +| 错误码ID | 错误信息 | +| -------- | -------------------------------------- | +| 17700001 | The specified bundleName is not found. | +| 17700026 | The specified bundle is disabled. | + +**示例:** + ```ts import bundleManager from '@ohos.bundle.bundleManager'; import hilog from '@ohos.hilog'; @@ -2788,3 +2858,37 @@ try { hilog.error(0x0000, 'testTag', 'getBundleInfoSync failed: %{public}s', err.message); } ``` + +## ModuleType + +标识模块类型。 + + **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework.Core + +| 名称 | 值 | 说明 | +| ------- | ---- | -------------------- | +| ENTRY | 1 | 应用的主模块。 | +| FEATURE | 2 | 应用的动态特性模块。 | +| SHARED | 3 | 应用的动态共享库模块。 | + +## BundleType + +标识应用的类型。 + + **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework.Core + +| 名称 | 值 | 说明 | +| -------------- | ---- | --------------- | +| APP | 0 | 该Bundle是普通应用程序。 | +| ATOMIC_SERVICE | 1 | 该Bundle是元服务。 | + +## AtomicServiceModuleType + +标识在元服务分包时的分包类型。 + + **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework.Core + +| 名称 | 值 | 说明 | +| ------ | ---- | --------------------------- | +| NORMAL | 0 | 元服务中的页面包。 | +| MAIN | 1 | 元服务中的落地页包. | diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundleMonitor.md b/zh-cn/application-dev/reference/apis/js-apis-bundleMonitor.md index 24090ebd1d3fa354f69089b4b118f55149331c91..6e0695fcb910d1d185dd56ef102bd9ecc56fd546 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundleMonitor.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundleMonitor.md @@ -33,7 +33,7 @@ import bundleMonitor from '@ohos.bundle.bundleMonitor'; ## bundleMonitor.on -on(type: BundleChangedEvent, callback: callback\): void; +on(type: BundleChangedEvent, callback: Callback\): void; 注册监听应用的安装,卸载,更新。 @@ -66,7 +66,7 @@ try { ## bundleMonitor.off -off(type: BundleChangedEvent, callback?: callback\): void; +off(type: BundleChangedEvent, callback?: Callback\): void; 注销监听应用的安装,卸载,更新。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-camera.md b/zh-cn/application-dev/reference/apis/js-apis-camera.md index a212608f96b6d043e869fe1484d8a353cf510674..dd90f990bd9714ec5899740ad44f65e6f8d045eb 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-camera.md +++ b/zh-cn/application-dev/reference/apis/js-apis-camera.md @@ -477,10 +477,10 @@ on(type: 'cameraStatus', callback: AsyncCallback): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ----------------------------------------------------- | ---- | --------- | -| type | string | 是 | 监听事件,固定为'cameraStatus',callback返回相机设备信息,包含设备以及设备对应的状态(可用、不可用等),cameraManager对象获取成功可监听。 | -| callback | AsyncCallback<[CameraStatusInfo](#camerastatusinfo)\> | 是 | 回调函数,用于获取镜头状态变化信息。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -----------------| ---- | --------- | +| type | string | 是 | 监听事件,固定为'cameraStatus'。cameraManager对象获取成功后可监听。目前只支持对设备打开或者关闭会触发该事件并返回对应信息 | +| callback | AsyncCallback<[CameraStatusInfo](#camerastatusinfo)\> | 是 | 回调函数,用于获取镜头状态变化信息。 | | **示例:** @@ -505,8 +505,8 @@ on(type: 'cameraMute', callback: AsyncCallback): void | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------- | ---- | --------- | -| type | string | 是 | 监听事件,固定为'cameraMute',系统相机摄像头开关,callback返回开关状态变化信息,cameraManager对象获取成功可监听。 | -| callback | AsyncCallback\ | 是 | 回调函数,用于获取禁用状态变化信息。 | +| type | string | 是 | 监听事件,固定为'cameraMute',系统相机摄像头开关,cameraManager对象获取成功后可监听。系统设置打开或禁用相机会触发该事件并返回状态 | +| callback | AsyncCallback\ | 是 | 回调函数,用于获取禁用状态变化信息,返回true是开启状态,返回false是禁用状态。 | **示例:** @@ -728,7 +728,7 @@ on(type: 'error', cameraDevice:CameraDevice, callback: ErrorCallback | 是 | 回调函数,用于获取结果。返回错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | @@ -1850,8 +1850,8 @@ on(type: 'focusStateChange', callback: AsyncCallback): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ----------------------------------------- | ---- | ------------------------ | -| type | string | 是 | 监听事件,固定为'focusStateChange',callback 返回聚焦状态改变信息,session 创建成功可监听。 | -| callback | AsyncCallback<[FocusState](#focusstate)\> | 是 | 回调函数,用于获取焦距状态。 | +| type | string | 是 | 监听事件,固定为'focusStateChange',session 创建成功可监听。仅当自动对焦模式时,且相机对焦状态发生改变时可触发该事件 | +| callback | AsyncCallback<[FocusState](#focusstate)\> | 是 | 回调函数,用于获取当前对焦状态。 | **示例:** @@ -1873,7 +1873,7 @@ on(type: 'error', callback: ErrorCallback): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ----------------------------------------------------------- | ---- | ------------------------------ | -| type | string | 是 | 监听事件,固定为'error',callback返回session接口使用错误返回对应错误码,比如调用(beginConfig(),commitConfig(),addInput)等接口发生错误时返回对应错误码。 | +| type | string | 是 | 监听事件,固定为'error',session创建成功之后可监听该接口。session调用相关接口出现错误时会触发该事件,比如调用(beginConfig(),commitConfig(),addInput)等接口发生错误时返回错误信息。 | | callback | ErrorCallback | 是 | 回调函数,用于获取错误信息。返回错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | **示例:** @@ -2054,8 +2054,8 @@ on(type: 'frameStart', callback: AsyncCallback): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------- | ---- | --------------------------------------- | -| type | string | 是 | 监听事件,固定为'frameStart',预览开始第一帧返回,previewOutput创建成功可监听。 | -| callback | AsyncCallback | 是 | 回调函数,用于获取结果。 | +| type | string | 是 | 监听事件,固定为'frameStart',previewOutput创建成功可监听。底层第一次开始曝光时触发该事件并返回 | +| callback | AsyncCallback | 是 | 回调函数,用于获取结果。只要有该事件返回就证明预览开始 | **示例:** @@ -2077,8 +2077,8 @@ on(type: 'frameEnd', callback: AsyncCallback): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------- | ---- | ------------------------------------- | -| type | string | 是 | 监听事件,固定为'frameEnd',预览结束最后一帧返回,previewOutput创建成功可监听。 | -| callback | AsyncCallback | 是 | 回调函数,用于获取结果。 | +| type | string | 是 | 监听事件,固定为'frameEnd',previewOutput创建成功可监听。预览完全结束最后一帧时触发该事件并返回, | +| callback | AsyncCallback | 是 | 回调函数,用于获取结果。只要有该事件返回就证明预览结束 | **示例:** @@ -2098,9 +2098,9 @@ on(type: 'error', callback: ErrorCallback): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ----------------------------------------------------------------- | ---- | ------------------------ | -| type | string | 是 | 监听事件,固定为'error',callback返回预览接口使用错误时的错误码,比如调用(start(),release())等接口发生错误时返回对应错误码。| +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------| ---- | ------------------------ | +| type | string | 是 | 监听事件,固定为'error',previewOutput创建成功可监听。预览接口使用错误时触发该事件,比如调用(start(),release())等接口发生错误时返回对应错误信息。| | callback | ErrorCallback | 是 | 回调函数,用于获取错误信息。返回错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | **示例:** @@ -2367,7 +2367,7 @@ on(type: 'captureStart', callback: AsyncCallback): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------------- | ---- | ------------------------------------------ | -| type | string | 是 | 监听事件,固定为'captureStart',callback返回拍照开始事件。 | +| type | string | 是 | 监听事件,固定为'captureStart',photoOutput创建成功后可监听。每次拍照,底层开始曝光时触发该事件并返回。 | | callback | AsyncCallback | 是 | 使用callback的方式获取Capture ID。 | **示例:** @@ -2388,10 +2388,10 @@ on(type: 'frameShutter', callback: AsyncCallback): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ----------------------------------------------------- | --- | ------------------------------------ | -| type | string | 是 | 监听事件,固定为'frameShutter',callback返回拍照图像获取成功信息(captureId跟获取时间)。 | -| callback | AsyncCallback<[FrameShutterInfo](#frameshutterinfo)\> | 是 | 回调函数,用于获取相关信息。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------- | --- | ------------------------------------ | +| type | string | 是 | 监听事件,固定为'frameShutter',photoOutput创建成功后可监听。 | +| callback | AsyncCallback<[FrameShutterInfo](#frameshutterinfo)\> | 是 | 回调函数,用于获取相关信息。该回调返回意味着可以再次下发拍照请求。 | **示例:** @@ -2412,9 +2412,9 @@ on(type: 'captureEnd', callback: AsyncCallback): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ------------------------------------------------- | ---- | ---------------------------------------- | -| type | string | 是 | 监听事件,固定为'captureEnd',callback返回拍照结束事件。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------- | ---- | ---------------------------------------- | +| type | string | 是 | 监听事件,固定为'captureEnd',photoOutput创建成功后可监听。拍照完全结束可触发该事件发生并返回相应信息。 | | callback | AsyncCallback<[CaptureEndInfo](#captureendinfo)\> | 是 | 回调函数,用于获取相关信息。 | **示例:** @@ -2436,9 +2436,9 @@ on(type: 'error', callback: ErrorCallback): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ----------------------------------------------------- | ---- | ----------------------------------- | -| type | string | 是 | 监听事件,固定为'error',callback 返回拍照接口调用时出现错误并返回错误码。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------- | ---- | ----------------------------------- | +| type | string | 是 | 监听事件,固定为'error',photoOutput创建成功后可监听。拍照接口调用时出现错误触发该事件并返回错误信息。 | | callback | ErrorCallback | 是 | 回调函数,用于获取错误信息。返回错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | **示例:** @@ -2638,8 +2638,8 @@ on(type: 'frameStart', callback: AsyncCallback): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------- | ---- | ----------------------------------------- | -| type | string | 是 | 监听事件,固定为'frameStart',callback返回录像开始获取第一帧图像时返回。 | -| callback | AsyncCallback | 是 | 回调函数,用于获取结果。 | +| type | string | 是 | 监听事件,固定为'frameStart',videoOutput创建成功后可监听。底层第一次曝光时触发该事件并返回。 | +| callback | AsyncCallback | 是 | 回调函数,用于获取结果。 只要有该事件返回就证明录像开始 | **示例:** @@ -2661,8 +2661,8 @@ on(type: 'frameEnd', callback: AsyncCallback): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------- | ---- | ------------------------------------------ | -| type | string | 是 | 监听事件,固定为'frameEnd',callback返回录像结束获取最后一帧图像时返回 。 | -| callback | AsyncCallback | 是 | 回调函数,用于获取结果。 | +| type | string | 是 | 监听事件,固定为'frameEnd',videoOutput创建成功后可监听。录像完全结束最后一帧时触发该事件并返回 。 | +| callback | AsyncCallback | 是 | 回调函数,用于获取结果。 只要有该事件返回就证明录像结束 | **示例:** @@ -2682,9 +2682,9 @@ on(type: 'error', callback: ErrorCallback): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ------------------------------------------------ | ---- | -------------------------------------- | -| type | string | 是 | 监听事件,固定为'error',callback返回录像接口调用时出现错误时返回对应错误码,比如调用(start(),release())接口时出现错误返回对应错误码。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------- | ---- | -------------------------------------- | +| type | string | 是 | 监听事件,固定为'error',videoOutput创建成功后可监听。录像接口调用出现错误时触发该事件并返回对应错误码,比如调用(start(),release())接口时出现错误返回对应错误信息。 | | callback | Callback | 是 | 回调函数,用于获取错误信息。返回错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | **示例:** @@ -2809,9 +2809,9 @@ on(type: 'metadataObjectsAvailable', callback: AsyncCallback\> | 是 | 回调函数,用于获取metadata数据。 | **示例:** @@ -2832,9 +2832,9 @@ on(type: 'error', callback: ErrorCallback): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ------------------------------------------------ | ---- | --------------------------------------- | -| type | string | 是 | 监听事件,固定为'error',callback 返回metadata输出接口使用错误时返回对应错误码,比如调用(start(),release())接口时发生错误返回对应错误码。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------- | ---- | --------------------------------------- | +| type | string | 是 | 监听事件,固定为'error',metadataOutput创建成功后可监听。metadata接口使用错误时触发该事件并返回对应错误码,比如调用(start(),release())接口时发生错误返回对应错误信息。 | | callback | Callback | 是 | 回调函数,用于获取错误信息。返回错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | **示例:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-cardEmulation.md b/zh-cn/application-dev/reference/apis/js-apis-cardEmulation.md index 55635168340b262a37f109b58395a2280ea42293..e6f45e0b61932ac8decda26b0537c33b5f8724b4 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-cardEmulation.md +++ b/zh-cn/application-dev/reference/apis/js-apis-cardEmulation.md @@ -16,31 +16,37 @@ import cardEmulation from '@ohos.nfc.cardEmulation'; 定义不同的NFC卡模拟类型。 +> **说明:** +> 从 API version 6 开始支持,从 API version 9 开始废弃,建议使用[hasHceCapability](#hashcecapability9)替代。 + **系统能力:** SystemCapability.Communication.NFC.CardEmulation | 名称 | 值 | 说明 | | -------- | -------- | -------- | | HCE | 0 | HCE 卡模拟。 | | UICC | 1 | SIM 卡模拟。 | -| ESE | 2 | ESE卡模拟。 | +| ESE | 2 | ESE卡模拟。 | -## CardType +## CardType9+ -定义卡模拟应用是支付类型,还是非支付类型。 +定义卡模拟应用所使用的业务类型,是支付类型,还是其他类型。 **系统能力:** SystemCapability.Communication.NFC.CardEmulation | 名称 | 值 | 说明 | | -------- | -------- | -------- | -| PAYMENT | "payment" | 卡模拟应用是支付类型。 | -| OTHER | "other" | 卡模拟应用是非支付类型。 | +| PAYMENT | "payment" | 卡模拟应用所使用的业务是支付类型。 | +| OTHER | "other" | 卡模拟应用所使用的业务是其他类型。 | -## cardEmulation.isSupported +## isSupported isSupported(feature: number): boolean 是否支持某种类型的卡模拟。 +> **说明:** +> 从 API version 6 开始支持,从 API version 9 开始废弃,建议使用[hasHceCapability](#hashcecapability9)替代。 + **系统能力:** SystemCapability.Communication.NFC.CardEmulation **参数:** @@ -55,89 +61,44 @@ isSupported(feature: number): boolean | -------- | -------- | | boolean | true: 支持该类型卡模拟, false: 不支持该类型卡模拟。| -## cardEmulation.isDefaultService +## hasHceCapability9+ -isDefaultService(elementName: ElementName, type: CardType): boolean +hasHceCapability(): boolean -判断指定的应用是否为默认支付应用。 +判断是否支持HCE功能。 **系统能力:** SystemCapability.Communication.NFC.CardEmulation -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------- | -------- | ---- | ----------------------- | -| elementName | [ElementName](js-apis-bundleManager-elementName.md#elementname) | 是 | 应用的描述,由包名和组件名组成。 | -| type | [CardType](#cardtype) | 是 | 应用的描述,由包名和组件名组成。 | +**需要权限:** ohos.permission.NFC_CARD_EMULATION **返回值:** | **类型** | **说明** | | -------- | -------- | -| boolean | true: 是默认支付应用, false: 不是默认支付应用。| - -## HceService8+ +| boolean | true: 支持HCE, false: 不支持HCE。| -提供HCE卡模拟的实现,主要包括接收对端读卡设备的APDU数据,并响应APDU数据到对端读卡设备。使用HCE相关接口前,必须先判断设备是否支持HCE卡模拟能力。 +## isDefaultService9+ -### startHCE8+ +isDefaultService(elementName: ElementName, type: CardType): boolean -startHCE(aidList: string[]): boolean +判断指定的应用是否为指定业务类型的默认应用。 -启动HCE业务功能。包括设置当前应用为前台优先,动态注册AID列表。 +**系统能力:** SystemCapability.Communication.NFC.CardEmulation **需要权限:** ohos.permission.NFC_CARD_EMULATION -**系统能力:** SystemCapability.Communication.NFC.CardEmulation - **参数:** | 参数名 | 类型 | 必填 | 说明 | | ------- | -------- | ---- | ----------------------- | -| aidList | string[] | 是 | 动态注册卡模拟的AID列表。 | - -### stopHCE8+ - -stopHCE(): boolean - -停止HCE业务功能。包括退出当前应用前台优先,释放动态注册的AID列表。 - -**需要权限:** ohos.permission.NFC_CARD_EMULATION - -**系统能力:** SystemCapability.Communication.NFC.CardEmulation - -### on8+ - -on(type: "hceCmd", callback: AsyncCallback): void; +| elementName | [ElementName](js-apis-bundleManager-elementName.md#elementname) | 是 | 应用的描述,由Bundle名称和组件名称组成。 | +| type | [CardType](#cardtype9) | 是 | 卡模拟业务类型。 | -订阅回调,用于接收对端读卡设备发送的APDU数据。 - -**需要权限:** ohos.permission.NFC_CARD_EMULATION - -**系统能力:** SystemCapability.Communication.NFC.CardEmulation - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ----------------------- | ---- | -------------------------------------------- | -| type | string | 是 | 固定填"hceCmd"字符串。 | -| callback | AsyncCallback | 是 | 订阅的事件回调,入参是符合APDU协议的数据,每个number十六进制表示,范围是0x00~0xFF。 | - -### sendResponse8+ - -sendResponse(responseApdu: number[]): void; - -发送APDU数据到对端读卡设备。 - -**需要权限:** ohos.permission.NFC_CARD_EMULATION - -**系统能力:** SystemCapability.Communication.NFC.CardEmulation - -**参数:** +**返回值:** -| 参数名 | 类型 | 必填 | 说明 | -| ------------ | -------- | ---- | -------------------------------------------------- | -| responseApdu | number[] | 是 | 发送到对端读卡设备的符合APDU协议的数据,每个number十六进制表示,范围是0x00~0xFF。 | +| **类型** | **说明** | +| -------- | -------- | +| boolean | true: 是默认支付应用, false: 不是默认支付应用。| **示例:** @@ -150,31 +111,17 @@ if (!isHceSupported) { return; } +var hasHceCap = cardEmulation.hasHceCapability(); +if (!hasHceCap) { + console.log('this device hasHceCapability false, ignore it.'); + return; +} + var elementName = { "bundleName": "com.test.cardemulation", "abilityName": "com.test.cardemulation.MainAbility", }; var isDefaultService = cardEmulation.isDefaultService(elementName, cardEmulation.CardType.PAYMENT); console.log('is the app is default service for this card type: ' + isDefaultService); - -// device supports HCE, transimit APDU with remote nfc reader. -var hceService = new cardEmulation.HceService(); -hceService.startHCE([ - "F0010203040506", "A0000000041010" -]); - -hceService.on("hceCmd", (err, res) => { - if(err.data === 0) { - console.log('callback => Operation hceCmd succeeded. Data: ' + JSON.stringify(res)); - hceService.sendResponse([0x00,0xa4,0x04,0x00, - 0x0e,0x32,0x50,0x41,0x59,0x2e,0x53,0x59,0x53,0x2e,0x44,0x44, - 0x46,0x30,0x31,0x00]); - } else { - console.log('callback => Operation hceCmd failed. Cause: ' + err.data); - } -}) - -// stop HCE when the application exit the nfc card emulation. -hceService.stopHCE(); ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-cert.md b/zh-cn/application-dev/reference/apis/js-apis-cert.md index 8ee8bd2309e88546bc98bdb344d8e2757f86bfac..c3451703a6d58475333c37600fa88556b627bedb 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-cert.md +++ b/zh-cn/application-dev/reference/apis/js-apis-cert.md @@ -104,6 +104,11 @@ createX509Cert(inStream : EncodingBlob, callback : AsyncCallback\) : v | inStream | [EncodingBlob](#encodingblob) | 是 | X509证书序列化数据 | | callback | AsyncCallback\ | 是 | 回调函数。表示X509证书对象 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------- | +| 19020001 | memory error. | **示例:** @@ -146,6 +151,12 @@ createX509Cert(inStream : EncodingBlob) : Promise\ | ------- | ---------------- | | Promise\ | 表示X509证书对象 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------- | +| 19020001 | memory error. | + **示例:** ```js @@ -184,6 +195,11 @@ verify(key : cryptoFramework.PubKey, callback : AsyncCallback\) : void | key | cryptoFramework.PubKey | 是 | 用于验签的公钥对象 | | callback | AsyncCallback\ | 是 | 回调函数。使用AsyncCallback的第一个error参数判断是否验签成功,error为null表示成功,不为null表示失败 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------ | +| 19030001 | crypto operation error. | **示例:** @@ -235,6 +251,12 @@ verify(key : cryptoFramework.PubKey) : Promise\ | -------------- | ----------- | | Promise\ | Promise对象 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------ | +| 19030001 | crypto operation error. | + **示例:** ```js @@ -275,6 +297,13 @@ getEncoded(callback : AsyncCallback\) : void | -------- | --------------------------------------------- | ---- | -------------------------------- | | callback | AsyncCallback\<[EncodingBlob](#encodingblob)> | 是 | 回调函数。表示X509证书序列化数据 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error.| **示例:** @@ -318,6 +347,14 @@ getEncoded() : Promise\ | --------------------------------------- | ---------------------- | | Promise\<[EncodingBlob](#encodingblob)> | 表示X509证书序列化数据 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error.| + **示例:** ```js @@ -356,6 +393,13 @@ getPublicKey() : cryptoFramework.PubKey | ------ | ---------------- | | cryptoFramework.PubKey | X509证书公钥对象:仅用于X509Cert的verify接口 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------- | +| 19020001 | memory error. | +| 19030001 | crypto operation error.| + **示例:** ```js @@ -398,6 +442,15 @@ checkValidityWithDate(date: string) : void | -------- | -------------- | ---- | ---------- | | date | string | 是 | 日期(格式:YYMMDDHHMMSSZ 或 YYYYMMDDHHMMSSZ,时间必须以Z结尾:表示标准时间) | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------- | +| 19020001 | memory error. | +| 19030001 | crypto operation error.| +| 19030003 | the certificate has not taken effect. | +| 19030004 | the certificate has expired.| + **示例:** ```js @@ -513,6 +566,14 @@ getIssuerName() : DataBlob | --------------------- | ---------------------- | | [DataBlob](#datablob) | 表示X509证书颁发者名称 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error.| + **示例:** ```js @@ -549,6 +610,14 @@ getSubjectName() : DataBlob | --------------------- | -------------------- | | [DataBlob](#datablob) | 表示X509证书主体名称 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error.| + **示例:** ```js @@ -585,6 +654,14 @@ getNotBeforeTime() : string | ------ | ------------------------------------------------------------ | | string | 表示X509证书有效期起始时间(格式:YYMMDDHHMMSSZ 或 YYYYMMDDHHMMSSZ,时间以Z结尾:表示标准时间) | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error.| + **示例:** ```js @@ -621,6 +698,14 @@ getNotAfterTime() : string | ------ | ------------------------------------------------------------ | | string | 表示X509证书有效期截止时间(格式:YYMMDDHHMMSSZ 或 YYYYMMDDHHMMSSZ,时间以Z结尾:表示标准时间) | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error.| + **示例:** ```js @@ -657,6 +742,14 @@ getSignature() : DataBlob | --------------------- | -------------------- | | [DataBlob](#datablob) | 表示X509证书签名数据 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error.| + **示例:** ```js @@ -693,6 +786,14 @@ getSignatureAlgName() : string | ------ | ------------------------ | | string | 表示X509证书签名算法名称 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error.| + **示例:** ```js @@ -729,6 +830,14 @@ getSignatureAlgOid() : string | ------ | --------------------------------- | | string | 表示X509证书签名算法对象标志符OID | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error.| + **示例:** ```js @@ -765,6 +874,14 @@ getSignatureAlgParams() : DataBlob | --------------------- | ------------------------ | | [DataBlob](#datablob) | 表示X509证书签名算法参数 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error.| + **示例:** ```js @@ -801,6 +918,13 @@ getKeyUsage() : DataBlob | --------------------- | -------------------- | | [DataBlob](#datablob) | 表示X509证书秘钥用途 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------- | +| 19020001 | memory error. | +| 19030001 | crypto operation error.| + **示例:** ```js @@ -837,6 +961,14 @@ getExtKeyUsage() : DataArray | ----------------------- | ------------------------ | | [DataArray](#dataarray) | 表示X509证书扩展秘钥用途 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error.| + **示例:** ```js @@ -909,6 +1041,14 @@ getSubjectAltNames() : DataArray | ----------------------- | ------------------------ | | [DataArray](#dataarray) | 表示X509证书主体可选名称 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error.| + **示例:** ```js @@ -945,6 +1085,14 @@ getIssuerAltNames() : DataArray | ----------------------- | -------------------------- | | [DataArray](#dataarray) | 表示X509证书颁发者可选名称 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error.| + **示例:** ```js @@ -982,6 +1130,11 @@ createX509Crl(inStream : EncodingBlob, callback : AsyncCallback\) : voi | inStream | [EncodingBlob](#encodingblob) | 是 | 表示证书吊销列表序列化数据 | | callback | AsyncCallback\ | 是 | 回调函数。表示证书吊销列表对象 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------- | +| 19020001 | memory error. | **示例:** @@ -1024,6 +1177,12 @@ createX509Crl(inStream : EncodingBlob) : Promise\ | ----------------- | -------------------- | | Promise\ | 表示证书吊销列表对象 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------- | +| 19020001 | memory error. | + **示例:** ```js @@ -1145,6 +1304,13 @@ getEncoded(callback : AsyncCallback\) : void | -------- | ---------------------------- | ---- | ------------------------------------------ | | callback | AsyncCallback\ | 是 | 回调函数,表示X509证书吊销列表的序列化数据 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error. | **示例:** @@ -1188,6 +1354,14 @@ getEncoded() : Promise\ | ---------------------- | -------------------------------- | | Promise\ | 表示X509证书吊销列表的序列化数据 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error. | + **示例:** ```js @@ -1227,6 +1401,11 @@ verify(key : cryptoFramework.PubKey, callback : AsyncCallback\) : void | key | cryptoFramework.PubKey | 是 | 表示用于验签的公钥对象 | | callback | AsyncCallback\ | 是 | 回调函数,使用AsyncCallback的第一个error参数判断是否验签成功,error为null表示成功,error不为null表示失败。 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------- | +| 19030001 | crypto operation error. | **示例:** @@ -1279,6 +1458,12 @@ verify(key : cryptoFramework.PubKey) : Promise\ | ---- | ------------------------------------------------------------ | | Promise\ | Promise对象 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------- | +| 19030001 | crypto operation error. | + **示例:** ```js @@ -1356,6 +1541,14 @@ getIssuerName() : DataBlob | --------------------- | ------------------------------ | | [DataBlob](#datablob) | 表示X509证书吊销列表颁发者名称 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error. | + **示例:** ```js @@ -1392,6 +1585,14 @@ getLastUpdate() : string | ------ | ------------------------------------ | | string | 表示X509证书吊销列表最后一次更新日期 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error. | + **示例:** ```js @@ -1428,6 +1629,14 @@ getNextUpdate() : string | ------ | ------------------------------------ | | string | 表示X509证书吊销列表下一次更新的日期 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error. | + **示例:** ```js @@ -1470,6 +1679,13 @@ getRevokedCert(serialNumber : number) : X509CrlEntry | ---------------------- | --------------------- | | X509CrlEntry | 表示被吊销X509证书对象 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------- | +| 19020001 | memory error. | +| 19030001 | crypto operation error. | + **示例:** ```js @@ -1518,6 +1734,13 @@ getRevokedCertWithCert(cert : X509Cert) : X509CrlEntry | ------------ | -------------------- | | X509CrlEntry | 表示被吊销X509证书对象 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------- | +| 19020001 | memory error. | +| 19030001 | crypto operation error. | + **示例:** ```js @@ -1560,6 +1783,12 @@ getRevokedCerts(callback : AsyncCallback>) : void | -------- | ----------------------------------- | ---- | -------------------------------- | | callback | AsyncCallback> | 是 | 回调函数。表示被吊销X509证书列表 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------- | +| 19020001 | memory error. | +| 19030001 | crypto operation error. | **示例:** @@ -1603,6 +1832,13 @@ getRevokedCerts() : Promise> | ----------------------------- | ---------------------- | | Promise> | 表示被吊销X509证书列表 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------- | +| 19020001 | memory error. | +| 19030001 | crypto operation error. | + **示例:** ```js @@ -1641,6 +1877,14 @@ getTbsInfo() : DataBlob | --------------------- | ------------------------------- | | [DataBlob](#datablob) | 表示证书吊销列表的tbsCertList信息 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error. | + **示例:** ```js @@ -1681,6 +1925,14 @@ getSignature() : DataBlob | --------------------- | ------------------------------ | | [DataBlob](#datablob) | 表示X509证书吊销列表的签名数据 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error. | + **示例:** ```js @@ -1717,6 +1969,14 @@ getSignatureAlgName() : string | ------ | -------------------------------- | | string | 表示X509证书吊销列表签名的算法名 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error. | + **示例:** ```js @@ -1753,6 +2013,14 @@ getSignatureAlgOid() : string | ------ | --------------------------------------------- | | string | 表示X509证书吊销列表签名算法的对象标志符OID。 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error. | + **示例:** ```js @@ -1789,6 +2057,14 @@ getSignatureAlgParams() : DataBlob | --------------------- | ---------------------------------- | | [DataBlob](#datablob) | 表示X509证书吊销列表签名的算法参数 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error. | + **示例:** ```js @@ -1831,6 +2107,14 @@ createCertChainValidator(algorithm :string) : CertChainValidator | ------------------ | -------------------- | | CertChainValidator | 表示证书链校验器对象 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error. | + **示例:** ```js @@ -1846,7 +2130,7 @@ let validator = cryptoCert.createCertChainValidator("PKIX"); ### 属性 -**系统能力:** SystemCapability.Security.CryptoFramework +**系统能力:** SystemCapability.Security.Cert | 名称 | 类型 | 可读 | 可写 | 说明 | | ------- | ------ | ---- | ---- | -------------------------- | @@ -1869,6 +2153,19 @@ validate(certChain : CertChainData, callback : AsyncCallback\) : void | certChain | [CertChainData](#certchaindata) | 是 | 表示X509证书链序列化数据 | | callback | AsyncCallback\ | 是 | 回调函数。使用AsyncCallback的第一个error参数判断是否校验成功,error为null表示成功,error不为null表示失败 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error. | +| 19030002 | the certificate signature verification failed. | +| 19030003 | the certificate has not taken effect. | +| 19030004 | the certificate has expired. | +| 19030005 | failed to obtain the certificate issuer. | +| 19030006 | the key cannot be used for signing a certificate. | +| 19030007 | the key cannot be used for digital signature. | **示例:** @@ -1916,6 +2213,20 @@ validate(certChain : CertChainData) : Promise\ | -------------- | ----------- | | Promise\ | Promise对象 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error. | +| 19030002 | the certificate signature verification failed. | +| 19030003 | the certificate has not taken effect. | +| 19030004 | the certificate has expired. | +| 19030005 | failed to obtain the certificate issuer. | +| 19030006 | the key cannot be used for signing a certificate. | +| 19030007 | the key cannot be used for digital signature. | + **示例:** ```js @@ -1980,6 +2291,13 @@ getEncoded(callback : AsyncCallback\) : void | -------- | --------------------------------------------- | ---- | ------------------------------------ | | callback | AsyncCallback\<[EncodingBlob](#encodingblob)> | 是 | 回调函数。表示被吊销证书的序列化数据 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error. | **示例:** @@ -2011,6 +2329,14 @@ getEncoded() : Promise\ | --------------------------------------- | -------------------------- | | Promise\<[EncodingBlob](#encodingblob)> | 表示被吊销证书的序列化数据 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error. | + **示例:** ```js @@ -2063,6 +2389,13 @@ getCertIssuer() : DataBlob | --------------------- | ----------------------- | | [DataBlob](#datablob) | 表示被吊销证书的颁发者信息 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | -------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | + **示例:** ```js @@ -2091,6 +2424,14 @@ getRevocationDate() : string | ------ | ------------------ | | string | 表示证书被吊销的日期 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error. | + **示例:** ```js diff --git a/zh-cn/application-dev/reference/apis/js-apis-commonEvent.md b/zh-cn/application-dev/reference/apis/js-apis-commonEvent.md index e96e5492cd0ec20cd96f3e8060202a580dbdcf42..f00dba0881a96c34e812db65121c313b53dcc702 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-commonEvent.md +++ b/zh-cn/application-dev/reference/apis/js-apis-commonEvent.md @@ -64,7 +64,7 @@ publish(event: string, options: CommonEventPublishData, callback: AsyncCallback\ | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------------- | ---- | ---------------------- | | event | string | 是 | 表示要发布的公共事件。 | -| options | [CommonEventPublishData](#commoneventpublishdata) | 是 | 表示发布公共事件的属性。 | +| options | [CommonEventPublishData](./js-apis-inner-commonEvent-commonEventPublishData.md) | 是 | 表示发布公共事件的属性。 | | callback | syncCallback\ | 是 | 表示被指定的回调方法。 | **示例:** @@ -148,7 +148,7 @@ publishAsUser(event: string, userId: number, options: CommonEventPublishData, ca | -------- | ---------------------- | ---- | ---------------------- | | event | string | 是 | 表示要发布的公共事件。 | | userId | number | 是 | 表示指定向该用户ID发送此公共事件。 | -| options | [CommonEventPublishData](#commoneventpublishdata) | 是 | 表示发布公共事件的属性。 | +| options | [CommonEventPublishData](./js-apis-inner-commonEvent-commonEventPublishData.md) | 是 | 表示发布公共事件的属性。 | | callback | AsyncCallback\ | 是 | 表示被指定的回调方法。 | **示例:** @@ -191,8 +191,8 @@ createSubscriber(subscribeInfo: CommonEventSubscribeInfo, callback: AsyncCallbac | 参数名 | 类型 | 必填 | 说明 | | ------------- | ------------------------------------------------------------ | ---- | -------------------------- | -| subscribeInfo | [CommonEventSubscribeInfo](#commoneventsubscribeinfo) | 是 | 表示订阅信息。 | -| callback | AsyncCallback\<[CommonEventSubscriber](#commoneventsubscriber)> | 是 | 表示创建订阅者的回调方法。 | +| subscribeInfo | [CommonEventSubscribeInfo](./js-apis-inner-commonEvent-commonEventSubscribeInfo.md) | 是 | 表示订阅信息。 | +| callback | AsyncCallback\<[CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md)> | 是 | 表示创建订阅者的回调方法。 | **示例:** @@ -233,12 +233,12 @@ createSubscriber(subscribeInfo: CommonEventSubscribeInfo): Promise\ | 返回订阅者对象。 | +| Promise\<[CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md)> | 返回订阅者对象。 | **示例:** @@ -273,8 +273,8 @@ subscribe(subscriber: CommonEventSubscriber, callback: AsyncCallback\ | 是 | 表示接收公共事件数据的回调函数。 | +| subscriber | [CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md) | 是 | 表示订阅者对象。 | +| callback | AsyncCallback\<[CommonEventData](./js-apis-inner-commonEvent-commonEventData.md)> | 是 | 表示接收公共事件数据的回调函数。 | **示例:** @@ -325,7 +325,7 @@ unsubscribe(subscriber: CommonEventSubscriber, callback?: AsyncCallback\): | 参数名 | 类型 | 必填 | 说明 | | ---------- | ----------------------------------------------- | ---- | ------------------------ | -| subscriber | [CommonEventSubscriber](#commoneventsubscriber) | 是 | 表示订阅者对象。 | +| subscriber | [CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md) | 是 | 表示订阅者对象。 | | callback | AsyncCallback\ | 否 | 表示取消订阅的回调方法。 | **示例:** @@ -1123,4 +1123,4 @@ subscriber.finishCommonEvent().then(() => { | publisherPermission | string | 是 | 否 | 表示发布者的权限。 | | publisherDeviceId | string | 是 | 否 | 表示设备ID,该值必须是同一ohos网络上的现有设备ID。 | | userId | number | 是 | 否 | 表示用户ID。此参数是可选的,默认值当前用户的ID。如果指定了此参数,则该值必须是系统中现有的用户ID。 | -| priority | number | 是 | 否 | 表示订阅者的优先级。值的范围是-100到1000。 | \ No newline at end of file +| priority | number | 是 | 否 | 表示订阅者的优先级。值的范围是-100到1000。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-commonEventManager.md b/zh-cn/application-dev/reference/apis/js-apis-commonEventManager.md index 1378d5d29b3dc4ffbc4e73994cc054d2fec1307f..4e04fa0fe12db0282fdc393e9be438d44f287b6a 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-commonEventManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-commonEventManager.md @@ -76,7 +76,7 @@ publish(event: string, options: CommonEventPublishData, callback: AsyncCallback\ | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------------- | ---- | ---------------------- | | event | string | 是 | 表示要发布的公共事件。 | -| options | [CommonEventPublishData](#commoneventpublishdata) | 是 | 表示发布公共事件的属性。 | +| options | [CommonEventPublishData](./js-apis-inner-commonEvent-commonEventPublishData.md) | 是 | 表示发布公共事件的属性。 | | callback | syncCallback\ | 是 | 表示被指定的回调方法。 | **错误码:** @@ -185,7 +185,7 @@ publishAsUser(event: string, userId: number, options: CommonEventPublishData, ca | -------- | ---------------------- | ---- | ---------------------- | | event | string | 是 | 表示要发布的公共事件。 | | userId | number | 是 | 表示指定向该用户ID发送此公共事件。 | -| options | [CommonEventPublishData](#commoneventpublishdata) | 是 | 表示发布公共事件的属性。 | +| options | [CommonEventPublishData](./js-apis-inner-commonEvent-commonEventPublishData.md) | 是 | 表示发布公共事件的属性。 | | callback | AsyncCallback\ | 是 | 表示被指定的回调方法。 | **错误码:** @@ -240,8 +240,8 @@ createSubscriber(subscribeInfo: CommonEventSubscribeInfo, callback: AsyncCallbac | 参数名 | 类型 | 必填 | 说明 | | ------------- | ------------------------------------------------------------ | ---- | -------------------------- | -| subscribeInfo | [CommonEventSubscribeInfo](#commoneventsubscribeinfo) | 是 | 表示订阅信息。 | -| callback | AsyncCallback\<[CommonEventSubscriber](#commoneventsubscriber)> | 是 | 表示创建订阅者的回调方法。 | +| subscribeInfo | [CommonEventSubscribeInfo](./js-apis-inner-commonEvent-commonEventSubscribeInfo.md) | 是 | 表示订阅信息。 | +| callback | AsyncCallback\<[CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md)> | 是 | 表示创建订阅者的回调方法。 | **示例:** @@ -286,12 +286,12 @@ createSubscriber(subscribeInfo: CommonEventSubscribeInfo): Promise\ | 返回订阅者对象。 | +| Promise\<[CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md)> | 返回订阅者对象。 | **示例:** @@ -331,8 +331,8 @@ subscribe(subscriber: CommonEventSubscriber, callback: AsyncCallback\ | 是 | 表示接收公共事件数据的回调函数。 | +| subscriber | [CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md) | 是 | 表示订阅者对象。 | +| callback | AsyncCallback\<[CommonEventData](./js-apis-inner-commonEvent-commonEventData.md)> | 是 | 表示接收公共事件数据的回调函数。 | **示例:** @@ -392,7 +392,7 @@ unsubscribe(subscriber: CommonEventSubscriber, callback?: AsyncCallback\): | 参数名 | 类型 | 必填 | 说明 | | ---------- | ----------------------------------------------- | ---- | ------------------------ | -| subscriber | [CommonEventSubscriber](#commoneventsubscriber) | 是 | 表示订阅者对象。 | +| subscriber | [CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md) | 是 | 表示订阅者对象。 | | callback | AsyncCallback\ | 否 | 表示取消订阅的回调方法。 | **示例:** @@ -447,6 +447,7 @@ try { } catch (err) { console.info("unsubscribe failed " + JSON.stringify(err)); } +<<<<<<< HEAD ``` ## CommonEventSubscriber @@ -1191,4 +1192,7 @@ subscriber.finishCommonEvent().then(() => { | publisherPermission | string | 是 | 否 | 表示发布者的权限。 | | publisherDeviceId | string | 是 | 否 | 表示设备ID,该值必须是同一ohos网络上的现有设备ID。 | | userId | number | 是 | 否 | 表示用户ID。此参数是可选的,默认值当前用户的ID。如果指定了此参数,则该值必须是系统中现有的用户ID。 | -| priority | number | 是 | 否 | 表示订阅者的优先级。值的范围是-100到1000。 | \ No newline at end of file +| priority | number | 是 | 否 | 表示订阅者的优先级。值的范围是-100到1000。 | +======= +``` +>>>>>>> a6c9265cd... common event docs fix diff --git a/zh-cn/application-dev/reference/apis/js-apis-cryptoFramework.md b/zh-cn/application-dev/reference/apis/js-apis-cryptoFramework.md index ba5f0890e965eae69492c42dfc7014a059c85161..0c80adbe729fabcdff44ca7009521f8963eb2820 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-cryptoFramework.md +++ b/zh-cn/application-dev/reference/apis/js-apis-cryptoFramework.md @@ -2217,6 +2217,8 @@ sign(data : DataBlob) : Promise\ | -------------- | ----------- | | Promise\ | Promise对象 | +**错误码:** + | 错误码ID | 错误信息 | | -------- | ---------------------- | | 17620001 | memory error. | diff --git a/zh-cn/application-dev/reference/apis/js-apis-curve.md b/zh-cn/application-dev/reference/apis/js-apis-curve.md index 9c5d2547d6bc37050153c1322f074bcb784fc76b..6bbf96f5913e62061bde5d43783aa1b696790e5d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-curve.md +++ b/zh-cn/application-dev/reference/apis/js-apis-curve.md @@ -209,9 +209,10 @@ Curves.responsiveSpringMotion() // 创建一个默认弹性跟手动画曲线 interpolate(fraction: number): number - 插值曲线的插值计算函数,可以通过传入的归一化时间参数返回当前的插值 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **系统能力:** SystemCapability.ArkUI.ArkUI.Full **参数:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-data-dataShare.md b/zh-cn/application-dev/reference/apis/js-apis-data-dataShare.md index c8e4eb4098ce682dd9d1736cad2bc637d2092fd0..c020071d71df7945d50f2365d8de48b4c5176e05 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-data-dataShare.md +++ b/zh-cn/application-dev/reference/apis/js-apis-data-dataShare.md @@ -49,7 +49,7 @@ createDataShareHelper(context: Context, uri: string, callback: AsyncCallback< | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------------------------------------------- | ---- | ------------------------------------------------------------ | -| context | [Context](js-apis-application-context.md#context) | 是 | 应用的上下文环境。 | +| context | [Context](js-apis-app-ability-uiAbility.md) | 是 | 应用的上下文环境。 | | uri | string | 是 | 指示要连接的服务端应用的路径。 | | callback | AsyncCallback<[DataShareHelper](#datasharehelper)> | 是 | 回调函数。当创建DataShareHelper实例成功,err为undefined,data为获取到的DataShareHelper实例;否则为错误对象。 | @@ -94,7 +94,7 @@ createDataShareHelper(context: Context, uri: string): Promise<DataShareHelper | 参数名 | 类型 | 必填 | 说明 | | ------- | ------------------------------------------------- | ---- | ------------------------------ | -| context | [Context](js-apis-application-context.md#context) | 是 | 应用的上下文环境。 | +| context | [Context](js-apis-app-ability-uiAbility.md) | 是 | 应用的上下文环境。 | | uri | string | 是 | 指示要连接的服务端应用的路径。 | **返回值:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-data-distributedobject.md b/zh-cn/application-dev/reference/apis/js-apis-data-distributedobject.md index a0e388b6711bf468a4a282cc28fef3df7b0e9249..780ae2299547437e0ec3b8aab8a88bc582022ce6 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-data-distributedobject.md +++ b/zh-cn/application-dev/reference/apis/js-apis-data-distributedobject.md @@ -15,7 +15,7 @@ import distributedObject from '@ohos.data.distributedDataObject'; ## distributedObject.create9+ -create(context: Context, source: object): DistributedObjectV9 +create(context: Context, source: object): DataObject 创建一个分布式数据对象。 @@ -32,7 +32,7 @@ create(context: Context, source: object): DistributedObjectV9 | 类型 | 说明 | | -------- | -------- | -| [DistributedObjectV9](#distributedobjectv9) | 创建完成的分布式数据对象。 | +| [DataObject](#dataobject) | 创建完成的分布式数据对象。 | **示例:** @@ -44,7 +44,7 @@ import distributedObject from '@ohos.data.distributedDataObject'; import featureAbility from '@ohos.ability.featureAbility'; // 获取context let context = featureAbility.getContext(); -// 创建对象,该对象包含4个属性类型,string,number,boolean和Object +// 创建对象,该对象包含4个属性类型:string、number、boolean和Object let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); ``` @@ -54,15 +54,15 @@ Stage模型示例: // 导入模块 import distributedObject from '@ohos.data.distributedDataObject'; import UIAbility from '@ohos.app.ability.UIAbility'; -// 获取context -let context; + +let g_object = null; + class EntryAbility extends UIAbility { onWindowStageCreate(windowStage){ - context = this.context + // 创建对象,该对象包含4个属性类型:string、number、boolean和Object + g_object = distributedObject.create(this.context, {name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); } } -// 创建对象,该对象包含4个属性类型,string,number,boolean和Object -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); ``` ## distributedObject.genSessionId @@ -108,9 +108,9 @@ revokeSave接口回调信息。 | -------- | -------- | -------- | -------- | | sessionId | string | 是 | 多设备协同的唯一标识。 | -## DistributedObjectV9 +## DataObject -表示一个分布式数据对象。 +表示一个分布式数据对象。在使用以下接口前,需调用[create()](#distributedobjectcreate9)获取DataObject对象。 ### setSessionId9+ @@ -139,35 +139,10 @@ setSessionId(sessionId: string, callback: AsyncCallback<void>): void **示例:** -FA模型示例 - ```js -import distributedObject from '@ohos.data.distributedDataObject'; -import featureAbility from '@ohos.ability.featureAbility'; -// 获取context -let context = featureAbility.getContext(); -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); -// g_object加入分布式组网 -g_object.setSessionId(distributedObject.genSessionId(), ()=>{ - console.log("join session"); -}); -``` -Stage模型示例 - -```ts -import distributedObject from '@ohos.data.distributedDataObject'; -import UIAbility from '@ohos.app.ability.UIAbility'; -// 获取context -let context; -class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage){ - context = this.context - } -} -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); // g_object加入分布式组网 g_object.setSessionId(distributedObject.genSessionId(), ()=>{ - console.log("join session"); + console.info("join session"); }); ``` @@ -197,43 +172,14 @@ setSessionId(callback: AsyncCallback<void>): void **示例:** -FA模型示例 - ```js -import distributedObject from '@ohos.data.distributedDataObject'; -import featureAbility from '@ohos.ability.featureAbility'; -// 获取context -let context = featureAbility.getContext(); -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); // g_object加入分布式组网 g_object.setSessionId(distributedObject.genSessionId(), ()=>{ - console.log("join session"); + console.info("join session"); }); // 退出分布式组网 g_object.setSessionId(() => { - console.log("leave all lession."); -}); -``` -Stage模型示例 - -```ts -import distributedObject from '@ohos.data.distributedDataObject'; -import UIAbility from '@ohos.app.ability.UIAbility'; -// 获取context -let context; -class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage){ - context = this.context - } -} -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); -// g_object加入分布式组网 -g_object.setSessionId(distributedObject.genSessionId(), ()=>{ - console.log("join session"); -}); -// 退出分布式组网 -g_object.setSessionId(() => { - console.log("leave all lession."); + console.info("leave all lession."); }); ``` @@ -269,40 +215,7 @@ setSessionId(sessionId?: string): Promise<void> **示例:** -FA模型示例 - ```js -import distributedObject from '@ohos.data.distributedDataObject'; -import featureAbility from '@ohos.ability.featureAbility'; -// 获取context -let context = featureAbility.getContext(); -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); -// g_object加入分布式组网 -g_object.setSessionId(distributedObject.genSessionId()).then (()=>{ - console.log("join session."); - }).catch((error)=>{ - console.info("error:" + error.code + error.message); -}); -// 退出分布式组网 -g_object.setSessionId().then (()=>{ - console.log("leave all lession."); - }).catch((error)=>{ - console.info("error:" + error.code + error.message); -}); -``` -Stage模型示例 - -```ts -import distributedObject from '@ohos.data.distributedDataObject'; -import UIAbility from '@ohos.app.ability.UIAbility'; -// 获取context -let context; -class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage){ - context = this.context - } -} -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); // g_object加入分布式组网 g_object.setSessionId(distributedObject.genSessionId()).then (()=>{ console.info("join session."); @@ -311,7 +224,7 @@ g_object.setSessionId(distributedObject.genSessionId()).then (()=>{ }); // 退出分布式组网 g_object.setSessionId().then (()=>{ - console.log("leave all lession."); + console.info("leave all lession."); }).catch((error)=>{ console.info("error:" + error.code + error.message); }); @@ -334,38 +247,7 @@ on(type: 'change', callback: Callback<{ sessionId: string, fields: Array<stri **示例:** -FA模型示例 - ```js -import distributedObject from '@ohos.data.distributedDataObject'; -import featureAbility from '@ohos.ability.featureAbility'; -// 获取context -let context = featureAbility.getContext(); -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); -globalThis.changeCallback = (sessionId, changeData) => { - console.info("change" + sessionId); - if (changeData != null && changeData != undefined) { - changeData.forEach(element => { - console.info("changed !" + element + " " + g_object[element]); - }); - } -} -g_object.on("change", globalThis.changeCallback); -``` - -Stage模型示例 - -```ts -import distributedObject from '@ohos.data.distributedDataObject'; -import UIAbility from '@ohos.app.ability.UIAbility'; -// 获取context -let context; -class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage){ - context = this.context - } -} -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); globalThis.changeCallback = (sessionId, changeData) => { console.info("change" + sessionId); if (changeData != null && changeData != undefined) { @@ -395,33 +277,7 @@ off(type: 'change', callback?: Callback<{ sessionId: string, fields: Array<st **示例:** -FA模型示例 - ```js -import distributedObject from '@ohos.data.distributedDataObject'; -import featureAbility from '@ohos.ability.featureAbility'; -// 获取context -let context = featureAbility.getContext(); -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); -// 删除数据变更回调changeCallback -g_object.off("change", globalThis.changeCallback); -// 删除所有的数据变更回调 -g_object.off("change"); -``` - -Stage模型示例 - -```ts -import distributedObject from '@ohos.data.distributedDataObject'; -import UIAbility from '@ohos.app.ability.UIAbility'; -// 获取context -let context; -class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage){ - context = this.context - } -} -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); // 删除数据变更回调changeCallback g_object.off("change", globalThis.changeCallback); // 删除所有的数据变更回调 @@ -445,36 +301,10 @@ on(type: 'status', callback: Callback<{ sessionId: string, networkId: string, st **示例:** -FA模型示例 - ```js -import distributedObject from '@ohos.data.distributedDataObject'; -import featureAbility from '@ohos.ability.featureAbility'; -// 获取context -let context = featureAbility.getContext(); globalThis.statusCallback = (sessionId, networkId, status) => { globalThis.response += "status changed " + sessionId + " " + status + " " + networkId; } -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); -g_object.on("status", globalThis.statusCallback); -``` - -Stage模型示例 - -```ts -import distributedObject from '@ohos.data.distributedDataObject'; -import UIAbility from '@ohos.app.ability.UIAbility'; -// 获取context -let context; -class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage){ - context = this.context - } -} -globalThis.statusCallback = (sessionId, networkId, status) => { - globalThis.response += "status changed " + sessionId + " " + status + " " + networkId; -} -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); g_object.on("status", globalThis.statusCallback); ``` @@ -496,36 +326,7 @@ off(type: 'status', callback?: Callback<{ sessionId: string, deviceId: string, s **示例:** -FA模型示例 - ```js -import distributedObject from '@ohos.data.distributedDataObject'; -import featureAbility from '@ohos.ability.featureAbility'; -// 获取context -let context = featureAbility.getContext(); -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); -globalThis.statusCallback = (sessionId, networkId, status) => { - globalThis.response += "status changed " + sessionId + " " + status + " " + networkId; -} -// 删除上下线回调changeCallback -g_object.off("status",globalThis.statusCallback); -// 删除所有的上下线回调 -g_object.off("status"); -``` - -Stage模型示例 - -```ts -import distributedObject from '@ohos.data.distributedDataObject'; -import UIAbility from '@ohos.app.ability.UIAbility'; -// 获取context -let context; -class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage){ - context = this.context - } -} -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); globalThis.statusCallback = (sessionId, networkId, status) => { globalThis.response += "status changed " + sessionId + " " + status + " " + networkId; } @@ -560,37 +361,10 @@ save(deviceId: string, callback: AsyncCallback<SaveSuccessResponse>): void **示例:** -FA模型示例 ```ts -import distributedObject from '@ohos.data.distributedDataObject'; -import featureAbility from '@ohos.ability.featureAbility'; -// 获取context -let context = featureAbility.getContext(); -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false}); g_object.setSessionId("123456"); g_object.save("local", (result) => { - console.log("save callback"); - console.info("save sessionId: " + result.sessionId); - console.info("save version: " + result.version); - console.info("save deviceId: " + result.deviceId); -}); -``` - -Stage模型示例 -```ts -import distributedObject from '@ohos.data.distributedDataObject'; -import UIAbility from '@ohos.app.ability.UIAbility'; -// 获取context -let context; -class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage){ - context = this.context - } -} -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false}); -g_object.setSessionId("123456"); -g_object.save("local", (result) => { - console.log("save callback"); + console.info("save callback"); console.info("save sessionId: " + result.sessionId); console.info("save version: " + result.version); console.info("save deviceId: " + result.deviceId); @@ -627,40 +401,10 @@ save(deviceId: string): Promise<SaveSuccessResponse> **示例:** -FA模型示例 - ```js -import distributedObject from '@ohos.data.distributedDataObject'; -import featureAbility from '@ohos.ability.featureAbility'; -// 获取context -let context = featureAbility.getContext(); -let g_object = distributedObject.create(context,{name:"Amy", age:18, isVis:false}); g_object.setSessionId("123456"); g_object.save("local").then((result) => { - console.log("save callback"); - console.info("save sessionId " + result.sessionId); - console.info("save version " + result.version); - console.info("save deviceId " + result.deviceId); -}, () => { - console.error("save failed"); -}); -``` -Stage模型示例 - -```js -import distributedObject from '@ohos.data.distributedDataObject'; -import UIAbility from '@ohos.app.ability.UIAbility'; -// 获取context -let context; -class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage){ - context = this.context - } -} -let g_object = distributedObject.create(context,{name:"Amy", age:18, isVis:false}); -g_object.setSessionId("123456"); -g_object.save("local").then((result) => { - console.log("save callback"); + console.info("save callback"); console.info("save sessionId " + result.sessionId); console.info("save version " + result.version); console.info("save deviceId " + result.deviceId); @@ -688,54 +432,19 @@ revokeSave(callback: AsyncCallback<RevokeSaveSuccessResponse>): void **示例:** -FA模型示例 - ```js -import distributedObject from '@ohos.data.distributedDataObject'; -import featureAbility from '@ohos.ability.featureAbility'; -// 获取context -let context = featureAbility.getContext(); -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false}); -g_object.setSessionId("123456"); -// 持久化数据 -g_object.save("local", (result) => { - console.log("save callback"); - console.info("save sessionId " + result.sessionId); - console.info("save version " + result.version); - console.info("save deviceId " + result.deviceId); -}); -// 删除持久化保存的数据 -g_object.revokeSave((result) => { - console.log("revokeSave callback"); - console.log("revokeSave sessionId " + result.sessionId); -}); -``` - -Stage模型示例 - -```ts -import distributedObject from '@ohos.data.distributedDataObject'; -import UIAbility from '@ohos.app.ability.UIAbility'; -// 获取context -let context; -class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage) { - context = this.context - } -} -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false}); g_object.setSessionId("123456"); // 持久化数据 g_object.save("local", (result) => { - console.log("save callback"); + console.info("save callback"); console.info("save sessionId " + result.sessionId); console.info("save version " + result.version); console.info("save deviceId " + result.deviceId); }); // 删除持久化保存的数据 g_object.revokeSave((result) => { - console.log("revokeSave callback"); - console.log("revokeSave sessionId " + result.sessionId); + console.info("revokeSave callback"); + console.info("revokeSave sessionId " + result.sessionId); }); ``` @@ -758,18 +467,11 @@ revokeSave(): Promise<RevokeSaveSuccessResponse> **示例:** -FA模型示例 - ```ts -import distributedObject from '@ohos.data.distributedDataObject'; -import featureAbility from '@ohos.ability.featureAbility'; -// 获取context -let context = featureAbility.getContext(); -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false}); g_object.setSessionId("123456"); // 持久化数据 g_object.save("local").then((result) => { - console.log("save callback"); + console.info("save callback"); console.info("save sessionId " + result.sessionId); console.info("save version " + result.version); console.info("save deviceId " + result.deviceId); @@ -778,40 +480,8 @@ g_object.save("local").then((result) => { }); // 删除持久化保存的数据 g_object.revokeSave().then((result) => { - console.log("revokeSave callback"); - console.log("sessionId" + result.sessionId); -}, () => { - console.error("revokeSave failed"); -}); -``` - -Stage模型示例 - -```ts -import distributedObject from '@ohos.data.distributedDataObject'; -import UIAbility from '@ohos.app.ability.UIAbility'; -// 获取context -let context; -class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage) { - context = this.context - } -} -let g_object = distributedObject.create(context, {name:"Amy", age:18, isVis:false}); -g_object.setSessionId("123456"); -g_object.save("local").then((result) => { - console.log("save callback"); - console.info("save sessionId " + result.sessionId); - console.info("save version " + result.version); - console.info("save deviceId " + result.deviceId); -}, () => { - console.error("save failed"); -}); - -// 删除持久化保存的数据 -g_object.revokeSave().then((result) => { - console.log("revokeSave callback"); - console.log("sessionId" + result.sessionId); + console.info("revokeSave callback"); + console.info("sessionId" + result.sessionId); }, () => { console.error("revokeSave failed"); }); @@ -852,7 +522,7 @@ let g_object = distributedObject.createDistributedObject({name:"Amy", age:18, is ## DistributedObject(deprecated) -表示一个分布式数据对象。 +表示一个分布式数据对象。在使用以下接口前,需调用[createDistributedObject()](#distributedobjectcreatedistributedobjectdeprecated)获取DistributedObject对象。 ### setSessionId(deprecated) diff --git a/zh-cn/application-dev/reference/apis/js-apis-data-preferences.md b/zh-cn/application-dev/reference/apis/js-apis-data-preferences.md index 332aae1d3b62f0ddf776b0c1dc6d3e8d5f902bba..0f2f549fbee974206cac0a55a88a8eb2a92312b6 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-data-preferences.md +++ b/zh-cn/application-dev/reference/apis/js-apis-data-preferences.md @@ -22,8 +22,8 @@ import data_preferences from '@ohos.data.preferences'; | 名称 | 参数类型 | 可读 | 可写 | 说明 | | ---------------- | -------- | ---- | ---- | --------------------------------------- | -| MAX_KEY_LENGTH | number | 是 | 否 | Key的最大长度限制,需小于80个字节。 | -| MAX_VALUE_LENGTH | number | 是 | 否 | Value的最大长度限制,需小于8192个字节。 | +| MAX_KEY_LENGTH | number | 是 | 否 | Key的最大长度限制为80个字节。 | +| MAX_VALUE_LENGTH | number | 是 | 否 | Value的最大长度限制为8192个字节。 | ## data_preferences.getPreferences @@ -58,6 +58,7 @@ try { console.info("Failed to get preferences. code =" + err.code + ", message =" + err.message); return; } + preferences = val; console.info("Succeeded in getting preferences."); }) } catch (err) { @@ -68,26 +69,25 @@ try { Stage模型示例: ```ts -// 获取context import UIAbility from '@ohos.app.ability.UIAbility'; -let context = null; -class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage){ - context = this.context; - } -} let preferences = null; -try { - data_preferences.getPreferences(context, 'mystore', function (err, val) { - if (err) { - console.info("Failed to get preferences. code =" + err.code + ", message =" + err.message); - return; - } - console.info("Succeeded in getting preferences."); - }) -} catch (err) { - console.info("Failed to get preferences. code =" + err.code + ", message =" + err.message); + +class EntryAbility extends UIAbility { + onWindowStageCreate(windowStage) { + try { + data_preferences.getPreferences(this.context, 'mystore', function (err, val) { + if (err) { + console.info("Failed to get preferences. code =" + err.code + ", message =" + err.message); + return; + } + preferences = val; + console.info("Succeeded in getting preferences."); + }) + } catch (err) { + console.info("Failed to get preferences. code =" + err.code + ", message =" + err.message); + } + } } ``` @@ -128,36 +128,34 @@ try { preferences = object; console.info("Succeeded in getting preferences."); }).catch((err) => { - console.log("Failed to get preferences. code =" + err.code + ", message =" + err.message); + console.info("Failed to get preferences. code =" + err.code + ", message =" + err.message); }) } catch(err) { - console.log("Failed to get preferences. code =" + err.code + ", message =" + err.message); + console.info("Failed to get preferences. code =" + err.code + ", message =" + err.message); } ``` Stage模型示例: ```ts -// 获取context import UIAbility from '@ohos.app.ability.UIAbility'; -let context = null; -class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage){ - context = this.context; - } -} let preferences = null; -try { - let promise = data_preferences.getPreferences(context, 'mystore'); - promise.then((object) => { - preferences = object; - console.info("Succeeded in getting preferences."); - }).catch((err) => { - console.log("Failed to get preferences. code =" + err.code + ", message =" + err.message); - }) -} catch(err) { - console.log("Failed to get preferences. code =" + err.code + ", message =" + err.message); + +class EntryAbility extends UIAbility { + onWindowStageCreate(windowStage) { + try { + let promise = data_preferences.getPreferences(this.context, 'mystore'); + promise.then((object) => { + preferences = object; + console.info("Succeeded in getting preferences."); + }).catch((err) => { + console.info("Failed to get preferences. code =" + err.code + ", message =" + err.message); + }) + } catch(err) { + console.info("Failed to get preferences. code =" + err.code + ", message =" + err.message); + } + } } ``` @@ -214,25 +212,21 @@ try { Stage模型示例: ```ts -// 获取context import UIAbility from '@ohos.app.ability.UIAbility'; -let context = null; class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage){ - context = this.context; - } -} - -try { - data_preferences.deletePreferences(context, 'mystore', function (err, val) { - if (err) { + onWindowStageCreate(windowStage) { + try { + data_preferences.deletePreferences(this.context, 'mystore', function (err, val) { + if (err) { + console.info("Failed to delete preferences. code =" + err.code + ", message =" + err.message); + return; + } + console.info("Succeeded in deleting preferences." ); + }) + } catch (err) { console.info("Failed to delete preferences. code =" + err.code + ", message =" + err.message); - return; } - console.info("Succeeded in deleting preferences." ); - }) -} catch (err) { - console.info("Failed to delete preferences. code =" + err.code + ", message =" + err.message); + } } ``` @@ -293,25 +287,21 @@ try { Stage模型示例: ```ts -// 获取context import UIAbility from '@ohos.app.ability.UIAbility'; -let context = null; class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage){ - context = this.context; + onWindowStageCreate(windowStage) { + try{ + let promise = data_preferences.deletePreferences(this.context, 'mystore'); + promise.then(() => { + console.info("Succeeded in deleting preferences."); + }).catch((err) => { + console.info("Failed to delete preferences. code =" + err.code + ", message =" + err.message); + }) + } catch(err) { + console.info("Failed to delete preferences. code =" + err.code + ", message =" + err.message); + } } } - -try{ - let promise = data_preferences.deletePreferences(context, 'mystore'); - promise.then(() => { - console.info("Succeeded in deleting preferences."); - }).catch((err) => { - console.info("Failed to delete preferences. code =" + err.code + ", message =" + err.message); - }) -} catch(err) { - console.info("Failed to delete preferences. code =" + err.code + ", message =" + err.message); -} ``` ## data_preferences.removePreferencesFromCache @@ -357,25 +347,21 @@ try { Stage模型示例: ```ts -// 获取context import UIAbility from '@ohos.app.ability.UIAbility'; -let context = null; class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage){ - context = this.context; - } -} - -try { - data_preferences.removePreferencesFromCache(context, 'mystore', function (err, val) { - if (err) { + onWindowStageCreate(windowStage) { + try { + data_preferences.removePreferencesFromCache(this.context, 'mystore', function (err, val) { + if (err) { + console.info("Failed to remove preferences. code =" + err.code + ", message =" + err.message); + return; + } + console.info("Succeeded in removing preferences."); + }) + } catch (err) { console.info("Failed to remove preferences. code =" + err.code + ", message =" + err.message); - return; } - console.info("Succeeded in removing preferences."); - }) -} catch (err) { - console.info("Failed to remove preferences. code =" + err.code + ", message =" + err.message); + } } ``` @@ -427,25 +413,22 @@ try { Stage模型示例: ```ts -// 获取context import UIAbility from '@ohos.app.ability.UIAbility'; -let context = null; + class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage){ - context = this.context; + onWindowStageCreate(windowStage) { + try { + let promise = data_preferences.removePreferencesFromCache(this.context, 'mystore'); + promise.then(() => { + console.info("Succeeded in removing preferences."); + }).catch((err) => { + console.info("Failed to remove preferences. code =" + err.code + ", message =" + err.message); + }) + } catch(err) { + console.info("Failed to remove preferences. code =" + err.code + ", message =" + err.message); + } } } - -try { - let promise = data_preferences.removePreferencesFromCache(context, 'mystore'); - promise.then(() => { - console.info("Succeeded in removing preferences."); - }).catch((err) => { - console.info("Failed to remove preferences. code =" + err.code + ", message =" + err.message); - }) -} catch(err) { - console.info("Failed to remove preferences. code =" + err.code + ", message =" + err.message); -} ``` ## Preferences @@ -794,10 +777,10 @@ try { promise.then(() => { console.info("Succeeded in deleting the key 'startup'."); }).catch((err) => { - console.log("Failed to delete the key 'startup'. code =" + err.code +", message =" + err.message); + console.info("Failed to delete the key 'startup'. code =" + err.code +", message =" + err.message); }) } catch(err) { - console.log("Failed to delete the key 'startup'. code =" + err.code +", message =" + err.message); + console.info("Failed to delete the key 'startup'. code =" + err.code +", message =" + err.message); } ``` @@ -1037,4 +1020,4 @@ try { | boolean | 表示值类型为布尔值。 | | Array\ | 表示值类型为数字类型的数组。 | | Array\ | 表示值类型为布尔类型的数组。 | -| Array\ | 表示值类型为字符串类型的数组。 | \ No newline at end of file +| Array\ | 表示值类型为字符串类型的数组。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-data-relationalStore.md b/zh-cn/application-dev/reference/apis/js-apis-data-relationalStore.md index bb8dd19192f6374d0f7026f3071d9db408386b5c..810e9c33f1153ef408bd1a5a1d21ddde10161503 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-data-relationalStore.md +++ b/zh-cn/application-dev/reference/apis/js-apis-data-relationalStore.md @@ -30,7 +30,7 @@ getRdbStore(context: Context, config: StoreConfig, callback: AsyncCallback<Rd | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------------------------------------- | ---- | ------------------------------------------------------------ | -| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-ability-context.md)。 | +| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-inner-application-uiAbilityContext.md)。 | | config | [StoreConfig](#storeconfig) | 是 | 与此RDB存储相关的数据库配置。 | | callback | AsyncCallback<[RdbStore](#rdbstore)> | 是 | 指定callback回调函数,返回RdbStore对象。 | @@ -108,7 +108,7 @@ getRdbStore(context: Context, config: StoreConfig): Promise<RdbStore> | 参数名 | 类型 | 必填 | 说明 | | ------- | -------------------------------- | ---- | ------------------------------------------------------------ | -| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-ability-context.md)。 | +| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-inner-application-uiAbilityContext.md)。 | | config | [StoreConfig](#storeconfig) | 是 | 与此RDB存储相关的数据库配置。 | **返回值**: @@ -188,7 +188,7 @@ deleteRdbStore(context: Context, name: string, callback: AsyncCallback<void&g | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------- | ---- | ------------------------------------------------------------ | -| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-ability-context.md)。 | +| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-inner-application-uiAbilityContext.md)。 | | name | string | 是 | 数据库名称。 | | callback | AsyncCallback<void> | 是 | 指定callback回调函数。 | @@ -249,7 +249,7 @@ deleteRdbStore(context: Context, name: string): Promise<void> | 参数名 | 类型 | 必填 | 说明 | | ------- | ------- | ---- | ------------------------------------------------------------ | -| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-ability-context.md)。 | +| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-inner-application-uiAbilityContext.md)。 | | name | string | 是 | 数据库名称。 | **返回值**: @@ -363,6 +363,8 @@ class EntryAbility extends UIAbility { 描述订阅类型。 +**需要权限:** ohos.permission.DISTRIBUTED_DATASYNC + **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core | 名称 | 值 | 说明 | @@ -2430,9 +2432,9 @@ store.sync(relationalStore.SyncMode.SYNC_MODE_PUSH, predicates, function (err, r let predicates = new relationalStore.RdbPredicates('EMPLOYEE'); predicates.inDevices(['12345678abcde']); let promise = store.sync(relationalStore.SyncMode.SYNC_MODE_PUSH, predicates); -promise.then((resultSet) =>{ +promise.then((result) =>{ console.info(`Sync done.`); - for (let i = 0; i < resultSet.length; i++) { + for (let i = 0; i < result.length; i++) { console.info(`device= ${result[i][0]}, status= ${result[i][1]}`); } }).catch((err) => { @@ -2511,10 +2513,12 @@ try { 首先需要获取resultSet对象。 ```js +let resultSet = null; let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); predicates.equalTo("AGE", 18); let promise = store.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]); -promise.then((resultSet) => { +promise.then((result) => { + resultSet = result; console.info(`resultSet columnNames: ${resultSet.columnNames}`); console.info(`resultSet columnCount: ${resultSet.columnCount}`); }); @@ -2685,7 +2689,7 @@ goToRow(position: number): boolean let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); let promise = store.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]); promise.then((resultSet) => { - resultSet.(5); + resultSet.goToRow(5); resultSet.close(); }).catch((err) => { console.error(`query failed, err: ${err}`); diff --git a/zh-cn/application-dev/reference/apis/js-apis-data-storage.md b/zh-cn/application-dev/reference/apis/js-apis-data-storage.md index 0f88e6c822949fc19e03667f8a6a07ea290e78da..02ecf783227dffe73b28db6f9a42c2b7330efc9f 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-data-storage.md +++ b/zh-cn/application-dev/reference/apis/js-apis-data-storage.md @@ -8,7 +8,7 @@ > - 本模块首批接口从API version 6开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > > - 从API Version 9开始,该接口不再维护,推荐使用新接口[`@ohos.data.preferences`](js-apis-data-preferences.md)。 -> +> > - 本模块接口仅可在FA模型下使用。 @@ -24,8 +24,8 @@ import data_storage from '@ohos.data.storage'; | 名称 | 类型 | 可读 | 可写 | 说明 | | ---------------- | -------- | ---- | ---- | ------------------------------------- | -| MAX_KEY_LENGTH | number | 是 | 否 | key的最大长度限制,需小于80字节。 | -| MAX_VALUE_LENGTH | number | 是 | 否 | value的最大长度限制,需小于8192字节。 | +| MAX_KEY_LENGTH | number | 是 | 否 | key的最大长度限制为80字节。 | +| MAX_VALUE_LENGTH | number | 是 | 否 | value的最大长度限制为8192字节。 | ## data_storage.getStorageSync @@ -172,7 +172,7 @@ context.getFilesDir().then((filePath) => { console.info("======================>getFilesDirPromise====================>"); data_storage.deleteStorageSync(path + '/mystore'); -}); +}); ``` ## data_storage.deleteStorage @@ -276,9 +276,9 @@ let context = featureAbility.getContext(); context.getFilesDir().then((filePath) => { path = filePath; console.info("======================>getFilesDirPromise====================>"); - + data_storage.removeStorageFromCacheSync(path + '/mystore'); -}); +}); ``` @@ -924,4 +924,4 @@ storage.off('change', observer); | ------- | -------------------- | | number | 表示值类型为数字。 | | string | 表示值类型为字符。 | -| boolean | 表示值类型为布尔值。 | \ No newline at end of file +| boolean | 表示值类型为布尔值。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-faultLogger.md b/zh-cn/application-dev/reference/apis/js-apis-faultLogger.md index 4d23dcbbf40b40346096ff71db83443c53911676..4bd9e741756a4602c94181222395cfbd18ef9bd4 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-faultLogger.md +++ b/zh-cn/application-dev/reference/apis/js-apis-faultLogger.md @@ -148,7 +148,7 @@ query(faultType: FaultType, callback: AsyncCallback<Array<FaultLogInfo> | 错误码ID | 错误信息 | | --- | --- | -| 10600001 | The service is not running or broken | +| 10600001 | The service is not started or is faulty | **示例:** @@ -205,7 +205,7 @@ query(faultType: FaultType) : Promise<Array<FaultLogInfo>> | 错误码ID | 错误信息 | | --- | --- | -| 10600001 | The service is not running or broken | +| 10600001 | The service is not started or is faulty | **示例:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-file-environment.md b/zh-cn/application-dev/reference/apis/js-apis-file-environment.md index f6bb1c415116c14505e2cc211caa15e78c1ccc99..c7d9fd584acdf9c789c2f38c36e9f43909d38dfd 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-file-environment.md +++ b/zh-cn/application-dev/reference/apis/js-apis-file-environment.md @@ -3,7 +3,7 @@ 该模块提供环境目录能力,获取内存存储根目录、公共文件根目录的JS接口。 > **说明:** -> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > 本模块接口为系统接口,三方应用不支持调用。 > 本模块支持对错误码进行处理,错误码及其适配方式[参考文档](../errorcodes/errorcode-filemanagement.md#错误码适配指导)。 @@ -25,7 +25,7 @@ getStorageDataDir():Promise<string> | 类型 | 说明 | | --------------------- | ---------------- | -| Promise<string> | 返回存存储根目录 | +| Promise<string> | 返回存储根目录 | **示例:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-file-fs.md b/zh-cn/application-dev/reference/apis/js-apis-file-fs.md index aafee84ec385fed7e8d58a316fe85b19959d8f65..b762b859519ea36a068b84b13c7bbaf97a54dfdf 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-file-fs.md +++ b/zh-cn/application-dev/reference/apis/js-apis-file-fs.md @@ -474,7 +474,7 @@ mkdirSync(path: string): void **示例:** ```js - let dirPath = path + '/testDir'; + let dirPath = pathDir + '/testDir'; fs.mkdirSync(dirPath); ``` @@ -1559,6 +1559,245 @@ symlinkSync(target: string, srcPath: string): void fs.symlinkSync(srcFile, dstFile); ``` +## fs.listFile +listFile(path: string, options?: { + recursion?: boolean; + listNum?: number; + filter?: Filter; +}): Promise; + +列出文件夹下所有文件名,支持递归列出所有文件名(包含子目录下),支持文件过滤,使用Promise异步回调。 + +**系统能力**:SystemCapability.FileManagement.File.FileIO + +**参数:** + + | 参数名 | 类型 | 必填 | 说明 | + | ------ | ------ | ---- | --------------------------- | + | path | string | 是 | 文件夹的应用沙箱路径。 | + | options | Object | 否 | 文件过滤选项。 | + +**options参数说明:** + + | 参数名 | 类型 | 必填 | 说明 | + | ------ | ------ | ---- | --------------------------- | + | recursion | boolean | 否 | 是否递归子目录下文件名,默认为false。 | + | listNum | number | 否 | 列出文件名数量。当设置0时,列出所有文件,默认为0。 | + | filter | [Filter](#filter) | 否 | 文件过滤选项。当前仅支持后缀名匹配、文件名模糊查询、文件大小过滤、最近修改时间过滤。 | + +**返回值:** + + | 类型 | 说明 | + | --------------------- | ---------- | + | Promise<string[]> | Promise对象。返回文件名数组。 | + +**示例:** + + ```js + let options = { + "recursion": false, + "listNum": 0, + "filter": { + "suffix": [".png", ".jpg", ".jpeg"], + "displayName": ["%abc", "efg%"], + "fileSizeOver": 1024, + "lastModifiedAfter": new Date().getTime(), + } + }; + fs.listFile(pathDir, options).then((filenames) => { + console.info("listFile succeed"); + for (let i = 0; i < filenames.length; i++) { + console.info("fileName: %s", filenames[i]); + } + }).catch((err) => { + console.info("list file failed with error message: " + err.message + ", error code: " + err.code); + }); + ``` + +## fs.listFile +listFile(path: string, options?: { + recursion?: boolean; + listNum?: number; + filter?: Filter; +}, callback: AsyncCallback): void; + +列出文件夹下所有文件名,支持递归列出所有文件名(包含子目录下),支持文件过滤,使用Callback异步回调。 + +**参数:** + + | 参数名 | 类型 | 必填 | 说明 | + | ------ | ------ | ---- | --------------------------- | + | path | string | 是 | 文件夹的应用沙箱路径。 | + | options | Object | 否 | 文件过滤选项。 | + | callback | AsyncCallback<string[]> | 是 | 异步列出文件名数组之后的回调。 | + +**options参数说明:** + + | 参数名 | 类型 | 必填 | 说明 | + | ------ | ------ | ---- | --------------------------- | + | recursion | boolean | 否 | 是否递归子目录下文件名,默认为false。 | + | listNum | number | 否 | 列出文件名数量。当设置0时,列出所有文件,默认为0。 | + | filter | [Filter](#filter) | 否 | 文件过滤选项。当前仅支持后缀名匹配、文件名模糊查询、文件大小过滤、最近修改时间过滤。 | + +**示例:** + + ```js + let options = { + "recursion": false, + "listNum": 0, + "filter": { + "suffix": [".png", ".jpg", ".jpeg"], + "displayName": ["%abc", "efg%"], + "fileSizeOver": 1024, + "lastModifiedAfter": new Date().getTime(), + } + }; + fs.listFile(pathDir, options, (err, filenames) => { + if (err) { + console.info("list file failed with error message: " + err.message + ", error code: " + err.code); + } else { + console.info("listFile succeed"); + for (let i = 0; i < filenames.length; i++) { + console.info("filename: %s", filenames[i]); + } + } + }); + ``` + +## fs.listFileSync + +listFileSync(path: string, options?: { + recursion?: boolean; + listNum?: number; + filter?: Filter; +}): string[]; + +以同步方式列出文件夹下所有文件名,支持递归列出所有文件名(包含子目录下),支持文件过滤。 + +**参数:** + + | 参数名 | 类型 | 必填 | 说明 | + | ------ | ------ | ---- | --------------------------- | + | path | string | 是 | 文件夹的应用沙箱路径。 | + | options | Object | 否 | 文件过滤选项。 | + +**options参数说明:** + + | 参数名 | 类型 | 必填 | 说明 | + | ------ | ------ | ---- | --------------------------- | + | recursion | boolean | 否 | 是否递归子目录下文件名,默认为false。 | + | listNum | number | 否 | 列出文件名数量。当设置0时,列出所有文件,默认为0。 | + | filter | [Filter](#filter) | 否 | 文件过滤选项。当前仅支持后缀名匹配、文件名模糊查询、文件大小过滤、最近修改时间过滤。 | + +**返回值:** + + | 类型 | 说明 | + | --------------------- | ---------- | + | string[] | 返回文件名数组。 | + +**示例:** + + ```js + let options = { + "recursion": false, + "listNum": 0, + "filter": { + "suffix": [".png", ".jpg", ".jpeg"], + "displayName": ["%abc", "efg%"], + "fileSizeOver": 1024, + "lastModifiedAfter": new Date().getTime(), + } + }; + let filenames = fs.listFileSync(pathDir, options); + console.info("listFile succeed"); + for (let i = 0; i < filenames.length; i++) { + console.info("filename: %s", filenames[i]); + } + ``` +## fs.moveFile + +moveFile(src: string, dest: string, mode?: number): Promise; + +移动文件,使用Promise异步回调。 + +**系统能力**:SystemCapability.FileManagement.File.FileIO + +**参数:** + + | 参数名 | 类型 | 必填 | 说明 | + | ------ | ------ | ---- | --------------------------- | + | src | string | 是 | 源文件的应用沙箱路径。 | + | dest | string | 是 | 目的文件的应用沙箱路径。 | + | mode | number | 否 | 移动模式。若mode为0,移动位置存在同名文件时,强制移动覆盖。若mode为1,移动位置存在同名文件时,抛出异常。默认为0。 | + +**示例:** + + ```js + let srcPath = pathDir + '/source.txt'; + let destPath = pathDir + '/dest.txt'; + fs.moveFile(srcPath, destPath, 0).then(() => { + console.info("move file succeed"); + }).catch((err) => { + console.info("move file failed with error message: " + err.message + ", error code: " + err.code); + }); + ``` + +## fs.moveFile + +moveFile(src: string, dest: string, mode?: number, callback: AsyncCallback): void; + +移动文件,使用Callback异步回调。 + +**系统能力**:SystemCapability.FileManagement.File.FileIO + +**参数:** + + | 参数名 | 类型 | 必填 | 说明 | + | ------ | ------ | ---- | --------------------------- | + | src | string | 是 | 源文件的应用沙箱路径。 | + | dest | string | 是 | 目的文件的应用沙箱路径。 | + | mode | number | 否 | 移动模式。若mode为0,移动位置存在同名文件时,强制移动覆盖。若mode为1,移动位置存在同名文件时,抛出异常。默认为0。 | + | callback | AsyncCallback<void> | 是 | 异步移动文件之后的回调。 | + +**示例:** + + ```js + let srcPath = pathDir + '/source.txt'; + let destPath = pathDir + '/dest.txt'; + fs.moveFile(srcPath, destPath, 0, (err) => { + if (err) { + console.info("move file failed with error message: " + err.message + ", error code: " + err.code); + } else { + console.info("move file succeed"); + } + }); + ``` + +## fs.moveFileSync + +moveFile(src: string, dest: string, mode?: number): void; + +以同步方式移动文件。 + +**系统能力**:SystemCapability.FileManagement.File.FileIO + +**参数:** + + | 参数名 | 类型 | 必填 | 说明 | + | ------ | ------ | ---- | --------------------------- | + | src | string | 是 | 源文件的应用沙箱路径。 | + | dest | string | 是 | 目的文件的应用沙箱路径。 | + | mode | number | 否 | 移动模式。若mode为0,移动位置存在同名文件时,强制移动覆盖。若mode为1,移动位置存在同名文件时,抛出异常。默认为0。 | + +**示例:** + + ```js + let srcPath = pathDir + '/source.txt'; + let destPath = pathDir + '/dest.txt'; + fs.moveFileSync(srcPath, destPath, 0); + console.info("move file succeed"); + ``` + ## fs.mkdtemp mkdtemp(prefix: string): Promise<string> @@ -2353,6 +2592,104 @@ readSync(buffer: ArrayBuffer, options?: { offset?: number; length?: number; }): | ---- | ------ | ---- | ---- | ------- | | fd | number | 是 | 否 | 打开的文件描述符。 | +### lock + +lock(exclusive?: boolean): Promise; + +文件阻塞式施加共享锁或独占锁,使用Promise异步回调。 + +**系统能力**:SystemCapability.FileManagement.File.FileIO + +**参数:** + + | 参数名 | 类型 | 必填 | 说明 | + | ------- | ----------- | ---- | ---------------------------------------- | + | exclusive | boolean | 否 | 是否施加独占锁,默认false。 | + +**返回值:** + + | 类型 | 说明 | + | ---------------------------------- | ------ | + | Promise<void> | Promise对象。无返回值。 | + +**示例:** + + ```js + let file = fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); + file.lock(true).then(() => { + console.log("lock file successful"); + }).catch((err) => { + console.info("lock file failed with error message: " + err.message + ", error code: " + err.code); + }); + ``` + +### lock + +lock(exclusive?: boolean, callback: AsyncCallback): void; + +文件阻塞式施加共享锁或独占锁,使Callback异步回调。 + +**系统能力**:SystemCapability.FileManagement.File.FileIO + +**参数:** + + | 参数名 | 类型 | 必填 | 说明 | + | ------- | ----------- | ---- | ---------------------------------------- | + | exclusive | boolean | 否 | 是否施加独占锁,默认false。 | + | callback | AsyncCallback<void> | 是 | 异步文件上锁之后的回调。 | + +**示例:** + + ```js + let file = fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); + file.lock(true, (err) => { + if (err) { + console.info("lock file failed with error message: " + err.message + ", error code: " + err.code); + } else { + console.log("lock file successful"); + } + }); + ``` + +### tryLock + +tryLock(exclusive?: boolean): void; + +文件非阻塞式施加共享锁或独占锁。 + +**系统能力**:SystemCapability.FileManagement.File.FileIO + +**参数:** + + | 参数名 | 类型 | 必填 | 说明 | + | ------- | ----------- | ---- | ---------------------------------------- | + | exclusive | boolean | 否 | 是否施加独占锁,默认false。 | + +**示例:** + + ```js + let file = fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); + file.tryLock(true); + console.log("lock file successful"); + ``` + +### unlock + +unlock(): void; + +以同步方式给文件解锁。 + +**系统能力**:SystemCapability.FileManagement.File.FileIO + +**示例:** + + ```js + let file = fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); + file.tryLock(true); + file.unlock(); + console.log("unlock file successful"); + ``` + ## OpenMode open接口flags参数常量。文件打开标签。 @@ -2371,3 +2708,18 @@ open接口flags参数常量。文件打开标签。 | DIR | number | 0o200000 | 如果path不指向目录,则出错。 | | NOFOLLOW | number | 0o400000 | 如果path指向符号链接,则出错。 | | SYNC | number | 0o4010000 | 以同步IO的方式打开文件。 | + +## Filter + +**系统能力**:SystemCapability.FileManagement.File.FileIO + +文件过滤配置项类型,支持listFile接口使用。 + +| 名称 | 类型 | 说明 | +| ----------- | --------------- | ------------------ | +| suffix | Array<string> | 文件后缀名完全匹配,各个关键词OR关系。 | +| displayName | Array<string> | 文件名模糊匹配,各个关键词OR关系。 | +| mimeType | Array<string> | mime类型完全匹配,各个关键词OR关系。 | +| fileSizeOver | number | 文件大小匹配,大于等于指定大小的文件。 | +| lastModifiedAfter | number | 文件最近修改时间匹配,在指定时间点及之后的文件。 | +| excludeMedia | boolean | 是否排除Media中已有的文件。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-file-picker.md b/zh-cn/application-dev/reference/apis/js-apis-file-picker.md new file mode 100644 index 0000000000000000000000000000000000000000..a14b82314a97c1e7d99e69ecf1291bb32b718ece --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-file-picker.md @@ -0,0 +1,770 @@ +# @ohos.file.picker (选择器) + +> **说明:** +> 该模块接口从API Version 9开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 + +选择器(Picker)是一个封装PhotoViewPicker、DocumentViewPicker、AudioViewPicker等系统应用选择与保存能力的模块。应用可以自行选择使用哪种picker实现文件选择和文件保存的功能。 + +## 导入模块 +```js +import picker from '@ohos.file.picker'; +``` + +## PhotoViewPicker + +图库选择器对象,用来支撑选择图片/视频和保存图片/视频等用户场景。在使用前,需要先创建PhotoViewPicker实例。 + +**系统能力**:SystemCapability.FileManagement.UserFileService + +**示例:** + +```ts +let photoPicker = new picker.PhotoViewPicker(); +``` + +### select + +select(option?: PhotoSelectOptions) : Promise<PhotoSelectResult> + +通过选择模式拉起photoPicker界面,用户可以选择一个或多个图片/视频。接口采用promise异步返回形式,传入可选参数PhotoSelectOptions对象,返回PhotoSelectResult对象。 + +**系统能力**:SystemCapability.FileManagement.UserFileService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------- | ---- | -------------------------- | +| option | [PhotoSelectOptions](#photoselectoptions) | 否 | photoPicker选择选项 | + +**返回值:** + +| 类型 | 说明 | +| ----------------------------- | :---- | +| [PhotoSelectResult](#photoselectresult) | 返回photoPicker选择后的结果集 | + +**示例:** + +```ts +async function example() { + try { + let PhotoSelectOptions = new picker.PhotoSelectOptions(); + PhotoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE; + PhotoSelectOptions.maxSelectNumber = 5; + let photoPicker = new picker.PhotoViewPicker(); + photoPicker.select(PhotoSelectOptions).then((PhotoSelectResult) => { + console.info('PhotoViewPicker.select successfully, PhotoSelectResult uri: ' + JSON.stringify(PhotoSelectResult)); + }).catch((err) => { + console.error('PhotoViewPicker.select failed with err: ' + err); + }); + } catch (err) { + console.error('PhotoViewPicker failed with err: ' + err); + } +} +``` + +### select + +select(option: PhotoSelectOptions, callback: AsyncCallback<PhotoSelectResult>) : void + +通过选择模式拉起photoPicker界面,用户可以选择一个或多个图片/视频。接口采用callback异步返回形式,传入参数PhotoSelectOptions对象,返回PhotoSelectResult对象。 + +**系统能力**:SystemCapability.FileManagement.UserFileService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------- | ---- | -------------------------- | +| option | [PhotoSelectOptions](#photoselectoptions) | 是 | photoPicker选择选项 | +| callback | AsyncCallback<[PhotoSelectResult](#photoselectresult)> | 是 | callback 返回photoPicker选择后的结果集 | + +**示例:** + +```ts +async function example() { + try { + let PhotoSelectOptions = new picker.PhotoSelectOptions(); + PhotoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE; + PhotoSelectOptions.maxSelectNumber = 5; + let photoPicker = new picker.PhotoViewPicker(); + photoPicker.select(PhotoSelectOptions, (err, PhotoSelectResult) => { + if (err) { + console.error('PhotoViewPicker.select failed with err: ' + err); + return; + } + console.info('PhotoViewPicker.select successfully, PhotoSelectResult uri: ' + JSON.stringify(PhotoSelectResult)); + }); + } catch (err) { + console.error('PhotoViewPicker failed with err: ' + err); + } +} +``` + +### select + +select(callback: AsyncCallback<PhotoSelectResult>) : void + +通过选择模式拉起photoPicker界面,用户可以选择一个或多个图片/视频。接口采用callback异步返回形式,返回PhotoSelectResult对象。 + +**系统能力**:SystemCapability.FileManagement.UserFileService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------- | ---- | -------------------------- | +| callback | AsyncCallback<[PhotoSelectResult](#photoselectresult)> | 是 | callback 返回photoPicker选择后的结果集 | + +**示例:** + +```ts +async function example() { + try { + let photoPicker = new picker.PhotoViewPicker(); + photoPicker.select((err, PhotoSelectResult) => { + if (err) { + console.error('PhotoViewPicker.select failed with err: ' + err); + return; + } + console.info('PhotoViewPicker.select successfully, PhotoSelectResult uri: ' + JSON.stringify(PhotoSelectResult)); + }); + } catch (err) { + console.error('PhotoViewPicker failed with err: ' + err); + } +} +``` + +### save + +save(option?: PhotoSaveOptions) : Promise<Array<string>> + +通过保存模式拉起photoPicker界面,用户可以保存一个或多个图片/视频。接口采用promise异步返回形式,传入可选参数PhotoSaveOptions对象,返回保存文件的uri数组。 + +**系统能力**:SystemCapability.FileManagement.UserFileService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------- | ---- | -------------------------- | +| option | [PhotoSaveOptions](#photosaveoptions) | 否 | photoPicker保存图片或视频文件选项 | + +**返回值:** + +| 类型 | 说明 | +| ----------------------------- | :---- | +| <Array<string>> | 返回photoPicker保存图片或视频文件后的结果集 | + +**示例:** + +```ts +async function example() { + try { + let PhotoSaveOptions = new picker.PhotoSaveOptions(); + PhotoSaveOptions.newFileNames = ['PhotoViewPicker01.jpg', 'PhotoViewPicker01.mp4']; + let photoPicker = new picker.PhotoViewPicker(); + photoPicker.save(PhotoSaveOptions).then((PhotoSaveResult) => { + console.info('PhotoViewPicker.save successfully, PhotoSaveResult uri: ' + JSON.stringify(PhotoSaveResult)); + }).catch((err) => { + console.error('PhotoViewPicker.save failed with err: ' + err); + }); + } catch (err) { + console.error('PhotoViewPicker failed with err: ' + err); + } +} +``` + +### save + +save(option: PhotoSaveOptions, callback: AsyncCallback<Array<string>>) : void + +通过保存模式拉起photoPicker界面,用户可以保存一个或多个图片/视频。接口采用callback异步返回形式,传入参数PhotoSaveOptions对象,返回保存文件的uri数组。 + +**系统能力**:SystemCapability.FileManagement.UserFileService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------- | ---- | -------------------------- | +| option | [PhotoSaveOptions](#photosaveoptions) | 是 | photoPicker保存图片或视频文件选项 | +| callback | AsyncCallback<Array<string>> | 是 | callback 返回photoPicker保存图片或视频文件后的结果集 | + +**示例:** + +```ts +async function example() { + try { + let PhotoSaveOptions = new picker.PhotoSaveOptions(); + PhotoSaveOptions.newFileNames = ['PhotoViewPicker02.jpg','PhotoViewPicker02.mp4']; + let photoPicker = new picker.PhotoViewPicker(); + photoPicker.save(PhotoSaveOptions, (err, PhotoSaveResult) => { + if (err) { + console.error('PhotoViewPicker.save failed with err: ' + err); + return; + } + console.info('PhotoViewPicker.save successfully, PhotoSaveResult uri: ' + JSON.stringify(PhotoSaveResult)); + }); + } catch (err) { + console.error('PhotoViewPicker failed with err: ' + err); + } +} +``` + +### save + +save(callback: AsyncCallback<Array<string>>) : void + +通过保存模式拉起photoPicker界面,用户可以保存一个或多个图片/视频。接口采用callback异步返回形式,返回保存文件的uri数组。 + +**系统能力**:SystemCapability.FileManagement.UserFileService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------- | ---- | -------------------------- | +| callback | AsyncCallback<Array<string>> | 是 | callback 返回photoPicker保存图片或视频文件后的结果集 | + +**示例:** + +```ts +async function example() { + try { + let photoPicker = new picker.PhotoViewPicker(); + photoPicker.save((err, PhotoSaveResult) => { + if (err) { + console.error('PhotoViewPicker.save failed with err: ' + err); + return; + } + console.info('PhotoViewPicker.save successfully, PhotoSaveResult uri: ' + JSON.stringify(PhotoSaveResult)); + }); + } catch (err) { + console.error('PhotoViewPicker failed with err: ' + err); + } +} +``` + +## DocumentViewPicker + +文件选择器对象,用来支撑选择和保存非媒体文件等用户场景,比如各种格式文档。在使用前,需要先创建DocumentViewPicker实例。 + +**系统能力**:SystemCapability.FileManagement.UserFileService + +**示例:** + +```ts +let documentPicker = new picker.DocumentViewPicker(); +``` + +### select + +select(option?: DocumentSelectOptions) : Promise<Array<string>> + +通过选择模式拉起documentPicker界面,用户可以选择一个或多个文件。接口采用promise异步返回形式,传入可选参数DocumentSelectOptions对象,返回选择文件的uri数组。 + +**系统能力**:SystemCapability.FileManagement.UserFileService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------- | ---- | -------------------------- | +| option | [DocumentSelectOptions](#documentselectoptions) | 否 | documentPicker选择选项 | + +**返回值:** + +| 类型 | 说明 | +| ----------------------------- | :---- | +| <Array<string>> | 返回documentPicker选择后的结果集 | + +**示例:** + +```ts +async function example() { + try { + let DocumentSelectOptions = new picker.DocumentSelectOptions(); + let documentPicker = new picker.DocumentViewPicker(); + documentPicker.select(DocumentSelectOptions).then((DocumentSelectResult) => { + console.info('DocumentViewPicker.select successfully, DocumentSelectResult uri: ' + JSON.stringify(DocumentSelectResult)); + }).catch((err) => { + console.error('DocumentViewPicker.select failed with err: ' + err); + }); + } catch (err) { + console.error('DocumentViewPicker failed with err: ' + err); + } +} +``` + +### select + +select(option: DocumentSelectOptions, callback: AsyncCallback<Array<string>>) : void + +通过选择模式拉起documentPicker界面,用户可以选择一个或多个文件。接口采用callback异步返回形式,传入参数DocumentSelectOptions对象,返回选择文件的uri数组。 + +**系统能力**:SystemCapability.FileManagement.UserFileService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------- | ---- | -------------------------- | +| option | [DocumentSelectOptions](#documentselectoptions) | 是 | documentPicker选择选项 | +| callback | AsyncCallback<Array<string>> | 是 | callback 返回documentPicker选择后的结果集 | + +**示例:** + +```ts +async function example() { + try { + let DocumentSelectOptions = new picker.DocumentSelectOptions(); + let documentPicker = new picker.DocumentViewPicker(); + documentPicker.select(DocumentSelectOptions, (err, DocumentSelectResult) => { + if (err) { + console.error('DocumentViewPicker.select failed with err: ' + err); + return; + } + console.info('DocumentViewPicker.select successfully, DocumentSelectResult uri: ' + JSON.stringify(DocumentSelectResult)); + }); + } catch (err) { + console.error('DocumentViewPicker failed with err: ' + err); + } +} +``` + +### select + +select(callback: AsyncCallback<Array<string>>) : void + +通过选择模式拉起documentPicker界面,用户可以选择一个或多个文件。接口采用callback异步返回形式,返回选择文件的uri数组。 + +**系统能力**:SystemCapability.FileManagement.UserFileService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------- | ---- | -------------------------- | +| callback | AsyncCallback<Array<string>> | 是 | callback 返回documentPicker选择后的结果集 | + +**示例:** + +```ts +async function example() { + try { + let documentPicker = new picker.DocumentViewPicker(); + documentPicker.select((err, DocumentSelectResult) => { + if (err) { + console.error('DocumentViewPicker.select failed with err: ' + err); + return; + } + console.info('DocumentViewPicker.select successfully, DocumentSelectResult uri: ' + JSON.stringify(DocumentSelectResult)); + }); + } catch (err) { + console.error('DocumentViewPicker failed with err: ' + err); + } +} +``` + + +### save + +save(option?: DocumentSaveOptions) : Promise<Array<string>> + +通过保存模式拉起documentPicker界面,用户可以保存一个或多个文件。接口采用promise异步返回形式,传入可选参数DocumentSaveOptions对象,返回保存文件的uri数组。 + +**系统能力**:SystemCapability.FileManagement.UserFileService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------- | ---- | -------------------------- | +| option | [DocumentSaveOptions](#documentsaveoptions) | 否 | documentPicker保存选项 | + +**返回值:** + +| 类型 | 说明 | +| ----------------------------- | :---- | +| <Array<string>> | 返回documentPicker保存后的结果集 | + +**示例:** + +```ts +async function example() { + try { + let DocumentSaveOptions = new picker.DocumentSaveOptions(); + DocumentSaveOptions.newFileNames = ['DocumentViewPicker01.txt']; + let documentPicker = new picker.DocumentViewPicker(); + documentPicker.save(DocumentSaveOptions).then((DocumentSaveResult) => { + console.info('DocumentViewPicker.save successfully, DocumentSaveResult uri: ' + JSON.stringify(DocumentSaveResult)); + }).catch((err) => { + console.error('DocumentViewPicker.save failed with err: ' + err); + }); + } catch (err) { + console.errort('DocumentViewPicker failed with err: ' + err); + } +} +``` + +### save + +save(option: DocumentSaveOptions, callback: AsyncCallback<Array<string>>) : void + +通过保存模式拉起documentPicker界面,用户可以保存一个或多个文件。接口采用callback异步返回形式,传入参数DocumentSaveOptions对象,返回保存文件的uri数组。 + +**系统能力**:SystemCapability.FileManagement.UserFileService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------- | ---- | -------------------------- | +| option | [DocumentSaveOptions](#documentsaveoptions) | 是 | documentPicker保存选项 | +| callback | AsyncCallback<Array<string>> | 是 | callback 返回documentPicker保存后的结果集 | + +**示例:** + +```ts +async function example() { + try { + let DocumentSaveOptions = new picker.DocumentSaveOptions(); + DocumentSaveOptions.newFileNames = ['DocumentViewPicker02.txt']; + let documentPicker = new picker.DocumentViewPicker(); + documentPicker.save(DocumentSaveOptions, (err, DocumentSaveResult) => { + if (err) { + console.error('DocumentViewPicker.save failed with err: ' + err); + return; + } + console.info('DocumentViewPicker.save successfully, DocumentSaveResult uri: ' + JSON.stringify(DocumentSaveResult)); + }); + } catch (err) { + console.errort('DocumentViewPicker failed with err: ' + err); + } +} +``` + +### save + +save(callback: AsyncCallback<Array<string>>) : void + +通过保存模式拉起documentPicker界面,用户可以保存一个或多个文件。接口采用callback异步返回形式,返回保存文件的uri数组。 + +**系统能力**:SystemCapability.FileManagement.UserFileService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------- | ---- | -------------------------- | +| callback | AsyncCallback<Array<string>> | 是 | callback 返回documentPicker保存后的结果集 | + +**示例:** + +```ts +async function example() { + try { + let documentPicker = new picker.DocumentViewPicker(); + documentPicker.save((err, DocumentSaveResult) => { + if (err) { + console.error('DocumentViewPicker.save failed with err: ' + err); + return; + } + console.info('DocumentViewPicker.save successfully, DocumentSaveResult uri: ' + JSON.stringify(DocumentSaveResult)); + }); + } catch (err) { + console.errort('DocumentViewPicker failed with err: ' + err); + } +} +``` + +## AudioViewPicker + +音频选择器对象,用来支撑选择和保存音频类文件等用户场景。在使用前,需要先创建AudioViewPicker实例。 + +**系统能力**:SystemCapability.FileManagement.UserFileService + +**示例:** + +```ts +let audioPicker = new picker.AudioViewPicker(); +``` + +### select + +select(option?: AudioSelectOptions) : Promise<Array<string>> + +通过选择模式拉起audioPicker界面(目前拉起的是documentPicker,audioPicker在规划中),用户可以选择一个或多个音频文件。接口采用promise异步返回形式,传入可选参数AudioSelectOptions对象,返回选择音频文件的uri数组。 + +**系统能力**:SystemCapability.FileManagement.UserFileService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------- | ---- | -------------------------- | +| option | [AudioSelectOptions](#audioselectoptions) | 否 | audioPicker音频选择选项 | + +**返回值:** + +| 类型 | 说明 | +| ----------------------------- | :---- | +| <Array<string>> | 返回audioPicker选择音频后的结果集 | + +**示例:** + +```ts +async function example() { + try { + let AudioSelectOptions = new picker.AudioSelectOptions(); + let audioPicker = new picker.AudioViewPicker(); + audioPicker.select(AudioSelectOptions).then((AudioSelectResult) => { + console.info('AudioViewPicker.select successfully, AudioSelectResult uri: ' + JSON.stringify(AudioSelectResult)); + }).catch((err) => { + console.error('AudioViewPicker.select failed with err: ' + err); + }); + } catch (err) { + console.error('AudioViewPicker failed with err: ' + err); + } +} +``` + +### select + +select(option: AudioSelectOptions, callback: AsyncCallback<Array<string>>) : void + +通过选择模式拉起audioPicker界面(目前拉起的是documentPicker,audioPicker在规划中),用户可以选择一个或多个音频文件。接口采用callback异步返回形式,传入参数AudioSelectOptions对象,返回选择音频文件的uri数组。 + +**系统能力**:SystemCapability.FileManagement.UserFileService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------- | ---- | -------------------------- | +| option | [AudioSelectOptions](#audioselectoptions) | 是 | audioPicker音频选择选项 | +| callback | AsyncCallback<Array<string>> | 是 | callback 返回audioPicker选择音频后的结果集 | + +**示例:** + +```ts +async function example() { + try { + let AudioSelectOptions = new picker.AudioSelectOptions(); + let audioPicker = new picker.AudioViewPicker(); + audioPicker.select(AudioSelectOptions, (err, AudioSelectResult) => { + if (err) { + console.error('AudioViewPicker.select failed with err: ' + err); + return; + } + console.info('AudioViewPicker.select successfully, AudioSelectResult uri: ' + JSON.stringify(AudioSelectResult)); + }); + } catch (err) { + console.error('AudioViewPicker failed with err: ' + err); + } +} +``` + +### select + +select(callback: AsyncCallback<Array<string>>) : void + +通过选择模式拉起audioPicker界面(目前拉起的是documentPicker,audioPicker在规划中),用户可以选择一个或多个音频文件。接口采用callback异步返回形式,返回选择音频文件的uri数组。 + +**系统能力**:SystemCapability.FileManagement.UserFileService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------- | ---- | -------------------------- | +| callback | AsyncCallback<Array<string>> | 是 | callback 返回audioPicker选择音频后的结果集 | + +**示例:** + +```ts +async function example() { + try { + let audioPicker = new picker.AudioViewPicker(); + audioPicker.select((err, AudioSelectResult) => { + if (err) { + console.error('AudioViewPicker.select failed with err: ' + err); + return; + } + console.info('AudioViewPicker.select successfully, AudioSelectResult uri: ' + JSON.stringify(AudioSelectResult)); + }); + } catch (err) { + console.error('AudioViewPicker failed with err: ' + err); + } +} +``` + +### save + +save(option?: AudioSaveOptions) : Promise<Array<string>> + +通过保存模式拉起audioPicker界面(目前拉起的是documentPicker,audioPicker在规划中),用户可以保存一个或多个音频文件。接口采用promise异步返回形式,传入可选参数AudioSaveOptions对象,返回保存音频文件的uri数组。 + +**系统能力**:SystemCapability.FileManagement.UserFileService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------- | ---- | -------------------------- | +| option | [AudioSaveOptions](#audiosaveoptions) | 否 | audioPicker保存音频文件选项 | + +**返回值:** + +| 类型 | 说明 | +| ----------------------------- | ---- | +| <Array<string>> | 返回audioPicker保存音频文件后的结果集 | + +**示例:** + +```ts +async function example() { + try { + let AudioSaveOptions = new picker.AudioSaveOptions(); + AudioSaveOptions.newFileNames = ['AudioViewPicker01.mp3']; + let audioPicker = new picker.AudioViewPicker(); + audioPicker.save(AudioSaveOptions).then((AudioSaveResult) => { + console.info('AudioViewPicker.save successfully, AudioSaveResult uri: ' + JSON.stringify(AudioSaveResult)) + }).catch((err) => { + console.error('AudioViewPicker.save failed with err: ' + err); + }); + } catch (err) { + console.error('AudioViewPicker failed with err: ' + err); + } +} +``` + +### save + +save(option: AudioSaveOptions, callback: AsyncCallback<Array<string>>) : void + +通过保存模式拉起audioPicker界面(目前拉起的是documentPicker,audioPicker在规划中),用户可以保存一个或多个音频文件。接口采用callback异步返回形式,传入参数AudioSaveOptions对象,返回保存音频文件的uri数组。 + +**系统能力**:SystemCapability.FileManagement.UserFileService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------- | ---- | -------------------------- | +| option | [AudioSaveOptions](#audiosaveoptions) | 是 | audioPicker保存音频文件选项 | +| callback | AsyncCallback<Array<string>> | 是 | callback 返回audioPicker保存音频文件后的结果集 | + +**示例:** + +```ts +async function example() { + try { + let AudioSaveOptions = new picker.AudioSaveOptions(); + AudioSaveOptions.newFileNames = ['AudioViewPicker02.mp3']; + let audioPicker = new picker.AudioViewPicker(); + audioPicker.save(AudioSaveOptions, (err, AudioSaveResult) => { + if (err) { + console.error('AudioViewPicker.save failed with err: ' + err); + return; + } + console.info('AudioViewPicker.save successfully, AudioSaveResult uri: ' + JSON.stringify(AudioSaveResult)); + }); + } catch (err) { + console.error('AudioViewPicker failed with err: ' + err); + } +} +``` + +### save + +save(callback: AsyncCallback<Array<string>>) : void + +通过保存模式拉起audioPicker界面(目前拉起的是documentPicker,audioPicker在规划中),用户可以保存一个或多个音频文件。接口采用callback异步返回形式,返回保存音频文件的uri数组。 + +**系统能力**:SystemCapability.FileManagement.UserFileService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------- | ---- | -------------------------- | +| callback | AsyncCallback<Array<string>> | 是 | callback 返回audioPicker保存音频文件后的结果集 | + +**示例:** + +```ts +async function example() { + try { + let audioPicker = new picker.AudioViewPicker(); + audioPicker.save((err, AudioSaveResult) => { + if (err) { + console.error('AudioViewPicker.save failed with err: ' + err); + return; + } + console.info('AudioViewPicker.save successfully, AudioSaveResult uri: ' + JSON.stringify(AudioSaveResult)); + }); + } catch (err) { + console.error('AudioViewPicker failed with err: ' + err); + } +} +``` + +## PhotoViewMIMETypes + +枚举,可选择的媒体文件类型。 + +**系统能力:** 以下各项对应的系统能力均为 SystemCapability.FileManagement.UserFileService + +| 名称 | 值 | 说明 | +| ----- | ---- | ---- | +| IMAGE_TYPE | 'image/*' | 图片类型 | +| VIDEO_TYPE | 'video/*' | 视频类型 | +| IMAGE_VIDEO_TYPE | '\*/*' | 图片和视频类型 | + +## PhotoSelectOptions + +图库选择选项。 + +**系统能力:** 以下各项对应的系统能力均为 SystemCapability.FileManagement.UserFileService + +| 名称 | 类型 | 必填 | 说明 | +| ----------------------- | ------------------- | ---- | -------------------------------- | +| MIMEType? | [PhotoViewMIMETypes](#photoviewmimetypes) | 否 | 可选择的媒体文件类型 | +| maxSelectNumber? | number | 否 | 选择媒体文件数量的最大值(默认值为50,最大值为500) | + +## PhotoSelectResult + +返回图库选择后的结果集。 + +**系统能力:** 以下各项对应的系统能力均为 SystemCapability.FileManagement.UserFileService + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ----------------------- | ------------------- | ---- | ---- | ------------------------------ | +| photoUris | Array<string> | 是 | 是 | 返回图库选择后的媒体文件的uri数组 | +| isOriginalPhoto | boolean | 是 | 是 | 返回图库选择后的媒体文件是否为原图 | + +## PhotoSaveOptions + +图片或视频的保存选项。 + +**系统能力:** 以下各项对应的系统能力均为 SystemCapability.FileManagement.UserFileService + +| 名称 | 类型 | 必填 | 说明 | +| ----------------------- | ------------------- | ---- | ---------------------------- | +| newFileNames? | Array<string> | 否 | 拉起photoPicker进行保存图片或视频资源的文件名 | + +## DocumentSelectOptions + +文档选择选项,目前不支持参数配置。 + +**系统能力:** SystemCapability.FileManagement.UserFileService + +## DocumentSaveOptions + +文档保存选项。 + +**系统能力:** 以下各项对应的系统能力均为 SystemCapability.FileManagement.UserFileService + +| 名称 | 类型 | 必填 | 说明 | +| ----------------------- | ------------------- | ---- | ---------------------------- | +| newFileNames? | Array<string> | 否 | 拉起documentPicker进行保存的文件名 | + +## AudioSelectOptions + +音频选择选项,目前不支持参数配置。 + +**系统能力:** SystemCapability.FileManagement.UserFileService + +## AudioSaveOptions + +音频的保存选项。 + +**系统能力:** 以下各项对应的系统能力均为 SystemCapability.FileManagement.UserFileService + +| 名称 | 类型 | 必填 | 说明 | +| ----------------------- | ------------------- | ---- | ---------------------------- | +| newFileNames? | Array<string> | 否 | 拉起audioPicker进行保存音频资源的文件名 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-file-securityLabel.md b/zh-cn/application-dev/reference/apis/js-apis-file-securityLabel.md index 511211522f361c78bac6ceb98779fa216a3d5c6d..d7110ee4df486c1824d88d152ec98b8325e165e8 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-file-securityLabel.md +++ b/zh-cn/application-dev/reference/apis/js-apis-file-securityLabel.md @@ -44,7 +44,7 @@ FA模型context的具体获取方法参见[FA模型](js-apis-inner-app-context.m ## securityLabel.setSecurityLabel -setSecurityLabel(path:string, type:dataLevel):Promise<void> +setSecurityLabel(path:string, type:DataLevel):Promise<void> 以异步方法设置数据标签,以promise形式返回结果。 @@ -55,7 +55,7 @@ setSecurityLabel(path:string, type:dataLevel):Promise<void> | 参数名 | 类型 | 必填 | 说明 | | --------- | ------ | ---- | -------------------------------------------- | | path | string | 是 | 文件路径 | -| type | dataLevel | 是 | 文件等级属性,只支持"s0","s1","s2","s3","s4" | +| type | DataLevel | 是 | 文件等级属性,只支持"s0","s1","s2","s3","s4" | **返回值:** @@ -66,7 +66,8 @@ setSecurityLabel(path:string, type:dataLevel):Promise<void> **示例:** ```js - securityLabel.setSecurityLabel(path, "s0").then(() => { + let filePath = pathDir + '/test.txt'; + securityLabel.setSecurityLabel(filePath, "s0").then(() => { console.info("setSecurityLabel successfully"); }).catch((err) => { console.info("setSecurityLabel failed with error message: " + err.message + ", error code: " + err.code); @@ -75,7 +76,7 @@ setSecurityLabel(path:string, type:dataLevel):Promise<void> ## securityLabel.setSecurityLabel -setSecurityLabel(path:string, type:dataLevel, callback: AsyncCallback<void>):void +setSecurityLabel(path:string, type:DataLevel, callback: AsyncCallback<void>):void 以异步方法设置数据标签,以callback形式返回结果。 @@ -86,13 +87,14 @@ setSecurityLabel(path:string, type:dataLevel, callback: AsyncCallback<void> | 参数名 | 类型 | 必填 | 说明 | | --------- | ------------------------- | ---- | -------------------------------------------- | | path | string | 是 | 文件路径 | -| type | dataLevel | 是 | 文件等级属性,只支持"s0","s1","s2","s3","s4" | +| type | DataLevel | 是 | 文件等级属性,只支持"s0","s1","s2","s3","s4" | | callback | AsyncCallback<void> | 是 | 是否设置数据标签之后的回调 | **示例:** ```js - securityLabel.setSecurityLabel(path, "s0", (err) => { + let filePath = pathDir + '/test.txt'; + securityLabel.setSecurityLabel(filePath, "s0", (err) => { if (err) { console.info("setSecurityLabel failed with error message: " + err.message + ", error code: " + err.code); } else { @@ -103,7 +105,7 @@ setSecurityLabel(path:string, type:dataLevel, callback: AsyncCallback<void> ## securityLabel.setSecurityLabelSync -setSecurityLabelSync(path:string, type:dataLevel):void +setSecurityLabelSync(path:string, type:DataLevel):void 以同步方法设置数据标签。 @@ -114,12 +116,13 @@ setSecurityLabelSync(path:string, type:dataLevel):void | 参数名 | 类型 | 必填 | 说明 | | --------- | ------ | ---- | -------------------------------------------- | | path | string | 是 | 文件路径 | -| type | dataLevel | 是 | 文件等级属性,只支持"s0","s1","s2","s3","s4" | +| type | DataLevel | 是 | 文件等级属性,只支持"s0","s1","s2","s3","s4" | **示例:** ```js -securityLabel.setSecurityLabelSync(path, "s0"); +let filePath = pathDir + '/test.txt'; +securityLabel.setSecurityLabelSync(filePath, "s0"); ``` ## securityLabel.getSecurityLabel @@ -145,7 +148,8 @@ getSecurityLabel(path:string):Promise<string> **示例:** ```js - securityLabel.getSecurityLabel(path).then((type) => { + let filePath = pathDir + '/test.txt'; + securityLabel.getSecurityLabel(filePath).then((type) => { console.log("getSecurityLabel successfully, Label: " + type); }).catch((err) => { console.log("getSecurityLabel failed with error message: " + err.message + ", error code: " + err.code); @@ -170,7 +174,8 @@ getSecurityLabel(path:string, callback:AsyncCallback<string>): void **示例:** ```js - securityLabel.getSecurityLabel(path, (err, type) => { + let filePath = pathDir + '/test.txt'; + securityLabel.getSecurityLabel(filePath, (err, type) => { if (err) { console.log("getSecurityLabel failed with error message: " + err.message + ", error code: " + err.code); } else { @@ -201,6 +206,7 @@ getSecurityLabelSync(path:string):string **示例:** ```js -let type = securityLabel.getSecurityLabelSync(path); +let filePath = pathDir + '/test.txt'; +let type = securityLabel.getSecurityLabelSync(filePath); console.log("getSecurityLabel successfully, Label: " + type); ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-fileAccess.md b/zh-cn/application-dev/reference/apis/js-apis-fileAccess.md index 2f66868a47a28345d007b1320abbd349800f41d8..5c4b961d21119ad1d1870403730be3619a6d48fe 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-fileAccess.md +++ b/zh-cn/application-dev/reference/apis/js-apis-fileAccess.md @@ -6,6 +6,7 @@ fileAccess模块是基于extension机制实现的一个对公共文件访问和 > >- 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 >- 本模块接口为系统接口,三方应用不支持调用,当前只支持filepicker、文件管理器调用。 +>- 本模块支持对错误码进行处理,错误码及其适配方式[参考文档](../errorcodes/errorcode-filemanagement.md#错误码适配指导)。 ## 导入模块 diff --git a/zh-cn/application-dev/reference/apis/js-apis-fileio.md b/zh-cn/application-dev/reference/apis/js-apis-fileio.md index ccf923eea852415bade810a291241376bbf2de0a..92fece4af5cb285df3ad0b7878ce7a75c946f39c 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-fileio.md +++ b/zh-cn/application-dev/reference/apis/js-apis-fileio.md @@ -3434,20 +3434,3 @@ isSymbolicLink(): boolean let dir = fileio.opendirSync(pathDir); let isSymbolicLink = dir.readSync().isSymbolicLink(); ``` - -## Filter9+ - -**系统接口**:此接口为系统接口。 - -**系统能力**:SystemCapability.FileManagement.File.FileIO - -文件过滤器配置项。 - -| 名称 | 类型 | 说明 | -| ----------- | --------------- | ------------------ | -| suffix | Array<string> | 文件后缀名,各个关键词OR关系。 | -| displayName | Array<string> | 文件名模糊匹配,各个关键词OR关系。 | -| mimeType | Array<string> | mime类型匹配,各个关键词OR关系。 | -| fileSizeOver | number | 文件大小匹配,大于等于指定大小的文件。 | -| lastModifiedAfter | Date | 修改时间匹配,在指定时间点后的文件。 | -| excludeMedia | Boolean | 是否排除Media中已有的文件。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-http.md b/zh-cn/application-dev/reference/apis/js-apis-http.md index 16696b77fd623cede7edb72a05bafdb1cca37bb0..1cdf224165953ca89bc5d02298ff045a4f45b23c 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-http.md +++ b/zh-cn/application-dev/reference/apis/js-apis-http.md @@ -16,6 +16,7 @@ import http from '@ohos.net.http'; ## 完整示例 ```js +// 引入包名 import http from '@ohos.net.http'; // 每一个httpRequest对应一个HTTP请求任务,不可复用 @@ -44,16 +45,19 @@ httpRequest.request( connectTimeout: 60000, // 可选,默认为60000ms readTimeout: 60000, // 可选,默认为60000ms usingProtocol: http.HttpProtocol.HTTP1_1, // 可选,协议类型默认值由系统自动指定 + usingProxy: false, //可选,默认不使用网络代理,自API 10开始支持该属性 }, (err, data) => { if (!err) { // data.result为HTTP响应内容,可根据业务需要进行解析 - console.info('Result:' + data.result); - console.info('code:' + data.responseCode); + console.info('Result:' + JSON.stringify(data.result)); + console.info('code:' + JSON.stringify(data.responseCode)); // data.header为HTTP响应头,可根据业务需要进行解析 console.info('header:' + JSON.stringify(data.header)); - console.info('cookies:' + data.cookies); // 8+ + console.info('cookies:' + JSON.stringify(data.cookies)); // 8+ } else { console.info('error:' + JSON.stringify(err)); + // 取消订阅HTTP响应头事件 + httpRequest.off('headersReceive'); // 当该请求使用完毕时,调用destroy方法主动销毁。 httpRequest.destroy(); } @@ -103,6 +107,22 @@ request\(url: string, callback: AsyncCallback\\):void | url | string | 是 | 发起网络请求的URL地址。 | | callback | AsyncCallback\<[HttpResponse](#httpresponse)\> | 是 | 回调函数。 | +**错误码:** + +| 错误码ID | 错误信息 | +|---------|-------------------------------------------------------| +| 401 | Parameter error. | +| 201 | Permission denied. | +| 2300003 | URL using bad/illegal format or missing URL. | +| 2300007 | Couldn't connect to server. | +| 2300028 | Timeout was reached. | +| 2300052 | Server returned nothing (no headers, no data). | +| 2300999 | Unknown Other Error. | + +>**错误码说明:** +> 以上错误码的详细介绍参见[HTTP错误码](../errorcodes/errorcode-net-http.md)。 +> HTTP 错误码映射关系:2300000 + curl错误码。更多常用错误码,可参考:[curl错误码](https://curl.se/libcurl/c/libcurl-errors.html) + **示例:** ```js @@ -120,7 +140,7 @@ httpRequest.request("EXAMPLE_URL", (err, data) => { ### request -request\(url: string, options: HttpRequestOptions, callback: AsyncCallback\):void +request\(url: string, options: HttpRequestOptions, callback: AsyncCallback\\):void 根据URL地址和相关配置项,发起HTTP网络请求,使用callback方式作为异步方法。 @@ -136,6 +156,46 @@ request\(url: string, options: HttpRequestOptions, callback: AsyncCallback | 是 | 回调函数。 | +**错误码:** + +| 错误码ID | 错误信息 | +|---------|-------------------------------------------------------| +| 401 | Parameter error. | +| 201 | Permission denied. | +| 2300001 | Unsupported protocol. | +| 2300003 | URL using bad/illegal format or missing URL. | +| 2300005 | Couldn't resolve proxy name. | +| 2300006 | Couldn't resolve host name. | +| 2300007 | Couldn't connect to server. | +| 2300008 | Weird server reply. | +| 2300009 | Access denied to remote resource. | +| 2300016 | Error in the HTTP2 framing layer. | +| 2300018 | Transferred a partial file. | +| 2300023 | Failed writing received data to disk/application. | +| 2300025 | Upload failed. | +| 2300026 | Failed to open/read local data from file/application. | +| 2300027 | Out of memory. | +| 2300028 | Timeout was reached. | +| 2300047 | Number of redirects hit maximum amount. | +| 2300052 | Server returned nothing (no headers, no data). | +| 2300055 | Failed sending data to the peer. | +| 2300056 | Failure when receiving data from the peer. | +| 2300058 | Problem with the local SSL certificate. | +| 2300059 | Couldn't use specified SSL cipher. | +| 2300060 | SSL peer certificate or SSH remote key was not OK. | +| 2300061 | Unrecognized or bad HTTP Content or Transfer-Encoding.| +| 2300063 | Maximum file size exceeded. | +| 2300070 | Disk full or allocation exceeded. | +| 2300073 | Remote file already exists. | +| 2300077 | Problem with the SSL CA cert (path? access rights?). | +| 2300078 | Remote file not found. | +| 2300094 | An authentication function returned an error. | +| 2300999 | Unknown Other Error. | + +>**错误码说明:** +> 以上错误码的详细介绍参见[HTTP错误码](../errorcodes/errorcode-net-http.md)。 +> HTTP 错误码映射关系:2300000 + curl错误码。更多常用错误码,可参考:[curl错误码](https://curl.se/libcurl/c/libcurl-errors.html) + **示例:** ```js @@ -163,7 +223,7 @@ httpRequest.request("EXAMPLE_URL", ### request -request\(url: string, options? : HttpRequestOptions\): Promise +request\(url: string, options? : HttpRequestOptions\): Promise\ 根据URL地址,发起HTTP网络请求,使用Promise方式作为异步方法。 @@ -184,6 +244,45 @@ request\(url: string, options? : HttpRequestOptions\): Promise | :------------------------------------- | :-------------------------------- | | Promise<[HttpResponse](#httpresponse)> | 以Promise形式返回发起请求的结果。 | +**错误码:** + +| 错误码ID | 错误信息 | +|---------|-------------------------------------------------------| +| 401 | Parameter error. | +| 201 | Permission denied. | +| 2300001 | Unsupported protocol. | +| 2300003 | URL using bad/illegal format or missing URL. | +| 2300005 | Couldn't resolve proxy name. | +| 2300006 | Couldn't resolve host name. | +| 2300007 | Couldn't connect to server. | +| 2300008 | Weird server reply. | +| 2300009 | Access denied to remote resource. | +| 2300016 | Error in the HTTP2 framing layer. | +| 2300018 | Transferred a partial file. | +| 2300023 | Failed writing received data to disk/application. | +| 2300025 | Upload failed. | +| 2300026 | Failed to open/read local data from file/application. | +| 2300027 | Out of memory. | +| 2300028 | Timeout was reached. | +| 2300047 | Number of redirects hit maximum amount. | +| 2300052 | Server returned nothing (no headers, no data). | +| 2300055 | Failed sending data to the peer. | +| 2300056 | Failure when receiving data from the peer. | +| 2300058 | Problem with the local SSL certificate. | +| 2300059 | Couldn't use specified SSL cipher. | +| 2300060 | SSL peer certificate or SSH remote key was not OK. | +| 2300061 | Unrecognized or bad HTTP Content or Transfer-Encoding.| +| 2300063 | Maximum file size exceeded. | +| 2300070 | Disk full or allocation exceeded. | +| 2300073 | Remote file already exists. | +| 2300077 | Problem with the SSL CA cert (path? access rights?). | +| 2300078 | Remote file not found. | +| 2300094 | An authentication function returned an error. | +| 2300999 | Unknown Other Error. | + +>**错误码说明:** +> 以上错误码的详细介绍参见[HTTP错误码](../errorcodes/errorcode-net-http.md)。 +> HTTP 错误码映射关系:2300000 + curl错误码。更多常用错误码,可参考:[curl错误码](https://curl.se/libcurl/c/libcurl-errors.html) **示例:** @@ -222,6 +321,209 @@ destroy\(\): void httpRequest.destroy(); ``` +### request210+ + +request2(url: string, callback: AsyncCallback): void + +根据URL地址和相关配置项,发起HTTP网络请求并返回流式响应,使用callback方式作为异步方法。 + +**需要权限**:ohos.permission.INTERNET + +**系统能力**:SystemCapability.Communication.NetStack + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------------- | ---- | ----------------------------------------------- | +| url | string | 是 | 发起网络请求的URL地址。 | +| callback | AsyncCallback\ | 是 | 回调函数。 | + +**错误码:** + +| 错误码ID | 错误信息 | +|---------|-------------------------------------------------------| +| 401 | Parameter error. | +| 201 | Permission denied. | +| 2300003 | URL using bad/illegal format or missing URL. | +| 2300007 | Couldn't connect to server. | +| 2300028 | Timeout was reached. | +| 2300052 | Server returned nothing (no headers, no data). | +| 2300999 | Unknown Other Error. | + +>**错误码说明:** +> 以上错误码的详细介绍参见[HTTP错误码](../errorcodes/errorcode-net-http.md)。 +> HTTP 错误码映射关系:2300000 + curl错误码。更多常用错误码,可参考:[curl错误码](https://curl.se/libcurl/c/libcurl-errors.html) + +**示例:** + +```js +httpRequest.request2("EXAMPLE_URL", (err) => { + if (!err) { + console.info(request2 OK!); + } else { + console.info("request2 ERROR : err = " + JSON.stringify(err)); + } +}) +``` + +### request210+ + +request2(url: string, options: HttpRequestOptions, callback: AsyncCallback): void + +根据URL地址和相关配置项,发起HTTP网络请求并返回流式响应,使用callback方式作为异步方法。 + +**需要权限**:ohos.permission.INTERNET + +**系统能力**:SystemCapability.Communication.NetStack + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------------- | ---- | ----------------------------------------------- | +| url | string | 是 | 发起网络请求的URL地址。 | +| options | HttpRequestOptions | 是 | 参考[HttpRequestOptions](#httprequestoptions)。 | +| callback | AsyncCallback\ | 是 | 回调函数。 | + +**错误码:** + +| 错误码ID | 错误信息 | +|---------|-------------------------------------------------------| +| 401 | Parameter error. | +| 201 | Permission denied. | +| 2300001 | Unsupported protocol. | +| 2300003 | URL using bad/illegal format or missing URL. | +| 2300005 | Couldn't resolve proxy name. | +| 2300006 | Couldn't resolve host name. | +| 2300007 | Couldn't connect to server. | +| 2300008 | Weird server reply. | +| 2300009 | Access denied to remote resource. | +| 2300016 | Error in the HTTP2 framing layer. | +| 2300018 | Transferred a partial file. | +| 2300023 | Failed writing received data to disk/application. | +| 2300025 | Upload failed. | +| 2300026 | Failed to open/read local data from file/application. | +| 2300027 | Out of memory. | +| 2300028 | Timeout was reached. | +| 2300047 | Number of redirects hit maximum amount. | +| 2300052 | Server returned nothing (no headers, no data). | +| 2300055 | Failed sending data to the peer. | +| 2300056 | Failure when receiving data from the peer. | +| 2300058 | Problem with the local SSL certificate. | +| 2300059 | Couldn't use specified SSL cipher. | +| 2300060 | SSL peer certificate or SSH remote key was not OK. | +| 2300061 | Unrecognized or bad HTTP Content or Transfer-Encoding.| +| 2300063 | Maximum file size exceeded. | +| 2300070 | Disk full or allocation exceeded. | +| 2300073 | Remote file already exists. | +| 2300077 | Problem with the SSL CA cert (path? access rights?). | +| 2300078 | Remote file not found. | +| 2300094 | An authentication function returned an error. | +| 2300999 | Unknown Other Error. | + +>**错误码说明:** +> 以上错误码的详细介绍参见[HTTP错误码](../errorcodes/errorcode-net-http.md)。 +> HTTP 错误码映射关系:2300000 + curl错误码。更多常用错误码,可参考:[curl错误码](https://curl.se/libcurl/c/libcurl-errors.html) + +**示例:** + +```js +httpRequest.request2("EXAMPLE_URL", +{ + method: http.RequestMethod.GET, + header: { + 'Content-Type': 'application/json' + }, + readTimeout: 60000, + connectTimeout: 60000 +}, (err) => { + if (!err) { + console.info(request2 OK!); + } else { + console.info("request2 ERROR : err = " + JSON.stringify(err)); + } +}) +``` +### request210+ + +request2\(url: string, options? : HttpRequestOptions\): Promise\ + +根据URL地址,发起HTTP网络请求并返回流式响应,使用Promise方式作为异步方法。 + +**需要权限**:ohos.permission.INTERNET + +**系统能力**:SystemCapability.Communication.NetStack + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------------------ | ---- | ----------------------------------------------- | +| url | string | 是 | 发起网络请求的URL地址。 | +| options | HttpRequestOptions | 否 | 参考[HttpRequestOptions](#httprequestoptions)。 | + +**返回值:** + +| 类型 | 说明 | +| :------------------------------------- | :-------------------------------- | +| Promise\ | 以Promise形式返回发起请求的结果。 | + +**错误码:** + +| 错误码ID | 错误信息 | +|---------|-------------------------------------------------------| +| 401 | Parameter error. | +| 201 | Permission denied. | +| 2300001 | Unsupported protocol. | +| 2300003 | URL using bad/illegal format or missing URL. | +| 2300005 | Couldn't resolve proxy name. | +| 2300006 | Couldn't resolve host name. | +| 2300007 | Couldn't connect to server. | +| 2300008 | Weird server reply. | +| 2300009 | Access denied to remote resource. | +| 2300016 | Error in the HTTP2 framing layer. | +| 2300018 | Transferred a partial file. | +| 2300023 | Failed writing received data to disk/application. | +| 2300025 | Upload failed. | +| 2300026 | Failed to open/read local data from file/application. | +| 2300027 | Out of memory. | +| 2300028 | Timeout was reached. | +| 2300047 | Number of redirects hit maximum amount. | +| 2300052 | Server returned nothing (no headers, no data). | +| 2300055 | Failed sending data to the peer. | +| 2300056 | Failure when receiving data from the peer. | +| 2300058 | Problem with the local SSL certificate. | +| 2300059 | Couldn't use specified SSL cipher. | +| 2300060 | SSL peer certificate or SSH remote key was not OK. | +| 2300061 | Unrecognized or bad HTTP Content or Transfer-Encoding.| +| 2300063 | Maximum file size exceeded. | +| 2300070 | Disk full or allocation exceeded. | +| 2300073 | Remote file already exists. | +| 2300077 | Problem with the SSL CA cert (path? access rights?). | +| 2300078 | Remote file not found. | +| 2300094 | An authentication function returned an error. | +| 2300999 | Unknown Other Error. | + +>**错误码说明:** +> 以上错误码的详细介绍参见[HTTP错误码](../errorcodes/errorcode-net-http.md)。 +> HTTP 错误码映射关系:2300000 + curl错误码。更多常用错误码,可参考: + +**示例:** + +```js +let promise = httpRequest.request("EXAMPLE_URL", { + method: http.RequestMethod.GET, + connectTimeout: 60000, + readTimeout: 60000, + header: { + 'Content-Type': 'application/json' + } +}); +promise.then(() => { + console.info(request2 OK!); +}).catch((err) => { + console.info("request2 ERROR : err = " + JSON.stringify(err)); +}); +``` + ### on\('headerReceive'\) on\(type: 'headerReceive', callback: AsyncCallback\): void @@ -348,7 +650,148 @@ httpRequest.once('headersReceive', (header) => { console.info('header: ' + JSON.stringify(header)); }); ``` +### on\('dataReceive'\)10+ + +on\(type: 'dataReceive', callback: Callback\\): void + +订阅HTTP流式响应数据接收事件。 +**系统能力**:SystemCapability.Communication.NetStack + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------- | ---- | --------------------------------- | +| type | string | 是 | 订阅的事件类型,'dataReceive'。 | +| callback | AsyncCallback\ | 是 | 回调函数。 | + +**示例:** + +```js +httpRequest.on('dataReceive', (data) => { + console.info('dataReceive length: ' + JSON.stringify(data.byteLength)); +}); +``` + +### off\('dataReceive'\)10+ + +off\(type: 'dataReceive', callback?: Callback\\): void + +取消订阅HTTP流式响应数据接收事件。 + +>![](public_sys-resources/icon-note.gif) **说明:** +>可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 + +**系统能力**:SystemCapability.Communication.NetStack + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------ | ---- | -------------------------------------- | +| type | string | 是 | 取消订阅的事件类型:'dataReceive'。 | +| callback | Callback\ | 否 | 回调函数。 | + +**示例:** + +```js +httpRequest.off('dataReceive'); +``` + +### on\('dataEnd'\)10+ + +on\(type: 'dataEnd', callback: Callback\\): void + +订阅HTTP流式响应数据接收完毕事件。 + +**系统能力**:SystemCapability.Communication.NetStack + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------- | ---- | --------------------------------- | +| type | string | 是 | 订阅的事件类型,'dataEnd'。 | +| callback | AsyncCallback\ | 是 | 回调函数。 | + +**示例:** + +```js +httpRequest.on('dataReceive', () => { + console.info('Receive dataEnd!'); +}); +``` + +### off\('dataEnd'\)10+ + +off(type: 'dataEnd', callback?: Callback\): void + +取消订阅HTTP流式响应数据接收完毕事件。 + +>![](public_sys-resources/icon-note.gif) **说明:** +>可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 + +**系统能力**:SystemCapability.Communication.NetStack + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------ | ---- | -------------------------------------- | +| type | string | 是 | 取消订阅的事件类型:'dataEnd'。 | +| callback | Callback\ | 否 | 回调函数。 | + +**示例:** + +```js +httpRequest.off('dataEnd'); +``` + +### on\('dataProgress'\)10+ + + on\(type: 'dataProgress', callback: Callback\<{ receiveSize: number, totalSize: number }\>\): void + +订阅HTTP流式响应数据接收进度事件。 + +**系统能力**:SystemCapability.Communication.NetStack + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------- | ---- | --------------------------------- | +| type | string | 是 | 订阅的事件类型,'dataProgress'。 | +| callback | AsyncCallback\<{ receiveSize: number, totalSize: number }\> | 是 | 回调函数。 | + +**示例:** + +```js +httpRequest.on('dataProgress', (data) => { + if (!err) { + console.info('dataProgress:' + JSON.stringify(data)); + } +}); +``` + +### off\('dataProgress'\)10+ + +off(type: 'dataProgress', callback?: Callback\<{ receiveSize: number, totalSize: number }\>): void + +取消订阅HTTP流式响应数据接收进度事件。 + +>![](public_sys-resources/icon-note.gif) **说明:** +>可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 + +**系统能力**:SystemCapability.Communication.NetStack + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------ | ---- | -------------------------------------- | +| type | string | 是 | 取消订阅的事件类型:'dataProgress'。 | +| callback | Callback\<{ receiveSize: number, totalSize: number }\> | 否 | 回调函数。 | + +**示例:** + +```js +httpRequest.off('dataProgress'); +``` ## HttpRequestOptions 发起请求可选参数的类型和取值范围。 @@ -359,13 +802,14 @@ httpRequest.once('headersReceive', (header) => { | -------------- | --------------------------------------------- | ---- | ------------------------------------------------------------ | | method | [RequestMethod](#requestmethod) | 否 | 请求方式。 | | extraData | string \| Object \| ArrayBuffer6+ | 否 | 发送请求的额外数据。
- 当HTTP请求为POST、PUT等方法时,此字段为HTTP请求的content。
- 当HTTP请求为GET、OPTIONS、DELETE、TRACE、CONNECT等方法时,此字段为HTTP请求的参数补充,参数内容会拼接到URL中进行发送。6+
- 开发者传入string对象,开发者需要自行编码,将编码后的string传入。6+ | -| expectDataType9+ | [HttpDataType](#httpdatatype9) | 否 | 指定返回数据的类型。如果设置了此参数,系统将优先返回指定的类型。 | +| expectDataType9+ | [HttpDataType](#httpdatatype9) | 否 | 指定返回数据的类型。如果设置了此参数,系统将优先返回指定的类型。 | | usingCache9+ | boolean | 否 | 是否使用缓存,默认为true。 | | priority9+ | number | 否 | 优先级,范围\[1,1000],默认是1。 | -| header | Object | 否 | HTTP请求头字段。默认{'Content-Type': 'application/json'}。 | -| readTimeout | number | 否 | 读取超时时间。单位为毫秒(ms),默认为60000ms。 | -| connectTimeout | number | 否 | 连接超时时间。单位为毫秒(ms),默认为60000ms。 | -| usingProtocol9+ | [HttpProtocol](#httpprotocol9) | 否 | 使用协议。默认值由系统自动指定。 | +| header | Object | 否 | HTTP请求头字段。默认{'Content-Type': 'application/json'}。 | +| readTimeout | number | 否 | 读取超时时间。单位为毫秒(ms),默认为60000ms。 | +| connectTimeout | number | 否 | 连接超时时间。单位为毫秒(ms),默认为60000ms。 | +| usingProtocol9+ | [HttpProtocol](#httpprotocol9) | 否 | 使用协议。默认值由系统自动指定。 | +| usingProxy10+ | boolean \| Object | 否 | 是否使用HTTP代理,默认为false,不使用代理。
- 当usingProxy为布尔类型true时,使用默认网络代理。
- 当usingProxy为object类型时,使用指定网络代理。 | ## RequestMethod @@ -438,9 +882,9 @@ request方法回调函数的返回值类型。 | -------------------- | -------------------------------------------- | ---- | ------------------------------------------------------------ | | result | string \| Object \| ArrayBuffer6+ | 是 | HTTP请求根据响应头中Content-type类型返回对应的响应格式内容:
- application/json:返回JSON格式的字符串,如需HTTP响应具体内容,需开发者自行解析
- application/octet-stream:ArrayBuffer
- 其他:string | | resultType9+ | [HttpDataType](#httpdatatype9) | 是 | 返回值类型。 | -| responseCode | [ResponseCode](#responsecode) \| number | 是 | 回调函数执行成功时,此字段为[ResponseCode](#responsecode)。若执行失败,错误码将会从AsyncCallback中的err字段返回。错误码参考[Response错误码](#response常用错误码)。 | +| responseCode | [ResponseCode](#responsecode) \| number | 是 | 回调函数执行成功时,此字段为[ResponseCode](#responsecode)。若执行失败,错误码将会从AsyncCallback中的err字段返回。 | | header | Object | 是 | 发起HTTP请求返回来的响应头。当前返回的是JSON格式字符串,如需具体字段内容,需开发者自行解析。常见字段及解析方式如下:
- Content-Type:header['Content-Type'];
- Status-Line:header['Status-Line'];
- Date:header.Date/header['Date'];
- Server:header.Server/header['Server']; | -| cookies8+ | Array\ | 是 | 服务器返回的 cookies。 | +| cookies8+ | string | 是 | 服务器返回的 cookies。 | ## http.createHttpResponseCache9+ @@ -492,10 +936,10 @@ flush(callback: AsyncCallback\): void ```js httpResponseCache.flush(err => { if (err) { - console.log('flush fail'); + console.info('flush fail'); return; } - console.log('flush success'); + console.info('flush success'); }); ``` @@ -517,9 +961,9 @@ flush(): Promise\ ```js httpResponseCache.flush().then(() => { - console.log('flush success'); + console.info('flush success'); }).catch(err => { - console.log('flush fail'); + console.info('flush fail'); }); ``` @@ -542,10 +986,10 @@ delete(callback: AsyncCallback\): void ```js httpResponseCache.delete(err => { if (err) { - console.log('delete fail'); + console.info('delete fail'); return; } - console.log('delete success'); + console.info('delete success'); }); ``` ### delete9+ @@ -566,25 +1010,12 @@ delete(): Promise\ ```js httpResponseCache.delete().then(() => { - console.log('delete success'); + console.info('delete success'); }).catch(err => { - console.log('delete fail'); + console.info('delete fail'); }); ``` -## Response常用错误码 - -| 错误码 | 说明 | -| ------ | ------------------------------------------------------------ | -| -1 | 参数错误。检查参数的个数与类型是否正确。 | -| 3 | URL格式错误。检查URL的格式与语法是否正确。 | -| 4 | 构建时无法找到内置的请求功能、协议或选项。一个功能或选项是不启用或明确禁用时,为了得到它的功能,你需要得到一个重建的libcurl。 | -| 5 | 无法解析代理,指定的代理服务器主机无法解析。建议排查:1、url地址是否正确。2、联网是否正常,网络是否可以和外部进行通信。3、是否有网络访问权限。 | -| 6 | 无法解析主机,指定的远程主机无法解析。建议排查:1、url地址是否正确。2、联网是否正常,网络是否可以和外部进行通信。3、是否有网络访问权限。 | -| 7 | 无法连接代理或主机。建议排查:1、端口号是否有问题。 2、查看本地是否开启http的代理影响的。 | - -更多常用错误码,可参考:[curl错误码](https://curl.se/libcurl/c/libcurl-errors.html)。 - ## HttpDataType9+ http的数据类型。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-huks.md b/zh-cn/application-dev/reference/apis/js-apis-huks.md index e69ecb237c9c3097bed2036b013531fe27d3d6f6..6682fb5678785d516240d22f1e747c60ff53e19a 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-huks.md +++ b/zh-cn/application-dev/reference/apis/js-apis-huks.md @@ -1818,9 +1818,9 @@ async function huksAbort() { | 名称 | 值 | 说明 | | ------------------------------- | ---- | ------------------------- | -| HUKS_USER_AUTH_TYPE_FINGERPRINT | 1 | 表示用户认证类型为指纹。 | -| HUKS_USER_AUTH_TYPE_FACE | 2 | 表示用户认证类型为人脸 。 | -| HUKS_USER_AUTH_TYPE_PIN | 4 | 表示用户认证类型为PIN码。 | +| HUKS_USER_AUTH_TYPE_FINGERPRINT | 1 << 0 | 表示用户认证类型为指纹。 | +| HUKS_USER_AUTH_TYPE_FACE | 1 << 1 | 表示用户认证类型为人脸 。 | +| HUKS_USER_AUTH_TYPE_PIN | 1 << 2 | 表示用户认证类型为PIN码。 | ## HuksAuthAccessType9+ @@ -1830,8 +1830,8 @@ async function huksAbort() { | 名称 | 值 | 说明 | | --------------------------------------- | ---- | ------------------------------------------------ | -| HUKS_AUTH_ACCESS_INVALID_CLEAR_PASSWORD | 1 | 表示安全访问控制类型为清除密码后密钥无效。 | -| HUKS_AUTH_ACCESS_INVALID_NEW_BIO_ENROLL | 2 | 表示安全访问控制类型为新录入生物特征后密钥无效。 | +| HUKS_AUTH_ACCESS_INVALID_CLEAR_PASSWORD | 1 << 0 | 表示安全访问控制类型为清除密码后密钥无效。 | +| HUKS_AUTH_ACCESS_INVALID_NEW_BIO_ENROLL | 1 << 1 | 表示安全访问控制类型为新录入生物特征后密钥无效。 | ## HuksChallengeType9+ @@ -1892,7 +1892,7 @@ async function huksAbort() { | 名称 | 值 | 说明 | | -------------------------------------------- | ---------------------------------------- | -------------------------------------- | | HUKS_TAG_INVALID | HuksTagType.HUKS_TAG_TYPE_INVALID \| 0 | 表示非法的Tag。 | -| HUKS_TAG_ALGORITHM | HUKS_TAG_TYPE_UINT \| 1 | 表示算法的Tag。 | +| HUKS_TAG_ALGORITHM | HuksTagType.HUKS_TAG_TYPE_UINT \| 1 | 表示算法的Tag。 | | HUKS_TAG_PURPOSE | HuksTagType.HUKS_TAG_TYPE_UINT \| 2 | 表示密钥用途的Tag。 | | HUKS_TAG_KEY_SIZE | HuksTagType.HUKS_TAG_TYPE_UINT \| 3 | 表示密钥长度的Tag。 | | HUKS_TAG_DIGEST | HuksTagType.HUKS_TAG_TYPE_UINT \| 4 | 表示摘要算法的Tag。 | @@ -1922,7 +1922,7 @@ async function huksAbort() { | HUKS_TAG_ORIGINATION_EXPIRE_DATETIME | HuksTagType.HUKS_TAG_TYPE_ULONG \| 202 | 预留。 | | HUKS_TAG_USAGE_EXPIRE_DATETIME | HuksTagType.HUKS_TAG_TYPE_ULONG \| 203 | 预留。 | | HUKS_TAG_CREATION_DATETIME | HuksTagType.HUKS_TAG_TYPE_ULONG \| 204 | 预留。 | -| HUKS_TAG_ALL_USERS | ksTagType.HUKS_TAG_TYPE_BOOL \| 301 | 预留。 | +| HUKS_TAG_ALL_USERS | HuksTagType.HUKS_TAG_TYPE_BOOL \| 301 | 预留。 | | HUKS_TAG_USER_ID | HuksTagType.HUKS_TAG_TYPE_UINT \| 302 | 预留。 | | HUKS_TAG_NO_AUTH_REQUIRED | HuksTagType.HUKS_TAG_TYPE_BOOL \| 303 | 预留。 | | HUKS_TAG_USER_AUTH_TYPE | HuksTagType.HUKS_TAG_TYPE_UINT \| 304 | 表示用户认证类型。从[HuksUserAuthType](#huksuserauthtype9)中选择,需要与安全访问控制类型同时设置。支持同时指定两种用户认证类型,如:安全访问控制类型指定为HKS_SECURE_ACCESS_INVALID_NEW_BIO_ENROLL时,密钥访问认证类型可以指定以下三种: HKS_USER_AUTH_TYPE_FACE 、HKS_USER_AUTH_TYPE_FINGERPRINT、HKS_USER_AUTH_TYPE_FACE \| HKS_USER_AUTH_TYPE_FINGERPRINT | @@ -2889,11 +2889,6 @@ huks Handle结构体。 | HUKS_ERROR_NEW_ROOT_KEY_MATERIAL_EXIST | -36 |表示存在新的根密钥材料。| | HUKS_ERROR_UPDATE_ROOT_KEY_MATERIAL_FAIL | -37 |表示更新根密钥材料失败。| | HUKS_ERROR_VERIFICATION_FAILED | -38 |表示验证证书链失败。| -| HUKS_ERROR_GET_USERIAM_SECINFO_FAILED9+ | -40 |表示获取当前用户安全属性信息失败。| -| HUKS_ERROR_GET_USERIAM_AUTHINFO_FAILED9+ | -41 |表示获取当前用户认证信息失败。| -| HUKS_ERROR_USER_AUTH_TYPE_NOT_SUPPORT9+ | -42 |表示不支持当前用户认证类型的访问控制。| -| HUKS_ERROR_KEY_AUTH_FAILED9+ | -43 |表示安全访问控制认证失败。| -| HUKS_ERROR_DEVICE_NO_CREDENTIAL9+ | -44 |表示设备当前未录入凭据。| | HUKS_ERROR_CHECK_GET_ALG_FAIL | -100 |表示检查获取 ALG 失败。| | HUKS_ERROR_CHECK_GET_KEY_SIZE_FAIL | -101 |表示检查获取密钥大小失败。| | HUKS_ERROR_CHECK_GET_PADDING_FAIL | -102 |表示检查获取填充失败。| @@ -2920,7 +2915,5 @@ huks Handle结构体。 | HUKS_ERROR_INVALID_SALT | -123 |表示无效SALT。| | HUKS_ERROR_INVALID_ITERATION | -124 |表示无效的迭代。| | HUKS_ERROR_INVALID_OPERATION | -125 |表示无效操作。| -| HUKS_ERROR_INVALID_WRAPPED_FORMAT9+ | -126 |表示导入加密密钥时,密钥格式错误。| -| HUKS_ERROR_INVALID_USAGE_OF_KEY9+ | -127 |表示导入加密密钥时,密钥用途错误。| | HUKS_ERROR_INTERNAL_ERROR | -999 |表示内部错误。| | HUKS_ERROR_UNKNOWN_ERROR | -1000 |表示未知错误。| \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-i18n.md b/zh-cn/application-dev/reference/apis/js-apis-i18n.md index 44256b9542e9a4ce38a6b11475e6dcba71bb4f71..c2e88eeed1b761482ec958b0add5357f69c07fbc 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-i18n.md +++ b/zh-cn/application-dev/reference/apis/js-apis-i18n.md @@ -1059,7 +1059,7 @@ constructor(country: string, options?: PhoneNumberFormatOptions) | 参数名 | 类型 | 必填 | 说明 | | ------- | ---------------------------------------- | ---- | ---------------- | | country | string | 是 | 表示电话号码所属国家或地区代码。 | -| options | [PhoneNumberFormatOptions](#phonenumberformatoptions8) | 否 | 电话号码格式化对象的相关选项。 | +| options | [PhoneNumberFormatOptions](#phonenumberformatoptions9) | 否 | 电话号码格式化对象的相关选项。 | **示例:** ```js @@ -1149,7 +1149,7 @@ getLocationName(number: string, locale: string): string ``` -## PhoneNumberFormatOptions8+ +## PhoneNumberFormatOptions9+ 表示电话号码格式化对象可设置的属性。 @@ -1194,7 +1194,7 @@ getInstance(locale?:string): IndexUtil **示例:** ```js - let indexUtil= I18n.getInstance("zh-CN"); + let indexUtil = I18n.getInstance("zh-CN"); ``` @@ -1267,7 +1267,7 @@ getIndex(text: string): string **示例:** ```js - let indexUtil= I18n.getInstance("zh-CN"); + let indexUtil = I18n.getInstance("zh-CN"); let index = indexUtil.getIndex("hi"); // index = "H" ``` @@ -1382,7 +1382,7 @@ first(): number **示例:** ```js - let iterator = i18n.getLineInstance("en"); + let iterator = I18n.getLineInstance("en"); iterator.setLineBreakText("Apple is my favorite fruit."); let firstPos = iterator.first(); // firstPos = 0 ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-image.md b/zh-cn/application-dev/reference/apis/js-apis-image.md index 37e3873ff9f58287a76ba217f806c5a75d04d94f..eee086510f9db167d31c1558a2131775a1d7172f 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-image.md +++ b/zh-cn/application-dev/reference/apis/js-apis-image.md @@ -947,8 +947,18 @@ createImageSource(uri: string): ImageSource **示例:** ```js -let context = featureAbility.getContext(); -let path = context.getCacheDir() + "test.jpg"; +//Stage模型 +const context = getContext(this); +const path = context.getCacheDir() + "/test.jpg"; +const imageSourceApi = image.createImageSource(path); +``` + +```js +//FA模型 +import featureAbility from '@ohos.ability.featureAbility'; + +const context = featureAbility.getContext(); +const path = context.getCacheDir() + "/test.jpg"; const imageSourceApi = image.createImageSource(path); ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventData.md b/zh-cn/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventData.md new file mode 100644 index 0000000000000000000000000000000000000000..e84f3b4abffbb032a8a79c489a780ad252158737 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventData.md @@ -0,0 +1,11 @@ +# CommonEventData + +**系统能力:** `SystemCapability.Notification.CommonEvent` + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ---------- |-------------------- | ---- | ---- | ------------------------------------------------------- | +| event | string | 是 | 否 | 表示当前接收的公共事件名称。 | +| bundleName | string | 是 | 否 | 表示包名称。 | +| code | number | 是 | 否 | 表示公共事件的结果代码,用于传递int类型的数据。 | +| data | string | 是 | 否 | 表示公共事件的自定义结果数据,用于传递string类型的数据。 | +| parameters | {[key: string]: any} | 是 | 否 | 表示公共事件的附加信息。 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventPublishData.md b/zh-cn/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventPublishData.md new file mode 100644 index 0000000000000000000000000000000000000000..9d5fe786465e99ce4e85c49310943df600ccb8e6 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventPublishData.md @@ -0,0 +1,13 @@ +# CommonEventPublishData + +**系统能力:** `SystemCapability.Notification.CommonEvent` + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| --------------------- | -------------------- | ---- | ---- | ---------------------------- | +| bundleName | string | 是 | 否 | 表示包名称。 | +| code | number | 是 | 否 | 表示公共事件的结果代码。 | +| data | string | 是 | 否 | 表示公共事件的自定义结果数据。 | +| subscriberPermissions | Array\ | 是 | 否 | 表示订阅者的权限。 | +| isOrdered | boolean | 是 | 否 | 表示是否是有序事件。 | +| isSticky | boolean | 是 | 否 | 表示是否是粘性事件。仅系统应用或系统服务允许发送粘性事件。 | +| parameters | {[key: string]: any} | 是 | 否 | 表示公共事件的附加信息。 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventSubscribeInfo.md b/zh-cn/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventSubscribeInfo.md new file mode 100644 index 0000000000000000000000000000000000000000..6938b5351b61ab96cf8d87cc78fc3333af21cfa6 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventSubscribeInfo.md @@ -0,0 +1,11 @@ +# CommonEventSubscribeInfo + +**系统能力:** `SystemCapability.Notification.CommonEvent` + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ------------------- | -------------- | ---- | ---- | ------------------------------------------------------------ | +| events | Array\ | 是 | 否 | 表示要发送的公共事件。 | +| publisherPermission | string | 是 | 否 | 表示发布者的权限。 | +| publisherDeviceId | string | 是 | 否 | 表示设备ID,该值必须是同一ohos网络上的现有设备ID。 | +| userId | number | 是 | 否 | 表示用户ID。此参数是可选的,默认值当前用户的ID。如果指定了此参数,则该值必须是系统中现有的用户ID。 | +| priority | number | 是 | 否 | 表示订阅者的优先级。值的范围是-100到1000。 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventSubscriber.md b/zh-cn/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventSubscriber.md new file mode 100644 index 0000000000000000000000000000000000000000..411b63e250403b1f5ee916d273f5306c88cda65c --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventSubscriber.md @@ -0,0 +1,750 @@ +# CommonEventSubscriber + +## getCode + +```ts +getCode(callback: AsyncCallback): void +``` + +以回调形式获取公共事件代码。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------- | ---- | ------------------ | +| callback | AsyncCallback\ | 是 | 公共事件代码。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +//获取有序公共事件代码回调 +function getCodeCB(err, code) { + if (err.code) { + console.error(`getCode failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info("getCode " + JSON.stringify(code)); + } +} +subscriber.getCode(getCodeCB); +``` + +## getCode + +```ts +getCode(): Promise +``` + +以Promise形式获取公共事件代码。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**返回值:** + +| 类型 | 说明 | +| ---------------- | -------------------- | +| Promise\ | 公共事件代码。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +subscriber.getCode().then((code) => { + console.info("getCode " + JSON.stringify(code)); +}).catch((err) => { + console.error(`getCode failed, code is ${err.code}, message is ${err.message}`); +}); +``` + +## setCode + +```ts +setCode(code: number, callback: AsyncCallback): void +``` + +以回调形式设置公共事件的代码。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------------- | ---- | ---------------------- | +| code | number | 是 | 公共事件的代码。 | +| callback | AsyncCallback\ | 是 | 表示被指定的回调方法。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +//设置有序公共事件的代码回调 +function setCodeCB(err) { + if (err.code) { + console.error(`setCode failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info("setCode"); + } +} +subscriber.setCode(1, setCodeCB); +``` + +## setCode + +```ts +setCode(code: number): Promise +``` + +以Promise形式设置公共事件的代码。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ------------------ | +| code | number | 是 | 公共事件的代码。 | + +**返回值:** + +| 类型 | 说明 | +| ---------------- | -------------------- | +| Promise\ | 返回一个Promise的结果。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +subscriber.setCode(1).then(() => { + console.info("setCode"); +}).catch((err) => { + console.error(`setCode failed, code is ${err.code}, message is ${err.message}`); +}); +``` + +## getData + +```ts +getData(callback: AsyncCallback): void +``` + +以回调形式获取公共事件的数据。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------- | ---- | -------------------- | +| callback | AsyncCallback\ | 是 | 公共事件的数据。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +//获取有序公共事件代码数据回调 +function getDataCB(err, data) { + if (err.code) { + console.error(`getData failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info("getData " + JSON.stringify(data)); + } +} +subscriber.getData(getDataCB); +``` + +## getData + +```ts +getData(): Promise +``` + +以Promise形式获取公共事件的数据。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**返回值:** + +| 类型 | 说明 | +| ---------------- | ------------------ | +| Promise\ | 公共事件的数据。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +subscriber.getData().then((data) => { + console.info("getData " + JSON.stringify(data)); +}).catch((err) => { + console.error(`getData failed, code is ${err.code}, message is ${err.message}`); +}); +``` + +## setData + +setData(data: string, callback: AsyncCallback\): void + +以回调形式设置公共事件的数据。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------------- | ---- | -------------------- | +| data | string | 是 | 公共事件的数据。 | +| callback | AsyncCallback\ | 是 | 表示被指定的回调方法。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +//设置有序公共事件的结果数据回调 +function setDataCB(err) { + if (err.code) { + console.error(`setCode failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info("setData"); + } +} +subscriber.setData("publish_data_changed", setDataCB); +``` + +## setData + +```ts +setData(data: string): Promise +``` + +以Promise形式设置公共事件的果数据。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------- | +| data | string | 是 | 公共事件的数据。 | + +**返回值:** + +| 类型 | 说明 | +| ---------------- | -------------------- | +| Promise\ | 返回一个Promise的结果。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +subscriber.setData("publish_data_changed").then(() => { + console.info("setData"); +}).catch((err) => { + console.error(`setCode failed, code is ${err.code}, message is ${err.message}`); +}); +``` + +## setCodeAndData + +```ts +setCodeAndData(code: number, data: string, callback:AsyncCallback): void +``` + +以回调形式设置公共事件代码和数据。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------------- | ---- | ---------------------- | +| code | number | 是 | 公共事件的代码。 | +| data | string | 是 | 公共事件的数据。 | +| callback | AsyncCallback\ | 是 | 表示被指定的回调方法。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +//设置有序公共事件的代码和数据回调 +function setCodeDataCB(err) { + if (err.code) { + console.error(`setCodeAndData failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info("setCodeDataCallback"); + } +} +subscriber.setCodeAndData(1, "publish_data_changed", setCodeDataCB); +``` + +## setCodeAndData + +```ts +setCodeAndData(code: number, data: string): Promise +``` + +以Promise形式设置公共事件的代码和数据。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------- | +| code | number | 是 | 公共事件的代码。 | +| data | string | 是 | 公共事件的数据。 | + +**返回值:** + +| 类型 | 说明 | +| ---------------- | -------------------- | +| Promise\ | 返回一个Promise。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +subscriber.setCodeAndData(1, "publish_data_changed").then(() => { + console.info("setCodeAndData"); +}).catch((err) => { + console.error(`setCodeAndData failed, code is ${err.code}, message is ${err.message}`); +}); +``` + +## isOrderedCommonEvent + +```ts +isOrderedCommonEvent(callback: AsyncCallback): void +``` + +以回调形式查询当前公共事件的是否为有序公共事件。 + +返回true代表是有序公共事件,false代表不是有序公共事件。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------- | ---- | ---------------------------------- | +| callback | AsyncCallback\ | 是 | 当前公共事件的是否为有序公共事件。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +//获取当前公共事件是否为有序事件的回调 +function isOrderedCB(err, isOrdered) { + if (err.code) { + console.error(`isOrderedCommonEvent failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info("isOrdered " + JSON.stringify(isOrdered)); + } +} +subscriber.isOrderedCommonEvent(isOrderedCB); +``` + +## isOrderedCommonEvent + +```ts +isOrderedCommonEvent(): Promise +``` + +以Promise形式查询当前公共事件的是否为有序公共事件。 + +返回true代表是有序公共事件,false代表不是有序公共事件。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**返回值:** + +| 类型 | 说明 | +| ----------------- | -------------------------------- | +| Promise\ | 当前公共事件的是否为有序公共事件。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +subscriber.isOrderedCommonEvent().then((isOrdered) => { + console.info("isOrdered " + JSON.stringify(isOrdered)); +}).catch((err) => { + console.error(`isOrdered failed, code is ${err.code}, message is ${err.message}`); +}); +``` + +## isStickyCommonEvent + +```ts +isStickyCommonEvent(callback: AsyncCallback): void +``` + +以回调形式检查当前公共事件是否为一个粘性事件。 + +返回true代表是粘性公共事件,false代表不是粘性公共事件。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------- | ---- | ---------------------------------- | +| callback | AsyncCallback\ | 是 | 当前公共事件的是否为粘性公共事件。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +//获取当前公共事件是否为粘性事件的回调 +function isStickyCB(err, isSticky) { + if (err.code) { + console.error(`isStickyCommonEvent failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info("isSticky " + JSON.stringify(isSticky)); + } +} +subscriber.isStickyCommonEvent(isStickyCB); +``` + +## isStickyCommonEvent + +```ts +isStickyCommonEvent(): Promise +``` + +以Promise形式检查当前公共事件是否为一个粘性事件。 + +返回true代表是粘性公共事件,false代表不是粘性公共事件。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**返回值:** + +| 类型 | 说明 | +| ----------------- | -------------------------------- | +| Promise\ | 当前公共事件的是否为粘性公共事件。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +subscriber.isStickyCommonEvent().then((isSticky) => { + console.info("isSticky " + JSON.stringify(isSticky)); +}).catch((err) => { + console.error(`isSticky failed, code is ${err.code}, message is ${err.message}`); +}); +``` + +## abortCommonEvent + +```ts +abortCommonEvent(callback: AsyncCallback): void +``` + +以回调形式取消当前的有序公共事件,取消后,有序公共事件不再向下一个订阅者传递。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------------- | ---- | -------------------- | +| callback | AsyncCallback\ | 是 | 取消当前的有序公共事件。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +//取消当前有序公共事件的回调 +function abortCB(err) { + if (err.code) { + console.error(`abortCommonEvent failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info("abortCommonEvent"); + } +} +subscriber.abortCommonEvent(abortCB); +``` + +## abortCommonEvent + +```ts +abortCommonEvent(): Promise +``` + +以Promise形式取消当前的有序公共事件,取消后,公共事件不再向下一个订阅者传递。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**返回值:** + +| 类型 | 说明 | +| ---------------- | -------------------- | +| Promise\ | 返回一个Promise的结果。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +subscriber.abortCommonEvent().then(() => { + console.info("abortCommonEvent"); +}).catch((err) => { + console.error(`abortCommonEvent failed, code is ${err.code}, message is ${err.message}`); +}); +``` + +## clearAbortCommonEvent + +```ts +clearAbortCommonEvent(callback: AsyncCallback): void +``` + +以回调形式清除当前有序公共事件。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------------- | ---- | -------------------- | +| callback | AsyncCallback\ | 是 | 表示被指定的回调方法。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +//清除当前公共事件取消状态的回调 +function clearAbortCB(err) { + if (err.code) { + console.error(`clearAbortCommonEvent failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info("clearAbortCommonEvent"); + } +} +subscriber.clearAbortCommonEvent(clearAbortCB); +``` + +## clearAbortCommonEvent + +```ts +clearAbortCommonEvent(): Promise +``` + +以Promise形式清除当前有序公共事件。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**返回值:** + +| 类型 | 说明 | +| ---------------- | -------------------- | +| Promise\ | 返回一个Promise的结果。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +subscriber.clearAbortCommonEvent().then(() => { + console.info("clearAbortCommonEvent"); +}).catch((err) => { + console.error(`clearAbortCommonEvent failed, code is ${err.code}, message is ${err.message}`); +}); +``` + +## getAbortCommonEvent + +```ts +getAbortCommonEvent(callback: AsyncCallback): void +``` + +以回调形式获取当前有序公共事件是否取消的状态。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------- | ---- | ---------------------------------- | +| callback | AsyncCallback\ | 是 | 表示当前有序公共事件是否取消的状态。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +//获取当前有序公共事件是否取消的回调 +function getAbortCB(err, abortEvent) { + if (err.code) { + console.error(`getAbortCommonEvent failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info("abortCommonEvent " + abortEvent) + } +} +subscriber.getAbortCommonEvent(getAbortCB); +``` + +## getAbortCommonEvent + +```ts +getAbortCommonEvent(): Promise +``` + +以Promise形式获取当前有序公共事件是否取消的状态。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**返回值:** + +| 类型 | 说明 | +| ----------------- | ---------------------------------- | +| Promise\ | 表示当前有序公共事件是否取消的状态。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +subscriber.getAbortCommonEvent().then((abortEvent) => { + console.info("abortCommonEvent " + JSON.stringify(abortEvent)); +}).catch((err) => { + console.error(`getAbortCommonEvent failed, code is ${err.code}, message is ${err.message}`); +}); +``` + +## getSubscribeInfo + +```ts +getSubscribeInfo(callback: AsyncCallback): void +``` + +以回调形式获取订阅者的订阅信息。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------------ | ---- | ---------------------- | +| callback | AsyncCallback\<[CommonEventSubscribeInfo](./js-apis-inner-commonEvent-commonEventSubscribeInfo.md)> | 是 | 表示订阅者的订阅信息。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +//获取订阅者信息回调 +function getCB(err, subscribeInfo) { + if (err.code) { + console.error(`getSubscribeInfo failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info("subscribeInfo " + JSON.stringify(subscribeInfo)); + } +} +subscriber.getSubscribeInfo(getCB); +``` + +## getSubscribeInfo + +```ts +getSubscribeInfo(): Promise +``` + +以Promise形式获取订阅者的订阅信息。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------------------ | ---------------------- | +| Promise\<[CommonEventSubscribeInfo](./js-apis-inner-commonEvent-commonEventSubscribeInfo.md)> | 表示订阅者的订阅信息。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +subscriber.getSubscribeInfo().then((subscribeInfo) => { + console.info("subscribeInfo " + JSON.stringify(subscribeInfo)); +}).catch((err) => { + console.error(`getSubscribeInfo failed, code is ${err.code}, message is ${err.message}`); +}); +``` + +## finishCommonEvent9+ + +```ts +finishCommonEvent(callback: AsyncCallback): void +``` + +以回调形式结束当前有序公共事件。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------------- | ---- | -------------------------------- | +| callback | AsyncCallback\ | 是 | 表示有序公共事件结束后的回调函数。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +//结束当前有序公共事件的回调 +function finishCB(err) { + if (err.code) { + console.error(`finishCommonEvent failed, code is ${err.code}, message is ${err.message}`); +} else { + console.info("FinishCommonEvent"); +} + +subscriber.finishCommonEvent(finishCB); +``` + +## finishCommonEvent9+ + +```ts +finishCommonEvent(): Promise +``` + +以Promise形式结束当前有序公共事件。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**返回值:** + +| 类型 | 说明 | +| ---------------- | -------------------- | +| Promise\ | 返回一个Promise的结果。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +subscriber.finishCommonEvent().then(() => { + console.info("FinishCommonEvent"); +}).catch((err) => { + console.error(`finishCommonEvent failed, code is ${err.code}, message is ${err.message}`); +}); +``` \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationActionButton.md b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationActionButton.md new file mode 100644 index 0000000000000000000000000000000000000000..d822600d6939bf2c981a1ddbd611d2d6672816ca --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationActionButton.md @@ -0,0 +1,16 @@ +# NotificationActionButton + +描述通知中显示的操作按钮。 + +> **说明:** +> +> 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| --------- | ----------------------------------------------- | --- | ---- | ------------------------- | +| title | string | 是 | 是 | 按钮标题。 | +| wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | 是 | 是 | 点击按钮时触发的WantAgent。 | +| extras | { [key: string]: any } | 是 | 是 | 按钮扩展信息。 | +| userInput8+ | [NotificationUserInput](js-apis-inner-notification-notificationUserInput.md) | 是 | 是 | 用户输入对象实例。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationCommonDef.md b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationCommonDef.md new file mode 100644 index 0000000000000000000000000000000000000000..5d3e7eee4755935751d1aaa1859fa16d3663197b --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationCommonDef.md @@ -0,0 +1,16 @@ +# NotificationCommonDef + +> **说明:** +> +> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + +## BundleOption + +BundleOption模块为指定应用的包信息。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification + +| 名称 | 类型 | 必填 | 说明 | +| ------ | ------ |---- | ------ | +| bundle | string | 是 | 应用的包信息。 | +| uid | number | 否 | 用户ID。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationContent.md b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationContent.md new file mode 100644 index 0000000000000000000000000000000000000000..be8496b25a4909e2c7f2796e7e98c1381b50dfe1 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationContent.md @@ -0,0 +1,77 @@ +# NotificationContent + +描述通知类型。 + +> **说明:** +> +> 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ----------- | ------------------------------------------------------------ | ---- | --- | ------------------ | +| contentType | [ContentType](./js-apis-notificationManager.md#contenttype) | 是 | 是 | 通知内容类型。 | +| normal | [NotificationBasicContent](#notificationbasiccontent) | 是 | 是 | 基本类型通知内容。 | +| longText | [NotificationLongTextContent](#notificationlongtextcontent) | 是 | 是 | 长文本类型通知内容。 | +| multiLine | [NotificationMultiLineContent](#notificationmultilinecontent) | 是 | 是 | 多行类型通知内容。 | +| picture | [NotificationPictureContent](#notificationpicturecontent) | 是 | 是 | 图片类型通知内容。 | + +## NotificationBasicContent + +描述普通文本通知。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| -------------- | ------ | ---- | ---- | ---------------------------------- | +| title | string | 是 | 是 | 通知标题。 | +| text | string | 是 | 是 | 通知内容。 | +| additionalText | string | 是 | 是 | 通知附加内容,是对通知内容的补充。 | + + +## NotificationLongTextContent + +描述长文本通知。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| -------------- | ------ | ---- | --- | -------------------------------- | +| title | string | 是 | 是 | 通知标题。 | +| text | string | 是 | 是 | 通知内容。 | +| additionalText | string | 是 | 是 | 通知附加内容,是对通知内容的补充。 | +| longText | string | 是 | 是 | 通知的长文本。 | +| briefText | string | 是 | 是 | 通知概要内容,是对通知内容的总结。 | +| expandedTitle | string | 是 | 是 | 通知展开时的标题。 | + + +## NotificationMultiLineContent + +描述多行文本通知。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| -------------- | --------------- | --- | --- | -------------------------------- | +| title | string | 是 | 是 | 通知标题。 | +| text | string | 是 | 是 | 通知内容。 | +| additionalText | string | 是 | 是 | 通知附加内容,是对通知内容的补充。 | +| briefText | string | 是 | 是 | 通知概要内容,是对通知内容的总结。 | +| longTitle | string | 是 | 是 | 通知展开时的标题。 | +| lines | Array\ | 是 | 是 | 通知的多行文本。 | + + +## NotificationPictureContent + +描述附有图片的通知。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| -------------- | -------------- | ---- | --- | -------------------------------- | +| title | string | 是 | 是 | 通知标题。 | +| text | string | 是 | 是 | 通知内容。 | +| additionalText | string | 是 | 是 | 通知附加内容,是对通知内容的补充。 | +| briefText | string | 是 | 是 | 通知概要内容,是对通知内容的总结。 | +| expandedTitle | string | 是 | 是 | 通知展开时的标题。 | +| picture | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 | 是 | 通知的图片内容。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationFlags.md b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationFlags.md new file mode 100644 index 0000000000000000000000000000000000000000..1dfc0990395386c786064be441c7c413d2fc744c --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationFlags.md @@ -0,0 +1,29 @@ +# NotificationFlags + +描述通知标志的实例。 + +> **说明:** +> +> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ---------------- | ---------------------- | ---- | ---- | --------------------------------- | +| soundEnabled | [NotificationFlagStatus](#notificationflagstatus) | 是 | 否 | 是否启用声音提示。 | +| vibrationEnabled | [NotificationFlagStatus](#notificationflagstatus) | 是 | 否 | 是否启用振动提醒功能。 | + + +## NotificationFlagStatus + +描述通知标志状态。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification + +**系统接口**:此接口为系统接口,三方应用不支持调用。 + +| 名称 | 值 | 说明 | +| -------------- | --- | --------------------------------- | +| TYPE_NONE | 0 | 默认标志。 | +| TYPE_OPEN | 1 | 通知标志打开。 | +| TYPE_CLOSE | 2 | 通知标志关闭。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationRequest.md b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationRequest.md new file mode 100644 index 0000000000000000000000000000000000000000..9c37ecd7a7fa595eb456796051157c62cf30ae68 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationRequest.md @@ -0,0 +1,63 @@ +# NotificationRequest + +描述通知的请求。 + +> **说明:** +> +> 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| --------------------- | --------------------------------------------- | ---- | --- | -------------------------- | +| content | [NotificationContent](js-apis-inner-notification-notificationContent.md#notificationcontent) | 是 | 是 | 通知内容。 | +| id | number | 是 | 是 | 通知ID。 | +| slotType | [SlotType](js-apis-notificationManager.md#slottype) | 是 | 是 | 通道类型。 | +| isOngoing | boolean | 是 | 是 | 是否进行时通知。 | +| isUnremovable | boolean | 是 | 是 | 是否可移除。 | +| deliveryTime | number | 是 | 是 | 通知发送时间。 | +| tapDismissed | boolean | 是 | 是 | 通知是否自动清除。 | +| autoDeletedTime | number | 是 | 是 | 自动清除的时间。 | +| wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | 是 | 是 | WantAgent封装了应用的行为意图,点击通知时触发该行为。 | +| extraInfo | {[key: string]: any} | 是 | 是 | 扩展参数。 | +| color | number | 是 | 是 | 通知背景颜色。预留能力,暂未支持。 | +| colorEnabled | boolean | 是 | 是 | 通知背景颜色是否使能。预留能力,暂未支持。 | +| isAlertOnce | boolean | 是 | 是 | 设置是否仅有一次此通知提醒。 | +| isStopwatch | boolean | 是 | 是 | 是否显示已用时间。 | +| isCountDown | boolean | 是 | 是 | 是否显示倒计时时间。 | +| isFloatingIcon | boolean | 是 | 是 | 是否显示状态栏图标。 | +| label | string | 是 | 是 | 通知标签。 | +| badgeIconStyle | number | 是 | 是 | 通知角标类型。 | +| showDeliveryTime | boolean | 是 | 是 | 是否显示分发时间。 | +| actionButtons | Array\<[NotificationActionButton](js-apis-inner-notification-notificationActionButton.md)\> | 是 | 是 | 通知按钮,最多三个按钮。 | +| smallIcon | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 | 是 | 通知小图标。可选字段,大小不超过30KB。 | +| largeIcon | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 | 是 | 通知大图标。可选字段,大小不超过30KB。 | +| creatorBundleName | string | 是 | 否 | 创建通知的包名。 | +| creatorUid8+ | number | 是 | 否 | 创建通知的UID。 | +| creatorPid | number | 是 | 否 | 创建通知的PID。 | +| creatorUserId| number | 是 | 否 | 创建通知的UserId。 | +| hashCode | string | 是 | 否 | 通知唯一标识。 | +| classification | string | 是 | 是 | 通知分类。
**系统API**: 此接口为系统接口,三方应用不支持调用。 | +| groupName8+ | string | 是 | 是 | 组通知名称。 | +| template8+ | [NotificationTemplate](./js-apis-inner-notification-notificationTemplate.md) | 是 | 是 | 通知模板。 | +| isRemoveAllowed8+ | boolean | 是 | 否 | 通知是否能被移除。
**系统API**: 此接口为系统接口,三方应用不支持调用。 | +| source8+ | number | 是 | 否 | 通知源。
**系统API**: 此接口为系统接口,三方应用不支持调用。 | +| distributedOption8+ | [DistributedOptions](#distributedoptions) | 是 | 是 | 分布式通知的选项。 | +| deviceId8+ | string | 是 | 否 | 通知源的deviceId。
**系统API**: 此接口为系统接口,三方应用不支持调用。 | +| notificationFlags8+ | [NotificationFlags](js-apis-inner-notification-notificationflags#notificationFlags) | 是 | 否 | 获取NotificationFlags。 | +| removalWantAgent9+ | [WantAgent](js-apis-app-ability-wantAgent.md) | 是 | 是 | 当移除通知时,通知将被重定向到的WantAgent实例。 | +| badgeNumber9+ | number | 是 | 是 | 应用程序图标上显示的通知数。 | + + +## DistributedOptions + +描述分布式选项。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ---------------------- | -------------- | ---- | ---- | ---------------------------------- | +| isDistributed8+ | boolean | 是 | 是 | 是否为分布式通知。 | +| supportDisplayDevices8+ | Array\ | 是 | 是 | 可以同步通知到的设备列表。 | +| supportOperateDevices8+ | Array\ | 是 | 是 | 可以打开通知的设备列表。 | +| remindType8+ | number | 是 | 否 | 通知的提醒方式。
**系统API**: 此接口为系统接口,三方应用不支持调用。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationSlot.md b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationSlot.md new file mode 100644 index 0000000000000000000000000000000000000000..27d5aec3672ee7caa0eefd640153f3ee70514a3a --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationSlot.md @@ -0,0 +1,24 @@ +# NotificationSlot + +描述通知槽 + +> **说明:** +> +> 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| -------------------- | --------------------- | ---- | --- | ------------------------------------------ | +| type | [SlotType](js-apis-notificationManager.md#slottype) | 是 | 是 | 通道类型。 | +| level | number | 是 | 是 | 通知级别,不设置则根据通知渠道类型有默认值。 | +| desc | string | 是 | 是 | 通知渠道描述信息。 | +| badgeFlag | boolean | 是 | 是 | 是否显示角标。 | +| bypassDnd | boolean | 是 | 是 | 置是否在系统中绕过免打扰模式。 | +| lockscreenVisibility | number | 是 | 是 | 在锁定屏幕上显示通知的模式。 | +| vibrationEnabled | boolean | 是 | 是 | 是否可振动。 | +| sound | string | 是 | 是 | 通知提示音。 | +| lightEnabled | boolean | 是 | 是 | 是否闪灯。 | +| lightColor | number | 是 | 是 | 通知灯颜色。 | +| vibrationValues | Array\ | 是 | 是 | 通知振动样式。 | +| enabled9+ | boolean | 是 | 否 | 此通知插槽中的启停状态。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationTemplate.md b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationTemplate.md new file mode 100644 index 0000000000000000000000000000000000000000..58e9d4442712e965f56d6837de8d9cbfef010544 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationTemplate.md @@ -0,0 +1,14 @@ +# NotificationTemplate + +通知模板。 + +> **说明:** +> +> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ---- | ---------------------- | ---- | ---- | ---------- | +| name | string | 是 | 是 | 模板名称。 | +| data | {[key:string]: Object} | 是 | 是 | 模板数据。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationUserInput.md b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationUserInput.md new file mode 100644 index 0000000000000000000000000000000000000000..bc60f868ba6d787cbacf2b79e50102b7f06cb103 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationUserInput.md @@ -0,0 +1,13 @@ +# NotificationUserInput + +保存用户输入的通知消息。 + +> **说明:** +> +> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + +**系统能力**:SystemCapability.Notification.Notification + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| -------- | ------ | --- | ---- | ----------------------------- | +| inputKey | string | 是 | 是 | 用户输入时用于标识此输入的key。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-inputmethod-extension-context.md b/zh-cn/application-dev/reference/apis/js-apis-inputmethod-extension-context.md index 3172154aacf3db947647566612a1d5e6736f1af0..a309cd10dc40f03482b744b2ee54b0df710d9be5 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inputmethod-extension-context.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inputmethod-extension-context.md @@ -51,7 +51,7 @@ this.context.destroy((err) => { ## InputMethodExtensionContext.destroy -destroy(): Promise; 停止输入法应用自身。通过Promise异步回调。 @@ -61,7 +61,7 @@ destroy(): Promise; | 无返回结果的Promise对象。 | **示例:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-inputmethod.md b/zh-cn/application-dev/reference/apis/js-apis-inputmethod.md index 6a36a1ef096a9c61f584a3dec9e6838a8971b1a2..2d4b2df2972a032f88224b7c96ded371fc3e843f 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inputmethod.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inputmethod.md @@ -1149,8 +1149,6 @@ showOptionalInputMethods(callback: AsyncCallback<boolean>): void 显示输入法选择对话框。使用callback异步回调。 -**需要权限:** ohos.permission.CONNECT_IME_ABILITY,仅系统应用可用。 - **系统能力:** SystemCapability.MiscServices.InputMethodFramework **参数:** @@ -1189,8 +1187,6 @@ showOptionalInputMethods(): Promise<boolean> 显示输入法选择对话框。使用promise异步回调。 -**需要权限:** ohos.permission.CONNECT_IME_ABILITY,仅系统应用可用。 - **系统能力:** SystemCapability.MiscServices.InputMethodFramework **返回值:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md b/zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md index 72f116c900e3921315385e2dab0d54dd277e6bec..2e1eab7f697c4dcb9a987819e88332fd0afabc80 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md @@ -708,7 +708,7 @@ hide(callback: AsyncCallback<void>): void | 错误码ID | 错误信息 | | -------- | -------------------------- | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **示例:** @@ -742,7 +742,7 @@ hide(): Promise<void> | 错误码ID | 错误信息 | | -------- | -------------------------- | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **示例:** @@ -837,7 +837,7 @@ sendKeyFunction(action:number, callback: AsyncCallback<boolean>): void | 错误码ID | 错误信息 | | -------- | -------------------------- | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **示例:** @@ -886,7 +886,7 @@ sendKeyFunction(action: number): Promise<boolean> | 错误码ID | 错误信息 | | -------- | -------------------------- | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **示例:** @@ -928,7 +928,7 @@ getForward(length:number, callback: AsyncCallback<string>): void | 错误码ID | 错误信息 | | -------- | ------------------------------ | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | | 12800006 | Input method controller error. | **示例:** @@ -974,7 +974,7 @@ getForward(length:number): Promise<string> | 错误码ID | 错误信息 | | -------- | ------------------------------ | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | | 12800006 | Input method controller error. | **示例:** @@ -1013,7 +1013,7 @@ getBackward(length:number, callback: AsyncCallback<string>): void | 错误码ID | 错误信息 | | -------- | ------------------------------ | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | | 12800006 | Input method controller error. | **示例:** @@ -1059,7 +1059,7 @@ getBackward(length:number): Promise<string> | 错误码ID | 错误信息 | | -------- | ------------------------------ | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | | 12800006 | Input method controller error. | **示例:** @@ -1099,7 +1099,7 @@ deleteForward(length:number, callback: AsyncCallback<boolean>): void | 错误码ID | 错误信息 | | -------- | -------------------------- | | 12800002 | Input method engine error. | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **示例:** @@ -1149,7 +1149,7 @@ deleteForward(length:number): Promise<boolean> | 错误码ID | 错误信息 | | -------- | -------------------------- | | 12800002 | Input method engine error. | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **示例:** @@ -1192,7 +1192,7 @@ deleteBackward(length:number, callback: AsyncCallback<boolean>): void | 错误码ID | 错误信息 | | -------- | -------------------------- | | 12800002 | Input method engine error. | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **示例:** @@ -1242,7 +1242,7 @@ deleteBackward(length:number): Promise<boolean> | 错误码ID | 错误信息 | | -------- | -------------------------- | | 12800002 | Input method engine error. | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **示例:** @@ -1281,7 +1281,7 @@ insertText(text:string, callback: AsyncCallback<boolean>): void | 错误码ID | 错误信息 | | -------- | -------------------------- | | 12800002 | Input method engine error. | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **示例:** @@ -1326,7 +1326,7 @@ insertText(text:string): Promise<boolean> | 错误码ID | 错误信息 | | -------- | -------------------------- | | 12800002 | Input method engine error. | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **示例:** @@ -1366,7 +1366,7 @@ getEditorAttribute(callback: AsyncCallback<EditorAttribute>): void | 错误码ID | 错误信息 | | -------- | -------------------------- | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **示例:** @@ -1401,7 +1401,7 @@ getEditorAttribute(): Promise<EditorAttribute> | 错误码ID | 错误信息 | | -------- | -------------------------- | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **示例:** @@ -1435,7 +1435,7 @@ moveCursor(direction: number, callback: AsyncCallback<void>): void | 错误码ID | 错误信息 | | -------- | -------------------------- | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **示例:** @@ -1479,7 +1479,7 @@ moveCursor(direction: number): Promise<void> | 错误码ID | 错误信息 | | -------- | -------------------------- | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **示例:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-installer.md b/zh-cn/application-dev/reference/apis/js-apis-installer.md index 2514a26dca6b475ce64bd082801fd2036d85185d..96a8f14d28c718bed51a2ef8109425d2410f1012 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-installer.md +++ b/zh-cn/application-dev/reference/apis/js-apis-installer.md @@ -174,7 +174,6 @@ uninstall(bundleName: string, installParam: InstallParam, callback: AsyncCallbac | -------- | ------------------------------------------------------------ | | 17700004 | The specified user ID is not found. | | 17700020 | The specified bundle is pre-installed bundle which cannot be uninstalled. | -| 17700101 | The system service is excepted. | **示例:** @@ -283,7 +282,7 @@ try { | 名称 | 类型 | 必填 | 说明 | | ------------------------------ | ------------------------------ | ------------------ | ------------------ | -| userId | number | 是 | 指示用户id,可使用[queryOsAccountLocalIdFromProcess](js-apis-osAccount.md#queryosaccountlocalidfromprocess9)获取当前进程所在用户。 | +| userId | number | 是 | 指示用户id,可使用[queryOsAccountLocalIdFromProcess](js-apis-osAccount.md#getOsAccountLocalId)获取当前进程所在用户。 | | installFlag | number | 是 | 指示安装标志,枚举值:0:应用初次安装,1:应用覆盖安装。 | | isKeepData | boolean | 是 | 卸载时是否保留数据目录。 | | hashParams | Array<[HashParam](#hashparam)> | 是 | 哈希值参数。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-intl.md b/zh-cn/application-dev/reference/apis/js-apis-intl.md index 584bd5b433ad8435b4c5067b4ec71823219bad56..1065a275779112f4950ce0c8316c02699444c798 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-intl.md +++ b/zh-cn/application-dev/reference/apis/js-apis-intl.md @@ -67,7 +67,7 @@ constructor(locale: string, options?: LocaleOptions) | 参数名 | 类型 | 必填 | 说明 | | -------------------- | -------------------------------- | ---- | ---------------------------- | | locale | string | 是 | 包含区域信息的字符串,包括语言以、脚本、国家或地区。语言、脚本、国家或地区的国际标准及组合方式请见[Intl开发指导](../../internationalization/intl-guidelines.md#设置区域信息) | -| options9+ | [LocaleOptions](#localeoptions6) | 否 | 用于创建区域对象的选项。 | +| options9+ | [LocaleOptions](#localeoptions9) | 否 | 用于创建区域对象的选项。 | **示例:** ```js @@ -159,7 +159,7 @@ minimize(): Locale ``` -## LocaleOptions6+ +## LocaleOptions9+ 表示区域初始化选项。 @@ -206,7 +206,7 @@ constructor(locale: string | Array<string>, options?: DateTimeOptions) | 参数名 | 类型 | 必填 | 说明 | | -------------------- | ------------------------------------ | ---- | ---------------------------- | | locale | string \| Array<string> | 是 | 包含区域设置信息的字符串,包括语言以及可选的脚本和区域。 | -| options9+ | [DateTimeOptions](#datetimeoptions6) | 否 | 用于创建时间日期格式化的选项。 | +| options9+ | [DateTimeOptions](#datetimeoptions9) | 否 | 用于创建时间日期格式化的选项。 | **示例:** ```js @@ -298,7 +298,7 @@ resolvedOptions(): DateTimeOptions | 类型 | 说明 | | ------------------------------------ | ----------------------------- | -| [DateTimeOptions](#datetimeoptions6) | DateTimeFormat 对象的格式化选项。 | +| [DateTimeOptions](#datetimeoptions9) | DateTimeFormat 对象的格式化选项。 | **示例:** ```js @@ -310,7 +310,7 @@ resolvedOptions(): DateTimeOptions ``` -## DateTimeOptions6+ +## DateTimeOptions9+ 表示时间日期格式化选项。 @@ -370,7 +370,7 @@ constructor(locale: string | Array<string>, options?: NumberOptions) | 参数名 | 类型 | 必填 | 说明 | | -------------------- | -------------------------------- | ---- | ---------------------------- | | locale | string \| Array<string> | 是 | 包含区域设置信息的字符串,包括语言以及可选的脚本和区域。 | -| options9+ | [NumberOptions](#numberoptions6) | 否 | 用于创建数字格式化的选项。 | +| options9+ | [NumberOptions](#numberoptions9) | 否 | 用于创建数字格式化的选项。 | **示例:** ```js @@ -420,7 +420,7 @@ resolvedOptions(): NumberOptions | 类型 | 说明 | | -------------------------------- | --------------------------- | -| [NumberOptions](#numberoptions6) | NumberFormat 对象的格式化选项。 | +| [NumberOptions](#numberoptions9) | NumberFormat 对象的格式化选项。 | **示例:** @@ -433,7 +433,7 @@ resolvedOptions(): NumberOptions ``` -## NumberOptions6+ +## NumberOptions9+ 表示设备支持的能力。 @@ -493,7 +493,7 @@ constructor(locale: string | Array<string>, options?: CollatorOptions) | 参数名 | 类型 | 必填 | 说明 | | -------------------- | ------------------------------------ | ---- | ---------------------------- | | locale | string \| Array<string> | 是 | 包含区域设置信息的字符串,包括语言以及可选的脚本和区域。 | -| options9+ | [CollatorOptions](#collatoroptions8) | 否 | 用于创建排序对象的选项。 | +| options9+ | [CollatorOptions](#collatoroptions9) | 否 | 用于创建排序对象的选项。 | **示例:** ```js @@ -544,7 +544,7 @@ resolvedOptions(): CollatorOptions | 类型 | 说明 | | ------------------------------------ | ----------------- | -| [CollatorOptions](#collatoroptions8) | 返回的Collator对象的属性。 | +| [CollatorOptions](#collatoroptions9) | 返回的Collator对象的属性。 | **示例:** ```js @@ -556,7 +556,7 @@ resolvedOptions(): CollatorOptions ``` -## CollatorOptions8+ +## CollatorOptions9+ 表示Collator可设置的属性。 @@ -604,7 +604,7 @@ constructor(locale: string | Array<string>, options?: PluralRulesOptions) | 参数名 | 类型 | 必填 | 说明 | | -------------------- | ---------------------------------------- | ---- | ---------------------------- | | locale | string \| Array<string> | 是 | 包含区域设置信息的字符串,包括语言以及可选的脚本和区域。 | -| options9+ | [PluralRulesOptions](#pluralrulesoptions8) | 否 | 用于创建单复数对象的选项。 | +| options9+ | [PluralRulesOptions](#pluralrulesoptions9) | 否 | 用于创建单复数对象的选项。 | **示例:** ```js @@ -647,7 +647,7 @@ select(n: number): string ``` -## PluralRulesOptions8+ +## PluralRulesOptions9+ 表示PluralRules对象可设置的属性。 @@ -695,7 +695,7 @@ constructor(locale: string | Array<string>, options?: RelativeTimeFormatIn | 参数名 | 类型 | 必填 | 说明 | | -------------------- | ---------------------------------------- | ---- | ---------------------------- | | locale | string \| Array<string> | 是 | 包含区域设置信息的字符串,包括语言以及可选的脚本和区域。 | -| options9+ | [RelativeTimeFormatInputOptions](#relativetimeformatinputoptions8) | 否 | 用于创建相对时间格式化对象的选项。 | +| options9+ | [RelativeTimeFormatInputOptions](#relativetimeformatinputoptions9) | 否 | 用于创建相对时间格式化对象的选项。 | **示例:** ```js @@ -787,7 +787,7 @@ resolvedOptions(): RelativeTimeFormatResolvedOptions ``` -## RelativeTimeFormatInputOptions8+ +## RelativeTimeFormatInputOptions9+ 表示RelativeTimeFormat对象可设置的属性。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-media.md b/zh-cn/application-dev/reference/apis/js-apis-media.md index 16fde9ac18de28681b74d37e43413684392bb20c..4b7051bd362f1d27bff16d338a1fe06fc97cf3c9 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-media.md +++ b/zh-cn/application-dev/reference/apis/js-apis-media.md @@ -925,6 +925,14 @@ getTrackDescription(callback: AsyncCallback\>): void **示例:** ```js +printfDescription(obj) { + for (let item in obj) { + let property = obj[item]; + console.info('audio key is ' + item); + console.info('audio value is ' + property); + } +} + avPlayer.getTrackDescription((error, arrList) => { if ((arrList) != null) { for (let i = 0; i < arrList.length; i++) { @@ -962,6 +970,14 @@ getTrackDescription(): Promise\> ```js let arrayDescription; + +printfDescription(obj) { + for (let item in obj) { + let property = obj[item]; + console.info('audio key is ' + item); + console.info('audio value is ' + property); + } +} avPlayer.getTrackDescription().then((arrList) => { if (arrList != null) { arrayDescription = arrList; @@ -1058,7 +1074,7 @@ setSpeed(speed: PlaybackSpeed): void **示例:** ```js -avPlayer.setSpeed(media.AVPlayerSpeed.SPEED_FORWARD_2_00_X) +avPlayer.setSpeed(media.PlaybackSpeed.SPEED_FORWARD_2_00_X) ``` ### on('speedDone')9+ @@ -1551,6 +1567,8 @@ on(type: 'audioInterrupt', callback: (info: audio.InterruptEvent) => void): void **示例:** ```js +import audio from '@ohos.multimedia.audio'; + avPlayer.on('audioInterrupt', (info: audio.InterruptEvent) => { console.info('audioInterrupt success,and InterruptEvent info is:' + info) }) @@ -1740,7 +1758,7 @@ let AVRecorderConfig = { location : { latitude : 30, longitude : 130 } } -AVRecorder.prepare(AVRecorderConfig, (err) => { +avRecorder.prepare(AVRecorderConfig, (err) => { if (err == null) { console.info('prepare success'); } else { @@ -1811,7 +1829,7 @@ let AVRecorderConfig = { location : { latitude : 30, longitude : 130 } } -AVRecorder.prepare(AVRecorderConfig).then(() => { +avRecorder.prepare(AVRecorderConfig).then(() => { console.info('prepare success'); }).catch((err) => { console.info('prepare failed and catch error is ' + err.message); @@ -1852,7 +1870,7 @@ getInputSurface(callback: AsyncCallback\): void ```js let surfaceID = null; // 该surfaceID用于传递给相机接口创造videoOutput -AVRecorder.getInputSurface((err, surfaceId) => { +avRecorder.getInputSurface((err, surfaceId) => { if (err == null) { console.info('getInputSurface success'); surfaceID = surfaceId; @@ -1861,8 +1879,6 @@ AVRecorder.getInputSurface((err, surfaceId) => { } }); -// videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID); - ``` ### getInputSurface9+ @@ -1898,14 +1914,12 @@ getInputSurface(): Promise\ ```js let surfaceID = null; // 该surfaceID用于传递给相机接口创造videoOutput -AVRecorder.getInputSurface().then((surfaceId) => { +avRecorder.getInputSurface().then((surfaceId) => { console.info('getInputSurface success'); surfaceID = surfaceId; }).catch((err) => { console.info('getInputSurface failed and catch error is ' + err.message); }); - -// videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID); ``` ### start9+ @@ -1937,7 +1951,7 @@ start(callback: AsyncCallback\): void **示例:** ```js -AVRecorder.start((err) => { +avRecorder.start((err) => { if (err == null) { console.info('start AVRecorder success'); } else { @@ -1975,7 +1989,7 @@ start(): Promise\ **示例:** ```js -AVRecorder.start().then(() => { +avRecorder.start().then(() => { console.info('start AVRecorder success'); }).catch((err) => { console.info('start AVRecorder failed and catch error is ' + err.message); @@ -2011,7 +2025,7 @@ pause(callback: AsyncCallback\): void **示例:** ```js -AVRecorder.pause((err) => { +avRecorder.pause((err) => { if (err == null) { console.info('pause AVRecorder success'); } else { @@ -2049,7 +2063,7 @@ pause(): Promise\ **示例:** ```js -AVRecorder.pause().then(() => { +avRecorder.pause().then(() => { console.info('pause AVRecorder success'); }).catch((err) => { console.info('pause AVRecorder failed and catch error is ' + err.message); @@ -2085,7 +2099,7 @@ resume(callback: AsyncCallback\): void **示例:** ```js -AVRecorder.resume((err) => { +avRecorder.resume((err) => { if (err == null) { console.info('resume AVRecorder success'); } else { @@ -2123,7 +2137,7 @@ resume(): Promise\ **示例:** ```js -AVRecorder.resume().then(() => { +avRecorder.resume().then(() => { console.info('resume AVRecorder success'); }).catch((err) => { console.info('resume AVRecorder failed and catch error is ' + err.message); @@ -2161,7 +2175,7 @@ stop(callback: AsyncCallback\): void **示例:** ```js -AVRecorder.stop((err) => { +avRecorder.stop((err) => { if (err == null) { console.info('stop AVRecorder success'); } else { @@ -2201,7 +2215,7 @@ stop(): Promise\ **示例:** ```js -AVRecorder.stop().then(() => { +avRecorder.stop().then(() => { console.info('stop AVRecorder success'); }).catch((err) => { console.info('stop AVRecorder failed and catch error is ' + err.message); @@ -2236,7 +2250,7 @@ reset(callback: AsyncCallback\): void **示例:** ```js -AVRecorder.reset((err) => { +avRecorder.reset((err) => { if (err == null) { console.info('reset AVRecorder success'); } else { @@ -2273,7 +2287,7 @@ reset(): Promise\ **示例:** ```js -AVRecorder.reset().then(() => { +avRecorder.reset().then(() => { console.info('reset AVRecorder success'); }).catch((err) => { console.info('reset AVRecorder failed and catch error is ' + err.message); @@ -2307,7 +2321,7 @@ release(callback: AsyncCallback\): void **示例:** ```js -AVRecorder.release((err) => { +avRecorder.release((err) => { if (err == null) { console.info('release AVRecorder success'); } else { @@ -2343,7 +2357,7 @@ release(): Promise\ **示例:** ```js -AVRecorder.release().then(() => { +avRecorder.release().then(() => { console.info('release AVRecorder success'); }).catch((err) => { console.info('release AVRecorder failed and catch error is ' + err.message); @@ -2368,9 +2382,8 @@ on(type: 'stateChange', callback: (state: AVRecorderState, reason: StateChangeRe **示例:** ```js -AVRecorder.on('stateChange', async (state, reason) => { +avRecorder.on('stateChange', async (state, reason) => { console.info('case state has changed, new state is :' + state + ',and new reason is : ' + reason); - } }); ``` @@ -2391,7 +2404,7 @@ off(type: 'stateChange'): void **示例:** ```js -AVRecorder.off('stateChange'); +avRecorder.off('stateChange'); ``` ### on('error')9+ @@ -2423,7 +2436,7 @@ on(type: 'error', callback: ErrorCallback): void **示例:** ```js -AVRecorder.on('error', (err) => { +avRecorder.on('error', (err) => { console.info('case avRecorder.on(error) called, errMessage is ' + err.message); }); ``` @@ -2454,7 +2467,7 @@ off(type: 'error'): void **示例:** ```js -AVRecorder.off('error'); +avRecorder.off('error'); ``` ## AVRecorderState9+ diff --git a/zh-cn/application-dev/reference/apis/js-apis-medialibrary.md b/zh-cn/application-dev/reference/apis/js-apis-medialibrary.md index 752de65c1cb3089d882ca922587c05e2455a56f7..246d3418a2114a7e61ddef6227147087994cc6a3 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-medialibrary.md +++ b/zh-cn/application-dev/reference/apis/js-apis-medialibrary.md @@ -1,7 +1,10 @@ # @ohos.multimedia.medialibrary (媒体库管理) > **说明:** -> 该组件从API Version 6开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 +> - 该组件从API Version 6开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 +> - 从API Version 9开始废弃。保留至API Version 13版本。 +> - 部分功能变更为系统接口,仅供系统应用使用,请使用[@ohos.filemanagement.userFileManager](js-apis-userFileManager.md)相应接口替代。 +> - 媒体资源选择和保存功能仍开放给普通应用,请使用[@ohos.file.picker](js-apis-file-picker.md)相应接口替代。 ## 导入模块 ```js @@ -130,17 +133,12 @@ async function example() { console.info('fileAsset.displayName ' + '0 : ' + fileAsset.displayName); // 调用 getNextObject 接口获取下一个资源,直到最后一个 for (let i = 1; i < count; i++) { - fetchFileResult.getNextObject((error, fileAsset) => { - if (fileAsset == undefined) { - console.error('get next object failed with error: ' + error); - return; - } - console.info('fileAsset.displayName ' + i + ': ' + fileAsset.displayName); - }) + let fileAsset = await fetchFileResult.getNextObject(); + console.info('fileAsset.displayName ' + i + ': ' + fileAsset.displayName); } + // 释放FetchFileResult实例并使其失效。无法调用其他方法 + fetchFileResult.close(); }); - // 释放FetchFileResult实例并使其失效。无法调用其他方法 - fetchFileResult.close(); }); } ``` @@ -198,18 +196,15 @@ async function example() { console.info('fileAsset.displayName ' + '0 : ' + fileAsset.displayName); // 调用 getNextObject 接口获取下一个资源,直到最后一个 for (let i = 1; i < count; i++) { - fetchFileResult.getNextObject().then((fileAsset) => { - console.info('fileAsset.displayName ' + i + ': ' + fileAsset.displayName); - }).catch((error) => { - console.error('get next object failed with error: ' + error); - }) + let fileAsset = await fetchFileResult.getNextObject(); + console.info('fileAsset.displayName ' + i + ': ' + fileAsset.displayName); } + // 释放FetchFileResult实例并使其失效。无法调用其他方法 + fetchFileResult.close(); }).catch((error) => { // 调用getFirstObject接口失败 console.error('get first object failed with error: ' + error); }); - // 释放FetchFileResult实例并使其失效。无法调用其他方法 - fetchFileResult.close(); }).catch((error) => { // 调用getFileAssets接口失败 console.error('get file assets failed with error: ' + error); @@ -499,7 +494,7 @@ async function example() { ### getAlbums7+ -getAlbums(options: MediaFetchOptions, callback: AsyncCallback): void +getAlbums(options: MediaFetchOptions, callback: AsyncCallback<Array<Album>>): void 获取相册列表,使用callback 方式返回结果。 @@ -534,7 +529,7 @@ async function example() { ### getAlbums7+ -getAlbums(options: MediaFetchOptions): Promise +getAlbums(options: MediaFetchOptions): Promise<Array<Album>> 获取相册列表,使用 promise 方式返回结果。 @@ -614,13 +609,13 @@ release(): Promise<void> media.release() ``` -### storeMediaAsset(deprecated) +### storeMediaAsset storeMediaAsset(option: MediaAssetOption, callback: AsyncCallback<string>): void 保存媒体资源,以异步方法获取保存成功的URI,使用callback形式返回结果。 -> **说明**: 从API Version 9开始废弃。 +> **说明**:此接口为API Version 6开始支持,只支持FA模型使用。 **系统能力**:SystemCapability.Multimedia.MediaLibrary.Core @@ -650,13 +645,13 @@ mediaLibrary.getMediaLibrary().storeMediaAsset(option, (error, value) => { ``` -### storeMediaAsset(deprecated) +### storeMediaAsset storeMediaAsset(option: MediaAssetOption): Promise<string> 保存媒体资源,以异步方法获取保存成功的URI,使用Promise形式返回结果。 -> **说明**: 从API Version 9开始废弃。 +> **说明**:此接口为API Version 6开始支持,只支持FA模型使用。 **系统能力**:SystemCapability.Multimedia.MediaLibrary.Core @@ -689,13 +684,15 @@ mediaLibrary.getMediaLibrary().storeMediaAsset(option).then((value) => { ``` -### startImagePreview(deprecated) +### startImagePreview startImagePreview(images: Array<string>, index: number, callback: AsyncCallback<void>): void 启动图片预览界面并限定预览开始显示的图片。可以预览指定序号的单张本地图片(datashare://),也可以预览列表中的所有网络图片(https://)。使用callback方式进行异步回调。 -> **说明**:
从API Version 9开始废弃。建议使用[Image组件](../arkui-ts/ts-basic-components-image.md)替代。
Image组件,可用于本地图片和网络图片的渲染展示。 +> **说明**: +> 此接口为API Version 6开始支持,只支持FA模型使用。 +> 建议使用[Image组件](../arkui-ts/ts-basic-components-image.md)替代。
Image组件,可用于本地图片和网络图片的渲染展示。 **系统能力**:SystemCapability.Multimedia.MediaLibrary.Core @@ -731,13 +728,15 @@ mediaLibrary.getMediaLibrary().startImagePreview(images, index, (error) => { ``` -### startImagePreview(deprecated) +### startImagePreview startImagePreview(images: Array<string>, callback: AsyncCallback<void>): void 启动图片预览界面,可以预览列表中首张本地图片(datashare://),也可以预览列表中的所有网络图片(https://)。使用callback方式进行异步回调。 -> **说明**:
从API Version 9开始废弃。建议使用[Image组件](../arkui-ts/ts-basic-components-image.md)替代。
Image组件,可用于本地图片和网络图片的渲染展示。 +> **说明**: +> 此接口为API Version 6开始支持,只支持FA模型使用。 +> 建议使用[Image组件](../arkui-ts/ts-basic-components-image.md)替代。
Image组件,可用于本地图片和网络图片的渲染展示。 **系统能力**:SystemCapability.Multimedia.MediaLibrary.Core @@ -771,13 +770,15 @@ mediaLibrary.getMediaLibrary().startImagePreview(images, (error) => { ``` -### startImagePreview(deprecated) +### startImagePreview startImagePreview(images: Array<string>, index?: number): Promise<void> 启动图片预览界面并限定预览开始显示的图片。可以预览指定序号的单张本地图片(datashare://),也可以预览列表中的所有网络图片(https://)。使用Promise方式进行异步回调。 -> **说明**:
从API Version 9开始废弃。建议使用[Image组件](../arkui-ts/ts-basic-components-image.md)替代。
Image组件,可用于本地图片和网络图片的渲染展示。 +> **说明**: +> 此接口为API Version 6开始支持,只支持FA模型使用。 +> 建议使用[Image组件](../arkui-ts/ts-basic-components-image.md)替代。
Image组件,可用于本地图片和网络图片的渲染展示。 **系统能力**:SystemCapability.Multimedia.MediaLibrary.Core @@ -816,13 +817,15 @@ mediaLibrary.getMediaLibrary().startImagePreview(images, index).then(() => { ``` -### startMediaSelect(deprecated) +### startMediaSelect startMediaSelect(option: MediaSelectOption, callback: AsyncCallback<Array<string>>): void 启动媒体选择界面,以异步方法获取选择的媒体URI列表,使用callback形式返回结果。 -> **说明**:
从API Version 9开始废弃。建议使用系统应用图库替代。图库是系统内置的可视资源访问应用,提供图片和视频的管理、浏览等功能,使用方法请参考[OpenHarmony/applications_photos](https://gitee.com/openharmony/applications_photos#4-%E5%85%B8%E5%9E%8B%E6%8E%A5%E5%8F%A3%E7%9A%84%E4%BD%BF%E7%94%A8)。 +> **说明**: +> 此接口为API Version 6开始支持,只支持FA模型使用。 +> 建议使用系统应用图库替代。图库是系统内置的可视资源访问应用,提供图片和视频的管理、浏览等功能,使用方法请参考[OpenHarmony/applications_photos](https://gitee.com/openharmony/applications_photos#4-%E5%85%B8%E5%9E%8B%E6%8E%A5%E5%8F%A3%E7%9A%84%E4%BD%BF%E7%94%A8)。 **系统能力**:SystemCapability.Multimedia.MediaLibrary.Core @@ -830,7 +833,7 @@ startMediaSelect(option: MediaSelectOption, callback: AsyncCallback<Array< | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------------------------------- | ---- | ------------------------------------ | -| option | [MediaSelectOption](#mediaselectoptiondeprecated) | 是 | 媒体选择选项。 | +| option | [MediaSelectOption](#mediaselectoption) | 是 | 媒体选择选项。 | | callback | AsyncCallback<Array<string>> | 是 | 媒体选择回调,返回选择的媒体URI(datashare://)列表。 | **示例:** @@ -851,13 +854,15 @@ mediaLibrary.getMediaLibrary().startMediaSelect(option, (error, value) => { ``` -### startMediaSelect(deprecated) +### startMediaSelect startMediaSelect(option: MediaSelectOption): Promise<Array<string>> 启动媒体选择界面,以异步方法获取选择的媒体URI列表,使用Promise形式返回结果。 -> **说明**:
从API Version 9开始废弃。建议使用系统应用图库替代。图库是系统内置的可视资源访问应用,提供图片和视频的管理、浏览等功能,使用方法请参考[OpenHarmony/applications_photos](https://gitee.com/openharmony/applications_photos#4-%E5%85%B8%E5%9E%8B%E6%8E%A5%E5%8F%A3%E7%9A%84%E4%BD%BF%E7%94%A8)。 +> **说明**: +> 此接口为API Version 6开始支持,只支持FA模型使用。 +> 建议使用系统应用图库替代。图库是系统内置的可视资源访问应用,提供图片和视频的管理、浏览等功能,使用方法请参考[OpenHarmony/applications_photos](https://gitee.com/openharmony/applications_photos#4-%E5%85%B8%E5%9E%8B%E6%8E%A5%E5%8F%A3%E7%9A%84%E4%BD%BF%E7%94%A8)。 **系统能力**:SystemCapability.Multimedia.MediaLibrary.Core @@ -865,7 +870,7 @@ startMediaSelect(option: MediaSelectOption): Promise<Array<string>> | 参数名 | 类型 | 必填 | 说明 | | ------ | --------------------------------------- | ---- | ------- | -| option | [MediaSelectOption](#mediaselectoptiondeprecated) | 是 | 媒体选择选项。 | +| option | [MediaSelectOption](#mediaselectoption) | 是 | 媒体选择选项。 | **返回值:** @@ -1907,9 +1912,9 @@ async function example() { if(i == fetchCount - 1) { var result = fetchFileResult.isAfterLast(); console.info('mediaLibrary fileAsset isAfterLast result: ' + result); + fetchFileResult.close(); } } - fetchFileResult.close(); } ``` @@ -1969,8 +1974,8 @@ async function example() { return; } console.info('getFirstObject successfully, displayName : ' + fileAsset.displayName); + fetchFileResult.close(); }) - fetchFileResult.close(); } ``` @@ -2002,10 +2007,10 @@ async function example() { let fetchFileResult = await media.getFileAssets(getImageOp); fetchFileResult.getFirstObject().then((fileAsset) => { console.info('getFirstObject successfully, displayName: ' + fileAsset.displayName); + fetchFileResult.close(); }).catch((error) => { console.error('getFirstObject failed with error: ' + error); }); - fetchFileResult.close(); } ``` @@ -2038,16 +2043,16 @@ async function example() { }; let fetchFileResult = await media.getFileAssets(getImageOp); let fileAsset = await fetchFileResult.getFirstObject(); - if (!fetchFileResult.isAfterLast) { + if (!fileAsset.isAfterLast) { fetchFileResult.getNextObject((error, fileAsset) => { if (error) { console.error('fetchFileResult getNextObject failed with error: ' + error); return; } console.log('fetchFileResult getNextObject successfully, displayName: ' + fileAsset.displayName); + fetchFileResult.close(); }) } - fetchFileResult.close(); } ``` @@ -2081,14 +2086,14 @@ async function example() { }; let fetchFileResult = await media.getFileAssets(getImageOp); let fileAsset = await fetchFileResult.getFirstObject(); - if (!fetchFileResult.isAfterLast) { + if (!fileAsset.isAfterLast) { fetchFileResult.getNextObject().then((fileAsset) => { console.info('fetchFileResult getNextObject successfully, displayName: ' + fileAsset.displayName); + fetchFileResult.close(); }).catch((error) => { console.error('fetchFileResult getNextObject failed with error: ' + error); }) } - fetchFileResult.close(); } ``` @@ -2124,8 +2129,8 @@ async function example() { return; } console.info('getLastObject successfully, displayName: ' + fileAsset.displayName); + fetchFileResult.close(); }) - fetchFileResult.close(); } ``` @@ -2157,10 +2162,10 @@ async function example() { let fetchFileResult = await media.getFileAssets(getImageOp); fetchFileResult.getLastObject().then((fileAsset) => { console.info('getLastObject successfully, displayName: ' + fileAsset.displayName); + fetchFileResult.close(); }).catch((error) => { console.error('getLastObject failed with error: ' + error); }); - fetchFileResult.close(); } ``` @@ -2197,8 +2202,8 @@ async function example() { return; } console.info('getPositionObject successfully, displayName: ' + fileAsset.displayName); + fetchFileResult.close(); }) - fetchFileResult.close(); } ``` @@ -2236,10 +2241,10 @@ async function example() { let fetchFileResult = await media.getFileAssets(getImageOp); fetchFileResult.getPositionObject(0).then((fileAsset) => { console.info('getPositionObject successfully, displayName: ' + fileAsset.displayName); + fetchFileResult.close(); }).catch((error) => { console.error('getPositionObject failed with error: ' + error); }); - fetchFileResult.close(); } ``` @@ -2276,9 +2281,9 @@ async function example() { } for (let i = 0; i < fetchFileResult.getCount(); i++) { console.info('getAllObject fileAssetList ' + i + ' displayName: ' + fileAssetList[i].displayName); - } + } + fetchFileResult.close(); }) - fetchFileResult.close(); } ``` @@ -2312,10 +2317,10 @@ async function example() { for (let i = 0; i < fetchFileResult.getCount(); i++) { console.info('getAllObject fileAssetList ' + i + ' displayName: ' + fileAssetList[i].displayName); } + fetchFileResult.close(); }).catch((error) => { console.error('getAllObject failed with error: ' + error); }); - fetchFileResult.close(); } ``` @@ -2447,10 +2452,10 @@ async function example() { console.error('album getFileAssets failed with error: ' + error); return; } - let count = fetchFileResult.getcount(); + let count = fetchFileResult.getCount(); console.info('album getFileAssets successfully, count: ' + count); + fetchFileResult.close(); }); - fetchFileResult.close(); } ``` @@ -2484,7 +2489,7 @@ async function example() { selections: '', selectionArgs: [], }; - let fileNoArgsfetchOp = { + let fileNoArgsfetchOp = { selections: '', selectionArgs: [], }; @@ -2492,13 +2497,13 @@ async function example() { const albumList = await media.getAlbums(AlbumNoArgsfetchOp); const album = albumList[0]; // 取到相册列表中的一个相册,获取此相册中所有符合媒体检索选项的媒体资源 - album.getFileAssets(fileNoArgsfetchOp).then((albumFetchFileResult) => { - let count = fetchFileResult.getcount(); + album.getFileAssets(fileNoArgsfetchOp).then((fetchFileResult) => { + let count = fetchFileResult.getCount(); console.info('album getFileAssets successfully, count: ' + count); + fetchFileResult.close(); }).catch((error) => { console.error('album getFileAssets failed with error: ' + error); }); - fetchFileResult.close(); } ``` @@ -2622,12 +2627,10 @@ async function example() { | width | number | 是 | 是 | 宽(单位:像素) | | height | number | 是 | 是 | 高(单位:像素) | -## MediaAssetOption(deprecated) +## MediaAssetOption 媒体资源选项。 -> **说明**: 从API Version 9开始废弃。 - **系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.MediaLibrary.Core @@ -2637,16 +2640,14 @@ async function example() { | mimeType | string | 是 | 是 | 媒体MIME(Multipurpose Internet Mail Extensions)类型。
包括:'image/\*'、'video/\*'、'audio/\*'、 'file\*'。 | | relativePath | string | 是 | 是 | 自定义媒体资源保存位置,例:Pictures/ 不填则保存到默认路径。
image类型默认路径Pictures/
video类型默认路径Videos/
audio类型默认路径Audios/
file类型默认路径Documents/ 。 | -## MediaSelectOption(deprecated) +## MediaSelectOption 媒体资源类型选项。 -> **说明**: 从API Version 9开始废弃。 - **系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.MediaLibrary.Core | 名称 | 类型 | 可读 | 可写 | 说明 | | ----- | ------ | ---- | ---- | -------------------- | | type | 'image' | 'video' | 'media' | 是 | 是 | 媒体类型,包括:image, video, media,当前仅支持media类型 | -| count | number | 是 | 是 | 媒体选择,count = 1表示单选,count大于1表示多选。 | +| count | number | 是 | 是 | 可以选择媒体数量的最大值,count = 1表示单选,count大于1表示多选。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-net-connection.md b/zh-cn/application-dev/reference/apis/js-apis-net-connection.md index 4b02345124af20ab8459506ad3ff72bb1e7d9edb..cfd1405bc9385985c34cee0500f6a82aa9e7cf98 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-net-connection.md +++ b/zh-cn/application-dev/reference/apis/js-apis-net-connection.md @@ -3,7 +3,6 @@ 网络连接管理提供管理网络一些基础能力,包括获取默认激活的数据网络、获取所有激活数据网络列表、开启关闭飞行模式、获取网络能力信息等功能。 > **说明:** -> > 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 ## 导入模块 @@ -11,6 +10,40 @@ ```js import connection from '@ohos.net.connection' ``` +## connection.createNetConnection + +createNetConnection(netSpecifier?: NetSpecifier, timeout?: number): NetConnection + +返回一个NetConnection对象,netSpecifier指定关注的网络的各项特征,timeout是超时时间(单位是毫秒),netSpecifier是timeout的必要条件,两者都没有则表示关注默认网络。 + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------------ | ----------------------------- | ---- | ------------------------------------------------------------ | +| netSpecifier | [NetSpecifier](#netspecifier) | 否 | 指定网络的各项特征,不指定则关注默认网络。 | +| timeout | number | 否 | 获取netSpecifier指定的网络时的超时时间,仅netSpecifier存在时生效。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------- | -------------------- | +| [NetConnection](#netconnection) | 所关注的网络的句柄。 | + +**示例:** + +```js +// 关注默认网络 +let netConnection = connection.createNetConnection() + +// 关注蜂窝网络 +let netConnectionCellular = connection.createNetConnection({ + netCapabilities: { + bearerTypes: [connection.NetBearType.BEARER_CELLULAR] + } +}) +``` ## connection.getDefaultNet @@ -26,14 +59,22 @@ getDefaultNet(callback: AsyncCallback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------------------------- | ---- | ---------- | -| callback | AsyncCallback\<[NetHandle](#nethandle)> | 是 | 回调函数。 | +| callback | AsyncCallback\<[NetHandle](#nethandle)> | 是 | 回调函数。当成功获取默认激活的数据网络时,err为undefined,data为默认激活的数据网络;否则为错误对象 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | **示例:** ```js -connection.getDefaultNet(function (error, netHandle) { +connection.getDefaultNet(function (error, data) { console.log(JSON.stringify(error)) - console.log(JSON.stringify(netHandle)) + console.log(JSON.stringify(data)) }) ``` @@ -53,17 +94,25 @@ getDefaultNet(): Promise\ | --------------------------------- | ------------------------------------- | | Promise\<[NetHandle](#nethandle)> | 以Promise形式返回默认激活的数据网络。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + **示例:** ```js -connection.getDefaultNet().then(function (netHandle) { - console.log(JSON.stringify(netHandle)) +connection.getDefaultNet().then(function (data) { + console.log(JSON.stringify(data)) }) ``` ## connection.getDefaultNetSync9+ -getDefaultNetSync(): NetHandle; +getDefaultNetSync(): NetHandle 使用同步方法获取默认激活的数据网络。可以使用[getNetCapabilities](#connectiongetnetcapabilities)去获取网络的类型、拥有的能力等信息。 @@ -77,58 +126,321 @@ getDefaultNetSync(): NetHandle; | --------- | ---------------------------------- | | NetHandle | 以同步方式返回默认激活的数据网络。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + **示例:** ```js let netHandle = connection.getDefaultNetSync(); ``` -## connection.hasDefaultNet +## connection.getGlobalHttpProxy10+ -hasDefaultNet(callback: AsyncCallback\): void +getGlobalHttpProxy(callback: AsyncCallback\): void -检查默认数据网络是否被激活,使用callback方式作为异步方法。如果有默认数据网路,可以使用[getDefaultNet](#connectiongetdefaultnet)去获取。 +获取网络的全局代理配置信息,使用callback方式作为异步方法。 -**需要权限**:ohos.permission.GET_NETWORK_INFO +**系统接口**:此接口为系统接口。 **系统能力**:SystemCapability.Communication.NetManager.Core **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ----------------------- | ---- | -------------------------------------- | -| callback | AsyncCallback\ | 是 | 回调函数,默认数据网络被激活返回true。 | +| 参数名 | 类型 | 必填 | 说明 | +| --------- | ------------------------------------------------------------ | ---- | ---------------- | +| callback | AsyncCallback\<[HttpProxy](#httpproxy)> | 是 | 回调函数。当成功获取网络的全局代理配置信息时,err为undefined,data为网络的全局代理配置信息;否则为错误对象| + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | **示例:** ```js -connection.hasDefaultNet(function (error, has) { - console.log(JSON.stringify(error)) - console.log('has: ' + has) +connection.getGlobalHttpProxy((error,data) => { + console.info(JSON.stringify(error)); + console.info(JSON.stringify(data)); }) ``` -## connection.hasDefaultNet +## connection.getGlobalHttpProxy10+ -hasDefaultNet(): Promise\ +getGlobalHttpProxy(): Promise\; -检查默认数据网络是否被激活,使用Promise方式作为异步方法。如果有默认数据网路,可以使用[getDefaultNet](#connectiongetdefaultnet)去获取。 +获取网络的全局代理配置信息,使用Promise方式作为异步方法。 -**需要权限**:ohos.permission.GET_NETWORK_INFO +**系统接口**:此接口为系统接口。 **系统能力**:SystemCapability.Communication.NetManager.Core **返回值:** -| 类型 | 说明 | -| ----------------- | ----------------------------------------------- | -| Promise\ | 以Promise形式返回,默认数据网络被激活返回true。 | +| 类型 | 说明 | +| --------------------------------- | ------------------------------------- | +| Promise\<[HttpProxy](#httpproxy)> | 以Promise形式返回网络的全局代理配置信息。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | **示例:** ```js -connection.hasDefaultNet().then(function (has) { - console.log('has: ' + has) +connection.getGlobalHttpProxy().then((data) => { + console.info(JSON.stringify(data)); +}).catch(error => { + console.info(JSON.stringify(error)); +}) +``` + +## connection.setGlobalHttpProxy10+ + +setGlobalHttpProxy(httpProxy: HttpProxy, callback: AsyncCallback\): void + +设置网络全局Http代理配置信息,使用callback方式作为异步方法。 + +**系统接口**:此接口为系统接口。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | ------------------------------------------------------------ | ---- | ---------------- | +| httpProxy | [HttpProxy](#httpproxy) | 是 | 网络全局Http代理配置信息 | +| callback | AsyncCallback\ | 是 | 回调函数。当成功设置网络全局Http代理配置信息时,err为undefined,否则为错误对象| + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js +let exclusionStr="192.168,baidu.com" +let exclusionArray = exclusionStr.split(','); +let httpProxy = { + host: "192.168.xx.xxx", + port: 8080, + exclusionList: exclusionArray +} +connection.setGlobalHttpProxy(httpProxy, (error, data) => { + console.info(JSON.stringify(error)); + console.info(JSON.stringify(data)); +}); +``` + +## connection.setGlobalHttpProxy10+ + +setGlobalHttpProxy(httpProxy: HttpProxy): Promise\; + +设置网络全局Http代理配置信息,使用Promise方式作为异步方法。 + +**系统接口**:此接口为系统接口。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | ------------------------------------------------------------ | ---- | ---------------- | +| httpProxy | [HttpProxy](#httpproxy) | 是 | 网络全局Http代理配置信息。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------- | ----------------------------- | +| Promise\ | 无返回值的Promise对象。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js +let exclusionStr="192.168,baidu.com" +let exclusionArray = exclusionStr.split(','); +let httpProxy = { + host: "192.168.xx.xxx", + port: 8080, + exclusionList: exclusionArray +} +connection.setGlobalHttpProxy(httpProxy).then((error, data) => { + console.info(JSON.stringify(data)); +}).catch(error=>{ + console.info(JSON.stringify(error)); +}) +``` + +## connection.getAppNet9+ + +getAppNet(callback: AsyncCallback\): void + +获取App绑定的网络信息,使用callback方式作为异步方法。 + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | ------------------------------------------------------------ | ---- | ---------------- | +| callback | AsyncCallback\<[NetHandle](#nethandle)> | 是 | 回调函数。当成功获取App绑定的网络信息时,err为undefined,data为获取到App绑定的网络信息;否则为错误对象| + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js +connection.getAppNet(function(error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}) +``` + +## connection.getAppNet9+ + +getAppNet(): Promise\; + +获取App绑定的网络信息,使用Promise方式作为异步方法。 + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**返回值:** + +| 类型 | 说明 | +| --------------------------------- | ------------------------------------- | +| Promise\<[NetHandle](#nethandle)> | 以Promise形式返回App绑定的网络信息。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js +connection.getAppNet().then((data) => { + console.info(JSON.stringify(data)); +}).catch(error => { + console.info(JSON.stringify(error)); +}) +``` + +## connection.SetAppNet9+ + +setAppNet(netHandle: NetHandle, callback: AsyncCallback\): void + +绑定App到指定网络,绑定后的App只能通过指定网络访问外网,使用callback方式作为异步方法。 + +**需要权限**:ohos.permission.INTERNET + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | ------------------------------------------------------------ | ---- | ---------------- | +| netHandle | [NetHandle](#nethandle) | 是 | 数据网络的句柄。 | +| callback | AsyncCallback\ | 是 | 回调函数。当成功绑定App到指定网络时,err为undefined,否则为错误对象| + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js +connection.getDefaultNet(function (error, netHandle) { + connection.setAppNet(netHandle, (error, data) => { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) + }); +}) +``` + +## connection.SetAppNet9+ + +setAppNet(netHandle: NetHandle): Promise\; + +绑定App到指定网络,绑定后的App只能通过指定网络访问外网,使用Promise方式作为异步方法。 + +**需要权限**:ohos.permission.INTERNET + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | ------------------------------------------------------------ | ---- | ---------------- | +| netHandle | [NetHandle](#nethandle) | 是 | 数据网络的句柄。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------- | ----------------------------- | +| Promise\ | 无返回值的Promise对象。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js +connection.getDefaultNet().then(function (netHandle) { + connection.setAppNet(netHandle).then((error, data) => { + console.log(JSON.stringify(data)) + }).catch(error => { + console.log(JSON.stringify(error)) + }) }) ``` @@ -146,14 +458,22 @@ getAllNets(callback: AsyncCallback<Array<NetHandle>>): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | -| callback | AsyncCallback<Array<[NetHandle](#nethandle)>> | 是 | 回调函数。 | +| callback | AsyncCallback<Array<[NetHandle](#nethandle)>> | 是 | 回调函数。当成功获取所有处于连接状态的网络列表时,err为undefined,data为激活的数据网络列表;否则为错误对象 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | **示例:** ```js -connection.getAllNets(function (error, nets) { +connection.getAllNets(function (error, data) { console.log(JSON.stringify(error)) - console.log(JSON.stringify(nets)) + console.log(JSON.stringify(data)) }); ``` @@ -173,11 +493,19 @@ getAllNets(): Promise<Array<NetHandle>> | -------- | -------- | | Promise<Array<[NetHandle](#nethandle)>> | 以Promise形式返回激活的数据网络列表。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + **示例:** ```js -connection.getAllNets().then(function (nets) { - console.log(JSON.stringify(nets)) +connection.getAllNets().then(function (data) { + console.log(JSON.stringify(data)) }); ``` @@ -196,15 +524,25 @@ getConnectionProperties(netHandle: NetHandle, callback: AsyncCallback\ | 是 | 回调函数。 | +| callback | AsyncCallback\<[ConnectionProperties](#connectionproperties)> | 是 | 回调函数。当成功获取netHandle对应的网络的连接信息时,err为undefined,data为获取的网络连接信息;否则为错误对象| + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | **示例:** ```js connection.getDefaultNet().then(function (netHandle) { - connection.getConnectionProperties(netHandle, function (error, info) { + connection.getConnectionProperties(netHandle, function (error, data) { console.log(JSON.stringify(error)) - console.log(JSON.stringify(info)) + console.log(JSON.stringify(data)) }) }) ``` @@ -231,12 +569,22 @@ getConnectionProperties(netHandle: NetHandle): Promise\ | ------------------------------------------------------- | --------------------------------- | | Promise\<[ConnectionProperties](#connectionproperties)> | 以Promise形式返回网络的连接信息。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + **示例:** ```js connection.getDefaultNet().then(function (netHandle) { - connection.getConnectionProperties(netHandle).then(function (info) { - console.log(JSON.stringify(info)) + connection.getConnectionProperties(netHandle).then(function (data) { + console.log(JSON.stringify(data)) }) }) ``` @@ -256,15 +604,25 @@ getNetCapabilities(netHandle: NetHandle, callback: AsyncCallback\ | 是 | 回调函数。 | +| callback | AsyncCallback\<[NetCapabilities](#netcapabilities)> | 是 | 回调函数。当成功获取netHandle对应的网络的能力信息时,err为undefined,data为获取到的网络能力信息;否则为错误对象 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | **示例:** ```js connection.getDefaultNet().then(function (netHandle) { - connection.getNetCapabilities(netHandle, function (error, info) { + connection.getNetCapabilities(netHandle, function (error, data) { console.log(JSON.stringify(error)) - console.log(JSON.stringify(info)) + console.log(JSON.stringify(data)) }) }) ``` @@ -291,12 +649,22 @@ getNetCapabilities(netHandle: NetHandle): Promise\ | --------------------------------------------- | --------------------------------- | | Promise\<[NetCapabilities](#netcapabilities)> | 以Promise形式返回网络的能力信息。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + **示例:** ```js connection.getDefaultNet().then(function (netHandle) { - connection.getNetCapabilities(netHandle).then(function (info) { - console.log(JSON.stringify(info)) + connection.getNetCapabilities(netHandle).then(function (data) { + console.log(JSON.stringify(data)) }) }) ``` @@ -315,14 +683,22 @@ isDefaultNetMetered(callback: AsyncCallback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ----------------------- | ---- | -------------------------------------- | -| callback | AsyncCallback\ | 是 | 回调函数,当前网络上的数据流量使用被计量返回true。 | +| callback | AsyncCallback\ | 是 | 回调函数。当前网络上的数据流量使用被计量返回true。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | **示例:** ```js -connection.isDefaultNetMetered(function (error, has) { +connection.isDefaultNetMetered(function (error, data) { console.log(JSON.stringify(error)) - console.log('has: ' + has) + console.log('data: ' + data) }) ``` @@ -342,11 +718,216 @@ isDefaultNetMetered(): Promise\ | ----------------- | ----------------------------------------------- | | Promise\ | 以Promise形式返回,当前网络上的数据流量使用被计量true。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + **示例:** ```js -connection.isDefaultNetMetered().then(function (has) { - console.log('has: ' + has) +connection.isDefaultNetMetered().then(function (data) { + console.log('data: ' + data) +}) +``` + +## connection.hasDefaultNet + +hasDefaultNet(callback: AsyncCallback\): void + +检查默认数据网络是否被激活,使用callback方式作为异步方法。如果有默认数据网路,可以使用[getDefaultNet](#connectiongetdefaultnet)去获取。 + +**需要权限**:ohos.permission.GET_NETWORK_INFO + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------- | ---- | -------------------------------------- | +| callback | AsyncCallback\ | 是 | 回调函数。默认数据网络被激活返回true。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js +connection.hasDefaultNet(function (error, data) { + console.log(JSON.stringify(error)) + console.log('data: ' + data) +}) +``` + +## connection.hasDefaultNet + +hasDefaultNet(): Promise\ + +检查默认数据网络是否被激活,使用Promise方式作为异步方法。如果有默认数据网路,可以使用[getDefaultNet](#connectiongetdefaultnet)去获取。 + +**需要权限**:ohos.permission.GET_NETWORK_INFO + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**返回值:** + +| 类型 | 说明 | +| ----------------- | ----------------------------------------------- | +| Promise\ | 以Promise形式返回,默认数据网络被激活返回true。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js +connection.hasDefaultNet().then(function (data) { + console.log('data: ' + data) +}) +``` + +## connection.enableAirplaneMode + +enableAirplaneMode(callback: AsyncCallback\): void + +开启飞行模式,使用callback方式作为异步方法。 + +**系统接口**:此接口为系统接口。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------- | ---- | ------------------ | +| callback | AsyncCallback\ | 是 | 回调函数。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js +connection.enableAirplaneMode(function (error) { + console.log(JSON.stringify(error)) +}) +``` + +## connection.enableAirplaneMode + +enableAirplaneMode(): Promise\ + +开启飞行模式,使用Promise方式作为异步方法。 + +**系统接口**:此接口为系统接口。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------- | ----------------------------- | +| Promise\ | 无返回值的Promise对象。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js +connection.enableAirplaneMode().then(function (error) { + console.log(JSON.stringify(error)) +}) +``` + +## connection.disableAirplaneMode + +disableAirplaneMode(callback: AsyncCallback\): void + +关闭飞行模式,使用callback方式作为异步方法。 + +**系统接口**:此接口为系统接口。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------- | ---- | ------------------ | +| callback | AsyncCallback\ | 是 | 回调函数。当关闭飞行模式成功,err为undefined,否则为错误对象。| + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js +connection.disableAirplaneMode(function (error) { + console.log(JSON.stringify(error)) +}) +``` + +## connection.disableAirplaneMode + +disableAirplaneMode(): Promise\ + +关闭飞行模式,使用Promise方式作为异步方法。 + +**系统接口**:此接口为系统接口。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------- | ----------------------------- | +| Promise\ | 无返回值的Promise对象。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js +connection.disableAirplaneMode().then(function (error) { + console.log(JSON.stringify(error)) }) ``` @@ -366,7 +947,17 @@ reportNetConnected(netHandle: NetHandle, callback: AsyncCallback<void>): v | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | netHandle | [NetHandle](#nethandle) | 是 | 数据网络的句柄,参考[NetHandle](#nethandle)。 | -| callback | AsyncCallback<void> | 是 | 回调函数。 | +| callback | AsyncCallback<void> | 是 | 回调函数。当向网络管理报告网络处于可用状态成功,err为undefined,否则为错误对象。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | **示例:** @@ -400,6 +991,16 @@ reportNetConnected(netHandle: NetHandle): Promise<void> | -------- | -------- | | Promise<void> | 无返回值的Promise对象。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + **示例:** ```js @@ -426,7 +1027,17 @@ reportNetDisconnected(netHandle: NetHandle, callback: AsyncCallback<void>) | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | netHandle | [NetHandle](#nethandle) | 是 | 数据网络的句柄,参考[NetHandle](#nethandle)。 | -| callback | AsyncCallback<void> | 是 | 回调函数。 | +| callback | AsyncCallback<void> | 是 | 回调函数。当向网络管理报告网络处于不可用状态成功,err为undefined,否则为错误对象。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | **示例:** @@ -460,6 +1071,16 @@ reportNetDisconnected(netHandle: NetHandle): Promise<void> | -------- | -------- | | Promise<void> | 无返回值的Promise对象。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + **示例:** ```js @@ -485,15 +1106,25 @@ getAddressesByName(host: string, callback: AsyncCallback\>): | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------------- | ---- | ------------------ | | host | string | 是 | 需要解析的主机名。 | -| callback | AsyncCallback\> | 是 | 回调函数。 | +| callback | AsyncCallback\> | 是 | 回调函数。当使用默认网络解析主机名成功获取所有IP地址,err为undefined,data为获取到的所有IP地址;否则为错误对象。| + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | **示例:** ```js let host = "xxxx"; -connection.getAddressesByName(host, function (error, addresses) { +connection.getAddressesByName(host, function (error, data) { console.log(JSON.stringify(error)) - console.log(JSON.stringify(addresses)) + console.log(JSON.stringify(data)) }) ``` @@ -519,156 +1150,102 @@ getAddressesByName(host: string): Promise\> | ------------------------------------------- | ----------------------------- | | Promise\> | 以Promise形式返回所有IP地址。 | -**示例:** - -```js -let host = "xxxx"; -connection.getAddressesByName(host).then(function (addresses) { - console.log(JSON.stringify(addresses)) -}) -``` - -## connection.enableAirplaneMode - -enableAirplaneMode(callback: AsyncCallback\): void - -开启飞行模式,使用callback方式作为异步方法。 - -**系统接口**:此接口为系统接口。 - -**系统能力**:SystemCapability.Communication.NetManager.Core - -**参数:** +**错误码:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ------------------------------------------------- | ---- | ------------------ | -| callback | AsyncCallback\ | 是 | 回调函数。 | +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | **示例:** ```js -connection.enableAirplaneMode(function (error) { - console.log(JSON.stringify(error)) -}) -``` - -## connection.enableAirplaneMode - -enableAirplaneMode(): Promise\ - -开启飞行模式,使用Promise方式作为异步方法。 - -**系统接口**:此接口为系统接口。 - -**系统能力**:SystemCapability.Communication.NetManager.Core - -**返回值:** - -| 类型 | 说明 | -| ------------------------------------------- | ----------------------------- | -| Promise\ | 无返回值的Promise对象。 | - -**示例:** - -```js -connection.enableAirplaneMode().then(function (error) { - console.log(JSON.stringify(error)) +let host = "xxxx"; +connection.getAddressesByName(host).then(function (data) { + console.log(JSON.stringify(data)) }) ``` -## connection.disableAirplaneMode - -disableAirplaneMode(callback: AsyncCallback\): void - -关闭飞行模式,使用callback方式作为异步方法。 - -**系统接口**:此接口为系统接口。 - -**系统能力**:SystemCapability.Communication.NetManager.Core - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ------------------------------------------------- | ---- | ------------------ | -| callback | AsyncCallback\ | 是 | 回调函数。 | - -**示例:** - -```js -connection.disableAirplaneMode(function (error) { - console.log(JSON.stringify(error)) -}) -``` +## NetConnection -## connection.disableAirplaneMode +网络连接的句柄。 -disableAirplaneMode(): Promise\ +### register -关闭飞行模式,使用Promise方式作为异步方法。 +register(callback: AsyncCallback\): void -**系统接口**:此接口为系统接口。 +订阅指定网络状态变化的通知。 + +**需要权限**:ohos.permission.GET_NETWORK_INFO **系统能力**:SystemCapability.Communication.NetManager.Core -**返回值:** +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------------- | ---- | ---------- | +| callback | AsyncCallback\ | 是 | 回调函数。当订阅指定网络状态变化的通知成功,err为undefined,否则为错误对象。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | +| 2101008 | The callback is not exists. | +| 2101022 | The number of requests exceeded the maximum. | -| 类型 | 说明 | -| ------------------------------------------- | ----------------------------- | -| Promise\ | 无返回值的Promise对象。 | **示例:** ```js -connection.disableAirplaneMode().then(function (error) { +netConnection.register(function (error) { console.log(JSON.stringify(error)) }) ``` -## connection.createNetConnection +### unregister -createNetConnection(netSpecifier?: NetSpecifier, timeout?: number): NetConnection +unregister(callback: AsyncCallback\): void -返回一个NetConnection对象,netSpecifier指定关注的网络的各项特征,timeout是超时时间(单位是毫秒),netSpecifier是timeout的必要条件,两者都没有则表示关注默认网络。 +取消订阅默认网络状态变化的通知。 **系统能力**:SystemCapability.Communication.NetManager.Core **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ------------ | ----------------------------- | ---- | ------------------------------------------------------------ | -| netSpecifier | [NetSpecifier](#netspecifier) | 否 | 指定网络的各项特征,不指定则关注默认网络。 | -| timeout | number | 否 | 获取netSpecifier指定的网络时的超时时间,仅netSpecifier存在时生效。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------------- | ---- | ---------- | +| callback | AsyncCallback\ | 是 | 回调函数。当取消订阅指定网络状态变化的通知成功,err为undefined,否则为错误对象。 | -**返回值:** +**错误码:** -| 类型 | 说明 | -| ------------------------------- | -------------------- | -| [NetConnection](#netconnection) | 所关注的网络的句柄。 | +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | +| 2101007 | The same callback exists. | **示例:** ```js -// 关注默认网络 -let netConnection = connection.createNetConnection() - -// 关注蜂窝网络 -let netConnectionCellular = connection.createNetConnection({ - netCapabilities: { - bearerTypes: [connection.NetBearType.BEARER_CELLULAR] - } +netConnection.unregister(function (error) { + console.log(JSON.stringify(error)) }) ``` -## NetConnection - -网络连接的句柄。 - ### on('netAvailable') on(type: 'netAvailable', callback: Callback\): void 订阅网络可用事件。 +**模型约束**:此接口调用之前需要先调用register接口,使用unregister取消订阅默认网络状态变化的通知。 + **系统能力**:SystemCapability.Communication.NetManager.Core **参数:** @@ -676,21 +1253,37 @@ on(type: 'netAvailable', callback: Callback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------------------------- | ---- | ------------------------------------------------------------ | | type | string | 是 | 订阅事件,固定为'netAvailable'。
netAvailable:数据网络可用事件。 | -| callback | Callback\<[NetHandle](#nethandle)> | 是 | 回调函数。 | +| callback | Callback\<[NetHandle](#nethandle)> | 是 | 回调函数,返回数据网络句柄。| **示例:** ```js -netConnection.on('netAvailable', function (data) { +// 创建NetConnection对象 +let netCon = connection.createNetConnection() + +// 先使用register接口注册订阅事件 +netCon.register(function (error) { + console.log(JSON.stringify(error)) +}) + +// 订阅网络可用事件。调用register后,才能接收到此事件通知 +netCon.on('netAvailable', function (data) { console.log(JSON.stringify(data)) }) + +// 使用unregister接口取消订阅 +netCon.unregister(function (error) { + console.log(JSON.stringify(error)) +}) ``` -### on('netCapabilitiesChange') +### on('netBlockStatusChange') -on(type: 'netCapabilitiesChange', callback: Callback<{ netHandle: NetHandle, netCap: NetCapabilities }>): void +on(type: 'netBlockStatusChange', callback: Callback<{ netHandle: NetHandle, blocked: boolean }>): void -订阅网络能力变化事件。 +订阅网络阻塞状态事件,使用callback方式作为异步方法。 + +**模型约束**:此接口调用之前需要先调用register接口,使用unregister取消订阅默认网络状态变化的通知。 **系统能力**:SystemCapability.Communication.NetManager.Core @@ -698,22 +1291,38 @@ on(type: 'netCapabilitiesChange', callback: Callback<{ netHandle: NetHandle, net | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | 是 | 订阅事件,固定为'netCapabilitiesChange'。
netCapabilitiesChange:网络能力变化事件。 | -| callback | Callback<{ netHandle: [NetHandle](#nethandle), netCap: [NetCapabilities](#netcapabilities) }> | 是 | 回调函数。 | +| type | string | 是 | 订阅事件,固定为'netBlockStatusChange'。
netBlockStatusChange:网络阻塞状态事件。 | +| callback | Callback<{ netHandle: [NetHandle](#nethandle), blocked: boolean }> | 是 | 回调函数,返回数据网络句柄(netHandle),及网络堵塞状态(blocked)。| **示例:** ```js -netConnection.on('netCapabilitiesChange', function (data) { +// 创建NetConnection对象 +let netCon = connection.createNetConnection() + +// 先使用register接口注册订阅事件 +netCon.register(function (error) { + console.log(JSON.stringify(error)) +}) + +// 订阅网络阻塞状态事件。调用register后,才能接收到此事件通知 +netCon.on('netBlockStatusChange', function (data) { console.log(JSON.stringify(data)) }) + +// 使用unregister接口取消订阅 +netCon.unregister(function (error) { + console.log(JSON.stringify(error)) +}) ``` -### on('netConnectionPropertiesChange') +### on('netCapabilitiesChange') -on(type: 'netConnectionPropertiesChange', callback: Callback<{ netHandle: NetHandle, connectionProperties: ConnectionProperties }>): void +on(type: 'netCapabilitiesChange', callback: Callback<{ netHandle: NetHandle, netCap: NetCapabilities }>): void -订阅网络连接信息变化事件。 +订阅网络能力变化事件。 + +**模型约束**:此接口调用之前需要先调用register接口,使用unregister取消订阅默认网络状态变化的通知。 **系统能力**:SystemCapability.Communication.NetManager.Core @@ -721,22 +1330,38 @@ on(type: 'netConnectionPropertiesChange', callback: Callback<{ netHandle: NetHan | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | 是 | 订阅事件,固定为'netConnectionPropertiesChange'。
netConnectionPropertiesChange:网络连接信息变化事件。 | -| callback | Callback<{ netHandle: [NetHandle](#nethandle), connectionProperties: [ConnectionProperties](#connectionproperties) }> | 是 | 回调函数。 | +| type | string | 是 | 订阅事件,固定为'netCapabilitiesChange'。
netCapabilitiesChange:网络能力变化事件。 | +| callback | Callback<{ netHandle: [NetHandle](#nethandle), netCap: [NetCapabilities](#netcapabilities) }> | 是 | 回调函数,返回数据网络句柄(netHandle)和网络的能力信息(netCap)。| **示例:** ```js -netConnection.on('netConnectionPropertiesChange', function (data) { +// 创建NetConnection对象 +let netCon = connection.createNetConnection() + +// 先使用register接口注册订阅事件 +netCon.register(function (error) { + console.log(JSON.stringify(error)) +}) + +// 订阅网络能力变化事件。调用register后,才能接收到此事件通知 +netCon.on('netCapabilitiesChange', function (data) { console.log(JSON.stringify(data)) }) + +// 使用unregister接口取消订阅 +netCon.unregister(function (error) { + console.log(JSON.stringify(error)) +}) ``` -### on('netBlockStatusChange') +### on('netConnectionPropertiesChange') -on(type: 'netBlockStatusChange', callback: Callback<{ netHandle: NetHandle, blocked: boolean }>): void +on(type: 'netConnectionPropertiesChange', callback: Callback<{ netHandle: NetHandle, connectionProperties: ConnectionProperties }>): void -订阅网络阻塞状态事件,使用callback方式作为异步方法。 +订阅网络连接信息变化事件。 + +**模型约束**:此接口调用之前需要先调用register接口,使用unregister取消订阅默认网络状态变化的通知。 **系统能力**:SystemCapability.Communication.NetManager.Core @@ -744,15 +1369,29 @@ on(type: 'netBlockStatusChange', callback: Callback<{ netHandle: NetHandle, b | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | 是 | 订阅事件,固定为'netBlockStatusChange'。
netBlockStatusChange:网络阻塞状态事件。 | -| callback | Callback<{ netHandle: [NetHandle](#nethandle), blocked: boolean }> | 是 | 回调函数。 | +| type | string | 是 | 订阅事件,固定为'netConnectionPropertiesChange'。
netConnectionPropertiesChange:网络连接信息变化事件。 | +| callback | Callback<{ netHandle: [NetHandle](#nethandle), connectionProperties: [ConnectionProperties](#connectionproperties) }> | 是 | 回调函数,返回数据网络句柄(netHandle)和网络的连接信息(connectionProperties)| **示例:** ```js -netConnection.on('netBlockStatusChange', function (data) { +// 创建NetConnection对象 +let netCon = connection.createNetConnection() + +// 先使用register接口注册订阅事件 +netCon.register(function (error) { + console.log(JSON.stringify(error)) +}) + +// 订阅网络连接信息变化事件。调用register后,才能接收到此事件通知 +netCon.on('netConnectionPropertiesChange', function (data) { console.log(JSON.stringify(data)) }) + +// 使用unregister接口取消订阅 +netCon.unregister(function (error) { + console.log(JSON.stringify(error)) +}) ``` ### on('netLost') @@ -761,6 +1400,8 @@ on(type: 'netLost', callback: Callback\): void 订阅网络丢失事件。 +**模型约束**:此接口调用之前需要先调用register接口,使用unregister取消订阅默认网络状态变化的通知。 + **系统能力**:SystemCapability.Communication.NetManager.Core **参数:** @@ -768,15 +1409,28 @@ on(type: 'netLost', callback: Callback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------------------------- | ---- | ------------------------------------------------------------ | | type | string | 是 | 订阅事件,固定为'netLost'。
netLost:网络严重中断或正常断开事件。 | -| callback | Callback\<[NetHandle](#nethandle)> | 是 | 回调函数。 | +| callback | Callback\<[NetHandle](#nethandle)> | 是 | 回调函数,数据网络句柄(netHandle)| **示例:** ```js -let netConnection1 = connection.createNetConnection() -netConnection1.on('netLost', function (data) { +// 创建NetConnection对象 +let netCon = connection.createNetConnection() + +// 先使用register接口注册订阅事件 +netCon.register(function (error) { + console.log(JSON.stringify(error)) +}) + +// 订阅网络丢失事件。调用register后,才能接收到此事件通知 +netCon.on('netLost', function (data) { console.log(JSON.stringify(data)) }) + +// 使用unregister接口取消订阅 +netCon.unregister(function (error) { + console.log(JSON.stringify(error)) +}) ``` ### on('netUnavailable') @@ -785,6 +1439,8 @@ on(type: 'netUnavailable', callback: Callback\): void 订阅网络不可用事件。 +**模型约束**:此接口调用之前需要先调用register接口,使用unregister取消订阅默认网络状态变化的通知。 + **系统能力**:SystemCapability.Communication.NetManager.Core **参数:** @@ -792,58 +1448,26 @@ on(type: 'netUnavailable', callback: Callback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------- | ---- | ------------------------------------------------------------ | | type | string | 是 | 订阅事件,固定为'netUnavailable'。
netUnavailable:网络不可用事件。 | -| callback | Callback\ | 是 | 回调函数。 | +| callback | Callback\ | 是 | 回调函数,无返回结果。| **示例:** ```js -netConnection.on('netUnavailable', function (data) { - console.log(JSON.stringify(data)) -}) -``` - -### register - -register(callback: AsyncCallback\): void - -订阅指定网络状态变化的通知。 - -**需要权限**:ohos.permission.GET_NETWORK_INFO - -**系统能力**:SystemCapability.Communication.NetManager.Core - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------------------- | ---- | ---------- | -| callback | AsyncCallback\ | 是 | 回调函数。 | +// 创建NetConnection对象 +let netCon = connection.createNetConnection() -**示例:** - -```js -netConnection.register(function (error) { +// 先使用register接口注册订阅事件 +netCon.register(function (error) { console.log(JSON.stringify(error)) }) -``` - -### unregister - -unregister(callback: AsyncCallback\): void - -取消订阅默认网络状态变化的通知。 - -**系统能力**:SystemCapability.Communication.NetManager.Core - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------------------- | ---- | ---------- | -| callback | AsyncCallback\ | 是 | 回调函数。 | -**示例:** +// 订阅网络不可用事件。调用register后,才能接收到此事件通知 +netCon.on('netUnavailable', function (data) { + console.log(JSON.stringify(data)) +}) -```js -netConnection.unregister(function (error) { +// 使用unregister接口取消订阅 +netCon.unregister(function (error) { console.log(JSON.stringify(error)) }) ``` @@ -864,7 +1488,7 @@ netConnection.unregister(function (error) { ### bindSocket9+ -bindSocket(socketParam: TCPSocket \| UDPSocket, callback: AsyncCallback\): void; +bindSocket(socketParam: TCPSocket \| UDPSocket, callback: AsyncCallback\): void 将TCPSocket或UDPSocket绑定到当前网络,使用callback方式作为异步方法。 @@ -875,24 +1499,33 @@ bindSocket(socketParam: TCPSocket \| UDPSocket, callback: AsyncCallback\): | 参数名 | 类型 | 必填 | 说明 | | ----------- | ------------------------ | ---- | -------------------------------| | socketParam | [TCPSocket](js-apis-socket.md#tcpsocket) \| [UDPSocket](js-apis-socket.md#udpsocket) | 是 | 待绑定的TCPSocket或UDPSocket对象。| -| callback | AsyncCallback\ | 是 | 回调函数 | +| callback | AsyncCallback\ | 是 | 回调函数。当TCPSocket或UDPSocket成功绑定到当前网络,err为undefined,否则为错误对象。| + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | **示例:** ```js import socket from "@ohos.net.socket"; -connection.getDefaultNet().then((netHandle)=>{ +connection.getDefaultNet().then((netHandle) => { var tcp = socket.constructTCPSocketInstance(); var udp = socket.constructUDPSocketInstance(); let socketType = "TCPSocket"; if (socketType == "TCPSocket") { tcp.bind({ - address: '192.168.xx.xxx', port: xxxx, family: 1 - }, err => { - if (err) { + address: '192.168.xx.xxx', port: 8080, family: 1 + }, error => { + if (error) { console.log('bind fail'); } - netHandle.bindSocket(tcp, (error, data)=>{ + netHandle.bindSocket(tcp, (error, data) => { if (error) { console.log(JSON.stringify(error)); } else { @@ -902,19 +1535,19 @@ connection.getDefaultNet().then((netHandle)=>{ }) } else { let callback = value => { - console.log(TAG + "on message, message:" + value.message + ", remoteInfo:" + value.remoteInfo); + console.log("on message, message:" + value.message + ", remoteInfo:" + value.remoteInfo); } udp.on('message', callback); udp.bind({ - address: '192.168.xx.xxx', port: xxxx, family: 1 - }, err => { - if (err) { + address: '192.168.xx.xxx', port: 8080, family: 1 + }, error => { + if (error) { console.log('bind fail'); } udp.on('message', (data) => { console.log(JSON.stringify(data)) }); - netHandle.bindSocket(udp,(error, data)=>{ + netHandle.bindSocket(udp, (error, data) => { if (error) { console.log(JSON.stringify(error)); } else { @@ -946,49 +1579,54 @@ bindSocket(socketParam: TCPSocket \| UDPSocket): Promise\; | -------------- | ---------------------- | | Promise\ | 无返回值的Promise对象。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + **示例:** ```js import socket from "@ohos.net.socket"; -connection.getDefaultNet().then((netHandle)=>{ +connection.getDefaultNet().then((netHandle) => { var tcp = socket.constructTCPSocketInstance(); var udp = socket.constructUDPSocketInstance(); let socketType = "TCPSocket"; if (socketType == "TCPSocket") { tcp.bind({ - address: '192.168.xx.xxx', port: xxxx, family: 1 - }, err => { - if (err) { + address: '192.168.xx.xxx', port: 8080, family: 1 + }, error => { + if (error) { console.log('bind fail'); } - netHandle.bindSocket(tcp).then((err, data) => { - if (err) { - console.log(JSON.stringify(err)); - } else { - console.log(JSON.stringify(data)); - } + netHandle.bindSocket(tcp).then((data) => { + console.log(JSON.stringify(data)); + }).catch(error => { + console.log(JSON.stringify(error)); }) }) } else { let callback = value => { - console.log(TAG + "on message, message:" + value.message + ", remoteInfo:" + value.remoteInfo); + console.log("on message, message:" + value.message + ", remoteInfo:" + value.remoteInfo); } udp.on('message', callback); udp.bind({ - address: '192.168.xx.xxx', port: xxxx, family: 1 - }, err => { - if (err) { + address: '192.168.xx.xxx', port: 8080, family: 1 + }, error => { + if (error) { console.log('bind fail'); } udp.on('message', (data) => { console.log(JSON.stringify(data)); }) - netHandle.bindSocket(udp).then((err, data) => { - if (err) { - console.log(JSON.stringify(err)); - } else { - console.log(JSON.stringify(data)); - } + netHandle.bindSocket(udp).then((data) => { + console.log(JSON.stringify(data)); + }).catch(error => { + console.log(JSON.stringify(error)); }) }) } @@ -1010,16 +1648,26 @@ getAddressesByName(host: string, callback: AsyncCallback\>): | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------------- | ---- | ------------------ | | host | string | 是 | 需要解析的主机名。 | -| callback | AsyncCallback\> | 是 | 回调函数 | +| callback | AsyncCallback\> | 是 | 回调函数。当使用对应网络解析主机名成功获取所有IP地址,err为undefined,data为获取到的所有IP地址;否则为错误对象。| + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | **示例:** ```js connection.getDefaultNet().then(function (netHandle) { let host = "xxxx"; - netHandle.getAddressesByName(host, function (error, addresses) { + netHandle.getAddressesByName(host, function (error, data) { console.log(JSON.stringify(error)) - console.log(JSON.stringify(addresses)) + console.log(JSON.stringify(data)) }) }) ``` @@ -1046,13 +1694,23 @@ getAddressesByName(host: string): Promise\> | ------------------------------------------- | ----------------------------- | | Promise\> | 以Promise形式返回所有IP地址。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + **示例:** ```js connection.getDefaultNet().then(function (netHandle) { let host = "xxxx"; - netHandle.getAddressesByName(host).then(function (addresses) { - console.log(JSON.stringify(addresses)) + netHandle.getAddressesByName(host).then(function (data) { + console.log(JSON.stringify(data)) }) }) ``` @@ -1072,16 +1730,26 @@ getAddressByName(host: string, callback: AsyncCallback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ----------------------------------------- | ---- | ------------------ | | host | string | 是 | 需要解析的主机名。 | -| callback | AsyncCallback\<[NetAddress](#netaddress)> | 是 | 回调函数。 | +| callback | AsyncCallback\<[NetAddress](#netaddress)> | 是 | 回调函数。当使用对应网络解析主机名获取第一个IP地址成功,err为undefined,data为获取的第一个IP地址;否则为错误对象。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | **示例:** ```js connection.getDefaultNet().then(function (netHandle) { let host = "xxxx"; - netHandle.getAddressByName(host, function (error, address) { + netHandle.getAddressByName(host, function (error, data) { console.log(JSON.stringify(error)) - console.log(JSON.stringify(address)) + console.log(JSON.stringify(data)) }) }) ``` @@ -1108,41 +1776,27 @@ getAddressByName(host: string): Promise\ | ----------------------------------- | ------------------------------- | | Promise\<[NetAddress](#netaddress)> | 以Promise形式返回第一个IP地址。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + **示例:** ```js connection.getDefaultNet().then(function (netHandle) { let host = "xxxx"; - netHandle.getAddressByName(host).then(function (address) { - console.log(JSON.stringify(address)) + netHandle.getAddressByName(host).then(function (data) { + console.log(JSON.stringify(data)) }) }) ``` -## NetSpecifier - -提供承载数据网络能力的实例。 - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetManager.Core。 - -| 名称 | 类型 | 必填 | 说明 | -| ----------------------- | ----------------------------------- | ---- | ------------------------------------------------------------ | -| netCapabilities | [NetCapabilities](#netcapabilities) | 是 | 存储数据网络的传输能力和承载类型。 | -| bearerPrivateIdentifier | string | 否 | 网络标识符,Wi-Fi网络的标识符是"wifi",蜂窝网络的标识符是"slot0"(对应SIM卡1)。 | - -## NetCapabilities - -网络的能力集。 - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetManager.Core。 - -| 名称 | 类型 | 必填 | 说明 | -| --------------------- | ---------------------------------- | --- | ------------------------ | -| linkUpBandwidthKbps | number | 否 | 上行(设备到网络)带宽。 | -| linkDownBandwidthKbps | number | 否 | 下行(网络到设备)带宽。 | -| networkCap | Array\<[NetCap](#netcap)> | 否 | 网络具体能力。 | -| bearerTypes | Array\<[NetBearType](#netbeartype)> | 是 | 网络类型。 | - ## NetCap 网络具体能力。 @@ -1169,6 +1823,42 @@ connection.getDefaultNet().then(function (netHandle) { | BEARER_WIFI | 1 | Wi-Fi网络。 | | BEARER_ETHERNET | 3 | 以太网网络。 | +## HttpProxy10+ + +网络全局代理配置信息 + +**系统能力**:SystemCapability.Communication.NetManager.Core + +| 名称 | 类型 | 必填 | 说明 | +| ------ | ------ | --- |------------------------- | +| host | string | 否 | 代理服务器主机名。 | +| port | number | 否 | 主机端口。 | +| exclusionList | Array | 否 | 不使用代理服务器的屏蔽列表。 | + +## NetSpecifier + +提供承载数据网络能力的实例。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetManager.Core。 + +| 名称 | 类型 | 必填 | 说明 | +| ----------------------- | ----------------------------------- | ---- | ------------------------------------------------------------ | +| netCapabilities | [NetCapabilities](#netcapabilities) | 是 | 存储数据网络的传输能力和承载类型。 | +| bearerPrivateIdentifier | string | 否 | 网络标识符,Wi-Fi网络的标识符是"wifi",蜂窝网络的标识符是"slot0"(对应SIM卡1)。 | + +## NetCapabilities + +网络的能力集。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetManager.Core。 + +| 名称 | 类型 | 必填 | 说明 | +| --------------------- | ---------------------------------- | --- | ------------------------ | +| linkUpBandwidthKbps | number | 否 | 上行(设备到网络)带宽。 | +| linkDownBandwidthKbps | number | 否 | 下行(网络到设备)带宽。 | +| networkCap | Array\<[NetCap](#netcap)> | 否 | 网络具体能力。 | +| bearerTypes | Array\<[NetBearType](#netbeartype)> | 是 | 网络类型。 | + ## ConnectionProperties 网络连接信息。 @@ -1181,20 +1871,9 @@ connection.getDefaultNet().then(function (netHandle) { | domains | string | 是 |所属域,默认""。 | | linkAddresses | Array\<[LinkAddress](#linkaddress)> | 是 |链路信息。 | | routes | Array\<[RouteInfo](#routeinfo)> | 是 |路由信息。 | -| dnses | Array\<[NetAddress](#netaddress)>; | 是 |网络地址,参考[NetAddress](#netaddress)。 | +| dnses | Array\<[NetAddress](#netaddress)> | 是 |网络地址,参考[NetAddress](#netaddress)。 | | mtu | number | 是 |最大传输单元。 | -## LinkAddress - -网络链路信息。 - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetManager.Core。 - -| 名称 | 类型 | 必填 |说明 | -| ------------ | ----------------------- |---- |-------------------- | -| address | [NetAddress](#netaddress) | 是 | 链路地址。 | -| prefixLength | number | 是 |链路地址前缀的长度。 | - ## RouteInfo 网络路由信息。 @@ -1209,6 +1888,17 @@ connection.getDefaultNet().then(function (netHandle) { | hasGateway | boolean | 是 |是否有网关。 | | isDefaultRoute | boolean | 是 |是否为默认路由。 | +## LinkAddress + +网络链路信息。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetManager.Core。 + +| 名称 | 类型 | 必填 |说明 | +| ------------ | ----------------------- |---- |-------------------- | +| address | [NetAddress](#netaddress) | 是 | 链路地址。 | +| prefixLength | number | 是 |链路地址前缀的长度。 | + ## NetAddress 网络地址。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-net-ethernet.md b/zh-cn/application-dev/reference/apis/js-apis-net-ethernet.md index a451b5cf79e0c7ee25f77d7432e110173799442c..823f3f1aa66f05d8d518deeb7c6d43fcba681282 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-net-ethernet.md +++ b/zh-cn/application-dev/reference/apis/js-apis-net-ethernet.md @@ -3,7 +3,6 @@ 以太网连接管理主要提供有线网络能力,提供设置有线网络的IP地址,子网掩码,网关,DNS等信息 > **说明:** -> > 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 ## 导入模块 @@ -32,18 +31,37 @@ setIfaceConfig(iface: string, ic: InterfaceConfiguration, callback: AsyncCallbac | ic | [InterfaceConfiguration](#interfaceconfiguration) | 是 | 要设置的网络接口配置信息 | | callback | AsyncCallback\ | 是 | 回调函数,成功无返回,失败返回对应错误码。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------------------| +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2200001 | Invalid parameter value. | +| 2200002 | Operation failed. Cannot connect to service.| +| 2200003 | System internal error. | +| 2201005 | The device information does not exist. | +| 2201006 | Device disconnected. | +| 2201007 | Failed to write the user configuration. | + **示例:** ```js -ethernet.setIfaceConfig("eth0", {mode:ethernet.STATIC,ipAddr:"192.168.1.123", routeAddr:"192.168.1.1", - gateAddr:"192.168.1.1", maskAddr:"255.255.255.0", dnsAddr0:"1.1.1.1", dnsAddr1:"2.2.2.2"}, - (error) => { - if (error) { - console.log("setIfaceConfig callback error = " + error); - } else { - console.log("setIfaceConfig callback ok "); - } - }); +ethernet.setIfaceConfig("eth0", { + mode: 0, + ipAddr: "192.168.xx.xxx", + route: "192.168.xx.xxx", + gateway: "192.168.xx.xxx", + netMask: "255.255.255.0", + dnsServers: "1.1.1.1", + domain: "2.2.2.2" +}, (error) => { + if (error) { + console.log("setIfaceConfig callback error = " + JSON.stringify(error)); + } else { + console.log("setIfaceConfig callback ok "); + } +}); ``` ## ethernet.setIfaceConfig @@ -71,14 +89,34 @@ setIfaceConfig(iface: string, ic: InterfaceConfiguration): Promise\ | ------------------- | ----------------------------------------------------------- | | Promise\ | 以Promise形式返回执行结果。成功无返回,失败返回对应错误码。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------------------| +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2200001 | Invalid parameter value. | +| 2200002 | Operation failed. Cannot connect to service.| +| 2200003 | System internal error. | +| 2201005 | The device information does not exist. | +| 2201006 | Device disconnected. | +| 2201007 | Failed to write the user configuration. | + **示例:** ```js -ethernet.setIfaceConfig("eth0", {mode:ethernet.STATIC,ipAddr:"192.168.1.123", routeAddr:"192.168.1.1", - gateAddr:"192.168.1.1", maskAddr:"255.255.255.0", dnsAddr0:"1.1.1.1", dnsAddr1:"2.2.2.2"}).then(() => { +ethernet.setIfaceConfig("eth0", { + mode: 0, + ipAddr: "192.168.xx.xxx", + route: "192.168.xx.xxx", + gateway: "192.168.xx.xxx", + netMask: "255.255.255.0", + dnsServers: "1.1.1.1", + domain: "2.2.2.2" +}).then(() => { console.log("setIfaceConfig promiss ok "); -}).catch((error) => { - console.log("setIfaceConfig promiss error = " + error); +}).catch(error => { + console.log("setIfaceConfig promiss error = " + JSON.stringify(error)); }); ``` @@ -101,20 +139,31 @@ getIfaceConfig(iface: string, callback: AsyncCallback\): | iface | string | 是 | 指定网络接口 | | callback | AsyncCallback\<[InterfaceConfiguration](#interfaceconfiguration)> | 是 | 回调函数,返回指定网络接口信息 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------------------| +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2200001 | Invalid parameter value. | +| 2200002 | Operation failed. Cannot connect to service.| +| 2200003 | System internal error. | +| 2201005 | The device information does not exist. | + **示例:** ```js ethernet.getIfaceConfig("eth0", (error, value) => { if (error) { - console.log("getIfaceConfig callback error = " + error); + console.log("getIfaceConfig callback error = " + JSON.stringify(error)); } else { - console.log("getIfaceConfig callback mode = " + value.mode); - console.log("getIfaceConfig callback ipAddr = " + value.ipAddr); - console.log("getIfaceConfig callback routeAddr = " + value.routeAddr); - console.log("getIfaceConfig callback gateAddr = " + value.gateAddr); - console.log("getIfaceConfig callback maskAddr = " + value.maskAddr); - console.log("getIfaceConfig callback dns0Addr = " + value.dns0Addr); - console.log("getIfaceConfig callback dns1Addr = " + value.dns1Addr); + console.log("getIfaceConfig callback mode = " + JSON.stringify(value.mode)); + console.log("getIfaceConfig callback ipAddr = " + JSON.stringify(value.ipAddr)); + console.log("getIfaceConfig callback route = " + JSON.stringify(value.route)); + console.log("getIfaceConfig callback gateway = " + JSON.stringify(value.gateway)); + console.log("getIfaceConfig callback netMask = " + JSON.stringify(value.netMask)); + console.log("getIfaceConfig callback dnsServers = " + JSON.stringify(value.dnsServers)); + console.log("getIfaceConfig callback domain = " + JSON.stringify(value.domain)); } }); ``` @@ -143,19 +192,30 @@ getIfaceConfig(iface: string): Promise\ | --------------------------------- | ---------------------------------- | | Promise\<[InterfaceConfiguration](#interfaceconfiguration)> | 以Promise形式返回接口信息。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------------------| +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2200001 | Invalid parameter value. | +| 2200002 | Operation failed. Cannot connect to service.| +| 2200003 | System internal error. | +| 2201005 | The device information does not exist. | + **示例:** ```js ethernet.getIfaceConfig("eth0").then((data) => { - console.log("getIfaceConfig promiss mode = " + data.mode); - console.log("getIfaceConfig promiss ipAddr = " + data.ipAddr); - console.log("getIfaceConfig promiss routeAddr = " + data.routeAddr); - console.log("getIfaceConfig promiss gateAddr = " + data.gateAddr); - console.log("getIfaceConfig promiss maskAddr = " + data.maskAddr); - console.log("getIfaceConfig promiss dns0Addr = " + data.dns0Addr); - console.log("getIfaceConfig promiss dns1Addr = " + data.dns1Addr); -}).catch((error) => { - console.log("getIfaceConfig promiss error = " + error); + console.log("getIfaceConfig promiss mode = " + JSON.stringify(data.mode)); + console.log("getIfaceConfig promiss ipAddr = " + JSON.stringify(data.ipAddr)); + console.log("getIfaceConfig promiss route = " + JSON.stringify(data.route)); + console.log("getIfaceConfig promiss gateway = " + JSON.stringify(data.gateway)); + console.log("getIfaceConfig promiss netMask = " + JSON.stringify(data.netMask)); + console.log("getIfaceConfig promiss dnsServers = " + JSON.stringify(data.dnsServers)); + console.log("getIfaceConfig promiss domain = " + JSON.stringify(data.domain)); +}).catch(error => { + console.log("getIfaceConfig promiss error = " + JSON.stringify(error)); }); ``` @@ -178,15 +238,26 @@ isIfaceActive(iface: string, callback: AsyncCallback\): void | iface | string | 是 | 接口名。为空时代表查询是否存在激活接口 | | callback | AsyncCallback\ | 是 | 回调函数,已激活:1,未激活:0,其他为获取失败错误码。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------------------| +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2200001 | Invalid parameter value. | +| 2200002 | Operation failed. Cannot connect to service.| +| 2200003 | System internal error. | +| 2201005 | The device information does not exist. | + **示例:** ```js ethernet.isIfaceActive("eth0", (error, value) => { - if (error) { - console.log("whether2Activate callback error = " + error); - } else { - console.log("whether2Activate callback = " + value); - } + if (error) { + console.log("whether2Activate callback error = " + JSON.stringify(error)); + } else { + console.log("whether2Activate callback = " + JSON.stringify(value)); + } }); ``` @@ -214,13 +285,24 @@ isIfaceActive(iface: string): Promise\ | ----------------| ------------------------------------------------------------------ | | Promise\ | 以Promise形式返回获取结果。已激活:1,未激活:0,其他为获取失败错误码。| +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------------------| +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2200001 | Invalid parameter value. | +| 2200002 | Operation failed. Cannot connect to service.| +| 2200003 | System internal error. | +| 2201005 | The device information does not exist. | + **示例:** ```js ethernet.isIfaceActive("eth0").then((data) => { - console.log("isIfaceActive promiss = " + data); -}).catch((error) => { - console.log("isIfaceActive promiss error = " + error); + console.log("isIfaceActive promiss = " + JSON.stringify(data)); +}).catch(error => { + console.log("isIfaceActive promiss error = " + JSON.stringify(error)); }); ``` @@ -242,18 +324,26 @@ getAllActiveIfaces(callback: AsyncCallback\>): void | -------- | ------------------------------------ | ---- | ------------------------------ | | callback | AsyncCallback\> | 是 | 回调函数,返回值为对应接口名。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------------------| +| 201 | Permission denied. | +| 2200002 | Operation failed. Cannot connect to service.| +| 2200003 | System internal error. | + **示例:** ```js ethernet.getAllActiveIfaces((error, value) => { - if (error) { - console.log("getAllActiveIfaces callback error = " + error); - } else { - console.log("getAllActiveIfaces callback value.length = " + value.length); - for (let i = 0; i < value.length; i++) { - console.log("getAllActiveIfaces callback = " + value[i]); + if (error) { + console.log("getAllActiveIfaces callback error = " + JSON.stringify(error)); + } else { + console.log("getAllActiveIfaces callback value.length = " + JSON.stringify(value.length)); + for (let i = 0; i < value.length; i++) { + console.log("getAllActiveIfaces callback = " + JSON.stringify(value[i])); + } } - } }); ``` @@ -275,16 +365,24 @@ getAllActiveIfaces(): Promise\> | ------------------------------ | ----------------------------------------------- | | Promise\> | 以Promise形式返回获取结果。返回值为对应接口名。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------------------------| +| 201 | Permission denied. | +| 2200002 | Operation failed. Cannot connect to service.| +| 2200003 | System internal error. | + **示例:** ```js ethernet.getAllActiveIfaces().then((data) => { - console.log("getAllActiveIfaces promiss data.length = " + data.length); - for (let i = 0; i < data.length; i++) { - console.log("getAllActiveIfaces promiss = " + data[i]); - } -}).catch((error) => { - console.log("getAllActiveIfaces promiss error = " + error); + console.log("getAllActiveIfaces promiss data.length = " + JSON.stringify(data.length)); + for (let i = 0; i < data.length; i++) { + console.log("getAllActiveIfaces promiss = " + JSON.stringify(data[i])); + } +}).catch(error => { + console.log("getAllActiveIfaces promiss error = " + JSON.stringify(error)); }); ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-net-policy.md b/zh-cn/application-dev/reference/apis/js-apis-net-policy.md new file mode 100644 index 0000000000000000000000000000000000000000..a628c3346a7f923f1c170b340d922fa2336882bc --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-net-policy.md @@ -0,0 +1,1558 @@ +# @ohos.net.policy (网络策略管理) + +网络策略管理通过对用户使用数据流量进行控制管理,采用防火墙技术实现网络策略的管理。 + +> **说明:** +> +> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + +## 导入模块 + +```js +import policy from '@ohos.net.policy' +``` + +## policy.setBackgroundPolicy + +setBackgroundPolicy(isAllowed: boolean, callback: AsyncCallback\): void + +设置后台网络策略,使用callback方式作为异步方法。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------- | ---- | ---------- | +| isAllowed | boolean | 是 | 是否允许应用后台使用数据 | +| callback | AsyncCallback\ | 是 | 回调函数,成功返回设置后台网络策略的结果,失败返回错误码错误信息。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js +policy.setBackgroundPolicy(Boolean(Number.parseInt(this.isBoolean))), (error, data) => { + this.callBack(error, data); + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}); +``` + +## policy.setBackgroundPolicy + +setBackgroundPolicy(isAllowed: boolean): Promise\ + +设置后台网络策略,使用Promise方式作为异步方法。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------- | ---- | ---------- | +| isAllowed | boolean | 是 | 是否允许应用后台使用数据 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**返回值:** + +| 类型 | 说明 | +| --------------------------------- | ------------------------------------- | +| Promise\ | 以Promise形式返回设定结果,失败返回错误码错误信息。 | + +**示例:** + +```js +policy.setBackgroundPolicy(Boolean(Number.parseInt(this.isBoolean))).then(function(error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}) +``` + +## policy.isBackgroundAllowed + +isBackgroundAllowed(callback: AsyncCallback\): void + +获取后台网络策略,使用callback方式作为异步方法。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------- | ---- | ---------- | +| callback | AsyncCallback\ | 是 | 回调函数,返回true代表后台策略为允许。失败返回错误码错误信息。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js +policy.isBackgroundAllowed((error, data) => { + this.callBack(error, data); + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}); +``` + +## policy.isBackgroundAllowed + +isBackgroundAllowed(): Promise\; + +获取后台网络策略,使用Promise方式作为异步方法。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**返回值:** + +| 类型 | 说明 | +| --------------------------------- | ------------------------------------- | +| Promise\ | 以Promise形式返回设定结果。 返回true代表后台策略为允许。失败返回错误码错误信息。| + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js +policy.isBackgroundAllowed().then(function(error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}) + +``` + +## policy.setPolicyByUid + +setPolicyByUid(uid: number, policy: NetUidPolicy, callback: AsyncCallback\): void + +设置对应uid应用的访问计量网络的策略,使用callback方式作为异步方法。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------- | ---- | ---------- | +| uid | number | 是 | 应用的唯一标识符 | +| policy | [NetUidPolicy](#netuidpolicy) | 是 | 应用对应的策略 | +| callback | AsyncCallback\ | 是 | 回调函数,成功返回设定结果。失败返回错误码错误信息。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js +let param = { + uid: Number.parseInt(this.firstParam), policy: Number.parseInt(this.currentNetUidPolicy) +} +policy.setPolicyByUid(Number.parseInt(this.firstParam), Number.parseInt(this.currentNetUidPolicy), (error, data) => { + this.callBack(error, data); +}); +``` + +## policy.setPolicyByUid + +setPolicyByUid(uid: number, policy: NetUidPolicy): Promise\; + +设置对应uid应用的访问计量网络的策略,使用Promise方式作为异步方法。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------- | ---- | ---------- | +| uid | number | 是 | 应用的唯一标识符 | +| policy | [NetUidPolicy](#netuidpolicy) | 是 | 应用对应的策略 | + +**返回值:** + +| 类型 | 说明 | +| --------------------------------- | ------------------------------------- | +| Promise\ | 以Promise形式返回设定结果。失败返回错误码错误信息。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js +let param = { + uid: Number.parseInt(this.firstParam), policy: Number.parseInt(this.currentNetUidPolicy) +} +policy.setPolicyByUid(Number.parseInt(this.firstParam), Number.parseInt(this.currentNetUidPolicy)).then(function(error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}) + +``` + +## policy.getPolicyByUid + +getPolicyByUid(uid: number, callback: AsyncCallback\): void + +通过应用uid获取策略,使用callback方式作为异步方法。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------- | ---- | ---------- | +| uid | number | 是 | app唯一标识符 | +| callback | AsyncCallback\<[NetUidPolicy](#netuidpolicy)> | 是 | 回调函数,成功返回获取策略结果,失败返回错误码错误信息。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js +policy.getPolicyByUid(Number.parseInt(this.firstParam), (error, data) => { + this.callBack(error, data); +}); +``` + +## policy.getPolicyByUid + +getPolicyByUid(uid: number): Promise\; + +通过应用uid获取策略,使用Promise方式作为异步方法。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------- | ---- | ---------- | +| uid | number | 是 | app唯一标识符 | + +**返回值:** + +| 类型 | 说明 | +| --------------------------------- | ------------------------------------- | +| Promise\<[NetUidPolicy](#netuidpolicy)> | 以Promise形式返回获取策略结果。失败返回错误码错误信息。| + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js +policy.getPolicyByUid(Number.parseInt(this.firstParam)).then(function(error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}) + +``` + +## policy.getUidsByPolicy + +getUidsByPolicy(policy: NetUidPolicy, callback: AsyncCallback\>): void + +通过策略获取设置这一策略的应用uid数组,使用callback方式作为异步方法。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------- | ---- | ---------- | +| policy | [NetUidPolicy](#netuidpolicy) | 是 | 应用对应的计量网络下的策略 | +| callback | AsyncCallback\> | 是 | 回调函数,成功返回应用的uid数组,失败返回错误码错误信息。| + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js +policy.getUidsByPolicy(Number.parseInt(this.currentNetUidPolicy), (error, data) => { + this.callBack(error, data); +}); +``` + +## policy.getUidsByPolicy + +function getUidsByPolicy(policy: NetUidPolicy): Promise\>; + +通过策略获取设置这一策略的应用uid数组,使用Promise方式作为异步方法。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------- | ---- | ---------- | +| policy | [NetUidPolicy](#netuidpolicy) | 是 | app对应的计量网络下的策略 | + +**返回值:** + +| 类型 | 说明 | +| --------------------------------- | ------------------------------------- | +| Promise\> | 以Promise形式返回应用的uid数组,失败返回错误码错误信息。| + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js +policy.getUidsByPolicy(Number.parseInt(this.firstParam)).then(function(error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}) + +``` + +## policy.getNetQuotaPolicies + +getNetQuotaPolicies(callback: AsyncCallback\>): void + +获取计量网络策略,使用callback方式作为异步方法。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------- | ---- | ---------- | +| callback | AsyncCallback\> | 是 | 回调函数,返回获取结果。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js +policy.getNetQuotaPolicies((error, data) => { + this.callBack(error, data); +}); +``` + +## policy.getNetQuotaPolicies + +getNetQuotaPolicies(): Promise\>; + +获取计量网络策略,使用Promise方式作为异步方法。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**返回值:** + +| 类型 | 说明 | +| --------------------------------- | ------------------------------------- | +| Promise\> | 以Promise形式返回设定结果。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js +policy.getNetQuotaPolicies().then(function(error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}) + +``` + +## policy.setNetQuotaPolicies + +setNetQuotaPolicies(quotaPolicies: Array\, callback: AsyncCallback\): void + +设置计量网络策略,使用callback方式作为异步方法。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------- | ---- | ---------- | +| quotaPolicies | Array\<[NetQuotaPolicy](#netquotapolicy)> | 是 | 计量网络策略 | +| callback | AsyncCallback\ | 是 | 回调函数,返回设定结果。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js +let param = {netType:Number.parseInt(this.netType), iccid:this.iccid, ident:this.ident, periodDuration:this.periodDuration, warningBytes:Number.parseInt(this.warningBytes), + limitBytes:Number.parseInt(this.limitBytes), lastWarningRemind:this.lastWarningRemind, lastLimitRemind:this.lastLimitRemind, metered:Boolean(Number.parseInt(this.metered)), limitAction:this.limitAction}; +this.netQuotaPolicyList.push(param); + +policy.setNetQuotaPolicies(this.netQuotaPolicyList, (error, data) => { + this.callBack(error, data); +}); +``` + +## policy.setNetQuotaPolicies + +setNetQuotaPolicies(quotaPolicies: Array\): Promise\; + +设置计量网络策略,使用Promise方式作为异步方法。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------- | ---- | ---------- | +| quotaPolicies | Array\<[NetQuotaPolicy](#netquotapolicy)> | 是 | 计量网络策略 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**返回值:** + +| 类型 | 说明 | +| --------------------------------- | ------------------------------------- | +| Promise\ | 以Promise形式返回设定结果。 | + +**示例:** + +```js +let param = {netType:Number.parseInt(this.netType), iccid:this.iccid, ident:this.ident, periodDuration:this.periodDuration, warningBytes:Number.parseInt(this.warningBytes), + limitBytes:Number.parseInt(this.limitBytes), lastWarningRemind:this.lastWarningRemind, lastLimitRemind:this.lastLimitRemind, metered:Boolean(Number.parseInt(this.metered)), limitAction:this.limitAction}; +this.netQuotaPolicyList.push(param); + +policy.setNetQuotaPolicies(this.netQuotaPolicyList).then(function(error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}) +``` + +## policy.restoreAllPolicies + +restoreAllPolicies(iccid: string, callback: AsyncCallback\): void + +重置对应sim卡id的蜂窝网络、后台网络策略、防火墙策略、应用对应的策略,使用callback方式作为异步方法。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------- | ---- | ---------- | +| iccid | string | 是 | SIM卡ID| +| callback | AsyncCallback\ | 是 | 回调函数,返回重置结果。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js +this.firstParam = iccid; +policy.restoreAllPolicies(this.firstParam, (error, data) => { + this.callBack(error, data); +}); +``` + +## policy.restoreAllPolicies + +restoreAllPolicies(iccid: string): Promise\; + +重置对应sim卡id的蜂窝网络、后台网络策略、防火墙策略、应用对应的策略,使用Promise方式作为异步方法。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------- | ---- | ---------- | +| iccid | string | 是 | SIM卡ID| + +**返回值:** + +| 类型 | 说明 | +| --------------------------------- | ------------------------------------- | +| Promise\ | 以Promise形式返回设定结果。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js +this.firstParam = iccid; +policy.restoreAllPolicies(this.firstParam).then(function(error, data){ + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}) + +``` + +## policy.isUidNetAllowed + +isUidNetAllowed(uid: number, isMetered: boolean, callback: AsyncCallback\): void + +获取对应uid能否访问计量或非计量网络,使用callback方式作为异步方法。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------- | ---- | ---------- | +| uid | number | 是 | app唯一标识符 | +| isMetered | boolean | 是 | 是否为计量网络 | +| callback | AsyncCallback\ | 是 | 回调函数,返回true表示这个uid可以访问对应的计量网络。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js + +let param = { + uid: Number.parseInt(this.firstParam), isMetered: Boolean(Number.parseInt(this.isBoolean)) +} +policy.isUidNetAllowed(Number.parseInt(this.firstParam), Boolean(Number.parseInt(this.isBoolean)), (error, data) => { + this.callBack(error, data); +}); +``` + +## policy.isUidNetAllowed + +isUidNetAllowed(uid: number, isMetered: boolean): Promise\; + +获取对应uid能否访问计量或非计量网络,使用Promise方式作为异步方法。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------- | ---- | ---------- | +| uid | number | 是 | app唯一标识符 | +| isMetered | boolean | 是 | 是否为计量网络 | + +**返回值:** + +| 类型 | 说明 | +| --------------------------------- | ------------------------------------- | +| Promise\ | 以Promise形式返回设定结果。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js + +let param = { + uid: Number.parseInt(this.firstParam), isMetered: Boolean(Number.parseInt(this.isBoolean)) +} +policy.isUidNetAllowed(Number.parseInt(this.firstParam), Boolean(Number.parseInt(this.isBoolean))).then(function(error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}) + +``` + +## policy.isUidNetAllowed + +isUidNetAllowed(uid: number, iface: string, callback: AsyncCallback\): void + +获取对应uid能否访问指定的iface的网络,使用callback方式作为异步方法。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------- | ---- | ---------- | +| uid | number | 是 | app唯一标识符 | +| iface | string | 是 | 网络对应的名称 | +| callback | AsyncCallback\ | 是 | 回调函数,返回true表示这个uid可以访问对应iface的网络。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js + +let param = { + uid: Number.parseInt(this.firstParam), iface: this.secondParam +} +policy.isUidNetAllowed(Number.parseInt(this.firstParam), this.secondParam, (error, data) => { + this.callBack(error, data); +}); +``` + +## policy.isUidNetAllowed + +isUidNetAllowed(uid: number, iface: string): Promise\; + +获取对应uid能否访问指定的iface的网络,使用Promise方式作为异步方法。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------- | ---- | ---------- | +| uid | number | 是 | app唯一标识符 | +| iface | string | 是 | 网络对应的名称 | + +**返回值:** + +| 类型 | 说明 | +| --------------------------------- | ------------------------------------- | +| Promise\ | 以Promise形式返回设定结果。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js +let param = { + uid: Number.parseInt(this.firstParam), iface: this.secondParam +} +policy.isUidNetAllowed(Number.parseInt(this.firstParam), this.secondParam).then(function(error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}) + +``` + +## policy.setDeviceIdleAllowList + +setDeviceIdleAllowList(uid: number, isAllowed: boolean, callback: AsyncCallback\): void + +设置指定uid应用是否在休眠防火墙的白名单,使用callback方式作为异步方法。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------- | ---- | ---------- | +| uid | number | 是 | app唯一标识符 | +| isAllowed | boolean | 是 | 是否加入白名单 | +| callback | callback: AsyncCallback\ | 是 | 回调函数,返回设定结果。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js +let param = { + uid: Number.parseInt(this.firstParam), isAllowed: Boolean(Number.parseInt(this.isBoolean)) +} +policy.setDeviceIdleAllowList(Number.parseInt(this.firstParam), Boolean(Number.parseInt(this.isBoolean)), (error, data) => { + this.callBack(error, data); +}); +``` + +## policy.setDeviceIdleAllowList + +setDeviceIdleAllowList(uid: number, isAllowed: boolean): Promise\; + +设置指定uid应用是否在休眠防火墙的白名单,使用Promise方式作为异步方法。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------- | ---- | ---------- | +| uid | number | 是 | app唯一标识符 | +| isAllowed | boolean | 是 | 是否加入白名单 | + +**返回值:** + +| 类型 | 说明 | +| --------------------------------- | ------------------------------------- | +| Promise\ | 以Promise形式返回设定结果。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js +let param = { + uid: Number.parseInt(this.firstParam), isAllowed: Boolean(Number.parseInt(this.isBoolean)) +} +policy.setDeviceIdleAllowList(Number.parseInt(this.firstParam), Boolean(Number.parseInt(this.isBoolean))).then(function(error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}) + +``` + +## policy.getDeviceIdleAllowList + +getDeviceIdleAllowList(callback: AsyncCallback\>): void + +获取休眠模式白名单所包含的uid数组,使用callback方式作为异步方法。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------- | ---- | ---------- | +| callback | AsyncCallback\> | 是 | 回调函数,返回获取结果。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js +policy.getDeviceIdleAllowList((error, data) => { + this.callBack(error, data); +}); +``` + +## policy.getDeviceIdleAllowList + +getDeviceIdleAllowList(): Promise\>; + +获取休眠模式白名单所包含的uid数组,使用Promise方式作为异步方法。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**返回值:** + +| 类型 | 说明 | +| --------------------------------- | ------------------------------------- | +| Promise\> | 以Promise形式返回设定结果。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js +policy.getDeviceIdleAllowList().then(function(error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}) +``` + +## policy.getBackgroundPolicyByUid + +getBackgroundPolicyByUid(uid: number, callback: AsyncCallback\): void + +获取指定uid能否访问后台网络,使用callback方式作为异步方法。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------- | ---- | ---------- | +| uid | number | 是 | app唯一标识符 | +| callback | AsyncCallback\<[NetBackgroundPolicy](#netbackgroundpolicy)> | 是 | 回调函数,返回获取结果。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js +this.firstParam = uid +policy.getBackgroundPolicyByUid(Number.parseInt(this.firstParam), (error, data) => { + this.callBack(error, data); +}); +``` + +## policy.getBackgroundPolicyByUid + +getBackgroundPolicyByUid(uid: number): Promise\; + +获取指定uid能否访问后台网络,使用Promise方式作为异步方法。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------- | ---- | ---------- | +| uid | number | 是 | app唯一标识符 | + +**返回值:** + +| 类型 | 说明 | +| --------------------------------- | ------------------------------------- | +| Promise\<[NetBackgroundPolicy](#netbackgroundpolicy)> | 以Promise形式返回设定结果。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js +this.firstParam = uid +policy.getBackgroundPolicyByUid(Number.parseInt(this.firstParam)).then(function(error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}) +``` + +## policy.resetPolicies + +resetPolicies(iccid: string, callback: AsyncCallback\): void + +重置对应sim卡id的蜂窝网络、后台网络策略、防火墙策略、应用对应的策略,使用callback方式作为异步方法。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------- | ---- | ---------- | +| iccid | string | 是 | SIM卡ID| +| callback | AsyncCallback\ | 是 | 回调函数,返回重置结果。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js +this.firstParam = iccid +policy.resetPolicies(this.firstParam, (error, data) => { + this.callBack(error, data); +}); +``` + +## policy.resetPolicies + +resetPolicies(iccid: string): Promise\; + +重置对应sim卡id的蜂窝网络、后台网络策略、防火墙策略、应用对应的策略,使用Promise方式作为异步方法。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------- | ---- | ---------- | +| iccid | string | 是 | SIM卡ID| + +**返回值:** + +| 类型 | 说明 | +| --------------------------------- | ------------------------------------- | +| Promise\ | 以Promise形式返回设定结果。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js +policy.getUidsByPolicy(Number.parseInt(this.firstParam)).then(function(error, data) { + +}) +this.firstParam = iccid +policy.resetPolicies(this.firstParam).then(function(error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}) + +``` + +## policy.updateRemindPolicy + +updateRemindPolicy(netType: NetBearType, iccid: string, remindType: RemindType, callback: AsyncCallback\): void + +更新提醒策略,使用callback方式作为异步方法。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------- | ---- | ---------- | +| netType | [NetBearType](js-apis-net-connection.md#netbeartype) | 是 | 网络类型 | +| iccid | string | 是 | SIM卡ID| +| remindType | [RemindType](#remindtype) | 是 | 提醒类型 | +| callback | AsyncCallback\ | 是 | 回调函数,返回更新结果。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js +let param = { + netType: Number.parseInt(this.netType), iccid: this.firstParam, remindType: this.currentRemindType +} +policy.updateRemindPolicy(Number.parseInt(this.netType), this.firstParam, Number.parseInt(this.currentRemindType), (error, data) => { + this.callBack(error, data); +}); +``` + +## policy.updateRemindPolicy + +updateRemindPolicy(netType: NetBearType, iccid: string, remindType: RemindType): Promise\; + +更新提醒策略,使用Promise方式作为异步方法。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------- | ---- | ---------- | +| netType | [NetBearType](js-apis-net-connection.md#netbeartype) | 是 | 网络类型 | +| iccid | string | 是 | SIM卡ID| +| remindType | [RemindType](#remindtype) | 是 | 提醒类型 | + +**返回值:** + +| 类型 | 说明 | +| --------------------------------- | ------------------------------------- | +| Promise\ | 以Promise形式返回设定结果。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js +let param = { + netType: Number.parseInt(this.netType), iccid: this.firstParam, remindType: this.currentRemindType +} +policy.updateRemindPolicy(Number.parseInt(this.netType), this.firstParam, Number.parseInt(this.currentRemindType)).then(function(error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}) + +``` + +## policy.setPowerSaveAllowList + +setPowerSaveAllowList(uid: number, isAllowed: boolean, callback: AsyncCallback\): void + +设置指定uid应用是否在省电防火墙的白名单,使用callback方式作为异步方法。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------- | ---- | ---------- | +| uid | number | 是 | app唯一标识符 | +| isAllowed | boolean | 是 | 是否加入白名单 | +| callback | callback: AsyncCallback\ | 是 | 回调函数,返回设定结果。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js +let param = { + uid: Number.parseInt(this.firstParam), isAllowed: Boolean(Number.parseInt(this.isBoolean)) +} +policy.setPowerSaveAllowList(Number.parseInt(this.firstParam), Boolean(Number.parseInt(this.isBoolean)), (error, data) => { + this.callBack(error, data); +}); +``` + +## policy.setPowerSaveAllowList + +setPowerSaveAllowList(uid: number, isAllowed: boolean): Promise\; + +设置指定uid应用是否在省电防火墙的白名单,使用Promise方式作为异步方法。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------- | ---- | ---------- | +| uid | number | 是 | app唯一标识符 | +| isAllowed | boolean | 是 | 是否加入白名单 | + +**返回值:** + +| 类型 | 说明 | +| --------------------------------- | ------------------------------------- | +| Promise\ | 以Promise形式返回设定结果。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js +let param = { + uid: Number.parseInt(this.firstParam), isAllowed: Boolean(Number.parseInt(this.isBoolean)) +} +policy.setPowerSaveAllowList(Number.parseInt(this.firstParam), Boolean(Number.parseInt(this.isBoolean))).then(function(error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}) + +``` + +## policy.getPowerSaveAllowList + +getPowerSaveAllowList(callback: AsyncCallback\>): void + +获取省电模式白名单所包含的uid数组,使用callback方式作为异步方法。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------- | ---- | ---------- | +| callback | AsyncCallback\> | 是 | 回调函数,返回获取结果。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js +policy.getPowerSaveAllowList((error, data) => { + this.callBack(error, data); +}); +``` + +## policy.getPowerSaveAllowList + +getPowerSaveAllowList(): Promise\>; + +获取休眠模式白名单所包含的uid数组,使用Promise方式作为异步方法。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**返回值:** + +| 类型 | 说明 | +| --------------------------------- | ------------------------------------- | +| Promise\> | 以Promise形式返回设定结果。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**示例:** + +```js +policy.getPowerSaveAllowList().then(function(error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}) +``` + +## policy.on + +网络策略的句柄。 + +### on('netUidPolicyChange') + +on(type: "netUidPolicyChange", callback: Callback\<{ uid: number, policy: NetUidPolicy }>): void + +注册policy发生改变时的回调,使用callback方式作为异步方法。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------- | ---- | ------------------------------------------------------------ | +| type | netUidPolicyChange | 是 | policy发生改变的类型 | +| callback | Callback\<{ uid: number, policy: [NetUidPolicy](#netuidpolicy) }> | 是 | 回调函数。注册policy发生改变时调用。 | + +**示例:** + +```js +policy.on('netUidPolicyChange', (data) => { + this.log('on netUidPolicyChange:' + JSON.stringify(data)); +}) +``` + +### on('netUidRuleChange') + +on(type: "netUidRuleChange", callback: Callback\<{ uid: number, rule: NetUidRule }>): void + +注册rule发生改变时的回调,使用callback方式作为异步方法。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------- | ---- | ------------------------------------------------------------ | +| type | netUidRuleChange | 是 | rule发生改变的类型 | +| callback | Callback\<{ uid: number, rule: [NetUidRule](#netuidrule) }> | 是 | 回调函数。注册rule发生改变时的调用。 | + +**示例:** + +```js +policy.on('netUidRuleChange', (data) => { + this.log('on netUidRuleChange:' + JSON.stringify(data)); +}) +``` + +### on('netMeteredIfacesChange') + +on(type: "netMeteredIfacesChange", callback: Callback\>): void + +注册计量iface发生改变时的回调,使用callback方式作为异步方法。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------- | ---- | ------------------------------------------------------------ | +| type | netMeteredIfacesChange | 是 | 计量iface发生改变的类型 | +| callback | Callback\> | 是 | 回调函数。注册计量iface发生改变时调用。 | + +**示例:** + +```js +policy.on('netMeteredIfacesChange', (data) => { + this.log('on netMeteredIfacesChange:' + JSON.stringify(data)); +}) +``` + +### on('netQuotaPolicyChange') + +on(type: "netQuotaPolicyChange", callback: Callback\>): void + +注册计量网络策略发生改变时的回调,使用callback方式作为异步方法。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------- | ---- | ------------------------------------------------------------ | +| type | netQuotaPolicyChange | 是 | 计量网络策略发生改变的类型 | +| callback | Callback\> | 是 | 回调函数。注册计量网络策略发生改变时调用。 | + +**示例:** + +```js +policy.on('netQuotaPolicyChange', (data) => { + this.log('on netQuotaPolicyChange:' + JSON.stringify(data)); +}) +``` + +### on('netBackgroundPolicyChange') + +on(type: "netBackgroundPolicyChange", callback: Callback\): void + +注册后台网络策略发生改变时的回调,使用callback方式作为异步方法。 + +**需要权限**:ohos.permission.CONNECTIVITY_INTERNAL + +**系统能力**:SystemCapability.Communication.NetManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------- | ---- | ------------------------------------------------------------ | +| type | netBackgroundPolicyChange | 是 | 后台网络策略发生改变的类型 | +| callback | Callback\ | 是 | 回调函数。注册后台网络策略发生改变时调用。 | + +**示例:** + +```js +policy.on('netBackgroundPolicyChange', (data) => { + this.log('on netBackgroundPolicyChange:' + JSON.stringify(data)); +}) +``` + +## NetBackgroundPolicy + +后台网络策略。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetManager.Core。 + +| 参数名 | 值 | 说明 | +| ------------------------ | ---- | ---------------------- | +| NET_BACKGROUND_POLICY_NONE | 0 | 默认值。 | +| NET_BACKGROUND_POLICY_ENABLE | 1 | 应用在后台可以使用计量网路。 | +| NET_BACKGROUND_POLICY_DISABLE | 2 | 应用在后台不可以使用计量网路。 | +| NET_BACKGROUND_POLICY_ALLOW_LIST | 3 | 只有应用指定的列表在后台可以使用计量网络。 | + +## NetQuotaPolicy + +计量网络策略。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetManager.Core。 + +| 参数名 | 类型 | 说明 | +| ----------------------- | ----------------------------------- | ------------------------------------------------------------ | +| netType | [NetBearType](js-apis-net-connection.md#netbeartype) | 网络类型。 | +| iccid | string | 计量蜂窝网络的SIM卡的标识值。以太网,wifi网络不会用到 | +| ident | string | 计量蜂窝网络中配合iccid联合使用。以太网,wifi网络单独使用。用于标记类型。 | +| periodDuration | string | 计量开始时间。 | +| warningBytes | number | 发出警告的流量阈值。 | +| limitBytes | number | 流量设置的配额。 | +| lastWarningRemind | string | 最新一次发出警告的时间。 | +| lastLimitRemind | string | 最新一次配额耗尽的时间。 | +| metered | string | 是否为计量网络。 | +| limitAction | [LimitAction](#limitaction) | 到达流量限制后的动作。 | + +## LimitAction + +限制动作。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetManager.Core。 + +| 参数名 | 值 | 说明 | +| ---------------------- | ----- | ------------ | +| LIMIT_ACTION_NONE | -1 | 默认值。 | +| LIMIT_ACTION_DISABLE | 0 | 当配额策略达到限制时,访问被禁用。 | +| LIMIT_ACTION_AUTO_BILL| 1 | 当配额策略达到限制时,用户将自动计费。 | + +## NetUidRule + +计量网络规则。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetManager.Core。 + +| 参数名 | 值 | 说明 | +| ---------------------- | ----- | ------------ | +| NET_RULE_NONE | 0 | 默认规则 | +| NET_RULE_ALLOW_METERED_FOREGROUND | 1 | 允许前台访问计量网络 | +| NET_RULE_ALLOW_METERED | 2 | 允许访问计量网络 | +| NET_RULE_REJECT_METERED | 4 | 拒绝访问计量网络 | +| NET_RULE_ALLOW_ALL | 32 | 允许访问所有网络 | +| NET_RULE_REJECT_ALL | 64 | 拒绝访问所有网络 | + +## RemindType + +提醒类型。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetManager.Core。 + +| 参数名 | 值 | 说明 | +| ---------------------- | - | ------- | +| REMIND_TYPE_WARNING | 1 | 警告提醒 | +| REMIND_TYPE_LIMIT | 2 | 限制提醒 | + +## NetUidPolicy + +应用对应的网络策略。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetManager.Core。 + +| 参数名 | 值 | 说明 | +| ---------------------- | ----- | ------------ | +| NET_POLICY_NONE | 0 | 默认网络策略 | +| NET_POLICY_ALLOW_METERED_BACKGROUND | 1 | 允许应用在后台访问计量网络 | +| NET_POLICY_REJECT_METERED_BACKGROUND | 2 | 拒绝应用在后台访问计量网络 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-net-sharing.md b/zh-cn/application-dev/reference/apis/js-apis-net-sharing.md index cefbc4d648d85cb95de3f56f8bfd010f3384d366..fd4ed040b47b0a7729efc4eb4b30f43c98e9a8e2 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-net-sharing.md +++ b/zh-cn/application-dev/reference/apis/js-apis-net-sharing.md @@ -1,6 +1,6 @@ # @ohos.net.sharing (网络共享管理) -网络共享管理分享设备已有网络给其他连接设备,支持Wi-Fi热点共享和蓝牙共享,同时提供网络共享状态、共享流量查询功能。 +网络共享管理分享设备已有网络给其他连接设备,支持Wi-Fi热点共享、蓝牙共享和USB共享,同时提供网络共享状态、共享流量查询功能。 > **说明:** > @@ -30,6 +30,15 @@ isSharingSupported(callback: AsyncCallback\): void | -------- | --------------------------------------- | ---- | ---------- | | callback | AsyncCallback\ | 是 | 回调函数,返回true代表支持网络共享。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 2200002 | Operation failed. Cannot connect to service. | +| 2200003 | System internal error. | +| 2202011 | Cannot get network sharing configuration. | + **示例:** ```js @@ -57,6 +66,15 @@ isSharingSupported(): Promise\ | --------------------------------- | ------------------------------------- | | Promise\ | 以Promise形式返回是否支持共享结果。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 2200002 | Operation failed. Cannot connect to service. | +| 2200003 | System internal error. | +| 2202011 | Cannot get network sharing configuration. | + **示例:** ```js @@ -85,6 +103,14 @@ isSharing(callback: AsyncCallback\): void | -------- | --------------------------------------- | ---- | ---------- | | callback | AsyncCallback\ | 是 | 回调函数,返回true代表网络共享中。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 2200002 | Operation failed. Cannot connect to service. | +| 2200003 | System internal error. | + **示例:** ```js @@ -112,6 +138,14 @@ isSharing(): Promise\ | --------------------------------- | ------------------------------------- | | Promise\ | 以Promise形式返回网络共享状态结果,返回true代表网络共享中。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 2200002 | Operation failed. Cannot connect to service. | +| 2200003 | System internal error. | + **示例:** ```js @@ -141,11 +175,27 @@ startSharing(type: SharingIfaceType, callback: AsyncCallback\): void | type | [SharingIfaceType](#sharingifacetype) | 是 | 共享类型,0:Wi-Fi 1:USB 2:BLUETOOTH。 | | callback | AsyncCallback\ | 是 | 回调函数,返回开启网络共享结果。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2200001 | Invalid parameter value. | +| 2200002 | Operation failed. Cannot connect to service. | +| 2200003 | System internal error. | +| 2202004 | Try to share an unavailable iface. | +| 2202005 | WiFi sharing failed. | +| 2202006 | Bluetooth sharing failed. | +| 2202009 | Network share enable forwarding error. | +| 2202011 | Cannot get network sharing configuration. | + **示例:** ```js import SharingIfaceType from '@ohos.net.sharing' -sharing.startSharing(SharingIfaceType.SHARING_WIFI, (error) => { +let SHARING_WIFI=0; +sharing.startSharing(SHARING_WIFI, (error) => { console.log(JSON.stringify(error)); }); ``` @@ -174,11 +224,27 @@ startSharing(type: SharingIfaceType): Promise\ | --------------------------------- | ------------------------------------- | | Promise\ | 以Promise形式返回开启共享执行结果。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2200001 | Invalid parameter value. | +| 2200002 | Operation failed. Cannot connect to service. | +| 2200003 | System internal error. | +| 2202004 | Try to share an unavailable iface. | +| 2202005 | WiFi sharing failed. | +| 2202006 | Bluetooth sharing failed. | +| 2202009 | Network share enable forwarding error. | +| 2202011 | Cannot get network sharing configuration. | + **示例:** ```js import SharingIfaceType from '@ohos.net.sharing' -sharing.startSharing(SharingIfaceType.SHARING_WIFI).then(() => { +let SHARING_WIFI=0; +sharing.startSharing(SHARING_WIFI).then(() => { console.log("start wifi sharing successful"); }).catch(error => { console.log("start wifi sharing failed"); @@ -204,11 +270,25 @@ stopSharing(type: SharingIfaceType, callback: AsyncCallback\): void | type | [SharingIfaceType](#sharingifacetype) | 是 | 共享类型,0:Wi-Fi 1:USB 2:BLUETOOTH。 | | callback | AsyncCallback\ | 是 | 回调函数,返回停止网络共享结果。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2200001 | Invalid parameter value. | +| 2200002 | Operation failed. Cannot connect to service. | +| 2200003 | System internal error. | +| 2202005 | WiFi sharing failed. | +| 2202006 | Bluetooth sharing failed. | +| 2202011 | Cannot get network sharing configuration. | + **示例:** ```js import SharingIfaceType from '@ohos.net.sharing' -sharing.stopSharing(SharingIfaceType.SHARING_WIFI, (error) => { +let SHARING_WIFI=0; +sharing.stopSharing(SHARING_WIFI, (error) => { console.log(JSON.stringify(error)); }); ``` @@ -237,11 +317,25 @@ stopSharing(type: SharingIfaceType): Promise\ | --------------------------------- | ------------------------------------- | | Promise\ | 以Promise形式返回关闭共享执行结果。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2200001 | Invalid parameter value. | +| 2200002 | Operation failed. Cannot connect to service. | +| 2200003 | System internal error. | +| 2202005 | WiFi sharing failed. | +| 2202006 | Bluetooth sharing failed. | +| 2202011 | Cannot get network sharing configuration. | + **示例:** ```js import SharingIfaceType from '@ohos.net.sharing' -sharing.stopSharing(SharingIfaceType.SHARING_WIFI).then(() => { +let SHARING_WIFI=0; +sharing.stopSharing(SHARING_WIFI).then(() => { console.log("stop wifi sharing successful"); }).catch(error => { console.log("stop wifi sharing failed"); @@ -266,6 +360,14 @@ getStatsRxBytes(callback: AsyncCallback\): void | -------- | --------------------------------------- | ---- | ---------- | | callback | AsyncCallback\ | 是 | 回调函数,number代表数据量,单位:KB。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 2200002 | Operation failed. Cannot connect to service. | +| 2200003 | System internal error. | + **示例:** ```js @@ -293,6 +395,14 @@ getStatsRxBytes(): Promise\ | --------------------------------- | ------------------------------------- | | Promise\ | 以Promise形式返回共享网络接收数据量,单位:KB。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 2200002 | Operation failed. Cannot connect to service. | +| 2200003 | System internal error. | + **示例:** ```js @@ -321,6 +431,14 @@ getStatsTxBytes(callback: AsyncCallback\): void | -------- | --------------------------------------- | ---- | ---------- | | callback | AsyncCallback\ | 是 | 回调函数,number代表数据量,单位:KB。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 2200002 | Operation failed. Cannot connect to service. | +| 2200003 | System internal error. | + **示例:** ```js @@ -348,6 +466,14 @@ getStatsTxBytes(): Promise\ | --------------------------------- | ------------------------------------- | | Promise\ | 以Promise形式返回共享网络发送数据量,单位:KB。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 2200002 | Operation failed. Cannot connect to service. | +| 2200003 | System internal error. | + **示例:** ```js @@ -376,6 +502,14 @@ getStatsTotalBytes(callback: AsyncCallback\): void | -------- | --------------------------------------- | ---- | ---------- | | callback | AsyncCallback\ | 是 | 回调函数,number代表数据量,单位:KB。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 2200002 | Operation failed. Cannot connect to service. | +| 2200003 | System internal error. | + **示例:** ```js @@ -403,6 +537,14 @@ getStatsTotalBytes(): Promise\ | --------------------------------- | ------------------------------------- | | Promise\ | 以Promise形式返回共享网络总数据量,单位:KB。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 2200002 | Operation failed. Cannot connect to service. | +| 2200003 | System internal error. | + **示例:** ```js @@ -432,11 +574,22 @@ getSharingIfaces(state: SharingIfaceState, callback: AsyncCallback\> | 是 | 回调函数,返回指定状态的网卡名称列表。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2200001 | Invalid parameter value. | +| 2200002 | Operation failed. Cannot connect to service. | +| 2200003 | System internal error. | + **示例:** ```js import SharingIfaceState from '@ohos.net.sharing' -sharing.getSharingIfaces(SharingIfaceState.SHARING_NIC_CAN_SERVER, (error, data) => { +let SHARING_BLUETOOTH=2; +sharing.getSharingIfaces(SHARING_BLUETOOTH, (error, data) => { console.log(JSON.stringify(error)); console.log(JSON.stringify(data)); }); @@ -466,11 +619,22 @@ getSharingIfaces(state: SharingIfaceState): Promise\> | --------------------------------- | ------------------------------------- | | Promise\> | 以Promise形式返回指定状态网卡名称列表。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2200001 | Invalid parameter value. | +| 2200002 | Operation failed. Cannot connect to service. | +| 2200003 | System internal error. | + **示例:** ```js import SharingIfaceState from '@ohos.net.sharing' -sharing.getSharingIfaces(SharingIfaceState.SHARING_NIC_CAN_SERVER).then(data => { +let SHARING_BLUETOOTH=2; +sharing.getSharingIfaces(SHARING_BLUETOOTH).then(data => { console.log(JSON.stringify(data)); }).catch(error => { console.log(JSON.stringify(error)); @@ -496,11 +660,22 @@ getSharingState(type: SharingIfaceType, callback: AsyncCallback\ | 是 | 回调函数,返回指定类型网络共享状态。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2200001 | Invalid parameter value. | +| 2200002 | Operation failed. Cannot connect to service. | +| 2200003 | System internal error. | + **示例:** ```js import SharingIfaceType from '@ohos.net.sharing' -sharing.getSharingState(SharingIfaceType.SHARING_WIFI, (error, data) => { +let SHARING_WIFI=0; +sharing.getSharingState(SHARING_WIFI, (error, data) => { console.log(JSON.stringify(error)); console.log(JSON.stringify(data)); }); @@ -524,6 +699,16 @@ getSharingState(type: SharingIfaceType): Promise\ | -------- | --------------------------------------- | ---- | ---------- | | type | [SharingIfaceType](#sharingifacetype) | 是 | 共享类型,0:Wi-Fi 1:USB 2:BLUETOOTH。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2200001 | Invalid parameter value. | +| 2200002 | Operation failed. Cannot connect to service. | +| 2200003 | System internal error. | + **返回值:** | 类型 | 说明 | @@ -534,7 +719,8 @@ getSharingState(type: SharingIfaceType): Promise\ ```js import SharingIfaceType from '@ohos.net.sharing' -sharing.getSharingState(SharingIfaceType.SHARING_WIFI).then(data => { +let SHARING_WIFI=0; +sharing.getSharingState(SHARING_WIFI).then(data => { console.log(JSON.stringify(data)); }).catch(error => { console.log(JSON.stringify(error)); @@ -560,11 +746,22 @@ getSharableRegexes(type: SharingIfaceType, callback: AsyncCallback\> | 是 | 回调函数,返回指定类型网卡名称正则表达式列表。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2200001 | Invalid parameter value. | +| 2200002 | Operation failed. Cannot connect to service. | +| 2200003 | System internal error. | + **示例:** ```js import SharingIfaceType from '@ohos.net.sharing' -sharing.getSharableRegexes(SharingIfaceType.SHARING_WIFI, (error, data) => { +let SHARING_WIFI=0; +sharing.getSharableRegexes(SHARING_WIFI, (error, data) => { console.log(JSON.stringify(error)); console.log(JSON.stringify(data)); }); @@ -594,11 +791,22 @@ getSharableRegexes(type: SharingIfaceType): Promise\> | --------------------------------- | ------------------------------------- | | Promise\> | 以Promise形式返回正则表达式列表。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2200001 | Invalid parameter value. | +| 2200002 | Operation failed. Cannot connect to service. | +| 2200003 | System internal error. | + **示例:** ```js import SharingIfaceType from '@ohos.net.sharing' -sharing.getSharableRegexes(SharingIfaceType.SHARING_WIFI).then(data => { +let SHARING_WIFI=0; +sharing.getSharableRegexes(SHARING_WIFI).then(data => { console.log(JSON.stringify(data)); }).catch(error => { console.log(JSON.stringify(error)); @@ -624,12 +832,18 @@ on(type: 'sharingStateChange', callback: Callback\): void | type | string | 是 | 事件名称。 | | callback | AsyncCallback\ | 是 | 回调函数,返回网络共享状态。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | + **示例:** ```js -sharing.on('sharingStateChange', (error, data) => { - console.log(JSON.stringify(error)); - console.log(JSON.stringify(data)); + sharing.on('sharingStateChange', (data) => { + console.log('on sharingStateChange:' + JSON.stringify(data)); }); ``` @@ -652,11 +866,17 @@ off(type: 'sharingStateChange', callback?: Callback\): void | type | string | 是 | 事件名称。 | | callback | AsyncCallback\ | 否 | 回调函数,返回网络共享状态。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | + **示例:** ```js -sharing.off('sharingStateChange', (error, data) => { - console.log(JSON.stringify(error)); +sharing.off('sharingStateChange', (data) => { console.log(JSON.stringify(data)); }); ``` @@ -680,12 +900,18 @@ on(type: 'interfaceSharingStateChange', callback: Callback\<{ type: SharingIface | type | string | 是 | 事件名称。 | | callback | AsyncCallback\<{ type: [SharingIfaceType](#sharingifacetype), iface: string, state: SharingIfaceState(#sharingifacestate) }> | 是 | 回调函数,指定网卡共享状态变化时调用。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | + **示例:** ```js -sharing.on('interfaceSharingStateChange', (error, data) => { - console.log(JSON.stringify(error)); - console.log(JSON.stringify(data)); + sharing.on('interfaceSharingStateChange', (data) => { + console.log('on interfaceSharingStateChange:' + JSON.stringify(data)); }); ``` @@ -708,11 +934,17 @@ off(type: 'interfaceSharingStateChange', callback?: Callback\<{ type: SharingIfa | type | string | 是 | 事件名称。 | | callback | AsyncCallback\<{ type: [SharingIfaceType](#sharingifacetype), iface: string, state: SharingIfaceState(#sharingifacestate) }> | 否 | 回调函数,注销指定网卡共享状态变化通知。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | + **示例:** ```js -sharing.off('interfaceSharingStateChange', (error, data) => { - console.log(JSON.stringify(error)); +sharing.off('interfaceSharingStateChange', (data) => { console.log(JSON.stringify(data)); }); ``` @@ -736,12 +968,18 @@ on(type: 'sharingUpstreamChange', callback: Callback\): void | type | string | 是 | 事件名称。 | | callback | AsyncCallback\ | 是 | 回调函数,上行网络变化时调用。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | + **示例:** ```js -sharing.on('sharingUpstreamChange', (error, data) => { - console.log(JSON.stringify(error)); - console.log(JSON.stringify(data)); + sharing.on('sharingUpstreamChange', (data) => { + console.log('on sharingUpstreamChange:' + JSON.stringify(data)); }); ``` @@ -764,11 +1002,17 @@ off(type: 'sharingUpstreamChange', callback?: Callback\): void | type | string | 是 | 事件名称。 | | callback | AsyncCallback\ | 否 | 回调函数,注销上行网络变化事件。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | + **示例:** ```js -sharing.off('sharingUpstreamChange', (error, data) => { - console.log(JSON.stringify(error)); +sharing.off('sharingUpstreamChange', (data) => { console.log(JSON.stringify(data)); }); ``` @@ -789,7 +1033,7 @@ sharing.off('sharingUpstreamChange', (error, data) => { ## SharingIfaceType -网络共享类型(暂不支持USB共享)。 +网络共享类型。 **系统接口**:此接口为系统接口。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-nfcController.md b/zh-cn/application-dev/reference/apis/js-apis-nfcController.md index a82e48c76e80342f10ce9ee42bfcd2852fc09d34..b46c3e52c46c256fad4ca33851398ed62e7aad52 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-nfcController.md +++ b/zh-cn/application-dev/reference/apis/js-apis-nfcController.md @@ -31,6 +31,9 @@ isNfcAvailable(): boolean 查询设备是否有NFC能力。 +> **说明:** +> 从 API version 7 开始支持,从 API version 9 开始废弃,建议使用canIUse("SystemCapability.Communication.NFC.Core")替代。 + **系统能力:** SystemCapability.Communication.NFC.Core **返回值:** @@ -46,6 +49,9 @@ openNfc(): boolean 打开NFC开关。 +> **说明:** +> 从 API version 7 开始支持,从 API version 9 开始废弃,建议使用[enableNfc](#controllerenablenfc9)替代。 + **需要权限:** ohos.permission.MANAGE_SECURE_SETTINGS **系统能力:** SystemCapability.Communication.NFC.Core @@ -56,12 +62,33 @@ openNfc(): boolean | -------- | -------- | | boolean | true: 打开NFC成功, false: 打开NFC失败。 | +## controller.enableNfc9+ + +enableNfc(): boolean + +打开NFC开关。 + +**需要权限:** ohos.permission.MANAGE_SECURE_SETTINGS + +**系统能力:** SystemCapability.Communication.NFC.Core + +**错误码:** + +以下错误码的详细介绍请参见[NFC错误码](../errorcodes/errorcode-nfc.md)。 + +| 错误码ID | 错误信息| +| ------- | -------| +| 3100101 | NFC state is abnormal in service. | + ## controller.closeNfc closeNfc(): boolean 关闭NFC开关。 +> **说明:** +> 从 API version 7 开始支持,从 API version 9 开始废弃,建议使用[disableNfc](#controllerdisablenfc9)替代。 + **需要权限:** ohos.permission.MANAGE_SECURE_SETTINGS **系统能力:** SystemCapability.Communication.NFC.Core @@ -72,6 +99,24 @@ closeNfc(): boolean | -------- | ------------------------------------------- | | boolean | true: 关闭NFC成功, false: 关闭NFC失败。 | +## controller.disableNfc9+ + +disableNfc(): boolean + +关闭NFC开关。 + +**需要权限:** ohos.permission.MANAGE_SECURE_SETTINGS + +**系统能力:** SystemCapability.Communication.NFC.Core + +**错误码:** + +以下错误码的详细介绍请参见[NFC错误码](../errorcodes/errorcode-nfc.md)。 + +| 错误码ID | 错误信息| +| ------- | -------| +| 3100101 | NFC state is abnormal in service. | + ## controller.isNfcOpen isNfcOpen(): boolean @@ -150,12 +195,28 @@ if (!controller.isNfcOpen()) { console.log("controller openNfc ret: " + ret); } +// from api9, use 'enableNfc' to open nfc. +try { + controller.enableNfc(); + console.log("controller enableNfc success"); +} catch (busiError) { + console.log("controller enableNfc busiError: " + busiError); +} + // close nfc, require permission: ohos.permission.MANAGE_SECURE_SETTINGS if (controller.isNfcOpen()) { var ret = controller.closeNfc(); console.log("controller closeNfc ret: " + ret); } +// from api9, use 'disableNfc' to close nfc. +try { + controller.disableNfc(); + console.log("controller disableNfc success"); +} catch (busiError) { + console.log("controller disableNfc busiError: " + busiError); +} + // unregister callback controller.off("nfcStateChange"); ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-nfcTag.md b/zh-cn/application-dev/reference/apis/js-apis-nfcTag.md index 3c1f33040ca9c792e42256b083dbecaa9ec4ee44..d7ebd70b23d8889b5d04fda6832cda2f340f55da 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-nfcTag.md +++ b/zh-cn/application-dev/reference/apis/js-apis-nfcTag.md @@ -126,64 +126,204 @@ getNfcATag(tagInfo: [TagInfo](#taginfo)): [NfcATag](js-apis-nfctech.md#nfcatag) 获取NFC A类型Tag对象,通过该对象可访问NfcA技术类型的Tag。 -**需要权限:** ohos.permission.NFC_TAG +> **说明:** +> 从 API version 7 开始支持,从 API version 9 开始废弃,建议使用[tag.getNfcA](#taggetnfca9)替代。 + +**系统能力:** SystemCapability.Communication.NFC.Tag + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | ------------------------- | ---- | ---------------------------------------- | +| taginfo | [TagInfo](#taginfo) | 是 | 包含Tag技术类型和相关参数,从tag.getTagInfo(want: Want)获取。 + +**返回值:** + +| **类型** | **说明** | +| -------- | -------- | +| [NfcATag](js-apis-nfctech.md#nfcatag) | NFC A类型Tag对象。 | + +## tag.getNfcA9+ + +getNfcA(tagInfo: [TagInfo](#taginfo)): [NfcATag](js-apis-nfctech.md#nfcatag) + +获取NFC A类型Tag对象,通过该对象可访问NfcA技术类型的Tag。 **系统能力:** SystemCapability.Communication.NFC.Tag +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | ------------------------- | ---- | ---------------------------------------- | +| taginfo | [TagInfo](#taginfo) | 是 | 包含Tag技术类型和相关参数,从tag.getTagInfo(want: Want)获取。 + **返回值:** | **类型** | **说明** | | -------- | -------- | | [NfcATag](js-apis-nfctech.md#nfcatag) | NFC A类型Tag对象。 | +**错误码:** + +以下错误码的详细介绍请参见[NFC错误码](../errorcodes/errorcode-nfc.md)。 + +| 错误码ID | 错误信息| +| ------- | -------| +| 3100201 | Tag running state is abnormal in service. | + ## tag.getNfcBTag getNfcBTag(tagInfo: [TagInfo](#taginfo)): [NfcBTag](js-apis-nfctech.md#nfcbtag) 获取NFC B类型Tag对象,通过该对象可访问NfcB技术类型的Tag。 -**需要权限:** ohos.permission.NFC_TAG +> **说明:** +> 从 API version 7 开始支持,从 API version 9 开始废弃,建议使用[tag.getNfcB](#taggetnfcb9)替代。 + +**系统能力:** SystemCapability.Communication.NFC.Tag + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | ------------------------- | ---- | ---------------------------------------- | +| taginfo | [TagInfo](#taginfo) | 是 | 包含Tag技术类型和相关参数,从tag.getTagInfo(want: Want)获取。 + +**返回值:** + +| **类型** | **说明** | +| -------- | ---------------- | +| [NfcBTag](js-apis-nfctech.md#nfcbtag) | NFC B类型Tag对象。 | + +## tag.getNfcB9+ + +getNfcB(tagInfo: [TagInfo](#taginfo)): [NfcBTag](js-apis-nfctech.md#nfcbtag) + +获取NFC B类型Tag对象,通过该对象可访问NfcB技术类型的Tag。 **系统能力:** SystemCapability.Communication.NFC.Tag +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | ------------------------- | ---- | ---------------------------------------- | +| taginfo | [TagInfo](#taginfo) | 是 | 包含Tag技术类型和相关参数,从tag.getTagInfo(want: Want)获取。 + **返回值:** | **类型** | **说明** | | -------- | ---------------- | | [NfcBTag](js-apis-nfctech.md#nfcbtag) | NFC B类型Tag对象。 | +**错误码:** + +以下错误码的详细介绍请参见[NFC错误码](../errorcodes/errorcode-nfc.md)。 + +| 错误码ID | 错误信息| +| ------- | -------| +| 3100201 | Tag running state is abnormal in service. | + ## tag.getNfcFTag getNfcFTag(tagInfo: [TagInfo](#taginfo)): [NfcFTag](js-apis-nfctech.md#nfcftag) 获取NFC F类型Tag对象,通过该对象可访问NfcF技术类型的Tag。 -**需要权限:** ohos.permission.NFC_TAG +> **说明:** +> 从 API version 7 开始支持,从 API version 9 开始废弃,建议使用[tag.getNfcF](#taggetnfcf9)替代。 + +**系统能力:** SystemCapability.Communication.NFC.Tag + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | ------------------------- | ---- | ---------------------------------------- | +| taginfo | [TagInfo](#taginfo) | 是 | 包含Tag技术类型和相关参数,从tag.getTagInfo(want: Want)获取。 + +**返回值:** + +| **类型** | **说明** | +| -------- | ---------------- | +| [NfcFTag](js-apis-nfctech.md#nfcftag) | NFC F类型Tag对象。 | + +## tag.getNfcF9+ + +getNfcF(tagInfo: [TagInfo](#taginfo)): [NfcFTag](js-apis-nfctech.md#nfcftag) + +获取NFC F类型Tag对象,通过该对象可访问NfcF技术类型的Tag。 **系统能力:** SystemCapability.Communication.NFC.Tag +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | ------------------------- | ---- | ---------------------------------------- | +| taginfo | [TagInfo](#taginfo) | 是 | 包含Tag技术类型和相关参数,从tag.getTagInfo(want: Want)获取。 + **返回值:** | **类型** | **说明** | | -------- | ---------------- | | [NfcFTag](js-apis-nfctech.md#nfcftag) | NFC F类型Tag对象。 | +**错误码:** + +以下错误码的详细介绍请参见[NFC错误码](../errorcodes/errorcode-nfc.md)。 + +| 错误码ID | 错误信息| +| ------- | -------| +| 3100201 | Tag running state is abnormal in service. | + ## tag.getNfcVTag getNfcVTag(tagInfo: [TagInfo](#taginfo)): [NfcVTag](js-apis-nfctech.md#nfcvtag) 获取NFC V类型Tag对象,通过该对象可访问NfcV技术类型的Tag。 -**需要权限:** ohos.permission.NFC_TAG +> **说明:** +> 从 API version 7 开始支持,从 API version 9 开始废弃,建议使用[tag.getNfcV](#taggetnfcv9)替代。 + +**系统能力:** SystemCapability.Communication.NFC.Tag + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | ------------------------- | ---- | ---------------------------------------- | +| taginfo | [TagInfo](#taginfo) | 是 | 包含Tag技术类型和相关参数,从tag.getTagInfo(want: Want)获取。 + +**返回值:** + +| **类型** | **说明** | +| -------- | ---------------- | +| [NfcVTag](js-apis-nfctech.md#nfcvtag) | NFC V类型Tag对象。 | + +## tag.getNfcV9+ + +getNfcV(tagInfo: [TagInfo](#taginfo)): [NfcVTag](js-apis-nfctech.md#nfcvtag) + +获取NFC V类型Tag对象,通过该对象可访问NfcV技术类型的Tag。 **系统能力:** SystemCapability.Communication.NFC.Tag +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | ------------------------- | ---- | ---------------------------------------- | +| taginfo | [TagInfo](#taginfo) | 是 | 包含Tag技术类型和相关参数,从tag.getTagInfo(want: Want)获取。 + **返回值:** | **类型** | **说明** | | -------- | ---------------- | | [NfcVTag](js-apis-nfctech.md#nfcvtag) | NFC V类型Tag对象。 | +**错误码:** + +以下错误码的详细介绍请参见[NFC错误码](../errorcodes/errorcode-nfc.md)。 + +| 错误码ID | 错误信息| +| ------- | -------| +| 3100201 | Tag running state is abnormal in service. | + ## tag.getIsoDep9+ getIsoDep(tagInfo: [TagInfo](#taginfo)): [IsoDepTag](js-apis-nfctech.md#isoDepTag9 ) diff --git a/zh-cn/application-dev/reference/apis/js-apis-nfctech.md b/zh-cn/application-dev/reference/apis/js-apis-nfctech.md index fc5241358c6f5e76f43833d7aef8b059b663fe58..122d4992bf1b5b2e2c5ac7d431ad970d345443d2 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-nfctech.md +++ b/zh-cn/application-dev/reference/apis/js-apis-nfctech.md @@ -26,8 +26,6 @@ getSak(): number 获取NFC-A标签的SAK值。 -**需要权限:** ohos.permission.NFC_TAG - **系统能力:** SystemCapability.Communication.NFC.Tag **返回值:** @@ -52,8 +50,6 @@ getAtqa(): number[] 获取NFC-A标签的Atqa值。 -**需要权限:** ohos.permission.NFC_TAG - **系统能力:** SystemCapability.Communication.NFC.Tag **返回值:** @@ -86,8 +82,6 @@ getRespAppData(): number[] 获取标签的应用程序数据。 -**需要权限:** ohos.permission.NFC_TAG - **系统能力:** SystemCapability.Communication.NFC.Tag **返回值:** @@ -112,8 +106,6 @@ getRespProtocol(): number[] 获取标签的协议信息。 -**需要权限:** ohos.permission.NFC_TAG - **系统能力:** SystemCapability.Communication.NFC.Tag **返回值:** @@ -146,8 +138,6 @@ getSystemCode(): number[] 从标签实例获取系统代码。 -**需要权限:** ohos.permission.NFC_TAG - **系统能力:** SystemCapability.Communication.NFC.Tag **返回值:** @@ -172,8 +162,6 @@ getPmm(): number[] 从标签实例获取PMm(由IC代码和制造商参数组成)。 -**需要权限:** ohos.permission.NFC_TAG - **系统能力:** SystemCapability.Communication.NFC.Tag **返回值:** @@ -206,8 +194,6 @@ getResponseFlags(): number 从标签实例实例获取响应标志。 -**需要权限:** ohos.permission.NFC_TAG - **系统能力:** SystemCapability.Communication.NFC.Tag **返回值:** @@ -232,8 +218,6 @@ getDsfId(): number 从标签实例实例获取数据存储格式标识符(DSFID)。 -**需要权限:** ohos.permission.NFC_TAG - **系统能力:** SystemCapability.Communication.NFC.Tag **返回值:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-notification.md b/zh-cn/application-dev/reference/apis/js-apis-notification.md index 1b38b96ba429c8f7ddd02856c5b49231a5fd7428..57caa47b96bafb866f96a4a00a5571fd713d0c50 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-notification.md +++ b/zh-cn/application-dev/reference/apis/js-apis-notification.md @@ -893,8 +893,8 @@ function unsubscribeCallback(err) { console.info("unsubscribe success"); } } -function onDisconnectCallback(data) { - console.info("Cancel callback: " + JSON.stringify(data)); +function onDisconnectCallback() { + console.info("subscribe disconnect"); } let subscriber = { onDisconnect: onDisconnectCallback @@ -925,8 +925,8 @@ unsubscribe(subscriber: NotificationSubscriber): Promise\ **示例:** ```js -function onDisconnectCallback(data) { - console.info("Cancel callback: " + JSON.stringify(data)); +function onDisconnectCallback() { + console.info("subscribe disconnect"); } let subscriber = { onDisconnect: onDisconnectCallback diff --git a/zh-cn/application-dev/reference/apis/js-apis-notificationManager.md b/zh-cn/application-dev/reference/apis/js-apis-notificationManager.md index 082c541329f95275d81f93e69c4db19cced495da..03ca809219a46937302f1e8992d0474396499b7c 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-notificationManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-notificationManager.md @@ -24,7 +24,7 @@ publish(request: NotificationRequest, callback: AsyncCallback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------- | ---- | ------------------------------------------- | -| request | [NotificationRequest](#notificationrequest) | 是 | 用于设置要发布通知的内容和相关配置信息。 | +| request | [NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest) | 是 | 用于设置要发布通知的内容和相关配置信息。 | | callback | AsyncCallback\ | 是 | 发布通知的回调方法。 | **错误码:** @@ -80,7 +80,7 @@ publish(request: NotificationRequest): Promise\ | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------- | ---- | ------------------------------------------- | -| request | [NotificationRequest](#notificationrequest) | 是 | 用于设置要发布通知的内容和相关配置信息。 | +| request | [NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest) | 是 | 用于设置要发布通知的内容和相关配置信息。 | **错误码:** @@ -132,7 +132,7 @@ publish(request: NotificationRequest, userId: number, callback: AsyncCallback\ | 是 | 被指定的回调方法。 | @@ -194,7 +194,7 @@ publish(request: NotificationRequest, userId: number): Promise\ | 参数名 | 类型 | 必填 | 说明 | | -------- | ----------------------------------------- | ---- | ------------------------------------------- | -| request | [NotificationRequest](#notificationrequest) | 是 | 用于设置要发布通知的内容和相关配置信息。 | +| request | [NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest) | 是 | 用于设置要发布通知的内容和相关配置信息。 | | userId | number | 是 | 用户ID。 | **错误码:** @@ -439,7 +439,7 @@ addSlot(slot: NotificationSlot, callback: AsyncCallback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------- | ---- | -------------------- | -| slot | [NotificationSlot](#notificationslot) | 是 | 要创建的通知通道对象。 | +| slot | [NotificationSlot](js-apis-inner-notification-notificationSlot.md) | 是 | 要创建的通知通道对象。 | | callback | AsyncCallback\ | 是 | 表示被指定的回调方法。 | **错误码:** @@ -488,7 +488,7 @@ addSlot(slot: NotificationSlot): Promise\ | 参数名 | 类型 | 必填 | 说明 | | ---- | ---------------- | ---- | -------------------- | -| slot | [NotificationSlot](#notificationslot) | 是 | 要创建的通知通道对象。 | +| slot | [NotificationSlot](js-apis-inner-notification-notificationSlot.md) | 是 | 要创建的通知通道对象。 | **错误码:** @@ -605,7 +605,7 @@ addSlots(slots: Array\, callback: AsyncCallback\): voi | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------- | ---- | ------------------------ | -| slots | Array\<[NotificationSlot](#notificationslot)\> | 是 | 要创建的通知通道对象数组。 | +| slots | Array\<[NotificationSlot](js-apis-inner-notification-notificationSlot.md)\> | 是 | 要创建的通知通道对象数组。 | | callback | AsyncCallback\ | 是 | 表示被指定的回调方法。 | **错误码:** @@ -658,7 +658,7 @@ addSlots(slots: Array\): Promise\ | 参数名 | 类型 | 必填 | 说明 | | ----- | ------------------------- | ---- | ------------------------ | -| slots | Array\<[NotificationSlot](#notificationslot)\> | 是 | 要创建的通知通道对象数组。 | +| slots | Array\<[NotificationSlot](js-apis-inner-notification-notificationSlot.md)\> | 是 | 要创建的通知通道对象数组。 | **错误码:** @@ -701,7 +701,7 @@ getSlot(slotType: SlotType, callback: AsyncCallback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------------------- | ---- | ----------------------------------------------------------- | | slotType | [SlotType](#slottype) | 是 | 通知渠道类型,目前分为社交通信、服务提醒、内容咨询和其他类型。 | -| callback | AsyncCallback\<[NotificationSlot](#notificationslot)\> | 是 | 表示被指定的回调方法。 | +| callback | AsyncCallback\<[NotificationSlot](js-apis-inner-notification-notificationSlot.md)\> | 是 | 表示被指定的回调方法。 | **错误码:** @@ -783,7 +783,7 @@ getSlots(callback: AsyncCallback>): void | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------------------- | ---- | -------------------- | -| callback | AsyncCallback\\> | 是 | 以callback形式返回获取此应用程序的所有通知通道的结果。 | +| callback | AsyncCallback\\> | 是 | 以callback形式返回获取此应用程序的所有通知通道的结果。 | **错误码:** @@ -823,7 +823,7 @@ getSlots(): Promise\> | 类型 | 说明 | | ----------------------------------------------------------- | ------------------------------------------------------------ | -| Promise\\> | 以Promise形式返回获取此应用程序的所有通知通道的结果。 | +| Promise\\> | 以Promise形式返回获取此应用程序的所有通知通道的结果。 | **错误码:** @@ -1005,7 +1005,7 @@ setNotificationEnable(bundle: BundleOption, enable: boolean, callback: AsyncCall | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------- | ---- | -------------------- | -| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 指定应用的包信息。 | | enable | boolean | 是 | 使能状态。 | | callback | AsyncCallback\ | 是 | 设定通知使能回调函数。 | @@ -1054,7 +1054,7 @@ setNotificationEnable(bundle: BundleOption, enable: boolean): Promise\ | 参数名 | 类型 | 必填 | 说明 | | ------ | ------------ | ---- | ---------- | -| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 指定应用的包信息。 | | enable | boolean | 是 | 使能状态。 | **错误码:** @@ -1097,7 +1097,7 @@ isNotificationEnabled(bundle: BundleOption, callback: AsyncCallback\): | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------- | ---- | ------------------------ | -| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 指定应用的包信息。 | | callback | AsyncCallback\ | 是 | 获取通知使能状态回调函数。 | **错误码:** @@ -1145,7 +1145,7 @@ isNotificationEnabled(bundle: BundleOption): Promise\ | 参数名 | 类型 | 必填 | 说明 | | ------ | ------------ | ---- | ---------- | -| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 指定应用的包信息。 | **返回值:** @@ -1237,7 +1237,7 @@ isNotificationEnabled(): Promise\ | 参数名 | 类型 | 必填 | 说明 | | ------ | ------------ | ---- | ---------- | -| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 指定应用的包信息。 | **返回值:** @@ -1282,7 +1282,7 @@ displayBadge(bundle: BundleOption, enable: boolean, callback: AsyncCallback\ | 是 | 设定角标使能回调函数。 | @@ -1331,7 +1331,7 @@ displayBadge(bundle: BundleOption, enable: boolean): Promise\ | 参数名 | 类型 | 必填 | 说明 | | ------ | ------------ | ---- | ---------- | -| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 指定应用的包信息。 | | enable | boolean | 是 | 使能状态。 | **错误码:** @@ -1374,7 +1374,7 @@ isBadgeDisplayed(bundle: BundleOption, callback: AsyncCallback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------- | ---- | ------------------------ | -| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 指定应用的包信息。 | | callback | AsyncCallback\ | 是 | 获取角标使能状态回调函数。 | **错误码:** @@ -1422,7 +1422,7 @@ isBadgeDisplayed(bundle: BundleOption): Promise\ | 参数名 | 类型 | 必填 | 说明 | | ------ | ------------ | ---- | ---------- | -| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 指定应用的包信息。 | **返回值:** @@ -1470,8 +1470,8 @@ setSlotByBundle(bundle: BundleOption, slot: NotificationSlot, callback: AsyncCal | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------- | ---- | -------------------- | -| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 | -| slot | [NotificationSlot](#notificationslot) | 是 | 通知通道。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 指定应用的包信息。 | +| slot | [NotificationSlot](js-apis-inner-notification-notificationSlot.md) | 是 | 通知通道。 | | callback | AsyncCallback\ | 是 | 设定通知通道回调函数。 | **错误码:** @@ -1524,8 +1524,8 @@ setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise\ | 参数名 | 类型 | 必填 | 说明 | | ------ | ------------ | ---- | ---------- | -| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 | -| slot | [NotificationSlot](#notificationslot) | 是 | 通知通道。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 指定应用的包信息。 | +| slot | [NotificationSlot](js-apis-inner-notification-notificationSlot.md) | 是 | 通知通道。 | **错误码:** @@ -1570,8 +1570,8 @@ getSlotsByBundle(bundle: BundleOption, callback: AsyncCallback> | 是 | 获取通知通道回调函数。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 指定应用的包信息。 | +| callback | AsyncCallback> | 是 | 获取通知通道回调函数。 | **错误码:** @@ -1618,13 +1618,13 @@ getSlotsByBundle(bundle: BundleOption): Promise> | 参数名 | 类型 | 必填 | 说明 | | ------ | ------------ | ---- | ---------- | -| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 指定应用的包信息。 | **返回值:** | 类型 | 说明 | | ----------------------------------------------------------- | ------------------------------------------------------------ | -| Promise> | 以Promise形式返回获取指定应用的通知通道。 | +| Promise> | 以Promise形式返回获取指定应用的通知通道。 | **错误码:** @@ -1666,7 +1666,7 @@ getSlotNumByBundle(bundle: BundleOption, callback: AsyncCallback\): voi | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------- | ---- | ---------------------- | -| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 指定应用的包信息。 | | callback | AsyncCallback\ | 是 | 获取通知通道数量回调函数。 | **错误码:** @@ -1714,7 +1714,7 @@ getSlotNumByBundle(bundle: BundleOption): Promise\ | 参数名 | 类型 | 必填 | 说明 | | ------ | ------------ | ---- | ---------- | -| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 指定应用的包信息。 | **返回值:** @@ -1763,7 +1763,7 @@ getAllActiveNotifications(callback: AsyncCallback>) | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------------------------ | ---- | -------------------- | -| callback | AsyncCallback> | 是 | 获取活动通知回调函数。 | +| callback | AsyncCallback> | 是 | 获取活动通知回调函数。 | **错误码:** @@ -1793,7 +1793,7 @@ Notification.getAllActiveNotifications(getAllActiveNotificationsCallback); ## Notification.getAllActiveNotifications -getAllActiveNotifications(): Promise\\> +getAllActiveNotifications(): Promise\\> 获取当前未删除的所有通知(Promise形式)。 @@ -1807,7 +1807,7 @@ getAllActiveNotifications(): Promise\\> | 以Promise形式返回获取活动通知。 | +| Promise\\> | 以Promise形式返回获取活动通知。 | **错误码:** @@ -1915,7 +1915,7 @@ getActiveNotifications(callback: AsyncCallback>): v | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------------------------ | ---- | ------------------------------ | -| callback | AsyncCallback> | 是 | 获取当前应用通知列表回调函数。 | +| callback | AsyncCallback> | 是 | 获取当前应用通知列表回调函数。 | **错误码:** @@ -1945,7 +1945,7 @@ Notification.getActiveNotifications(getActiveNotificationsCallback); ## Notification.getActiveNotifications -getActiveNotifications(): Promise\\> +getActiveNotifications(): Promise\\> 获取当前应用未删除的通知列表(Promise形式)。 @@ -1955,7 +1955,7 @@ getActiveNotifications(): Promise\\> | 以Promise形式返回获取当前应用通知列表。 | +| Promise\\> | 以Promise形式返回获取当前应用通知列表。 | **错误码:** @@ -1989,7 +1989,7 @@ cancelGroup(groupName: string, callback: AsyncCallback\): void | 参数名 | 类型 | 必填 | 说明 | | --------- | --------------------- | ---- | ---------------------------- | -| groupName | string | 是 | 通知组名称,此名称需要在发布通知时通过[NotificationRequest](#notificationrequest)对象指定。 | +| groupName | string | 是 | 通知组名称,此名称需要在发布通知时通过[NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest)对象指定。 | | callback | AsyncCallback\ | 是 | 取消本应用指定组下通知的回调函数。 | **错误码:** @@ -2071,7 +2071,7 @@ removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCall | 参数名 | 类型 | 必填 | 说明 | | --------- | --------------------- | ---- | ---------------------------- | -| bundle | [BundleOption](#bundleoption) | 是 | 应用的包信息。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 应用的包信息。 | | groupName | string | 是 | 通知组名称。 | | callback | AsyncCallback\ | 是 | 删除指定应用指定组下通知的回调函数。 | @@ -2121,7 +2121,7 @@ removeGroupByBundle(bundle: BundleOption, groupName: string): Promise\ | 参数名 | 类型 | 必填 | 说明 | | --------- | ------------ | ---- | -------------- | -| bundle | [BundleOption](#bundleoption) | 是 | 应用的包信息。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 应用的包信息。 | | groupName | string | 是 | 通知组名称。 | **错误码:** @@ -2786,7 +2786,7 @@ setDistributedEnable(enable: boolean, callback: AsyncCallback\): void **示例:** ```javascript -function setDistributedEnableCallback() { +function setDistributedEnableCallback(err) { if (err) { console.info("setDistributedEnable failed " + JSON.stringify(err)); } else { @@ -2933,7 +2933,7 @@ setDistributedEnableByBundle(bundle: BundleOption, enable: boolean, callback: As | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------ | ---- | -------------------------- | -| bundle | [BundleOption](#bundleoption) | 是 | 应用的包信息。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 应用的包信息。 | | enable | boolean | 是 | 是否支持。 | | callback | AsyncCallback\ | 是 | 应用程序是否支持分布式通知的回调函数。 | @@ -2987,7 +2987,7 @@ setDistributedEnableByBundle(bundle: BundleOption, enable: boolean): Promise\ | 是 | 查询指定应用是否支持分布式通知的回调函数。 | **错误码:** @@ -3050,7 +3050,7 @@ isDistributedEnabledByBundle(bundle: BundleOption, callback: AsyncCallback\ | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------ | ---- | -------------------------- | -| bundle | [BundleOption](#bundleoption) | 是 | 应用的包。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 应用的包。 | **返回值:** @@ -3213,7 +3213,7 @@ publishAsBundle(request: NotificationRequest, representativeBundle: string, user | 参数名 | 类型 | 必填 | 说明 | | -------------------- | ------------------------------------------- | ---- | ---------------------------------------- | -| request | [NotificationRequest](#notificationrequest) | 是 | 用于设置要发布通知的内容和相关配置信息。 | +| request | [NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest) | 是 | 用于设置要发布通知的内容和相关配置信息。 | | representativeBundle | string | 是 | 被代理应用的包名。 | | userId | number | 是 | 用户ID。 | | callback | AsyncCallback | 是 | 发布代理通知的回调方法。 | @@ -3280,7 +3280,7 @@ publishAsBundle(request: NotificationRequest, representativeBundle: string, user | 参数名 | 类型 | 必填 | 说明 | | -------------------- | ------------------------------------------- | ---- | --------------------------------------------- | -| request | [NotificationRequest](#notificationrequest) | 是 | 用于设置要发布通知的内容和相关配置信息。 | +| request | [NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest) | 是 | 用于设置要发布通知的内容和相关配置信息。 | | representativeBundle | string | 是 | 被代理应用的包名。 | | userId | number | 是 | 用户ID。 | @@ -3440,7 +3440,7 @@ setNotificationEnableSlot(bundle: BundleOption, type: SlotType, enable: boolean, | 参数名 | 类型 | 必填 | 说明 | | -------- | ----------------------------- | ---- | ---------------------- | -| bundle | [BundleOption](#bundleoption) | 是 | 应用的包信息。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 应用的包信息。 | | type | [SlotType](#slottype) | 是 | 指定渠道类型。 | | enable | boolean | 是 | 使能状态。 | | callback | AsyncCallback\ | 是 | 设置渠道使能回调函数。 | @@ -3491,7 +3491,7 @@ setNotificationEnableSlot(bundle: BundleOption, type: SlotType, enable: boolean) | 参数名 | 类型 | 必填 | 说明 | | ------ | ----------------------------- | ---- | -------------- | -| bundle | [BundleOption](#bundleoption) | 是 | 应用的包信息。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 应用的包信息。 | | type | [SlotType](#slottype) | 是 | 渠道类型。 | | enable | boolean | 是 | 使能状态。 | @@ -3534,7 +3534,7 @@ isNotificationSlotEnabled(bundle: BundleOption, type: SlotType, callback: AsyncC | 参数名 | 类型 | 必填 | 说明 | | -------- | ----------------------------- | ---- | ---------------------- | -| bundle | [BundleOption](#bundleoption) | 是 | 应用的包信息。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 应用的包信息。 | | type | [SlotType](#slottype) | 是 | 渠道类型。 | | callback | AsyncCallback\ | 是 | 获取渠道使能状态回调函数。 | @@ -3583,7 +3583,7 @@ isNotificationSlotEnabled(bundle: BundleOption, type: SlotType): Promise\ { | LEVEL_HIGH | 4 | 表示通知功能已启用,状态栏中显示通知图标,有横幅和提示音。 | -## BundleOption - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| ------ | ------ |---- | --- | ------ | -| bundle | string | 是 | 是 | 应用的包信息。 | -| uid | number | 是 | 是 | 用户ID。 | - - ## SlotType **系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification @@ -3888,227 +3878,6 @@ Notification.getSyncNotificationEnabledWithoutApp(userId).then((data) => { | OTHER_TYPES | 0xFFFF | 其他类型。 | -## NotificationActionButton - -描述通知中显示的操作按钮。 - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| --------- | ----------------------------------------------- | --- | ---- | ------------------------- | -| title | string | 是 | 是 | 按钮标题。 | -| wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | 是 | 是 | 点击按钮时触发的WantAgent。 | -| extras | { [key: string]: any } | 是 | 是 | 按钮扩展信息。 | -| userInput | [NotificationUserInput](#notificationuserinput) | 是 | 是 | 用户输入对象实例。 | - - -## NotificationBasicContent - -描述普通文本通知。 - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| -------------- | ------ | ---- | ---- | ---------------------------------- | -| title | string | 是 | 是 | 通知标题。 | -| text | string | 是 | 是 | 通知内容。 | -| additionalText | string | 是 | 是 | 通知附加内容,是对通知内容的补充。 | - - -## NotificationLongTextContent - -描述长文本通知。 - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| -------------- | ------ | ---- | --- | -------------------------------- | -| title | string | 是 | 是 | 通知标题。 | -| text | string | 是 | 是 | 通知内容。 | -| additionalText | string | 是 | 是 | 通知附加内容,是对通知内容的补充。 | -| longText | string | 是 | 是 | 通知的长文本。 | -| briefText | string | 是 | 是 | 通知概要内容,是对通知内容的总结。 | -| expandedTitle | string | 是 | 是 | 通知展开时的标题。 | - - -## NotificationMultiLineContent - -描述多行文本通知。 - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| -------------- | --------------- | --- | --- | -------------------------------- | -| title | string | 是 | 是 | 通知标题。 | -| text | string | 是 | 是 | 通知内容。 | -| additionalText | string | 是 | 是 | 通知附加内容,是对通知内容的补充。 | -| briefText | string | 是 | 是 | 通知概要内容,是对通知内容的总结。 | -| longTitle | string | 是 | 是 | 通知展开时的标题。 | -| lines | Array\ | 是 | 是 | 通知的多行文本。 | - - -## NotificationPictureContent - -描述附有图片的通知。 - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| -------------- | -------------- | ---- | --- | -------------------------------- | -| title | string | 是 | 是 | 通知标题。 | -| text | string | 是 | 是 | 通知内容。 | -| additionalText | string | 是 | 是 | 通知附加内容,是对通知内容的补充。 | -| briefText | string | 是 | 是 | 通知概要内容,是对通知内容的总结。 | -| expandedTitle | string | 是 | 是 | 通知展开时的标题。 | -| picture | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 | 是 | 通知的图片内容。 | - - -## NotificationContent - -描述通知类型。 - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| ----------- | ------------------------------------------------------------ | ---- | --- | ------------------ | -| contentType | [ContentType](#contenttype) | 是 | 是 | 通知内容类型。 | -| normal | [NotificationBasicContent](#notificationbasiccontent) | 是 | 是 | 基本类型通知内容。 | -| longText | [NotificationLongTextContent](#notificationlongtextcontent) | 是 | 是 | 长文本类型通知内容。 | -| multiLine | [NotificationMultiLineContent](#notificationmultilinecontent) | 是 | 是 | 多行类型通知内容。 | -| picture | [NotificationPictureContent](#notificationpicturecontent) | 是 | 是 | 图片类型通知内容。 | - - -## NotificationFlagStatus - -描述通知标志状态。 - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification - -**系统接口**:此接口为系统接口,三方应用不支持调用。 - -| 名称 | 值 | 说明 | -| -------------- | --- | --------------------------------- | -| TYPE_NONE | 0 | 默认标志。 | -| TYPE_OPEN | 1 | 通知标志打开。 | -| TYPE_CLOSE | 2 | 通知标志关闭。 | - - -## NotificationFlags - -描述通知标志的实例。 - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| ---------------- | ---------------------- | ---- | ---- | --------------------------------- | -| soundEnabled | [NotificationFlagStatus](#notificationflagstatus) | 是 | 否 | 是否启用声音提示。 | -| vibrationEnabled | [NotificationFlagStatus](#notificationflagstatus) | 是 | 否 | 是否启用振动提醒功能。 | - - -## NotificationRequest - -描述通知的请求。 - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| --------------------- | --------------------------------------------- | ---- | --- | -------------------------- | -| content | [NotificationContent](#notificationcontent) | 是 | 是 | 通知内容。 | -| id | number | 是 | 是 | 通知ID。 | -| slotType | [SlotType](#slottype) | 是 | 是 | 通道类型。 | -| isOngoing | boolean | 是 | 是 | 是否进行时通知。 | -| isUnremovable | boolean | 是 | 是 | 是否可移除。 | -| deliveryTime | number | 是 | 是 | 通知发送时间。 | -| tapDismissed | boolean | 是 | 是 | 通知是否自动清除。 | -| autoDeletedTime | number | 是 | 是 | 自动清除的时间。 | -| wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | 是 | 是 | WantAgent封装了应用的行为意图,点击通知时触发该行为。 | -| extraInfo | {[key: string]: any} | 是 | 是 | 扩展参数。 | -| color | number | 是 | 是 | 通知背景颜色。预留能力,暂未支持。 | -| colorEnabled | boolean | 是 | 是 | 通知背景颜色是否使能。预留能力,暂未支持。 | -| isAlertOnce | boolean | 是 | 是 | 设置是否仅有一次此通知提醒。 | -| isStopwatch | boolean | 是 | 是 | 是否显示已用时间。 | -| isCountDown | boolean | 是 | 是 | 是否显示倒计时时间。 | -| isFloatingIcon | boolean | 是 | 是 | 是否显示状态栏图标。 | -| label | string | 是 | 是 | 通知标签。 | -| badgeIconStyle | number | 是 | 是 | 通知角标类型。 | -| showDeliveryTime | boolean | 是 | 是 | 是否显示分发时间。 | -| actionButtons | Array\<[NotificationActionButton](#notificationactionbutton)\> | 是 | 是 | 通知按钮,最多三个按钮。 | -| smallIcon | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 | 是 | 通知小图标。可选字段,大小不超过30KB。 | -| largeIcon | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 | 是 | 通知大图标。可选字段,大小不超过30KB。 | -| creatorBundleName | string | 是 | 否 | 创建通知的包名。 | -| creatorUid | number | 是 | 否 | 创建通知的UID。 | -| creatorPid | number | 是 | 否 | 创建通知的PID。 | -| creatorUserId| number | 是 | 否 | 创建通知的UserId。 | -| hashCode | string | 是 | 否 | 通知唯一标识。 | -| classification | string | 是 | 是 | 通知分类。
**系统API**: 此接口为系统接口,三方应用不支持调用。 | -| groupName| string | 是 | 是 | 组通知名称。 | -| template | [NotificationTemplate](#notificationtemplate) | 是 | 是 | 通知模板。 | -| isRemoveAllowed | boolean | 是 | 否 | 通知是否能被移除。
**系统API**: 此接口为系统接口,三方应用不支持调用。 | -| source | number | 是 | 否 | 通知源。
**系统API**: 此接口为系统接口,三方应用不支持调用。 | -| distributedOption | [DistributedOptions](#distributedoptions) | 是 | 是 | 分布式通知的选项。 | -| deviceId | string | 是 | 否 | 通知源的deviceId。
**系统API**: 此接口为系统接口,三方应用不支持调用。 | -| notificationFlags | [NotificationFlags](#notificationflags) | 是 | 否 | 获取NotificationFlags。 | -| removalWantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | 是 | 是 | 当移除通知时,通知将被重定向到的WantAgent实例。 | -| badgeNumber | number | 是 | 是 | 应用程序图标上显示的通知数。 | - - -## DistributedOptions - -描述分布式选项。 - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| ---------------------- | -------------- | ---- | ---- | ---------------------------------- | -| isDistributed | boolean | 是 | 是 | 是否为分布式通知。 | -| supportDisplayDevices | Array\ | 是 | 是 | 可以同步通知到的设备列表。 | -| supportOperateDevices | Array\ | 是 | 是 | 可以打开通知的设备列表。 | -| remindType | number | 是 | 否 | 通知的提醒方式。
**系统API**: 此接口为系统接口,三方应用不支持调用。 | - - -## NotificationSlot - -描述通知槽 - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| -------------------- | --------------------- | ---- | --- | ------------------------------------------ | -| type | [SlotType](#slottype) | 是 | 是 | 通道类型。 | -| level | number | 是 | 是 | 通知级别,不设置则根据通知渠道类型有默认值。 | -| desc | string | 是 | 是 | 通知渠道描述信息。 | -| badgeFlag | boolean | 是 | 是 | 是否显示角标。 | -| bypassDnd | boolean | 是 | 是 | 置是否在系统中绕过免打扰模式。 | -| lockscreenVisibility | number | 是 | 是 | 在锁定屏幕上显示通知的模式。 | -| vibrationEnabled | boolean | 是 | 是 | 是否可振动。 | -| sound | string | 是 | 是 | 通知提示音。 | -| lightEnabled | boolean | 是 | 是 | 是否闪灯。 | -| lightColor | number | 是 | 是 | 通知灯颜色。 | -| vibrationValues | Array\ | 是 | 是 | 通知振动样式。 | -| enabled9+ | boolean | 是 | 否 | 此通知插槽中的启停状态。 | - - -## NotificationTemplate - -通知模板。 - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| ---- | ---------------------- | ---- | ---- | ---------- | -| name | string | 是 | 是 | 模板名称。 | -| data | {[key:string]: Object} | 是 | 是 | 模板数据。 | - - -## NotificationUserInput - -保存用户输入的通知消息。 - -**系统能力**:SystemCapability.Notification.Notification - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| -------- | ------ | --- | ---- | ----------------------------- | -| inputKey | string | 是 | 是 | 用户输入时用于标识此输入的key。 | ## DeviceRemindType diff --git a/zh-cn/application-dev/reference/apis/js-apis-notificationSubscribe.md b/zh-cn/application-dev/reference/apis/js-apis-notificationSubscribe.md index a44e8a95f6245ff1fc3b2eec29f7096935f90600..7dcf55b24147daf24d409057e68b7c59eb32236e 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-notificationSubscribe.md +++ b/zh-cn/application-dev/reference/apis/js-apis-notificationSubscribe.md @@ -9,7 +9,7 @@ ## 导入模块 ```js -import NotificationSubscribe from '@ohos.notificationSubscribe'; +import notificationSubscribe from '@ohos.notificationSubscribe'; ``` @@ -30,8 +30,8 @@ subscribe(subscriber: NotificationSubscriber, info: NotificationSubscribeInfo, c | 参数名 | 类型 | 必填 | 说明 | | ---------- | ------------------------- | ---- | ---------------- | -| subscriber | [NotificationSubscriber](#notificationsubscriber) | 是 | 通知订阅对象。 | -| info | [NotificationSubscribeInfo](#notificationsubscribeinfo) | 是 | 通知订阅信息。 | +| subscriber | [NotificationSubscriber](js-apis-notification.md#notificationsubscriber) | 是 | 通知订阅对象。 | +| info | [NotificationSubscribeInfo](js-apis-notification.md#notificationsubscribeinfo) | 是 | 通知订阅信息。 | | callback | AsyncCallback\ | 是 | 订阅动作回调函数。 | **错误码:** @@ -50,7 +50,7 @@ subscribe(subscriber: NotificationSubscriber, info: NotificationSubscribeInfo, c //subscribe回调 function subscribeCallback(err) { if (err) { - console.info("subscribe failed " + JSON.stringify(err)); + console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`); } else { console.info("subscribe success"); } @@ -64,11 +64,9 @@ let subscriber = { let info = { bundleNames: ["bundleName1","bundleName2"] }; -NotificationSubscribe.subscribe(subscriber, info, subscribeCallback); +notificationSubscribe.subscribe(subscriber, info, subscribeCallback); ``` - - ## NotificationSubscribe.subscribe subscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\): void @@ -85,7 +83,7 @@ subscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\): | 参数名 | 类型 | 必填 | 说明 | | ---------- | ---------------------- | ---- | ---------------- | -| subscriber | [NotificationSubscriber](#notificationsubscriber) | 是 | 通知订阅对象。 | +| subscriber | [NotificationSubscriber](js-apis-notification.md#notificationsubscriber) | 是 | 通知订阅对象。 | | callback | AsyncCallback\ | 是 | 订阅动作回调函数。 | **错误码:** @@ -103,7 +101,7 @@ subscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\): ```js function subscribeCallback(err) { if (err) { - console.info("subscribe failed " + JSON.stringify(err)); + console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`); } else { console.info("subscribe success"); } @@ -114,7 +112,7 @@ function onConsumeCallback(data) { let subscriber = { onConsume: onConsumeCallback }; -NotificationSubscribe.subscribe(subscriber, subscribeCallback); +notificationSubscribe.subscribe(subscriber, subscribeCallback); ``` @@ -135,8 +133,8 @@ subscribe(subscriber: NotificationSubscriber, info?: NotificationSubscribeInfo): | 参数名 | 类型 | 必填 | 说明 | | ---------- | ------------------------- | ---- | ------------ | -| subscriber | [NotificationSubscriber](#notificationsubscriber) | 是 | 通知订阅对象。 | -| info | [NotificationSubscribeInfo](#notificationsubscribeinfo) | 否 | 通知订阅信息。 | +| subscriber | [NotificationSubscriber](js-apis-notification.md#notificationsubscriber) | 是 | 通知订阅对象。 | +| info | [NotificationSubscribeInfo](js-apis-notification.md#notificationsubscribeinfo) | 否 | 通知订阅信息。 | **错误码:** @@ -157,7 +155,7 @@ function onConsumeCallback(data) { let subscriber = { onConsume: onConsumeCallback }; -NotificationSubscribe.subscribe(subscriber).then(() => { +notificationSubscribe.subscribe(subscriber).then(() => { console.info("subscribe success"); }); ``` @@ -180,7 +178,7 @@ unsubscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\) | 参数名 | 类型 | 必填 | 说明 | | ---------- | ---------------------- | ---- | -------------------- | -| subscriber | [NotificationSubscriber](#notificationsubscriber) | 是 | 通知订阅对象。 | +| subscriber | [NotificationSubscriber](js-apis-notification.md#notificationsubscriber) | 是 | 通知订阅对象。 | | callback | AsyncCallback\ | 是 | 取消订阅动作回调函数。 | **错误码:** @@ -198,22 +196,20 @@ unsubscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\) ```js function unsubscribeCallback(err) { if (err) { - console.info("unsubscribe failed " + JSON.stringify(err)); + console.error(`unsubscribe failed, code is ${err.code}, message is ${err.message}`); } else { console.info("unsubscribe success"); } } -function onDisconnectCallback(data) { - console.info("Cancel callback: " + JSON.stringify(data)); +function onDisconnectCallback() { + console.info("subscribe disconnect"); } let subscriber = { onDisconnect: onDisconnectCallback }; -NotificationSubscribe.unsubscribe(subscriber, unsubscribeCallback); +notificationSubscribe.unsubscribe(subscriber, unsubscribeCallback); ``` - - ## NotificationSubscribe.unsubscribe unsubscribe(subscriber: NotificationSubscriber): Promise\ @@ -230,7 +226,7 @@ unsubscribe(subscriber: NotificationSubscriber): Promise\ | 参数名 | 类型 | 必填 | 说明 | | ---------- | ---------------------- | ---- | ------------ | -| subscriber | [NotificationSubscriber](#notificationsubscriber) | 是 | 通知订阅对象。 | +| subscriber | [NotificationSubscriber](js-apis-notification.md#notificationsubscriber) | 是 | 通知订阅对象。 | **错误码:** @@ -245,19 +241,17 @@ unsubscribe(subscriber: NotificationSubscriber): Promise\ **示例:** ```js -function onDisconnectCallback(data) { - console.info("Cancel callback: " + JSON.stringify(data)); +function onDisconnectCallback() { + console.info("subscribe disconnect"); } let subscriber = { onDisconnect: onDisconnectCallback }; -NotificationSubscribe.unsubscribe(subscriber).then(() => { +notificationSubscribe.unsubscribe(subscriber).then(() => { console.info("unsubscribe success"); }); ``` - - ## NotificationSubscribe.remove remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveReason, callback: AsyncCallback\): void @@ -274,8 +268,8 @@ remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveRea | 参数名 | 类型 | 必填 | 说明 | | --------------- | ----------------------------------| ---- | -------------------- | -| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 | -| notificationKey | [NotificationKey](#notificationkey) | 是 | 通知键值。 | +| bundle | [BundleOption](js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 指定应用的包信息。 | +| notificationKey | [NotificationKey](js-apis-notification.md#notificationkey) | 是 | 通知键值。 | | reason | [RemoveReason](#removereason) | 是 | 通知删除原因。 | | callback | AsyncCallback\ | 是 | 删除指定通知回调函数。 | @@ -296,7 +290,7 @@ remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveRea ```js function removeCallback(err) { if (err) { - console.info("remove failed " + JSON.stringify(err)); + console.error(`remove failed, code is ${err.code}, message is ${err.message}`); } else { console.info("remove success"); } @@ -308,8 +302,8 @@ let notificationKey = { id: 0, label: "label", }; -let reason = NotificationSubscribe.RemoveReason.CLICK_REASON_REMOVE; -NotificationSubscribe.remove(bundle, notificationKey, reason, removeCallback); +let reason = notificationSubscribe.RemoveReason.CLICK_REASON_REMOVE; +notificationSubscribe.remove(bundle, notificationKey, reason, removeCallback); ``` @@ -330,8 +324,8 @@ remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveRea | 参数名 | 类型 | 必填 | 说明 | | --------------- | --------------- | ---- | ---------- | -| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 | -| notificationKey | [NotificationKey](#notificationkey) | 是 | 通知键值。 | +| bundle | [BundleOption](js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 指定应用的包信息。 | +| notificationKey | [NotificationKey]((js-apis-notification.md#notificationkey)) | 是 | 通知键值。 | | reason | [RemoveReason](#removereason) | 是 | 通知删除原因。 | **错误码:** @@ -357,13 +351,11 @@ let notificationKey = { label: "label", }; let reason = NotificationSubscribe.RemoveReason.CLICK_REASON_REMOVE; -NotificationSubscribe.remove(bundle, notificationKey, reason).then(() => { +notificationSubscribe.remove(bundle, notificationKey, reason).then(() => { console.info("remove success"); }); ``` - - ## NotificationSubscribe.remove remove(hashCode: string, reason: RemoveReason, callback: AsyncCallback\): void @@ -380,7 +372,7 @@ remove(hashCode: string, reason: RemoveReason, callback: AsyncCallback\): | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------- | ---- | -------------------- | -| hashCode | string | 是 | 通知唯一ID。可以通过[onConsume](#onconsume)回调的入参[SubscribeCallbackData](#subscribecallbackdata)获取其内部[NotificationRequest](#notificationrequest)对象中的hashCode。 | +| hashCode | string | 是 | 通知唯一ID。可以通过[onConsume](#onconsume)回调的入参[SubscribeCallbackData](js-apis-notification.md#subscribecallbackdata)获取其内部[NotificationRequest](#notificationrequest)对象中的hashCode。 | | reason | [RemoveReason](#removereason) | 是 | 通知删除原因。 | | callback | AsyncCallback\ | 是 | 删除指定通知回调函数。 | @@ -402,17 +394,15 @@ let hashCode = 'hashCode'; function removeCallback(err) { if (err) { - console.info("remove failed " + JSON.stringify(err)); + console.error(`remove failed, code is ${err.code}, message is ${err.message}`); } else { console.info("remove success"); } } let reason = NotificationSubscribe.RemoveReason.CANCEL_REASON_REMOVE; -NotificationSubscribe.remove(hashCode, reason, removeCallback); +notificationSubscribe.remove(hashCode, reason, removeCallback); ``` - - ## NotificationSubscribe.remove remove(hashCode: string, reason: RemoveReason): Promise\ @@ -447,14 +437,12 @@ remove(hashCode: string, reason: RemoveReason): Promise\ ```js let hashCode = 'hashCode'; -let reason = NotificationSubscribe.RemoveReason.CLICK_REASON_REMOVE; -NotificationSubscribe.remove(hashCode, reason).then(() => { +let reason = notificationSubscribe.RemoveReason.CLICK_REASON_REMOVE; +notificationSubscribe.remove(hashCode, reason).then(() => { console.info("remove success"); }); ``` - - ## NotificationSubscribe.removeAll removeAll(bundle: BundleOption, callback: AsyncCallback\): void @@ -471,7 +459,7 @@ removeAll(bundle: BundleOption, callback: AsyncCallback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------- | ---- | ---------------------------- | -| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 | +| bundle | [BundleOption]((js-apis-inner-notification-notificationCommonDef.md#bundleoption)) | 是 | 指定应用的包信息。 | | callback | AsyncCallback\ | 是 | 删除指定应用的所有通知回调函数。 | **错误码:** @@ -490,7 +478,7 @@ removeAll(bundle: BundleOption, callback: AsyncCallback\): void ```js function removeAllCallback(err) { if (err) { - console.info("removeAll failed " + JSON.stringify(err)); + console.error(`removeAll failed, code is ${err.code}, message is ${err.message}`); } else { console.info("removeAll success"); } @@ -501,8 +489,6 @@ let bundle = { NotificationSubscribe.removeAll(bundle, removeAllCallback); ``` - - ## NotificationSubscribe.removeAll removeAll(callback: AsyncCallback\): void @@ -536,17 +522,15 @@ removeAll(callback: AsyncCallback\): void ```js function removeAllCallback(err) { if (err) { - console.info("removeAll failed " + JSON.stringify(err)); + console.error(`removeAll failed, code is ${err.code}, message is ${err.message}`); } else { console.info("removeAll success"); } } -NotificationSubscribe.removeAll(removeAllCallback); +notificationSubscribe.removeAll(removeAllCallback); ``` - - ## NotificationSubscribe.removeAll removeAll(bundle?: BundleOption): Promise\ @@ -563,7 +547,7 @@ removeAll(bundle?: BundleOption): Promise\ | 参数名 | 类型 | 必填 | 说明 | | ------ | ------------ | ---- | ---------- | -| bundle | [BundleOption](#bundleoption) | 否 | 指定应用的包信息。 | +| bundle | [BundleOption]((js-apis-inner-notification-notificationCommonDef.md#bundleoption)) | 否 | 指定应用的包信息。 | **错误码:** @@ -580,7 +564,7 @@ removeAll(bundle?: BundleOption): Promise\ ```js // 不指定应用时,删除所有通知 -NotificationSubscribe.removeAll().then(() => { +notificationSubscribe.removeAll().then(() => { console.info("removeAll success"); }); ``` @@ -620,7 +604,7 @@ removeAll(userId: number, callback: AsyncCallback\): void ```js function removeAllCallback(err) { if (err) { - console.info("removeAll failed " + JSON.stringify(err)); + console.error(`removeAll failed, code is ${err.code}, message is ${err.message}`); } else { console.info("removeAll success"); } @@ -628,7 +612,7 @@ function removeAllCallback(err) { let userId = 1; -NotificationSubscribe.removeAll(userId, removeAllCallback); +notificationSubscribe.removeAll(userId, removeAllCallback); ``` ## Notification.removeAll @@ -665,7 +649,7 @@ removeAll(userId: number): Promise\ ```js function removeAllCallback(err) { if (err) { - console.info("removeAll failed " + JSON.stringify(err)); + console.error(`removeAll failed, code is ${err.code}, message is ${err.message}`); } else { console.info("removeAll success"); } @@ -673,11 +657,9 @@ function removeAllCallback(err) { let userId = 1; -NotificationSubscribe.removeAll(userId, removeAllCallback); +notificationSubscribe.removeAll(userId, removeAllCallback); ``` - - ## NotificationSubscriber 作为订阅通知接口[subscribe](#notificationsubscribe)的入参,提供订阅者接收到新通知、取消通知等的回调方法。 @@ -686,7 +668,7 @@ NotificationSubscribe.removeAll(userId, removeAllCallback); ### onConsume -onConsume?: (data: [SubscribeCallbackData](#subscribecallbackdata)) => void +onConsume?: (data: [SubscribeCallbackData](js-apis-notification.md#subscribecallbackdata)) => void 接收到新通知的回调函数。 @@ -698,14 +680,14 @@ onConsume?: (data: [SubscribeCallbackData](#subscribecallbackdata)) => void | 参数名 | 类型 | 必填 | 说明 | | ------------ | ------------------------ | ---- | -------------------------- | -| data | [SubscribeCallbackData](#subscribecallbackdata) | 是 | 新接收到的通知信息。 | +| data | [SubscribeCallbackData](js-apis-notification.md#subscribecallbackdata) | 是 | 新接收到的通知信息。 | **示例:** ```javascript function subscribeCallback(err) { if (err) { - console.info("subscribe failed " + JSON.stringify(err)); + console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`); } else { console.info("subscribeCallback"); } @@ -721,12 +703,12 @@ let subscriber = { onConsume: onConsumeCallback }; -NotificationSubscribe.subscribe(subscriber, subscribeCallback); +notificationSubscribe.subscribe(subscriber, subscribeCallback); ``` ### onCancel -onCancel?:(data: [SubscribeCallbackData](#subscribecallbackdata)) => void +onCancel?:(data: [SubscribeCallbackData](js-apis-notification.md#subscribecallbackdata)) => void 取消通知的回调函数。 @@ -738,14 +720,14 @@ onCancel?:(data: [SubscribeCallbackData](#subscribecallbackdata)) => void | 参数名 | 类型 | 必填 | 说明 | | ------------ | ------------------------ | ---- | -------------------------- | -| data | [SubscribeCallbackData](#subscribecallbackdata) | 是 | 需要取消的通知信息。 | +| data | [SubscribeCallbackData](js-apis-notification.md#subscribecallbackdata) | 是 | 需要取消的通知信息。 | **示例:** ```javascript function subscribeCallback(err) { if (err) { - console.info("subscribe failed " + JSON.stringify(err)); + console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`); } else { console.info("subscribeCallback"); } @@ -761,12 +743,12 @@ let subscriber = { onCancel: onCancelCallback }; -NotificationSubscribe.subscribe(subscriber, subscribeCallback); +notificationSubscribe.subscribe(subscriber, subscribeCallback); ``` ### onUpdate -onUpdate?:(data: [NotificationSortingMap](#notificationsortingmap)) => void +onUpdate?:(data: [NotificationSortingMap](js-apis-notification.md#notificationsortingmap)) => void 更新通知排序的回调函数。 @@ -778,14 +760,14 @@ onUpdate?:(data: [NotificationSortingMap](#notificationsortingmap)) => void | 参数名 | 类型 | 必填 | 说明 | | ------------ | ------------------------ | ---- | -------------------------- | -| data | [NotificationSortingMap](#notificationsortingmap) | 是 | 最新的通知排序列表。 | +| data | [NotificationSortingMap](js-apis-notification.md#notificationsortingmap)) | 是 | 最新的通知排序列表。 | **示例:** ```javascript function subscribeCallback(err) { if (err) { - console.info("subscribe failed " + JSON.stringify(err)); + console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`); } else { console.info("subscribeCallback"); } @@ -799,7 +781,7 @@ let subscriber = { onUpdate: onUpdateCallback }; -NotificationSubscribe.subscribe(subscriber, subscribeCallback); +notificationSubscribe.subscribe(subscriber, subscribeCallback); ``` ### onConnect @@ -817,7 +799,7 @@ onConnect?:() => void ```javascript function subscribeCallback(err) { if (err) { - console.info("subscribe failed " + JSON.stringify(err)); + console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`); } else { console.info("subscribeCallback"); } @@ -831,7 +813,7 @@ let subscriber = { onConnect: onConnectCallback }; -NotificationSubscribe.subscribe(subscriber, subscribeCallback); +notificationSubscribe.subscribe(subscriber, subscribeCallback); ``` ### onDisconnect @@ -849,14 +831,14 @@ onDisconnect?:() => void ```javascript function subscribeCallback(err) { if (err) { - console.info("subscribe failed " + JSON.stringify(err)); + console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`); } else { console.info("subscribeCallback"); } }; function unsubscribeCallback(err) { if (err.code) { - console.info("unsubscribe failed " + JSON.stringify(err)); + console.error(`unsubscribe failed, code is ${err.code}, message is ${err.message}`); } else { console.info("unsubscribeCallback"); } @@ -875,9 +857,9 @@ let subscriber = { }; // 订阅通知后会收到onConnect回调 -NotificationSubscribe.subscribe(subscriber, subscribeCallback); +notificationSubscribe.subscribe(subscriber, subscribeCallback); // 取消订阅后会收到onDisconnect回调 -NotificationSubscribe.unsubscribe(subscriber, unsubscribeCallback); +notificationSubscribe.unsubscribe(subscriber, unsubscribeCallback); ``` ### onDestroy @@ -895,7 +877,7 @@ onDestroy?:() => void ```javascript function subscribeCallback(err) { if (err) { - console.info("subscribe failed " + JSON.stringify(err)); + console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`); } else { console.info("subscribeCallback"); } @@ -909,7 +891,7 @@ let subscriber = { onDestroy: onDestroyCallback }; -NotificationSubscribe.subscribe(subscriber, subscribeCallback); +notificationSubscribe.subscribe(subscriber, subscribeCallback); ``` ### onDoNotDisturbDateChange @@ -933,7 +915,7 @@ onDoNotDisturbDateChange?:(mode: notification.[DoNotDisturbDate](js-apis-notific ```javascript function subscribeCallback(err) { if (err) { - console.info("subscribe failed " + JSON.stringify(err)); + console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`); } else { console.info("subscribeCallback"); } @@ -947,13 +929,13 @@ let subscriber = { onDoNotDisturbDateChange: onDoNotDisturbDateChangeCallback }; -NotificationSubscribe.subscribe(subscriber, subscribeCallback); +notificationSubscribe.subscribe(subscriber, subscribeCallback); ``` ### onEnabledNotificationChanged -onEnabledNotificationChanged?:(callbackData: [EnabledNotificationCallbackData](#enablednotificationcallbackdata)) => void +onEnabledNotificationChanged?:(callbackData: [EnabledNotificationCallbackData](js-apis-notification.md#enablednotificationcallbackdata)) => void 监听应用通知使能变化。 @@ -965,14 +947,14 @@ onEnabledNotificationChanged?:(callbackData: [EnabledNotificationCallbackData](# | 参数名 | 类型 | 必填 | 说明 | | ------------ | ------------------------ | ---- | -------------------------- | -| callback | AsyncCallback\<[EnabledNotificationCallbackData](#enablednotificationcallbackdata)\> | 是 | 回调返回监听到的应用信息。 | +| callback | AsyncCallback\<[EnabledNotificationCallbackData](js-apis-notification.md#enablednotificationcallbackdata)\> | 是 | 回调返回监听到的应用信息。 | **示例:** ```javascript function subscribeCallback(err) { if (err) { - console.info("subscribe failed " + JSON.stringify(err)); + console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`); } else { console.info("subscribeCallback"); } @@ -988,107 +970,49 @@ let subscriber = { onEnabledNotificationChanged: onEnabledNotificationChangedCallback }; -NotificationSubscribe.subscribe(subscriber, subscribeCallback); +notificationSubscribe.subscribe(subscriber, subscribeCallback); ``` -## BundleOption - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| ------ | ------ |---- | --- | ------ | -| bundle | string | 是 | 是 | 应用的包信息。 | -| uid | number | 是 | 是 | 用户ID。 | - -## NotificationKey - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| ----- | ------ | ---- | --- | -------- | -| id | number | 是 | 是 | 通知ID。 | -| label | string | 是 | 是 | 通知标签。 | - -## SubscribeCallbackData +### onBadgeChanged10+ -**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification - -**系统API**:此接口为系统接口,三方应用不支持调用。 - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| --------------- | ------------------------------------------------- | -------- | -------- | -------- | -| request | [NotificationRequest](js-apis-notificationManager.md#notificationrequest) | 是 | 否 | 通知内容。 | -| sortingMap | [NotificationSortingMap](#notificationsortingmap) | 是 | 否 | 排序信息。 | -| reason | number | 是 | 否 | 删除原因。 | -| sound | string | 是 | 否 | 通知声音。 | -| vibrationValues | Array\ | 是 | 否 | 通知震动。 | - - -## EnabledNotificationCallbackData - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification - -**系统API**:此接口为系统接口,三方应用不支持调用。 + onBadgeChanged?:(data: [BadgeNumberCallbackData](#badgenumbercallbackdata)) => void -| 名称 | 类型 | 可读 | 可写 | 描述 | -| ------ | ------- | ---------------- | ---------------- | ---------------- | -| bundle | string | 是 | 否 | 应用的包名。 | -| uid | number | 是 | 否 | 应用的uid。 | -| enable | boolean | 是 | 否 | 应用通知使能状态。 | +监听应用角标个数变化。 - -## NotificationSorting - -提供有关活动通知的排序信息。 - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification +**系统能力**:SystemCapability.Notification.Notification **系统API**: 此接口为系统接口,三方应用不支持调用。 -| 名称 | 类型 | 可读 | 可写 | 说明 | -| -------- | ------------------------------------- | ---- | --- | ------------ | -| slot | [NotificationSlot](js-apis-notificationManager.md#notificationslot) | 是 | 否 | 通知通道内容。 | -| hashCode | string | 是 | 否 | 通知唯一标识。 | -| ranking | number | 是 | 否 | 通知排序序号。 | - - -## NotificationSortingMap - -提供关于已订阅的所有通知中活动通知的排序信息 - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification - -**系统API**:此接口为系统接口,三方应用不支持调用。 - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| -------------- | ------------------------------------------------------------ | ---- | --- | ---------------- | -| sortings | {[key: string]: [NotificationSorting](#notificationsorting)} | 是 | 否 | 通知排序信息数组。 | -| sortedHashCode | Array\ | 是 | 否 | 通知唯一标识数组。 | - - -## NotificationSubscribeInfo - -设置订阅所需通知的发布者的信息。 - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification +**参数:** -**系统API**: 此接口为系统接口,三方应用不支持调用。 +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------------ | ---- | -------------------------- | +| callback | AsyncCallback\<[BadgeNumberCallbackData](#badgenumbercallbackdata)\> | 是 | 回调返回监听到的应用信息。 | -| 名称 | 类型 | 可读 | 可写 | 说明 | -| ----------- | --------------- | --- | ---- | ------------------------------- | -| bundleNames | Array\ | 是 | 是 | 指定订阅哪些包名的APP发来的通知。 | -| userId | number | 是 | 是 | 指定订阅哪个用户下发来的通知。 | +**示例:** +```javascript +function subscribeCallback(err) { + if (err) { + console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info("subscribeCallback"); + } +}; -## NotificationUserInput +function onBadgeChangedCallback(data) { + console.info("bundle: ", data.bundle); + console.info("uid: ", data.uid); + console.info("badgeNumber: ", data.badgeNumber); +}; -保存用户输入的通知消息。 +let subscriber = { + onBadgeChanged: onBadgeChangedCallback +}; -**系统能力**:SystemCapability.Notification.Notification +notificationSubscribe.subscribe(subscriber, subscribeCallback); +``` -| 名称 | 类型 | 可读 | 可写 | 说明 | -| -------- | ------ | --- | ---- | ----------------------------- | -| inputKey | string | 是 | 是 | 用户输入时用于标识此输入的key。 | ## RemoveReason @@ -1099,4 +1023,16 @@ NotificationSubscribe.subscribe(subscriber, subscribeCallback); | 名称 | 值 | 说明 | | -------------------- | --- | -------------------- | | CLICK_REASON_REMOVE | 1 | 点击通知后删除通知。 | -| CANCEL_REASON_REMOVE | 2 | 用户删除通知。 | \ No newline at end of file +| CANCEL_REASON_REMOVE | 2 | 用户删除通知。 | + +## BadgeNumberCallbackData10+ + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification + +**系统API**:此接口为系统接口,三方应用不支持调用。 + +| 名称 | 类型 | 可读 | 可写 | 描述 | +| ----------- | ------ | ---- | ---- | ------------ | +| bundle | string | 是 | 否 | 应用的包名。 | +| uid | number | 是 | 否 | 应用的uid。 | +| badgeNumber | number | 是 | 否 | 角标个数。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-observer.md b/zh-cn/application-dev/reference/apis/js-apis-observer.md index 5ebba5403091c43c966efcd65f141923bc535f8c..0e0708d456af551f68b2c3b9348dcfccdc0c6ba1 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-observer.md +++ b/zh-cn/application-dev/reference/apis/js-apis-observer.md @@ -10,7 +10,7 @@ ## 导入模块 ``` -import observer from '@ohos.telephony.observer' +import observer from '@ohos.telephony.observer'; ``` ## observer.on('networkStateChange') @@ -45,7 +45,7 @@ on\(type: \'networkStateChange\', callback: Callback\): void; **示例:** ```js -observer.on('networkStateChange', data =>{ +observer.on('networkStateChange', data => { console.log("on networkStateChange, data:" + JSON.stringify(data)); }); ``` @@ -84,7 +84,7 @@ on\(type: \'networkStateChange\', options: { slotId: number }, callback: Callbac **示例:** ```js -observer.on('networkStateChange', {slotId: 0}, data =>{ +observer.on('networkStateChange', {slotId: 0}, data => { console.log("on networkStateChange, data:" + JSON.stringify(data)); }); ``` @@ -159,7 +159,7 @@ on\(type: \'signalInfoChange\', callback: Callback\>): **示例:** ```js -observer.on('signalInfoChange', data =>{ +observer.on('signalInfoChange', data => { console.log("on signalInfoChange, data:" + JSON.stringify(data)); }); ``` @@ -196,7 +196,7 @@ on\(type: \'signalInfoChange\', options: { slotId: number }, callback: Callback< **示例:** ```js -observer.on('signalInfoChange', {slotId: 0}, data =>{ +observer.on('signalInfoChange', {slotId: 0}, data => { console.log("on signalInfoChange, data:" + JSON.stringify(data)); }); ``` @@ -274,7 +274,7 @@ on(type: 'callStateChange', callback: Callback\<{ state: CallState, number: stri **示例:** ```js -observer.on('callStateChange', value =>{ +observer.on('callStateChange', value => { console.log("on callStateChange, state:" + value.state + ", number:" + value.number); }); ``` @@ -310,7 +310,7 @@ on(type: 'callStateChange', options: { slotId: number }, callback: Callback<{ st **示例:** ```js -observer.on('callStateChange', {slotId: 0}, value =>{ +observer.on('callStateChange', {slotId: 0}, value => { console.log("on callStateChange, state:" + value.state + ", number:" + value.number); }); ``` @@ -388,7 +388,7 @@ on\(type: 'cellularDataConnectionStateChange', callback: Callback\<{ state: Data **示例:** ```js -observer.on('cellularDataConnectionStateChange', value =>{ +observer.on('cellularDataConnectionStateChange', value => { console.log("on cellularDataConnectionStateChange, state:" + value.state + ", network:" + value.network); }); ``` @@ -424,7 +424,7 @@ on\(type: 'cellularDataConnectionStateChange', options: { slotId: number }, call **示例:** ```js -observer.on('cellularDataConnectionStateChange', {slotId: 0}, value =>{ +observer.on('cellularDataConnectionStateChange', {slotId: 0}, value => { console.log("on cellularDataConnectionStateChange, state:" + value.state + ", network:" + value.network); }); ``` @@ -502,7 +502,7 @@ on\(type: 'cellularDataFlowChange', callback: Callback\\): void; **示例:** ```js -observer.on('cellularDataFlowChange', data =>{ +observer.on('cellularDataFlowChange', data => { console.log("on networkStateChange, data:" + JSON.stringify(data)); }); ``` @@ -538,7 +538,7 @@ on\(type: 'cellularDataFlowChange', options: { slotId: number }, callback: Call **示例:** ```js -observer.on('cellularDataFlowChange', {slotId: 0}, data =>{ +observer.on('cellularDataFlowChange', {slotId: 0}, data => { console.log("on cellularDataFlowChange, data:" + JSON.stringify(data)); }); ``` @@ -616,7 +616,7 @@ on\(type: 'simStateChange', callback: Callback\\): void; **示例:** ```js -observer.on('simStateChange', data =>{ +observer.on('simStateChange', data => { console.log("on simStateChange, data:" + JSON.stringify(data)); }); ``` @@ -652,7 +652,7 @@ on\(type: 'simStateChange', options: { slotId: number }, callback: Callback\{ +observer.on('simStateChange', {slotId: 0}, data => { console.log("on simStateChange, data:" + JSON.stringify(data)); }); ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-osAccount.md b/zh-cn/application-dev/reference/apis/js-apis-osAccount.md index a4785b97b6f18f3ab41f2c071f5633f52205e9fa..69dd469a234161e6fbfbd345701d509a04bb382d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-osAccount.md +++ b/zh-cn/application-dev/reference/apis/js-apis-osAccount.md @@ -303,13 +303,13 @@ checkOsAccountActivated(localId: number): Promise<boolean> } ``` -### checkConstraintEnabled9+ +### checkOsAccountConstraintEnabled9+ -checkConstraintEnabled(localId: number, constraint: string, callback: AsyncCallback<boolean>): void +checkOsAccountConstraintEnabled(localId: number, constraint: string, callback: AsyncCallback<boolean>): void 判断指定系统帐号是否具有指定约束。使用callback异步回调。 -**需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS +**需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS 或 ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS **系统能力:** SystemCapability.Account.OsAccount @@ -336,25 +336,25 @@ checkConstraintEnabled(localId: number, constraint: string, callback: AsyncCallb let localId = 100; let constraint = "constraint.wifi"; try { - accountManager.checkConstraintEnabled(localId, constraint, (err, isEnabled)=>{ + accountManager.checkOsAccountConstraintEnabled(localId, constraint, (err, isEnabled)=>{ if (err) { - console.log("checkConstraintEnabled failed, error: " + JSON.stringify(err)); + console.log("checkOsAccountConstraintEnabled failed, error: " + JSON.stringify(err)); } else { - console.log("checkConstraintEnabled successfully, isEnabled: " + isEnabled); + console.log("checkOsAccountConstraintEnabled successfully, isEnabled: " + isEnabled); } }); } catch (err) { - console.log("checkConstraintEnabled exception: " + JSON.stringify(err)); + console.log("checkOsAccountConstraintEnabled exception: " + JSON.stringify(err)); } ``` -### checkConstraintEnabled9+ +### checkOsAccountConstraintEnabled9+ -checkConstraintEnabled(localId: number, constraint: string): Promise<boolean> +checkOsAccountConstraintEnabled(localId: number, constraint: string): Promise<boolean> 判断指定系统帐号是否具有指定约束。使用Promise异步回调。 -**需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS +**需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS 或 ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS **系统能力:** SystemCapability.Account.OsAccount @@ -386,13 +386,13 @@ checkConstraintEnabled(localId: number, constraint: string): Promise<boolean& let localId = 100; let constraint = "constraint.wifi"; try { - accountManager.checkConstraintEnabled(localId, constraint).then((isEnabled) => { - console.log("checkConstraintEnabled successfully, isEnabled: " + isEnabled); + accountManager.checkOsAccountConstraintEnabled(localId, constraint).then((isEnabled) => { + console.log("checkOsAccountConstraintEnabled successfully, isEnabled: " + isEnabled); }).catch((err) => { - console.log("checkConstraintEnabled failed, error: " + JSON.stringify(err)); + console.log("checkOsAccountConstraintEnabled failed, error: " + JSON.stringify(err)); }); } catch (err) { - console.log("checkConstraintEnabled exception: " + JSON.stringify(err)); + console.log("checkOsAccountConstraintEnabled exception: " + JSON.stringify(err)); } ``` @@ -972,9 +972,9 @@ getOsAccountCount(): Promise<number> } ``` -### queryOsAccountLocalIdFromProcess9+ +### getOsAccountLocalId9+ -queryOsAccountLocalIdFromProcess(callback: AsyncCallback<number>): void +getOsAccountLocalId(callback: AsyncCallback<number>): void 获取当前进程所属的系统帐号ID,使用callback异步回调。 @@ -997,21 +997,21 @@ queryOsAccountLocalIdFromProcess(callback: AsyncCallback<number>): void ```js let accountManager = account_osAccount.getAccountManager(); try { - accountManager.queryOsAccountLocalIdFromProcess((err, localId) => { + accountManager.getOsAccountLocalId((err, localId) => { if (err) { - console.log("queryOsAccountLocalIdFromProcess failed, error: " + JSON.stringify(err)); + console.log("getOsAccountLocalId failed, error: " + JSON.stringify(err)); } else { - console.log("queryOsAccountLocalIdFromProcess successfully, localId: " + localId); + console.log("getOsAccountLocalId successfully, localId: " + localId); } }); } catch (err) { - console.log("queryOsAccountLocalIdFromProcess exception: " + JSON.stringify(err)); + console.log("getOsAccountLocalId exception: " + JSON.stringify(err)); } ``` -### queryOsAccountLocalIdFromProcess9+ +### getOsAccountLocalId9+ -queryOsAccountLocalIdFromProcess(): Promise<number> +getOsAccountLocalId(): Promise<number> 获取当前进程所属的系统帐号ID,使用Promise异步回调。 @@ -1034,19 +1034,19 @@ queryOsAccountLocalIdFromProcess(): Promise<number> ```js let accountManager = account_osAccount.getAccountManager(); try { - accountManager.queryOsAccountLocalIdFromProcess().then((localId) => { - console.log("queryOsAccountLocalIdFromProcess successfully, localId: " + localId); + accountManager.getOsAccountLocalId().then((localId) => { + console.log("getOsAccountLocalId successfully, localId: " + localId); }).catch((err) => { - console.log("queryOsAccountLocalIdFromProcess failed, error: " + JSON.stringify(err)); + console.log("getOsAccountLocalId failed, error: " + JSON.stringify(err)); }); } catch (err) { - console.log('queryOsAccountLocalIdFromProcess exception: ' + JSON.stringify(err)); + console.log('getOsAccountLocalId exception: ' + JSON.stringify(err)); } ``` -### queryOsAccountLocalIdFromUid9+ +### getOsAccountLocalIdForUid9+ -queryOsAccountLocalIdFromUid(uid: number, callback: AsyncCallback<number>): void +getOsAccountLocalIdForUid(uid: number, callback: AsyncCallback<number>): void 根据uid查询对应的系统帐号ID,使用callback异步回调。 @@ -1072,20 +1072,20 @@ queryOsAccountLocalIdFromUid(uid: number, callback: AsyncCallback<number>) let accountManager = account_osAccount.getAccountManager(); let uid = 12345678; try { - accountManager.queryOsAccountLocalIdFromUid(uid, (err, localId) => { + accountManager.getOsAccountLocalIdForUid(uid, (err, localId) => { if (err) { - console.log("queryOsAccountLocalIdFromUid failed, error: " + JSON.stringify(err)); + console.log("getOsAccountLocalIdForUid failed, error: " + JSON.stringify(err)); } - console.log("queryOsAccountLocalIdFromUid successfully, localId: " + localId); + console.log("getOsAccountLocalIdForUid successfully, localId: " + localId); }); } catch (err) { - console.log("queryOsAccountLocalIdFromUid exception: " + JSON.stringify(err)); + console.log("getOsAccountLocalIdForUid exception: " + JSON.stringify(err)); } ``` -### queryOsAccountLocalIdFromUid9+ +### getOsAccountLocalIdForUid9+ -queryOsAccountLocalIdFromUid(uid: number): Promise<number> +getOsAccountLocalIdForUid(uid: number): Promise<number> 根据uid查询对应的系统帐号ID,使用Promise异步回调。 @@ -1116,19 +1116,19 @@ queryOsAccountLocalIdFromUid(uid: number): Promise<number> let accountManager = account_osAccount.getAccountManager(); let uid = 12345678; try { - accountManager.queryOsAccountLocalIdFromUid(uid).then((localId) => { - console.log("queryOsAccountLocalIdFromUid successfully, localId: " + localId); + accountManager.getOsAccountLocalIdForUid(uid).then((localId) => { + console.log("getOsAccountLocalIdForUid successfully, localId: " + localId); }).catch((err) => { - console.log("queryOsAccountLocalIdFromUid failed, error: " + JSON.stringify(err)); + console.log("getOsAccountLocalIdForUid failed, error: " + JSON.stringify(err)); }); } catch (err) { - console.log('queryOsAccountLocalIdFromUid exception: ' + JSON.stringify(err)); + console.log('getOsAccountLocalIdForUid exception: ' + JSON.stringify(err)); } ``` -### queryOsAccountLocalIdFromDomain9+ +### getOsAccountLocalIdForDomain9+ -queryOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo, callback: AsyncCallback<number>): void +getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo, callback: AsyncCallback<number>): void 根据域帐号信息,获取与其关联的系统帐号ID。使用callback异步回调。 @@ -1156,21 +1156,21 @@ queryOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo, callback: AsyncCa let domainInfo = {domain: 'testDomain', accountName: 'testAccountName'}; let accountManager = account_osAccount.getAccountManager(); try { - accountManager.queryOsAccountLocalIdFromDomain(domainInfo, (err, localId) => { + accountManager.getOsAccountLocalIdForDomain(domainInfo, (err, localId) => { if (err) { - console.log("queryOsAccountLocalIdFromDomain failed, error: " + JSON.stringify(err)); + console.log("getOsAccountLocalIdForDomain failed, error: " + JSON.stringify(err)); } else { - console.log("queryOsAccountLocalIdFromDomain successfully, localId: " + localId); + console.log("getOsAccountLocalIdForDomain successfully, localId: " + localId); } }); } catch (err) { - console.log('queryOsAccountLocalIdFromDomain exception: ' + JSON.stringify(err)); + console.log('getOsAccountLocalIdForDomain exception: ' + JSON.stringify(err)); } ``` -### queryOsAccountLocalIdFromDomain9+ +### getOsAccountLocalIdForDomain9+ -queryOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo): Promise<number> +getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo): Promise<number> 根据域帐号信息,获取与其关联的系统帐号的帐号ID。使用Promise异步回调。 @@ -1203,13 +1203,13 @@ queryOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo): Promise<numbe let accountManager = account_osAccount.getAccountManager(); let domainInfo = {domain: 'testDomain', accountName: 'testAccountName'}; try { - accountManager.queryOsAccountLocalIdFromDomain(domainInfo).then((localId) => { - console.log("queryOsAccountLocalIdFromDomain successfully, localId: " + localId); + accountManager.getOsAccountLocalIdForDomain(domainInfo).then((localId) => { + console.log("getOsAccountLocalIdForDomain successfully, localId: " + localId); }).catch((err) => { - console.log("queryOsAccountLocalIdFromDomain failed, error: " + JSON.stringify(err)); + console.log("getOsAccountLocalIdForDomain failed, error: " + JSON.stringify(err)); }); } catch (err) { - console.log("queryOsAccountLocalIdFromDomain exception: " + JSON.stringify(err)); + console.log("getOsAccountLocalIdForDomain exception: " + JSON.stringify(err)); } ``` @@ -1455,9 +1455,9 @@ queryAllCreatedOsAccounts(): Promise<Array<OsAccountInfo>> } ``` -### getActivatedOsAccountIds9+ +### getActivatedOsAccountLocalIds9+ -getActivatedOsAccountIds(callback: AsyncCallback<Array<number>>): void +getActivatedOsAccountLocalIds(callback: AsyncCallback<Array<number>>): void 查询当前处于激活状态的系统帐号的ID列表。使用callback异步回调。 @@ -1480,21 +1480,21 @@ getActivatedOsAccountIds(callback: AsyncCallback<Array<number>>): vo ```js let accountManager = account_osAccount.getAccountManager(); try { - accountManager.getActivatedOsAccountIds((err, idArray)=>{ - console.log('getActivatedOsAccountIds err:' + JSON.stringify(err)); - console.log('getActivatedOsAccountIds idArray length:' + idArray.length); + accountManager.getActivatedOsAccountLocalIds((err, idArray)=>{ + console.log('getActivatedOsAccountLocalIds err:' + JSON.stringify(err)); + console.log('getActivatedOsAccountLocalIds idArray length:' + idArray.length); for(let i=0;i9+
+### getActivatedOsAccountLocalIds9+ -getActivatedOsAccountIds(): Promise<Array<number>> +getActivatedOsAccountLocalIds(): Promise<Array<number>> 查询当前处于激活状态的系统帐号的ID列表。使用Promise异步回调。 @@ -1517,13 +1517,13 @@ getActivatedOsAccountIds(): Promise<Array<number>> ```js let accountManager = account_osAccount.getAccountManager(); try { - accountManager.getActivatedOsAccountIds().then((idArray) => { - console.log('getActivatedOsAccountIds, idArray: ' + idArray); + accountManager.getActivatedOsAccountLocalIds().then((idArray) => { + console.log('getActivatedOsAccountLocalIds, idArray: ' + idArray); }).catch((err) => { - console.log('getActivatedOsAccountIds err: ' + JSON.stringify(err)); + console.log('getActivatedOsAccountLocalIds err: ' + JSON.stringify(err)); }); } catch (e) { - console.log('getActivatedOsAccountIds exception:' + JSON.stringify(e)); + console.log('getActivatedOsAccountLocalIds exception:' + JSON.stringify(e)); } ``` @@ -2213,9 +2213,9 @@ setOsAccountProfilePhoto(localId: number, photo: string): Promise<void> } ``` -### queryOsAccountLocalIdBySerialNumber9+ +### getOsAccountLocalIdForSerialNumber9+ -queryOsAccountLocalIdBySerialNumber(serialNumber: number, callback: AsyncCallback<number>): void +getOsAccountLocalIdForSerialNumber(serialNumber: number, callback: AsyncCallback<number>): void 通过SN码查询与其关联的系统帐号的帐号ID。使用callback异步回调。 @@ -2242,7 +2242,7 @@ queryOsAccountLocalIdBySerialNumber(serialNumber: number, callback: AsyncCallbac let accountManager = account_osAccount.getAccountManager(); let serialNumber = 12345; try { - accountManager.queryOsAccountLocalIdBySerialNumber(serialNumber, (err, localId)=>{ + accountManager.getOsAccountLocalIdForSerialNumber(serialNumber, (err, localId)=>{ console.log('ger localId err:' + JSON.stringify(err)); console.log('get localId:' + localId + ' by serialNumber: ' + serialNumber); }); @@ -2251,9 +2251,9 @@ queryOsAccountLocalIdBySerialNumber(serialNumber: number, callback: AsyncCallbac } ``` -### queryOsAccountLocalIdBySerialNumber9+ +### getOsAccountLocalIdForSerialNumber9+ -queryOsAccountLocalIdBySerialNumber(serialNumber: number): Promise<number> +getOsAccountLocalIdForSerialNumber(serialNumber: number): Promise<number> 通过SN码查询与其关联的系统帐号的帐号ID。使用Promise异步回调。 @@ -2285,19 +2285,19 @@ queryOsAccountLocalIdBySerialNumber(serialNumber: number): Promise<number> let accountManager = account_osAccount.getAccountManager(); let serialNumber = 12345; try { - accountManager.queryOsAccountLocalIdBySerialNumber(serialNumber).then((localId) => { - console.log('queryOsAccountLocalIdBySerialNumber localId: ' + localId); + accountManager.getOsAccountLocalIdForSerialNumber(serialNumber).then((localId) => { + console.log('getOsAccountLocalIdForSerialNumber localId: ' + localId); }).catch((err) => { - console.log('queryOsAccountLocalIdBySerialNumber err: ' + JSON.stringify(err)); + console.log('getOsAccountLocalIdForSerialNumber err: ' + JSON.stringify(err)); }); } catch (e) { - console.log('queryOsAccountLocalIdBySerialNumber exception: ' + JSON.stringify(e)); + console.log('getOsAccountLocalIdForSerialNumber exception: ' + JSON.stringify(e)); } ``` -### querySerialNumberByOsAccountLocalId9+ +### getSerialNumberForOsAccountLocalId9+ -querySerialNumberByOsAccountLocalId(localId: number, callback: AsyncCallback<number>): void +getSerialNumberForOsAccountLocalId(localId: number, callback: AsyncCallback<number>): void 通过系统帐号ID获取与该系统帐号关联的SN码。使用callback异步回调。 @@ -2324,7 +2324,7 @@ querySerialNumberByOsAccountLocalId(localId: number, callback: AsyncCallback< let accountManager = account_osAccount.getAccountManager(); let localId = 100; try { - accountManager.querySerialNumberByOsAccountLocalId(localId, (err, serialNumber)=>{ + accountManager.getSerialNumberForOsAccountLocalId(localId, (err, serialNumber)=>{ console.log('ger serialNumber err:' + JSON.stringify(err)); console.log('get serialNumber:' + serialNumber + ' by localId: ' + localId); }); @@ -2333,9 +2333,9 @@ querySerialNumberByOsAccountLocalId(localId: number, callback: AsyncCallback< } ``` -### querySerialNumberByOsAccountLocalId9+ +### getSerialNumberForOsAccountLocalId9+ -querySerialNumberByOsAccountLocalId(localId: number): Promise<number> +getSerialNumberForOsAccountLocalId(localId: number): Promise<number> 通过系统帐号ID获取与该系统帐号关联的SN码。使用Promise异步回调。 @@ -2367,13 +2367,13 @@ querySerialNumberByOsAccountLocalId(localId: number): Promise<number> let accountManager = account_osAccount.getAccountManager(); let localId = 100; try { - accountManager.querySerialNumberByOsAccountLocalId(localId).then((serialNumber) => { - console.log('querySerialNumberByOsAccountLocalId serialNumber: ' + serialNumber); + accountManager.getSerialNumberForOsAccountLocalId(localId).then((serialNumber) => { + console.log('getSerialNumberForOsAccountLocalId serialNumber: ' + serialNumber); }).catch((err) => { - console.log('querySerialNumberByOsAccountLocalId err: ' + JSON.stringify(err)); + console.log('getSerialNumberForOsAccountLocalId err: ' + JSON.stringify(err)); }); } catch (e) { - console.log('querySerialNumberByOsAccountLocalId exception:' + JSON.stringify(e)); + console.log('getSerialNumberForOsAccountLocalId exception:' + JSON.stringify(e)); } ``` @@ -2461,9 +2461,9 @@ off(type: 'activate' | 'activating', name: string, callback?: Callback<number } ``` -### getBundleIdFromUid9+ +### getBundleIdForUid9+ -getBundleIdFromUid(uid: number, callback: AsyncCallback<number>): void; +getBundleIdForUid(uid: number, callback: AsyncCallback<number>): void; 通过uid查询对应的bundleId,使用callback异步回调。 @@ -2491,17 +2491,17 @@ getBundleIdFromUid(uid: number, callback: AsyncCallback<number>): void; let accountManager = account_osAccount.getAccountManager(); let testUid = 1000000; try { - accountManager.getBundleIdFromUid(testUid, (err, bundleId) => { - console.info('getBundleIdFromUid errInfo:' + JSON.stringify(err)); - console.info('getBundleIdFromUid bundleId:' + JSON.stringify(bundleId)); + accountManager.getBundleIdForUid(testUid, (err, bundleId) => { + console.info('getBundleIdForUid errInfo:' + JSON.stringify(err)); + console.info('getBundleIdForUid bundleId:' + JSON.stringify(bundleId)); }); } catch (e) { - console.info('getBundleIdFromUid exception:' + JSON.stringify(e)); + console.info('getBundleIdForUid exception:' + JSON.stringify(e)); } ``` -### getBundleIdFromUid9+ +### getBundleIdForUid9+ -getBundleIdFromUid(uid: number): Promise<number>; +getBundleIdForUid(uid: number): Promise<number>; 通过uid查询对应的bundleId,使用Promise异步回调。 @@ -2534,13 +2534,13 @@ getBundleIdFromUid(uid: number): Promise<number>; let accountManager = account_osAccount.getAccountManager(); let testUid = 1000000; try { - accountManager.getBundleIdFromUid(testUid).then((result) => { - console.info('getBundleIdFromUid bundleId:' + JSON.stringify(result)); + accountManager.getBundleIdForUid(testUid).then((result) => { + console.info('getBundleIdForUid bundleId:' + JSON.stringify(result)); }).catch((err)=>{ - console.info('getBundleIdFromUid errInfo:' + JSON.stringify(err)); + console.info('getBundleIdForUid errInfo:' + JSON.stringify(err)); }); } catch (e) { - console.info('getBundleIdFromUid exception:' + JSON.stringify(e)); + console.info('getBundleIdForUid exception:' + JSON.stringify(e)); } ``` @@ -2619,9 +2619,9 @@ isMainOsAccount(): Promise<boolean>; console.info('isMainOsAccount exception:' + JSON.stringify(e)); } ``` -### queryOsAccountConstraintSourceTypes9+ +### getOsAccountConstraintSourceTypes9+ -queryOsAccountConstraintSourceTypes(localId: number, constraint: string, callback: AsyncCallback<Array<ConstraintSourceTypeInfo>>): void; +getOsAccountConstraintSourceTypes(localId: number, constraint: string, callback: AsyncCallback<Array<ConstraintSourceTypeInfo>>): void; 查询指定系统帐号的指定约束来源信息,使用callback异步回调。 @@ -2652,18 +2652,18 @@ queryOsAccountConstraintSourceTypes(localId: number, constraint: string, callbac ```js let accountManager = account_osAccount.getAccountManager(); try { - accountManager.queryOsAccountConstraintSourceTypes(100, 'constraint.wifi',(err,sourceTypeInfos)=>{ - console.info('queryOsAccountConstraintSourceType errInfo:' + JSON.stringify(err)); - console.info('queryOsAccountConstraintSourceType sourceTypeInfos:' + JSON.stringify(sourceTypeInfos)); + accountManager.getOsAccountConstraintSourceTypes(100, 'constraint.wifi',(err,sourceTypeInfos)=>{ + console.info('getOsAccountConstraintSourceTypes errInfo:' + JSON.stringify(err)); + console.info('getOsAccountConstraintSourceTypes sourceTypeInfos:' + JSON.stringify(sourceTypeInfos)); }); } catch (e) { - console.info('queryOsAccountConstraintSourceType exception:' + JSON.stringify(e)); + console.info('getOsAccountConstraintSourceTypes exception:' + JSON.stringify(e)); } ``` -### queryOsAccountConstraintSourceTypes9+ +### getOsAccountConstraintSourceTypes9+ -queryOsAccountConstraintSourceTypes(localId: number, constraint: string): Promise<Array<ConstraintSourceTypeInfo>>; +getOsAccountConstraintSourceTypes(localId: number, constraint: string): Promise<Array<ConstraintSourceTypeInfo>>; 查询指定系统帐号的指定约束来源信息,使用Promise异步回调。 @@ -2699,13 +2699,13 @@ queryOsAccountConstraintSourceTypes(localId: number, constraint: string): Promis ```js let accountManager = account_osAccount.getAccountManager(); try { - accountManager.queryOsAccountConstraintSourceTypes(100, 'constraint.wifi').then((result) => { - console.info('queryOsAccountConstraintSourceType sourceTypeInfos:' + JSON.stringify(result)); + accountManager.getOsAccountConstraintSourceTypes(100, 'constraint.wifi').then((result) => { + console.info('getOsAccountConstraintSourceTypes sourceTypeInfos:' + JSON.stringify(result)); }).catch((err)=>{ - console.info('queryOsAccountConstraintSourceType errInfo:' + JSON.stringify(err)); + console.info('getOsAccountConstraintSourceTypes errInfo:' + JSON.stringify(err)); }); } catch (e) { - console.info('queryOsAccountConstraintSourceType exception:' + JSON.stringify(e)); + console.info('getOsAccountConstraintSourceTypes exception:' + JSON.stringify(e)); } ``` @@ -2851,7 +2851,7 @@ isOsAccountConstraintEnable(localId: number, constraint: string, callback: Async > **说明:** > -> 从 API version 7开始支持,从API version 9开始废弃。建议使用[checkConstraintEnabled](#checkconstraintenabled9)。 +> 从 API version 7开始支持,从API version 9开始废弃。建议使用[checkOsAccountConstraintEnabled](#checkosaccountconstraintenabled9)。 **需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS @@ -2888,7 +2888,7 @@ isOsAccountConstraintEnable(localId: number, constraint: string): Promise<boo > **说明:** > -> 从 API version 7开始支持,从API version 9开始废弃。建议使用[checkConstraintEnabled](#checkconstraintenabled9-1)。 +> 从 API version 7开始支持,从API version 9开始废弃。建议使用[checkOsAccountConstraintEnabled](#checkosaccountconstraintenabled9-1)。 **需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS @@ -3157,7 +3157,7 @@ getOsAccountLocalIdFromProcess(callback: AsyncCallback<number>): void > **说明:** > -> 从 API version 7开始支持,从API version 9开始废弃。建议使用[queryOsAccountLocalIdFromProcess](#queryosaccountlocalidfromprocess9)。 +> 从 API version 7开始支持,从API version 9开始废弃。建议使用[getOsAccountLocalId](#getosaccountlocalid9)。 **系统能力:** SystemCapability.Account.OsAccount @@ -3188,7 +3188,7 @@ getOsAccountLocalIdFromProcess(): Promise<number> > **说明:** > -> 从 API version 7开始支持,从API version 9开始废弃。建议使用[queryOsAccountLocalIdFromProcess](#queryosaccountlocalidfromprocess9-1)。 +> 从 API version 7开始支持,从API version 9开始废弃。建议使用[getOsAccountLocalId](#getosaccountlocalid9-1)。 **系统能力:** SystemCapability.Account.OsAccount @@ -3217,7 +3217,7 @@ getOsAccountLocalIdFromUid(uid: number, callback: AsyncCallback<number>): > **说明:** > -> 从 API version 7开始支持,从API version 9开始废弃。建议使用[queryOsAccountLocalIdFromUid](#queryosaccountlocalidfromuid9)。 +> 从 API version 7开始支持,从API version 9开始废弃。建议使用[getOsAccountLocalIdForUid](#getosaccountlocalidforuid9)。 **系统能力:** SystemCapability.Account.OsAccount @@ -3250,7 +3250,7 @@ getOsAccountLocalIdFromUid(uid: number): Promise<number> > **说明:** > -> 从 API version 7开始支持,从API version 9开始废弃。建议使用[queryOsAccountLocalIdFromUid](#queryosaccountlocalidfromuid9-1)。 +> 从 API version 7开始支持,从API version 9开始废弃。建议使用[getOsAccountLocalIdForUid](#getosaccountlocalidforuid9-1)。 **系统能力:** SystemCapability.Account.OsAccount @@ -3286,7 +3286,7 @@ getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo, callback: AsyncCall > **说明:** > -> 从 API version 8开始支持,从API version 9开始废弃。建议使用[queryOsAccountLocalIdFromDomain](#queryosaccountlocalidfromdomain9)。 +> 从 API version 8开始支持,从API version 9开始废弃。建议使用[getOsAccountLocalIdForDomain](#getosaccountlocalidfordomain9)。 **需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS @@ -3321,7 +3321,7 @@ getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo): Promise<number& > **说明:** > -> 从 API version 8开始支持,从API version 9开始废弃。建议使用[queryOsAccountLocalIdFromDomain](#queryosaccountlocalidfromdomain9-1)。 +> 从 API version 8开始支持,从API version 9开始废弃。建议使用[getOsAccountLocalIdForDomain](#getosaccountlocalidfordomain9-1)。 **需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS @@ -3429,7 +3429,7 @@ queryActivatedOsAccountIds(callback: AsyncCallback<Array<number>>): > **说明:** > -> 从 API version 8开始支持,从API version 9开始废弃。建议使用[getActivatedOsAccountIds](#getactivatedosaccountids9)。 +> 从 API version 8开始支持,从API version 9开始废弃。建议使用[getActivatedOsAccountLocalIds](#getactivatedosaccountlocalids9)。 **系统能力:** SystemCapability.Account.OsAccount @@ -3458,7 +3458,7 @@ queryActivatedOsAccountIds(): Promise<Array<number>> > **说明:** > -> 从 API version 8开始支持,从API version 9开始废弃。建议使用[getActivatedOsAccountIds](#getactivatedosaccountids9-1)。 +> 从 API version 8开始支持,从API version 9开始废弃。建议使用[getActivatedOsAccountLocalIds](#getactivatedosaccountlocalids9-1)。 查询当前处于激活状态的系统帐号的ID列表。使用Promise异步回调。 @@ -3668,7 +3668,7 @@ getOsAccountLocalIdBySerialNumber(serialNumber: number, callback: AsyncCallback& > **说明:** > -> 从 API version 8开始支持,从API version 9开始废弃。建议使用[queryOsAccountLocalIdBySerialNumber](#queryosaccountlocalidbyserialnumber9)。 +> 从 API version 8开始支持,从API version 9开始废弃。建议使用[getOsAccountLocalIdForSerialNumber](#getosaccountlocalidforserialnumber9)。 **系统能力:** SystemCapability.Account.OsAccount @@ -3698,7 +3698,7 @@ getOsAccountLocalIdBySerialNumber(serialNumber: number): Promise<number> > **说明:** > -> 从 API version 8开始支持,从API version 9开始废弃。建议使用[queryOsAccountLocalIdBySerialNumber](#queryosaccountlocalidbyserialnumber9-1)。 +> 从 API version 8开始支持,从API version 9开始废弃。建议使用[getOsAccountLocalIdForSerialNumber](#getosaccountlocalidforserialnumber9-1)。 **系统能力:** SystemCapability.Account.OsAccount @@ -3734,7 +3734,7 @@ getSerialNumberByOsAccountLocalId(localId: number, callback: AsyncCallback<nu > **说明:** > -> 从 API version 8开始支持,从API version 9开始废弃。建议使用[querySerialNumberByOsAccountLocalId](#queryserialnumberbyosaccountlocalid9)。 +> 从 API version 8开始支持,从API version 9开始废弃。建议使用[getSerialNumberForOsAccountLocalId](#getserialnumberforosaccountlocalid9)。 **系统能力:** SystemCapability.Account.OsAccount @@ -3764,7 +3764,7 @@ getSerialNumberByOsAccountLocalId(localId: number): Promise<number> > **说明:** > -> 从 API version 8开始支持,从API version 9开始废弃。建议使用[querySerialNumberByOsAccountLocalId](#queryserialnumberbyosaccountlocalid9-1)。 +> 从 API version 8开始支持,从API version 9开始废弃。建议使用[getSerialNumberForOsAccountLocalId](#getserialnumberforosaccountlocalid9-1)。 **系统能力:** SystemCapability.Account.OsAccount diff --git a/zh-cn/application-dev/reference/apis/js-apis-permissionrequestresult.md b/zh-cn/application-dev/reference/apis/js-apis-permissionrequestresult.md index 1eae91fc9ae92b7a9082ae4a66692a45a77ddf73..948eb9a341774b3d717489f6b80a0136966716b5 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-permissionrequestresult.md +++ b/zh-cn/application-dev/reference/apis/js-apis-permissionrequestresult.md @@ -14,7 +14,7 @@ | 名称 | 类型 | 可读 | 可写 | 说明 | | -------- | -------- | -------- | -------- | -------- | | permissions | Array<string> | 是 | 否 | 用户传入的权限。| -| authResults | Array<number> | 是 | 否 | 相应请求权限的结果:
-1表示权限已设置,无需弹窗,需要用户在"设置"中修改。
0表示无需任何操作。
1表示需要动态弹窗授权。
2表示请求无效,可能原因有:
-未在设置文件中声明目标权限;
-权限名非法;
-部分权限存在特殊申请条件,在申请对应权限时未满足其指定的条件,见[ohos.permission.LOCATION](../../security/permission-list.md#ohospermissionlocation)与[ohos.permission.APPROXIMATELY_LOCATION](../../security/permission-list.md#ohospermissionapproximately_location)| +| authResults | Array<number> | 是 | 否 | 相应请求权限的结果:
- -1:未授权,表示权限已设置,无需弹窗,需要用户在"设置"中修改。
- 0:已授权。
- 2:未授权,表示请求无效,可能原因有:
-未在设置文件中声明目标权限。
-权限名非法。
-部分权限存在特殊申请条件,在申请对应权限时未满足其指定的条件,见[ohos.permission.LOCATION](../../security/permission-list.md#ohospermissionlocation)与[ohos.permission.APPROXIMATELY_LOCATION](../../security/permission-list.md#ohospermissionapproximately_location) | ## 使用说明 diff --git a/zh-cn/application-dev/reference/apis/js-apis-pointer.md b/zh-cn/application-dev/reference/apis/js-apis-pointer.md index deefe2780eb2107ea2a2ebe8979fca43d3e45e48..d4fdde6403d39a226b15e0ac994b74b8aecbd190 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-pointer.md +++ b/zh-cn/application-dev/reference/apis/js-apis-pointer.md @@ -278,21 +278,23 @@ getPointerStyle(windowId: number, callback: AsyncCallback<PointerStyle>): ```js import window from '@ohos.window'; -window.getTopWindow((error, win) => { - win.getProperties((error, properties) => { - let windowId = properties.id; - if (windowId < 0) { - console.log(`Invalid windowId`); - return; - } - try { - pointer.getPointerStyle(windowId, (error, style) => { - console.log(`Get pointer style success, style: ${JSON.stringify(style)}`); - }); - } catch (error) { - console.log(`Get pointer style failed, error: ${JSON.stringify(error, [`code`, `message`])}`); - } - }); +window.getLastWindow(this.context, (error, win) => { + if (error.code) { + console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(error)); + return; + } + let windowId = win.getWindowProperties().id; + if (windowId < 0) { + console.log(`Invalid windowId`); + return; + } + try { + pointer.getPointerStyle(windowId, (error, style) => { + console.log(`Get pointer style success, style: ${JSON.stringify(style)}`); + }); + } catch (error) { + console.log(`Get pointer style failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } }); ``` @@ -321,21 +323,23 @@ getPointerStyle(windowId: number): Promise<PointerStyle> ```js import window from '@ohos.window'; -window.getTopWindow((error, win) => { - win.getProperties((error, properties) => { - let windowId = properties.id; - if (windowId < 0) { - console.log(`Invalid windowId`); - return; - } - try { - pointer.getPointerStyle(windowId).then((style) => { - console.log(`Get pointer style success, style: ${JSON.stringify(style)}`); - }); - } catch (error) { - console.log(`Get pointer style failed, error: ${JSON.stringify(error, [`code`, `message`])}`); - } - }); +window.getLastWindow(this.context, (error, win) => { + if (error.code) { + console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(error)); + return; + } + let windowId = win.getWindowProperties().id; + if (windowId < 0) { + console.log(`Invalid windowId`); + return; + } + try { + pointer.getPointerStyle(windowId).then((style) => { + console.log(`Get pointer style success, style: ${JSON.stringify(style)}`); + }); + } catch (error) { + console.log(`Get pointer style failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } }); ``` @@ -360,21 +364,23 @@ setPointerStyle(windowId: number, pointerStyle: PointerStyle, callback: AsyncCal ```js import window from '@ohos.window'; -window.getTopWindow((error, win) => { - win.getProperties((error, properties) => { - let windowId = properties.id; - if (windowId < 0) { - console.log(`Invalid windowId`); - return; - } - try { - pointer.setPointerStyle(windowId, pointer.PointerStyle.CROSS, error => { - console.log(`Set pointer style success`); - }); - } catch (error) { - console.log(`Set pointer style failed, error: ${JSON.stringify(error, [`code`, `message`])}`); - } - }); +window.getLastWindow(this.context, (error, win) => { + if (error.code) { + console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(error)); + return; + } + let windowId = win.getWindowProperties().id; + if (windowId < 0) { + console.log(`Invalid windowId`); + return; + } + try { + pointer.setPointerStyle(windowId, pointer.PointerStyle.CROSS, error => { + console.log(`Set pointer style success`); + }); + } catch (error) { + console.log(`Set pointer style failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } }); ``` ## pointer.setPointerStyle9+ @@ -398,21 +404,23 @@ setPointerStyle(windowId: number, pointerStyle: PointerStyle): Promise<void&g ```js import window from '@ohos.window'; -window.getTopWindow((error, win) => { - win.getProperties((error, properties) => { - let windowId = properties.id; - if (windowId < 0) { - console.log(`Invalid windowId`); - return; - } - try { - pointer.setPointerStyle(windowId, pointer.PointerStyle.CROSS).then(() => { - console.log(`Set pointer style success`); - }); - } catch (error) { - console.log(`Set pointer style failed, error: ${JSON.stringify(error, [`code`, `message`])}`); - } - }); +window.getLastWindow(this.context, (error, win) => { + if (error.code) { + console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(error)); + return; + } + let windowId = win.getWindowProperties().id; + if (windowId < 0) { + console.log(`Invalid windowId`); + return; + } + try { + pointer.setPointerStyle(windowId, pointer.PointerStyle.CROSS).then(() => { + console.log(`Set pointer style success`); + }); + } catch (error) { + console.log(`Set pointer style failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } }); ``` ## PointerStyle9+ diff --git a/zh-cn/application-dev/reference/apis/js-apis-privacyManager.md b/zh-cn/application-dev/reference/apis/js-apis-privacyManager.md index 04918ca06f0759a4033d73afcfb769861dcbecc5..af58a0309276ba7cb542caabba8f2b4b19d385d9 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-privacyManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-privacyManager.md @@ -445,7 +445,7 @@ try { ## privacyManager.on -on(type: 'activeStateChange', permissionNameList: Array<Permissions>, callback: Callback<ActiveChangeResponse>): void +on(type: 'activeStateChange', permissionList: Array<Permissions>, callback: Callback<ActiveChangeResponse>): void 订阅指定权限列表的权限使用状态变更事件。 @@ -458,7 +458,7 @@ on(type: 'activeStateChange', permissionNameList: Array<Permissions>, call | 参数名 | 类型 | 必填 | 说明 | | ------------------ | --------------------- | ---- | ------------------------------------------------------------ | | type | string | 是 | 订阅事件类型,固定为'activeStateChange',权限使用状态变更事件。 | -| permissionNameList | Array<Permissions> | 是 | 订阅的权限名列表,为空时表示订阅所有的权限使用状态变化。 | +| permissionList | Array<Permissions> | 是 | 订阅的权限名列表,为空时表示订阅所有的权限使用状态变化。 | | callback | Callback<[ActiveChangeResponse](#activechangeresponse)> | 是 | 订阅指定权限使用状态变更事件的回调。 | **错误码:** @@ -478,9 +478,9 @@ on(type: 'activeStateChange', permissionNameList: Array<Permissions>, call ```js import privacyManager from '@ohos.privacyManager'; -let permissionNameList = []; +let permissionList = []; try { - privacyManager.on('activeStateChange', permissionNameList, (data) => { + privacyManager.on('activeStateChange', permissionList, (data) => { console.debug("receive permission state change, data:" + JSON.stringify(data)); }); } catch(err) { @@ -490,7 +490,7 @@ try { ## privacyManager.off -off(type: 'activeStateChange', permissionNameList: Array<Permissions>, callback?: Callback<ActiveChangeResponse>): void; +off(type: 'activeStateChange', permissionList: Array<Permissions>, callback?: Callback<ActiveChangeResponse>): void; 取消订阅指定权限列表的权限使用状态变更事件。 @@ -503,7 +503,7 @@ off(type: 'activeStateChange', permissionNameList: Array<Permissions>, cal | 参数名 | 类型 | 必填 | 说明 | | ------------------ | --------------------- | ---- | ------------------------------------------------------------ | | type | string | 是 | 订阅事件类型,固定为'activeStateChange',权限使用状态变更事件。 | -| permissionNameList | Array<Permissions> | 是 | 订阅的权限名列表,为空时表示订阅所有的权限状态变化,必须与on的输入一致。 | +| permissionList | Array<Permissions> | 是 | 订阅的权限名列表,为空时表示订阅所有的权限状态变化,必须与on的输入一致。 | | callback | Callback<[ActiveChangeResponse](#activechangeresponse)> | 否 | 取消订阅指定tokenId与指定权限名状态变更事件的回调。| **错误码:** @@ -513,7 +513,7 @@ off(type: 'activeStateChange', permissionNameList: Array<Permissions>, cal | 错误码ID | 错误信息 | | -------- | -------- | | 12100001 | The parameter is invalid. The permissionName in list is all invalid or the list size is larger than 1024. | -| 12100004 | The interface is not used with | +| 12100004 | The interface is not used together with "on"| | 12100007 | Service is abnormal. | | 12100008 | Out of memory. | @@ -522,9 +522,9 @@ off(type: 'activeStateChange', permissionNameList: Array<Permissions>, cal ```js import privacyManager from '@ohos.privacyManager'; -let permissionNameList = []; +let permissionList = []; try { - privacyManager.off('activeStateChange', permissionNameList); + privacyManager.off('activeStateChange', permissionList); }catch(err) { console.log(`catch err->${JSON.stringify(err)}`); } diff --git a/zh-cn/application-dev/reference/apis/js-apis-process.md b/zh-cn/application-dev/reference/apis/js-apis-process.md index 8f9f63a038ed0a31cd4e02b0985db02181b7e553..906b6e422456da4cd78b8a4a3c23a18f0b09e012 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-process.md +++ b/zh-cn/application-dev/reference/apis/js-apis-process.md @@ -18,13 +18,8 @@ import process from '@ohos.process'; | 名称 | 类型 | 可读 | 可写 | 说明 | | -------- | -------- | -------- | -------- | -------- | -| egid | number | 是 | 否 | 进程的有效组标识。
**系统接口:** 此接口为系统接口。
此接口仅用于对应用的测试。| -| euid | number | 是 | 否 | 进程的有效用户身份。
**系统接口:** 此接口为系统接口。
此接口仅用于对应用的测试。 | -| gid | number | 是 | 否 | 进程的组标识。
**系统接口:** 此接口为系统接口。
此接口仅用于对应用的测试。| | uid | number | 是 | 否 | 进程的用户标识。 | -| groups | number[] | 是 | 否 | 带有补充组id的数组。
**系统接口:** 此接口为系统接口。
此接口仅用于对应用的测试。 | | pid | number | 是 | 否 | 当前进程的pid。 | -| ppid | number | 是 | 否 | 当前进程的父进程的pid。
**系统接口:** 此接口为系统接口。
此接口仅用于对应用的测试。 | | tid8+ | number | 是 | 否 | 当前线程的tid。 | @@ -120,50 +115,6 @@ let result = process.getPastCpuTime() ; ``` -## process.runCmd - -runCmd(command: string, options?: { timeout?: number, killSignal?: number | string, maxBuffer?: number }): ChildProcess - -通过runcmd可以fork一个新的进程来运行一段shell,并返回ChildProcess对象。 - -**系统接口:** 此接口为系统接口。 - -此接口仅用于对应用的测试。 - -**系统能力:** SystemCapability.Utils.Lang - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| command | string | 是 | shell命令。 | -| options | Object | 否 | 相关选项参数。 | - -**表1** options - -| 名称 | 参数类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| timeout | number | 否 | 子进程运行的毫秒数,当子进程运行时间超出此时间,则父进程发送killSignal信号给子进程。timeout默认为0。 | -| killSignal | number \| string | 否 | 子进程运行时间超出timeout时,父进程发送killSignal 信号给子进程。killSignal 默认为'SIGTERM'。 | -| maxBuffer | number | 否 | 子进程标准输入输出的最大缓冲区大小,当超出此大小时则终止子进程。maxBuffer默认1024\*1024。 | - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| [ChildProcess](#childprocess) | 子进程对象。 | - -**示例:** - -```js -let child = process.runCmd('ls', { maxBuffer : 2 }); -let result = child.wait(); -child.getOutput.then(val=>{ - console.log("child.getOutput = " + val); -}) -``` - - ## process.abort abort(): void @@ -179,118 +130,6 @@ process.abort(); ``` -## process.on - -on(type: string, listener: EventListener): void - -存储用户所触发的事件。 - -**系统接口:** 此接口为系统接口。 - -此接口仅用于对应用的测试。 - -**系统能力:** SystemCapability.Utils.Lang - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| type | string | 是 | 存储事件的type。 | -| listener | [EventListener](#eventlistener) | 是 | 回调的事件。 | - -**示例:** - -```js -process.on("data", (e)=>{ - console.log("data callback"); -}) -``` - - -## process.off - -off(type: string): boolean - -删除用户存储的事件。 - -**系统接口:** 此接口为系统接口。 - -此接口仅用于对应用的测试。 - -**系统能力:** SystemCapability.Utils.Lang - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| type | string | 是 | 删除事件的type。 | - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| boolean | 事件删除成功则返回true,没有成功则为false。| - -**示例:** - -```js -process.on("data", (e)=>{ - console.log("data callback"); -}) -let result = process.off("data"); -``` - - -## process.cwd - -cwd(): string - -获取进程的工作目录。 - -**系统接口:** 此接口为系统接口。 - -此接口仅用于对应用的测试。 - -**系统能力:** SystemCapability.Utils.Lang - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| string| 返回当前进程的工作目录。 | - -**示例:** - -```js -let path = process.cwd(); -``` - - -## process.chdir - -chdir(dir: string): void - -更改进程的当前工作目录。 - -**系统接口:** 此接口为系统接口。 - -此接口仅用于对应用的测试。 - -**系统能力:** SystemCapability.Utils.Lang - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| dir | string | 是 | 路径。 | - -**示例:** - -```js -process.chdir('/system'); -``` - - ## process.uptime uptime(): number @@ -729,156 +568,3 @@ let pro = new process.ProcessManager(); let pres = process.pid; let result = pro.kill(28, pres); ``` - - -## ChildProcess - -ChildProcess对象为创建的新的子进程,主进程可以获取子进程的标准输入输出,以及发送信号和关闭子进程,可以通过[process.runCmd](#processruncmd)获取ChildProcess对象。 - -**系统接口:** 此接口为系统接口。 - -### 属性 - -**系统接口:** 此接口为系统接口。 - -**系统能力:** SystemCapability.Utils.Lang - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| -------- | -------- | -------- | -------- | -------- | -| pid | number | 是 | 否 | 子进程的pid。
**系统接口:** 此接口为系统接口。
此接口仅用于对应用的测试。 | -| ppid | number | 是 | 否 | 子进程的父进程的pid。
**系统接口:** 此接口为系统接口。
此接口仅用于对应用的测试。 | -| exitCode | number | 是 | 否 | 子进程的退出码。
**系统接口:** 此接口为系统接口。
此接口仅用于对应用的测试。| -| killed | boolean | 是 | 否 | 父进程给子进程发信号是否成功。
**系统接口:** 此接口为系统接口。
此接口仅用于对应用的测试。 | - - -### wait - -wait(): Promise<number> - -等待子进程运行结束,返回promise对象,其值为子进程的退出码。 - -**系统接口:** 此接口为系统接口。 - -此接口仅用于对应用的测试。 - -**系统能力:** SystemCapability.Utils.Lang - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| Promise<number> | 异步返回子进程的退出码。 | - -**示例:** - -```js -let child = process.runCmd('ls'); -let result = child.wait(); -result.then(val=>{ - console.log("result = " + val); -}) -``` - - -### getOutput - -getOutput(): Promise<Uint8Array> - -获取子进程的标准输出。 - -**系统接口:** 此接口为系统接口。 - -此接口仅用于对应用的测试。 - -**系统能力:** SystemCapability.Utils.Lang - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| Promise<Uint8Array> | 异步返回标准输出的字节流。 | - -**示例:** - -```js -let child = process.runCmd('ls'); -let result = child.wait(); -child.getOutput().then(val=>{ - console.log("child.getOutput = " + val); -}) -``` - - -### getErrorOutput - -getErrorOutput(): Promise<Uint8Array> - -获取子进程的标准错误输出。 - -**系统接口:** 此接口为系统接口。 - -此接口仅用于对应用的测试。 - -**系统能力:** SystemCapability.Utils.Lang - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| Promise<Uint8Array> | 异步返回标准错误输出的字节流。 | - -**示例:** - -```js -let child = process.runCmd('madir test.text'); -let result = child.wait(); -child.getErrorOutput().then(val=>{ - console.log("child.getErrorOutput= " + val); -}) -``` - - -### close - -close(): void - -关闭正在运行的子进程。 - -**系统接口:** 此接口为系统接口。 - -此接口仅用于对应用的测试。 - -**系统能力:** SystemCapability.Utils.Lang - -**示例:** - -```js -let child = process.runCmd('sleep 5; ls'); -child.close(); -``` - - -### kill - -kill(signal: number | string): void - -用于发送信号给子进程,结束指定进程。 - -**系统接口:** 此接口为系统接口。 - -此接口仅用于对应用的测试。 - -**系统能力:** SystemCapability.Utils.Lang - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| signal | number \| string | 是 | 数字或字符串。 | - -**示例:** - -```js -let child = process.runCmd('sleep 5; ls'); -child.kill(9); -``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-radio.md b/zh-cn/application-dev/reference/apis/js-apis-radio.md index d7244da3bbc60c50798d1dabefa46a4019ce887d..d5f4ee95395aa236456f84b6a3dd34f932d5d7c0 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-radio.md +++ b/zh-cn/application-dev/reference/apis/js-apis-radio.md @@ -10,7 +10,7 @@ ## 导入模块 ``` -import radio from '@ohos.telephony.radio' +import radio from '@ohos.telephony.radio'; ``` ## radio.getRadioTech @@ -46,7 +46,7 @@ getRadioTech\(slotId: number, callback: AsyncCallback<\{psRadioTech: RadioTechno ```js let slotId = 0; -radio.getRadioTech(slotId, (err, data) =>{ +radio.getRadioTech(slotId, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -130,7 +130,7 @@ getNetworkState\(callback: AsyncCallback\): void **示例:** ```js -radio.getNetworkState((err, data) =>{ +radio.getNetworkState((err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-resource-manager.md b/zh-cn/application-dev/reference/apis/js-apis-resource-manager.md index e959b5c021035b4bef999fd8b78ecca9fc14b008..ad04193189eddfe65a2f6c3bd86650d6dc4f6c2a 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-resource-manager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-resource-manager.md @@ -19,8 +19,9 @@ import resourceManager from '@ohos.resourceManager'; Stage模型下Context的引用方法请参考[Stage模型的Context详细介绍](../..//application-models/application-context-stage.md)。 ```ts -import Ability from '@ohos.application.Ability'; -class MainAbility extends Ability { +import UIAbility from '@ohos.app.ability.UIAbility'; + +export default class EntryAbility extends UIAbility { onWindowStageCreate(windowStage) { let context = this.context; let resourceManager = context.resourceManager; diff --git a/zh-cn/application-dev/reference/apis/js-apis-router.md b/zh-cn/application-dev/reference/apis/js-apis-router.md index 4cd9ccf699f3f119698f291a20e9858b346f2edb..9c4f2642f11e9519ce50bd98b3a4339c9c18dc7e 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-router.md +++ b/zh-cn/application-dev/reference/apis/js-apis-router.md @@ -596,7 +596,7 @@ export default { // 在detail页面中 export default { onInit() { - console.info('showData1:' + router.getParams()[data1]); + console.info('showData1:' + router.getParams()['data1']); } } ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-rpc.md b/zh-cn/application-dev/reference/apis/js-apis-rpc.md index 9174039580bd0a5af8b344350a16d6a65b48c61e..b7a9e10eda1637ae4829929903570269f4a9b4b2 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-rpc.md +++ b/zh-cn/application-dev/reference/apis/js-apis-rpc.md @@ -5649,7 +5649,7 @@ asObject(): IRemoteObject return this; } } - let remoteObject = new TestAbility().asObject(); + let remoteObject = new TestAbility("testObject").asObject(); ``` **示例:** @@ -6058,7 +6058,7 @@ isObjectDead(): boolean **系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.IPC.Core。 -| 名称 | 默认值 | 说明 | +| 名称 | 值 | 说明 | | --------------------- | ----------------------- | --------------------------------- | | PING_TRANSACTION | 1599098439 (0x5f504e47) | 内部指令码,用于测试IPC服务正常。 | | DUMP_TRANSACTION | 1598311760 (0x5f444d50) | 内部指令码,获取Binder内部状态。 | @@ -6974,7 +6974,7 @@ isObjectDead(): boolean **系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.IPC.Core。 - | 名称 | 默认值 | 说明 | + | 名称 | 值 | 说明 | | ------------- | ---- | ----------------------------------------------------------- | | TF_SYNC | 0 | 同步调用标识。 | | TF_ASYNC | 1 | 异步调用标识。 | @@ -8259,13 +8259,13 @@ getDescriptor(): string } } let testRemoteObject = new TestRemoteObject("testObject"); + console.log("RpcServer: descriptor is: " + descriptor); try { let descriptor = testRemoteObject.getDescriptor(); } catch(error) { console.info("rpc get local interface fail, errorCode " + error.code); console.info("rpc get local interface fail, errorMessage " + error.message); } - console.log("RpcServer: descriptor is: " + descriptor); ``` ### getInterfaceDescriptor(deprecated) @@ -8340,8 +8340,8 @@ modifyLocalInterface(localInterface: IRemoteBroker, descriptor: string): void try { this.modifyLocalInterface(this, descriptor); } catch(error) { - console.info(rpc attach local interface fail, errorCode " + error.code); - console.info(rpc attach local interface fail, errorMessage " + error.message); + console.info(" rpc attach local interface fail, errorCode " + error.code); + console.info(" rpc attach local interface fail, errorMessage " + error.message); } } registerDeathRecipient(recipient: MyDeathRecipient, flags: number) { @@ -8414,7 +8414,7 @@ attachLocalInterface(localInterface: IRemoteBroker, descriptor: string): void 映射内存保护类型: - | 名称 | 默认值 | 说明 | + | 名称 | 值 | 说明 | | ---------- | --- | ------------------ | | PROT_EXEC | 4 | 映射的内存可执行 | | PROT_NONE | 0 | 映射的内存不可访问 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-screen-lock.md b/zh-cn/application-dev/reference/apis/js-apis-screen-lock.md index c2489044571a00f59297c578f4e29c381857954b..2f2768c1d8203b5e2dc056d40a124dc037d1cdef 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-screen-lock.md +++ b/zh-cn/application-dev/reference/apis/js-apis-screen-lock.md @@ -12,12 +12,14 @@ import screenlock from '@ohos.screenLock'; ``` -## EventType +## EventType9+ 定义系统事件类型。 **系统能力:** SystemCapability.MiscServices.ScreenLock +**系统接口**:此接口为系统接口。 + | 事件类型 | 说明 | | ------------------ | ------------------------ | | beginWakeUp | 表示设备开始唤醒。 | @@ -35,15 +37,17 @@ import screenlock from '@ohos.screenLock'; | screenlockEnabled | 表示锁屏是否启用。 | | serviceRestart | 表示锁屏服务进行重启。 | -## SystemEvent +## SystemEvent9+ 定义系统事件回调参数结构。 **系统能力:** SystemCapability.MiscServices.ScreenLock +**系统接口**:此接口为系统接口。 + | 名称 | 类型 | 必填 | 说明 | | --------- | ------ | ---- | ------------- | -| eventType | [EventType](#eventtype) | 是 | 系统事件类型。 | +| eventType | [EventType](#eventtype9) | 是 | 系统事件类型。 | | params | string | 是 | 系统事件参数。 | ## screenlock.isLocked9+ @@ -204,7 +208,7 @@ onSystemEvent(callback: Callback<SystemEvent>): boolean | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------- | ---- | ----------------- | -| callback | Callback\<[SystemEvent](#systemevent)> | 是 | 锁屏相关的系统事件回调函数。 | +| callback | Callback\<[SystemEvent](#systemevent9)> | 是 | 锁屏相关的系统事件回调函数。 | **返回值:** @@ -226,7 +230,7 @@ try { ## screenlock.sendScreenLockEvent9+ -sendScreenLockEvent(event: string, parameter: number, callback: AsyncCallback<boolean>): void +sendScreenLockEvent(event: String, parameter: number, callback: AsyncCallback<boolean>): void 应用发送事件到锁屏服务。使用callback异步回调。 @@ -238,7 +242,7 @@ sendScreenLockEvent(event: string, parameter: number, callback: AsyncCallback< | 参数名 | 类型 | 必填 | 说明 | | --------- | ------------------------ | ---- | -------------------- | -| event | string | 是 | 事件类型,支持如下取值:
- "unlockScreenResult",表示解锁结果。
- "lockScreenResult",表示锁屏结果。
- "screenDrawDone",表示屏幕绘制完成。 | +| event | String | 是 | 事件类型,支持如下取值:
- "unlockScreenResult",表示解锁结果。
- "lockScreenResult",表示锁屏结果。
- "screenDrawDone",表示屏幕绘制完成。 | | parameter | number | 是 | 事件结果。
- parameter为0,表示成功。例如解锁成功或锁屏成功。
- parameter为1,表示失败。例如解锁失败或锁屏失败。
- parameter为2,表示取消。例如锁屏取消或解锁取消。 | | callback | AsyncCallback\ | 是 | 回调函数。返回true表示发送事件成功;返回false表示发送事件失败。 | @@ -256,7 +260,7 @@ screenlock.sendScreenLockEvent('unlockScreenResult', 0, (err, result) => { ## screenlock.sendScreenLockEvent9+ -sendScreenLockEvent(event: string, parameter: number): Promise<boolean> +sendScreenLockEvent(event: String, parameter: number): Promise<boolean> 应用发送事件到锁屏服务。使用Promise异步回调。 @@ -268,7 +272,7 @@ sendScreenLockEvent(event: string, parameter: number): Promise<boolean> | 参数名 | 类型 | 必填 | 说明 | | --------- | ------ | ---- | --------------------------------------- | -| event | string | 是 | 事件类型,支持如下取值:
- "unlockScreenResult",表示解锁结果。
- "lockScreenResult",表示锁屏结果。
- "screenDrawDone",表示屏幕绘制完成。 | +| event | String | 是 | 事件类型,支持如下取值:
- "unlockScreenResult",表示解锁结果。
- "lockScreenResult",表示锁屏结果。
- "screenDrawDone",表示屏幕绘制完成。 | | parameter | number | 是 | 事件结果。
- parameter为0,表示成功。例如解锁成功或锁屏成功。
- parameter为1,表示失败。例如解锁失败或锁屏失败。
- parameter为2,表示取消。例如锁屏取消或解锁取消。 | **返回值:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-sensor.md b/zh-cn/application-dev/reference/apis/js-apis-sensor.md index 73b75b5381307ae355769a5426e3beb67cd6db52..efc9e2fd88f27e7ee23637fa2e7895b839e3f329 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-sensor.md +++ b/zh-cn/application-dev/reference/apis/js-apis-sensor.md @@ -2660,7 +2660,7 @@ try { ## sensor.getAngleVariation9+ getAngleVariation(currentRotationMatrix: Array<number>, preRotationMatrix: Array<number>, - callback: AsyncCallback): void + callback: AsyncCallback<Array<number>>): void 计算两个旋转矩阵之间的角度变化。 @@ -2716,7 +2716,7 @@ try { ## sensor.getAngleVariation9+ -getAngleVariation(currentRotationMatrix: Array<number>, preRotationMatrix: Array<number>): Promise +getAngleVariation(currentRotationMatrix: Array<number>, preRotationMatrix: Array<number>): Promise<Array<number>> 得到两个旋转矩阵之间的角度变化。 @@ -2776,7 +2776,7 @@ try { ## sensor.getRotationMatrix9+ -getRotationMatrix(rotationVector: Array<number>, callback: AsyncCallback): void +getRotationMatrix(rotationVector: Array<number>, callback: AsyncCallback<Array<number>>): void 根据旋转矢量获取旋转矩阵。 @@ -2818,7 +2818,7 @@ try { ## sensor.getRotationMatrix9+ -getRotationMatrix(rotationVector: Array<number>): Promise +getRotationMatrix(rotationVector: Array<number>): Promise<Array<number>> 根据旋转矢量获取旋转矩阵。 @@ -2865,7 +2865,7 @@ try { ## sensor.transformRotationMatrix9+ transformRotationMatrix(inRotationVector: Array<number>, coordinates: CoordinatesOptions, - callback: AsyncCallback): void + callback: AsyncCallback<Array<number>>): void 根据指定坐标系映射旋转矩阵。 @@ -2912,7 +2912,7 @@ try { ## sensor.transformRotationMatrix9+ -transformRotationMatrix(inRotationVector: Array<number>, coordinates: CoordinatesOptions): Promise +transformRotationMatrix(inRotationVector: Array<number>, coordinates: CoordinatesOptions): Promise<Array<number>> 根据指定坐标系映射旋转矩阵。 @@ -2963,7 +2963,7 @@ try { ## sensor.getQuaternion9+ -getQuaternion(rotationVector: Array<number>, callback: AsyncCallback): void +getQuaternion(rotationVector: Array<number>, callback: AsyncCallback<Array<number>>): void 根据旋转向量计算归一化四元数。 @@ -3005,7 +3005,7 @@ try { ## sensor.getQuaternion9+ -getQuaternion(rotationVector: Array<number>): Promise +getQuaternion(rotationVector: Array<number>): Promise<Array<number>> 根据旋转向量计算归一化四元数。 @@ -3051,7 +3051,7 @@ try { ## sensor.getOrientation9+ -getOrientation(rotationMatrix: Array<number>, callback: AsyncCallback): void +getOrientation(rotationMatrix: Array<number>, callback: AsyncCallback<Array<number>>): void 根据旋转矩阵计算设备方向。 @@ -3100,7 +3100,7 @@ try { ## sensor.getOrientation9+ -getOrientation(rotationMatrix: Array<number>): Promise +getOrientation(rotationMatrix: Array<number>): Promise<Array<number>> 根据旋转矩阵计算设备的方向。 @@ -3192,7 +3192,7 @@ try { ## sensor.getRotationMatrix9+ -getRotationMatrix(gravity: Array<number>, geomagnetic: Array<number>,): Promise<RotationMatrixResponse> +getRotationMatrix(gravity: Array<number>, geomagnetic: Array<number>): Promise<RotationMatrixResponse> 根据重力矢量和地磁矢量计算旋转矩阵。 @@ -3238,7 +3238,7 @@ try { ## sensor.getSensorList9+ -getSensorList(callback: AsyncCallback): void +getSensorList(callback: AsyncCallback<Array<Sensor>>): void 获取设备上的所有传感器信息。 @@ -3248,7 +3248,7 @@ getSensorList(callback: AsyncCallback): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------------------------------------- | ---- | ---------------- | -| callback | AsyncCallback | 是 | 回调函数,返回传感器属性列表。 | +| callback | AsyncCallback<Array<[Sensor](#sensor9)>> | 是 | 回调函数,返回传感器属性列表。 | **错误码**: @@ -3278,7 +3278,7 @@ try { ## sensor.getSensorList9+ - getSensorList(): Promise< Array<Sensor>> + getSensorList(): Promise<Array<Sensor>> 获取设备上的所有传感器信息。 @@ -3288,7 +3288,7 @@ try { | 参数名 | 类型 | 必填 | 说明 | | ------- | ---------------------------------------- | ---- | ---------------- | -| promise | Promise | 是 | Promise对象,返回传感器属性列表。 | +| promise | Promise<Array<[Sensor](#sensor9)>> | 是 | Promise对象,返回传感器属性列表。 | **错误码**: diff --git a/zh-cn/application-dev/reference/apis/js-apis-socket.md b/zh-cn/application-dev/reference/apis/js-apis-socket.md index 1659644ba57a226828422a0d1576acda37a64000..944301f6c5509de4702c4535529b73987f310208 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-socket.md +++ b/zh-cn/application-dev/reference/apis/js-apis-socket.md @@ -53,6 +53,13 @@ bind\(address: NetAddress, callback: AsyncCallback\): void | address | [NetAddress](#netaddress) | 是 | 目标地址信息,参考[NetAddress](#netaddress)。 | | callback | AsyncCallback\ | 是 | 回调函数。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | + **示例:** ```js @@ -83,6 +90,12 @@ bind\(address: NetAddress\): Promise | ------- | ---------------------------------- | ---- | ------------------------------------------------------ | | address | [NetAddress](#netaddress) | 是 | 目标地址信息,参考[NetAddress](#netaddress)。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | **返回值:** @@ -122,6 +135,13 @@ send\(options: UDPSendOptions, callback: AsyncCallback\): void | options | [UDPSendOptions](#udpsendoptions) | 是 | UDPSocket发送参数,参考[UDPSendOptions](#udpsendoptions)。 | | callback | AsyncCallback\ | 是 | 回调函数。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | + **示例:** ```js @@ -161,6 +181,13 @@ send\(options: UDPSendOptions\): Promise | ------- | ---------------------------------------- | ---- | ------------------------------------------------------------ | | options | [UDPSendOptions](#udpsendoptions) | 是 | UDPSocket发送参数,参考[UDPSendOptions](#udpsendoptions)。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | + **返回值:** | 类型 | 说明 | @@ -265,6 +292,12 @@ getState\(callback: AsyncCallback\): void | -------- | ------------------------------------------------------ | ---- | ---------- | | callback | AsyncCallback<[SocketStateBase](#socketstatebase)> | 是 | 回调函数。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------- | +| 201 | Permission denied. | + **示例:** ```js @@ -345,6 +378,12 @@ setExtraOptions\(options: UDPExtraOptions, callback: AsyncCallback\): voi | options | [UDPExtraOptions](#udpextraoptions) | 是 | UDPSocket连接的其他属性,参考[UDPExtraOptions](#udpextraoptions)。 | | callback | AsyncCallback\ | 是 | 回调函数。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | **示例:** @@ -398,6 +437,13 @@ setExtraOptions\(options: UDPExtraOptions\): Promise | :-------------- | :--------------------------------------------------- | | Promise\ | 以Promise形式返回设置UDPSocket连接的其他属性的结果。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | + **示例:** ```js @@ -562,7 +608,6 @@ on\(type: 'error', callback: ErrorCallback\): void | type | string | 是 | 订阅的事件类型。'error':error事件。 | | callback | ErrorCallback | 是 | 回调函数。 | - **示例:** ```js @@ -667,6 +712,12 @@ Socket的连接信息。 | port | number | 是 | 端口号,范围0~65535。 | | size | number | 是 | 服务器响应信息的字节长度。 | +## UDP 错误码说明 + +UDP 其余错误码映射形式为:2301000 + Linux内核错误码。 + +错误码的详细介绍参见[Socket错误码](../errorcodes/errorcode-net-socket.md) + ## socket.constructTCPSocketInstance constructTCPSocketInstance\(\): TCPSocket @@ -709,6 +760,12 @@ bind\(address: NetAddress, callback: AsyncCallback\): void | address | [NetAddress](#netaddress) | 是 | 目标地址信息,参考[NetAddress](#netaddress)。 | | callback | AsyncCallback\ | 是 | 回调函数。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | **示例:** @@ -746,6 +803,13 @@ bind\(address: NetAddress\): Promise | :-------------- | :------------------------------------------------------- | | Promise\ | 以Promise形式返回TCPSocket绑定本机的IP地址和端口的结果。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | + **示例:** ```js @@ -776,6 +840,13 @@ connect\(options: TCPConnectOptions, callback: AsyncCallback\): void | options | [TCPConnectOptions](#tcpconnectoptions) | 是 | TCPSocket连接的参数,参考[TCPConnectOptions](#tcpconnectoptions)。 | | callback | AsyncCallback\ | 是 | 回调函数。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | + **示例:** ```js @@ -812,6 +883,13 @@ connect\(options: TCPConnectOptions\): Promise | :-------------- | :--------------------------------------------------------- | | Promise\ | 以Promise形式返回TCPSocket连接到指定的IP地址和端口的结果。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | + **示例:** ```js @@ -845,6 +923,13 @@ send\(options: TCPSendOptions, callback: AsyncCallback\): void | options | [TCPSendOptions](#tcpsendoptions) | 是 | TCPSocket发送请求的参数,参考[TCPSendOptions](#tcpsendoptions)。 | | callback | AsyncCallback\ | 是 | 回调函数。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | + **示例:** ```js @@ -892,6 +977,13 @@ send\(options: TCPSendOptions\): Promise | :-------------- | :------------------------------------------------- | | Promise\ | 以Promise形式返回通过TCPSocket连接发送数据的结果。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | + **示例:** ```js @@ -929,6 +1021,11 @@ close\(callback: AsyncCallback\): void | -------- | --------------------- | ---- | ---------- | | callback | AsyncCallback\ | 是 | 回调函数。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------- | +| 201 | Permission denied. | **示例:** @@ -960,6 +1057,12 @@ close\(\): Promise | :-------------- | :----------------------------------------- | | Promise\ | 以Promise形式返回关闭TCPSocket连接的结果。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------- | +| 201 | Permission denied. | + **示例:** ```js @@ -992,6 +1095,12 @@ getRemoteAddress\(callback: AsyncCallback\): void | -------- | ------------------------------------------------- | ---- | ---------- | | callback | AsyncCallback<[NetAddress](#netaddress)> | 是 | 回调函数。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------- | +| 201 | Permission denied. | + **示例:** ```js @@ -1031,6 +1140,12 @@ getRemoteAddress\(\): Promise | :------------------------------------------ | :------------------------------------------ | | Promise<[NetAddress](#netaddress)> | 以Promise形式返回获取对端socket地址的结果。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------- | +| 201 | Permission denied. | + **示例:** ```js @@ -1069,6 +1184,11 @@ getState\(callback: AsyncCallback\): void | -------- | ------------------------------------------------------ | ---- | ---------- | | callback | AsyncCallback<[SocketStateBase](#socketstatebase)> | 是 | 回调函数。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------- | +| 201 | Permission denied. | **示例:** @@ -1109,6 +1229,11 @@ getState\(\): Promise | :----------------------------------------------- | :----------------------------------------- | | Promise<[SocketStateBase](#socketstatebase)> | 以Promise形式返回获取TCPSocket状态的结果。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------- | +| 201 | Permission denied. | **示例:** @@ -1149,6 +1274,13 @@ setExtraOptions\(options: TCPExtraOptions, callback: AsyncCallback\): voi | options | [TCPExtraOptions](#tcpextraoptions) | 是 | TCPSocket连接的其他属性,参考[TCPExtraOptions](#tcpextraoptions)。 | | callback | AsyncCallback\ | 是 | 回调函数。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | + **示例:** ```js @@ -1203,6 +1335,12 @@ setExtraOptions\(options: TCPExtraOptions\): Promise | :-------------- | :--------------------------------------------------- | | Promise\ | 以Promise形式返回设置TCPSocket连接的其他属性的结果。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | **示例:** @@ -1304,7 +1442,6 @@ on\(type: 'connect' | 'close', callback: Callback\): void | type | string | 是 | 订阅的事件类型。
- 'connect':连接事件。
- 'close':关闭事件。 | | callback | Callback\ | 是 | 回调函数。 | - **示例:** ```js @@ -1453,6 +1590,12 @@ TCPSocket连接的其他属性。 | reuseAddress | boolean | 否 | 是否重用地址。默认为false。 | | socketTimeout | number | 否 | 套接字超时时间,单位毫秒(ms)。 | +## TCP 错误码说明 + +TCP 其余错误码映射形式为:2301000 + Linux内核错误码。 + +错误码的详细介绍参见[Socket错误码](../errorcodes/errorcode-net-socket.md) + ## socket.constructTLSSocketInstance9+ constructTLSSocketInstance(): TLSSocket @@ -1766,7 +1909,6 @@ connect(options: TLSConnectOptions, callback: AsyncCallback\): void | 2303104 | Interrupted system call. | | 2303109 | Bad file number. | | 2303111 | Resource temporarily unavailable try again. | -| 2303113 | System permission denied. | | 2303188 | Socket operation on non-socket. | | 2303191 | Protocol wrong type for socket. | | 2303198 | Address already in use. | @@ -1783,7 +1925,7 @@ connect(options: TLSConnectOptions, callback: AsyncCallback\): void ```js let tlsTwoWay = socket.constructTLSSocketInstance(); // Two way authentication -tlsTwoWay.bind({address: '192.168.xxx.xxx', port: xxxx, family: 1}, err => { +tlsTwoWay.bind({address: '192.168.xxx.xxx', port: 8080, family: 1}, err => { if (err) { console.log('bind fail'); return; @@ -1794,14 +1936,14 @@ let options = { ALPNProtocols: ["spdy/1", "http/1.1"], address: { address: "192.168.xx.xxx", - port: xxxx, + port: 8080, family: 1, }, secureOptions: { key: "xxxx", cert: "xxxx", ca: ["xxxx"], - passwd: "xxxx", + password: "xxxx", protocols: [socket.Protocol.TLSv12], useRemoteCipherPrefer: true, signatureAlgorithms: "rsa_pss_rsae_sha256:ECDSA+SHA256", @@ -1809,12 +1951,12 @@ let options = { }, }; tlsTwoWay.connect(options, (err, data) => { - console.error(err); - console.log(data); + console.error("connect callback error"+err); + console.log(JSON.stringify(data)); }); let tlsOneWay = socket.constructTLSSocketInstance(); // One way authentication -tlsOneWay.bind({address: '192.168.xxx.xxx', port: xxxx, family: 1}, err => { + tlsOneWay.bind({address: '192.168.xxx.xxx', port: 8080, family: 1}, err => { if (err) { console.log('bind fail'); return; @@ -1824,7 +1966,7 @@ tlsOneWay.bind({address: '192.168.xxx.xxx', port: xxxx, family: 1}, err => { let oneWayOptions = { address: { address: "192.168.xxx.xxx", - port: xxxx, + port: 8080, family: 1, }, secureOptions: { @@ -1833,8 +1975,8 @@ let oneWayOptions = { }, }; tlsOneWay.connect(oneWayOptions, (err, data) => { - console.error(err); - console.log(data); + console.error("connect callback error"+err); + console.log(JSON.stringify(data)); }); ``` @@ -1866,7 +2008,6 @@ connect(options: TLSConnectOptions): Promise\ | 2303104 | Interrupted system call. | | 2303109 | Bad file number. | | 2303111 | Resource temporarily unavailable try again. | -| 2303113 | System permission denied. | | 2303188 | Socket operation on non-socket. | | 2303191 | Protocol wrong type for socket. | | 2303198 | Address already in use. | @@ -1883,7 +2024,7 @@ connect(options: TLSConnectOptions): Promise\ ```js let tlsTwoWay = socket.constructTLSSocketInstance(); // Two way authentication -tlsTwoWay.bind({address: '192.168.xxx.xxx', port: xxxx, family: 1}, err => { +tlsTwoWay.bind({address: '192.168.xxx.xxx', port: 8080, family: 1}, err => { if (err) { console.log('bind fail'); return; @@ -1894,14 +2035,14 @@ let options = { ALPNProtocols: ["spdy/1", "http/1.1"], address: { address: "xxxx", - port: xxxx, + port: 8080, family: 1, }, secureOptions: { key: "xxxx", cert: "xxxx", ca: ["xxxx"], - passwd: "xxxx", + password: "xxxx", protocols: [socket.Protocol.TLSv12], useRemoteCipherPrefer: true, signatureAlgorithms: "rsa_pss_rsae_sha256:ECDSA+SHA256", @@ -1909,13 +2050,13 @@ let options = { }, }; tlsTwoWay.connect(options).then(data => { - console.log(data); + console.log(JSON.stringify(data)); }).catch(err => { console.error(err); }); let tlsOneWay = socket.constructTLSSocketInstance(); // One way authentication -tlsOneWay.bind({address: '192.168.xxx.xxx', port: xxxx, family: 1}, err => { +tlsOneWay.bind({address: '192.168.xxx.xxx', port: 8080, family: 1}, err => { if (err) { console.log('bind fail'); return; @@ -1925,7 +2066,7 @@ tlsOneWay.bind({address: '192.168.xxx.xxx', port: xxxx, family: 1}, err => { let oneWayOptions = { address: { address: "192.168.xxx.xxx", - port: xxxx, + port: 8080, family: 1, }, secureOptions: { @@ -1934,7 +2075,7 @@ let oneWayOptions = { }, }; tlsOneWay.connect(oneWayOptions).then(data => { - console.log(data); + console.log(JSON.stringify(data)); }).catch(err => { console.error(err); }); @@ -2263,7 +2404,7 @@ getCipherSuite(): Promise\> ```js tls.getCipherSuite().then(data => { - console.log(data); + console.log('getCipherSuite success:' + JSON.stringify(data)); }).catch(err => { console.error(err); }); @@ -2327,7 +2468,7 @@ getSignatureAlgorithms(): Promise\> ```js tls.getSignatureAlgorithms().then(data => { - console.log(data); + console.log("getSignatureAlgorithms success" + data); }).catch(err => { console.error(err); }); @@ -2503,7 +2644,7 @@ TLS安全相关操作,其中ca证书为必选参数,其他参数为可选参 | ca | string \| Array\ | 是 | 服务端的ca证书,用于认证校验服务端的数字证书。| | cert | string | 否 | 本地客户端的数字证书。 | | key | string | 否 | 本地数字证书的私钥。 | -| passwd | string | 否 | 读取私钥的密码。 | +| password | string | 否 | 读取私钥的密码。 | | protocols | [Protocol](#protocol9) \|Array\<[Protocol](#protocol9)> | 否 | TLS的协议版本。 | | useRemoteCipherPrefer | boolean | 否 | 优先使用对等方的密码套件。 | | signatureAlgorithms | string | 否 | 通信过程中的签名算法。 | @@ -2528,4 +2669,4 @@ TLS通信的协议版本。 | 类型 | 说明 | | --------------------------------------------------------------------- | --------------------- | -|[cryptoFramework.EncodingBlob](js-apis-cryptoFramework.md#datablob) | 存储证书的数据和编码格式 | \ No newline at end of file +|[cryptoFramework.EncodingBlob](js-apis-cryptoFramework.md#datablob) | 存储证书的数据和编码格式 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-battery.md b/zh-cn/application-dev/reference/apis/js-apis-system-battery.md index 17967892eb76429700751046bc18e32a5aa25c88..d917ea5ff7e1bc5e234295b4072083fd6184572e 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-battery.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-battery.md @@ -25,7 +25,7 @@ getStatus(options?: GetStatusOptions): void; **参数:** -| 参数名 | 类型 | 必填 | 说明 | +| 名称 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | options | [GetStatusOptions](#getstatusoptions) | 否 | 包含接口调用结果的对象。 | @@ -46,7 +46,9 @@ battery.getStatus({ 包含接口调用结果的对象。 -| 参数名 | 类型 | 必填 | 说明 | +**系统能力:** SystemCapability.PowerManager.BatteryManager.Core + +| 名称 | 类型 | 必填 | 说明 | | -------- | --------------------------------------------------- | ---- | ------------------------------------------------------------ | | success | (data: [BatteryResponse](#batteryresponse)) => void | 否 | 接口调用成功的回调函数,data为[BatteryResponse](#batteryresponse)类型的返回值。 | | fail | (data: string, code: number) => void | 否 | 接口调用失败的回调函数。data为错误信息,code为错误码。 | @@ -56,7 +58,9 @@ battery.getStatus({ 包含充电状态及剩余电量的对象。 -| 参数名 | 类型 | 说明 | -| -------- | -------- | -------- | -| charging | boolean | 当前电池是否在充电中。 | -| level | number | 当前电池的电量,取值范围:0.00 - 1.00 。 | +**系统能力:** SystemCapability.PowerManager.BatteryManager.Core + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| -------- | -------- | -------- | -------- | -------- | +| charging | boolean | 是 | 否 | 当前电池是否在充电中。 | +| level | number | 是 | 否 | 当前电池的电量,取值范围:0.00 - 1.00 。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-brightness.md b/zh-cn/application-dev/reference/apis/js-apis-system-brightness.md index e9039e94424ca59f0acb972f3bf15e5156ba5aee..a47d9f3f50105c77c3d52411358b95ffdca8c6b5 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-brightness.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-brightness.md @@ -45,7 +45,7 @@ getValue(options?: GetBrightnessOptions): void ## brightness.setValue -etValue(options?: SetBrightnessOptions): void +setValue(options?: SetBrightnessOptions): void 设置设备当前的屏幕亮度值。 @@ -74,7 +74,7 @@ etValue(options?: SetBrightnessOptions): void ## brightness.getMode -getMode(options?: GetBrightnessModeOptions: void +getMode(options?: GetBrightnessModeOptions): void 获得当前屏幕亮度模式。 @@ -161,6 +161,8 @@ setKeepScreenOn(options?: SetKeepScreenOnOptions): void 获取屏幕亮度的参数对象。 +**系统能力:** SystemCapability.PowerManager.DisplayPowerManager + | 名称 | 类型 | 必填 | 说明 | | -------- | --------------------------------------------------------- | ---- | ------------------------------------------------------------ | | success | (data: [BrightnessResponse](#brightnessresponse)) => void | 否 | 接口调用成功的回调函数。data为[BrightnessResponse](#brightnessresponse)类型的返回值。 | @@ -171,6 +173,8 @@ setKeepScreenOn(options?: SetKeepScreenOnOptions): void 设置屏幕亮度的参数对象。 +**系统能力:** SystemCapability.PowerManager.DisplayPowerManager + | 名称 | 类型 | 必填 | 说明 | | -------- | ------------------------------------ | ---- | ------------------------------------------------------------ | | value | number | 是 | 屏幕亮度,值为1-255之间的整数。
- 如果值小于等于0,系统按1处理。
- 如果值大于255,系统按255处理。
- 如果值为小数,系统将处理为整数。例如设置为8.1,系统按8处理。 | @@ -182,14 +186,18 @@ setKeepScreenOn(options?: SetKeepScreenOnOptions): void 包含屏幕亮度的对象。 -| 名称 | 类型 | 说明 | -| -------- | -------- | -------- | -| value | number | 屏幕亮度,范围:1到255。 | +**系统能力:** SystemCapability.PowerManager.DisplayPowerManager + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| -------- | -------- | -------- | -------- | -------- | +| value | number | 是 | 否 | 屏幕亮度,范围:1到255。 | ## GetBrightnessModeOptions 获取屏幕亮度模式的参数对象。 +**系统能力:** SystemCapability.PowerManager.DisplayPowerManager + | 名称 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | success | (data: [BrightnessModeResponse](#brightnessmoderesponse)) => void | 否 | 接口调用成功的回调函数。data为[BrightnessModeResponse](#brightnessmoderesponse)类型的返回值。 | @@ -200,6 +208,8 @@ setKeepScreenOn(options?: SetKeepScreenOnOptions): void 设置屏幕亮度模式的参数对象。 +**系统能力:** SystemCapability.PowerManager.DisplayPowerManager + | 名称 | 类型 | 必填 | 说明 | | -------- | ------------------------------------ | ---- | ------------------------------------------------------ | | mode | number | 是 | 0表示手动调节屏幕亮度模式,1表示自动调节屏幕亮度模式。 | @@ -211,14 +221,18 @@ setKeepScreenOn(options?: SetKeepScreenOnOptions): void 包含屏幕亮度模式的对象。 -| 名称 | 类型 | 说明 | -| -------- | -------- | -------- | -| mode | number | 0表示手动调节屏幕亮度模式,1表示自动调节屏幕亮度模式。 | +**系统能力:** SystemCapability.PowerManager.DisplayPowerManager + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| -------- | -------- | -------- | -------- | -------- | +| mode | number | 是 | 否 | 0表示手动调节屏幕亮度模式,1表示自动调节屏幕亮度模式。 | ## SetKeepScreenOnOptions 设置屏幕常亮的参数对象。 +**系统能力:** SystemCapability.PowerManager.DisplayPowerManager + | 名称 | 类型 | 必填 | 说明 | | ------------ | ------------------------------------ | ---- | ------------------------------------------------------ | | keepScreenOn | boolean | 是 | true表示保持屏幕常亮,false表示取消屏幕常亮。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-date-time.md b/zh-cn/application-dev/reference/apis/js-apis-system-date-time.md index c3e97f5085d47faf62857bfc92c120d86a9927c2..8d4015e345a50ece149775ae90c792f29f8a4755 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-date-time.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-date-time.md @@ -193,7 +193,7 @@ getRealActiveTime(isNano: boolean, callback: AsyncCallback<number>): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------- | ---- | -------------------------- | | isNano | boolean | 是 | 返回结果是否为纳秒数。
- true:表示返回结果为纳秒数(ns)。
- false:表示返回结果为毫秒数(ms)。 | -| callback | AsyncCallback<number> | 是 | 回调函数,返回自系统启动以来经过的时间,但不包括度睡眠时间。 | +| callback | AsyncCallback<number> | 是 | 回调函数,返回自系统启动以来经过的时间,但不包括深度睡眠时间。 | **示例:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-fetch.md b/zh-cn/application-dev/reference/apis/js-apis-system-fetch.md index f6c7b4b5eb360d1bf4cf18c3ddd37450445be811..ed8c646e3d6082c779bd9e02b726cc4c634dbac0 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-fetch.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-fetch.md @@ -45,11 +45,11 @@ fetch(Object): void ## FetchResponse -| 参数名 | 类型 | 说明 | -| -------- | -------- | -------- | -| code | number | 表示服务器的状态code。 | -| data | string \| Object | 返回数据类型由responseType确定,详见表 responseType与success中data关系。 | -| headers | Object | 表示服务器response的所有header。 | +| 参数名 | 类型 | 可读 | 可写 | 说明 | +| -------- | -------- | -------- | -------- | -------- | +| code | number | 是 | 否 | 表示服务器的状态code。 | +| data | string \| Object | 是 | 否 | 返回数据类型由responseType确定,详见表 responseType与success中data关系。 | +| headers | Object | 是 | 否 | 表示服务器response的所有header。 | **表2** responseType与success中data关系 diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-network.md b/zh-cn/application-dev/reference/apis/js-apis-system-network.md index 7ac1f1ea18ba295deea28cfa49a3cd49018d6b7b..dafd8dfb0cc77456536366353b7b3a3a01e9851b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-network.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-network.md @@ -2,7 +2,7 @@ > **说明:** > - 从API Version 7 开始,该接口不再维护,推荐使用新接口[`@ohos.telephony.observer`](js-apis-observer.md)。 -> +> > - 本模块首批接口从API version 3开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 @@ -122,7 +122,9 @@ export default { ## NetworkResponse -| 参数名 | 类型 | 说明 | -| -------- | -------- | -------- | -| metered | boolean | 是否按照流量计费。 | -| type | string | 网络类型,可能的值有2g,3g,4g,5g,wifi,none等。 | \ No newline at end of file +**系统能力:** SystemCapability.Communication.NetManager.Core + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| metered | boolean | 否 |是否按照流量计费。 | +| type | string | 是|网络类型,可能的值有2g,3g,4g,5g,wifi,none等。 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-notification.md b/zh-cn/application-dev/reference/apis/js-apis-system-notification.md index de75ed99a66540804acb0900340c3c0738ee3ec9..4dcc9726aec6906ef7dd95b2139ad51fe095f751 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-notification.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-notification.md @@ -17,22 +17,22 @@ import notification from '@system.notification'; **系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification -| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | -| ----------- | --- | ---- | ---------------------------------------------- | ---- | ------------------------- | -| bundleName | 是 | 是 | string | 是 | 单击通知后要重定向到的应用程序的Bundle名。 | -| abilityName | 是 | 是 | string | 是 | 单击通知后要重定向到的应用程序的Ability名称。 | -| uri | 是 | 是 | string | 否 | 要重定向到的页面的uri。 | +| 名称 | 类型 | 必填 | 说明 | +| ----------- | ---------------------------------------------- | ---- | ------------------------- | +| bundleName | string | 是 | 单击通知后要重定向到的应用程序的Bundle名。 | +| abilityName | string | 是 | 单击通知后要重定向到的应用程序的Ability名称。 | +| uri | string | 否 | 要重定向到的页面的uri。 | ## ShowNotificationOptions **系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification -| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | -| ------------- | --- | ---- | ---------------------------------------------- | ---- | ------------------------- | -| contentTitle | 是 | 是 | string | 否 | 通知标题。 | -| contentText | 是 | 是 | string | 否 | 通知内容。 | -| clickAction | 是 | 是 | ActionResult | 否 | 通知被点击后触发的行为。 | +| 名称 | 类型 | 必填 | 说明 | +| ------------- | ---------------------------------------------- | ---- | ------------------------- | +| contentTitle | string | 否 | 通知标题。 | +| contentText | string | 否 | 通知内容。 | +| clickAction | ActionResult | 否 | 通知被点击后触发的行为。 | ## notification.show diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-package.md b/zh-cn/application-dev/reference/apis/js-apis-system-package.md index d6fe62baaa1041b6cfbe0620aa7701e0dc592da9..53b3d08dbc4cac86f470e15756836c6e4953338f 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-package.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-package.md @@ -23,8 +23,6 @@ hasInstalled(options: CheckPackageHasInstalledOptions): void 查询指定应用是否存在,或者原生应用是否安装。 -**需要权限:** None - **系统能力:** SystemCapability.BundleManager.BundleFramework **参数:** @@ -65,7 +63,7 @@ export default { **系统能力:** SystemCapability.BundleManager.BundleFramework。 -| 参数名 | 类型 | 必填 | 说明 | +| 名称 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | |result | boolean | 是 | 指示应用是否已安装。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-sensor.md b/zh-cn/application-dev/reference/apis/js-apis-system-sensor.md index 545e00496d9d495c1421544bc2808a7f9c5936da..2f3d54255a9a81a80a337a8877df9e76c032fecc 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-sensor.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-sensor.md @@ -1,16 +1,14 @@ # @system.sensor (传感器) -## 模块说明 - sensor模块提供订阅传感器数据基本能力,主要包含查询传感器的列表、订阅/取消传感器的数据、执行控制命令等。 根据传感器的用途,可以将传感器分为六大类:运动类传感器、环境类传感器、方向类传感器、光线类传感器、健康类传感器、其他类传感器(如霍尔传感器),每一大类传感器包含不同类型的传感器,某种类型的传感器可能是单一的物理传感器,也可能是由多个物理传感器复合而成。 -> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +> **说明:** > > - 从API Version 8开始,该接口不再维护,推荐使用新接口[`@ohos.sensor`](js-apis-sensor.md)。 -> - 本模块首批接口从API version 4开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +> - 本模块首批接口从API version 3开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > - 该功能使用需要对应硬件支持,仅支持真机调试。 @@ -21,15 +19,9 @@ sensor模块提供订阅传感器数据基本能力,主要包含查询传感 import sensor from '@system.sensor'; ``` -## 传感器错误码列表 - -| 错误码 | 说明 | -| ---- | -------------- | -| 900 | 当前设备不支持相应的传感器。 | - ## sensor.subscribeAccelerometer -subscribeAccelerometer(Object): void + subscribeAccelerometer(options: subscribeAccelerometerOptions): void 观察加速度数据变化。针对同一个应用,多次点击调用时,会覆盖前面的调用效果,即仅最后一次调用生效。 @@ -39,23 +31,13 @@ subscribeAccelerometer(Object): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | ---- | ---------------------------------------- | -| interval | string | 是 | 频率参数,加速度的回调函数执行频率。
默认为normal,可选值有:
- game:极高的回调频率,20ms/次,适用于游戏。
- ui:较高的回调频率,60ms/次,适用于UI更新。
- normal:普通的回调频率,200ms/次,低功耗。 | -| success | Function | 是 | 感应到加速度数据变化后的回调函数。 | -| fail | Function | 否 | 接口调用失败的回调函数。 | - -success返回值: - -| 参数名 | 类型 | 说明 | -| ---- | ------ | ------- | -| x | number | x轴的加速度。 | -| y | number | y轴的加速度。 | -| z | number | z轴的加速度。 | +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------------------------------------------------------------ | ---- | ------------------------------------------ | +| options | [subscribeAccelerometerOptions](#subscribeaccelerometeroptions) | 是 | 监听加速度传感器数据的回调函数的执行频率。 | **示例:** -``` +```js sensor.subscribeAccelerometer({ interval: 'normal', success: function(ret) { @@ -69,7 +51,7 @@ sensor.subscribeAccelerometer({ }); ``` -> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +> **说明:** > 建议在页面销毁时,即onDestory回调中,取消数据订阅,避免不必要的性能开销。 ## sensor.unsubscribeAccelerometer @@ -84,13 +66,13 @@ unsubscribeAccelerometer(): void **示例:** -``` +```js sensor.unsubscribeAccelerometer(); ``` ## sensor.subscribeCompass -subscribeCompass(Object): void + subscribeCompass(options: SubscribeCompassOptions): void 订阅罗盘数据变化。针对同一个应用,多次点击调用时,会覆盖前面的调用效果,即仅最后一次调用生效。 @@ -98,20 +80,13 @@ subscribeCompass(Object): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ------- | -------- | ---- | --------------- | -| success | Function | 是 | 罗盘数据改变后触发的回调函数。 | -| fail | Function | 否 | 接口调用失败的回调函数。 | - -success返回值: - -| 参数名 | 类型 | 说明 | -| --------- | ------ | ---------- | -| direction | number | 设备面对的方向度数。 | +| 参数名 | 类型 | 必填 | 说明 | +| ------- | --------------------------------------------------- | ---- | -------------------------------- | +| options | [SubscribeCompassOptions](#subscribecompassoptions) | 是 | 当罗盘传感器数据发生变化时调用。 | **示例:** -``` +```js sensor.subscribeCompass({ success: function(ret) { console.log('get data direction:' + ret.direction); @@ -122,7 +97,7 @@ sensor.subscribeCompass({ }); ``` -> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +> **说明:** > 建议在页面销毁时,即onDestory回调中,取消数据订阅,避免不必要的性能开销。 ## sensor.unsubscribeCompass @@ -135,13 +110,13 @@ unsubscribeCompass(): void **示例:** -``` +```js sensor.unsubscribeCompass(); ``` ## sensor.subscribeProximity -subscribeProximity(Object): void + subscribeProximity(options: SubscribeProximityOptions): void 订阅距离感应数据变化。针对同一个应用,多次点击调用时,会覆盖前面的调用效果,即仅最后一次调用生效。 @@ -149,20 +124,13 @@ subscribeProximity(Object): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ------- | -------- | ---- | ----------------- | -| success | Function | 是 | 距离感应数据改变后调用的回调函数。 | -| fail | Function | 否 | 接口调用失败的回调函数。 | - -success返回值: - -| 参数名 | 类型 | 说明 | -| -------- | ------ | --------------------- | -| distance | number | 可见物体相对于设备显示屏的接近或远离状态。 | +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------------------------------------------------------- | ---- | -------------------------------- | +| options | [SubscribeProximityOptions](#subscribeproximityoptions) | 是 | 当距离传感器数据发生变化时调用。 | **示例:** -``` +```js sensor.subscribeProximity({ success: function(ret) { console.log('get data distance:' + ret.distance); @@ -173,7 +141,7 @@ sensor.subscribeProximity({ }); ``` -> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +> **说明:** > 建议在页面销毁时,即onDestory回调中,取消数据订阅,避免不必要的性能开销。 ## sensor.unsubscribeProximity @@ -186,13 +154,13 @@ unsubscribeProximity(): void **示例:** -``` +```js sensor.unsubscribeProximity(); ``` ## sensor.subscribeLight -sensor.subscribeLight(Object): void + subscribeLight(options: SubscribeLightOptions): void 订阅环境光线感应数据变化。再次调用时,会覆盖前一次调用效果,即仅最后一次调用生效。 @@ -200,20 +168,13 @@ sensor.subscribeLight(Object): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ------- | -------- | ---- | --------------- | -| success | Function | 是 | 光线感应数据改变后的回调函数。 | -| fail | Function | 否 | 接口调用失败的回调函数。 | - -success返回值: - -| 参数名 | 类型 | 说明 | -| --------- | ------ | ------------ | -| intensity | number | 光线强度,单位为lux。 | +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ----------------------------------------------- | ---- | ---------------------------------- | +| options | [SubscribeLightOptions](#subscribelightoptions) | 是 | 当环境光传感器数据发生变化时调用。 | **示例:** -``` +```js sensor.subscribeLight({ success: function(ret) { console.log('get data intensity:' + ret.intensity); @@ -224,7 +185,7 @@ sensor.subscribeLight({ }); ``` -> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +> **说明:** > 建议在页面销毁时,即onDestory回调中,取消数据订阅,避免不必要的性能开销。 ## sensor.unsubscribeLight @@ -237,13 +198,13 @@ unsubscribeLight(): void **示例:** -``` +```js sensor.unsubscribeLight(); ``` ## sensor.subscribeStepCounter -subscribeStepCounter(Object): void + subscribeStepCounter(options: SubscribeStepCounterOptions): void 订阅计步传感器数据变化。针对同一个应用,多次点击调用时,会覆盖前面的调用效果,即仅最后一次调用生效。 @@ -253,20 +214,13 @@ subscribeStepCounter(Object): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ------- | -------- | ---- | ---------------- | -| success | Function | 是 | 计步传感器数据改变后的回调函数。 | -| fail | Function | 否 | 接口调用失败的回调函数。 | - -success返回值: - -| 参数名 | 类型 | 说明 | -| ----- | ------ | --------------------- | -| steps | number | 计步传感器重启后累计记录的步数。
| +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ----------------------------------------------------------- | ---- | -------------------------------------- | +| options | [SubscribeStepCounterOptions](#subscribestepcounteroptions) | 是 | 当步进计数器传感器数据发生变化时调用。 | **示例:** -``` +```js sensor.subscribeStepCounter({ success: function(ret) { console.log('get step value:' + ret.steps); @@ -277,7 +231,7 @@ sensor.subscribeStepCounter({ }); ``` -> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +> **说明:** > 建议在页面销毁时,即onDestory回调中,取消数据订阅,避免不必要的性能开销。 ## sensor.unsubscribeStepCounter @@ -292,14 +246,14 @@ unsubscribeStepCounter(): void **示例:** -``` +```js sensor.unsubscribeStepCounter(); ``` ## sensor.subscribeBarometer -subscribeBarometer(Object): void +subscribeBarometer(options: SubscribeBarometerOptions): void 订阅气压传感器数据变化。针对同一个应用,多次点击调用时,会覆盖前面的调用效果,即仅最后一次调用生效。 @@ -307,20 +261,13 @@ subscribeBarometer(Object): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ------- | -------- | ---- | ---------------- | -| success | Function | 是 | 气压传感器数据改变后的回调函数。 | -| fail | Function | 否 | 接口调用失败的回调函数。 | - -success返回值: - -| 参数名 | 类型 | 说明 | -| -------- | ------ | ----------- | -| pressure | number | 气压值,单位:帕斯卡。 | +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------------------------------------------------------- | ---- | ---------------------------------- | +| options | [SubscribeBarometerOptions](#subscribebarometeroptions) | 是 | 当气压计传感器数据发生变化时调用。 | **示例:** -``` +```js sensor.subscribeBarometer({ success: function(ret) { console.log('get data value:' + ret.pressure); @@ -331,7 +278,7 @@ sensor.subscribeBarometer({ }); ``` -> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +> **说明:** > 建议在页面销毁时,即onDestory回调中,取消数据订阅,避免不必要的性能开销。 @@ -345,14 +292,14 @@ unsubscribeBarometer(): void **示例:** -``` +```js sensor.unsubscribeBarometer(); ``` ## sensor.subscribeHeartRate -subscribeHeartRate(Object): void + subscribeHeartRate(options: SubscribeHeartRateOptions): void 订阅心率传感器数据变化。针对同一个应用,多次点击调用时,会覆盖前面的调用效果,即仅最后一次调用生效。 @@ -362,20 +309,13 @@ subscribeHeartRate(Object): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ------- | -------- | ---- | ------------------------- | -| success | Function | 是 | 心率传感器数据改变后的回调函数,默认频率5s/次。 | -| fail | Function | 否 | 接口调用失败的回调函数。 | - -success返回值: - -| 参数名 | 类型 | 说明 | -| --------- | ------ | ---- | -| heartRate | number | 心率值。 | +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------------------------------------------------------- | ---- | -------------------------------- | +| options | [SubscribeHeartRateOptions](#subscribeheartrateoptions) | 是 | 当心率传感器数据发生变化时调用。 | **示例:** -``` +```js sensor.subscribeHeartRate({ success: function(ret) { console.log('get heartrate value:' + ret.heartRate); @@ -386,7 +326,7 @@ sensor.subscribeHeartRate({ }); ``` -> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +> **说明:** > 建议在页面销毁时,即onDestory回调中,取消数据订阅,避免不必要的性能开销。 @@ -402,13 +342,13 @@ unsubscribeHeartRate(): void **示例:** -``` +```js sensor.unsubscribeHeartRate(); ``` ## sensor.subscribeOnBodyState -subscribeOnBodyState(Object): void + subscribeOnBodyState(options: SubscribeOnBodyStateOptions): void 订阅设备佩戴状态。针对同一个应用,多次点击调用时,会覆盖前面的调用效果,即仅最后一次调用生效。 @@ -416,20 +356,13 @@ subscribeOnBodyState(Object): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ------- | -------- | ---- | ------------- | -| success | Function | 是 | 穿戴状态改变后的回调函数。 | -| fail | Function | 否 | 接口调用失败的回调函数。 | - -success返回值: - -| 参数名 | 类型 | 说明 | -| ----- | ------- | ------ | -| value | boolean | 是否已佩戴。 | +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ----------------------------------------------------------- | ---- | ---------------------- | +| options | [SubscribeOnBodyStateOptions](#subscribeonbodystateoptions) | 是 | 当穿着状态改变时调用。 | **示例:** -``` +```js sensor.subscribeOnBodyState({ success: function(ret) { console.log('get on-body state value:' + ret.value); @@ -440,7 +373,7 @@ sensor.subscribeOnBodyState({ }); ``` -> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +> **说明:** > 建议在页面销毁时,即onDestory回调中,取消数据订阅,避免不必要的性能开销。 ## sensor.unsubscribeOnBodyState @@ -453,13 +386,13 @@ unsubscribeOnBodyState(): void **示例:** -``` +```js sensor.unsubscribeOnBodyState(); ``` ## sensor.getOnBodyState -getOnBodyState(Object): void + getOnBodyState(options: GetOnBodyStateOptions): void 获取设备佩戴状态。 @@ -467,21 +400,13 @@ getOnBodyState(Object): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | ---- | ------------ | -| success | Function | 否 | 接口调用成功的回调函数。 | -| fail | Function | 否 | 接口调用失败的回调函数。 | -| complete | Function | 否 | 接口调用结束的回调函数。 | - -success返回值: - -| 参数名 | 类型 | 说明 | -| ----- | ------- | ------ | -| value | boolean | 是否已佩戴。 | +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ----------------------------------------------- | ---- | -------------------------- | +| options | [GetOnBodyStateOptions](#getonbodystateoptions) | 是 | 获取传感器磨损状态时调用。 | **示例:** -``` +```js sensor.getOnBodyState({ success: function(ret) { console.log('on body state: ' + ret.value); @@ -494,7 +419,7 @@ sensor.getOnBodyState({ ## sensor.subscribeDeviceOrientation6+ -subscribeDeviceOrientation(interval: string, success: (data: DeviceOrientationResponse), fail?: (data: string, code: number)): void + subscribeDeviceOrientation(options: SubscribeDeviceOrientationOptions): void 观察设备方向传感器数据变化。 @@ -504,22 +429,13 @@ subscribeDeviceOrientation(interval: string, success: (data: DeviceOrientationRe **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | ---- | ---------------------------------------- | -| interval | string | 是 | 频率参数,设备方向传感器的回调函数执行频率。
默认为normal,可选值有:
- game:极高的回调频率,20ms/次,适用于游戏。
- ui:较高的回调频率,60ms/次,适用于UI更新。
- normal:普通的回调频率,200ms/次,低功耗。 | -| success | Function | 是 | 感应到设备方向传感器数据变化后的回调函数。 | -| fail | Function | 否 | 接口调用失败的回调函数。 | - - success返回值: -| 参数名 | 类型 | 说明 | -| ----- | ------ | ---------------------------------------- | -| alpha | number | 当设备坐标 X/Y 和地球 X/Y 重合时,绕着 Z 轴转动的夹角为 alpha。 | -| beta | number | 当设备坐标 Y/Z 和地球 Y/Z 重合时,绕着 X 轴转动的夹角为 beta。 | -| gamma | number | 当设备 X/Z 和地球 X/Z 重合时,绕着 Y 轴转动的夹角为 gamma。 | +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------------------------------------------------------------ | ---- | ------------------------------------------------ | +| options | [SubscribeDeviceOrientationOptions](#subscribedeviceorientationoptions) | 是 | 用于监听设备方向传感器数据的回调函数的执行频率。 | **示例:** -``` +```js sensor.subscribeDeviceOrientation({ interval: 'normal', success: function(ret) { @@ -533,7 +449,7 @@ sensor.subscribeDeviceOrientation({ }); ``` -> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +> **说明:** > 建议在页面销毁时,即onDestory回调中,取消数据订阅,避免不必要的性能开销。 ## sensor.unsubscribeDeviceOrientation6+ @@ -546,13 +462,13 @@ unsubscribeDeviceOrientation(): void **示例:** -``` +```js sensor.unsubscribeDeviceOrientation(); ``` ## sensor.subscribeGyroscope6+ -subscribeGyroscope(interval: string, success: (data: GyroscopeResponse), fail?: (data: string, code: number)): void + subscribeGyroscope(options: SubscribeGyroscopeOptions): void 观察陀螺仪数据变化。 @@ -564,23 +480,13 @@ subscribeGyroscope(interval: string, success: (data: GyroscopeResponse), fail?: **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | ---- | ---------------------------------------- | -| interval | string | 是 | 频率参数,陀螺仪的回调函数执行频率。
默认为normal,可选值有:
- game:极高的回调频率,20ms/次,适用于游戏。
- ui:较高的回调频率,60ms/次,适用于UI更新。
- normal:普通的回调频率,200ms/次,低功耗。 | -| success | Function | 是 | 感应到陀螺仪数据变化后的回调函数。 | -| fail | Function | 否 | 接口调用失败的回调函数。 | - -success返回值: - -| 参数名 | 类型 | 说明 | -| ---- | ------ | --------- | -| x | number | x轴的旋转角速度。 | -| y | number | y轴的旋转角速度。 | -| z | number | z轴的旋转角速度。 | +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------------------------------------------------------- | ---- | ---------------------------------------------- | +| options | [SubscribeGyroscopeOptions](#subscribegyroscopeoptions) | 是 | 用于侦听陀螺仪传感器数据的回调函数的执行频率。 | **示例:** -``` +```js sensor.subscribeGyroscope({ interval: 'normal', success: function(ret) { @@ -594,7 +500,7 @@ sensor.subscribeGyroscope({ }); ``` -> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +> **说明:** > 建议在页面销毁时,即onDestory回调中,取消数据订阅,避免不必要的性能开销。 ## sensor.unsubscribeGyroscope6+ @@ -609,6 +515,253 @@ unsubscribeGyroscope(): void **示例:** -``` +```js sensor.unsubscribeGyroscope(); ``` + +## subscribeAccelerometerOptions + +用于监听加速度传感器数据的回调函数的执行频率。 + +**需要权限**:ohos.permission.ACCELEROMETER + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| -------- | ----------------------------------------------- | ---- | ------------------------------------------------------------ | +| interval | string | 是 | 频率参数,加速度的回调函数执行频率。 默认为normal,可选值有: - game:极高的回调频率,20ms/次,适用于游戏。 - ui:较高的回调频率,60ms/次,适用于UI更新。 - normal:普通的回调频率,200ms/次,低功耗。 | +| success | [AccelerometerResponse](#accelerometerresponse) | 是 | 感应到加速度数据变化后的回调函数。 | +| fail | Function | 否 | 接口调用失败的回调函数。 | + +## AccelerometerResponse + +感应到加速度数据变化后的回调函数。 + +**需要权限**:ohos.permission.ACCELEROMETER + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| ---- | ------ | ---- | ------------- | +| x | number | 是 | x轴的加速度。 | +| y | number | 是 | y轴的加速度。 | +| z | number | 是 | z轴的加速度。 | + +## SubscribeCompassOptions + +当罗盘传感器数据发生变化时调用。 + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| ------- | ----------------------------------- | ---- | ------------------------------ | +| success | [CompassResponse](#compassresponse) | 是 | 罗盘数据改变后触发的回调函数。 | +| fail | Function | 否 | 接口调用失败的回调函数。 | + +## CompassResponse + +罗盘数据改变后触发的回调函数。 + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| --------- | ------ | ---- | -------------------- | +| direction | number | 是 | 设备面对的方向度数。 | + +## SubscribeProximityOptions + +当距离传感器数据发生变化时调用。 + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| ------- | --------------------------------------- | ---- | ---------------------------------- | +| success | [ProximityResponse](#proximityresponse) | 是 | 距离感应数据改变后调用的回调函数。 | +| fail | Function | 否 | 接口调用失败的回调函数。 | + +## ProximityResponse + +距离感应数据改变后调用的回调函数。 + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| -------- | ------ | ---- | ------------------------------------------ | +| distance | number | 是 | 可见物体相对于设备显示屏的接近或远离状态。 | + +## SubscribeLightOptions + +当环境光传感器数据发生变化时调用。 + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| ------- | ------------------------------- | ---- | ------------------------------ | +| success | [LightResponse](#lightresponse) | 是 | 光线感应数据改变后的回调函数。 | +| fail | Function | 否 | 接口调用失败的回调函数。 | + +## LightResponse + +光线感应数据改变后的回调函数。 + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| --------- | ------ | ---- | --------------------- | +| intensity | number | 是 | 光线强度,单位为lux。 | + +## SubscribeStepCounterOptions + +当步进计数器传感器数据发生变化时调用。 + +**需要权限**:ohos.permission.ACTIVITY_MOTION + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| ------- | ------------------------------------------- | ---- | -------------------------------- | +| success | [StepCounterResponse](#stepcounterresponse) | 是 | 计步传感器数据改变后的回调函数。 | +| fail | Function | 否 | 接口调用失败的回调函数。 | + +## StepCounterResponse + +计步传感器数据改变后的回调函数。 + +**需要权限**:ohos.permission.ACTIVITY_MOTION + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| ----- | ------ | ---- | -------------------------------- | +| steps | number | 是 | 计步传感器重启后累计记录的步数。 | + +## SubscribeBarometerOptions + +当气压计传感器数据发生变化时调用。 + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| ------- | --------------------------------------- | ---- | -------------------------------- | +| success | [BarometerResponse](#barometerresponse) | 是 | 气压传感器数据改变后的回调函数。 | +| fail | Function | 否 | 接口调用失败的回调函数。 | + +## BarometerResponse + +气压传感器数据改变后的回调函数。 + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| -------- | ------ | ---- | ---------------------- | +| pressure | number | 是 | 气压值,单位:帕斯卡。 | + +## SubscribeHeartRateOptions + +当心率传感器数据发生变化时调用。 + +**需要权限**:ohos.permission.READ_HEALTH_DATA + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| ------- | --------------------------------------- | ---- | ----------------------------------------------- | +| success | [HeartRateResponse](#heartrateresponse) | 是 | 心率传感器数据改变后的回调函数,默认频率5s/次。 | +| fail | Function | 否 | 接口调用失败的回调函数。 | + +## HeartRateResponse + +心率传感器数据改变后的回调函数,默认频率5s/次。 + +**需要权限**:ohos.permission.READ_HEALTH_DATA + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| --------- | ------ | ---- | -------- | +| heartRate | number | 是 | 心率值。 | + +## SubscribeOnBodyStateOptions + +当穿着状态改变时调用。 + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| ------- | ------------------------------------------- | ---- | -------------------------- | +| success | [OnBodyStateResponse](#onbodystateresponse) | 是 | 穿戴状态改变后的回调函数。 | +| fail | Function | 否 | 接口调用失败的回调函数。 | + +## OnBodyStateResponse + +传感器是否磨损。 + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| ----- | ------- | ---- | ------------ | +| value | boolean | 是 | 是否已佩戴。 | + +## GetOnBodyStateOptions + + 获取传感器磨损状态时调用。 + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------- | ---- | ------------------------ | +| success | [OnBodyStateResponse](#onbodystateresponse) | 否 | 接口调用成功的回调函数。 | +| fail | Function | 否 | 接口调用失败的回调函数。 | +| complete | Function | 否 | 接口调用结束的回调函数。 | + +## SubscribeDeviceOrientationOptions6+ + +用于监听设备方向传感器数据的回调函数的执行频率。 + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------- | ---- | ------------------------------------------------------------ | +| interval | string | 是 | 频率参数,设备方向传感器的回调函数执行频率。
默认为normal,可选值有:
- game:极高的回调频率,20ms/次,适用于游戏。
- ui:较高的回调频率,60ms/次,适用于UI更新。
- normal:普通的回调频率,200ms/次,低功耗。 | +| success | [DeviceOrientationResponse](#deviceorientationresponse) | 是 | 感应到设备方向传感器数据变化后的回调函数。 | +| fail | Function | 否 | 接口调用失败的回调函数。 | + +## DeviceOrientationResponse6+ + +感应到设备方向传感器数据变化后的回调函数。 + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| ----- | ------ | ---- | ------------------------------------------------------------ | +| alpha | number | 是 | 当设备坐标 X/Y 和地球 X/Y 重合时,绕着 Z 轴转动的夹角为 alpha。 | +| beta | number | 是 | 当设备坐标 Y/Z 和地球 Y/Z 重合时,绕着 X 轴转动的夹角为 beta。 | +| gamma | number | 是 | 当设备 X/Z 和地球 X/Z 重合时,绕着 Y 轴转动的夹角为 gamma。 | + +## SubscribeGyroscopeOptions6+ + +用于侦听陀螺仪传感器数据的回调函数的执行频率。 + +**需要权限**:ohos.permission.GYROSCOPE + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------- | ---- | ------------------------------------------------------------ | +| interval | string | 是 | 频率参数,陀螺仪的回调函数执行频率。
默认为normal,可选值有:
- game:极高的回调频率,20ms/次,适用于游戏。
- ui:较高的回调频率,60ms/次,适用于UI更新。
- normal:普通的回调频率,200ms/次,低功耗。 | +| success | [GyroscopeResponse](#gyroscoperesponse) | 是 | 感应到陀螺仪数据变化后的回调函数。 | +| fail | Function | 否 | 接口调用失败的回调函数。 | + +## GyroscopeResponse6+ + +感应到陀螺仪数据变化后的回调函数。 + +**需要权限**:ohos.permission.GYROSCOPE + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| ---- | ------ | ---- | ----------------- | +| x | number | 是 | x轴的旋转角速度。 | +| y | number | 是 | y轴的旋转角速度。 | +| z | number | 是 | z轴的旋转角速度。 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-vibrate.md b/zh-cn/application-dev/reference/apis/js-apis-system-vibrate.md index c77faf7b3978c263e41591c796e7bbb8fec4b8f5..7726086cc4e0c4e0327b773d8278e9240fcb5041 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-vibrate.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-vibrate.md @@ -1,14 +1,12 @@ # @system.vibrator (振动) -## 模块说明 - vibrator模块提供控制马达振动的能力,主要包含灯的列表查询、打开灯、关闭灯等接口,振动器的列表查询、振动器的振动器效果查询、触发/关闭振动器等接口。 控制类小器件指的是设备上的LED灯和振动器。其中,LED灯主要用作指示(如充电状态)、闪烁功能(如三色灯)等;振动器主要用于闹钟、开关机振动、来电振动等场景。 -> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** -> - 本模块首批接口从API version 4开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +> **说明:** +> - 本模块首批接口从API version 3开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > - 从API Version 8开始,该接口不再维护,推荐使用新接口[`@ohos.vibrator`](js-apis-vibrator.md)。 > - 该功能使用需要对应硬件支持,仅支持真机调试。 @@ -22,26 +20,23 @@ import vibrator from '@system.vibrator'; ## vibrator.vibrate -vibrate(Object): void + vibrate(options?: VibrateOptions): void 触发设备振动。 -**系统能力**:SystemCapability.Sensors.MiscDevice +**需要权限**:ohos.permission.VIBRATE -**需要权限**:ohos.permission.VIBRATE,该权限为系统权限 +**系统能力**:SystemCapability.Sensors.MiscDevice **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| mode | string | 否 | 振动的模式,其中long表示长振动,short表示短振动,默认值为long。 | -| success | Function | 是 | 感应到振动数据变化后的回调函数。 | -| fail | Function | 否 | 接口调用失败的回调函数。 | -| complete | Function | 否 | 接口调用结束的回调函数。 | +| 参数名 | 类型 | 必填 | 说明 | +| ------- | --------------------------------- | ---- | ---------- | +| options | [VibrateOptions](#vibrateoptions) | 否 | 振动模式。 | **示例:** -``` +```js vibrator.vibrate({ mode: 'short', success: function() { @@ -56,3 +51,17 @@ vibrator.vibrate({ }); ``` +## VibrateOptions + +振动模式。 + +**需要权限**:ohos.permission.VIBRATE + +**系统能力**:SystemCapability.Sensors.MiscDevice + +| 名称 | 类型 | 必填 | 说明 | +| -------- | -------- | ---- | ------------------------------------------------------------ | +| mode | string | 否 | 振动的模式,其中long表示长振动,short表示短振动,默认值为long。 | +| success | Function | 否 | 感应到振动数据变化后的回调函数。 | +| fail | Function | 否 | 接口调用失败的回调函数。 | +| complete | Function | 否 | 接口调用结束的回调函数。 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-tagSession.md b/zh-cn/application-dev/reference/apis/js-apis-tagSession.md index 8677dd02863676b4bf8296bd75396eab7bc096eb..32b66bd40eecb8b10ef4313dbd7325c80cf8162e 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-tagSession.md +++ b/zh-cn/application-dev/reference/apis/js-apis-tagSession.md @@ -26,6 +26,9 @@ getTagInfo(): tag.TagInfo 获取该Tag被分发时,NFC服务所提供的Tag数据对象。 +> **说明:** +> 从 API version 7 开始支持,从 API version 9 开始废弃,建议使用[tag.getTagInfo](js-apis-nfcTag.md#taggettaginfo9)替代。 + **需要权限:** ohos.permission.NFC_TAG **系统能力:** SystemCapability.Communication.NFC.Tag @@ -54,6 +57,9 @@ connectTag(): boolean; 和标签建立连接。在从标签读取数据或将数据写入标签之前,必须调用此方法。 +> **说明:** +> 从 API version 7 开始支持,从 API version 9 开始废弃,建议使用[tagSession.connect](#tagsessionconnect9)替代。 + **需要权限:** ohos.permission.NFC_TAG **系统能力:** SystemCapability.Communication.NFC.Tag @@ -76,12 +82,49 @@ let connectStatus = tag.getIsoDep(tagInfo).connectTag(); console.log("connectStatus: " + connectStatus); ``` +### tagSession.connect9+ + +connect(): void; + +和标签建立连接。在从标签读取数据或将数据写入标签之前,必须调用此方法。 + +**需要权限:** ohos.permission.NFC_TAG + +**系统能力:** SystemCapability.Communication.NFC.Tag + +**错误码:** + +以下错误码的详细介绍请参见[NFC错误码](../errorcodes/errorcode-nfc.md)。 + +| 错误码ID | 错误信息| +| ------- | -------| +| 3100201 | Tag running state is abnormal in service. | + +**示例:** + +```js +import tag from '@ohos.nfc.tag'; + +// see 'tag.TagInfo' at 'js-apis-nfcTag.md', tagInfo is an Object given by nfc service when tag is dispatched. +// the folowing getXXX, can be one of getIsoDep, getNdef, getMifareClassic, ... + +try { + tag.getIsoDep(tagInfo).connect(); + console.log("tag connect success"); +} catch (busiError) { + console.log("tag connect busiError: " + busiError); +} +``` + ### tagSession.reset() reset(): void 重置与标签的连接。 +> **说明:** +> 从 API version 7 开始支持,从 API version 9 开始废弃,建议使用[tagSession.resetConnection](#tagsessionresetconnection9)替代。 + **需要权限:** ohos.permission.NFC_TAG **系统能力:** SystemCapability.Communication.NFC.Tag @@ -97,12 +140,49 @@ import tag from '@ohos.nfc.tag'; tag.getIsoDep(tagInfo).reset(); ``` +### tagSession.resetConnection()9+ + +resetConnection(): void + +重置与标签的连接。 + +**需要权限:** ohos.permission.NFC_TAG + +**系统能力:** SystemCapability.Communication.NFC.Tag + +**错误码:** + +以下错误码的详细介绍请参见[NFC错误码](../errorcodes/errorcode-nfc.md)。 + +| 错误码ID | 错误信息| +| ------- | -------| +| 3100201 | Tag running state is abnormal in service. | + +**示例:** + +```js +import tag from '@ohos.nfc.tag'; + +// see 'tag.TagInfo' at 'js-apis-nfcTag.md', tagInfo is an Object given by nfc service when tag is dispatched. +// the folowing getXXX, can be one of getIsoDep, getNdef, getMifareClassic, ... + +try { + tag.getIsoDep(tagInfo).resetConnection(); + console.log("tag resetConnection success"); +} catch (busiError) { + console.log("tag resetConnection busiError: " + busiError); +} +``` + ### tagSession.isTagConnected isTagConnected(): boolean 检查是否已与标签建立连接。 +> **说明:** +> 从 API version 7 开始支持,从 API version 9 开始废弃,建议使用[tagSession.isConnected](#tagsessionisconnected9)替代。 + **需要权限:** ohos.permission.NFC_TAG **系统能力:** SystemCapability.Communication.NFC.Tag @@ -125,12 +205,47 @@ let isTagConnected = tag.getIsoDep(tagInfo).isTagConnected(); console.log("isTagConnected: " + isTagConnected); ``` +### tagSession.isConnected9+ + +isConnected(): boolean + +检查是否已与标签建立连接。 + +**需要权限:** ohos.permission.NFC_TAG + +**系统能力:** SystemCapability.Communication.NFC.Tag + +**返回值:** + +| **类型** | **说明** | +| ------------------ | --------------------------| +| boolean | 已建立连接返回 true,未建立连接返回false。 | + +**示例:** + +```js +import tag from '@ohos.nfc.tag'; + +// see 'tag.TagInfo' at 'js-apis-nfcTag.md', tagInfo is an Object given by nfc service when tag is dispatched. +// the folowing getXXX, can be one of getIsoDep, getNdef, getMifareClassic, ... + +try { + var isConnected = tag.getIsoDep(tagInfo).isConnected(); + console.log("tag isConnected = " + isConnected); +} catch (busiError) { + console.log("tag isConnected busiError: " + busiError); +} +``` + ### tagSession.getMaxSendLength getMaxSendLength(): number 查询可以发送到标签的最大数据长度。 +> **说明:** +> 从 API version 7 开始支持,从 API version 9 开始废弃,建议使用[tagSession.getMaxTransmitSize](#tagsessiongetmaxtransmitsize9)替代。 + **需要权限:** ohos.permission.NFC_TAG **系统能力:** SystemCapability.Communication.NFC.Tag @@ -152,12 +267,54 @@ let maxSendLen = tag.getIsoDep(tagInfo).getMaxSendLength(); console.log("tag maxSendLen: " + maxSendLen); ``` +### tagSession.getMaxTransmitSize9+ + +getMaxTransmitSize(): number + +查询可以发送到标签的最大数据长度。 + +**需要权限:** ohos.permission.NFC_TAG + +**系统能力:** SystemCapability.Communication.NFC.Tag + +**返回值:** + +| **类型** | **说明** | +| ------------------ | --------------------------| +| number | 可以发送到标签的最大数据长度,非负数。 | + +**错误码:** + +以下错误码的详细介绍请参见[NFC错误码](../errorcodes/errorcode-nfc.md)。 + +| 错误码ID | 错误信息| +| ------- | -------| +| 3100201 | Tag running state is abnormal in service. | + +**示例:** +```js +import tag from '@ohos.nfc.tag'; + +// see 'tag.TagInfo' at 'js-apis-nfcTag.md', tagInfo is an Object given by nfc service when tag is dispatched. +// the folowing getXXX, can be one of getIsoDep, getNdef, getMifareClassic, ... + +try { + var maxTransmitSize = tag.getIsoDep(tagInfo).getMaxTransmitSize(); + console.log("tag maxTransmitSize = " + maxTransmitSize); +} catch (busiError) { + console.log("tag getMaxTransmitSize busiError: " + busiError); +} +``` + ### tagSession.getSendDataTimeout getSendDataTimeout(): number 查询发送数据到Tag的等待超时时间,单位是毫秒。 +> **说明:** +> 从 API version 7 开始支持,从 API version 9 开始废弃,建议使用[tagSession.getTimeout](#tagsessiongettimeout9)替代。 + **需要权限:** ohos.permission.NFC_TAG **系统能力:** SystemCapability.Communication.NFC.Tag @@ -180,12 +337,55 @@ let sendDataTimeout = tag.getIsoDep(tagInfo).getSendDataTimeout(); console.log("tag sendDataTimeout: " + sendDataTimeout); ``` +### tagSession.getTimeout9+ + +getTimeout(): number + +查询发送数据到Tag的等待超时时间,单位是毫秒。 + +**需要权限:** ohos.permission.NFC_TAG + +**系统能力:** SystemCapability.Communication.NFC.Tag + +**返回值:** + +| **类型** | **说明** | +| ------------------ | --------------------------| +| number | 发送数据到Tag的等待超时时间,单位是毫秒,非负数。 | + +**错误码:** + +以下错误码的详细介绍请参见[NFC错误码](../errorcodes/errorcode-nfc.md)。 + +| 错误码ID | 错误信息| +| ------- | -------| +| 3100201 | Tag running state is abnormal in service. | + +**示例:** + +```js +import tag from '@ohos.nfc.tag'; + +// see 'tag.TagInfo' at 'js-apis-nfcTag.md', tagInfo is an Object given by nfc service when tag is dispatched. +// the folowing getXXX, can be one of getIsoDep, getNdef, getMifareClassic, ... + +try { + var timeout = tag.getIsoDep(tagInfo).getTimeout(); + console.log("tag timeout = " + timeout); +} catch (busiError) { + console.log("tag getTimeout busiError: " + busiError); +} +``` + ### tagSession.setSendDataTimeout setSendDataTimeout(timeout: number): boolean 查询发送数据到Tag的等待超时时间,单位是毫秒。 +> **说明:** +> 从 API version 7 开始支持,从 API version 9 开始废弃,建议使用[tagSession.setTimeout](#tagsessionsettimeout9)替代。 + **需要权限:** ohos.permission.NFC_TAG **系统能力:** SystemCapability.Communication.NFC.Tag @@ -215,12 +415,56 @@ let setStatus = tag.getIsoDep(tagInfo).setSendDataTimeout(timeoutMs); console.log("tag setSendDataTimeout setStatus: " + setStatus); ``` +### tagSession.setTimeout9+ + +setTimeout(timeout: number): void + +查询发送数据到Tag的等待超时时间,单位是毫秒。 + +**需要权限:** ohos.permission.NFC_TAG + +**系统能力:** SystemCapability.Communication.NFC.Tag + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------- | ---- | -------------------------------------- | +| timeout | number | 是 | 超时时间,单位毫秒,非负值。 | + +**错误码:** + +以下错误码的详细介绍请参见[NFC错误码](../errorcodes/errorcode-nfc.md)。 + +| 错误码ID | 错误信息| +| ------- | -------| +| 3100201 | Tag running state is abnormal in service. | + +**示例:** + +```js +import tag from '@ohos.nfc.tag'; + +// see 'tag.TagInfo' at 'js-apis-nfcTag.md', tagInfo is an Object given by nfc service when tag is dispatched. +// the folowing getXXX, can be one of getIsoDep, getNdef, getMifareClassic, ... + +let timeoutMs = 700; // change it to be correct. +try { + tag.getIsoDep(tagInfo).setTimeout(timeoutMs); + console.log("tag setTimeout success"); +} catch (busiError) { + console.log("tag setTimeout busiError: " + busiError); +} +``` + ### tagSession.sendData sendData(data: number[]): Promise 发送指令到Tag上,使用Promise方式作为异步方法。 +> **说明:** +> 从 API version 7 开始支持,从 API version 9 开始废弃,建议使用[tagSession.transmit](#tagsessiontransmit9)替代。 + **需要权限:** ohos.permission.NFC_TAG **系统能力:** SystemCapability.Communication.NFC.Tag @@ -267,6 +511,9 @@ sendData(data: number[], callback: AsyncCallback): void 发送指令到Tag上,使用AsyncCallback方式作为异步方法。 +> **说明:** +> 从 API version 7 开始支持,从 API version 9 开始废弃,建议使用[tagSession.transmit](#tagsessiontransmit9-1)替代。 + **需要权限:** ohos.permission.NFC_TAG **系统能力:** SystemCapability.Communication.NFC.Tag @@ -303,3 +550,123 @@ tag.getIsoDep(tagInfo).sendData(cmdData, (err, response)=> { } }); ``` + +### tagSession.transmit9+ + +transmit(data: number[]): Promise + +发送指令到Tag上,使用Promise方式作为异步方法。 + +**需要权限:** ohos.permission.NFC_TAG + +**系统能力:** SystemCapability.Communication.NFC.Tag + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------- | ---- | -------------------------------------- | +| data | number[] | 是 | 要发送的指令。每个number十六进制表示,范围是0x00~0xFF。 | + +**返回值:** + +| **类型** | **说明** | +| ------------------ | --------------------------| +| Promise | 对端Tag对指令的响应数据。每个number十六进制表示,范围是0x00~0xFF。| + +**错误码:** + +以下错误码的详细介绍请参见[NFC错误码](../errorcodes/errorcode-nfc.md)。 + +| 错误码ID | 错误信息| +| ------- | -------| +| 3100201 | Tag running state is abnormal in service. | + +**示例:** + +```js +import tag from '@ohos.nfc.tag'; + +// see 'tag.TagInfo' at 'js-apis-nfcTag.md', tagInfo is an Object given by nfc service when tag is dispatched. +// the folowing getXXX, can be one of getIsoDep, getNdef, getMifareClassic, ... + +// connect the tag at first if not connected. +try { + if (!tag.getIsoDep(tagInfo).isConnected()) { + tag.getIsoDep(tagInfo).connect(); + } +} catch (busiError) { + console.log("tag connect busiError: " + busiError); + return; +} + +let cmdData = [0x01, 0x02, 0x03, 0x04]; // change the raw data to be correct. +try { + tag.getIsoDep(tagInfo).transmit(cmdData).then((response) => { + console.log("tagSession transmit Promise response: " + response); + }).catch((err)=> { + console.log("tagSession transmit Promise err: " + err); + }); +} catch (busiError) { + console.log("tag transmit busiError: " + busiError); + return; +} +``` + +### tagSession.transmit9+ + +transmit(data: number[], callback: AsyncCallback): void + +发送指令到Tag上,使用AsyncCallback方式作为异步方法。 + +**需要权限:** ohos.permission.NFC_TAG + +**系统能力:** SystemCapability.Communication.NFC.Tag + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------- | ---- | -------------------------------------- | +| data | number[] | 是 | 要发送的指令。每个number十六进制表示,范围是0x00~0xFF。 | +| callback | AsyncCallback | 是 | 回调函数,返回响应数据。每个number十六进制表示,范围是0x00~0xFF。 | + +**错误码:** + +以下错误码的详细介绍请参见[NFC错误码](../errorcodes/errorcode-nfc.md)。 + +| 错误码ID | 错误信息| +| ------- | -------| +| 3100201 | Tag running state is abnormal in service. | + +**示例:** + +```js +import tag from '@ohos.nfc.tag'; + +// see 'tag.TagInfo' at 'js-apis-nfcTag.md', tagInfo is an Object given by nfc service when tag is dispatched. +// the folowing getXXX, can be one of getIsoDep, getNdef, getMifareClassic, ... + +// connect the tag at first if not connected. +try { + if (!tag.getIsoDep(tagInfo).isConnected()) { + tag.getIsoDep(tagInfo).connect(); + } +} catch (busiError) { + console.log("tag connect busiError: " + busiError); + return; +} + +let cmdData = [0x01, 0x02, 0x03, 0x04]; // change the raw data to be correct. +try { + tag.getIsoDep(tagInfo).transmit(cmdData, (err, response)=> { + if (err) { + console.log("tagSession transmit AsyncCallback err: " + err); + } else { + console.log("tagSession transmit AsyncCallback response: " + response); + } + }); +} catch (busiError) { + console.log("tag transmit busiError: " + busiError); + return; +} + +``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-uitest.md b/zh-cn/application-dev/reference/apis/js-apis-uitest.md index 2feec76275e6c49a61c8ebe6ef3dbd796234efac..97ec1fc917f2e6851962f4955bc98a69ccac89a6 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-uitest.md +++ b/zh-cn/application-dev/reference/apis/js-apis-uitest.md @@ -1,4 +1,4 @@ -# @ohos.uitest (UiTest) +# @ohos.UiTest UiTest提供模拟UI操作的能力,供开发者在测试场景使用,主要支持如点击、双击、长按、滑动等UI操作能力。 @@ -20,7 +20,7 @@ UiTest提供模拟UI操作的能力,供开发者在测试场景使用,主要 ## 导入模块 ```js -import {UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection, WindowMode, PointerMatrix} from '@ohos.uitest'; +import {UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection, WindowMode, PointerMatrix} from '@ohos.UiTest'; ``` ## MatchPattern @@ -61,8 +61,8 @@ import {UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern | 名称 | 类型 | 可读 | 可写 | 说明 | | ---- | ------ | ---- | ---- | ---------------- | -| X | number | 是 | 否 | 坐标点的横坐标。 | -| Y | number | 是 | 否 | 坐标点的纵坐标。 | +| x | number | 是 | 否 | 坐标点的横坐标。 | +| y | number | 是 | 否 | 坐标点的纵坐标。 | ## Rect9+ @@ -2093,7 +2093,7 @@ fling(from: Point, to: Point, stepLen: number, speed: number): Promise\ ```js async function demo() { let driver = Driver.create(); - await driver.fling({X: 500, Y: 480},{X: 450, Y: 480},5,600); + await driver.fling({x: 500, Y: 480},{x: 450, Y: 480},5,600); } ``` @@ -2132,12 +2132,12 @@ injectMultiPointerAction(pointers: PointerMatrix, speed?: number): Promise\ { - console.log(`requestRight = ${JSON.stringify(ret)}`); + console.log(`requestRight = ${ret}`); }); ``` @@ -375,8 +375,9 @@ controlTransfer(pipe: USBDevicePipe, controlparam: USBControlParams, timeout ?: **示例:** ```js -usb.controlTransfer(devicepipe, USBControlParams).then((ret) => { - console.log(`controlTransfer = ${JSON.stringify(ret)}`); +let param = new usb.USBControlParams(); +usb.controlTransfer(devicepipe, param).then((ret) => { + console.log(`controlTransfer = ${ret}`); }) ``` @@ -412,7 +413,7 @@ bulkTransfer(pipe: USBDevicePipe, endpoint: USBEndpoint, buffer: Uint8Array, tim //把获取到的设备对象作为参数传入usb.connectDevice;当usb.connectDevice接口成功返回之后; //才可以调用第三个接口usb.claimInterface.当usb.claimInterface 调用成功以后,再调用该接口。 usb.bulkTransfer(devicepipe, endpoint, buffer).then((ret) => { - console.log(`bulkTransfer = ${JSON.stringify(ret)}`); + console.log(`bulkTransfer = ${ret}`); }); ``` @@ -499,7 +500,7 @@ usbFunctionsToString(funcs: FunctionType): string **示例:** ```js -let funcs = ACM | ECM; +let funcs = usb.ACM | usb.ECM; let ret = usb.usbFunctionsToString(funcs); ``` @@ -528,7 +529,7 @@ setCurrentFunctions(funcs: FunctionType): Promise\ **示例:** ```js -let funcs = HDC; +let funcs = usb.HDC; let ret = usb.setCurrentFunctions(funcs); ``` @@ -631,7 +632,12 @@ setPortRoles(portId: number, powerRole: PowerRoleType, dataRole: DataRoleType): **示例:** ```js -let ret = usb.getSupportedModes(0); +let portId = 1; +usb.setPortRoles(portId, usb.PowerRoleType.SOURCE, usb.DataRoleType.HOST).then(() => { + console.info('usb setPortRoles successfully.'); +}).catch(err => { + console.error('usb setPortRoles failed: ' + err.code + ' message: ' + err.message); +}); ``` ## USBEndpoint diff --git a/zh-cn/application-dev/reference/apis/js-apis-usb.md b/zh-cn/application-dev/reference/apis/js-apis-usb.md index 7817395fa9d00d86898d765e1070f93f618c3e8b..ab49c1a921f63af9b7784e3cfdc3b757805bdbea 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-usb.md +++ b/zh-cn/application-dev/reference/apis/js-apis-usb.md @@ -32,7 +32,7 @@ getDevices(): Array<Readonly<USBDevice>> ```js let devicesList = usb.getDevices(); -console.log(`devicesList = ${JSON.stringify(devicesList)}`); +console.log(`devicesList = ${devicesList}`); //devicesList 返回的数据结构 //此处提供一个简单的示例,如下 [ @@ -121,13 +121,12 @@ connectDevice(device: USBDevice): Readonly<USBDevicePipe> let devicesList = usb.getDevices(); if (devicesList.length == 0) { console.log(`device list is empty`); - return; } let device = devicesList[0]; usb.requestRight(device.name); let devicepipe = usb.connectDevice(device); -console.log(`devicepipe = ${JSON.stringify(devicepipe)}`); +console.log(`devicepipe = ${devicepipe}`); ``` ## usb.hasRight @@ -185,7 +184,7 @@ requestRight(deviceName: string): Promise<boolean> ```js let devicesName="1-1"; usb.requestRight(devicesName).then((ret) => { - console.log(`requestRight = ${JSON.stringify(ret)}`); + console.log(`requestRight = ${ret}`); }); ``` @@ -213,7 +212,7 @@ removeRight(deviceName: string): boolean ```js let devicesName="1-1"; -if (usb.removeRight(devicesName) { +if usb.removeRight(devicesName) { console.log(`Succeed in removing right`); } ``` @@ -248,7 +247,7 @@ addRight(bundleName: string, deviceName: string): boolean ```js let devicesName = "1-1"; let bundleName = "com.example.hello"; -if (usb.addRight(bundleName, devicesName) { +if usb.addRight(bundleName, devicesName) { console.log(`Succeed in adding right`); } ``` @@ -457,8 +456,9 @@ controlTransfer(pipe: USBDevicePipe, controlparam: USBControlParams, timeout ?: **示例:** ```js -usb.controlTransfer(devicepipe, USBControlParams).then((ret) => { - console.log(`controlTransfer = ${JSON.stringify(ret)}`); +let param = new usb.USBControlParams(); +usb.controlTransfer(devicepipe, param).then((ret) => { + console.log(`controlTransfer = ${ret}`); }) ``` @@ -494,7 +494,7 @@ bulkTransfer(pipe: USBDevicePipe, endpoint: USBEndpoint, buffer: Uint8Array, tim //把获取到的设备对象作为参数传入usb.connectDevice;当usb.connectDevice接口成功返回之后; //才可以调用第三个接口usb.claimInterface.当usb.claimInterface 调用成功以后,再调用该接口。 usb.bulkTransfer(devicepipe, endpoint, buffer).then((ret) => { - console.log(`bulkTransfer = ${JSON.stringify(ret)}`); + console.log(`bulkTransfer = ${ret}`); }); ``` @@ -581,7 +581,7 @@ usbFunctionsToString(funcs: FunctionType): string **示例:** ```js -let funcs = ACM | ECM; +let funcs = usb.ACM | usb.ECM; let ret = usb.usbFunctionsToString(funcs); ``` @@ -610,7 +610,7 @@ setCurrentFunctions(funcs: FunctionType): Promise\ **示例:** ```js -let funcs = HDC; +let funcs = usb.HDC; let ret = usb.setCurrentFunctions(funcs); ``` @@ -713,7 +713,12 @@ setPortRoles(portId: number, powerRole: PowerRoleType, dataRole: DataRoleType): **示例:** ```js -let ret = usb.getSupportedModes(0); +let portId = 1; +usb.setPortRoles(portId, usb.PowerRoleType.SOURCE, usb.DataRoleType.HOST).then(() => { + console.info('usb setPortRoles successfully.'); +}).catch(err => { + console.error('usb setPortRoles failed: ' + err.code + ' message: ' + err.message); +}); ``` ## USBEndpoint diff --git a/zh-cn/application-dev/reference/apis/js-apis-usbManager.md b/zh-cn/application-dev/reference/apis/js-apis-usbManager.md index 6eaf7501cc163afbec26e8b9749da044f94b4e05..c9dbcbbfe22ef45fa59569695297f02d5df07da5 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-usbManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-usbManager.md @@ -30,7 +30,7 @@ getDevices(): Array<Readonly<USBDevice>> ```js let devicesList = usb.getDevices(); -console.log(`devicesList = ${JSON.stringify(devicesList)}`); +cconsole.log(`devicesList = ${devicesList}`); //devicesList 返回的数据结构 //此处提供一个简单的示例,如下 [ @@ -119,13 +119,12 @@ connectDevice(device: USBDevice): Readonly<USBDevicePipe> let devicesList = usb.getDevices(); if (devicesList.length == 0) { console.log(`device list is empty`); - return; } let device = devicesList[0]; usb.requestRight(device.name); let devicepipe = usb.connectDevice(device); -console.log(`devicepipe = ${JSON.stringify(devicepipe)}`); +console.log(`devicepipe = ${devicepipe}`); ``` ## usb.hasRight @@ -155,7 +154,7 @@ hasRight(deviceName: string): boolean ```js let devicesName="1-1"; let bool = usb.hasRight(devicesName); -console.log(bool); +console.log(`${bool}`); ``` ## usb.requestRight @@ -183,7 +182,7 @@ requestRight(deviceName: string): Promise<boolean> ```js let devicesName="1-1"; usb.requestRight(devicesName).then((ret) => { - console.log(`requestRight = ${JSON.stringify(ret)}`); + console.log(`requestRight = ${ret}`); }); ``` @@ -211,7 +210,7 @@ removeRight(deviceName: string): boolean ```js let devicesName="1-1"; -if (usb.removeRight(devicesName) { +if usb.removeRight(devicesName) { console.log(`Succeed in removing right`); } ``` @@ -246,7 +245,7 @@ addRight(bundleName: string, deviceName: string): boolean ```js let devicesName = "1-1"; let bundleName = "com.example.hello"; -if (usb.addRight(bundleName, devicesName) { +if usb.addRight(bundleName, devicesName) { console.log(`Succeed in adding right`); } ``` @@ -455,8 +454,9 @@ controlTransfer(pipe: USBDevicePipe, controlparam: USBControlParams, timeout ?: **示例:** ```js -usb.controlTransfer(devicepipe, USBControlParams).then((ret) => { - console.log(`controlTransfer = ${JSON.stringify(ret)}`); +let param = new usb.USBControlParams(); +usb.controlTransfer(devicepipe, param).then((ret) => { + console.log(`controlTransfer = ${ret}`); }) ``` @@ -492,7 +492,7 @@ bulkTransfer(pipe: USBDevicePipe, endpoint: USBEndpoint, buffer: Uint8Array, tim //把获取到的设备对象作为参数传入usb.connectDevice;当usb.connectDevice接口成功返回之后; //才可以调用第三个接口usb.claimInterface.当usb.claimInterface 调用成功以后,再调用该接口。 usb.bulkTransfer(devicepipe, endpoint, buffer).then((ret) => { - console.log(`bulkTransfer = ${JSON.stringify(ret)}`); + console.log(`bulkTransfer = ${ret}`); }); ``` @@ -579,7 +579,7 @@ usbFunctionsToString(funcs: FunctionType): string **示例:** ```js -let funcs = ACM | ECM; +let funcs = usb.ACM | usb.ECM; let ret = usb.usbFunctionsToString(funcs); ``` @@ -608,7 +608,7 @@ setCurrentFunctions(funcs: FunctionType): Promise\ **示例:** ```js -let funcs = HDC; +let funcs = usb.HDC; usb.setCurrentFunctions(funcs).then(() => { console.info('usb setCurrentFunctions successfully.'); }).catch(err => { @@ -716,7 +716,7 @@ setPortRoles(portId: number, powerRole: PowerRoleType, dataRole: DataRoleType): ```js let portId = 1; -usb.usb.setPortRoles(portId, usb.PowerRoleType.SOURCE, usb.DataRoleType.HOST).then(() => { +usb.setPortRoles(portId, usb.PowerRoleType.SOURCE, usb.DataRoleType.HOST).then(() => { console.info('usb setPortRoles successfully.'); }).catch(err => { console.error('usb setPortRoles failed: ' + err.code + ' message: ' + err.message); diff --git a/zh-cn/application-dev/reference/apis/js-apis-useriam-userauth.md b/zh-cn/application-dev/reference/apis/js-apis-useriam-userauth.md index 251d446bdb9f8250d97fb8e57ef3821f40248522..ecc881616acbdece068111001a82daa64a93c14c 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-useriam-userauth.md +++ b/zh-cn/application-dev/reference/apis/js-apis-useriam-userauth.md @@ -22,8 +22,8 @@ import userIAM_userAuth from '@ohos.userIAM.userAuth'; | ------------ | ---------- | ---- | -------------------- | | result | number | 是 | 认证结果。 | | token | Uint8Array | 否 | 用户身份认证通过的凭证。 | -| remainAttempts | number | 否 | 剩余的认证操作次数。 | -| lockoutDuration | number | 否 | 认证操作的冻结时间。 | +| remainAttempts | number | 否 | 剩余的认证尝试次数。 | +| lockoutDuration | number | 否 | 认证操作的锁定时长,时间单位为毫秒ms。 | ## TipInfo9+ diff --git a/zh-cn/application-dev/reference/apis/js-apis-util.md b/zh-cn/application-dev/reference/apis/js-apis-util.md index 0254aca1a63d8d2086da50f893b1c9b2f657d8c9..1e097c20cf4559465ffacc7414865f36db4162fc 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-util.md +++ b/zh-cn/application-dev/reference/apis/js-apis-util.md @@ -110,7 +110,7 @@ async function fn() { return 'hello world'; } let cb = util.callbackWrapper(fn); -cb((err, ret) => { +cb(1, (err, ret) => { if (err) throw err; console.log(ret); }); diff --git a/zh-cn/application-dev/reference/apis/js-apis-webSocket.md b/zh-cn/application-dev/reference/apis/js-apis-webSocket.md index 5eb5d8ab5f6f3d8c65e074f2be1a519492a5a249..bb4cff3e2293e3d89c9ec53f1367f41d51b18104 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-webSocket.md +++ b/zh-cn/application-dev/reference/apis/js-apis-webSocket.md @@ -104,6 +104,12 @@ connect\(url: string, callback: AsyncCallback\): void | url | string | 是 | 建立WebSocket连接的URL地址。 | | callback | AsyncCallback\ | 是 | 回调函数。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | **示例:** @@ -138,6 +144,12 @@ connect\(url: string, options: WebSocketRequestOptions, callback: AsyncCallback< | options | WebSocketRequestOptions | 是 | 参考[WebSocketRequestOptions](#websocketrequestoptions)。 | | callback | AsyncCallback\ | 是 | 回调函数。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | **示例:** @@ -182,6 +194,13 @@ connect\(url: string, options?: WebSocketRequestOptions\): Promise | :----------------- | :-------------------------------- | | Promise\ | 以Promise形式返回建立连接的结果。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | + **示例:** ```js @@ -213,6 +232,13 @@ send\(data: string | ArrayBuffer, callback: AsyncCallback\): void | data | string \| ArrayBuffer 8+ | 是 | 发送的数据。 | | callback | AsyncCallback\ | 是 | 回调函数。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | + **示例:** ```js @@ -252,6 +278,13 @@ send\(data: string | ArrayBuffer\): Promise | :----------------- | :-------------------------------- | | Promise\ | 以Promise形式返回发送数据的结果。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | + **示例:** ```js @@ -284,6 +317,13 @@ close\(callback: AsyncCallback\): void | -------- | ------------------------ | ---- | ---------- | | callback | AsyncCallback\ | 是 | 回调函数。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | + **示例:** ```js @@ -316,6 +356,13 @@ close\(options: WebSocketCloseOptions, callback: AsyncCallback\): void | options | WebSocketCloseOptions | 是 | 参考[WebSocketCloseOptions](#websocketcloseoptions)。 | | callback | AsyncCallback\ | 是 | 回调函数。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | + **示例:** ```js @@ -356,6 +403,13 @@ close\(options?: WebSocketCloseOptions\): Promise | :----------------- | :-------------------------------- | | Promise\ | 以Promise形式返回关闭连接的结果。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | + **示例:** ```js @@ -448,7 +502,6 @@ on\(type: 'message', callback: AsyncCallback\): void | type | string | 是 | 'message':WebSocket的接收到服务器消息事件。 | | callback | AsyncCallback\8+
\> | 是 | 回调函数。 | - **示例:** ```js @@ -529,7 +582,6 @@ off\(type: 'close', callback?: AsyncCallback<\{ code: number, reason: string \}\ | type | string | 是 | 'close':WebSocket的关闭事件。 | | callback | AsyncCallback<{ code: number, reason: string }> | 否 | 回调函数。 | - **示例:** ```js @@ -553,7 +605,6 @@ on\(type: 'error', callback: ErrorCallback\): void | type | string | 是 | 'error':WebSocket的Error事件。 | | callback | ErrorCallback | 是 | 回调函数。 | - **示例:** ```js diff --git a/zh-cn/application-dev/reference/apis/js-apis-webview.md b/zh-cn/application-dev/reference/apis/js-apis-webview.md index 66c9844cd14d5577a3d13bb1dc79d80fb214ea3c..7e99b7ef998884e63d9d0b54b9ce60bb3311d477 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-webview.md +++ b/zh-cn/application-dev/reference/apis/js-apis-webview.md @@ -2,7 +2,7 @@ # @ohos.web.webview (Webview) -提供web控制能力。 +@ohos.web.webview提供web控制能力,[web](../arkui-ts/ts-basic-components-web.md)组件提供具有网页显示能力。 > **说明:** > @@ -232,15 +232,15 @@ static initializeWebEngine(): void ```ts // xxx.ts -import Ability from '@ohos.application.Ability' -import web_webview from '@ohos.web.webview' +import UIAbility from '@ohos.app.ability.UIAbility'; +import web_webview from '@ohos.web.webview'; -export default class MainAbility extends Ability { +export default class EntryAbility extends UIAbility { onCreate(want, launchParam) { - console.log("MainAbility onCreate") + console.log("EntryAbility onCreate") web_webview.WebviewController.initializeWebEngine() globalThis.abilityWant = want - console.log("MainAbility onCreate done") + console.log("EntryAbility onCreate done") } } ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-window.md b/zh-cn/application-dev/reference/apis/js-apis-window.md index ca8c36843fce7dd7fbbbeaf8f97a16a313a9ef79..008d1ce9036020ed617a1ed1a4924b4f525f72ec 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-window.md +++ b/zh-cn/application-dev/reference/apis/js-apis-window.md @@ -40,7 +40,7 @@ import window from '@ohos.window'; | TYPE_LAUNCHER_DOCK9+ | 12 | 表示桌面Dock栏。
**模型约束:** 此接口仅可在Stage模型下使用。
**系统接口:** 此接口为系统接口。 | | TYPE_VOICE_INTERACTION9+ | 13 | 表示智慧语音。
**模型约束:** 此接口仅可在Stage模型下使用。
**系统接口:** 此接口为系统接口。 | | TYPE_POINTER9+ | 14 | 表示鼠标。
**模型约束:** 此接口仅可在Stage模型下使用。
**系统接口:** 此接口为系统接口。 | -| TYPE_FLOAT_CAMERA9+ | 15 | 表示相机类型悬浮窗。
**模型约束:** 此接口仅可在Stage模型下使用。
**需要权限:** ohos.permission.SYSTEM_FLOAT_WINDOW | +| TYPE_FLOAT_CAMERA9+ | 15 | 表示相机类型悬浮窗。
**模型约束:** 此接口仅可在Stage模型下使用。
**系统接口:** 此接口为系统接口。 | | TYPE_DIALOG9+ | 16 | 表示模态窗口。
**模型约束:** 此接口仅可在Stage模型下使用。
**系统接口:** 此接口为系统接口。 | | TYPE_SCREENSHOT9+ | 17 | 表示截屏窗口。
**模型约束:** 此接口仅可在Stage模型下使用。
**系统接口:** 此接口为系统接口。 | diff --git a/zh-cn/application-dev/reference/arkui-js/js-components-custom-basic-usage.md b/zh-cn/application-dev/reference/arkui-js/js-components-custom-basic-usage.md index bbd00b8c1bf389bc026f2f3617fc3cc70e93cdd4..18cf415472a1b896c485b35bea6dfe5fe0583695 100644 --- a/zh-cn/application-dev/reference/arkui-js/js-components-custom-basic-usage.md +++ b/zh-cn/application-dev/reference/arkui-js/js-components-custom-basic-usage.md @@ -3,7 +3,7 @@ 自定义组件是用户根据业务需求,将已有的组件组合,封装成的新组件,可以在工程中多次调用,从而提高代码的可读性。自定义组件通过element引入到宿主页面,使用方法如下: ```html - +
@@ -12,8 +12,8 @@ 结合if-else使用自定义组件的示例,showComp1为true时显示自定义组件comp1,否则显示comp2: ```html - - + +
@@ -76,7 +76,7 @@ export default { ```html - +
@@ -125,7 +125,7 @@ export default { ```html - +
父组件:{{text}} diff --git a/zh-cn/application-dev/reference/arkui-js/js-components-custom-props.md b/zh-cn/application-dev/reference/arkui-js/js-components-custom-props.md index a384d0cce0f98cbb715089815d29acc5285db440..882d732f5a7e097dcfb573c49b67101a85f2dfcd 100644 --- a/zh-cn/application-dev/reference/arkui-js/js-components-custom-props.md +++ b/zh-cn/application-dev/reference/arkui-js/js-components-custom-props.md @@ -21,7 +21,7 @@ export default { ```html - +
@@ -57,7 +57,7 @@ export default { ```html - +
diff --git a/zh-cn/application-dev/reference/arkui-js/js-components-custom-slot.md b/zh-cn/application-dev/reference/arkui-js/js-components-custom-slot.md index f5bceca1a24068409268c4e600872f24afafcba3..b3d541c6c8473b6a6da0d74348f0f98d97ef39cc 100644 --- a/zh-cn/application-dev/reference/arkui-js/js-components-custom-slot.md +++ b/zh-cn/application-dev/reference/arkui-js/js-components-custom-slot.md @@ -20,7 +20,7 @@ 引用该自定义组件方式如下: ```html - +
父组件中定义的内容 @@ -45,7 +45,7 @@ 引用该自定义组件方式如下: ```html - +
插入第二个插槽中 diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_000000127777774.png b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_000000127777774.png index 60f430b646b45a3e3b16a9bb024e4a14e48bf4d3..24edbed60b52947c5effbba951a6523582603f30 100644 Binary files a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_000000127777774.png and b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_000000127777774.png differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_000000127777775.png b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_000000127777775.png index 60f430b646b45a3e3b16a9bb024e4a14e48bf4d3..24edbed60b52947c5effbba951a6523582603f30 100644 Binary files a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_000000127777775.png and b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_000000127777775.png differ diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-animatorproperty.md b/zh-cn/application-dev/reference/arkui-ts/ts-animatorproperty.md index adfe8558de0cf3cac1ec2cbe908c18c75a11f0ab..546783781c7be91d1eccd6d11de8fd9a954f3db7 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-animatorproperty.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-animatorproperty.md @@ -6,20 +6,21 @@ > > 从API Version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 - animation(value: {duration?: number, tempo?: number, curve?: string | Curve | ICurve, delay?:number, iterations: number, playMode?: PlayMode, onFinish?: () => void}) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 名称 | 参数类型 | 必填 | 描述 | | ---------- | ------------------------------------------| ---- | ------------------------------------------------------------ | -| duration | number | 否 | 设置动画时长。单位为毫秒,默认动画时长为1000毫秒。
默认值:1000 | +| duration | number | 否 | 设置动画时长。单位为毫秒,默认动画时长为1000毫秒。
默认值:1000
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
- 在ArkTS卡片上最大动画持续时间为1000毫秒,若超出则固定为1000毫秒。 | | tempo | number | 否 | 动画播放速度。数值越大,动画播放速度越快,数值越小,播放速度越慢
值为0时,表示不存在动画。
默认值:1 | -| curve | string \| [Curve](ts-appendix-enums.md#curve) \| ICurve9+ | 否 | 设置动画曲线。默认曲线为线性。
默认值:Curve.Linear | +| curve | string \| [Curve](ts-appendix-enums.md#curve) \| ICurve9+ | 否 | 设置动画曲线。默认曲线为线性。
默认值:Curve.Linear
从API version 9开始,该接口支持在ArkTS卡片中使用。 | | delay | number | 否 | 设置动画延迟执行的时长。单位为毫秒,默认不延时播放。
默认值:0 | | iterations | number | 否 | 设置播放次数。默认播放一次,设置为-1时表示无限次播放。
默认值:1 | -| playMode | [PlayMode](ts-appendix-enums.md#playmode) | 否 | 设置动画播放模式,默认播放完成后重头开始播放。
默认值:PlayMode.Normal | -| onFinish | () => void | 否 | 状态回调,动画播放完成时触发。 | +| playMode | [PlayMode](ts-appendix-enums.md#playmode) | 否 | 设置动画播放模式,默认播放完成后重头开始播放。
默认值:PlayMode.Normal
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| onFinish | () => void | 否 | 状态回调,动画播放完成时触发。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-appendix-enums.md b/zh-cn/application-dev/reference/arkui-ts/ts-appendix-enums.md index 01bd2021d811cf64c04b249a092e45ba3c45a858..3ee1f6a1fbc402e3040d869f0fcb0ab3d75f9840 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-appendix-enums.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-appendix-enums.md @@ -2,6 +2,8 @@ ## Color +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 颜色名称 | 颜色值 | 颜色示意 | | ------------------------ | -------- | ------------------------------------------------------------ | | Black | 0x000000 | ![zh-cn_image_0000001219864153](figures/zh-cn_image_0000001219864153.png) | @@ -19,6 +21,8 @@ ## ImageFit +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | --------- | ------------------------------------------------------------ | | Contain | 保持宽高比进行缩小或者放大,使得图片完全显示在显示边界内。 | @@ -30,6 +34,8 @@ ## BorderStyle +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------ | ----------------------------------------------- | | Dotted | 显示为一系列圆点,圆点半径为borderWidth的一半。 | @@ -38,6 +44,8 @@ ## LineJoinStyle +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ----- | -------------------- | | Bevel | 使用斜角连接路径段。 | @@ -46,6 +54,8 @@ ## TouchType +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------ | ------------------------------ | | Down | 手指按下时触发。 | @@ -55,6 +65,8 @@ ## MouseButton +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------- | ---------------- | | Left | 鼠标左键。 | @@ -66,6 +78,8 @@ ## MouseAction +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------- | -------------- | | Press | 鼠标按键按下。 | @@ -75,6 +89,8 @@ ## Curve +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------------------- | ------------------------------------------------------------ | | Linear | 表示动画从头到尾的速度都是相同的。 | @@ -93,6 +109,8 @@ ## AnimationStatus +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------- | ------------------ | | Initial | 动画初始状态。 | @@ -102,6 +120,8 @@ ## FillMode +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | --------- | ------------------------------------------------------------ | | None | 动画未执行时不会将任何样式应用于目标,动画播放完成之后恢复初始默认状态。 | @@ -111,6 +131,8 @@ ## PlayMode +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ---------------- | ------------------------------------------------------------ | | Normal | 动画按正常播放。 | @@ -120,6 +142,8 @@ ## KeyType +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ---- | ---------- | | Down | 按键按下。 | @@ -127,6 +151,8 @@ ## KeySource +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | -------- | -------------------- | | Unknown | 输入设备类型未知。 | @@ -136,16 +162,18 @@ | 名称 | 描述 | | -------- | ---------------------- | -| Top | 竖直方向上边缘 | -| Center(deprecated) | 竖直方向居中位置
从API version 9开始废弃 | -| Bottom | 竖直方向下边缘 | +| Top | 竖直方向上边缘
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| Center(deprecated) | 竖直方向居中位置
从API version 9开始废弃 | +| Bottom | 竖直方向下边缘
从API version 9开始,该接口支持在ArkTS卡片中使用。 | | Baseline(deprecated) | 交叉轴方向文本基线位置
从API version 9开始废弃 | -| Start | 水平方向起始位置 | -| Middle(deprecated) | 水平方向居中位置
从API version 9开始废弃 | -| End | 水平方向末尾位置 | +| Start | 水平方向起始位置
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| Middle(deprecated) | 水平方向居中位置
从API version 9开始废弃 | +| End | 水平方向末尾位置
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## Week +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | -------- | ---------------------- | | Mon | 星期一 | @@ -158,6 +186,8 @@ ## Direction +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ---- | ---------------------- | | Ltr | 元素从左到右布局。 | @@ -166,6 +196,8 @@ ## BarState +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ---- | -------------------------------- | | Off | 不显示。 | @@ -174,6 +206,8 @@ ## EdgeEffect +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------ | ------------------------------------------------------------ | | Spring | 弹性物理动效,滑动到边缘后可以根据初始速度或通过触摸事件继续滑动一段距离,松手后回弹。 | @@ -182,6 +216,8 @@ ## Alignment +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ----------- | ---------------- | | TopStart | 顶部起始端。 | @@ -196,6 +232,8 @@ ## TransitionType +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------ | -------------------------------------------------- | | All | 指定当前的Transition动效生效在组件的所有变化场景。 | @@ -204,6 +242,8 @@ ## RelateType +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------ | ------------------------------- | | FILL | 缩放当前子组件以填充满父组件 | @@ -211,6 +251,8 @@ ## Visibility +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------- | -------------------------------- | | Hidden | 隐藏,但参与布局进行占位。 | @@ -219,6 +261,8 @@ ## LineCapStyle +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------ | -------------------- | | Butt | 线条两端为平行线,不额外扩展。 | @@ -227,6 +271,8 @@ ## Axis +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ---------- | ------------ | | Vertical | 方向为纵向。 | @@ -234,6 +280,8 @@ ## HorizontalAlign +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------ | ------------------------ | | Start | 按照语言方向起始端对齐。 | @@ -242,6 +290,8 @@ ## FlexAlign +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------------ | ------------------------------------------------------------ | | Start | 元素在主轴方向首端对齐,第一个元素与行首对齐,同时后续的元素与前一个对齐。 | @@ -253,6 +303,8 @@ ## ItemAlign +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | -------- | ------------------------------------------------------------ | | Auto | 使用Flex容器中默认配置。 | @@ -264,6 +316,8 @@ ## FlexDirection +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------------- | ------------------------------ | | Row | 主轴与行方向一致作为布局模式。 | @@ -273,6 +327,8 @@ ## FlexWrap +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ----------- | ------------------------------------------------- | | NoWrap | Flex容器的元素单行/列布局,子项不允许超出容器。 | @@ -281,6 +337,8 @@ ## VerticalAlign +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------ | ------------------------ | | Top | 顶部对齐。 | @@ -289,6 +347,8 @@ ## ImageRepeat +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | -------- | -------------------------- | | X | 只在水平轴上重复绘制图片。 | @@ -298,6 +358,8 @@ ## ImageSize +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 类型 | 描述 | | ------- | ------------------------------------------------------------ | | Cover | 默认值,保持宽高比进行缩小或者放大,使得图片两边都大于或等于显示边界。 | @@ -306,6 +368,8 @@ ## GradientDirection +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ----------- | ---------- | | Left | 从右向左。 | @@ -320,6 +384,8 @@ ## SharedTransitionEffectType +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ----------- | ---------- | | Static | 目标页面元素的位置保持不变,可以配置透明度动画。目前,只有为重定向到目标页面而配置的静态效果才会生效。 | @@ -327,6 +393,8 @@ ## FontStyle +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------ | ---------------- | | Normal | 标准的字体样式。 | @@ -334,6 +402,8 @@ ## FontWeight +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------- | -------------- | | Lighter | 字体较细。 | @@ -345,6 +415,8 @@ ## TextAlign +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------ | -------------- | | Start | 水平对齐首部。 | @@ -353,6 +425,8 @@ ## TextOverflow +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | -------- | -------------------------------------- | | Clip | 文本超长时进行裁剪显示。 | @@ -361,6 +435,8 @@ ## TextDecorationType +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ----------- | ------------------ | | Underline | 文字下划线修饰。 | @@ -370,6 +446,8 @@ ## TextCase +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | --------- | -------------------- | | Normal | 保持文本原有大小写。 | @@ -378,6 +456,8 @@ ## ResponseType8+ +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ---------- | -------------------------- | | LongPress | 通过长按触发菜单弹出。 | @@ -385,6 +465,8 @@ ## HoverEffect8+ +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | --------- | ---------------------------- | | Auto | 使用组件的系统默认悬浮效果。 | @@ -394,6 +476,8 @@ ## Placement8+ +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------------- | ------------------------------------------------------------ | | Left | 气泡提示位于组件左侧,与组件左侧中心对齐。 | @@ -411,6 +495,8 @@ ## CopyOptions9+ +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ----------- | -------------------- | | None | 不支持复制。 | @@ -419,6 +505,8 @@ ## HitTestMode9+ +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ----------- | -------------------- | | Default | 自身节点和子节点都响应触摸事件的命中测试,但会阻止被该节点屏蔽的其他节点的命中测试。 | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-blank.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-blank.md index 6d1d1b49596bbd1dc23c5852b8e471918e5d58cf..16bb9d5c487dc9b47ef9302ce1a3ad9d8942f85c 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-blank.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-blank.md @@ -16,6 +16,8 @@ Blank(min?: number | string) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | @@ -28,7 +30,7 @@ Blank(min?: number | string) | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | -| color | [ResourceColor](ts-types.md#resourcecolor) | 设置空白填充的填充颜色。 | +| color | [ResourceColor](ts-types.md#resourcecolor) | 设置空白填充的填充颜色。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-button.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-button.md index 3579acfe447e6c34457ea9337d0502357c9d5a43..2483a6f2d4a4c18ecdd17d5b15e4f4faa37557dd 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-button.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-button.md @@ -16,6 +16,8 @@ **方法1:** Button(options?: {type?: ButtonType, stateEffect?: boolean}) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | @@ -28,6 +30,8 @@ 使用文本内容创建相应的按钮组件,此时Button无法包含子组件。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | @@ -40,10 +44,13 @@ | 名称 | 参数类型 | 描述 | | ----------- | ----------- | --------------------------------- | -| type | ButtonType | 设置Button样式。
默认值:ButtonType.Capsule | -| stateEffect | boolean | 按钮按下时是否开启按压态显示效果,当设置为false时,按压效果关闭。
默认值:true | +| type | ButtonType | 设置Button样式。
默认值:ButtonType.Capsule
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| stateEffect | boolean | 按钮按下时是否开启按压态显示效果,当设置为false时,按压效果关闭。
默认值:true
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## ButtonType枚举说明 + +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------- | ------------------ | | Capsule | 胶囊型按钮(圆角默认为高度的一半)。 | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-checkbox.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-checkbox.md index 9d1669047af57332bf85b5a6122bd183ed2b49e7..ab5f04d2981a6a063355d022a66eacd492011199 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-checkbox.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-checkbox.md @@ -14,6 +14,8 @@ Checkbox(options?: {name?: string, group?: string }) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | @@ -28,16 +30,16 @@ Checkbox(options?: {name?: string, group?: string }) | 名称 | 参数类型 | 描述 | | ------------- | ------- | -------- | -| select | boolean | 设置多选框是否选中。
默认值:false | -| selectedColor | [ResourceColor](ts-types.md#resourcecolor) | 设置多选框选中状态颜色。 | +| select | boolean | 设置多选框是否选中。
默认值:false
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| selectedColor | [ResourceColor](ts-types.md#resourcecolor) | 设置多选框选中状态颜色。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 事件 支持[通用事件](ts-universal-events-click.md)外,还支持以下事件: -| 名称 | 功能描述 | -| ----------| -------- | -|onChange(callback: (value: boolean) => void) | 当选中状态发生变化时,触发该回调。(只有手动触发且Checkbox状态改变时才会触发onChange回调)
- value为true时,表示已选中。
- value为false时,表示未选中。 | +| 名称 | 功能描述 | +| -------------------------------------------- | ------------------------------------------------------------ | +| onChange(callback: (value: boolean) => void) | 当选中状态发生变化时,触发该回调。(只有手动触发且Checkbox状态改变时才会触发onChange回调)
- value为true时,表示已选中。
- value为false时,表示未选中。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-checkboxgroup.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-checkboxgroup.md index df19c5e7c4a4781734ad174552f239fe63219a81..70d75bc16fce4d7e7f7ef8a86082594e550cd062 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-checkboxgroup.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-checkboxgroup.md @@ -16,9 +16,9 @@ CheckboxGroup(options?: { group?: string }) 创建多选框群组,可以控制群组内的Checkbox全选或者不全选,group值相同的Checkbox和CheckboxGroup为同一群组。 -**参数:** - +从API version 9开始,该接口支持在ArkTS卡片中使用。 +**参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | | -------- | -------- | -------- | -------- | @@ -30,8 +30,8 @@ CheckboxGroup(options?: { group?: string }) | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | -| selectAll | boolean | 设置是否全选。
默认值:false,若同组的Checkbox显式设置select,则Checkbox的优先级高。 | -| selectedColor | [ResourceColor](ts-types.md#resourcecolor) | 设置被选中或部分选中状态的颜色。 | +| selectAll | boolean | 设置是否全选。
默认值:false,若同组的Checkbox显式设置select,则Checkbox的优先级高。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| selectedColor | [ResourceColor](ts-types.md#resourcecolor) | 设置被选中或部分选中状态的颜色。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 事件 @@ -39,9 +39,12 @@ CheckboxGroup(options?: { group?: string }) | 名称 | 功能描述 | | -------- | -------- | -| onChange (callback: (event: [CheckboxGroupResult](#checkboxgroupresult对象说明)) => void ) |CheckboxGroup的选中状态或群组内的Checkbox的选中状态发生变化时,触发回调。(只有手动触发且Checkbox或CheckboxGroup状态改变时才会触发onChange回调)| +| onChange (callback: (event: [CheckboxGroupResult](#checkboxgroupresult对象说明)) => void ) |CheckboxGroup的选中状态或群组内的Checkbox的选中状态发生变化时,触发回调。(只有手动触发且Checkbox或CheckboxGroup状态改变时才会触发onChange回调)
从API version 9开始,该接口支持在ArkTS卡片中使用。| ## CheckboxGroupResult对象说明 + +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 类型 | 描述 | | ------ | ------ | ------- | | name | Array<string> | 群组内所有被选中的多选框名称。 | @@ -49,6 +52,8 @@ CheckboxGroup(options?: { group?: string }) ## SelectStatus枚举说明 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ----- | -------------------- | | All | 群组多选择框全部选择。 | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-datapanel.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-datapanel.md index 49309776f39130ac5b3641563ba7826615c810b6..4adb26c5466bd1b1df352ed4b1775dfb0fc260a6 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-datapanel.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-datapanel.md @@ -18,6 +18,8 @@ DataPanel(options:{values: number[], max?: number, type?: DataPanelType}) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | @@ -26,8 +28,10 @@ DataPanel(options:{values: number[], max?: number, type?: DataPanelType}) | max | number | 否 | - max大于0,表示数据的最大值。
- max小于等于0,max等于value数组各项的和,按比例显示。
默认值:100 | | type8+ | [DataPanelType](#datapaneltype枚举说明) | 否 | 数据面板的类型(不支持动态修改)。
默认值:DataPanelType.Circle | - ## DataPanelType枚举说明 + +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | -------| ------------ | | Line | 线型数据面板。 | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-divider.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-divider.md index 46f2ac309214572ce06ddc33505ff882353ff43d..5dfb1e71dee75a73698c1141fc46a4a950223e07 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-divider.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-divider.md @@ -16,16 +16,18 @@ Divider() +从API version 9开始,该接口支持在ArkTS卡片中使用。 + ## 属性 除支持[通用属性](ts-universal-attributes-size.md)外,还支持以下属性: | 名称 | 参数类型 | 描述 | | ----------- | ---------- | ------------------ | -| vertical | boolean | 使用水平分割线还是垂直分割线。false:水平分割线;true:垂直分割线。
默认值:false | -| color | [ResourceColor](ts-types.md#resourcecolor) | 分割线颜色。 | -| strokeWidth | number \| string | 分割线宽度。
默认值:1 | -| lineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | 分割线的端点样式。
默认值:LineCapStyle.Butt | +| vertical | boolean | 使用水平分割线还是垂直分割线。false:水平分割线;true:垂直分割线。
默认值:false
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| color | [ResourceColor](ts-types.md#resourcecolor) | 分割线颜色。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeWidth | number \| string | 分割线宽度。
默认值:1
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| lineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | 分割线的端点样式。
默认值:LineCapStyle.Butt
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 事件 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-formcomponent.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-formcomponent.md index d451d3fd941f47c54577fc54125255a713e35ea7..c8737ca8a0712ae7f8025b17fa46c1f4762c38f4 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-formcomponent.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-formcomponent.md @@ -108,7 +108,7 @@ struct CardExample { .visibility(Visibility.Visible) .onAcquired((form)=>{ console.log(`form info : ${JSON.stringify(form)}`); - this.fomId = form.id; + this.formId = form.id; }) .onError((err)=>{ console.log(`fail to add form, err: ${JSON.stringify(err)}`); diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-gauge.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-gauge.md index 16884200f16f3521dcd875a035f242050afb282a..8f2609ef6a4828d2703f7066e08036266a107ca9 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-gauge.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-gauge.md @@ -17,6 +17,8 @@ Gauge(options:{value: number, min?: number, max?: number}) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | @@ -31,16 +33,18 @@ Gauge(options:{value: number, min?: number, max?: number}) | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | -| value | number | 设置量规图的数据值,可用于动态修改量规图的数据值。
默认值:0 | -| startAngle | number | 设置起始角度位置,时钟0点为0度,顺时针方向为正角度。
默认值:0 | -| endAngle | number | 设置终止角度位置,时钟0点为0度,顺时针方向为正角度。
默认值:360 | -| colors | Array<[ColorStop](#colorstop)> | 设置量规图的颜色,支持分段颜色设置。 | -| strokeWidth | Length | 设置环形量规图的环形厚度。 | +| value | number | 设置量规图的数据值,可用于动态修改量规图的数据值。
默认值:0
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| startAngle | number | 设置起始角度位置,时钟0点为0度,顺时针方向为正角度。
默认值:0
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| endAngle | number | 设置终止角度位置,时钟0点为0度,顺时针方向为正角度。
默认值:360
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| colors | Array<[ColorStop](#colorstop)> | 设置量规图的颜色,支持分段颜色设置。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeWidth | Length | 设置环形量规图的环形厚度。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## ColorStop 颜色断点类型,用于描述渐进色颜色断点。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 类型定义 | 描述 | | --------- | -------------------- | ------------------------------------------------------------ | | ColorStop | [[ResourceColor](ts-types.md#resourcecolor), number] | 描述渐进色颜色断点类型,第一个参数为颜色值,若设置为非颜色类型,则置为黑色。第二个参数为颜色所占比重,若设置为负数或是非数值类型,则将比重置为0,该颜色不显示。 | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-image.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-image.md index 36dbeca9f84b24ff8c1c7d456ff604c092833c9f..4b75b65ca53169850c7732be1bbe9594a600cf4d 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-image.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-image.md @@ -23,11 +23,13 @@ Image(src: string | PixelMap | Resource) 通过图片数据源获取图片,用于后续渲染展示。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | | ------ | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| src | string\| [PixelMap](../apis/js-apis-image.md#pixelmap7) \| [Resource](ts-types.md#resource类型) | 是 | 图片的数据源,支持本地图片和网络图片。
当使用相对路径引用图片资源时,例如`Image("common/test.jpg")`,不支持跨包/跨模块调用该Image组件,建议使用`$r`方式来管理需全局使用的图片资源。
\- 支持的图片格式包括png、jpg、bmp、svg和gif。
\- 支持`Base64`字符串。格式`data:image/[png\|jpeg\|bmp\|webp];base64,[base64 data]`, 其中`[base64 data]`为`Base64`字符串数据。
\- 支持`datashare://`路径前缀的字符串,用于访问通过data ability提供的图片路径。图片加载前需要申请[媒体库功能相关权限](../../file-management/medialibrary-overview.md#申请媒体库功能相关权限)
\- 支持file:///data/storage路径前缀的字符串,用于读取本应用安装目录下files文件夹下的图片资源。需要保证目录包路径下的文件有可读权限。 | +| src | string\| [PixelMap](../apis/js-apis-image.md#pixelmap7) \| [Resource](ts-types.md#resource类型) | 是 | 图片的数据源,支持本地图片和网络图片。
当使用相对路径引用图片资源时,例如`Image("common/test.jpg")`,不支持跨包/跨模块调用该Image组件,建议使用`$r`方式来管理需全局使用的图片资源。
\- 支持的图片格式包括png、jpg、bmp、svg和gif。
\- 支持`Base64`字符串。格式`data:image/[png\|jpeg\|bmp\|webp];base64,[base64 data]`, 其中`[base64 data]`为`Base64`字符串数据。
\- 支持`datashare://`路径前缀的字符串,用于访问通过data ability提供的图片路径。图片加载前需要申请[媒体库功能相关权限](../../file-management/medialibrary-overview.md#申请媒体库功能相关权限)
\- 支持file:///data/storage路径前缀的字符串,用于读取本应用安装目录下files文件夹下的图片资源。需要保证目录包路径下的文件有可读权限。
**说明:**
- ArkTS卡片上支持gif图片格式动效,但仅在显示时播放一次。
- ArkTS卡片上不支持`http://`等网络相关路径前缀、`datashare://`路径前缀以及`file://data/storage`路径前缀的字符串
- ArkTS卡片上不支持 [PixelMap](../apis/js-apis-image.md#pixelmap7)类型 | ## 属性 @@ -35,19 +37,19 @@ Image(src: string | PixelMap | Resource) | 名称 | 参数类型 | 描述 | | --------------------- | ------------------------------------------------------- | ------------------------------------------------------------ | -| alt | string \| [Resource](ts-types.md#resource类型) | 加载时显示的占位图,支持本地图片。 | -| objectFit | [ImageFit](ts-appendix-enums.md#imagefit) | 设置图片的缩放类型。
默认值:ImageFit.Cover | -| objectRepeat | [ImageRepeat](ts-appendix-enums.md#imagerepeat) | 设置图片的重复样式。
默认值:ImageRepeat.NoRepeat
**说明:**
svg类型图源不支持该属性。 | -| interpolation | [ImageInterpolation](#imageinterpolation) | 设置图片的插值效果,即减轻低清晰度图片在放大显示的时候出现的锯齿问题,仅针对图片放大插值。
默认值:ImageInterpolation.None
**说明:**
svg类型图源不支持该属性。
PixelMap资源不支持该属性。 | -| renderMode | [ImageRenderMode](#imagerendermode) | 设置图片渲染的模式。
默认值:ImageRenderMode.Original
**说明:**
svg类型图源不支持该属性。 | -| sourceSize | {
width: number,
height: number
} | 设置图片裁剪尺寸,将原始图片解码成pixelMap,指定尺寸的图片,单位为px。
**说明:**
PixelMap资源和SVG图片不支持该属性。 | -| matchTextDirection | boolean | 设置图片是否跟随系统语言方向,在RTL语言环境下显示镜像翻转显示效果。
默认值:false | -| fitOriginalSize | boolean | 图片组件尺寸未设置时,其显示尺寸是否跟随图源尺寸。
默认值:false | -| fillColor | [ResourceColor](ts-types.md#resourcecolor) | 填充颜色。设置的填充颜色会覆盖在图片上。仅对svg图源生效,设置后会替换svg图片的fill颜色。 | -| autoResize | boolean | 是否需要在图片解码过程中对图源做resize操作,该操作会根据显示区域的尺寸决定用于绘制的图源尺寸,有利于减少内存占用。
默认值:true | -| syncLoad8+ | boolean | 设置是否同步加载图片,默认是异步加载。同步加载时阻塞UI线程,不会显示占位图。
默认值:false | -| copyOption9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | 设置图片是否可复制(SVG图片不支持复制)。
当copyOption设置为非CopyOptions.None时,支持使用长按、鼠标右击、快捷组合键'CTRL+C'等方式进行复制。
默认值:CopyOptions.None | -| colorFilter9+ | [ColorFilter](ts-types.md#colorfilter9) | 给图像设置颜色滤镜效果。 | +| alt | string \| [Resource](ts-types.md#resource类型) | 加载时显示的占位图,支持本地图片。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| objectFit | [ImageFit](ts-appendix-enums.md#imagefit) | 设置图片的缩放类型。
默认值:ImageFit.Cover
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| objectRepeat | [ImageRepeat](ts-appendix-enums.md#imagerepeat) | 设置图片的重复样式。
默认值:ImageRepeat.NoRepeat
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
svg类型图源不支持该属性。 | +| interpolation | [ImageInterpolation](#imageinterpolation) | 设置图片的插值效果,即减轻低清晰度图片在放大显示的时候出现的锯齿问题,仅针对图片放大插值。
默认值:ImageInterpolation.None
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
svg类型图源不支持该属性。
PixelMap资源不支持该属性。 | +| renderMode | [ImageRenderMode](#imagerendermode) | 设置图片渲染的模式。
默认值:ImageRenderMode.Original
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
svg类型图源不支持该属性。 | +| sourceSize | {
width: number,
height: number
} | 设置图片裁剪尺寸,将原始图片解码成pixelMap,指定尺寸的图片,单位为px。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
PixelMap资源和SVG图片不支持该属性。 | +| matchTextDirection | boolean | 设置图片是否跟随系统语言方向,在RTL语言环境下显示镜像翻转显示效果。
默认值:false
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| fitOriginalSize | boolean | 图片组件尺寸未设置时,其显示尺寸是否跟随图源尺寸。
默认值:false
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| fillColor | [ResourceColor](ts-types.md#resourcecolor) | 填充颜色。设置的填充颜色会覆盖在图片上。仅对svg图源生效,设置后会替换svg图片的fill颜色。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| autoResize | boolean | 是否需要在图片解码过程中对图源做resize操作,该操作会根据显示区域的尺寸决定用于绘制的图源尺寸,有利于减少内存占用。
默认值:true
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| syncLoad8+ | boolean | 设置是否同步加载图片,默认是异步加载。同步加载时阻塞UI线程,不会显示占位图。
默认值:false
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| copyOption9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | 设置图片是否可复制(SVG图片不支持复制)。
当copyOption设置为非CopyOptions.None时,支持使用长按、鼠标右击、快捷组合键'CTRL+C'等方式进行复制。
默认值:CopyOptions.None
该接口支持在ArkTS卡片中使用。 | +| colorFilter9+ | [ColorFilter](ts-types.md#colorfilter9) | 给图像设置颜色滤镜效果。
该接口支持在ArkTS卡片中使用。 | > **说明:** > @@ -56,6 +58,8 @@ Image(src: string | PixelMap | Resource) ### ImageInterpolation +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------ | ------------------------- | | None | 不使用插值图片数据。 | @@ -65,6 +69,8 @@ Image(src: string | PixelMap | Resource) ### ImageRenderMode +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | -------- | --------------------- | | Original | 按照原图进行渲染,包括颜色。 | @@ -76,9 +82,9 @@ Image(src: string | PixelMap | Resource) | 名称 | 功能描述 | | ------------------------------------------------------------ | ------------------------------------------------------------ | -| onComplete(callback: (event?: { width: number, height: number, componentWidth: number,
 componentHeight: number, loadingStatus: number }) => void) | 图片成功加载时触发该回调,返回成功加载的图片尺寸。
- width:图片的宽,单位为像素。
- height:图片的高,单位为像素。
- componentWidth:组件的宽,单位为像素。
- componentHeight:组件的高,单位为像素。
- loadingStatus:图片加载成功的状态。
| -| onError(callback: (event?: { componentWidth: number, componentHeight: number , message9+: string }) => void) | 图片加载出现异常时触发该回调。
- componentWidth:组件的宽,单位为像素。
- componentHeight:组件的高,单位为像素。 | -| onFinish(event: () => void) | 当加载的源文件为带动效的svg图片时,当svg动效播放完成时会触发这个回调,如果动效为无限循环动效,则不会触发这个回调。 | +| onComplete(callback: (event?: { width: number, height: number, componentWidth: number,
 componentHeight: number, loadingStatus: number }) => void) | 图片成功加载时触发该回调,返回成功加载的图片尺寸。
- width:图片的宽,单位为像素。
- height:图片的高,单位为像素。
- componentWidth:组件的宽,单位为像素。
- componentHeight:组件的高,单位为像素。
- loadingStatus:图片加载成功的状态。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| onError(callback: (event?: { componentWidth: number, componentHeight: number , message9+: string }) => void) | 图片加载出现异常时触发该回调。
- componentWidth:组件的宽,单位为像素。
- componentHeight:组件的高,单位为像素。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| onFinish(event: () => void) | 当加载的源文件为带动效的svg图片时,当svg动效播放完成时会触发这个回调,如果动效为无限循环动效,则不会触发这个回调。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 @@ -353,20 +359,16 @@ struct ImageExample3 { ### 渲染沙箱路径图片 ```ts -import fileio from '@ohos.fileio' -import fs from '@ohos.file.fs' -import context from '@ohos.application.context' +import fileio from '@ohos.fileio'; +import fs from '@ohos.file.fs'; +import context from '@ohos.app.ability.common'; @Entry @Component struct LoadImageExample { @State resourcesPath: string = '' @State sandboxPath: string = '' - context: context.AbilityContext - - aboutToAppear() { - this.context = getContext(this) as context.AbilityContext - } + context: context.UIAbility = getContext(this) as context.UIAbilityContext build() { Column() { diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-loadingprogress.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-loadingprogress.md index d52eaf34dbfe8a77bebb67e3e18f43238e35644a..b75519c1419a2d30ec0b4c2ae34112f2ab73b502 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-loadingprogress.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-loadingprogress.md @@ -18,11 +18,13 @@ LoadingProgress() 创建加载进展组件。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + ## 属性 | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | -| color | [ResourceColor](ts-types.md#resourcecolor) | 设置加载进度条前景色。 | +| color | [ResourceColor](ts-types.md#resourcecolor) | 设置加载进度条前景色。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-marquee.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-marquee.md index bb26b0a9af1b258a36a7ca6c5eef246fd8274740..bbf92272113f7c71bcfdeaeee4570e11947566cc 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-marquee.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-marquee.md @@ -17,29 +17,31 @@ Marquee(value: { start: boolean, step?: number, loop?: number, fromStart?: boolean, src: string }) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | | -------- | -------- | -------- | -------- | | start | boolean | 是 | 控制跑马灯是否进入播放状态。 | | step | number | 否 | 滚动动画文本滚动步长。
默认值:6,单位vp | -| loop | number | 否 | 设置重复滚动的次数,小于等于零时无限循环。
默认值:-1 | +| loop | number | 否 | 设置重复滚动的次数,小于等于零时无限循环。
默认值:-1
**说明:**
ArkTS卡片上该参数设置任意值都仅在可见时滚动一次。 | | fromStart | boolean | 否 | 设置文本从头开始滚动或反向滚动。
默认值:true | | src | string | 是 | 需要滚动的文本。 | ## 属性 -| 名称 | 参数类型 | 描述 | -| ---------- | -------- | ------------------------------------ | -| allowScale | boolean | 是否允许文本缩放。
默认值:false | +| 名称 | 参数类型 | 描述 | +| ---------- | -------- | ------------------------------------------------------------ | +| allowScale | boolean | 是否允许文本缩放。
默认值:false
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 事件 | 名称 | 功能描述 | | -------- | -------- | -| onStart(event: () => void) | 开始滚动时触发回调。 | -| onBounce(event: () => void) | 完成一次滚动时触发,若循环次数不为1,则该事件会多次触发。 | -| onFinish(event: () => void) | 滚动全部循环次数完成时触发回调。 | +| onStart(event: () => void) | 开始滚动时触发回调。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| onBounce(event: () => void) | 完成一次滚动时触发,若循环次数不为1,则该事件会多次触发。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| onFinish(event: () => void) | 滚动全部循环次数完成时触发回调。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-menu.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-menu.md index 3bcdbdb380cffb2e6fa4f3c0f554600270e4d671..dde03192a4d6bbcc5a935e4a0072351436c03131 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-menu.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-menu.md @@ -1,6 +1,6 @@ # Menu -以垂直列表形式显示的菜单,优先用于PC端的菜单开发。 +以垂直列表形式显示的菜单。 > **说明:** > diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-plugincomponent.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-plugincomponent.md index 0bad69d7c539028e0e165cc3e16a27ca93575876..f4d92ad423e1a47497d5673b2ce8dea3a587f09d 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-plugincomponent.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-plugincomponent.md @@ -46,7 +46,7 @@ PluginComponent(value: { template: PluginComponentTemplate, data: KVObject}) ```ts //PluginUserExample.ets -import plugin from "plugin_component.js" +import plugin from "./plugin_component.js" @Entry @Component @@ -102,7 +102,7 @@ struct PluginUserExample { ```ts //PluginProviderExample.ets -import plugin from "plugin_component.js" +import plugin from "./plugin_component.js" @Entry @Component diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-progress.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-progress.md index 85d343bdb5a1e405b2a30f966d1f3f5d2099ab55..69b6d182ffbf5d3bea4e4f47d6163c4ecf0109ca 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-progress.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-progress.md @@ -18,17 +18,21 @@ Progress(options: {value: number, total?: number, type?: ProgressType}) 创建进度组件,用于显示内容加载或操作处理进度。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | | -------- | -------- | -------- | -------- | -| value | number | 是 | 指定当前进度值。设置小于0的数值时置为0,设置大于total的数值时置为total。 | -| total | number | 否 | 指定进度总长。
默认值:100 | -| type8+ | [ProgressType](#progresstype枚举说明) | 否 | 指定进度条类型。
默认值:ProgressType.Linear | +| value | number | 是 | 指定当前进度值。设置小于0的数值时置为0,设置大于total的数值时置为total。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| total | number | 否 | 指定进度总长。
默认值:100
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| type8+ | [ProgressType](#progresstype枚举说明) | 否 | 指定进度条类型。
默认值:ProgressType.Linear
从API version 9开始,该接口支持在ArkTS卡片中使用。 | | styledeprecated | [ProgressStyle](#progressstyle枚举说明) | 否 | 指定进度条样式。
该参数从API version8开始废弃,建议使用type替代。
默认值:ProgressStyle.Linear | ## ProgressType枚举说明 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | -------- | -------- | | Linear | 线性样式。从API version9开始,高度大于宽度的时候自适应垂直显示。 | @@ -39,6 +43,8 @@ Progress(options: {value: number, total?: number, type?: ProgressType}) ## ProgressStyle枚举说明 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | --------- | ------------------------------------------------------------ | | Linear | 线性样式。 | @@ -51,10 +57,10 @@ Progress(options: {value: number, total?: number, type?: ProgressType}) | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | -| value | number | 设置当前进度值。设置小于0的数值时置为0,设置大于total的数值时置为total。非法数值不生效。 | -| color | [ResourceColor](ts-types.md#resourcecolor) | 设置进度条前景色。 | -| backgroundColor | [ResourceColor](ts-types.md#resourcecolor) | 设置进度条底色。 | -| style8+ | {
strokeWidth?: [Length](ts-types.md#length),
scaleCount?: number,
scaleWidth?: [Length](ts-types.md#length)
} | 定义组件的样式。
- strokeWidth: 设置进度条宽度(不支持百分比设置)。从API version9开始,环形进度条设置宽度大于等于半径时,默认修改宽度至半径值的二分之一。
默认值:4.0Vp
- scaleCount: 设置环形进度条总刻度数。
默认值:120
- scaleWidth: 设置环形进度条刻度粗细(不支持百分比设置),刻度粗细大于进度条宽度时,为系统默认粗细。
默认值:2.0Vp | +| value | number | 设置当前进度值。设置小于0的数值时置为0,设置大于total的数值时置为total。非法数值不生效。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| color | [ResourceColor](ts-types.md#resourcecolor) | 设置进度条前景色。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| backgroundColor | [ResourceColor](ts-types.md#resourcecolor) | 设置进度条底色。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| style8+ | {
strokeWidth?: [Length](ts-types.md#length),
scaleCount?: number,
scaleWidth?: [Length](ts-types.md#length)
} | 定义组件的样式。
- strokeWidth: 设置进度条宽度(不支持百分比设置)。从API version9开始,环形进度条设置宽度大于等于半径时,默认修改宽度至半径值的二分之一。
默认值:4.0Vp
- scaleCount: 设置环形进度条总刻度数。
默认值:120
- scaleWidth: 设置环形进度条刻度粗细(不支持百分比设置),刻度粗细大于进度条宽度时,为系统默认粗细。
默认值:2.0Vp
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-qrcode.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-qrcode.md index 89ae82004a405e536ad3e7c686190a68528b43ba..c1e1ec63eaebe421f29fbdba9656394e30c3d81a 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-qrcode.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-qrcode.md @@ -16,6 +16,8 @@ QRCode(value: string) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | @@ -28,8 +30,8 @@ QRCode(value: string) | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | -| color | [ResourceColor](ts-types.md#resourcecolor) | 设置二维码颜色。
默认值:Color.Black | -| backgroundColor | [ResourceColor](ts-types.md#resourcecolor) | 设置二维码背景颜色。
默认值:Color.White | +| color | [ResourceColor](ts-types.md#resourcecolor) | 设置二维码颜色。
默认值:Color.Black
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| backgroundColor | [ResourceColor](ts-types.md#resourcecolor) | 设置二维码背景颜色。
默认值:Color.White
从API version 9开始,该接口支持在ArkTS卡片中使用。| ## 事件 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-radio.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-radio.md index 76bc6a9a644384009be751b746e26b00df26f6c8..4a496bc9760dbaf909443ab5721d6bcc00bfd7d3 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-radio.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-radio.md @@ -16,6 +16,8 @@ Radio(options: {value: string, group: string}) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | @@ -29,7 +31,7 @@ Radio(options: {value: string, group: string}) | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | -| checked | boolean | 设置单选框的选中状态。
默认值:false | +| checked | boolean | 设置单选框的选中状态。
默认值:false
从API version 9开始,该接口支持在ArkTS卡片中使用。| ## 事件 @@ -37,7 +39,7 @@ Radio(options: {value: string, group: string}) | 名称 | 功能描述 | | -------- | -------- | -| onChange(callback: (isChecked: boolean) => void) | 单选框选中状态改变时触发回调。
-isChecked为true时,代表选中。
-isChecked为false时,代表未选中。 | +| onChange(callback: (isChecked: boolean) => void) | 单选框选中状态改变时触发回调。
-isChecked为true时,代表选中。
-isChecked为false时,代表未选中。
从API version 9开始,该接口支持在ArkTS卡片中使用。| ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-rating.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-rating.md index 458692f9d232176521f0c46d7510abc907ebb9f0..e371f92c38183f150c4b0516e4547f0638e6df57 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-rating.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-rating.md @@ -16,6 +16,8 @@ Rating(options?: { rating: number, indicator?: boolean }) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | @@ -28,16 +30,16 @@ Rating(options?: { rating: number, indicator?: boolean }) | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | -| stars | number | 设置评星总数。
默认值:5 | -| stepSize | number | 操作评级的步长。
默认值:0.5 | -| starStyle | {
backgroundUri: string,
foregroundUri: string,
secondaryUri?: string
} | backgroundUri:未选中的星级的图片链接,可由用户自定义或使用系统默认图片,仅支持本地图片。
foregroundUri:选中的星级的图片路径,可由用户自定义或使用系统默认图片,仅支持本地图片。
secondaryUir:部分选中的星级的图片路径,可由用户自定义或使用系统默认图片,仅支持本地图片。 | +| stars | number | 设置评星总数。
默认值:5
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| stepSize | number | 操作评级的步长。
默认值:0.5
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| starStyle | {
backgroundUri: string,
foregroundUri: string,
secondaryUri?: string
} | backgroundUri:未选中的星级的图片链接,可由用户自定义或使用系统默认图片,仅支持本地图片。
foregroundUri:选中的星级的图片路径,可由用户自定义或使用系统默认图片,仅支持本地图片。
secondaryUir:部分选中的星级的图片路径,可由用户自定义或使用系统默认图片,仅支持本地图片。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 事件 | 名称 | 功能描述 | | -------- | -------- | -| onChange(callback:(value: number) => void) | 操作评分条的评星发生改变时触发该回调。 | +| onChange(callback:(value: number) => void) | 操作评分条的评星发生改变时触发该回调。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-slider.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-slider.md index 647260276e3dba7f7954b38e0fe5d3ca2d557875..505ae2a43813e426426ebe8124d375a61dab9728 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-slider.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-slider.md @@ -16,6 +16,8 @@ Slider(options?: {value?: number, min?: number, max?: number, step?: number, style?: SliderStyle, direction?: Axis, reverse?: boolean}) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | @@ -30,6 +32,8 @@ Slider(options?: {value?: number, min?: number, max?: number, step?: number, sty ## SliderStyle枚举说明 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | -------- | -------- | | OutSet | 滑块在滑轨上。 | @@ -42,12 +46,12 @@ Slider(options?: {value?: number, min?: number, max?: number, step?: number, sty | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | -| blockColor | [ResourceColor](ts-types.md#resourcecolor) | 设置滑块的颜色。 | -| trackColor | [ResourceColor](ts-types.md#resourcecolor) | 设置滑轨的背景颜色。 | -| selectedColor | [ResourceColor](ts-types.md#resourcecolor) | 设置滑轨的已滑动部分颜色。 | -| showSteps | boolean | 设置当前是否显示步长刻度值。
默认值:false | -| showTips | boolean | 设置滑动时是否显示百分比气泡提示。
默认值:false | -| trackThickness | [Length](ts-types.md#length) | 设置滑轨的粗细。 | +| blockColor | [ResourceColor](ts-types.md#resourcecolor) | 设置滑块的颜色。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| trackColor | [ResourceColor](ts-types.md#resourcecolor) | 设置滑轨的背景颜色。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| selectedColor | [ResourceColor](ts-types.md#resourcecolor) | 设置滑轨的已滑动部分颜色。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| showSteps | boolean | 设置当前是否显示步长刻度值。
默认值:false
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| showTips | boolean | 设置滑动时是否显示百分比气泡提示。
默认值:false
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| trackThickness | [Length](ts-types.md#length) | 设置滑轨的粗细。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 事件 @@ -56,10 +60,12 @@ Slider(options?: {value?: number, min?: number, max?: number, step?: number, sty | 名称 | 功能描述 | | -------- | -------- | -| onChange(callback: (value: number, mode: SliderChangeMode) => void) | Slider滑动时触发事件回调。
value:当前滑动进度值。若返回值有小数,可使用Math.toFixed()方法将数据处理为预期的精度。
mode:拖动状态。 | +| onChange(callback: (value: number, mode: SliderChangeMode) => void) | Slider滑动时触发事件回调。
value:当前滑动进度值。若返回值有小数,可使用Math.toFixed()方法将数据处理为预期的精度。
mode:拖动状态。
从API version 9开始,该接口支持在ArkTS卡片中使用。| ## SliderChangeMode枚举说明 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 值 | 描述 | | -------- | -------- | -------- | | Begin | 0 | 开始拖动滑块。 | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-span.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-span.md index 5e615e7033fbe11e87ff2746df9547684a56f2d9..ebe015253108955d4c0e4f8ad029367a42da08f3 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-span.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-span.md @@ -16,6 +16,8 @@ Span(value: string | Resource) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | @@ -29,9 +31,9 @@ Span(value: string | Resource) | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | -| decoration | {
type: [TextDecorationType](ts-appendix-enums.md#textdecorationtype),
color?: [ResourceColor](ts-types.md#resourcecolor)
} | 设置文本装饰线样式及其颜色。
默认值:{
type: TextDecorationType.None
color:Color.Black
} | -| letterSpacing | number \| string | 设置文本字符间距。取值小于0,字符聚集重叠,取值大于0且随着数值变大,字符间距越来越大,稀疏分布。 | -| textCase | [TextCase](ts-appendix-enums.md#textcase) | 设置文本大小写。
默认值:TextCase.Normal | +| decoration | {
type: [TextDecorationType](ts-appendix-enums.md#textdecorationtype),
color?: [ResourceColor](ts-types.md#resourcecolor)
} | 设置文本装饰线样式及其颜色。
默认值:{
type: TextDecorationType.None
color:Color.Black
}
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| letterSpacing | number \| string | 设置文本字符间距。取值小于0,字符聚集重叠,取值大于0且随着数值变大,字符间距越来越大,稀疏分布。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| textCase | [TextCase](ts-appendix-enums.md#textcase) | 设置文本大小写。
默认值:TextCase.Normal
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 事件 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-text.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-text.md index 5431ce7579ab88a9d4972bd4fde5c47b5ae5179d..9392eef756b9c5eb3baace5dadb64b84ff4b21cc 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-text.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-text.md @@ -16,6 +16,8 @@ Text(content?: string | Resource) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | @@ -28,17 +30,17 @@ Text(content?: string | Resource) | 名称 | 参数类型 | 描述 | | ----------------------- | ----------------------------------- | ------------------------------------------- | -| textAlign | [TextAlign](ts-appendix-enums.md#textalign) | 设置文本段落在水平方向的对齐方式
默认值:TextAlign.Start
说明:
文本段落宽度占满Text组件宽度;可通过[align](ts-universal-attributes-location.md)属性控制文本段落在垂直方向上的位置。 | -| textOverflow | {overflow: [TextOverflow](ts-appendix-enums.md#textoverflow)} | 设置文本超长时的显示方式。
默认值:{overflow: TextOverflow.Clip}
**说明:**
文本截断是按字截断。例如,英文以单词为最小单位进行截断,若需要以字母为单位进行截断,可在字母间添加零宽空格:\u200B。
需配合`maxLines`使用,单独设置不生效。 | -| maxLines | number | 设置文本的最大行数。
默认值:Infinity
**说明:**
默认情况下,文本是自动折行的,如果指定此参数,则文本最多不会超过指定的行。如果有多余的文本,可以通过 `textOverflow`来指定截断方式。 | -| lineHeight | string \| number \| [Resource](ts-types.md#resource) | 设置文本的文本行高,设置值不大于0时,不限制文本行高,自适应字体大小,Length为number类型时单位为fp。 | -| decoration | {
type: [TextDecorationType](ts-appendix-enums.md#textdecorationtype),
color?: [ResourceColor](ts-types.md#resourcecolor)
} | 设置文本装饰线样式及其颜色。
默认值:{
type: TextDecorationType.None,
color:Color.Black
} | -| baselineOffset | number \| string | 设置文本基线的偏移量,默认值0。 | -| letterSpacing | number \| string | 设置文本字符间距。 | -| minFontSize | number \| string \| [Resource](ts-types.md#resource) | 设置文本最小显示字号。
需配合maxFontSize以及maxline或布局大小限制使用,单独设置不生效。 | -| maxFontSize | number \| string \| [Resource](ts-types.md#resource) | 设置文本最大显示字号。
需配合minFontSize以及maxline或布局大小限制使用,单独设置不生效。 | -| textCase | [TextCase](ts-appendix-enums.md#textcase) | 设置文本大小写。
默认值:TextCase.Normal | -| copyOption9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | 组件支持设置文本是否可复制粘贴。
默认值:CopyOptions.None | +| textAlign | [TextAlign](ts-appendix-enums.md#textalign) | 设置文本段落在水平方向的对齐方式
默认值:TextAlign.Start
说明:
文本段落宽度占满Text组件宽度;可通过[align](ts-universal-attributes-location.md)属性控制文本段落在垂直方向上的位置。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| textOverflow | {overflow: [TextOverflow](ts-appendix-enums.md#textoverflow)} | 设置文本超长时的显示方式。
默认值:{overflow: TextOverflow.Clip}
**说明:**
文本截断是按字截断。例如,英文以单词为最小单位进行截断,若需要以字母为单位进行截断,可在字母间添加零宽空格:\u200B。
需配合`maxLines`使用,单独设置不生效。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| maxLines | number | 设置文本的最大行数。
默认值:Infinity
**说明:**
默认情况下,文本是自动折行的,如果指定此参数,则文本最多不会超过指定的行。如果有多余的文本,可以通过 `textOverflow`来指定截断方式。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| lineHeight | string \| number \| [Resource](ts-types.md#resource) | 设置文本的文本行高,设置值不大于0时,不限制文本行高,自适应字体大小,Length为number类型时单位为fp。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| decoration | {
type: [TextDecorationType](ts-appendix-enums.md#textdecorationtype),
color?: [ResourceColor](ts-types.md#resourcecolor)
} | 设置文本装饰线样式及其颜色。
默认值:{
type: TextDecorationType.None,
color:Color.Black
}
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| baselineOffset | number \| string | 设置文本基线的偏移量,默认值0。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| letterSpacing | number \| string | 设置文本字符间距。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| minFontSize | number \| string \| [Resource](ts-types.md#resource) | 设置文本最小显示字号。
需配合maxFontSize以及maxline或布局大小限制使用,单独设置不生效。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| maxFontSize | number \| string \| [Resource](ts-types.md#resource) | 设置文本最大显示字号。
需配合minFontSize以及maxline或布局大小限制使用,单独设置不生效。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| textCase | [TextCase](ts-appendix-enums.md#textcase) | 设置文本大小写。
默认值:TextCase.Normal
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| copyOption9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | 组件支持设置文本是否可复制粘贴。
默认值:CopyOptions.None
该接口支持在ArkTS卡片中使用。 | > **说明:** > diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textarea.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textarea.md index 223e021f125f2cf2a33ac53be2aa8d2eca238025..2acf7d3a89ea1d74e5387040fedb05ddd98fe148 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textarea.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textarea.md @@ -36,7 +36,7 @@ TextArea(value?:{placeholder?: ResourceStr, text?: ResourceStr, controller?: Tex | textAlign | [TextAlign](ts-appendix-enums.md#textalign) | 设置文本在输入框中的水平对齐式。
默认值:TextAlign.Start | | caretColor | [ResourceColor](ts-types.md#resourcecolor) | 设置输入框光标颜色。 | | inputFilter8+ | {
value: [ResourceStr](ts-types.md#resourcestr),
error?: (value: string) => void
} | 通过正则表达式设置输入过滤器。匹配表达式的输入允许显示,不匹配的输入将被过滤。仅支持单个字符匹配,不支持字符串匹配。
- value:设置正则表达式。
- error:正则匹配失败时,返回被过滤的内容。 | -| copyOption9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | 设置输入的文本是否可复制。 | +| copyOption9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | 设置输入的文本是否可复制。
设置CopyOptions.None时,当前TextArea中的文字无法被复制或剪切,仅支持粘贴。 | ## 事件 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textinput.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textinput.md index 8853f258c7bb80d731dcaf6d78319d005cd94d43..951898ea55c92c7d27094eca0415cbb5ceeb4b5f 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textinput.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textinput.md @@ -38,7 +38,7 @@ TextInput(value?:{placeholder?: ResourceStr, text?: ResourceStr, controller?: Te | caretColor | [ResourceColor](ts-types.md#resourcecolor) | 设置输入框光标颜色。 | | maxLength | number | 设置文本的最大输入字符数。 | | inputFilter8+ | {
value: [ResourceStr](ts-types.md#resourcestr),
error?: (value: string) => void
} | 正则表达式,匹配表达式的输入允许显示,不匹配的输入将被过滤。目前仅支持单个字符匹配,不支持字符串匹配。
- value:设置正则表达式。
- error:正则匹配失败时,返回被过滤的内容。 | -| copyOption9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | 设置输入的文本是否可复制。 | +| copyOption9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | 设置输入的文本是否可复制。
设置CopyOptions.None时,当前TextInput中的文字无法被复制或剪切,仅支持粘贴。 | | showPasswordIcon9+ | boolean | 密码输入模式时,输入框末尾的图标是否显示。
默认值:true | | style9+ | TextInputStyle | 设置输入框为默认风格或内联输入风格。
默认值:TextInputStyle.Default | | textAlign9+ | [TextAlign](ts-appendix-enums.md#textalign) | 设置输入文本在输入框中的对齐方式。
默认值:TextAlign.Start | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-toggle.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-toggle.md index e00ea4bb7aeef7efb1f3b681563dcb37af8ef39a..7523972e0f3693ef7716c64c290d822394cefd98 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-toggle.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-toggle.md @@ -19,6 +19,8 @@ Toggle(options: { type: ToggleType, isOn?: boolean }) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | @@ -28,6 +30,9 @@ Toggle(options: { type: ToggleType, isOn?: boolean }) ## ToggleType枚举说明 + ++从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | -------- | ---------------- | | Checkbox | 提供单选框样式。
> **说明:**
> [通用属性padding](ts-universal-attributes-size.md)的默认值为:
{
 top: 14 vp,
 right: 6 vp,
 bottom: 14 vp,
 left: 6 vp
} | @@ -39,15 +44,15 @@ Toggle(options: { type: ToggleType, isOn?: boolean }) | 名称 | 参数 | 参数描述 | | ---------------- | --------------------------- | ---------------------- | -| selectedColor | [ResourceColor](ts-types.md#resourcecolor) | 设置组件打开状态的背景颜色。 | -| switchPointColor | [ResourceColor](ts-types.md#resourcecolor) | 设置Switch类型的圆形滑块颜色。
> **说明:**
> 仅对type为ToggleType.Switch生效。 | +| selectedColor | [ResourceColor](ts-types.md#resourcecolor) | 设置组件打开状态的背景颜色。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| switchPointColor | [ResourceColor](ts-types.md#resourcecolor) | 设置Switch类型的圆形滑块颜色。
> **说明:**
> 仅对type为ToggleType.Switch生效。
从API version 9开始,该接口支持在ArkTS卡片中使用。| ## 事件 | 名称 | 功能描述 | | -------- | -------- | -| onChange(callback: (isOn: boolean) => void) | 开关状态切换时触发该事件。 | +| onChange(callback: (isOn: boolean) => void) | 开关状态切换时触发该事件。
从API version 9开始,该接口支持在ArkTS卡片中使用。| ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md index 091f31fbd61fcddd2be1304a411eed32bef53bbe..43b806a70ab65e26ebf56bee4121b8355d48d674 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md @@ -1,6 +1,6 @@ # Web -提供具有网页显示能力的Web组件。 +提供具有网页显示能力的Web组件,[@ohos.web.webview](../apis/js-apis-webview.md)提供web控制能力。 > **说明:** > diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-canvasrenderingcontext2d.md b/zh-cn/application-dev/reference/arkui-ts/ts-canvasrenderingcontext2d.md index eb4daa60beeeef70faae846cbfb66f8033893589..e53768028e8070fff9d9e6afb154e7b001782927 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-canvasrenderingcontext2d.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-canvasrenderingcontext2d.md @@ -683,7 +683,7 @@ fillRect(x: number, y: number, w: number, h: number): void .height('100%') .backgroundColor('#ffff00') .onReady(() =>{ - this.context.fillRect(0,30,100,100) + this.context.fillRect(30,30,100,100) }) } .width('100%') @@ -1922,6 +1922,8 @@ setTransform(transform?: Matrix2D): void 以Matrix2D对象为模板重置现有的变换矩阵并创建新的变换矩阵。该接口为空接口。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + ### translate diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-canvas.md b/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-canvas.md index 03ef8e6c7a980e9383e7ed21cb98ad97832ca51d..c4cf9456bb0f71ec327460373f9481f045acaed8 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-canvas.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-canvas.md @@ -14,6 +14,8 @@ Canvas(context?: CanvasRenderingContext2D) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | @@ -30,7 +32,7 @@ Canvas(context?: CanvasRenderingContext2D) | 名称 | 参数 | 描述 | | ----------------------------- | ---- | -------------------- | -| onReady(event: () => void) | 无 | Canvas组件初始化完成时的事件回调,该事件之后Canvas组件宽高确定且可获取,可使用Canvas相关API进行绘制。 | +| onReady(event: () => void) | 无 | Canvas组件初始化完成时的事件回调,该事件之后Canvas组件宽高确定且可获取,可使用Canvas相关API进行绘制。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | **示例:** diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-canvasgradient.md b/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-canvasgradient.md index c6efa1ddbbbc323d26afd22179f0ed1cada1e640..199cbfb2a4223b668b683a448a53f6b648a57564 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-canvasgradient.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-canvasgradient.md @@ -14,6 +14,8 @@ addColorStop(offset: number, color: string): void 设置渐变断点值,包括偏移和颜色。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-imagebitmap.md b/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-imagebitmap.md index 8785206dcef551053042f745837aa8e664757c5d..2890d2890e202d12c13167f04919af42292dbf9a 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-imagebitmap.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-imagebitmap.md @@ -3,8 +3,20 @@ ImageBitmap对象可以存储canvas渲染的像素数据。 > **说明:** -> -> 从 API Version 8 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 +> +> 从 API Version 8 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 + +## 接口 + +ImageBitmap(src: string) + +从API version 9开始,该接口支持在ArkTS卡片中使用。 + +**参数:** + +| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | +| ------ | -------- | ---- | ------ | ------------------------------------------------------------ | +| src | string | 是 | - | 图片的数据源
**说明:**
- ArkTS卡片上不支持`http://`等网络相关路径前缀、`datashare://`路径前缀以及`file://data/storage`路径前缀的字符串 | @@ -12,8 +24,8 @@ ImageBitmap对象可以存储canvas渲染的像素数据。 | 属性 | 类型 | 描述 | | -------- | -------- | -------- | -| width | number | ImageBitmap的像素宽度。 | -| height | number | ImageBitmap的像素高度。 | +| width | number | ImageBitmap的像素宽度。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| height | number | ImageBitmap的像素高度。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | **示例:** @@ -53,4 +65,6 @@ ImageBitmap对象可以存储canvas渲染的像素数据。 close() -释放ImageBitmap对象相关联的所有图形资源。该接口为空接口。 \ No newline at end of file +释放ImageBitmap对象相关联的所有图形资源。该接口为空接口。 + +从API version 9开始,该接口支持在ArkTS卡片中使用。 \ No newline at end of file diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-imagedata.md b/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-imagedata.md index bd1b16a3981851566cb2970203935f439a3c74af..b9a49fb83833aa72194aea7c696ce66c7148ece1 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-imagedata.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-imagedata.md @@ -12,9 +12,9 @@ ImageData对象可以存储canvas渲染的像素数据。 | 属性 | 类型 | 描述 | | -------- | -------- | -------- | -| width | number | 矩形区域实际像素宽度,单位为px。 | -| height | number | 矩形区域实际像素高度,单位为px。 | -| data | Uint8ClampedArray | 一维数组,保存了相应的颜色数据,数据值范围为0到255。 | +| width | number | 矩形区域实际像素宽度,单位为px。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| height | number | 矩形区域实际像素高度,单位为px。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| data | Uint8ClampedArray | 一维数组,保存了相应的颜色数据,数据值范围为0到255。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | > **说明:** > diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-path2d.md b/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-path2d.md index dbad82b43f93702bc3f7f8a00f5572641a2d8833..9d2fd18f2d7b4ab3d72a5acab9d45035211d4ea7 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-path2d.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-path2d.md @@ -14,6 +14,8 @@ addPath(path: path2D, transform?:Matrix2D): void 将另一个路径添加到当前的路径对象中。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -61,6 +63,8 @@ closePath(): void 将路径的当前点移回到路径的起点,当前点到起点间画一条直线。如果形状已经闭合或只有一个点,则此功能不执行任何操作。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **示例:** ```ts @@ -101,6 +105,8 @@ moveTo(x: number, y: number): void 将路径的当前坐标点移动到目标点,移动过程中不绘制线条。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -148,6 +154,8 @@ lineTo(x: number, y: number): void 从当前点绘制一条直线到目标点。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -196,6 +204,8 @@ bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, 创建三次贝赛尔曲线的路径。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -245,6 +255,8 @@ quadraticCurveTo(cpx: number, cpy: number, x: number ,y: number): void 创建二次贝赛尔曲线的路径。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -292,6 +304,8 @@ arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, 绘制弧线路径。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -340,6 +354,8 @@ arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void 依据圆弧经过的点和圆弧半径创建圆弧路径。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -387,6 +403,8 @@ ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number 在规定的矩形区域绘制一个椭圆。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -437,6 +455,8 @@ rect(x: number, y: number, w: number, h: number): void 创建矩形路径。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-badge.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-badge.md index e359c9adfa14fd1309eb46f4b7fa8a17f950490b..db77314b4e4e4535d77f192980af4aa800630f29 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-badge.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-badge.md @@ -18,6 +18,8 @@ 创建数字标记组件。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | | -------- | -------- | -------- | -------- | -------- | @@ -30,6 +32,8 @@ 根据字符串创建标记组件。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | @@ -40,6 +44,8 @@ ## BadgePosition枚举说明 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | -------- | -------- | | RightTop | 圆点显示在右上角。 | @@ -48,6 +54,8 @@ ## BadgeStyle对象说明 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 类型 | 必填 | 默认值 | 描述 | | ---------- | ------------------------------------------ | ---- | ----------- | ------------------------------------------- | | color | [ResourceColor](ts-types.md#resourcecolor) | 否 | Color.White | 文本颜色。 | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-column.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-column.md index 7f1a17f3b79fe982560746540e72947510cfa4da..e53b393ecc6751f5826957ac63308c30d7b3110b 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-column.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-column.md @@ -16,6 +16,8 @@ Column(value?: {space?: string | number}) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | @@ -28,8 +30,8 @@ Column(value?: {space?: string | number}) | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | -| alignItems | [HorizontalAlign](ts-appendix-enums.md#horizontalalign) | 设置子组件在水平方向上的对齐格式。
默认值:HorizontalAlign.Center | -| justifyContent8+ | [FlexAlign](ts-appendix-enums.md#flexalign) | 设置子组件在垂直方向上的对齐格式。
默认值:FlexAlign.Start | +| alignItems | [HorizontalAlign](ts-appendix-enums.md#horizontalalign) | 设置子组件在水平方向上的对齐格式。
默认值:HorizontalAlign.Center
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| justifyContent8+ | [FlexAlign](ts-appendix-enums.md#flexalign) | 设置子组件在垂直方向上的对齐格式。
默认值:FlexAlign.Start
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-counter.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-counter.md index bd52cece165bb2ab581da8ae3260032baeb48232..ff574a2ceb332fad15eacb6dc2c7aa2f95fbde56 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-counter.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-counter.md @@ -16,6 +16,8 @@ Counter() +从API version 9开始,该接口支持在ArkTS卡片中使用。 + ## 事件 @@ -23,8 +25,8 @@ Counter() | 名称 | 功能描述 | | -------- | -------- | -| onInc(event: () => void) | 监听数值增加事件。 | -| onDec(event: () => void) | 监听数值减少事件。 | +| onInc(event: () => void) | 监听数值增加事件。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| onDec(event: () => void) | 监听数值减少事件。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-flex.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-flex.md index a84a7661022605f7663d75f9134c1317ebe0fca0..54e5d47d4af3c66fa2c4fd8a866efa60144e8b9c 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-flex.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-flex.md @@ -23,6 +23,7 @@ Flex(value?: { direction?: FlexDirection, wrap?: FlexWrap, justifyContent?: Fle 标准Flex布局容器。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 - 参数 | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | | -------------- | ---------------------------------------- | ---- | ----------------- | ---------------------------------------- | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-gridcol.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-gridcol.md index 2083ff7d49c7296f09a434ac0d805a775f5530d7..c63d3575f0d4b36bbf73ba615bd425d631357237 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-gridcol.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-gridcol.md @@ -13,6 +13,8 @@ GridCol(option?:{span?: number | GridColColumnOption, offset?: number | GridColColumnOption, order?: number | GridColColumnOption}) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -25,12 +27,14 @@ GridCol(option?:{span?: number | GridColColumnOption, offset?: number | GridColC | 参数名 | 类型 | 必填 | 说明 | | ------ | ----------------------------- | ---- | ------------------------------------------------------------ | -| span | number \| GridColColumnOption | 否 | 占用列数。span为0,意味着该元素不参与布局计算,即不会被渲染。
默认值:1。 | -| offset | number \| GridColColumnOption | 否 | 相对于前一个栅格子组件偏移的列数。
默认值:0。 | -| order | number \| GridColColumnOption | 否 | 元素的序号,根据栅格子组件的序号,从小到大对栅格子组件做排序。
默认值:0。 | +| span | number \| GridColColumnOption | 否 | 占用列数。span为0,意味着该元素不参与布局计算,即不会被渲染。
默认值:1。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| offset | number \| GridColColumnOption | 否 | 相对于前一个栅格子组件偏移的列数。
默认值:0。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| order | number \| GridColColumnOption | 否 | 元素的序号,根据栅格子组件的序号,从小到大对栅格子组件做排序。
默认值:0。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## GridColColumnOption +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 参数名 | 参数类型 | 必填 | 参数描述 | | ----- | ------ | ---- | ---------------------------------------- | | xs | number | 否 | 最小宽度类型设备。 | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-gridrow.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-gridrow.md index 75e927bf604194c4d19b99c2a291b8cd94c1876d..f00c751ab87939972e418c718c4fe57f05961c75 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-gridrow.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-gridrow.md @@ -15,6 +15,8 @@ ## 接口 GridRow(option?: {columns?: number | GridRowColumnOption, gutter?: Length | GutterOption, breakpoints?: BreakPoints, direction?: GridRowDirection}) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 |类型|必填|说明| |-----|-----|----|----| @@ -25,6 +27,8 @@ GridRow(option?: {columns?: number | GridRowColumnOption, gutter?: Length | Gutt ## GutterOption +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 参数名 | 参数类型 | 必填 | 参数描述 | | ----- | ------ | ---- | ---------------------------------------- | | x | Length \| GridRowSizeOption | 否 | 水平gutter option。 | @@ -34,6 +38,8 @@ GridRow(option?: {columns?: number | GridRowColumnOption, gutter?: Length | Gutt 栅格在不同宽度设备类型下,栅格列数。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 参数名 | 参数类型 | 必填 | 参数描述 | | ----- | ------ | ---- | ---------------------------------------- | | xs | number | 否 | 最小宽度类型设备。 | @@ -47,6 +53,8 @@ GridRow(option?: {columns?: number | GridRowColumnOption, gutter?: Length | Gutt 栅格在不同宽度设备类型下,gutter的大小。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 参数名 | 参数类型 | 必填 | 参数描述 | | ----- | ------ | ---- | ---------------------------------------- | | xs | Length | 否 | 最小宽度类型设备。 | @@ -58,6 +66,8 @@ GridRow(option?: {columns?: number | GridRowColumnOption, gutter?: Length | Gutt ## BreakPoints +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 参数名 | 参数类型 | 必填 | 参数描述 | | ----- | ------ | ---- | ---------------------------------------- | | value | Array<string> | 否 | 设置断点位置的单调递增数组。
默认值:["320vp", "520vp", "840vp"] | @@ -72,12 +82,18 @@ GridRow(option?: {columns?: number | GridRowColumnOption, gutter?: Length | Gutt ``` ## BreakpointsReference枚举类型 + +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 枚举名 | 描述 | | -------- | -------- | | WindowSize | 以窗口为参照。 | | ComponentSize | 以容器为参照。 | ## GridRowDirection枚举类型 + +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 枚举名 | 描述 | | -------- | -------- | | Row | 栅格元素按照行方向排列。 | @@ -118,6 +134,8 @@ GridRow(option?: {columns?: number | GridRowColumnOption, gutter?: Length | Gutt onBreakpointChange(callback: (breakpoints: string) => void) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 说明 | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-list.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-list.md index 02a2c585cfdad297e4b05824f4d23c0b792a17c6..a86cdf2dd1f92cdcd8ef75c4db6f1f840b1ae747 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-list.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-list.md @@ -17,6 +17,8 @@ List(value?:{space?: number | string, initialIndex?: number, scroller?: Scroller}) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | @@ -31,20 +33,22 @@ List(value?:{space?: number | string, initialIndex?: number, scroller? | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | -| listDirection | [Axis](ts-appendix-enums.md#axis) | 设置List组件排列方向。
默认值:Axis.Vertical | -| divider | {
strokeWidth: [Length](ts-types.md#length),
color?:[ResourceColor](ts-types.md),
startMargin?: Length,
endMargin?: Length
} \| null | 设置ListItem分割线样式,默认无分割线。
- strokeWidth: 分割线的线宽。
- color: 分割线的颜色。
- startMargin: 分割线与列表侧边起始端的距离。
- endMargin: 分割线与列表侧边结束端的距离。 | -| scrollBar | [BarState](ts-appendix-enums.md#barstate) | 设置滚动条状态。
默认值:BarState.Off | -| cachedCount | number | 设置列表中ListItem/ListItemGroup的预加载数量,其中ListItemGroup将作为一个整体进行计算,ListItemGroup中的所有ListItem会一次性全部加载出来。具体使用可参考[减少应用白块说明](../../ui/ui-ts-performance-improvement-recommendation.md#减少应用滑动白块)。
默认值:1 | +| listDirection | [Axis](ts-appendix-enums.md#axis) | 设置List组件排列方向。
默认值:Axis.Vertical
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| divider | {
strokeWidth: [Length](ts-types.md#length),
color?:[ResourceColor](ts-types.md#resourcecolor),
startMargin?: Length,
endMargin?: Length
} \| null | 设置ListItem分割线样式,默认无分割线。
- strokeWidth: 分割线的线宽。
- color: 分割线的颜色。
- startMargin: 分割线与列表侧边起始端的距离。
- endMargin: 分割线与列表侧边结束端的距离。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| scrollBar | [BarState](ts-appendix-enums.md#barstate) | 设置滚动条状态。
默认值:BarState.Off
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| cachedCount | number | 设置列表中ListItem/ListItemGroup的预加载数量,其中ListItemGroup将作为一个整体进行计算,ListItemGroup中的所有ListItem会一次性全部加载出来。具体使用可参考[减少应用白块说明](../../ui/ui-ts-performance-improvement-recommendation.md#减少应用滑动白块)。
默认值:1
从API version 9开始,该接口支持在ArkTS卡片中使用。 | | editMode | boolean | 声明当前List组件是否处于可编辑模式。
默认值:false | -| edgeEffect | [EdgeEffect](ts-appendix-enums.md#edgeeffect) | 设置组件的滑动效果。
默认值:EdgeEffect.Spring | -| chainAnimation | boolean | 设置当前List是否启用链式联动动效,开启后列表滑动以及顶部和底部拖拽时会有链式联动的效果。链式联动效果:List内的list-item间隔一定距离,在基本的滑动交互行为下,主动对象驱动从动对象进行联动,驱动效果遵循弹簧物理动效。
默认值:false
- false:不启用链式联动。
- true:启用链式联动。 | -| multiSelectable8+ | boolean | 是否开启鼠标框选。
默认值:false
- false:关闭框选。
- true:开启框选。 | -| lanes9+ | number \| [LengthConstrain](ts-types.md#lengthconstrain) | 以列模式为例(listDirection为Axis.Vertical):
lanes用于决定List组件在交叉轴方向按几列布局。
默认值:1
规则如下:
- lanes为指定的数量时,根据指定的数量与List组件的交叉轴宽度来决定每列的宽度;
- lane设置了{minLength,maxLength}时,根据List组件的宽度自适应决定lanes数量(即列数),保证缩放过程中lane的宽度符合{minLength,maxLength}的限制。其中,minLength条件会被优先满足,即优先保证符合ListItem的宽度符合最小宽度限制。例如在列模式下,设置了{minLength: 40vp,maxLength: 60vp},则当List组件宽度为70vp时,ListItem为一列,并且根据alignListItem属性做靠左、居中或者靠右布局;当List组件宽度变化至80vp时,符合两倍的minLength,则ListItem自适应为两列。 | -| alignListItem9+ | ListItemAlign | List交叉轴方向宽度大于ListItem交叉轴宽度 * lanes时,ListItem在List交叉轴方向的布局方式,默认为首部对齐。
默认值:ListItemAlign.Start | -| sticky9+ | StickyStyle | 配合[ListItemGroup](ts-container-listitemgroup.md)组件使用,设置ListItemGroup中header和footer是否要吸顶或吸底。
默认值:StickyStyle.None
**说明:**
sticky属性可以设置为 StickyStyle.Header \| StickyStyle.Footer 以同时支持header吸顶和footer吸底。 | +| edgeEffect | [EdgeEffect](ts-appendix-enums.md#edgeeffect) | 设置组件的滑动效果。
默认值:EdgeEffect.Spring
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| chainAnimation | boolean | 设置当前List是否启用链式联动动效,开启后列表滑动以及顶部和底部拖拽时会有链式联动的效果。链式联动效果:List内的list-item间隔一定距离,在基本的滑动交互行为下,主动对象驱动从动对象进行联动,驱动效果遵循弹簧物理动效。
默认值:false
- false:不启用链式联动。
- true:启用链式联动。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| multiSelectable8+ | boolean | 是否开启鼠标框选。
默认值:false
- false:关闭框选。
- true:开启框选。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| lanes9+ | number \| [LengthConstrain](ts-types.md#lengthconstrain) | 以列模式为例(listDirection为Axis.Vertical):
lanes用于决定List组件在交叉轴方向按几列布局。
默认值:1
规则如下:
- lanes为指定的数量时,根据指定的数量与List组件的交叉轴宽度来决定每列的宽度;
- lane设置了{minLength,maxLength}时,根据List组件的宽度自适应决定lanes数量(即列数),保证缩放过程中lane的宽度符合{minLength,maxLength}的限制。其中,minLength条件会被优先满足,即优先保证符合ListItem的宽度符合最小宽度限制。例如在列模式下,设置了{minLength: 40vp,maxLength: 60vp},则当List组件宽度为70vp时,ListItem为一列,并且根据alignListItem属性做靠左、居中或者靠右布局;当List组件宽度变化至80vp时,符合两倍的minLength,则ListItem自适应为两列。
该接口支持在ArkTS卡片中使用。 | +| alignListItem9+ | ListItemAlign | List交叉轴方向宽度大于ListItem交叉轴宽度 * lanes时,ListItem在List交叉轴方向的布局方式,默认为首部对齐。
默认值:ListItemAlign.Start
该接口支持在ArkTS卡片中使用。 | +| sticky9+ | StickyStyle | 配合[ListItemGroup](ts-container-listitemgroup.md)组件使用,设置ListItemGroup中header和footer是否要吸顶或吸底。
默认值:StickyStyle.None
该接口支持在ArkTS卡片中使用。
**说明:**
sticky属性可以设置为 StickyStyle.Header \| StickyStyle.Footer 以同时支持header吸顶和footer吸底。 | ## ListItemAlign9+枚举说明 +该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------ | -------------------------------------- | | Start | ListItem在List中,交叉轴方向首部对齐。 | @@ -53,6 +57,8 @@ List(value?:{space?: number | string, initialIndex?: number, scroller? ## StickyStyle9+枚举说明 +该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------ | -------------------------------------- | | None | ListItemGroup的header不吸顶,footer不吸底。 | @@ -66,13 +72,13 @@ List(value?:{space?: number | string, initialIndex?: number, scroller? | 名称 | 功能描述 | | -------- | -------- | | onItemDelete(event: (index: number) => boolean) | 当List组件在编辑模式时,点击ListItem右边出现的删除按钮时触发。
- index: 被删除的列表项的索引值。 | -| onScroll(event: (scrollOffset: number, scrollState: ScrollState) => void) | 列表滑动时触发。
- scrollOffset: 滑动偏移量。
- [scrollState](#scrollstate枚举说明): 当前滑动状态。 | -| onScrollIndex(event: (start: number, end: number) => void) | 列表滑动时触发。
计算索引值时,ListItemGroup作为一个整体占一个索引值,不计算ListItemGroup内部ListItem的索引值。
- start: 滑动起始位置索引值。
- end: 滑动结束位置索引值。 | -| onReachStart(event: () => void) | 列表到达起始位置时触发。 | -| onReachEnd(event: () => void) | 列表到底末尾位置时触发。 | -| onScrollFrameBegin9+(event: (offset: number, state: ScrollState) => { offsetRemain }) | 列表开始滑动时触发,事件参数传入即将发生的滑动量,事件处理函数中可根据应用场景计算实际需要的滑动量并作为事件处理函数的返回值返回,列表将按照返回值的实际滑动量进行滑动。
\- offset:即将发生的滑动量。
\- state:当前滑动状态。
- offsetRemain:水平方向实际滑动量。 | -| onScrollStart9+(event: () => void) | 列表滑动开始时触发。手指拖动列表或列表的滚动条触发的滑动开始时,会触发该事件。使用[Scroller](ts-container-scroll.md#scroller)滑动控制器触发的滑动,不会触发该事件。 | -| onScrollStop(event: () => void) | 列表滑动停止时触发。手拖动列表或列表的滚动条触发的滑动,手离开屏幕并且滑动停止时会触发该事件;使用[Scroller](ts-container-scroll.md#scroller)滑动控制器触发的滑动,不会触发该事件。 | +| onScroll(event: (scrollOffset: number, scrollState: ScrollState) => void) | 列表滑动时触发。
- scrollOffset: 滑动偏移量。
- [scrollState](#scrollstate枚举说明): 当前滑动状态。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| onScrollIndex(event: (start: number, end: number) => void) | 列表滑动时触发。
计算索引值时,ListItemGroup作为一个整体占一个索引值,不计算ListItemGroup内部ListItem的索引值。
- start: 滑动起始位置索引值。
- end: 滑动结束位置索引值。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| onReachStart(event: () => void) | 列表到达起始位置时触发。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| onReachEnd(event: () => void) | 列表到底末尾位置时触发。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| onScrollFrameBegin9+(event: (offset: number, state: ScrollState) => { offsetRemain }) | 列表开始滑动时触发,事件参数传入即将发生的滑动量,事件处理函数中可根据应用场景计算实际需要的滑动量并作为事件处理函数的返回值返回,列表将按照返回值的实际滑动量进行滑动。
\- offset:即将发生的滑动量。
\- state:当前滑动状态。
- offsetRemain:实际滑动量。
该接口支持在ArkTS卡片中使用。 | +| onScrollStart9+(event: () => void) | 列表滑动开始时触发。手指拖动列表或列表的滚动条触发的滑动开始时,会触发该事件。使用[Scroller](ts-container-scroll.md#scroller)滑动控制器触发的带动画的滑动,动画开始时会触发该事件。 | +| onScrollStop(event: () => void) | 列表滑动停止时触发。手拖动列表或列表的滚动条触发的滑动,手离开屏幕并且滑动停止时会触发该事件;使用[Scroller](ts-container-scroll.md#scroller)滑动控制器触发的带动画的滑动,动画停止会触发该事件。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | | onItemMove(event: (from: number, to: number) => boolean) | 列表元素发生移动时触发。
- from: 移动前索引值。
- to: 移动后索引值。 | | onItemDragStart(event: (event: ItemDragInfo, itemIndex: number) => ((() => any) \| void) | 开始拖拽列表元素时触发。
- event: 见[ItemDragInfo对象说明](ts-container-grid.md#itemdraginfo对象说明)。
- itemIndex: 被拖拽列表元素索引值。 | | onItemDragEnter(event: (event: ItemDragInfo) => void) | 拖拽进入列表元素范围内时触发。
- event: 见[ItemDragInfo对象说明](ts-container-grid.md#itemdraginfo对象说明)。 | @@ -82,6 +88,8 @@ List(value?:{space?: number | string, initialIndex?: number, scroller? ## ScrollState枚举说明 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------ | ------------------------- | | Idle | 未滑动状态。 | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-listitem.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-listitem.md index 3ce6fcd4f8bb16989ae70e0f08d1c26634e9a350..00abdf533d261b2111c92b20d77eca92c11d338d 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-listitem.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-listitem.md @@ -16,6 +16,8 @@ ListItem(value?: string) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + ## 属性 除支持[通用属性](ts-universal-attributes-size.md)外,还支持以下属性: @@ -24,7 +26,7 @@ ListItem(value?: string) | -------- | -------- | -------- | | sticky(deprecated) | [Sticky](#stickydeprecated枚举说明) | 设置ListItem吸顶效果。
默认值:Sticky.None
从API version9开始废弃,推荐使用[List组件sticky属性](ts-container-list.md#属性)。 | | editable | boolean \| [EditMode](#editmode枚举说明) | 当前ListItem元素是否可编辑,进入编辑模式后可删除或移动列表项。
默认值:false | -| selectable8+ | boolean | 当前ListItem元素是否可以被鼠标框选。
**说明:**
外层List容器的鼠标框选开启时,ListItem的框选才生效。
默认值:true | +| selectable8+ | boolean | 当前ListItem元素是否可以被鼠标框选。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
外层List容器的鼠标框选开启时,ListItem的框选才生效。
默认值:true | | swipeAction9+ | {
start?: CustomBuilder,
end?:CustomBuilder,
edgeEffect?: [SwipeEdgeEffect](#swipeedgeeffect9枚举说明),
} | 用于设置ListItem的划出组件。
- start: ListItem向右划动时item左边的组件(List垂直布局时)或ListItem向下划动时item上方的组件(List水平布局时)。
- end: ListItem向左划动时item右边的组件(List垂直布局时)或ListItem向上划动时item下方的组件(List水平布局时)。
- edgeEffect: 滑动效果。
| ## Sticky(deprecated)枚举说明 @@ -53,7 +55,7 @@ ListItem(value?: string) | 名称 | 功能描述 | | -------- | -------- | -| onSelect(event: (isSelected: boolean) => void)8+ | ListItem元素被鼠标框选的状态改变时触发回调。
isSelected:进入鼠标框选范围即被选中返回true, 移出鼠标框选范围即未被选中返回false。 | +| onSelect(event: (isSelected: boolean) => void)8+ | ListItem元素被鼠标框选的状态改变时触发回调。
isSelected:进入鼠标框选范围即被选中返回true, 移出鼠标框选范围即未被选中返回false。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-relativecontainer.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-relativecontainer.md index 4eb27d9e09e72015a1e7c0c10b6ecbf8d38ec155..6390be6bf5545188807777190731bc67143aab6b 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-relativecontainer.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-relativecontainer.md @@ -31,6 +31,8 @@ RelativeContainer() +从API version 9开始,该接口支持在ArkTS卡片中使用。 + ## 示例 ```ts diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-row.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-row.md index f9039ed0b31460923fc72a386ac31dab47ac6eba..3a5fc83204feb2c83ddbbb3fd6dc788816c9a2ad 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-row.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-row.md @@ -16,6 +16,8 @@ Row(value?:{space?: number | string }) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | @@ -27,8 +29,8 @@ Row(value?:{space?: number | string }) | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | -| alignItems | [VerticalAlign](ts-appendix-enums.md#verticalalign) | 设置子组件在垂直方向上的对齐格式。
默认值:VerticalAlign.Center | -| justifyContent8+ | [FlexAlign](ts-appendix-enums.md#flexalign) | 设置子组件在水平方向上的对齐格式。
FlexAlign.Start | +| alignItems | [VerticalAlign](ts-appendix-enums.md#verticalalign) | 设置子组件在垂直方向上的对齐格式。
默认值:VerticalAlign.Center
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| justifyContent8+ | [FlexAlign](ts-appendix-enums.md#flexalign) | 设置子组件在水平方向上的对齐格式。
FlexAlign.Start
从API version 9开始,该接口支持在ArkTS卡片中使用。| ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-scroll.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-scroll.md index 9996564d394d9c646f255a0d132d8c601638c3e3..53803a4425e2c592b4f70e3dda1a2670d6e6ae71 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-scroll.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-scroll.md @@ -18,6 +18,12 @@ Scroll(scroller?: Scroller) +**参数:** + +| 参数名 | 参数类型 | 必填 | 参数描述 | +| -------- | -------- | -------- | -------- | +| scroller | [Scroller](#scroller) | 否 | 可滚动组件的控制器。用于与可滚动组件进行绑定。 | + ## 属性 除支持[通用属性](ts-universal-attributes-size.md)外,还支持以下属性: @@ -42,12 +48,12 @@ Scroll(scroller?: Scroller) | 名称 | 功能描述 | | ------------------------------------------------------------ | ------------------------------------------------------------ | -| onScrollFrameBegin9+(event: (offset: number, state: ScrollState) => { offsetRemain }) | 每帧开始滚动时触发,事件参数传入即将发生的滚动量,事件处理函数中可根据应用场景计算实际需要的滚动量并作为事件处理函数的返回值返回,Scroll将按照返回值的实际滚动量进行滚动。
\- offset:即将发生的滚动量。
\- state:当前滚动状态。
- offsetRemain:水平方向实际滚动量。 | +| onScrollFrameBegin9+(event: (offset: number, state: ScrollState) => { offsetRemain }) | 每帧开始滚动时触发,事件参数传入即将发生的滚动量,事件处理函数中可根据应用场景计算实际需要的滚动量并作为事件处理函数的返回值返回,Scroll将按照返回值的实际滚动量进行滚动。
\- offset:即将发生的滚动量。
\- state:当前滚动状态。
- offsetRemain:实际滚动量。 | | onScroll(event: (xOffset: number, yOffset: number) => void) | 滚动事件回调, 返回滚动时水平、竖直方向偏移量。 | | onScrollEdge(event: (side: Edge) => void) | 滚动到边缘事件回调。 | -| onScrollEnd(event: () => void) | 滚动停止事件回调。
该事件从API9开始废弃,使用onScrollStop事件替代。 | -| onScrollStart9+(event: () => void) | 滚动开始时触发。手指拖动Scroll或拖动Scroll的滚动条触发的滚动开始时,会触发该事件。使用[Scroller](#scroller)滚动控制器触发的滚动,不会触发该事件。 | -| onScrollStop9+(event: () => void) | 滚动停止时触发。手拖动Scroll或拖动Scroll的滚动条触发的滚动,手离开屏幕并且滚动停止时会触发该事件;使用[Scroller](#scroller)滚动控制器触发的滚动,不会触发该事件。 | +| onScrollEnd(deprecated) (event: () => void) | 滚动停止事件回调。
该事件从API9开始废弃,使用onScrollStop事件替代。 | +| onScrollStart9+(event: () => void) | 滚动开始时触发。手指拖动Scroll或拖动Scroll的滚动条触发的滚动开始时,会触发该事件。使用[Scroller](#scroller)滚动控制器触发的带动画的滚动,动画开始时会触发该事件。 | +| onScrollStop9+(event: () => void) | 滚动停止时触发。手拖动Scroll或拖动Scroll的滚动条触发的滚动,手离开屏幕并且滚动停止时会触发该事件。使用[Scroller](#scroller)滚动控制器触发的带动画的滚动,动画停止时会触发该事件。 | > **说明:** > @@ -111,7 +117,7 @@ scrollPage(value: { next: boolean, direction?: Axis }): void ### currentOffset -currentOffset() +currentOffset(): { xOffset: number, yOffset: number } 返回当前的滚动偏移量。 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-stack.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-stack.md index 9b329c79b9806056213a6d191fbfd6d7b2d2486c..48c577803003b31fec6feed7de514b1fc178b3ac 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-stack.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-stack.md @@ -16,6 +16,8 @@ Stack(value?: { alignContent?: Alignment }) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-circle.md b/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-circle.md index db6b7734889a55af7884e2be2de46c619861dbc3..63ede8489f4221fdbd710f1b7851f6b808aaf46e 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-circle.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-circle.md @@ -16,6 +16,8 @@ Circle(options?: {width?: string | number, height?: string | number}) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | @@ -29,17 +31,17 @@ Circle(options?: {width?: string | number, height?: string | number}) | 名称 | 类型 | 描述 | | -------- | -------- | -------- | -| fill | [ResourceColor](ts-types.md) | 设置填充区域颜色。
默认值:Color.Black | -| fillOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 设置填充区域透明度。
默认值:1 | -| stroke | [ResourceColor](ts-types.md) | 设置边框颜色,不设置时,默认没有边框。 | -| strokeDashArray | Array<Length> | 设置边框间隙。
默认值:[] | -| strokeDashOffset | number \| string | 边框绘制起点的偏移量。
默认值:0 | -| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | 设置边框端点绘制样式。
默认值:LineCapStyle.Butt | -| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | 设置边框拐角绘制样式。
默认值:LineJoinStyle.Miter | -| strokeMiterLimit | number \| string | 设置斜接长度与边框宽度比值的极限值。
默认值:4
**说明:**
Circle组件无法设置尖角图形,该属性设置无效。 | -| strokeOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 设置边框透明度。
默认值:1
**说明:**
该属性的取值范围是[0.0, 1.0],若给定值小于0.0,则取值为0.0;若给定值大于1.0,则取值为1.0。 | -| strokeWidth | Length | 设置边框宽度。
默认值:1 | -| antiAlias | boolean | 是否开启抗锯齿效果。
默认值:true | +| fill | [ResourceColor](ts-types.md) | 设置填充区域颜色。
默认值:Color.Black
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| fillOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 设置填充区域透明度。
默认值:1
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| stroke | [ResourceColor](ts-types.md) | 设置边框颜色,不设置时,默认没有边框。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeDashArray | Array<Length> | 设置边框间隙。
默认值:[]
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeDashOffset | number \| string | 边框绘制起点的偏移量。
默认值:0
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | 设置边框端点绘制样式。
默认值:LineCapStyle.Butt
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | 设置边框拐角绘制样式。
默认值:LineJoinStyle.Miter
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeMiterLimit | number \| string | 设置斜接长度与边框宽度比值的极限值。
默认值:4
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
Circle组件无法设置尖角图形,该属性设置无效。 | +| strokeOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 设置边框透明度。
默认值:1
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
该属性的取值范围是[0.0, 1.0],若给定值小于0.0,则取值为0.0;若给定值大于1.0,则取值为1.0。 | +| strokeWidth | Length | 设置边框宽度。
默认值:1
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| antiAlias | boolean | 是否开启抗锯齿效果。
默认值:true
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-ellipse.md b/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-ellipse.md index 559a8791ece5b03ef04af063717555a58427429f..bb7cd917cad709a29d4fdebea42497df76e5f1e0 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-ellipse.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-ellipse.md @@ -16,6 +16,8 @@ Ellipse(options?: {width?: string | number, height?: string | number}) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | @@ -29,17 +31,17 @@ Ellipse(options?: {width?: string | number, height?: string | number}) | 名称 | 类型 | 默认值 | 描述 | | -------- | -------- | -------- | -------- | -| fill | [ResourceColor](ts-types.md) | Color.Black | 设置填充区域颜色。 | -| fillOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置填充区域透明度。 | -| stroke | [ResourceColor](ts-types.md) | - |设置边框颜色,不设置时,默认没有边框。 | -| strokeDashArray | Array<Length> | [] | 设置边框间隙。 | -| strokeDashOffset | number \| string | 0 | 边框绘制起点的偏移量。 | -| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | 设置边框端点绘制样式。 | -| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | 设置边框拐角绘制样式。 | -| strokeMiterLimit | number \| string | 4 | 设置斜接长度与边框宽度比值的极限值。
**说明:**
Ellipse组件无法设置尖角图形,该属性设置无效。 | -| strokeOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置边框透明度。
**说明:**
该属性的取值范围是[0.0, 1.0],若给定值小于0.0,则取值为0.0;若给定值大于1.0,则取值为1.0。 | -| strokeWidth | Length | 1 | 设置边框宽度。 | -| antiAlias | boolean | true | 是否开启抗锯齿效果。 | +| fill | [ResourceColor](ts-types.md) | Color.Black | 设置填充区域颜色。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| fillOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置填充区域透明度。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| stroke | [ResourceColor](ts-types.md) | - |设置边框颜色,不设置时,默认没有边框。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeDashArray | Array<Length> | [] | 设置边框间隙。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeDashOffset | number \| string | 0 | 边框绘制起点的偏移量。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | 设置边框端点绘制样式。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | 设置边框拐角绘制样式。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeMiterLimit | number \| string | 4 | 设置斜接长度与边框宽度比值的极限值。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
Ellipse组件无法设置尖角图形,该属性设置无效。 | +| strokeOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置边框透明度。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
该属性的取值范围是[0.0, 1.0],若给定值小于0.0,则取值为0.0;若给定值大于1.0,则取值为1.0。 | +| strokeWidth | Length | 1 | 设置边框宽度。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| antiAlias | boolean | true | 是否开启抗锯齿效果。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-line.md b/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-line.md index 6c1be1faad4f8e10eab54066920563875b8cb531..85f6d1289ce2b38e447f146ce547e094e9e1d9ee 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-line.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-line.md @@ -15,6 +15,8 @@ Line(value?: {width?: string | number, height?: string | number}) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | @@ -29,19 +31,19 @@ Line(value?: {width?: string | number, height?: string | number}) | 名称 | 类型 | 默认值 | 描述 | | -------- | -------- | -------- | -------- | -| startPoint | Array<Length> | [0, 0] | 直线起点坐标点(相对坐标),单位vp。 | -| endPoint | Array<Length> | [0, 0] | 直线终点坐标点(相对坐标),单位vp。 | -| fill | [ResourceColor](ts-types.md#resourcecolor) | Color.Black | 设置填充区域颜色。
**说明:**
Line组件无法形成闭合区域,该属性设置无效。 | -| fillOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置填充区域透明度。
**说明:**
Line组件无法形成闭合区域,该属性设置无效。 | -| stroke | [ResourceColor](ts-types.md#resourcecolor) | Color.Black | 设置线条颜色。 | -| strokeDashArray | Array<Length> | [] | 设置线条间隙。 | -| strokeDashOffset | number \| string | 0 | 线条绘制起点的偏移量。 | -| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | 设置线条端点绘制样式。 | -| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | 设置线条拐角绘制样式。 | -| strokeMiterLimit | number \| string | 4 | 设置锐角绘制成斜角的极限值。
**说明:**
Line组件无法设置锐角图形,该属性设置无效。 | -| strokeOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置线条透明度。
**说明:**
该属性的取值范围是[0.0, 1.0],若给定值小于0.0,则取值为0.0;若给定值大于1.0,则取值为1.0。 | -| strokeWidth | Length | 1 | 设置线条宽度。 | -| antiAlias | boolean | true | 是否开启抗锯齿效果。 | +| startPoint | Array<Length> | [0, 0] | 直线起点坐标点(相对坐标),单位vp。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| endPoint | Array<Length> | [0, 0] | 直线终点坐标点(相对坐标),单位vp。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| fill | [ResourceColor](ts-types.md#resourcecolor) | Color.Black | 设置填充区域颜色。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
Line组件无法形成闭合区域,该属性设置无效。 | +| fillOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置填充区域透明度。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
Line组件无法形成闭合区域,该属性设置无效。 | +| stroke | [ResourceColor](ts-types.md) | - | 设置边框颜色,不设置时,默认没有边框线条。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeDashArray | Array<Length> | [] | 设置线条间隙。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeDashOffset | number \| string | 0 | 线条绘制起点的偏移量。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | 设置线条端点绘制样式。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | 设置线条拐角绘制样式。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeMiterLimit | number \| string | 4 | 设置锐角绘制成斜角的极限值。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
Line组件无法设置锐角图形,该属性设置无效。 | +| strokeOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置线条透明度。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
该属性的取值范围是[0.0, 1.0],若给定值小于0.0,则取值为0.0;若给定值大于1.0,则取值为1.0。 | +| strokeWidth | Length | 1 | 设置线条宽度。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| antiAlias | boolean | true | 是否开启抗锯齿效果。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 @@ -58,6 +60,7 @@ struct LineExample { Line() .startPoint([0, 0]) .endPoint([50, 100]) + .stroke(Color.Black) .backgroundColor('#F5F5F5') Line() .width(200) @@ -72,6 +75,7 @@ struct LineExample { Line({ width: 50, height: 50 }) .startPoint([0, 0]) .endPoint([100, 100]) + .stroke(Color.Black) .strokeWidth(3) .strokeDashArray([10, 3]) .backgroundColor('#F5F5F5') @@ -79,6 +83,7 @@ struct LineExample { Line({ width: 50, height: 50 }) .startPoint([0, 0]) .endPoint([100, 100]) + .stroke(Color.Black) .strokeWidth(3) .strokeDashArray([10, 3]) .strokeDashOffset(5) @@ -105,6 +110,7 @@ struct LineExample1 { .height(200) .startPoint([50, 50]) .endPoint([50, 200]) + .stroke(Color.Black) .strokeWidth(20) .strokeLineCap(LineCapStyle.Butt) .backgroundColor('#F5F5F5').margin(10) @@ -114,6 +120,7 @@ struct LineExample1 { .height(200) .startPoint([50, 50]) .endPoint([50, 200]) + .stroke(Color.Black) .strokeWidth(20) .strokeLineCap(LineCapStyle.Round) .backgroundColor('#F5F5F5') @@ -123,6 +130,7 @@ struct LineExample1 { .height(200) .startPoint([50, 50]) .endPoint([50, 200]) + .stroke(Color.Black) .strokeWidth(20) .strokeLineCap(LineCapStyle.Square) .backgroundColor('#F5F5F5') @@ -145,29 +153,34 @@ struct LineExample { Line() .startPoint([50, 30]) .endPoint([300, 30]) + .stroke(Color.Black) .strokeWidth(10) // 设置strokeDashArray的数组间隔为 50 Line() .startPoint([50, 20]) .endPoint([300, 20]) + .stroke(Color.Black) .strokeWidth(10) .strokeDashArray([50]) // 设置strokeDashArray的数组间隔为 50, 10 Line() .startPoint([50, 20]) .endPoint([300, 20]) + .stroke(Color.Black) .strokeWidth(10) .strokeDashArray([50, 10]) // 设置strokeDashArray的数组间隔为 50, 10, 20 Line() .startPoint([50, 20]) .endPoint([300, 20]) + .stroke(Color.Black) .strokeWidth(10) .strokeDashArray([50, 10, 20]) // 设置strokeDashArray的数组间隔为 50, 10, 20, 30 Line() .startPoint([50, 20]) .endPoint([300, 20]) + .stroke(Color.Black) .strokeWidth(10) .strokeDashArray([50, 10, 20, 30]) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-path.md b/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-path.md index 1b3ebdef17e3e5b66396fac00b0cdef9c0fc5f49..5cf7d364f75b0a83a52817837b44ddb70a621ecf 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-path.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-path.md @@ -15,6 +15,8 @@ Path(value?: { width?: number | string; height?: number | string; commands?: string }) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | @@ -29,18 +31,18 @@ Path(value?: { width?: number | string; height?: number | string; commands?: str | 名称 | 类型 | 默认值 | 描述 | | -------- | ----------------------------------- | ---- | ---------------------------------------- | -| commands | string | '' | 路径绘制的命令字符串,单位为px。像素单位转换方法请参考[像素单位转换](ts-pixel-units.md)。 | -| fill | [ResourceColor](ts-types.md) | Color.Black | 设置填充区域颜色。 | -| fillOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置填充区域透明度。 | -| stroke | [ResourceColor](ts-types.md) | - | 设置线条颜色。 | -| strokeDashArray | Array<Length> | [] | 设置线条间隙。 | -| strokeDashOffset | number \| string | 0 | 线条绘制起点的偏移量。 | -| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | 设置线条端点绘制样式。 | -| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | 设置线条拐角绘制样式。 | -| strokeMiterLimit | number \| string | 4 | 设置斜接长度与边框宽度比值的极限值。斜接长度表示外边框外边交点到内边交点的距离,边框宽度即strokeWidth属性的值。
**说明:**
该属性取值需大于等于1,且在strokeLineJoin属性取值LineJoinStyle.Miter时生效。 | -| strokeOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置线条透明度。
**说明:**
该属性的取值范围是[0.0, 1.0],若给定值小于0.0,则取值为0.0;若给定值大于1.0,则取值为1.0。 | -| strokeWidth | Length | 1 | 设置线条宽度。 | -| antiAlias | boolean | true | 是否开启抗锯齿效果。 | +| commands | string | '' | 路径绘制的命令字符串,单位为px。像素单位转换方法请参考[像素单位转换](ts-pixel-units.md)。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| fill | [ResourceColor](ts-types.md) | Color.Black | 设置填充区域颜色。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| fillOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置填充区域透明度。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| stroke | [ResourceColor](ts-types.md) | - |设置边框颜色,不设置时,默认没有边框。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeDashArray | Array<Length> | [] | 设置线条间隙。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeDashOffset | number \| string | 0 | 线条绘制起点的偏移量。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | 设置线条端点绘制样式。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | 设置线条拐角绘制样式。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeMiterLimit | number \| string | 4 | 设置斜接长度与边框宽度比值的极限值。斜接长度表示外边框外边交点到内边交点的距离,边框宽度即strokeWidth属性的值。
**说明:**
该属性取值需大于等于1,且在strokeLineJoin属性取值LineJoinStyle.Miter时生效。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置线条透明度。
**说明:**
该属性的取值范围是[0.0, 1.0],若给定值小于0.0,则取值为0.0;若给定值大于1.0,则取值为1.0。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeWidth | Length | 1 | 设置线条宽度。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| antiAlias | boolean | true | 是否开启抗锯齿效果。
从API version 9开始,该接口支持在ArkTS卡片中使用。| commands支持的绘制命令如下: diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-polygon.md b/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-polygon.md index 687754f921ef7200cbeb8f13d8a150dd4e0af4a6..1e63df5002792b90232dd73cec7b10643a90ab39 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-polygon.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-polygon.md @@ -16,6 +16,8 @@ Polygon(value?: {width?: string | number, height?: string | number}) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | @@ -30,23 +32,25 @@ Polygon(value?: {width?: string | number, height?: string | number}) | 名称 | 类型 | 默认值 | 描述 | | -------- | -------- | -------- | -------- | -| points | Array<Point> | [] | 多边形的顶点坐标列表。 | -| fill | [ResourceColor](ts-types.md) | Color.Black | 设置填充区域颜色。 | -| fillOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置填充区域透明度。 | -| stroke | [ResourceColor](ts-types.md) | - | 设置边框颜色,不设置时,默认没有边框线条。 | -| strokeDashArray | Array<Length> | [] | 设置边框间隙。 | -| strokeDashOffset | number \| string | 0 | 边框绘制起点的偏移量。 | -| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | 设置边框端点绘制样式。 | -| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | 设置边框拐角绘制样式。 | -| strokeMiterLimit | number \| string | 4 | 设置斜接长度与边框宽度比值的极限值。斜接长度表示外边框外边交点到内边交点的距离,边框宽度即strokeWidth属性的值。
**说明:**
该属性取值需大于等于1,且在strokeLineJoin属性取值LineJoinStyle.Miter时生效。 | -| strokeOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置边框透明度。
**说明:**
该属性的取值范围是[0.0, 1.0],若给定值小于0.0,则取值为0.0;若给定值大于1.0,则取值为1.0。 | -| strokeWidth | Length | 1 | 设置边框宽度。 | -| antiAlias | boolean | true | 是否开启抗锯齿效果。 | +| points | Array<Point> | [] | 多边形的顶点坐标列表。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| fill | [ResourceColor](ts-types.md) | Color.Black | 设置填充区域颜色。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| fillOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置填充区域透明度。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| stroke | [ResourceColor](ts-types.md) | - | 设置边框颜色,不设置时,默认没有边框线条。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeDashArray | Array<Length> | [] | 设置边框间隙。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeDashOffset | number \| string | 0 | 边框绘制起点的偏移量。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | 设置边框端点绘制样式。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | 设置边框拐角绘制样式。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeMiterLimit | number \| string | 4 | 设置斜接长度与边框宽度比值的极限值。斜接长度表示外边框外边交点到内边交点的距离,边框宽度即strokeWidth属性的值。
**说明:**
该属性取值需大于等于1,且在strokeLineJoin属性取值LineJoinStyle.Miter时生效。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置边框透明度。
**说明:**
该属性的取值范围是[0.0, 1.0],若给定值小于0.0,则取值为0.0;若给定值大于1.0,则取值为1.0。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeWidth | Length | 1 | 设置边框宽度。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| antiAlias | boolean | true | 是否开启抗锯齿效果。
从API version 9开始,该接口支持在ArkTS卡片中使用。| ## Point 点坐标类型。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 类型定义 | 描述 | | --------- | -------------------- | ------------------------------------------------------------ | | Point | [number, number] | 第一个参数为x轴坐标,第二个参数为y轴坐标(相对坐标)。 | @@ -65,7 +69,6 @@ struct PolygonExample { Polygon({ width: 100, height: 100 }) .points([[0, 0], [50, 100], [100, 0]]) .fill(Color.Green) - .stroke(Color.Transparent) // 在 100 * 100 的矩形框中绘制一个四边形,起点(0, 0),经过(0, 100)和(100, 100),终点(100, 0) Polygon().width(100).height(100) .points([[0, 0], [0, 100], [100, 100], [100, 0]]) @@ -77,7 +80,6 @@ struct PolygonExample { .points([[50, 0], [0, 50], [20, 100], [80, 100], [100, 50]]) .fill(Color.Red) .fillOpacity(0.6) - .stroke(Color.Transparent) }.width('100%').margin({ top: 10 }) } } diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-polyline.md b/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-polyline.md index 5074c350a2e3d096bd9ae32688b6ed9c24ffe4aa..52f6fe26c12bbc36b2bcb28c6ac143a9ec2cf889 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-polyline.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-polyline.md @@ -16,6 +16,8 @@ Polyline(value?: {width?: string | number, height?: string | number}) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | @@ -30,23 +32,25 @@ Polyline(value?: {width?: string | number, height?: string | number}) | 名称 | 类型 | 默认值 | 描述 | | -------- | -------- | -------- | -------- | -| points | Array<Point> | [] | 折线经过坐标点列表。 | -| fill | [ResourceColor](ts-types.md) | Color.Black | 设置填充区域颜色。 | -| fillOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置填充区域透明度。 | -| stroke | [ResourceColor](ts-types.md) | - | 设置线条颜色。 | -| strokeDashArray | Array<Length> | [] | 设置线条间隙。 | -| strokeDashOffset | number \| string | 0 | 线条绘制起点的偏移量。 | -| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | 设置线条端点绘制样式。 | -| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | 设置线条拐角绘制样式。 | -| strokeMiterLimit | number \| string | 4 | 设置斜接长度与边框宽度比值的极限值。斜接长度表示外边框外边交点到内边交点的距离,边框宽度即strokeWidth属性的值。
**说明:**
该属性取值需大于等于1,且在strokeLineJoin属性取值LineJoinStyle.Miter时生效。 | -| strokeOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置线条透明度。
**说明:**
该属性的取值范围是[0.0, 1.0],若给定值小于0.0,则取值为0.0;若给定值大于1.0,则取值为1.0。 | -| strokeWidth | Length | 1 | 设置线条宽度。 | -| antiAlias | boolean | true | 是否开启抗锯齿效果。 | +| points | Array<Point> | [] | 折线经过坐标点列表。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| fill | [ResourceColor](ts-types.md) | Color.Black | 设置填充区域颜色。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| fillOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置填充区域透明度。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| stroke | [ResourceColor](ts-types.md) | - | 设置边框颜色,不设置时,默认没有边框线条。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeDashArray | Array<Length> | [] | 设置线条间隙。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeDashOffset | number \| string | 0 | 线条绘制起点的偏移量。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | 设置线条端点绘制样式。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | 设置线条拐角绘制样式。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeMiterLimit | number \| string | 4 | 设置斜接长度与边框宽度比值的极限值。斜接长度表示外边框外边交点到内边交点的距离,边框宽度即strokeWidth属性的值。
**说明:**
该属性取值需大于等于1,且在strokeLineJoin属性取值LineJoinStyle.Miter时生效。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置线条透明度。
**说明:**
该属性的取值范围是[0.0, 1.0],若给定值小于0.0,则取值为0.0;若给定值大于1.0,则取值为1.0。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeWidth | Length | 1 | 设置线条宽度。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| antiAlias | boolean | true | 是否开启抗锯齿效果。
从API version 9开始,该接口支持在ArkTS卡片中使用。| ## Point 点坐标类型。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 类型定义 | 描述 | | --------- | -------------------- | ------------------------------------------------------------ | | Point | [number, number] | 第一个参数为x轴坐标,第二个参数为y轴坐标(相对坐标)。 | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-rect.md b/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-rect.md index dbddfaf03fa31c54f880521a47d37a1c56f423c7..889b9f2f0d91311d2ec934cc8e46f6f4a67dc61b 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-rect.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-rect.md @@ -17,6 +17,8 @@ Rect(value?: {width?: string | number,height?: string | number,radius?: string | number | Array<string | number>} | {width?: string | number,height?: string | number,radiusWidth?: string | number,radiusHeight?: string | number}) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | @@ -34,20 +36,20 @@ Rect(value?: {width?: string | number,height?: string | number,radius?: string | | 名称 | 类型 | 默认值 | 描述 | | -------- | -------- | -------- | -------- | -| radiusWidth | string \| number | 0 | 圆角的宽度,仅设置宽时宽高一致。 | -| radiusHeight | string \| number | 0 | 圆角的高度,仅设置高时宽高一致。 | -| radius | string \| number \| Array<string \| number> | 0 | 圆角半径大小。 | -| fill | [ResourceColor](ts-types.md) | Color.Black | 设置填充区域颜色。 | -| fillOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置填充区域透明度。 | -| stroke | [ResourceColor](ts-types.md) | - | 设置边框颜色,不设置时,默认没有边框。 | -| strokeDashArray | Array<Length> | [] | 设置边框间隙。 | -| strokeDashOffset | number \| string | 0 | 边框绘制起点的偏移量。 | -| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | 设置边框端点绘制样式。 | -| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | 设置边框拐角绘制样式。 | -| strokeMiterLimit | number \| string | 4 | 设置斜接长度与边框宽度比值的极限值。斜接长度表示外边框外边交点到内边交点的距离,边框宽度即strokeWidth属性的值。
**说明:**
该属性取值需大于等于1,且在strokeLineJoin属性取值LineJoinStyle.Miter时生效。 | -| strokeOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置边框透明度。
**说明:**
该属性的取值范围是[0.0, 1.0],若给定值小于0.0,则取值为0.0;若给定值大于1.0,则取值为1.0。 | -| strokeWidth | Length | 1 | 设置边框宽度。 | -| antiAlias | boolean | true | 是否开启抗锯齿效果。 | +| radiusWidth | string \| number | 0 | 圆角的宽度,仅设置宽时宽高一致。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| radiusHeight | string \| number | 0 | 圆角的高度,仅设置高时宽高一致。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| radius | string \| number \| Array<string \| number> | 0 | 圆角半径大小。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| fill | [ResourceColor](ts-types.md) | Color.Black | 设置填充区域颜色。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| fillOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置填充区域透明度。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| stroke | [ResourceColor](ts-types.md) | - | 设置边框颜色,不设置时,默认没有边框。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeDashArray | Array<Length> | [] | 设置边框间隙。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeDashOffset | number \| string | 0 | 边框绘制起点的偏移量。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | 设置边框端点绘制样式。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | 设置边框拐角绘制样式。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeMiterLimit | number \| string | 4 | 设置斜接长度与边框宽度比值的极限值。斜接长度表示外边框外边交点到内边交点的距离,边框宽度即strokeWidth属性的值。
**说明:**
该属性取值需大于等于1,且在strokeLineJoin属性取值LineJoinStyle.Miter时生效。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置边框透明度。
**说明:**
该属性的取值范围是[0.0, 1.0],若给定值小于0.0,则取值为0.0;若给定值大于1.0,则取值为1.0。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeWidth | Length | 1 | 设置边框宽度。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| antiAlias | boolean | true | 是否开启抗锯齿效果。
从API version 9开始,该接口支持在ArkTS卡片中使用。| ## 示例 @@ -66,7 +68,6 @@ struct RectExample { // 绘制90% * 50矩形 Rect({ width: '90%', height: 50 }) .fill(Color.Pink) - .stroke(Color.Transparent) // 绘制90% * 50的矩形框 Rect() .width('90%') @@ -81,7 +82,6 @@ struct RectExample { .radiusHeight(20) .radiusWidth(40) .fill(Color.Pink) - .stroke(Color.Transparent) // 绘制90% * 80的矩形, 圆角宽高为20 Rect({ width: '90%', height: 80 }) .radius(20) @@ -92,7 +92,6 @@ struct RectExample { Rect({ width: '90%', height: 80 }) .radius([[40, 40], [20, 20], [40, 40], [20, 20]]) .fill(Color.Pink) - .stroke(Color.Transparent) }.width('100%').margin({ top: 5 }) } } diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-shape.md b/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-shape.md index 22231ba443c6382fb645d04b9833424324be8e55..7586e24fe930715e2b7f3b6cf6d12dce50043dca 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-shape.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-shape.md @@ -21,6 +21,8 @@ Shape(value?: PixelMap) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | @@ -34,19 +36,19 @@ Shape(value?: PixelMap) | 名称 | 类型 | 默认值 | 描述 | | -------- | -------- | -------- | -------- | -| viewPort | {
x?: number \| string,
y?: number \| string,
width?: number \| string,
height?: number \| string
} | { x:0, y:0, width:0, height:0 } | 形状的视口。 | -| fill | [ResourceColor](ts-types.md) | Color.Black | 设置填充区域颜色。 | -| fillOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置填充区域透明度。 | -| stroke | [ResourceColor](ts-types.md) | - | 设置边框颜色,不设置时,默认没有边框线条。 | -| strokeDashArray | Array<Length> | [] | 设置边框间隙。 | -| strokeDashOffset | number \| string | 0 | 边框绘制起点的偏移量。 | -| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | 设置边框端点绘制样式。 | -| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | 设置边框拐角绘制样式。 | -| strokeMiterLimit | number \| string | 4 | 设置斜接长度与边框宽度比值的极限值。斜接长度表示外边框外边交点到内边交点的距离,边框宽度即strokeWidth属性的值。
**说明:**
该属性取值需大于等于1,且在strokeLineJoin属性取值LineJoinStyle.Miter时生效。 | -| strokeOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置边框透明度。
**说明:**
该属性的取值范围是[0.0, 1.0],若给定值小于0.0,则取值为0.0;若给定值大于1.0,则取值为1.0。 | -| strokeWidth | number \| string | 1 | 设置边框宽度。 | -| antiAlias | boolean | true | 是否开启抗锯齿效果。 | -| mesh8+ | Array<number>,number,number | [],0,0 | 设置mesh效果。第一个参数为长度(column + 1)* (row + 1)* 2的数组,它记录了扭曲后的位图各个顶点位置,第二个参数为mesh矩阵列数column,第三个参数为mesh矩阵行数row。 | +| viewPort | {
x?: number \| string,
y?: number \| string,
width?: number \| string,
height?: number \| string
} | { x:0, y:0, width:0, height:0 } | 形状的视口。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| fill | [ResourceColor](ts-types.md) | Color.Black | 设置填充区域颜色。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| fillOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置填充区域透明度。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| stroke | [ResourceColor](ts-types.md) | - | 设置边框颜色,不设置时,默认没有边框线条。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeDashArray | Array<Length> | [] | 设置边框间隙。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeDashOffset | number \| string | 0 | 边框绘制起点的偏移量。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | 设置边框端点绘制样式。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | 设置边框拐角绘制样式。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeMiterLimit | number \| string | 4 | 设置斜接长度与边框宽度比值的极限值。斜接长度表示外边框外边交点到内边交点的距离,边框宽度即strokeWidth属性的值。
**说明:**
该属性取值需大于等于1,且在strokeLineJoin属性取值LineJoinStyle.Miter时生效。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置边框透明度。
**说明:**
该属性的取值范围是[0.0, 1.0],若给定值小于0.0,则取值为0.0;若给定值大于1.0,则取值为1.0。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeWidth | number \| string | 1 | 设置边框宽度。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| antiAlias | boolean | true | 是否开启抗锯齿效果。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| mesh8+ | Array<number>,number,number | [],0,0 | 设置mesh效果。第一个参数为长度(column + 1)* (row + 1)* 2的数组,它记录了扭曲后的位图各个顶点位置,第二个参数为mesh矩阵列数column,第三个参数为mesh矩阵行数row。
从API version 9开始,该接口支持在ArkTS卡片中使用。| ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-explicit-animation.md b/zh-cn/application-dev/reference/arkui-ts/ts-explicit-animation.md index e6511abfc7f4e969909655b05594e93df9764542..359b6890f857197555d65e39495eb2d0d558d48a 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-explicit-animation.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-explicit-animation.md @@ -6,9 +6,10 @@ > > 从API Version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 - animateTo(value: AnimateParam, event: () => void): void +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 参数 | 类型 | 是否必填 | 描述 | | ---------------- | ------------ | -------------------- | -------------------- | | value | [AnimateParam](#animateparam对象说明) | 是 | 设置动画效果相关参数。 | @@ -18,13 +19,13 @@ animateTo(value: AnimateParam, event: () => void): void | 名称 | 类型 | 描述 | | -------- | -------- | -------- | -| duration | number | 动画持续时间,单位为毫秒。
默认值:1000 | +| duration | number | 动画持续时间,单位为毫秒。
默认值:1000
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
- 在ArkTS卡片上最大动画持续时间为1000毫秒,若超出则固定为1000毫秒。 | | tempo | number | 动画的播放速度,值越大动画播放越快,值越小播放越慢,为0时无动画效果。
默认值:1.0 | -| curve | [Curve](ts-appendix-enums.md#curve) \| [ICurve](../apis/js-apis-curve.md#icurve) \| string | 动画曲线。
默认值:Curve.Linear | +| curve | [Curve](ts-appendix-enums.md#curve) \| [ICurve](../apis/js-apis-curve.md#icurve) \| string | 动画曲线。
默认值:Curve.Linear
从API version 9开始,该接口支持在ArkTS卡片中使用。 | | delay | number | 单位为ms(毫秒),默认不延时播放。
默认值:0 | | iterations | number | 默认播放一次,设置为-1时表示无限次播放。
默认值:1 | -| playMode | [PlayMode](ts-appendix-enums.md#playmode) | 设置动画播放模式,默认播放完成后重头开始播放。
默认值:PlayMode.Normal | -| onFinish | () => void | 动效播放完成回调。 | +| playMode | [PlayMode](ts-appendix-enums.md#playmode) | 设置动画播放模式,默认播放完成后重头开始播放。
默认值:PlayMode.Normal
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| onFinish | () => void | 动效播放完成回调。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-methods-custom-dialog-box.md b/zh-cn/application-dev/reference/arkui-ts/ts-methods-custom-dialog-box.md index 4b07b23b9d2ad75935b4be658d06933374a11722..604ebcbaa2793c48bf670705786324483fe094f8 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-methods-custom-dialog-box.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-methods-custom-dialog-box.md @@ -108,6 +108,11 @@ struct CustomDialogUser { customStyle: false }) + aboutToDisappear() { + delete this.dialogController, + this.dialogController = undefined + } + onCancel() { console.info('Callback when the first button is clicked') } @@ -124,7 +129,9 @@ struct CustomDialogUser { Column() { Button(this.inputValue) .onClick(() => { - this.dialogController.open() + if (this.dialogController != undefined) { + this.dialogController.open() + } }).backgroundColor(0x317aff) }.width('100%').margin({ top: 5 }) } diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-offscreencanvasrenderingcontext2d.md b/zh-cn/application-dev/reference/arkui-ts/ts-offscreencanvasrenderingcontext2d.md index 4b2cf7829f51081974f62855b30031e863a06740..a361fba275b5449880e7d47701dce7df65eb527d 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-offscreencanvasrenderingcontext2d.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-offscreencanvasrenderingcontext2d.md @@ -727,7 +727,7 @@ fillRect(x: number, y: number, w: number, h: number): void .height('100%') .backgroundColor('#ffff00') .onReady(() =>{ - this.offContext.fillRect(0,30,100,100) + this.offContext.fillRect(30,30,100,100) var image = this.offContext.transferToImageBitmap() this.context.transferFromImageBitmap(image) }) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-pixel-units.md b/zh-cn/application-dev/reference/arkui-ts/ts-pixel-units.md index 654b88ab931a8adbfd3f66d67f09ab33e145e817..d2de0f74094efb91025691580bef33c1e9e954b8 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-pixel-units.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-pixel-units.md @@ -15,14 +15,14 @@ 提供其他单位与px单位互相转换的方法。 -| 接口 | 描述 | -| ---------------------------------------- | ---------------------- | -| vp2px(value : number) : number | 将vp单位的数值转换为以px为单位的数值。 | -| px2vp(value : number) : number | 将px单位的数值转换为以vp为单位的数值。 | -| fp2px(value : number) : number | 将fp单位的数值转换为以px为单位的数值。 | -| px2fp(value : number) : number | 将px单位的数值转换为以fp为单位的数值。 | -| lpx2px(value : number) : number | 将lpx单位的数值转换为以px为单位的数值。 | -| px2lpx(value : number) : number | 将px单位的数值转换为以lpx为单位的数值。 | +| 接口 | 描述 | +| --------------------------------------------------- | ------------------------------------------------------------ | +| vp2px(value : number) : number | 将vp单位的数值转换为以px为单位的数值。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| px2vp(value : number) : number | 将px单位的数值转换为以vp为单位的数值。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| fp2px(value : number) : number | 将fp单位的数值转换为以px为单位的数值。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| px2fp(value : number) : number | 将px单位的数值转换为以fp为单位的数值。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| lpx2px(value : number) : number | 将lpx单位的数值转换为以px为单位的数值。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| px2lpx(value : number) : number | 将px单位的数值转换为以lpx为单位的数值。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-background.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-background.md index 1726ad14146e9f2c4aeb6919e3e031aa661fdfec..d3ce69c6dae140a33f2a6f68ebf0757a9c9fc09c 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-background.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-background.md @@ -10,10 +10,10 @@ | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | -| backgroundColor | [ResourceColor](ts-types.md#resourcecolor) | 设置组件的背景色。 | -| backgroundImage | src: [ResourceStr](ts-types.md#resourcestr),
repeat?: [ImageRepeat](ts-appendix-enums.md#imagerepeat) | src:图片地址,支持网络图片资源和本地图片资源地址(不支持svg类型的图片)。
repeat:设置背景图片的重复样式,默认不重复。 | -| backgroundImageSize | {
width?: [Length](ts-types.md#length),
height?: [Length](ts-types.md#length)
} \| [ImageSize](ts-appendix-enums.md#imagesize) | 设置背景图像的高度和宽度。当输入为{width: Length, height: Length}对象时,如果只设置一个属性,则第二个属性保持图片原始宽高比进行调整。默认保持原图的比例不变。
默认值:ImageSize.Auto | -| backgroundImagePosition | [Position](ts-types.md#position8) \| [Alignment](ts-appendix-enums.md#alignment) | 设置背景图在组件中显示位置,即相对于组件左上角的坐标。
默认值:
{
x: 0,
y: 0
}
x和y值设置百分比时,偏移量是相对组件自身宽高计算的。 | +| backgroundColor | [ResourceColor](ts-types.md#resourcecolor) | 设置组件的背景色。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| backgroundImage | src: [ResourceStr](ts-types.md#resourcestr),
repeat?: [ImageRepeat](ts-appendix-enums.md#imagerepeat) | src:图片地址,支持网络图片资源和本地图片资源地址(不支持svg类型的图片)。
repeat:设置背景图片的重复样式,默认不重复。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| backgroundImageSize | {
width?: [Length](ts-types.md#length),
height?: [Length](ts-types.md#length)
} \| [ImageSize](ts-appendix-enums.md#imagesize) | 设置背景图像的高度和宽度。当输入为{width: Length, height: Length}对象时,如果只设置一个属性,则第二个属性保持图片原始宽高比进行调整。默认保持原图的比例不变。
默认值:ImageSize.Auto
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| backgroundImagePosition | [Position](ts-types.md#position8) \| [Alignment](ts-appendix-enums.md#alignment) | 设置背景图在组件中显示位置,即相对于组件左上角的坐标。
默认值:
{
x: 0,
y: 0
}
x和y值设置百分比时,偏移量是相对组件自身宽高计算的。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-backgroundBlurStyle.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-backgroundBlurStyle.md index cb368b39322eff4969717eafe7fd80cb7b1af116..f31b9ab2fecaad49f6503bfab55b01e518cceff7 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-backgroundBlurStyle.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-backgroundBlurStyle.md @@ -12,10 +12,12 @@ | 名称 | 参数类型 | 描述 | | -------------------- | ----------------------- | ------------------------ | -| backgroundBlurStyle | [BlurStyle](#blurstyle) | 为当前组件提供一种在背景和内容之间的模糊能力,入参为模糊材质。| +| backgroundBlurStyle | [BlurStyle](#blurstyle) | 为当前组件提供一种在背景和内容之间的模糊能力,入参为模糊材质。
该接口支持在ArkTS卡片中使用。 | ## BlurStyle +该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------- | ---------- | | Thin | 轻薄材质。 | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-border-image.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-border-image.md index b41a408db85dccf042901b5dedcee65367dc18cd..2ade5dcdb6bc59452b253df6a4c73cacd7baae72 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-border-image.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-border-image.md @@ -10,10 +10,12 @@ | 名称 | 参数类型 | 描述 | | ---------- | ---------------------------------------- | --------------------------------------- | -| borderImage | [BorderImageOption](#borderimageoption对象说明) | 图片边框或者渐变色边框设置接口。 | +| borderImage | [BorderImageOption](#borderimageoption对象说明) | 图片边框或者渐变色边框设置接口。
该接口支持在ArkTS卡片中使用。 | ## BorderImageOption对象说明 +该接口支持在ArkTS卡片中使用。 + | 名称 | 类型 | 描述 | | ---------- | ---------------------------------------- | --------------------------------------- | | source | string \| [Resource](ts-types.md#resource) \| [linearGradient](ts-universal-attributes-gradient-color.md) | 边框图源或者渐变色设置。
**说明:** 边框图源仅适用于容器组件,如Row、Column、Flex,在非容器组件上使用会失效。 | @@ -23,9 +25,10 @@ | repeat | [RepeatMode](#repeatmode枚举说明) | 设置边框图片的重复方式。
默认值:RepeatMode.Stretch | | fill | boolean | 设置边框图片中心填充。
默认值:false | - ## RepeatMode枚举说明 +该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------- | ----------------------------------- | | Repeat | 被切割图片重复铺平在图片边框上,超出的部分会被剪裁。 | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-border.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-border.md index 58a64f62891cce602d65efe18cd04ee46c92abb5..e52c019db54f0f0b6bc7c45e1de40bd46aaabb4f 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-border.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-border.md @@ -13,11 +13,11 @@ | 名称 | 参数类型 | 描述 | | ------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | -| border | {
width?: [Length](ts-types.md#length) \| [EdgeWidths](#edgewidths9对象说明)9+,
color?:  [ResourceColor](ts-types.md#resourcecolor) \| [EdgeColors](#edgecolors9对象说明)9+,
radius?:  [Length](ts-types.md#length) \| [BorderRadiuses](#borderradiuses9对象说明)9+,
style?: [BorderStyle](ts-appendix-enums.md#borderstyle) \| [EdgeStyles](#edgestyles9对象说明)9+
} | 统一边框样式设置接口。
- width:设置边框宽度。
- color:设置边框颜色。
- radius:设置边框圆角半径。
- style:设置边框样式。 | -| borderStyle | [BorderStyle](ts-appendix-enums.md#borderstyle) \| [EdgeStyles](#edgestyles9对象说明)9+ | 设置元素的边框样式。
默认值:BorderStyle.Solid | -| borderWidth | [Length](ts-types.md#length) \| [EdgeWidths](#edgewidths9对象说明)9+ | 设置元素的边框宽度,不支持百分比。 | -| borderColor | [ResourceColor](ts-types.md#resourcecolor) \| [EdgeColors](#edgecolors9对象说明)9+ | 设置元素的边框颜色。
默认值:Color.Black | -| borderRadius | [Length](ts-types.md#length) \| [BorderRadiuses](#borderradiuses9对象说明)9+ | 设置元素的边框圆角半径,不支持百分比。 | +| border | {
width?: [Length](ts-types.md#length) \| [EdgeWidths](#edgewidths9对象说明)9+,
color?:  [ResourceColor](ts-types.md#resourcecolor) \| [EdgeColors](#edgecolors9对象说明)9+,
radius?:  [Length](ts-types.md#length) \| [BorderRadiuses](#borderradiuses9对象说明)9+,
style?: [BorderStyle](ts-appendix-enums.md#borderstyle) \| [EdgeStyles](#edgestyles9对象说明)9+
} | 统一边框样式设置接口。
- width:设置边框宽度。
- color:设置边框颜色。
- radius:设置边框圆角半径。
- style:设置边框样式。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| borderStyle | [BorderStyle](ts-appendix-enums.md#borderstyle) \| [EdgeStyles](#edgestyles9对象说明)9+ | 设置元素的边框样式。
默认值:BorderStyle.Solid
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| borderWidth | [Length](ts-types.md#length) \| [EdgeWidths](#edgewidths9对象说明)9+ | 设置元素的边框宽度,不支持百分比。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| borderColor | [ResourceColor](ts-types.md#resourcecolor) \| [EdgeColors](#edgecolors9对象说明)9+ | 设置元素的边框颜色。
默认值:Color.Black
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| borderRadius | [Length](ts-types.md#length) \| [BorderRadiuses](#borderradiuses9对象说明)9+ | 设置元素的边框圆角半径,不支持百分比。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## EdgeWidths9+对象说明 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-component-id.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-component-id.md index f56a0c97957064edf50c2f702a1a2f3bbea8c3a9..d4161f28b1303642db2c77ce388c230154a8acd6 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-component-id.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-component-id.md @@ -11,7 +11,7 @@ id为组件的唯一标识,在整个应用内唯一。本模块提供组件标 | 名称 | 参数说明 | 描述 | | -----| -------- | ----------------------------- | -| id | string | 组件的唯一标识,唯一性由使用者保证。
默认值:'' | +| id | string | 组件的唯一标识,唯一性由使用者保证。
默认值:''
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 接口 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-enable.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-enable.md index 794627c66f84c4aa409cc521c13fc25326bb6803..7bf82a4ed78ec0ae71b87cb093ebf782057d77e7 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-enable.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-enable.md @@ -10,9 +10,9 @@ ## 属性 -| 名称 | 参数类型 | 描述 | -| ------- | ------- | ---------------------------------------- | -| enabled | boolean | 值为true表示组件可交互,响应点击等操作。
值为false表示组件不可交互,不响应点击等操作。
默认值:true | +| 名称 | 参数类型 | 描述 | +| ------- | -------- | ------------------------------------------------------------ | +| enabled | boolean | 值为true表示组件可交互,响应点击等操作。
值为false表示组件不可交互,不响应点击等操作。
默认值:true
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-flex-layout.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-flex-layout.md index 176b1d4b04e4ba33d3adca9b8d309f2d3da6c7b8..e01fba5ea85912d2e78a357edc0ee7d7ff3b6bbf 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-flex-layout.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-flex-layout.md @@ -8,12 +8,12 @@ ## 属性 -| 名称 | 参数说明 | 描述 | -| ---------- | ---------------------------------------- | ---------------------------------------- | -| flexBasis | number \| string | 设置组件在父容器主轴方向上的基准尺寸。
默认值:'auto'(表示组件在主轴方向上的基准尺寸为组件原本的大小)。
不支持百分比设置。 | -| flexGrow | number | 设置父容器的剩余空间分配给此属性所在组件的比例。
默认值:0 | -| flexShrink | number | 设置父容器压缩尺寸分配给此属性所在组件的比例。
父容器为Row、Column时,默认值:0
父容器为flex时,默认值:1 | -| alignSelf | [ItemAlign](ts-appendix-enums.md#itemalign) | 子组件在父容器交叉轴的对齐格式,会覆盖Flex布局容器中的alignItems设置。
默认值:ItemAlign.Auto | +| 名称 | 参数说明 | 描述 | +| ---------- | ------------------------------------------- | ------------------------------------------------------------ | +| flexBasis | number \| string | 设置组件在父容器主轴方向上的基准尺寸。
默认值:'auto'(表示组件在主轴方向上的基准尺寸为组件原本的大小)。
不支持百分比设置。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| flexGrow | number | 设置父容器的剩余空间分配给此属性所在组件的比例。
默认值:0
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| flexShrink | number | 设置父容器压缩尺寸分配给此属性所在组件的比例。
父容器为Row、Column时,默认值:0
父容器为flex时,默认值:1
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| alignSelf | [ItemAlign](ts-appendix-enums.md#itemalign) | 子组件在父容器交叉轴的对齐格式,会覆盖Flex布局容器中的alignItems设置。
默认值:ItemAlign.Auto
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-gradient-color.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-gradient-color.md index 0a14af72b6503b0b69acffe09f82e866c0c1e6b8..c1f7ea7b4d5d466833f736a2035eeaaf1f99b22d 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-gradient-color.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-gradient-color.md @@ -12,9 +12,9 @@ | 名称 | 参数类型 | 描述 | | -------------- | -------------------------------------------- | ----------------------------------- | -| linearGradient | {
angle?: number \| string,
direction?: [GradientDirection](ts-appendix-enums.md#gradientdirection),
colors: Array<[ColorStop](ts-basic-components-gauge.md#colorstop)>,
repeating?: boolean
} | 线性渐变。
- angle: 线性渐变的起始角度。0点方向顺时针旋转为正向角度。
默认值:180
- direction: 线性渐变的方向,设置angle后不生效。
默认值:GradientDirection.Bottom
- colors: 为渐变的颜色描述。
- repeating: 为渐变的颜色重复着色。
默认值:false | -| sweepGradient | {
center: Point,
start?: number \| string,
end?: number \| string,
rotation?: number\|string,
colors: Array<[ColorStop](ts-basic-components-gauge.md#colorstop)>,
repeating?: boolean
} | 角度渐变。
- center:为角度渐变的中心点,即相对于当前组件左上角的坐标。
- start:角度渐变的起点。
默认值:0
- end:角度渐变的终点。
默认值:0
- rotation: 角度渐变的旋转角度。
默认值:0
- colors: 为渐变的颜色描述。
- repeating: 为渐变的颜色重复着色。
默认值:false | -| radialGradient | {
center: Point,
radius: number \| string,
colors: Array<[ColorStop](ts-basic-components-gauge.md#colorstop)>,
repeating?: boolean
} | 径向渐变。
- center:径向渐变的中心点,即相对于当前组件左上角的坐标。
- radius:径向渐变的半径。
- colors: 为渐变的颜色描述。
- repeating: 为渐变的颜色重复着色。
默认值:false | +| linearGradient | {
angle?: number \| string,
direction?: [GradientDirection](ts-appendix-enums.md#gradientdirection),
colors: Array<[ColorStop](ts-basic-components-gauge.md#colorstop)>,
repeating?: boolean
} | 线性渐变。
- angle: 线性渐变的起始角度。0点方向顺时针旋转为正向角度。
默认值:180
- direction: 线性渐变的方向,设置angle后不生效。
默认值:GradientDirection.Bottom
- colors: 为渐变的颜色描述。
- repeating: 为渐变的颜色重复着色。
默认值:false
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| sweepGradient | {
center: Point,
start?: number \| string,
end?: number \| string,
rotation?: number\|string,
colors: Array<[ColorStop](ts-basic-components-gauge.md#colorstop)>,
repeating?: boolean
} | 角度渐变。
- center:为角度渐变的中心点,即相对于当前组件左上角的坐标。
- start:角度渐变的起点。
默认值:0
- end:角度渐变的终点。
默认值:0
- rotation: 角度渐变的旋转角度。
默认值:0
- colors: 为渐变的颜色描述。
- repeating: 为渐变的颜色重复着色。
默认值:false
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| radialGradient | {
center: Point,
radius: number \| string,
colors: Array<[ColorStop](ts-basic-components-gauge.md#colorstop)>,
repeating?: boolean
} | 径向渐变。
- center:径向渐变的中心点,即相对于当前组件左上角的坐标。
- radius:径向渐变的半径。
- colors: 为渐变的颜色描述。
- repeating: 为渐变的颜色重复着色。
默认值:false
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-image-effect.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-image-effect.md index aeea88ebbd87f094527a258cf2c3a9ec7910fabb..a734d9e85a9930409107267060d8b01705d3e246 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-image-effect.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-image-effect.md @@ -12,17 +12,17 @@ | 名称 | 参数类型 | 默认值 | 描述 | | ----------------------------- | ------------------------------------------------------------ | ------ | ------------------------------------------------------------ | -| blur | number | - | 为当前组件添加内容模糊效果,入参为模糊半径,模糊半径越大越模糊,为0时不模糊。 | -| backdropBlur | number | - | 为当前组件添加背景模糊效果,入参为模糊半径,模糊半径越大越模糊,为0时不模糊。 | -| shadow | {
radius: number \| [Resource](ts-types.md#resource),
color?: [Color](ts-appendix-enums.md#color) \| string \| [Resource](ts-types.md#resource),
offsetX?: number \| [Resource](ts-types.md#resource),
offsetY?: number \| [Resource](ts-types.md#resource)
} | - | 为当前组件添加阴影效果,入参为模糊半径(必填)、阴影的颜色(可选,默认为灰色)、X轴的偏移量(可选,默认为0),Y轴的偏移量(可选,默认为0),偏移量单位为px。 | -| grayscale | number | 0.0 | 为当前组件添加灰度效果。值定义为灰度转换的比例,入参1.0则完全转为灰度图像,入参则0.0图像无变化,入参在0.0和1.0之间时,效果呈线性变化。(百分比) | -| brightness | number | 1.0 | 为当前组件添加高光效果,入参为高光比例,值为1时没有效果,小于1时亮度变暗,0为全黑;大于1时亮度增加,数值越大亮度越大。 | -| saturate | number | 1.0 | 为当前组件添加饱和度效果,饱和度为颜色中的含色成分和消色成分(灰)的比例,入参为1时,显示原图像,大于1时含色成分越大,饱和度越大;小于1时消色成分越大,饱和度越小。(百分比) | -| contrast | number | 1.0 | 为当前组件添加对比度效果,入参为对比度的值,值为1时,显示原图;大于1时,值越大对比度越高,图像越清晰醒目;小于1时,值越小对比度越低;当对比度为0时,图像变为全灰。(百分比) | -| invert | number | 0 | 反转输入的图像。入参为图像反转的比例。值为1时完全反转。值为0则图像无变化。(百分比) | -| sepia | number | 0 | 将图像转换为深褐色。入参为图像反转的比例。值为1则完全是深褐色的,值为0图像无变化。 (百分比) | -| hueRotate | number \| string | '0deg' | 色相旋转效果,输入参数为旋转角度。 | -| colorBlend 8+ | [Color](ts-appendix-enums.md#color) \| string \| [Resource](ts-types.md#resource) | - | 为当前组件添加颜色叠加效果,入参为叠加的颜色。 | +| blur | number | - | 为当前组件添加内容模糊效果,入参为模糊半径,模糊半径越大越模糊,为0时不模糊。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| backdropBlur | number | - | 为当前组件添加背景模糊效果,入参为模糊半径,模糊半径越大越模糊,为0时不模糊。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| shadow | {
radius: number \| [Resource](ts-types.md#resource),
color?: [Color](ts-appendix-enums.md#color) \| string \| [Resource](ts-types.md#resource),
offsetX?: number \| [Resource](ts-types.md#resource),
offsetY?: number \| [Resource](ts-types.md#resource)
} | - | 为当前组件添加阴影效果,入参为模糊半径(必填)、阴影的颜色(可选,默认为灰色)、X轴的偏移量(可选,默认为0),Y轴的偏移量(可选,默认为0),偏移量单位为px。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| grayscale | number | 0.0 | 为当前组件添加灰度效果。值定义为灰度转换的比例,入参1.0则完全转为灰度图像,入参则0.0图像无变化,入参在0.0和1.0之间时,效果呈线性变化。(百分比)
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| brightness | number | 1.0 | 为当前组件添加高光效果,入参为高光比例,值为1时没有效果,小于1时亮度变暗,0为全黑;大于1时亮度增加,数值越大亮度越大。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| saturate | number | 1.0 | 为当前组件添加饱和度效果,饱和度为颜色中的含色成分和消色成分(灰)的比例,入参为1时,显示原图像,大于1时含色成分越大,饱和度越大;小于1时消色成分越大,饱和度越小。(百分比)
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| contrast | number | 1.0 | 为当前组件添加对比度效果,入参为对比度的值,值为1时,显示原图;大于1时,值越大对比度越高,图像越清晰醒目;小于1时,值越小对比度越低;当对比度为0时,图像变为全灰。(百分比)
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| invert | number | 0 | 反转输入的图像。入参为图像反转的比例。值为1时完全反转。值为0则图像无变化。(百分比)
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| sepia | number | 0 | 将图像转换为深褐色。入参为图像反转的比例。值为1则完全是深褐色的,值为0图像无变化。 (百分比)
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| hueRotate | number \| string | '0deg' | 色相旋转效果,输入参数为旋转角度。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| colorBlend 8+ | [Color](ts-appendix-enums.md#color) \| string \| [Resource](ts-types.md#resource) | - | 为当前组件添加颜色叠加效果,入参为叠加的颜色。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-layout-constraints.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-layout-constraints.md index 5fb5468e9a67be8d63c19ce5f20c7057a542527f..7049c1352559952f5c9e3625ae5fcdc001d894e0 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-layout-constraints.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-layout-constraints.md @@ -9,10 +9,10 @@ ## 属性 -| 名称 | 参数说明 | 描述 | -| --------------- | ------ | ---------------------------------------- | -| aspectRatio | number | 指定当前组件的宽高比,aspectRatio = width/height。 | -| displayPriority | number | 设置当前组件在布局容器中显示的优先级,当父容器空间不足时,低优先级的组件会被隐藏。
小数点后的数字不作优先级区分,即区间为[x, x + 1)内的数字视为相同优先级。例如:1.0与1.9为同一优先级。
**说明:**
仅在Row/Column/Flex(单行)容器组件中生效。 | +| 名称 | 参数说明 | 描述 | +| --------------- | -------- | ------------------------------------------------------------ | +| aspectRatio | number | 指定当前组件的宽高比,aspectRatio = width/height。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| displayPriority | number | 设置当前组件在布局容器中显示的优先级,当父容器空间不足时,低优先级的组件会被隐藏。
小数点后的数字不作优先级区分,即区间为[x, x + 1)内的数字视为相同优先级。例如:1.0与1.9为同一优先级。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
仅在Row/Column/Flex(单行)容器组件中生效。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-location.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-location.md index fe33e7e9bd2a464ec43fd9a138c9b5a2320583d6..d82ebf0f2b9ea42bf62d62b8fc918cb014c20390 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-location.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-location.md @@ -12,12 +12,12 @@ | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | -| align | [Alignment](ts-appendix-enums.md#alignment) | 设置元素内容在元素绘制区域内的对齐方式。
默认值:Alignment.Center | -| direction | [Direction](ts-appendix-enums.md#direction) | 设置元素水平方向的布局。
默认值:Direction.Auto | -| position | [Position](ts-types.md#position8) | 绝对定位,设置元素左上角相对于父容器左上角偏移位置。在布局容器中,设置该属性不影响父容器布局,仅在绘制时进行位置调整。 | -| markAnchor | [Position](ts-types.md#position8) | 设置元素在位置定位时的锚点,以元素左上角作为基准点进行偏移。通常配合position和offset属性使用,单独使用时,效果类似offset
默认值:
{
x: 0,
y: 0
} | -| offset | [Position](ts-types.md#position8) | 相对定位,设置元素相对于自身的偏移量。设置该属性,不影响父容器布局,仅在绘制时进行位置调整。
默认值:
{
x: 0,
y: 0
} | -| alignRules9+ | {
left?: { anchor: string, align: [HorizontalAlign](ts-appendix-enums.md#horizontalalign) };
right?: { anchor: string, align: [HorizontalAlign](ts-appendix-enums.md#horizontalalign) };
middle?: { anchor: string, align: [HorizontalAlign](ts-appendix-enums.md#horizontalalign) };
top?: { anchor: string, align: [VerticalAlign](ts-appendix-enums.md#verticalalign) };
bottom?: { anchor: string, align: [VerticalAlign](ts-appendix-enums.md#verticalalign) };
center?: { anchor: string, align: [VerticalAlign](ts-appendix-enums.md#verticalalign) }
} | 指定相对容器的对齐规则。
- left:设置左对齐参数。
- right:设置右对齐参数。
- middle:设置中间对齐的参数。
- top:设置顶部对齐的参数。
- bottom:设置底部对齐的参数。
- center:设置中心对齐的参数。
**说明:**
- anchor:设置作为锚点的组件的id值。
- align:设置相对于锚点组件的对齐方式。 | +| align | [Alignment](ts-appendix-enums.md#alignment) | 设置元素内容在元素绘制区域内的对齐方式。
默认值:Alignment.Center
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| direction | [Direction](ts-appendix-enums.md#direction) | 设置元素水平方向的布局。
默认值:Direction.Auto
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| position | [Position](ts-types.md#position8) | 绝对定位,设置元素左上角相对于父容器左上角偏移位置。在布局容器中,设置该属性不影响父容器布局,仅在绘制时进行位置调整。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| markAnchor | [Position](ts-types.md#position8) | 设置元素在位置定位时的锚点,以元素左上角作为基准点进行偏移。通常配合position和offset属性使用,单独使用时,效果类似offset
默认值:
{
x: 0,
y: 0
}
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| offset | [Position](ts-types.md#position8) | 相对定位,设置元素相对于自身的偏移量。设置该属性,不影响父容器布局,仅在绘制时进行位置调整。
默认值:
{
x: 0,
y: 0
}
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| alignRules9+ | {
left?: { anchor: string, align: [HorizontalAlign](ts-appendix-enums.md#horizontalalign) };
right?: { anchor: string, align: [HorizontalAlign](ts-appendix-enums.md#horizontalalign) };
middle?: { anchor: string, align: [HorizontalAlign](ts-appendix-enums.md#horizontalalign) };
top?: { anchor: string, align: [VerticalAlign](ts-appendix-enums.md#verticalalign) };
bottom?: { anchor: string, align: [VerticalAlign](ts-appendix-enums.md#verticalalign) };
center?: { anchor: string, align: [VerticalAlign](ts-appendix-enums.md#verticalalign) }
} | 指定相对容器的对齐规则。
- left:设置左对齐参数。
- right:设置右对齐参数。
- middle:设置中间对齐的参数。
- top:设置顶部对齐的参数。
- bottom:设置底部对齐的参数。
- center:设置中心对齐的参数。
该接口支持在ArkTS卡片中使用。
**说明:**
- anchor:设置作为锚点的组件的id值。
- align:设置相对于锚点组件的对齐方式。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-opacity.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-opacity.md index 1883fcc9579703540203e7034d6d8005fe9df258..b24f4f342e0ce58850a6bd18adecf179a2beaf07 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-opacity.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-opacity.md @@ -12,7 +12,7 @@ | 名称 | 参数类型 | 描述 | | ------- | ---------------------------------------- | ---------------------------------------- | -| opacity | number \| [Resource](ts-types.md#resource) | 元素的不透明度,取值范围为0到1,1表示不透明,0表示完全透明, 达到隐藏组件效果,但是在布局中占位。
**说明:**
子组件可以继承父组件的此属性。默认值:1 | +| opacity | number \| [Resource](ts-types.md#resource) | 元素的不透明度,取值范围为0到1,1表示不透明,0表示完全透明, 达到隐藏组件效果,但是在布局中占位。
**说明:**
子组件可以继承父组件的此属性。默认值:1
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-overlay.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-overlay.md index 153cb7f34463052a855476f22fda8b76ddbb2233..95da98af8a3393950bb33a6a621671cacd1f33a4 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-overlay.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-overlay.md @@ -10,7 +10,7 @@ | 名称 | 参数类型 | 默认值 | 描述 | | -------- | -------- | -------- | -------- | -| overlay | value: string,
options?: {
align?: [Alignment](ts-appendix-enums.md#alignment), 
offset?: {x?: number, y?: number}
} | {
align: Alignment.Center,
offset: {0, 0}
} | 在当前组件上,增加遮罩文本。
value: 遮罩文本内容。
options: 文本定位,align设置文本相对于组件的方位,[offset](ts-universal-attributes-location.md)为文本基于自身左上角的偏移量。文本默认处于组件左上角。
两者都设置时效果重叠,文本相对于组件方位定位后再基于当前位置文本的左上角进行偏移。 | +| overlay | value: string,
options?: {
align?: [Alignment](ts-appendix-enums.md#alignment), 
offset?: {x?: number, y?: number}
} | {
align: Alignment.Center,
offset: {0, 0}
} | 在当前组件上,增加遮罩文本。
value: 遮罩文本内容。
options: 文本定位,align设置文本相对于组件的方位,[offset](ts-universal-attributes-location.md)为文本基于自身左上角的偏移量。文本默认处于组件左上角。
两者都设置时效果重叠,文本相对于组件方位定位后再基于当前位置文本的左上角进行偏移。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-polymorphic-style.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-polymorphic-style.md index eebd642335745d02b1f2ed25dd864901462278e7..cefbbec1b1992760edf17069900d024c4ba9a32c 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-polymorphic-style.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-polymorphic-style.md @@ -11,10 +11,12 @@ | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | -| stateStyles | StateStyles | 设置组件不同状态的样式。 | +| stateStyles | StateStyles | 设置组件不同状态的样式。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## StateStyles接口说明 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 类型 | 必填 | 描述 | | -------- | -------- | -------- | -------- | | normal | ()=>void | 否 | 组件无状态时的样式。 | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md index 7d001c0c0781ca41d72d34398a668b563d46b30f..54de8ab03769624a928d9a1dc3e2fe4fe3b2353a 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md @@ -25,6 +25,7 @@ | onStateChange | (event: { isVisible: boolean }) => void | 否 | 弹窗状态变化事件回调,参数isVisible为弹窗当前的显示状态。 | | arrowOffset9+ | [Length](ts-types.md#length) | 否 | popup箭头在弹窗处的偏移。箭头在气泡上下方时,数值为0表示箭头居最左侧,偏移量为箭头至最左侧的距离,默认居中。箭头在气泡左右侧时,偏移量为箭头至最上侧的距离,默认居中。如果显示在屏幕边缘,气泡会自动左右偏移,数值为0时箭头始终指向绑定组件。 | | showInSubWindow9+ | boolean | 否 | 是否在子窗口显示气泡,默认值为false。 | +| mask10+ | boolean \| [ResourceColor](ts-types.md#resourcecolor) | 否 | 设置气泡是否有遮罩层及遮罩颜色。如果设置为false,则没有遮罩层;如果设置为true,则设置有遮罩层并且颜色为透明色;如果设置为Color,则为遮罩层的颜色。 | ## CustomPopupOptions8+类型说明 @@ -32,13 +33,13 @@ | -------------------------| ------------------------- | ---- | ---------------------------------------------------- | | builder | [CustomBuilder](ts-types.md#custombuilder8) | 是 | 提示气泡内容的构造器。 | | placement | [Placement](ts-appendix-enums.md#placement8) | 否 | 气泡组件优先显示的位置,当前位置显示不下时,会自动调整位置。
默认值:Placement.Bottom | -| maskColor | [ResourceColor](ts-types.md#resourcecolor) | 否 | 提示气泡遮障层的颜色。 | | popupColor | [ResourceColor](ts-types.md#resourcecolor) | 否 | 提示气泡的颜色。 | | enableArrow | boolean | 否 | 是否显示箭头。
从API Version 9开始,如果箭头所在方位侧的气泡长度不足以显示下箭头,则会默认不显示箭头。比如:placement设置为Left,但气泡高度小于箭头的宽度的两倍(64vp),则实际不会显示箭头。
默认值:true | | autoCancel | boolean | 否 | 页面有操作时,是否自动关闭气泡。
默认值:true | | onStateChange | (event: { isVisible: boolean }) => void | 否 | 弹窗状态变化事件回调,参数为弹窗当前的显示状态。 | | arrowOffset9+ | [Length](ts-types.md#length) | 否 | popup箭头在弹窗处的偏移。箭头在气泡上下方时,数值为0表示箭头居最左侧,偏移量为箭头至最左侧的距离,默认居中。箭头在气泡左右侧时,偏移量为箭头至最上侧的距离,默认居中。如果显示在屏幕边缘,气泡会自动左右偏移,数值为0时箭头始终指向绑定组件。 | | showInSubWindow9+ | boolean | 否 | 是否在子窗口显示气泡,默认值为false。 | +| mask10+ | boolean \| [ResourceColor](ts-types.md#resourcecolor) | 否 | 设置气泡是否有遮罩层及遮罩颜色。如果设置为false,则没有遮罩层;如果设置为true,则设置有遮罩层并且颜色为透明色;如果设置为Color,则为遮罩层的颜色。 | ## 示例 @@ -102,7 +103,7 @@ struct PopupExample { .bindPopup(this.customPopup, { builder: this.popupBuilder, placement: Placement.Top, - maskColor: 0x33000000, + mask: {color: 0x33000000}, popupColor: Color.Yellow, enableArrow: true, showInSubWindow: false, diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-sharp-clipping.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-sharp-clipping.md index 00fe83401f13a4feded827a272cdba5dad75f4a9..d7c6f070afe88b8046b38870ef2e7176491661d1 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-sharp-clipping.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-sharp-clipping.md @@ -12,8 +12,8 @@ | 名称 | 参数类型 | 描述 | | -----| ------------------------------------------ | ------------------------------------ | -| clip | [Circle](ts-drawing-components-circle.md) \| [Ellipse](ts-drawing-components-ellipse.md) \| [Path](ts-drawing-components-path.md) \| [Rect](ts-drawing-components-rect.md) \| boolean | 参数为相应类型的组件,按指定的形状对当前组件进行裁剪;参数为boolean类型时,设置是否按照父容器边缘轮廓进行裁剪。
默认值:false | -| mask | [Circle](ts-drawing-components-circle.md) \| [Ellipse](ts-drawing-components-ellipse.md) \| [Path](ts-drawing-components-path.md) \| [Rect](ts-drawing-components-rect.md) | 在当前组件上加上指定形状的遮罩。 | +| clip | [Circle](ts-drawing-components-circle.md) \| [Ellipse](ts-drawing-components-ellipse.md) \| [Path](ts-drawing-components-path.md) \| [Rect](ts-drawing-components-rect.md) \| boolean | 参数为相应类型的组件,按指定的形状对当前组件进行裁剪;参数为boolean类型时,设置是否按照父容器边缘轮廓进行裁剪。
默认值:false
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| mask | [Circle](ts-drawing-components-circle.md) \| [Ellipse](ts-drawing-components-ellipse.md) \| [Path](ts-drawing-components-path.md) \| [Rect](ts-drawing-components-rect.md) | 在当前组件上加上指定形状的遮罩。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-size.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-size.md index a4e65b50d26c7e4188f3ffc9409c6abf3a1265c5..c091d5e51f1954fe78e4750bf8401dc797163d5e 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-size.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-size.md @@ -10,15 +10,15 @@ ## 属性 -| 名称 | 参数说明 | 描述 | -| -------------- | ---------------------------------------- | ---------------------------------------- | -| width | [Length](ts-types.md#length) | 设置组件自身的宽度,缺省时使用元素自身内容需要的宽度。若子组件的宽大于父组件的宽,则会画出父组件的范围。 | -| height | [Length](ts-types.md#length) | 设置组件自身的高度,缺省时使用元素自身内容需要的高度。若子组件的高大于父组件的高,则会画出父组件的范围。 | -| size | {
width?: [Length](ts-types.md#length),
height?: [Length](ts-types.md#length)
} | 设置高宽尺寸。 | -| padding | [Padding](ts-types.md#padding) \| [Length](ts-types.md#length) | 设置内边距属性。
参数为Length类型时,四个方向内边距同时生效。
默认值:0
padding设置百分比时,上下左右内边距均以父容器的width作为基础值。 | -| margin | [Margin](ts-types.md#margin) \| [Length](ts-types.md#length) | 设置外边距属性。
参数为Length类型时,四个方向外边距同时生效。
默认值:0
margin设置百分比时,上下左右外边距均以父容器的width作为基础值。| -| constraintSize | {
minWidth?: [Length](ts-types.md#length),
maxWidth?: [Length](ts-types.md#length),
minHeight?: [Length](ts-types.md#length),
maxHeight?: [Length](ts-types.md#length)
} | 设置约束尺寸,组件布局时,进行尺寸范围限制。constraintSize的优先级高于Width和Height。若设置的minWidth大于maxWidth,则minWidth生效,minHeight与maxHeight同理。
默认值:
{
minWidth: 0,
maxWidth: Infinity,
minHeight: 0,
maxHeight: Infinity
} | -| layoutWeight | number \| string | 父容器尺寸确定时,设置了layoutWeight属性的子元素与兄弟元素占主轴尺寸按照权重进行分配,忽略元素本身尺寸设置,表示自适应占满剩余空间。
**说明:**
仅在Row/Column/Flex布局中生效。| +| 名称 | 参数说明 | 描述 | +| -------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | +| width | [Length](ts-types.md#length) | 设置组件自身的宽度,缺省时使用元素自身内容需要的宽度。若子组件的宽大于父组件的宽,则会画出父组件的范围。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| height | [Length](ts-types.md#length) | 设置组件自身的高度,缺省时使用元素自身内容需要的高度。若子组件的高大于父组件的高,则会画出父组件的范围。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| size | {
width?: [Length](ts-types.md#length),
height?: [Length](ts-types.md#length)
} | 设置高宽尺寸。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| padding | [Padding](ts-types.md#padding) \| [Length](ts-types.md#length) | 设置内边距属性。
参数为Length类型时,四个方向内边距同时生效。
默认值:0
padding设置百分比时,上下左右内边距均以父容器的width作为基础值。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| margin | [Margin](ts-types.md#margin) \| [Length](ts-types.md#length) | 设置外边距属性。
参数为Length类型时,四个方向外边距同时生效。
默认值:0
margin设置百分比时,上下左右外边距均以父容器的width作为基础值。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| constraintSize | {
minWidth?: [Length](ts-types.md#length),
maxWidth?: [Length](ts-types.md#length),
minHeight?: [Length](ts-types.md#length),
maxHeight?: [Length](ts-types.md#length)
} | 设置约束尺寸,组件布局时,进行尺寸范围限制。constraintSize的优先级高于Width和Height。若设置的minWidth大于maxWidth,则minWidth生效,minHeight与maxHeight同理。
默认值:
{
minWidth: 0,
maxWidth: Infinity,
minHeight: 0,
maxHeight: Infinity
}
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| layoutWeight | number \| string | 父容器尺寸确定时,设置了layoutWeight属性的子元素与兄弟元素占主轴尺寸按照权重进行分配,忽略元素本身尺寸设置,表示自适应占满剩余空间。
**说明:**
仅在Row/Column/Flex布局中生效。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-touch-target.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-touch-target.md index aa8a4903a08a0394c911ef53a797789add582904..6782a448b7d950d0a2d3eee53ebe50a3f0fcbc54 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-touch-target.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-touch-target.md @@ -11,12 +11,15 @@ ## 属性 -| 名称 | 参数类型 | 描述 | -| -------------- | --------------------------------------------- | ----------------------------------------- | -| responseRegion | Array<[Rectangle](#rectangle对象说明)> \| [Rectangle](#rectangle对象说明) | 设置一个或多个触摸热区,包括位置和大小。
默认触摸热区为整个组件,默认值:
{
x:0,
y:0,
width:'100%',
height:'100%'
} | +| 名称 | 参数类型 | 描述 | +| -------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | +| responseRegion | Array<[Rectangle](#rectangle对象说明)> \| [Rectangle](#rectangle对象说明) | 设置一个或多个触摸热区,包括位置和大小。
默认触摸热区为整个组件,默认值:
{
x:0,
y:0,
width:'100%',
height:'100%'
}
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## Rectangle对象说明 + +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 类型 | 必填 | 描述 | | ------ | ----------------------------- | -----| -------------------------------- | | x | [Length](ts-types.md#length) | 否 | 触摸点相对于组件左上角的x轴坐标。
默认值:0vp | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-transformation.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-transformation.md index 2c9869a9dce1c8dc8f81791848d0a7293b516d43..f7bb9a57fb79574859d7e6569fc3ffa9d1057c7f 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-transformation.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-transformation.md @@ -11,9 +11,9 @@ | 名称 | 参数类型 | 描述 | | --------- | ------------------------------------------------------------ | ------------------------------------------------------------ | -| rotate | {
x?: number,
y?: number,
z?: number,
angle?: number \| string,
centerX?: number \| string,
centerY?: number \| string
} | (x, y, z)指定一个矢量,表示旋转轴,正角度为顺时针转动,负角度为逆时针转动,默认值为0,同时可以通过centerX和centerY设置旋转的中心点。
默认值:
{
x: 0,
y: 0,
z: 0,
angle: 0,
centerX: '50%',
centerY: '50%'
} | -| translate | {
x?: number \| string,
y?: number \| string,
z? : number \| string
} | 可以分别设置X轴、Y轴、Z轴的平移距离,距离的正负控制平移的方向。不支持百分比形式的输入。
默认值:
{
x: 0,
y: 0,
z: 0
} | -| scale | {
x?: number,
y?: number,
z?: number,
centerX?: number \| string,
centerY?: number \| string
} | 可以分别设置X轴、Y轴、Z轴的缩放比例,默认值为1,同时可以通过centerX和centerY设置缩放的中心点。
默认值:
{
x: 1,
y: 1,
z: 1,
centerX:'50%',
centerY:'50%'
} | +| rotate | {
x?: number,
y?: number,
z?: number,
angle?: number \| string,
centerX?: number \| string,
centerY?: number \| string
} | (x, y, z)指定一个矢量,表示旋转轴,正角度为顺时针转动,负角度为逆时针转动,默认值为0,同时可以通过centerX和centerY设置旋转的中心点。
默认值:
{
x: 0,
y: 0,
z: 0,
angle: 0,
centerX: '50%',
centerY: '50%'
}
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| translate | {
x?: number \| string,
y?: number \| string,
z? : number \| string
} | 可以分别设置X轴、Y轴、Z轴的平移距离,距离的正负控制平移的方向。不支持百分比形式的输入。
默认值:
{
x: 0,
y: 0,
z: 0
}
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| scale | {
x?: number,
y?: number,
z?: number,
centerX?: number \| string,
centerY?: number \| string
} | 可以分别设置X轴、Y轴、Z轴的缩放比例,默认值为1,同时可以通过centerX和centerY设置缩放的中心点。
默认值:
{
x: 1,
y: 1,
z: 1,
centerX:'50%',
centerY:'50%'
}
从API version 9开始,该接口支持在ArkTS卡片中使用。 | | transform | [Matrix4Transit](../apis/js-apis-matrix4.md) | 设置当前组件的变换矩阵。 | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-visibility.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-visibility.md index acb3efd2c503f4f5cc370d2e53c651103b38add4..972a0141578dc2e8863fb1453fb96570c0129ad3 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-visibility.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-visibility.md @@ -10,7 +10,7 @@ | 名称 | 参数类型 | 描述 | | ---------- | ---------------------------- | ------------------------------------------ | -| visibility | [Visibility](ts-appendix-enums.md#visibility) | 控制当前组件显示或隐藏。注意,即使组件处于隐藏状态,在页面刷新时仍存在重新创建过程,因此当对性能有严格要求时建议使用[条件渲染](../../quick-start/arkts-rendering-control.md#条件渲染)代替。
默认值:Visibility.Visible| +| visibility | [Visibility](ts-appendix-enums.md#visibility) | 控制当前组件显示或隐藏。注意,即使组件处于隐藏状态,在页面刷新时仍存在重新创建过程,因此当对性能有严格要求时建议使用[条件渲染](../../quick-start/arkts-rendering-control.md#条件渲染)代替。
默认值:Visibility.Visible
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-z-order.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-z-order.md index 60f6b667a8060ce86195496e469633dcf958602d..672db61316eb41f45aacc885faa821b8db9996f7 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-z-order.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-z-order.md @@ -12,7 +12,7 @@ | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | -| zIndex | number | 同一容器中兄弟组件显示层级关系。zIndex值越大,显示层级越高,即zIndex值大的组件会覆盖在zIndex值小的组件上方。 | +| zIndex | number | 同一容器中兄弟组件显示层级关系。zIndex值越大,显示层级越高,即zIndex值大的组件会覆盖在zIndex值小的组件上方。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-events-click.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-events-click.md index 33f2d964f4432eecd591abb1d4d0992328f2b0ff..2e84bd5c8327546e79e4c4f3150931f3e2c8d857 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-events-click.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-events-click.md @@ -11,9 +11,12 @@ | 名称 | 支持冒泡 | 功能描述 | | ---------------------------------------- | ---- | --------------------------------- | -| onClick(event: (event?: ClickEvent) => void) | 否 | 点击动作触发该回调,event返回值见ClickEvent对象说明。 | +| onClick(event: (event?: ClickEvent) => void) | 否 | 点击动作触发该回调,event返回值见ClickEvent对象说明。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## ClickEvent对象说明 + +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 类型 | 描述 | | ------------------- | ------------------------------------ | -------------------------------------------------------- | | screenX | number | 点击位置相对于应用窗口左上角的X坐标。 | @@ -26,6 +29,8 @@ ## EventTarget8+对象说明 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 参数类型 | 描述 | | ---- | ------------------------- | ---------- | | area | [Area](ts-types.md#area8) | 目标元素的区域信息。 | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-events-show-hide.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-events-show-hide.md index a84c69fc4393a1065f9678c1193406ebfaa1cc16..e0e2c14eb81d9a56f82e7f23b32b251eedae6493 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-events-show-hide.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-events-show-hide.md @@ -9,10 +9,10 @@ ## 事件 -| 名称 | 支持冒泡 | 功能描述 | -| ------------------------------------------------ | -------- | -------------------------- | -| onAppear(event: () => void) | 否 | 组件挂载显示时触发此回调。 | -| onDisAppear(event: () => void) | 否 | 组件卸载消失时触发此回调。 | +| 名称 | 支持冒泡 | 功能描述 | +| ------------------------------------------------ | -------- | ------------------------------------------------------------ | +| onAppear(event: () => void) | 否 | 组件挂载显示时触发此回调。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| onDisAppear(event: () => void) | 否 | 组件卸载消失时触发此回调。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/errorcodes/Readme-CN.md b/zh-cn/application-dev/reference/errorcodes/Readme-CN.md index e8915790ce2cc9861ab900637ad7a45ef65563f1..a0dc6f7a964e5438bbca61bb26a0055f962e780d 100644 --- a/zh-cn/application-dev/reference/errorcodes/Readme-CN.md +++ b/zh-cn/application-dev/reference/errorcodes/Readme-CN.md @@ -27,8 +27,9 @@ - 资源管理 - [I18n错误码](errorcode-i18n.md) - [资源管理错误码](errorcode-resource-manager.md) -- 资源调度 +- 后台任务 - [backgroundTaskManager错误码](errorcode-backgroundTaskMgr.md) + - [DeviceUsageStatistics错误码](errorcode-DeviceUsageStatistics.md) - [reminderAgentManager错误码](errorcode-reminderAgentManager.md) - [workScheduler错误码](errorcode-workScheduler.md) - 安全 @@ -49,6 +50,12 @@ - [电话子系统错误码](errorcode-telephony.md) - 网络管理 - [上传下载错误码](errorcode-request.md) + - [HTTP错误码](errorcode-net-http.md) + - [Socket错误码](errorcode-net-socket.md) + - [网络连接管理错误码](errorcode-net-connection.md) + - [以太网连接错误码](errorcode-net-ethernet.md) + - [网络共享错误码](errorcode-net-sharing.md) + - [策略管理错误码](errorcode-net-policy.md) - 通信与连接 - [NFC错误码](errorcode-nfc.md) - [RPC错误码](errorcode-rpc.md) @@ -78,7 +85,6 @@ - [系统参数错误码](errorcode-system-parameterV9.md) - [USB服务错误码](errorcode-usb.md) - [升级错误码](errorcode-update.md) - - [DeviceUsageStatistics错误码](errorcode-DeviceUsageStatistics.md) - 定制管理 - [企业设备管理错误码](errorcode-enterpriseDeviceManager.md) - 语言基础类库 diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-faultlogger.md b/zh-cn/application-dev/reference/errorcodes/errorcode-faultlogger.md index 3ed4da85c694859065392150c442d49fa7dcab10..52d7ea0e205dd965a373e404a3beac3669524f78 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-faultlogger.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-faultlogger.md @@ -4,11 +4,11 @@ **错误信息** -The service is not running or broken. +The service is not started or is faulty. **错误描述** -服务未启动/故障。 +服务未启动或者遇到未知错误。 **可能原因** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-form.md b/zh-cn/application-dev/reference/errorcodes/errorcode-form.md index 93dfb3c6d91ed044720e9d74d455dc619df116a6..e5e05c3d76aeb97993dec9a9f89f3d40880946fb 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-form.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-form.md @@ -154,3 +154,21 @@ The ability is not installed. **处理步骤** 检查传入的abilityName与bundleName是否有效。 + +## 16501005 连接卡片渲染服务失败 + +**错误信息** + +Connect FormRenderService failed, please try again later. + +**错误描述** + +连接卡片渲染服务失败时,系统会报此错误码。 + +**可能原因** + +服务繁忙。 + +**处理步骤** + +服务繁忙,请稍后重试。 diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-net-connection.md b/zh-cn/application-dev/reference/errorcodes/errorcode-net-connection.md new file mode 100644 index 0000000000000000000000000000000000000000..8efa8caab26a5d2a92070dc4b2b8bb80d8ff9cba --- /dev/null +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-net-connection.md @@ -0,0 +1,114 @@ +# 网络连接管理错误码 + +## 2100001 非法参数值 + +**错误信息** + +Invalid parameter value. + +**错误描述** + +非法参数值。 + +**可能原因** + +输入参数取值范围错误。 + +**处理步骤** + +检查输入参数的取值范围是否正确。 + +## 2100002 连接服务失败 + +**错误信息** + +Operation failed. Cannot connect to service. + +**错误描述** + +操作失败,连接系统服务发生异常。 + +**可能原因** + +服务发生异常。 + +**处理步骤** + +检查系统服务运行状态是否正常。 + +## 2100003 系统内部错误 + +**错误信息** + +System internal error. + +**错误描述** + +系统内部错误。 + +**可能原因** + +1.内存异常。 + +2.空指针。 + +**处理步骤** + +1.检查内存空间是否充足,清理内存后重试。 + +2.系统异常,请稍后重试或重启设备。 + +## 2101007 已存在相同的callback + +**错误信息** + +The same callback exists. + +**错误描述** + +已经注册的callback。 + +**可能原因** + +激活&监听指定属性网络并注册回调时,callback对象重复注册。 + +**处理步骤** + +1.确保待注册的callback对象未进行过注册 +2.若callback对象已进行过注册,执行已存在的注册。 + +## 2101008 callback不存在 + +**错误信息** + +The callback is not exists. + +**错误描述** + +不存在的callback对象。 + +**可能原因** + +未执行激活&监听指定属性网络请求并注册回调。 + +**处理步骤** + +检查callback对象,确保注销callback对象前,已执行注册函数。 + +## 2101022 请求数量超过最大值 + +**错误信息** + +The number of requests exceeded the maximum. + +**错误描述** + +网络请求数超过了最大值。 + +**可能原因** + +激活&监听指定属性网络请求数超过了最大值。 + +**处理步骤** + +建议通过日志信息“Over the max request number”定位问题。 diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-net-ethernet.md b/zh-cn/application-dev/reference/errorcodes/errorcode-net-ethernet.md new file mode 100644 index 0000000000000000000000000000000000000000..0bd04da347c74152c39ecc63197cf8159187047c --- /dev/null +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-net-ethernet.md @@ -0,0 +1,116 @@ +# 以太网错误码 + +## 2200001 非法参数值 + +**错误信息** + +Invalid parameter value. + +**错误描述** + +非法参数值。 + +**可能原因** + +输入参数取值范围错误。 + +**处理步骤** + +检查输入参数的取值范围是否正确。 + +## 2200002 连接服务失败 + +**错误信息** + +Operation failed. Cannot connect to service. + +**错误描述** + +操作失败,连接系统服务发生异常。 + +**可能原因** + +服务发生异常。 + +**处理步骤** + +检查系统服务运行状态是否正常。 + +## 2200003 系统内部错误 + +**错误信息** + +System internal error. + +**错误描述** + +系统内部错误。 + +**可能原因** + +1.内存异常。 + +2.空指针。 + +**处理步骤** + +1.检查内存空间是否充足,清理内存后重试。 + +2.系统异常,请稍后重试或重启设备。 + +## 2201005 设备信息不存在 + +**错误信息** + +The device information does not exist. + +**错误描述** + +设备信息不存在。 + +**可能原因** + +设置的设备或者获取的设备不存在。 + +**处理步骤** + + ```bash + > hdc shell ifconfig + ``` + 查看是否有对应的设备,比如eth0,eth1。 + +## 2201006 设备未连接 + +**错误信息** + +Device disconnected. + +**错误描述** + +设备未连接。 + +**可能原因** + +硬件网卡问题。 + +**处理步骤** + +需要查看以太网服务和底层netsys的log,查看kernel是否有上报连接状态。 + +## 2201007 用户配置写入失败 + +**错误信息** + +Failed to write the user configuration. + +**错误描述** + +写入配置文件信息失败。 + +**可能原因** + +系统报错。 + +**处理步骤** + +系统内部错误,出现的情况不明确,建议通过日志定位问题。 diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-net-http.md b/zh-cn/application-dev/reference/errorcodes/errorcode-net-http.md new file mode 100644 index 0000000000000000000000000000000000000000..c2887a453123dbc3d44cb3f91f26b08a7a20d9a9 --- /dev/null +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-net-http.md @@ -0,0 +1,527 @@ +# HTTP错误码 + +## 2300001 不支持的协议 + +**错误信息** + +Unsupported protocol. + +**错误描述** + +协议版本服务器不支持。 + +**可能原因** + +传入的协议版本,服务器不支持。 + +**处理步骤** + +请检查传入的协议版本是否合理,排查服务器实现。 + +## 2300003 URL格式错误 + +**错误信息** + +URL using bad/illegal format or missing URL. + +**错误描述** + +URL格式错误。 + +**可能原因** + +可能传入的url格式不正确。 + +**处理步骤** + +检查传入的url格式是否正确。 + +## 2300005 代理服务器域名解析失败 + +**错误信息** + +Couldn't resolve proxy name. + +**错误描述** + +代理服务器的域名无法解析。 + +**可能原因** + +服务器的URL不正确 + +**处理步骤** + +排查代理服务器的URL是否正确。 + +## 2300006 域名解析失败 + +**错误信息** + +Couldn't resolve host name. + +**错误描述** + +服务器的域名无法解析。 + +**可能原因** + +1.传入的服务器的URL不正确。 + +2.网络不通畅。 + +**处理步骤** + +1.请检查输入的服务器的URL是否合理。 + +2.请检查网络连接情况 + +## 2300007 无法连接到服务器 + +**错误信息** + +Couldn't connect to server. + +**错误描述** + +服务器无法连接。 + +**可能原因** + +可能传入的url格式不正确。 + +**处理步骤** + +检查传入的url格式是否正确。 + +## 2300008 服务器返回非法数据 + +**错误信息** + +Weird server reply. + +**错误描述** + +服务器返回非法数据。 + +**可能原因** + +服务器出错,返回了非HTTP格式的数据。 + +**处理步骤** + +排查服务器实现。 + +## 2300009 拒绝对远程资源的访问 + +**错误信息** + +Access denied to remote resource. + +**错误描述** + +拒绝对远程资源的访问。 + +**可能原因** + +指定的内容被服务器拒绝访问。 + +**处理步骤** + +排查请求内容。 + +## 2300016 HTT2帧层错误 + +**错误信息** + +Error in the HTTP2 framing layer. + +**错误描述** + +HTTP2层级的错误。 + +**可能原因** + +服务器不支持HTTP2。 + +**处理步骤** + +抓包分析、排查服务器是否支持HTTP2。 + +## 2300018 服务器返回数据不完整 + +**错误信息** + +Transferred a partial file. + +**错误描述** + +服务器返回的数据不完整。 + +**可能原因** + +可能与服务器实现有关 + +**处理步骤** + +排查服务器实现。 + +## 2300023 向磁盘/应用程序写入接收数据失败 + +**错误信息** + +Failed writing received data to disk/application. + +**错误描述** + +向磁盘/应用程序写入接收数据失败。 + +**可能原因** + +应用没有写文件权限。 + +**处理步骤** + +排查应用权限。 + +## 2300025 上传失败 + +**错误信息** + +Upload failed. + +**错误描述** + +上传失败。 + +**可能原因** + +文件过大或者网络问题。对于FTP,服务器通常会拒绝STOR命令。错误缓冲区通常包含服务器的解释。 + +**处理步骤** + +排查文件大小及网络状况。 + +## 2300026 从文件/应用程序中打开/读取本地数据失败 + +**错误信息** + +Failed to open/read local data from file/application. + +**错误描述** + +从文件/应用程序中打开/读取本地数据失败。 + +**可能原因** + +应用没有读文件权限 + +**处理步骤** + +排查应用权限。 + +## 2300027 内存不足 + +**错误信息** + +Out of memory. + +**错误描述** + +内存不足。 + +**可能原因** + +内存不足。 + +**处理步骤** + +排查系统内存。 + +## 2300028 操作超时 + +**错误信息** + +Timeout was reached. + +**错误描述** + +操作超时。 + +**可能原因** + +TCP连接超时或读写超时。 + +**处理步骤** + +排查网络问题。 + +## 2300047 重定向次数达到最大值 + +**错误信息** + +Number of redirects hit maximum amount. + +**错误描述** + +重定向次数达到最大值。 + +**可能原因** + +重定向次数过多 + +**处理步骤** + +排查服务器实现。 + +## 2300052 服务器没有返回内容 + +**错误信息** + +Server returned nothing (no headers, no data). + +**错误描述** + +服务器没有返回内容。 + +**可能原因** + +可能与服务器实现有关。 + +**处理步骤** + +排查服务器实现。 + +## 2300055 发送网络数据失败 + +**错误信息** + +Failed sending data to the peer. + +**错误描述** + +无法往对端发送数据,发送网络数据失败。 + +**可能原因** + +网络问题。 + +**处理步骤** + +排查网络。 + +## 2300056 接收网络数据失败 + +**错误信息** + +Failure when receiving data from the peer. + +**错误描述** + +无法往从对端收到数据,接收网络数据失败。 + +**可能原因** + +网络问题 + +**处理步骤** + +排查网络问题。 + +## 2300058 本地SSL证书错误 + +**错误信息** + +Problem with the local SSL certificate. + +**错误描述** + +本地SSL证书错误。 + +**可能原因** + +SSL证书格式有错误。 + +**处理步骤** + +检查SSL证书格式。 + +## 2300059 无法使用指定的密码 + +**错误信息** + +Couldn't use specified SSL cipher. + +**错误描述** + +无法使用指定的密码。 + +**可能原因** + +client和sever协商的加密算法系统不支持。 + +**处理步骤** + +抓包分析协商的算法。 + +## 2300060 远程服务器SSL证书或SSH秘钥不正确 + +**错误信息** + +SSL peer certificate or SSH remote key was not OK. + +**错误描述** + +远程服务器SSL证书或SSH秘钥不正确。 + +**可能原因** + +无法校验服务器身份,有可能是证书过期了 + +**处理步骤** + +检查证书有效性。 + +## 2300061 无法识别或错误的HTTP编码格式 + +**错误信息** + +Unrecognized or bad HTTP Content or Transfer-Encoding. + +**错误描述** + +无法识别或错误的HTTP编码格式。 + +**可能原因** + +HTTP编码格式不正确。 + +**处理步骤** + +排查服务器实现,目前仅支持gzip编码。 + +## 2300063 超出最大文件大小 + +**错误信息** + +Maximum file size exceeded. + +**错误描述** + +超出最大文件大小。 + +**可能原因** + +下载的文件过大。 + +**处理步骤** + +排查服务器实现。 + +## 2300070 服务器磁盘空间不足 + +**错误信息** + +Remote disk full or allocation exceeded. + +**错误描述** + +服务器磁盘空间不足。 + +**可能原因** + +服务器磁盘已满 + +**处理步骤** + +检查服务器磁盘空间。 + +## 2300073 服务器返回文件已存在 + +**错误信息** + +Remote file already exists. + +**错误描述** + +服务器返回文件已存在。 + +**可能原因** + +上传文件的时候,服务器返回文件已经存在。 + +**处理步骤** + +排查服务器。 + +## 2300077 SSL CA证书不存在或没有访问权限 + +**错误信息** + +Problem with the SSL CA cert (path? access rights?). + +**错误描述** + +SSL CA证书不存在或没有访问权限。 + +**可能原因** + +证书不存在或者没有访问权限。 + +**处理步骤** + +检查证书是否存在或者有没有访问权限。 + +## 2300078 URL请求的文件不存在 + +**错误信息** + +Remote file not found. + +**错误描述** + +URL请求的文件不存在。 + +**可能原因** + +URL请求的文件不存在 + +**处理步骤** + +检查URL请求的文件是否存在。 + +## 2300094 身份校验失败 + +**错误信息** + +An authentication function returned an error. + +**错误描述** + +身份校验失败。 + +**可能原因** + +传入的校验身份的字段与服务器不匹配。 + +**处理步骤** + +排查传入的校验身份的字段是否与服务器匹配。 + +## 2300999 未知错误 + +**错误信息** + +Unknown Other Error. + +**错误描述** + +未知错误。 + +**可能原因** + +未知错误。 + +**处理步骤** + +未知错误。 diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-net-policy.md b/zh-cn/application-dev/reference/errorcodes/errorcode-net-policy.md new file mode 100644 index 0000000000000000000000000000000000000000..6cf42c304a61a292efada5142db87cf96902dc9f --- /dev/null +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-net-policy.md @@ -0,0 +1,59 @@ +# 策略管理错误码 + +## 2100001 非法参数值 + +**错误信息** + +Invalid parameter value. + +**错误描述** + +非法参数值 + +**可能原因** + +输入参数取值范围错误。 + +**处理步骤** + +检查输入参数的取值范围是否正确。 + +## 2100002 连接服务失败 + +**错误信息** + +Operation failed. Cannot connect to service. + +**错误描述** + +操作失败,连接系统服务发生异常。 + +**可能原因** + +服务发生异常。 + +**处理步骤** + +检查系统服务运行状态是否正常。 + +## 2100003 系统内部错误 + +**错误信息** + +System internal error. + +**错误描述** + +系统内部错误。 + +**可能原因** + +1.内存异常。 + +2.空指针。 + +**处理步骤** + +1.检查内存空间是否充足,清理内存后重试。 + +2.系统异常,请稍后重试或重启设备。 diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-net-sharing.md b/zh-cn/application-dev/reference/errorcodes/errorcode-net-sharing.md new file mode 100644 index 0000000000000000000000000000000000000000..cf5c08cdfb538ad38c712df3d9e22bb9a7f93d10 --- /dev/null +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-net-sharing.md @@ -0,0 +1,159 @@ +# 网络共享错误码 + +## 2200001 非法参数值 + +**错误信息** + +Invalid parameter value. + +**错误描述** + +非法参数值。 + +**可能原因** + +输入参数取值范围错误。 + +**处理步骤** + +检查输入参数的取值范围是否正确。 + +## 2200002 连接服务失败 + +**错误信息** + +Operation failed. Cannot connect to service. + +**错误描述** + +操作失败,连接系统服务发生异常。 + +**可能原因** + +服务发生异常。 + +**处理步骤** + +检查系统服务运行状态是否正常。 + +## 2200003 系统内部错误 + +**错误信息** + +System internal error. + +**错误描述** + +系统内部错误。 + +**可能原因** + +1.内存异常。 + +2.空指针。 + +**处理步骤** + +1.检查内存空间是否充足,清理内存后重试。 + +2.系统异常,请稍后重试或重启设备。 + +## 2202004 共享的Iface不可用 + +**错误信息** + +Try to share an unavailable iface. + +**错误描述** + +使用了不可用的网卡。 + +**可能原因** + +使用的网卡不存在,或网卡名错误。 + +**处理步骤** + +1.通过指令查看共享的网卡是否被创建。 + + ```bash + > ifconfig -a + ``` + +2.检查网卡名是否拼写错误。 + +## 2202005 WiFi共享失败 + +**错误信息** + +WiFi sharing failed. + +**错误描述** + +开启WiFi共享失败。 + +**可能原因** + +没有连接网络,获取默认网络失败。 + +**处理步骤** + +检查网络的连接是否正常。 + +## 2202006 蓝牙共享失败 + +**错误信息** + +Bluetooth sharing failed. + +**错误描述** + +开启蓝牙共享失败。 + +**可能原因** + +1.未开启蓝牙。 + +2.没有连接网络,获取默认网络失败。 + +**处理步骤** + +1.点击蓝牙图标,开启蓝牙模式。 + +2.检查网络的连接是否正常。 + +## 2202009 网络共享开启转发错误 + +**错误信息** + +Network share enable forwarding error. + +**错误描述** + +网络共享开启转发错误。 + +**可能原因** + +设置Iptables的规则失败,命令的拼接出错。 + +**处理步骤** + +开启debug日志,检查Ip tables的命令是否拼接出现问题。 + +## 2202011 无法获取网络共享配置 + +**错误信息** + +Cannot get network sharing configuration. + +**错误描述** + +无法获取网络共享的配置。 + +**可能原因** + +打开网络共享配置文件失败,文件路径出错。 + +**处理步骤** + +检查配置文件目录。 diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-net-socket.md b/zh-cn/application-dev/reference/errorcodes/errorcode-net-socket.md new file mode 100644 index 0000000000000000000000000000000000000000..8598c9695b98e26c3fdb50f94a6b71cf16cd2d95 --- /dev/null +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-net-socket.md @@ -0,0 +1,351 @@ +# Socket 错误码 + +## 2301001 操作不允许 + +**错误信息** + +Operation not permitted. + +**错误描述** + +操作不允许。 + +**可能原因** + +非法操作。 + +**处理步骤** + +检查操作步骤。 + +## 2301002 文件不存在 + +**错误信息** + +No such file or directory. + +**错误描述** + +文件不存在。 + +**可能原因** + +文件不存在。 + +**处理步骤** + +检查文件名或文件路径。 + +## 2301003 进程不存在 + +**错误信息** + +No such process. + +**错误描述** + +进程不存在。 + +**可能原因** + +进程不存在 + +**处理步骤** + +排查进程信息。 + +## 2301004 系统调用中断 + +**错误信息** + +Interrupted system call. + +**错误描述** + +系统调用中断。 + +**可能原因** + +系统调用中断。 + +**处理步骤** + +排查系统调用。 + +**TCP/UDP 错误码说明:** +> TCP/UDP Socket其余错误码映射形式为:2301000 + Linux系统内核错误码errno,关键信息请参考Linux系统内核错误码。 + +## 2300002 系统内部错误 + +**错误信息** + +System internal error. + +**错误描述** + +系统内部错误。 + +**可能原因** + +1.内存异常。 + +2.空指针。 + +**处理步骤** + +1.检查内存空间是否充足,清理内存后重试。 + +2.系统异常,请稍后重试或重启设备。 + +## 2303104 中断系统调用 + +**错误信息** + +Interrupted system call. + +**错误描述** + +中断系统调用。 + +**可能原因** + +调有connect时,可能会导致阻塞时间过长,所以系统产生中断信号,返回EINTR错误。 + +**处理步骤** + +尝试重新走网络连接流程。 + +## 2303109 错误文件编号 + +**错误信息** + +Bad file number. + +**错误描述** + +在本地关闭的套接字上进行操作将返回该错误。 + +**可能原因** + +socket fd可能被关闭了,所以发生参数无效的错误。 + +**处理步骤** + +检查socket是否被意外关闭。 + +## 2303111 资源暂时不可用,请重试 + +**错误信息** + +Resource temporarily unavailable try again. + +**错误描述** + +系统资源暂时不可用,尝试再次调用。 + +**可能原因** + +系统资源繁忙。 + +**处理步骤** + +重新调用接口。 + +## 2303188 非套接字的套接字操作 + +**错误信息** + +Socket operation on non-socket. + +**错误描述** + +参数socket未指定一个套接字描述符。 + +**可能原因** + +参数不是套接字类型的描述符。 + +**处理步骤** + +检查代码描述符的获取是否正确。 + +## 2303191 socket协议类型错误 + +**错误信息** + +Protocol wrong type for socket. + +**错误描述** + +参数设置的协议类型错误。 + +**可能原因** + +标识了协议的Socket函数在不支持的socket上进行操作。 +如Internet UDP协议不能被标识为SOCK_STREAM socket类型。 + +**处理步骤** + +检查参数设置是否符合协议类型。 + +## 2303198 网络地址已被使用 + +**错误信息** + +Address already in use. + +**错误描述** + +地址已被使用。 + +**可能原因** + +如果应用程序试图将套接字绑定到已用于现有套接字的IP地址/端口,或未正确关闭的套接字,或仍在关闭过程中的套接字,则会发生此错误。 + +**处理步骤** + +尝试其他地址。 + +## 2303199 不能分配请求的地址 + +**错误信息** + +Cannot assign requested address. + +**错误描述** + +请求的地址在其上下文中无效。 + +**可能原因** + +当远程地址或端口对远程计算机无效时,可能发生该问题。 + +**处理步骤** + +检查地址或端口是否正确。 + +## 2303210 连接超时 + +**错误信息** + +Connection timed out. + +**错误描述** + +长时间不能和远程服务器建立连接。 + +**可能原因** + +这种情况一般发生在服务器主机崩溃。 + +**处理步骤** + +本地处理不了,需要确认远程服务器是否发生问题。 + +## 2303501 SSL为空 + +**错误信息** + +SSL is null. + +**错误描述** + +参数错误。 + +**可能原因** + +当内部发生函数执行失败时,会获取错误信息,当获取信息为null时,发生该错误。 + +**处理步骤** + +尝试重新执行一遍流程。 + +## 2303502 tls读取错误 + +**错误信息** + +Error in tls reading. + +**错误描述** + +等待套接字可读。 + +**可能原因** + +底层socket阻塞。 + +**处理步骤** + +重新执行接收数据的操作。 + +## 2303503 tls写入错误 + +**错误信息** + +Error in tls writing. + +**错误描述** + +等待套接字可写。 + +**可能原因** + +发送端缓冲区已满时,底层套接字发送将给出EWOUDLBLOCK错误,这意味着服务器没有读取从客户端发送的消息。 + +**处理步骤** + +需要检查服务器并修复它。 + +## 2303504 查找x509时出错 + +**错误信息** + +Error looking up x509. + +**错误描述** + +认证x509证书发生错误,操作未完成。 + +**可能原因** + +本地证书和服务器证书不匹配。 + +**处理步骤** + +检查本地CA跟证书和服务器证书是否匹配。 + +## 2303505 tls系统调用错误 + +**错误信息** + +Error occurred in the tls system call. + +**错误描述** + +发生了一些不可恢复的致命I/O错误。 + +**可能原因** + +网络问题,导致通信失败。 + +**处理步骤** + +请参阅Linux系统内核错误码errno以了解详细信息。 + +## 2303506 清除tls连接出错 + +**错误信息** + +Error clearing tls connection. + +**错误描述** + +TLS/SSL连接已关闭。 + +**可能原因** + +协议中出现关闭警报时,即连接已完全关闭时,才会返回此结果代码。 + +**处理步骤** + +尝试重新发起连接。 \ No newline at end of file diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-nfc.md b/zh-cn/application-dev/reference/errorcodes/errorcode-nfc.md index d6763eebdda0b57f0090abfd2da966f7d31dc40e..9c73fdd1a51dc669768f88c0488d5d92d60f3ac3 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-nfc.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-nfc.md @@ -4,7 +4,7 @@ **错误信息** -NFC opening or closing state is abnormal in service. +NFC state is abnormal in service. **错误描述** @@ -12,11 +12,13 @@ NFC服务内部执行NFC打开或关闭异常。 **可能原因** -和NFC服务建立通信异常。 +1. 和NFC服务建立通信异常。 +2. NFC芯片通信异常。 **处理步骤** -重新执行打开或关闭NFC。 +1. 重新执行打开或关闭NFC。 +2. 重新执行打开或关闭NFC,或重启设备尝试。 ## 3100201 diff --git a/zh-cn/application-dev/reference/syscap-list.md b/zh-cn/application-dev/reference/syscap-list.md index e804c0fe96aee8e94f5987424630bc24d6eda966..33f6ac5f09f4578a8d9b6414b4047854e23303d4 100644 --- a/zh-cn/application-dev/reference/syscap-list.md +++ b/zh-cn/application-dev/reference/syscap-list.md @@ -1394,3 +1394,267 @@ VAID管理服务 | Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | | ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | | 是 | 是 | 是 | 是 | 是 | 是 | 是 | 是 | + +## SystemCapability.Security.CertificateManager + +证书管理 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 否 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.Security.CryptoFramework + +加解密算法库框架-加解密基础能力 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 否 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.BundleManager.BundleFramework.Core + +包管理核心业务,包含包信息查询、安装卸载的核心能力 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 是 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.BundleManager.BundleFramework.FreeInstall + +包管理提供的免安装特性 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 是 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.BundleManager.BundleFramework.Resource + +包管理提供的获取图标和label的特性 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 是 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.BundleManager.BundleFramework.DefaultApp + +包管理提供的默认应用管理特性 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 是 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.BundleManager.BundleFramework.Launcher + +包管理提供给Launcher的查询特性 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 是 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.BundleManager.BundleFramework.SandboxApp + +包管理提供的沙箱应用的特性 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 是 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.BundleManager.BundleFramework.QuickFix + +包管理提供的快速修复的特性 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 是 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.BundleManager.BundleFramework.AppControl + +包管理提供的拦截特性 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 是 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.Graphic.Graphic2D.ColorManager.Core + +富设备广色域管理 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 否 | 是 | 否 | 是 | 否 | 否 | + +## SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply + +能效资源申请接口 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 是 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.Multimedia.Media.AVPlayer + +媒体音视频播放引擎能力 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 是 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.Multimedia.Media.AVRecorder + +媒体音视频录制引擎能力 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 是 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.Security.Cert + +加解密算法库框架-证书能力 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 否 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.Security.DataLossPrevention + +数据防泄漏 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 否 | 是 | 否 | 否 | 否 | 否 | + +## SystemCapability.Communication.NFC.Tag + +NFC标签服务 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 否 | 否 | 否 | 否 | 否 | 否 | 否 | 否 | + +## SystemCapability.Communication.NFC.CardEmulation + +NFC卡模拟服务 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 否 | 否 | 否 | 否 | 否 | 否 | 否 | 否 | + +## SystemCapability.Multimedia.Image.ImageCreator + +图像创建能力 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 是 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.Developtools.Syscap + +系统能力编解码 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 是 | 是 | 是 | 是 | 是 | 是 | 否 | + +## SystemCapability.Communication.NetManager.Ethernet + +以太网连接 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 否 | 否 | 否 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.Communication.NetManager.NetSharing + +网络共享 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 否 | 是 | 否 | 是 | 否 | 否 | + +## SystemCapability.Communication.NetManager.MDNS + +mDNS服务 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 是 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.Communication.NetManager.Vpn + +VPN + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 否 | 是 | 否 | 是 | 否 | 否 | + +## SystemCapability.XTS.DeviceAttest + +设备证明 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 是 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.XTS.DeviceAttestLite + +轻量设备证明 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 否 | 是 | 否 | 否 | 否 | 否 | 是 | 是 | + +## SystemCapability.FileManagement.UserFileManager.Core + +公共用户文件管理基础能力 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 是 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.FileManagement.UserFileManager.DistributedCore + +公共用户文件管理分布式能力 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 是 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.DistributedDataManager.UDMF.Core + +分布式数据管理--统一数据管理框架(UDMF)核心能力 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 否 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.BundleManager.BundleFramework.Overlay + +包管理overlay特性 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 是 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.Cloud.Push + +推送管理服务 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 是 | 是 | 是 | 是 | 是 | 否 | + +## SystemCapability.Multimedia.SystemSound.Core + +系统声音管理,如铃声,通知,闹钟等 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 是 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.Ability.AbilityRuntime.QuickFix + +快速修复 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 是 | 是 | 是 | 是 | 否 | 否 | \ No newline at end of file diff --git a/zh-cn/application-dev/security/accesstoken-guidelines.md b/zh-cn/application-dev/security/accesstoken-guidelines.md index 2da879dbf3b6ca9881ba15f4402925b8ee2e2887..f2ac38c6167371871dfef3e413ddcc7ac0d911ec 100644 --- a/zh-cn/application-dev/security/accesstoken-guidelines.md +++ b/zh-cn/application-dev/security/accesstoken-guidelines.md @@ -1,71 +1,49 @@ -# 访问控制授权申请指导 +# 访问控制授权申请 ## 场景介绍 -以下示例代码基于此场景假设:应用因为应用核心功能诉求,需要申请权限"ohos.permission.PERMISSION1"和权限"ohos.permission.PERMISSION2"。 +[应用的APL(Ability Privilege Level)等级](accesstoken-overview.md#应用apl等级说明)分为`normal`、`system_basic`和`system_core`三个等级,默认情况下,应用的APL等级都为`normal`等级。[权限类型](accesstoken-overview.md#权限类型说明)分为`system_grant`和`user_grant`两种类型。应用可申请的权限项参见[应用权限列表](permission-list.md)。 -- 应用的APL等级为normal。 -- 权限"ohos.permission.PERMISSION1"的权限等级为normal,权限类型为system_grant。 -- 权限"ohos.permission.PERMISSION2"的权限等级为system_basic, 权限类型为user_grant。 +本文将从如下场景分别介绍: -> **注意:** -> -> 当前场景下,应用申请的权限包括了user_grant权限,对这部分user_grant权限,可以先通过权限校验,判断当前调用者是否具备相应权限。 -> -> 当权限校验结果显示当前应用尚未被授权该权限时,再通过动态弹框授权方式给用户提供手动授权入口。 +- [配置文件权限声明](#配置文件权限声明) +- [ACL方式声明](#acl方式声明) +- [向用户申请授权](#向用户申请授权) +- [user_grant权限预授权](#user_grant权限预授权) -应用可申请的权限,可查询[应用权限列表](permission-list.md) +## 配置文件权限声明 -## 接口说明 +应用需要在工程配置文件中,对需要的权限逐个声明,未在配置文件中声明的权限,应用将无法获得授权。OpenHarmony提供了两种应用模型,分别为FA模型和Stage模型,更多信息可以参考[应用模型解读](../application-models/application-model-description.md)。不同的应用模型的应用包结构不同,所使用的配置文件不同。 -以下仅列举本指导使用的接口,不同模型下使用的拉起权限弹窗的接口有差异,更多说明可以查阅[完整示例](##完整示例)。 +> **说明**: +> +> 应用默认的APL等级为`normal`,当应用需要申请`system_basic`和`system_core`等级时,除了在配置文件中进行权限声明之外,还需要通过[ACL方式](#acl方式声明)进行声明使用。 -### FA模型 -| 接口名 | 描述 | -| ------------------------------------------------------------ | --------------------------------------------------- | -| requestPermissionsFromUser(permissions: Array\, requestCode: number, resultCallback: AsyncCallback\): void | 拉起弹窗请求用户授权。 | -> 详细可查阅[API参考](../reference/apis/js-apis-inner-app-context.md) +配置文件标签说明如下表所示。 +| 标签 | 是否必填 | 说明 | +| --------- | -------- | ------------------------------------------------------------ | +| name | 是 | 权限名称。 | +| reason | 否 | 描述申请权限的原因。
> **说明**:当申请的权限为user_grant权限时,此字段必填。 | +| usedScene | 否 | 描述权限使用的场景和时机。
> **说明**:当申请的权限为user_grant权限时,此字段必填。 | +| abilities | 否 | 标识需要使用到该权限的Ability,标签为数组形式。
**适用模型**:Stage模型 | +| ability | 否 | 标识需要使用到该权限的Ability,标签为数组形式。
**适用模型**:FA模型 | +| when | 否 | 标识权限使用的时机,值为`inuse/always`。
- inuse:表示为仅允许前台使用。
- always:表示前后台都可使用。 | ### Stage模型 -| 接口名 | 描述 | -| ------------------------------------------------------------ | --------------------------------------------------- | -| requestPermissionsFromUser(context: Context, permissions: Array<Permissions>, requestCallback: AsyncCallback<PermissionRequestResult>) : void; | 拉起弹窗请求用户授权。 | -> 详细可查阅[API参考](../reference/apis/js-apis-abilityAccessCtrl.md) - -## 权限申请声明 - -应用需要在工程配置文件中,对需要的权限逐个声明,没有在配置文件中声明的权限,应用将无法获得授权。OpenHarmony提供了两种应用模型,分别为FA模型和Stage模型,更多信息可以参考[应用模型解读](../application-models/application-model-description.md)。 - -不同的应用模型的应用包结构不同,所使用的配置文件不同,请开发者在申请权限时注意区分。 - -配置文件标签说明如下表。 - -| 标签 | 说明 | -| --------- | ------------------------------------------------------------ | -| name | 权限名称。 | -| reason | 当申请的权限为user_grant权限时,此字段必填,描述申请权限的原因。 | -| usedScene | 当申请的权限为user_grant权限时,此字段必填,描述权限使用的场景和时机。 | -| ability | 标识需要使用到该权限的Ability,标签为数组形式。
**适用模型:** FA模型 | -| abilities | 标识需要使用到该权限的Ability,标签为数组形式。
**适用模型:** Stage模型 | -| when | 标识权限使用的时机,值为"inuse/always",表示为仅允许前台使用和前后台都可使用。 | - -### FA模型 - -使用FA模型的应用,需要在config.json文件中声明权限。 - -**示例:** +使用Stage模型的应用,需要在[module.json5配置文件](../quick-start/module-configuration-file.md)中声明权限。 ```json { "module" : { - "reqPermissions":[ + // ... + "requestPermissions":[ { "name" : "ohos.permission.PERMISSION1", "reason": "$string:reason", "usedScene": { - "ability": [ + "abilities": [ "FormAbility" ], "when":"inuse" @@ -75,7 +53,7 @@ "name" : "ohos.permission.PERMISSION2", "reason": "$string:reason", "usedScene": { - "ability": [ + "abilities": [ "FormAbility" ], "when":"always" @@ -86,21 +64,20 @@ } ``` -### Stage模型 - -使用Stage模型的应用,需要在module.json5文件中声明权限。 +### FA模型 -**示例:** +使用FA模型的应用,需要在config.json配置文件中声明权限。 ```json { "module" : { - "requestPermissions":[ + // ... + "reqPermissions":[ { "name" : "ohos.permission.PERMISSION1", "reason": "$string:reason", "usedScene": { - "abilities": [ + "ability": [ "FormAbility" ], "when":"inuse" @@ -110,7 +87,7 @@ "name" : "ohos.permission.PERMISSION2", "reason": "$string:reason", "usedScene": { - "abilities": [ + "ability": [ "FormAbility" ], "when":"always" @@ -123,114 +100,239 @@ ## ACL方式声明 -如上述示例所示,权限"ohos.permission.PERMISSION2"的权限等级为system_basic,高于此时应用的APL等级,开发者的最佳做法是使用ACL方式。 - -在配置文件声明的基础上,应用还需要在Profile文件中声明不满足申请条件部分的权限。Profile文件的字段说明可参考[HarmonyAppProvision配置文件的说明](app-provision-structure.md)。 +应用在申请`system_basic`和`system_core`等级权限时,高于应用默认的`normal`等级。当应用需要申请权限项的等级高于应用默认的等级时,需要通过ACL方式进行声明使用。 -该场景中,开发者应该在字段"acls"中做声明如下: +例如应用在申请访问用户公共目录下音乐类型的文件,需要申请` ohos.permission.WRITE_AUDIO`权限,该权限为`system_basic`等级;以及应用在申请截取屏幕图像功能,该权限为`system_core`等级,需要申请` ohos.permission.CAPTURE_SCREEN`权限。此时需要将相关权限项配置到[HarmonyAppProvision配置文件](app-provision-structure.md)的`acl`字段中。 ```json { - "acls": { - "allowed-acls": [ - "ohos.permission.PERMISSION2" - ] - } + // ... + "acls":{ + "allowed-acls":[ + "ohos.permission.WRITE_AUDIO", + "ohos.permission.CAPTURE_SCREEN" + ] + } } ``` -## 申请授权user_grant权限 - -在前期的权限声明步骤后,在安装过程中系统会对system_grant类型的权限进行权限预授权,而user_grant类型权限则需要用户进行手动授权。 +## 向用户申请授权 -所以,应用在调用受"ohos.permission.PERMISSION2"权限保护的接口前,需要先校验应用是否已经获取该权限。 +当应用需要访问用户的隐私信息或使用系统能力时,例如获取位置信息、访问日历、使用相机拍摄照片或录制视频等,应该向用户请求授权。这需要使用 `user_grant` 类型权限。在此之前,应用需要进行权限校验,以判断当前调用者是否具备所需的权限。如果权限校验结果表明当前应用尚未被授权该权限,则应使用动态弹框授权方式,为用户提供手动授权的入口。示意效果如下图所示。 -如果校验结果显示,应用已经获取了该权限,那么应用可以直接访问该目标接口,否则,应用需要通过动态弹框先申请用户授权,并根据授权结果进行相应处理,处理方式可参考[访问控制开发概述](accesstoken-overview.md)。 +图1 向用户申请授权 +![](figures/permission-read_calendar.png) -> **注意:** +> **说明**: > -> 不能把之前授予的状态持久化,每次访问受目标权限保护的接口前,都应该调用requestPermissionsFromUser接口请求权限,因为用户在动态授予后可能通过设置取消应用的权限。 +> 每次访问受目标权限保护的接口之前,都需要使用 [requestPermissionsFromUser()](../reference/apis/js-apis-abilityAccessCtrl.md#requestpermissionsfromuser9) 接口请求相应的权限。用户可能在动态授予权限后通过系统设置来取消应用的权限,因此不能将之前授予的授权状态持久化。 + +### Stage模型 -## 完整示例 +以允许应用读取日历信息为例进行说明。 + +1. 申请`ohos.permission.READ_CALENDAR`权限,配置方式请参见[访问控制授权申请](#配置文件权限声明)。 + +2. 校验当前是否已经授权。 + + 在进行权限申请之前,需要先检查当前应用程序是否已经被授予了权限。可以通过调用[checkAccessToken()](../reference/apis/js-apis-abilityAccessCtrl.md#checkaccesstoken9)方法来校验当前是否已经授权。如果已经授权,则可以直接访问目标操作,否则需要进行下一步操作,即向用户申请授权。 + + ```ts + import bundleManager from '@ohos.bundle.bundleManager'; + import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl'; + + async function checkAccessToken(permission: Permissions): Promise { + let atManager = abilityAccessCtrl.createAtManager(); + let grantStatus: abilityAccessCtrl.GrantStatus; + + // 获取应用程序的accessTokenID + let tokenId: number; + try { + let bundleInfo: bundleManager.BundleInfo = await bundleManager.getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION); + let appInfo: bundleManager.ApplicationInfo = bundleInfo.appInfo; + tokenId = appInfo.accessTokenId; + } catch (err) { + console.error(`getBundleInfoForSelf failed, code is ${err.code}, message is ${err.message}`); + } + + // 校验应用是否被授予权限 + try { + grantStatus = await atManager.checkAccessToken(tokenId, permission); + } catch (err) { + console.error(`checkAccessToken failed, code is ${err.code}, message is ${err.message}`); + } + + return grantStatus; + } + + async function checkPermissions(): Promise { + const permissions: Array = ['ohos.permission.READ_CALENDAR']; + let grantStatus: abilityAccessCtrl.GrantStatus = await checkAccessToken(permissions[0]); + + if (grantStatus === abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED) { + // 已经授权,可以继续访问目标操作 + } else { + // 申请日历权限 + } + } + ``` + +3. 动态向用户申请授权。 + + 动态向用户申请权限是指在应用程序运行时向用户请求授权的过程。可以通过调用[requestPermissionsFromUser()](../reference/apis/js-apis-abilityAccessCtrl.md#requestpermissionsfromuser9)方法来实现。该方法接收一个权限列表参数,例如位置、日历、相机、麦克风等。用户可以选择授予权限或者拒绝授权。 + + 可以在UIAbility的`onWindowStageCreate()`回调中调用[requestPermissionsFromUser()](../reference/apis/js-apis-abilityAccessCtrl.md#requestpermissionsfromuser9)方法来动态申请权限,也可以根据业务需要在UI中向用户申请授权。 + + 在UIAbility中向用户申请授权。 + + ```typescript + import UIAbility from '@ohos.app.ability.UIAbility'; + import window from '@ohos.window'; + import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl'; + + const permissions: Array = ['ohos.permission.READ_CALENDAR']; + + export default class EntryAbility extends UIAbility { + // ... + + onWindowStageCreate(windowStage: window.WindowStage) { + // Main window is created, set main page for this ability + let context = this.context; + let atManager = abilityAccessCtrl.createAtManager(); + // requestPermissionsFromUser会判断权限的授权状态来决定是否唤起弹窗 + + atManager.requestPermissionsFromUser(context, permissions).then((data) => { + let grantStatus: Array = data.authResults; + let length: number = grantStatus.length; + for (let i = 0; i < length; i++) { + if (grantStatus[i] === 0) { + // 用户授权,可以继续访问目标操作 + } else { + // 用户拒绝授权,提示用户必须授权才能访问当前页面的功能,并引导用户到系统设置中打开相应的权限 + return; + } + } + // 授权成功 + }).catch((err) => { + console.error(`requestPermissionsFromUser failed, code is ${err.code}, message is ${err.message}`); + }) + + // ... + } + } + ``` + + 在UI中向用户申请授权。 + ```typescript + import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl'; + import common from '@ohos.app.ability.common'; + + const permissions: Array = ['ohos.permission.READ_CALENDAR']; + + @Entry + @Component + struct Index { + reqPermissionsFromUser(permissions: Array): void { + let context = getContext(this) as common.UIAbilityContext; + let atManager = abilityAccessCtrl.createAtManager(); + // requestPermissionsFromUser会判断权限的授权状态来决定是否唤起弹窗 + atManager.requestPermissionsFromUser(context, permissions).then((data) => { + let grantStatus: Array = data.authResults; + let length: number = grantStatus.length; + for (let i = 0; i < length; i++) { + if (grantStatus[i] === 0) { + // 用户授权,可以继续访问目标操作 + } else { + // 用户拒绝授权,提示用户必须授权才能访问当前页面的功能,并引导用户到系统设置中打开相应的权限 + return; + } + } + // 授权成功 + }).catch((err) => { + console.error(`requestPermissionsFromUser failed, code is ${err.code}, message is ${err.message}`); + }) + } + + // 页面展示 + build() { + // ... + } + } + ``` + +4. 处理授权结果。 + + 调用[requestPermissionsFromUser()](../reference/apis/js-apis-abilityAccessCtrl.md#requestpermissionsfromuser9)方法后,应用程序将等待用户授权的结果。如果用户授权,则可以继续访问目标操作。如果用户拒绝授权,则需要提示用户必须授权才能访问当前页面的功能,并引导用户到系统设置中打开相应的权限。 + + ```ts + function openPermissionsInSystemSettings(): void { + let context = getContext(this) as common.UIAbilityContext; + let wantInfo = { + action: 'action.settings.app.info', + parameters: { + settingsParamBundleName: 'com.example.myapplication' // 打开指定应用的详情页面 + } + } + context.startAbility(wantInfo).then(() => { + // ... + }).catch((err) => { + // ... + }) + } + ``` -请求用户授权权限的开发步骤为: +### FA模型 -1. 获取ability的上下文context。 -2. 调用requestPermissionsFromUser接口请求权限。运行过程中,该接口会根据应用是否已获得目标权限决定是否拉起动态弹框请求用户授权。 -3. 根据requestPermissionsFromUser接口返回值判断是否已获取目标权限。如果当前已经获取权限,则可以继续正常访问目标接口。 +通过调用[requestPermissionsFromUser()](../reference/apis/js-apis-inner-app-context.md#contextrequestpermissionsfromuser7)接口向用户动态申请授权。 -### FA模型下的示例代码 ```js - import featureAbility from '@ohos.ability.featureAbility'; +import featureAbility from '@ohos.ability.featureAbility'; - reqPermissions() { +reqPermissions() { let context = featureAbility.getContext(); let array:Array = ["ohos.permission.PERMISSION2"]; //requestPermissionsFromUser会判断权限的授权状态来决定是否唤起弹窗 context.requestPermissionsFromUser(array, 1).then(function(data) { - console.log("data type:" + typeof(data)); - console.log("data:" + data); - console.log("data permissions:" + data.permissions); - console.log("data result:" + data.authResults); + console.log("data:" + JSON.stringify(data)); + console.log("data permissions:" + JSON.stringify(data.permissions)); + console.log("data result:" + JSON.stringify(data.authResults)); }, (err) => { - console.error('Failed to start ability', err.code); + console.error('Failed to start ability', err.code); }); - } - +} ``` -> **说明:** -> FA模型的动态授权申请接口的使用详见[API参考](../reference/apis/js-apis-inner-app-context.md)。 - -### stage 模型下的示例代码 -```js - import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; - - //ability的onWindowStageCreate生命周期 - onWindowStageCreate() { - var context = this.context - var AtManager = abilityAccessCtrl.createAtManager(); - //requestPermissionsFromUser会判断权限的授权状态来决定是否唤起弹窗 - AtManager.requestPermissionsFromUser(context, ["ohos.permission.CAMERA"]).then((data) => { - console.log("data type:" + typeof(data)); - console.log("data:" + data); - console.log("data permissions:" + data.permissions); - console.log("data result:" + data.authResults); - }).catch((err) => { - console.error('Failed to start ability', err.code); - }) - } +## user_grant权限预授权 +应用在申请`user_grant`类型的权限默认未授权,需要通过拉起弹框由用户确认是否授予该权限。对于一些预制应用,不希望出现弹窗申请`user_grant`类型的权限,例如系统相机应用需要使用麦克风` ohos.permission.MICROPHONE`等权限,需要对麦克风等权限进行预授权,可以通过预授权的方式完成`user_grant`类型权限的授权。[预置配置文件](https://gitee.com/openharmony/vendor_hihope/blob/master/rk3568/preinstall-config/install_list_permissions.json)在设备上的路径为`/system/etc/app/install_list_permission.json`,设备开机启动时会读取该配置文件,在应用安装会对在文件中配置的`user_grant`类型权限授权。预授权配置文件字段内容包括`bundleName`、`app_signature`和`permissions`。 -``` -> **说明:** -> stage模型的动态授权申请接口的使用详见[API参考](../reference/apis/js-apis-abilityAccessCtrl.md)。 +- `bundleName`字段配置为应用的Bundle名称。 +- `app_signature`字段配置为应用的指纹信息。指纹信息的配置参见[应用特权配置指南](../../device-dev/subsystems/subsys-app-privilege-config-guide.md#install_list_capabilityjson中配置)。 +- `permissions`字段中`name`配置为需要预授权的`user_grant`类型的权限名;`permissions`字段中`userCancellable`表示为用户是否能够取消该预授权,配置为true,表示支持用户取消授权,为false则表示不支持用户取消授权。 -## user_grant权限预授权 -当前正常情况下,user_grant类型的权限默认不授权,需要时应通过拉起弹框由用户确认是否授予。对于一些预置应用,比如截屏应用,不希望出现弹框,则可以通过预授权的方式完成user_grant类型权限的授权。[预置配置文件](https://gitee.com/openharmony/vendor_hihope/blob/master/rk3568/preinstall-config/install_list_permissions.json)在设备上的路径为system/etc/app/install_list_permission.json,设备开机启动时会读取该配置文件,在应用安装会对在文件中配置的user_grant类型权限授权。当前仅支持预置应用配置该文件。 -预授权配置文件字段内容包括bundleName、app_signature、permissions。 -1. 这里的权限仅对user_grant类型的权限生效[查看权限等级和类型](permission-list.md)。 -2. userCancellable配置为true,表示支持用户取消授权,为false则表示不支持用户取消授权。 +> **说明**:当前仅支持预置应用配置该文件。 ```json [ + // ... { - "bundleName": "com.ohos.myapplication", // 包名 - "app_signature":[], // 指纹信息 + "bundleName": "com.example.myapplication", // Bundle名称 + "app_signature": ["****"], // 指纹信息 "permissions":[ { - "name":"xxxx", // 权限名,不可缺省 - "userCancellable":false // 用户不可取消授权,不可缺省 + "name": "ohos.permission.PERMISSION_X", // user_grant类型预授权的权限名 + "userCancellable": false // 用户不可取消授权 }, { - "name":"yyy", // 权限名,不可缺省 - "userCancellable":true // 用户可取消授权,不可缺省 + "name": "ohos.permission.PERMISSION_Y", // user_grant类型预授权的权限名 + "userCancellable": true // 用户可取消授权 } ] } ] ``` + ## 相关实例 针对访问控制,有以下相关实例可供参考: -- [`AbilityAccessCtrl`:访问权限控制(ArkTS)(Full SDK)(API8)(Full SDK)](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/Safety/AbilityAccessCtrl) -- [为应用添加运行时权限(ArkTS)(Full SDK)(API 9)](https://gitee.com/openharmony/codelabs/tree/master/Ability/AccessPermission) \ No newline at end of file +- [AbilityAccessCtrl:访问权限控制(ArkTS)(Full SDK)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SystemFeature/Security/AbilityAccessCtrl) +- [为应用添加运行时权限(ArkTS)(Full SDK)(API9)](https://gitee.com/openharmony/codelabs/tree/master/Ability/AccessPermission) \ No newline at end of file diff --git a/zh-cn/application-dev/ui/ui-ts-custom-component-lifecycle-callbacks.md b/zh-cn/application-dev/ui/ui-ts-custom-component-lifecycle-callbacks.md index a4fd8f633c2f4e127f0f574c979fc51755f52c0b..4c56db89c14ce7040ff72f27e4ab548b79b65068 100644 --- a/zh-cn/application-dev/ui/ui-ts-custom-component-lifecycle-callbacks.md +++ b/zh-cn/application-dev/ui/ui-ts-custom-component-lifecycle-callbacks.md @@ -15,12 +15,16 @@ aboutToAppear?(): void aboutToAppear函数在创建自定义组件的新实例后,在执行其build函数之前执行。允许在aboutToAppear函数中改变状态变量,更改将在后续执行build函数中生效。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + ## aboutToDisappear aboutToDisappear?(): void aboutToDisappear函数在自定义组件析构销毁之前执行。不允许在aboutToDisappear函数中改变状态变量,特别是@Link变量的修改可能会导致应用程序行为不稳定。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **示例1:** ```ts @@ -122,6 +126,8 @@ onLayout?(children: Array\, constraint: ConstraintSizeOptions): vo 框架会在自定义组件布局时,将该自定义组件的子节点信息和自身的尺寸范围通过onLayout传递给该自定义组件。不允许在onLayout函数中改变状态变量。 +该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 类型 | 说明 | @@ -135,6 +141,8 @@ onMeasure?(children: Array\, constraint: ConstraintSizeOptions): v 框架会在自定义组件确定尺寸时,将该自定义组件的子节点信息和自身的尺寸范围通过onMeasure传递给该自定义组件。不允许在onMeasure函数中改变状态变量。 +该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 类型 | 说明 | @@ -146,6 +154,8 @@ onMeasure?(children: Array\, constraint: ConstraintSizeOptions): v 子组件布局信息。 +该接口支持在ArkTS卡片中使用。 + | 参数 | 参数类型 | 描述 | | ---------- | ----------------------------------------------------------------------------------------------------------- | -------------------------------------- | | name | string | 子组件名称。 | @@ -160,6 +170,8 @@ onMeasure?(children: Array\, constraint: ConstraintSizeOptions): v 子组件border信息。 +该接口支持在ArkTS卡片中使用。 + | 参数 | 参数类型 | 描述 | | ----------- | ---------------------------------------------------------- | ---------------------------------------------- | | borderWidth | [EdgeWidths](../reference/arkui-ts/ts-types.md#edgewidths) | 边框宽度类型,用于描述组件边框不同方向的宽度。 | @@ -170,6 +182,8 @@ onMeasure?(children: Array\, constraint: ConstraintSizeOptions): v 子组件layout信息。 +该接口支持在ArkTS卡片中使用。 + | 参数 | 参数类型 | 描述 | | ---------- | -------------------------------------------------------------------------------- | ---------------- | | position | [Position](../reference/arkui-ts/ts-types.md#position) | 子组件位置坐标。 | diff --git a/zh-cn/application-dev/website.md b/zh-cn/application-dev/website.md index b8bbd834ef0204c152c7a460724d1b115ac43053..ad9fe726673795f06bd7709acc7ebd3cfde93ad9 100644 --- a/zh-cn/application-dev/website.md +++ b/zh-cn/application-dev/website.md @@ -91,7 +91,7 @@ - [线程模型](application-models/thread-model-stage.md) - [使用Emitter进行线程间通信](application-models/itc-with-emitter.md) - [使用Worker进行线程间通信](application-models/itc-with-worker.md) - - 任务管理 + - 后台任务管理 - [任务管理场景介绍](application-models/mission-management-overview.md) - [任务管理与启动模式](application-models/mission-management-launch-type.md) - [页面栈及任务链](application-models/page-mission-stack.md) @@ -930,6 +930,20 @@ - [@ohos.notification (Notification模块)(待停用)](reference/apis/js-apis-notification.md) - application - [EventHub](reference/apis/js-apis-inner-application-eventHub.md) + - commonEvent + - [CommonEventData](reference/apis/js-apis-inner-commonEvent-commonEventData.md) + - [CommonEventPublishData](reference/apis/js-apis-inner-commonEvent-commonEventPublishData.md) + - [CommonEventSubscriber](reference/apis/js-apis-inner-commonEvent-commonEventSubscriber.md) + - [CommonEventSubscribeInfo](reference/apis/js-apis-inner-commonEvent-commonEventSubscribeInfo.md) + - notification + - [NotificationActionButton](reference/apis/js-apis-inner-notification-notificationActionButton.md) + - [NotificationCommonDef](reference/apis/js-apis-inner-notification-notificationCommonDef.md) + - [NotificationContent](reference/apis/js-apis-inner-notification-notificationContent.md) + - [NotificationFlags](reference/apis/js-apis-inner-notification-notificationFlags.md) + - [NotificationRequest](reference/apis/js-apis-inner-notification-notificationRequest.md) + - [NotificationSlot](reference/apis/js-apis-inner-notification-notificationSlot.md) + - [NotificationTemplate](reference/apis/js-apis-inner-notification-notificationTemplate.md) + - [NotificationUserInput](reference/apis/js-apis-inner-notification-notificationUserInput.md) - 包管理 - [@ohos.bundle.appControl (appControl模块)](reference/apis/js-apis-appControl.md) - [@ohos.bundle.bundleManager (bundleManager模块)](reference/apis/js-apis-bundleManager.md) @@ -984,7 +998,7 @@ - [@ohos.i18n (国际化-I18n)](reference/apis/js-apis-i18n.md) - [@ohos.intl (国际化-Intl)](reference/apis/js-apis-intl.md) - [@ohos.resourceManager (资源管理)](reference/apis/js-apis-resource-manager.md) - - 资源调度 + - 后台任务 - [@ohos.distributedMissionManager (分布式任务管理)](reference/apis/js-apis-distributedMissionManager.md) - [@ohos.reminderAgentManager (后台代理提醒)](reference/apis/js-apis-reminderAgentManager.md) - [@ohos.resourceschedule.backgroundTaskManager (后台任务管理)](reference/apis/js-apis-resourceschedule-backgroundTaskManager.md) @@ -1232,8 +1246,9 @@ - 资源管理 - [I18n错误码](reference/errorcodes/errorcode-i18n.md) - [资源管理错误码](reference/errorcodes/errorcode-resource-manager.md) - - 资源调度 + - 后台任务 - [backgroundTaskManager错误码](reference/errorcodes/errorcode-backgroundTaskMgr.md) + - [DeviceUsageStatistics错误码](reference/errorcodes/errorcode-DeviceUsageStatistics.md) - [reminderAgentManager错误码](reference/errorcodes/errorcode-reminderAgentManager.md) - [workScheduler错误码](reference/errorcodes/errorcode-workScheduler.md) - 安全 @@ -1284,7 +1299,6 @@ - [系统参数错误码](reference/errorcodes/errorcode-system-parameterV9.md) - [USB服务错误码](reference/errorcodes/errorcode-usb.md) - [升级错误码](reference/errorcodes/errorcode-update.md) - - [DeviceUsageStatistics错误码](reference/errorcodes/errorcode-DeviceUsageStatistics.md) - 定制管理 - [企业设备管理错误码](reference/errorcodes/errorcode-enterpriseDeviceManager.md) - 语言基础类库 diff --git a/zh-cn/device-dev/faqs/faqs-burning.md b/zh-cn/device-dev/faqs/faqs-burning.md index 1e1d16aed57749fbee981943b49586d6492c7935..2d99e575d65a4dbe1183774769768b7a33e23448 100644 --- a/zh-cn/device-dev/faqs/faqs-burning.md +++ b/zh-cn/device-dev/faqs/faqs-burning.md @@ -140,3 +140,31 @@ **图10** 允许Visual Studio Code应用访问网络 ![zh-cn_image_0000001243084579](figures/zh-cn_image_0000001243084579.png) + + +### 烧录时无法识别到设备 + +- **现象描述** + + 烧录操作时,烧录工具提示“没有发现设备”或“Check whether the board is connected”等信息。 + +- **可能原因** + + Windows电脑与开发板之间的线缆(烧录所需线缆,此处以USB线缆为例)未连接。 + + Windows电脑与开发板之间线缆对应的驱动未安装。 + +- **解决方法** + + 1. 检查USB线缆是否连接。 + + 2. 在Windows环境中打开设备管理器。 + + 3. 打开“通用串行总线控制器”列表。 + + 4. 检查“USB Device”是否已安装驱动。如显示告警标识,说明Windows环境中未安装相应驱动。 + + 5. 请根据Windows环境的具体情况,安装“USB Device”的驱动(如FT23R USB UART Driver)后,重新操作。 + + 6. 如仍有其他问题,请查询对应FAQ。 + \ No newline at end of file diff --git a/zh-cn/device-dev/get-code/gettools-acquire.md b/zh-cn/device-dev/get-code/gettools-acquire.md index 1d25ad4cec7d388f14c23116fd9242cefda0beb5..1d5ad5209743da7148b0010188008b8887c4dd31 100644 --- a/zh-cn/device-dev/get-code/gettools-acquire.md +++ b/zh-cn/device-dev/get-code/gettools-acquire.md @@ -27,6 +27,7 @@ OpenHarmony为开发者提供了两种Docker环境,以帮助开发者快速完 > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> HPM Docker环境无需单独获取源码。 +3. 请使用具备root权限的用户,或已被授予docker使用权限的用户进行后续操作。 ## 独立Docker环境 diff --git "a/zh-cn/readme/figures/\345\210\206\345\270\203\345\274\217\347\241\254\344\273\266\345\255\220\347\263\273\347\273\237\346\236\266\346\236\204\345\233\276.png" "b/zh-cn/readme/figures/\345\210\206\345\270\203\345\274\217\347\241\254\344\273\266\345\255\220\347\263\273\347\273\237\346\236\266\346\236\204\345\233\276.png" new file mode 100644 index 0000000000000000000000000000000000000000..3b93378bab491277cfe241b76218eac59d90eafc Binary files /dev/null and "b/zh-cn/readme/figures/\345\210\206\345\270\203\345\274\217\347\241\254\344\273\266\345\255\220\347\263\273\347\273\237\346\236\266\346\236\204\345\233\276.png" differ diff --git "a/zh-cn/readme/\345\210\206\345\270\203\345\274\217\347\241\254\344\273\266\345\255\220\347\263\273\347\273\237.md" "b/zh-cn/readme/\345\210\206\345\270\203\345\274\217\347\241\254\344\273\266\345\255\220\347\263\273\347\273\237.md" new file mode 100644 index 0000000000000000000000000000000000000000..ea9ca7cfb93a3e09821d9dfff5cc8a2fd9ff4fc8 --- /dev/null +++ "b/zh-cn/readme/\345\210\206\345\270\203\345\274\217\347\241\254\344\273\266\345\255\220\347\263\273\347\273\237.md" @@ -0,0 +1,51 @@ +# 分布式硬件子系统 + +## 简介 + +### 子系统介绍 + +超级终端是指多个设备互相协同,借助各个设备的优势能力为用户提供1+1>2的更优体验。 +分布式硬件子系统是超级终端中用于设备间外设能力共享的子系统,其管理超级终端内各个设备的硬件信息,纳入硬件资源池统一管理,实现设备间硬件能力的跨设备共享和调用能力,打破了设备边界,并通过软件定义各种新产品形态和体验。如手机可以使用电视大屏幕显示,办公PC也能使用手机摄像头提供更强的摄像能力。 +分布式硬件平台对超级终端中的所有设备的硬件资源池化都是基于硬件虚拟化组件来进行构建的,每一个硬件在平台上注册对应的虚拟硬件实例,虚拟硬件通过虚拟化组件实现与对应的物理硬件之间的交互,从而实现了对周边设备对应硬件的控制和数据传输。硬件资源池化基于驱动接口(HDI)完成硬件虚拟化,服务层各个业务子系统可以像使用本机硬件一样使用分布式硬件。 + +### 子系统架构图 + +![分布式硬件子系统](figures/分布式硬件子系统架构图.png) + +## 目录 + +``` +foundation/distributedhardware +├──device_manager # 分布式设备管理部件目录 +├──distributed_hardware_fwk # 分布式硬件管理框架部件目录 +├──distributed_camera # 分布式相机部件目录 +└──distributed_screen # 分布式屏幕部件目录 +``` + +## 组件说明 + +### 分布式设备管理 + +DeviceManager组件在OpenHarmony上提供分布式设备的认证组网能力,并为开发者提供了一套用于分布式设备间上下线状态感知、发现和认证的接口,其能力主要包括分布式设备的可信状态管理,上下线状态管理以及设备的发现和认证管理。经过设备发现和认证后,两台设备会组成超级终端,超级终端中所有设备的硬件资源会自动同步,并由分布式硬件子系统进行统一的管理。 + +### 分布式硬件管理框架 + +分布式硬件管理框架是为分布式硬件子系统提供信息管理能力的部件。分布式硬件管理框架为分布式硬件子系统提供统一的硬件接入、查询和使能等能力。 + +### 分布式相机 + +分布式相机是多个设备的相机同时协同使用的能力。分布式相机部件是为分布式硬件子系统提供这一能力的部件。本部件不直接对接应用,只向分布式硬件框架子系统提供C++接口。应用可以通过相机框架的接口使用分布式相机部件操作其他设备的Camera,使用方式与本地相机一致。 + +### 分布式屏幕 + +分布式屏幕是一种屏幕虚拟化能力,支持用户指定组网认证过的其他OpenHarmony设备的屏幕作为Display的显示区域。在分布式硬件子系统中,分布式屏幕组件提供跨设备屏幕能力调用,为OpenHarmony操作系统提供系统投屏、屏幕镜像、屏幕分割等能力的实现。 + +## 相关仓 + +[distributedhardware\_device\_manager](https://gitee.com/openharmony/distributedhardware_device_manager) + +[distributedhardware\_distributed\_hardware\_fwk](https://gitee.com/openharmony/distributedhardware_distributed_hardware_fwk) + +[distributedhardware\_distributed\_camera](https://gitee.com/openharmony/distributedhardware_distributed_camera) + +[distributedhardware\_distributed\_screen](https://gitee.com/openharmony/distributedhardware_distributed_screen) \ No newline at end of file diff --git "a/zh-cn/readme/\347\275\221\347\273\234\347\256\241\347\220\206\345\255\220\347\263\273\347\273\237.md" "b/zh-cn/readme/\347\275\221\347\273\234\347\256\241\347\220\206\345\255\220\347\263\273\347\273\237.md" index 5a138c74e854c22b2dd9589b4903f830b9de762c..a1ceefd6cd9ece20e944100169737d28b6413e78 100644 --- "a/zh-cn/readme/\347\275\221\347\273\234\347\256\241\347\220\206\345\255\220\347\263\273\347\273\237.md" +++ "b/zh-cn/readme/\347\275\221\347\273\234\347\256\241\347\220\206\345\255\220\347\263\273\347\273\237.md" @@ -72,7 +72,7 @@ foundation/communication/ 1. 从@ohos.net.sharing中导入sharing命名空间。 2. 设定共享类型 3. 开始共享 -4. 止共享 +4. 停止共享 ``` // 引入包名 import sharing from '@ohos.net.sharing'; @@ -92,26 +92,28 @@ sharing.stopSharing(this.sharingType,(err)=>{ 1. 从@ohos.net.http.d.ts中导入http命名空间。 2. 调用createHttp()方法,创建一个HttpRequest对象。 -3. 调用该对象的on()方法,订阅http响应头,此接口会比request请求先返回。可以根据业务需要订阅此消息。 +3. 调用该对象的on()方法,订阅http响应头事件,此接口会比request请求先返回。可以根据业务需要订阅此消息。 4. 调用该对象的request()方法,传入http请求的url地址和可选参数,发起网络请求。 5. 按照实际业务需要,解析返回结果。 -6. 当该请求使用完毕时,调用destroy()方法主动销毁。 +6. 调用该对象的off()方法,取消订阅http响应头事件。 +7. 当该请求使用完毕时,调用destroy()方法主动销毁。 ``` // 引入包名 import http from '@ohos.net.http'; -// 每一个httpRequest对应一个http请求任务,不可复用 +// 每一个httpRequest对应一个HTTP请求任务,不可复用 let httpRequest = http.createHttp(); -// 用于订阅http响应头,此接口会比request请求先返回。可以根据业务需要订阅此消息 -httpRequest.on('headersReceive', (data) => { - console.info('header: ' + data.header); +// 用于订阅HTTP响应头,此接口会比request请求先返回。可以根据业务需要订阅此消息 +// 从API 8开始,使用on('headersReceive', Callback)替代on('headerReceive', AsyncCallback)。 8+ +httpRequest.on('headersReceive', (header) => { + console.info('header: ' + JSON.stringify(header)); }); httpRequest.request( - // 填写http请求的url地址,可以带参数也可以不带参数。URL地址需要开发者自定义。GET请求的参数可以在extraData中指定 + // 填写HTTP请求的URL地址,可以带参数也可以不带参数。URL地址需要开发者自定义。请求的参数可以在extraData中指定 "EXAMPLE_URL", { - method: 'POST', // 可选,默认为“GET” + method: http.RequestMethod.POST, // 可选,默认为http.RequestMethod.GET // 开发者根据自身业务需要添加header字段 header: { 'Content-Type': 'application/json' @@ -120,21 +122,28 @@ httpRequest.request( extraData: { "data": "data to send", }, - connectTimeout: 60000, // 可选,默认为60000,即60s - readTimeout: 60000, // 可选,默认为60000,即60s - },(err, data) => { + expectDataType: http.HttpDataType.STRING, // 可选,指定返回数据的类型 + usingCache: true, // 可选,默认为true + priority: 1, // 可选,默认为1 + connectTimeout: 60000, // 可选,默认为60000ms + readTimeout: 60000, // 可选,默认为60000ms + usingProtocol: http.HttpProtocol.HTTP1_1, // 可选,协议类型默认值由系统自动指定 + usingProxy: false, //可选,默认不使用网络代理,自API 10开始支持该属性 + }, (err, data) => { if (!err) { - // data.result为http响应内容,可根据业务需要进行解析 - console.info('Result:' + data.result); - console.info('code:' + data.responseCode); - // data.header为http响应头,可根据业务需要进行解析 - console.info('header:' + data.header); - console.info('header:' + data.cookies); + // data.result为HTTP响应内容,可根据业务需要进行解析 + console.info('Result:' + JSON.stringify(data.result)); + console.info('code:' + JSON.stringify(data.responseCode)); + // data.header为HTTP响应头,可根据业务需要进行解析 + console.info('header:' + JSON.stringify(data.header)); + console.info('cookies:' + JSON.stringify(data.cookies)); // 8+ } else { - console.info('error:' + err); + console.info('error:' + JSON.stringify(err)); + // 取消订阅HTTP响应头事件 + httpRequest.off('headersReceive'); + // 当该请求使用完毕时,调用destroy方法主动销毁。 + httpRequest.destroy(); } - // 当该请求使用完毕时,调用destroy()方法主动销毁。 - httpRequest.destroy(); } ); ``` diff --git a/zh-cn/release-notes/OpenHarmony-v3.2-beta1.md b/zh-cn/release-notes/OpenHarmony-v3.2-beta1.md index 2e05c035ae0079bb9df02b44c6e910926617e9fc..c005498dc429d4de1395afca4bc78e988d5c4d6a 100644 --- a/zh-cn/release-notes/OpenHarmony-v3.2-beta1.md +++ b/zh-cn/release-notes/OpenHarmony-v3.2-beta1.md @@ -186,26 +186,26 @@ _[API差异报告](api-change/v3.2-beta1/Readme-CN.md)_ | 子系统 | 名称 | 简介 | 开发语言 | | -------- | -------- | -------- | -------- | -| ArkUI | [MouseEvent](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/ETSUI/MouseEvent) | 本示例模拟了简单的扫雷游戏调用了鼠标事件的相关接口 | eTS | -| ArkUI | [Vibrator](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/device/Vibrator) | 本示例模拟倒计时场景,展示振动接口的使用方法。 | eTS | -| DFX | [FaultLogger](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/DFX/FaultLogger) | 本示例展示了在eTS中如何获取应用故障相关信息。 | eTS | -| ArkUI | [Gallery](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/ETSUI/Gallery) | 本Demo通过不同示例向用户介绍通用事件、通用属性、手势处理等不同组件的功能。 | eTS | +| ArkUI | [MouseEvent](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/ETSUI/MouseEvent) | 本示例模拟了简单的扫雷游戏调用了鼠标事件的相关接口 | ArkTS | +| ArkUI | [Vibrator](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/device/Vibrator) | 本示例模拟倒计时场景,展示振动接口的使用方法。 | ArkTS | +| DFX | [FaultLogger](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/DFX/FaultLogger) | 本示例展示了在ArkTS中如何获取应用故障相关信息。 | ArkTS | +| ArkUI | [Gallery](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/ETSUI/Gallery) | 本Demo通过不同示例向用户介绍通用事件、通用属性、手势处理等不同组件的功能。 | ArkTS | | 图形 | [JsWebGL](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/Graphics/JsWebGL) | 本示例调用GPU资源绘制了五角星和矩形,展示WebGL相关接口的使用方法。 | JS | -| ArkUI | [Clock](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/Preset/Clock) | 本示例使用eTS UI能力实现一个简单的时钟应用。 | eTS | -| 网络管理 | [Http](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/Network/Http) | 本示例仿postman输入API接口地址,获取相应数据,介绍数据请求接口的用法。 | eTS | -| 网络管理 | [Socket](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/Network/Socket) | 本示例主要演示了Socket在网络通信方面的应用,展示了Socket在两端设备的连接验证、聊天通信方面的应用。 | eTS | -| 分布式数据管理 | [DistributedRdb](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/data/DistributedRdb) | 本示例展示了在eTS中分布式关系型数据库的使用,在增、删、改、查的基本操作外,还包括分布式数据库的数据同步能力。 | eTS | -| 元能力 | [BackgroundTaskManager](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/ResourcesSchedule/BackgroundTaskManager) | 本示例模拟下载功能,将下载任务通过后台任务管理进行处理,实现退出应用后任务仍能够执行,直至任务结束。 | eTS | -| 元能力 | [BringApp](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/ETSUI/BringApp) | 本示例使用FeatureAbility接口,通过应用的包名与Ability名,拉起系统应用。 | eTS | -| 媒体 | [VideoPlayer](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/media/VideoPlayer) | 本示例展示了在eTS中VideoPlayer如何播放视频,同时提供一个可供其他应用调用播放视频的Ability。 | eTS | -| 元能力 | [DistributeCalc](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/Preset/DistributeCalc) | 本示例使用JS分布式能力实现了一个简单的计算器应用,可以进行简单的数值计算,支持远程拉起另一个计算器FA,两个FA进行协同计算。 | eTS | -| Web | [Browser](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/device/Browser) | 本示例运用OpenHarmony系统提供的Stage模型与相关接口展示了一个简易的浏览器。 | eTS | -| 元能力 | [DeviceUsageStatistics](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/device/DeviceUsageStatistics) | 本示例主要展示了设备使用信息情况。 | eTS | -| ArkUI | [AdaptiveCapabilities](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/MultiDeviceAppDev/AdaptiveCapabilities) | 本示例展示在eTS中的多设备自适应能力,包括资源限定词、原子布局和响应式布局。 | eTS | -| ArkUI | [Game2048](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/ETSUI/Game2048) | 2048是一款比较流行的数字游戏,此游戏demo是grid组件基础上进行开发完成的。 | eTS | -| 窗口 | [Window](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/Graphics/Window) | 本示例展示了创建新窗口,将应用悬浮在其他界面,及应用分屏等功能 | eTS | -| 分布式数据管理 | [Preference](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/data/Preferences) | 本示例主要展示了首选项在主题切换方面的功能。 | eTS | -| 全球化 | [International](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/common/International) | 本示例展示了i18n,intl,resourceManager在eTS中的使用,使用相关api实现系统语言和地区设置、时间和时区设置,展示了区域格式化示例。 | eTS | +| ArkUI | [Clock](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/Preset/Clock) | 本示例使用ArkTS UI能力实现一个简单的时钟应用。 | ArkTS | +| 网络管理 | [Http](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/Network/Http) | 本示例仿postman输入API接口地址,获取相应数据,介绍数据请求接口的用法。 | ArkTS | +| 网络管理 | [Socket](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/Network/Socket) | 本示例主要演示了Socket在网络通信方面的应用,展示了Socket在两端设备的连接验证、聊天通信方面的应用。 | ArkTS | +| 分布式数据管理 | [DistributedRdb](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/data/DistributedRdb) | 本示例展示了在ArkTS中分布式关系型数据库的使用,在增、删、改、查的基本操作外,还包括分布式数据库的数据同步能力。 | ArkTS | +| 元能力 | [BackgroundTaskManager](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/ResourcesSchedule/BackgroundTaskManager) | 本示例模拟下载功能,将下载任务通过后台任务管理进行处理,实现退出应用后任务仍能够执行,直至任务结束。 | ArkTS | +| 元能力 | [BringApp](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/ETSUI/BringApp) | 本示例使用FeatureAbility接口,通过应用的包名与Ability名,拉起系统应用。 | ArkTS | +| 媒体 | [VideoPlayer](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/media/VideoPlayer) | 本示例展示了在ArkTS中VideoPlayer如何播放视频,同时提供一个可供其他应用调用播放视频的Ability。 | ArkTS | +| 元能力 | [DistributeCalc](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/Preset/DistributeCalc) | 本示例使用JS分布式能力实现了一个简单的计算器应用,可以进行简单的数值计算,支持远程拉起另一个计算器FA,两个FA进行协同计算。 | ArkTS | +| Web | [Browser](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/device/Browser) | 本示例运用OpenHarmony系统提供的Stage模型与相关接口展示了一个简易的浏览器。 | ArkTS | +| 元能力 | [DeviceUsageStatistics](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/device/DeviceUsageStatistics) | 本示例主要展示了设备使用信息情况。 | ArkTS | +| ArkUI | [AdaptiveCapabilities](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/MultiDeviceAppDev/AdaptiveCapabilities) | 本示例展示在ArkTS中的多设备自适应能力,包括资源限定词、原子布局和响应式布局。 | ArkTS | +| ArkUI | [Game2048](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/ETSUI/Game2048) | 2048是一款比较流行的数字游戏,此游戏demo是grid组件基础上进行开发完成的。 | ArkTS | +| 窗口 | [Window](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/Graphics/Window) | 本示例展示了创建新窗口,将应用悬浮在其他界面,及应用分屏等功能 | ArkTS | +| 分布式数据管理 | [Preference](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/data/Preferences) | 本示例主要展示了首选项在主题切换方面的功能。 | ArkTS | +| 全球化 | [International](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/common/International) | 本示例展示了i18n,intl,resourceManager在ArkTS中的使用,使用相关api实现系统语言和地区设置、时间和时区设置,展示了区域格式化示例。 | ArkTS | 请访问[Samples](https://gitee.com/openharmony/applications_app_samples)仓了解更多信息。 diff --git a/zh-cn/release-notes/OpenHarmony-v3.2-beta2.md b/zh-cn/release-notes/OpenHarmony-v3.2-beta2.md index 3b90b000bb31aecd804ee8d861d53fd02ce6a34e..b402b095ec26351cc6c59f62a46a14c8deed853d 100644 --- a/zh-cn/release-notes/OpenHarmony-v3.2-beta2.md +++ b/zh-cn/release-notes/OpenHarmony-v3.2-beta2.md @@ -171,28 +171,28 @@ | 子系统 | 名称 | 简介 | 开发语言 | | -------- | -------- | -------- | -------- | -| 元能力 | MissionManager | 本示例通过调用系统任务管理的能力,对系统任务执行锁定、解锁、清理、切换到前台等操作。 | eTS | -| 网络管理 | AirQuality | 空气质量(Air quality)的好坏反映了空气污染程度,它是依据空气中污染物浓度的高低来判断的。空气污染是一个复杂的现象,在特定时间和地点空气污染物浓度受到许多因素影响。来自固定和流动污染源的人为污染物排放大小是影响空气质量的最主要因素之一,本示例实现了一个简单空气质量应用,使用折行显示能力显示空气质量信息,使用柱形图展示历史记录。 | eTS | -| ArkUI | TransitionAnimation | 本示例展示了转场动画的使用,包括页面间转场、组件内转场和共享元素转场。 | eTS | -| 应用程序包管理 | ZipLib | 本示例通过构建解压,压缩文件场景,向用户展示\@ohos.zlib接口。 | eTS | -| 工程能力 | Npm | 本示例展示了npm引用第三方js类库和本地库,主要展示了mathjs、dayjs和本地库应用。 | eTS | -| 数据管理 | DistributedMusicPlayer | 本示例使用fileIo获取指定音频文件,并通过AudioPlayer完成了音乐的播放完成了基本的音乐播放、暂停、上一曲、下一曲功能;并使用DeviceManager完成了分布式设备列表的显示和分布式能力完成了音乐播放状态的跨设备迁移。 | eTS | -| ArkUI | PatternLock | 本示例展示了图案密码锁组件的使用,实现了密码设置、验证和重置功能。 | eTS | -| 安全 | UserAuth | 本示例展示了用户认证中人脸识别功能。 | eTS | -| 安全 | Cipher | 本示例展示了加解密算法,包括RSA加密算法与AES加密算法。 | eTS | -| 图形图像 | Screen | 本示例监听屏幕数量变化,创建、销毁虚拟屏幕模拟屏幕增减,读取屏幕属性并显示。 | eTS | -| ArkUI | Search | 本示例展示了Search组件的使用,使用Search组件实现一个搜索界面。 | eTS | -| 设备管理 | USBManager | 本示例展示了USB设备管理的使用,包括USB设备插拔状态监听和USB设备信息显示。 | eTS | -| 数据管理 | DistributedDataGobang | 五子棋是一款比较流行的棋类游戏,此游戏使用分布式数据管理功能进行开发完成的。 | eTS | -| 媒体 | Image | 本示例仿照相册应用,读取本地设备中图片,获取图片信息,可对图片进行旋转操作。 | eTS | -| 安全 | AbilityAccessCtrl | 本示例通过模拟应用申请权限场景,向用户展示@ohos.abilityAccessCtrl接口。 | eTS | -| 网络管理 | WebSocket | 本示例展示了WebSocket的使用,包括客户端与服务端的连接和断开以及客户端数据的接收和发送。 | eTS | -| 通信与连接 | Bluetooth | 蓝牙技术是一种无线数据和语音通信开放的全球规范,它是基于低成本的近距离无线连接,为固定和移动设备建立通信环境的一种特殊的近距离无线技术连接。本示例实现蓝牙设备发现,配对,取消配对功能。 | eTS | -| 媒体 | GamePuzzle | 拼图Demo是基于Grid组件进行开发,通过image (图片处理)和medialibrary (媒体库管理)接口实现获取图片,以及图片裁剪分割。 | eTS | -| 网络管理 | UploadDownload | 上传就是将文件从个人终端设备传送至远程服务器,下载是将文件从远程服务器传送至个人终端设备,进而实现文件的存储,该示例使用上传下载的接口实现文件的上传下载。 | eTS | -| 设备管理 | Location | 本示例使用方向传感器及GPS,实现获取当前位置信息。 | eTS | -| 电话服务 | Observer | 本示例通过observer接口订阅网络状态、信号状态、通话状态、蜂窝数据、sim状态等事件,并获取状态变化返回的结果。 | eTS | -| ArkUI | AdaptiveCapabilities | 此Demo展示在eTS中的多设备自适应能力,包括资源限定词、原子布局和响应式布局。 | eTS | +| 元能力 | MissionManager | 本示例通过调用系统任务管理的能力,对系统任务执行锁定、解锁、清理、切换到前台等操作。 | ArkTS | +| 网络管理 | AirQuality | 空气质量(Air quality)的好坏反映了空气污染程度,它是依据空气中污染物浓度的高低来判断的。空气污染是一个复杂的现象,在特定时间和地点空气污染物浓度受到许多因素影响。来自固定和流动污染源的人为污染物排放大小是影响空气质量的最主要因素之一,本示例实现了一个简单空气质量应用,使用折行显示能力显示空气质量信息,使用柱形图展示历史记录。 | ArkTS | +| ArkUI | TransitionAnimation | 本示例展示了转场动画的使用,包括页面间转场、组件内转场和共享元素转场。 | ArkTS | +| 应用程序包管理 | ZipLib | 本示例通过构建解压,压缩文件场景,向用户展示\@ohos.zlib接口。 | ArkTS | +| 工程能力 | Npm | 本示例展示了npm引用第三方js类库和本地库,主要展示了mathjs、dayjs和本地库应用。 | ArkTS | +| 数据管理 | DistributedMusicPlayer | 本示例使用fileIo获取指定音频文件,并通过AudioPlayer完成了音乐的播放完成了基本的音乐播放、暂停、上一曲、下一曲功能;并使用DeviceManager完成了分布式设备列表的显示和分布式能力完成了音乐播放状态的跨设备迁移。 | ArkTS | +| ArkUI | PatternLock | 本示例展示了图案密码锁组件的使用,实现了密码设置、验证和重置功能。 | ArkTS | +| 安全 | UserAuth | 本示例展示了用户认证中人脸识别功能。 | ArkTS | +| 安全 | Cipher | 本示例展示了加解密算法,包括RSA加密算法与AES加密算法。 | ArkTS | +| 图形图像 | Screen | 本示例监听屏幕数量变化,创建、销毁虚拟屏幕模拟屏幕增减,读取屏幕属性并显示。 | ArkTS | +| ArkUI | Search | 本示例展示了Search组件的使用,使用Search组件实现一个搜索界面。 | ArkTS | +| 设备管理 | USBManager | 本示例展示了USB设备管理的使用,包括USB设备插拔状态监听和USB设备信息显示。 | ArkTS | +| 数据管理 | DistributedDataGobang | 五子棋是一款比较流行的棋类游戏,此游戏使用分布式数据管理功能进行开发完成的。 | ArkTS | +| 媒体 | Image | 本示例仿照相册应用,读取本地设备中图片,获取图片信息,可对图片进行旋转操作。 | ArkTS | +| 安全 | AbilityAccessCtrl | 本示例通过模拟应用申请权限场景,向用户展示@ohos.abilityAccessCtrl接口。 | ArkTS | +| 网络管理 | WebSocket | 本示例展示了WebSocket的使用,包括客户端与服务端的连接和断开以及客户端数据的接收和发送。 | ArkTS | +| 通信与连接 | Bluetooth | 蓝牙技术是一种无线数据和语音通信开放的全球规范,它是基于低成本的近距离无线连接,为固定和移动设备建立通信环境的一种特殊的近距离无线技术连接。本示例实现蓝牙设备发现,配对,取消配对功能。 | ArkTS | +| 媒体 | GamePuzzle | 拼图Demo是基于Grid组件进行开发,通过image (图片处理)和medialibrary (媒体库管理)接口实现获取图片,以及图片裁剪分割。 | ArkTS | +| 网络管理 | UploadDownload | 上传就是将文件从个人终端设备传送至远程服务器,下载是将文件从远程服务器传送至个人终端设备,进而实现文件的存储,该示例使用上传下载的接口实现文件的上传下载。 | ArkTS | +| 设备管理 | Location | 本示例使用方向传感器及GPS,实现获取当前位置信息。 | ArkTS | +| 电话服务 | Observer | 本示例通过observer接口订阅网络状态、信号状态、通话状态、蜂窝数据、sim状态等事件,并获取状态变化返回的结果。 | ArkTS | +| ArkUI | AdaptiveCapabilities | 此Demo展示在ArkTS中的多设备自适应能力,包括资源限定词、原子布局和响应式布局。 | ArkTS | | ArkUI | JsAdaptiveCapabilities | 此Demo展示在JS中的多设备自适应能力,包括资源限定词、原子布局和响应式布局。 | JS | 请访问[Samples](https://gitee.com/openharmony/app_samples)仓了解更多信息。 diff --git a/zh-cn/release-notes/OpenHarmony-v3.2-beta3.md b/zh-cn/release-notes/OpenHarmony-v3.2-beta3.md index ace55e63aef706b88533d58df2433fe89da54be1..6c579aa250ae8e672a5d1f0dc0872c8b491aef83 100644 --- a/zh-cn/release-notes/OpenHarmony-v3.2-beta3.md +++ b/zh-cn/release-notes/OpenHarmony-v3.2-beta3.md @@ -190,13 +190,13 @@ API变更请参考: | 子系统 | 名称 | 简介 | 开发语言 | | -------- | -------- | -------- | -------- | -| ArkUI | [HealthyDiet:健康饮食](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/ETSUI/HealthyDiet) | 这是一个记录饮食和查看食物信息的应用,主要用于管理饮食健康。可以添加饮食信息,包括食物的种类、重量以及用餐时间,如早餐、 午餐、晚餐和夜宵,并能统计得到相应用餐时间的总热量值、总蛋白质、总脂肪和总碳水值,并且用柱状图的形式展示出来。 | eTS | -| ArkUI | [MusicAlbum:一多音乐专辑主页](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/MultiDeviceAppDev/MusicAlbum) | 本示例展示了音乐专辑主页,使用一次开发多端部署中介绍的自适应布局能力和响应式布局能力进行多设备(或多窗口尺寸)适配,保证应用在不同设备或不同窗口尺寸下可以正常显示。 | eTS | -| 元能力、文件管理 | [Share:分享](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/Share/Share) | 分享的主要工作是实现:发送方将文本,链接,图片文件三种类型分享给三方应用,同时能够在三方应用中分别呈现出来。 | eTS | -| 元能力 | [GalleryForm:图库卡片](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/ability/GalleryForm) | 本示例是模拟图库卡片,实现对图库中的照片在卡片中显示,定时刷新卡片内容等功能。 | eTS | -| ArkUI | [AppMarket:一多应用市场首页](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/MultiDeviceAppDev/AppMarket) | 本示例展示了应用市场首页,页面中包括Tab栏、运营横幅、精品应用、精品游戏等。 | eTS | -| ArkUI | [Weather:一多天气](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/MultiDeviceAppDev/Weather) | 本示例展示一个天气应用界面,包括首页、城市管理、添加城市、更新时间弹窗,体现一次开发,多端部署的能力。 | eTS | -| 媒体 | [MediaCollections:媒体管理合集](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/media/MediaCollections) | 本示例展示了网络流播放能力、音视频播控能力、音量调节能力等。 | eTS | +| ArkUI | [HealthyDiet:健康饮食](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/ETSUI/HealthyDiet) | 这是一个记录饮食和查看食物信息的应用,主要用于管理饮食健康。可以添加饮食信息,包括食物的种类、重量以及用餐时间,如早餐、 午餐、晚餐和夜宵,并能统计得到相应用餐时间的总热量值、总蛋白质、总脂肪和总碳水值,并且用柱状图的形式展示出来。 | ArkTS | +| ArkUI | [MusicAlbum:一多音乐专辑主页](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/MultiDeviceAppDev/MusicAlbum) | 本示例展示了音乐专辑主页,使用一次开发多端部署中介绍的自适应布局能力和响应式布局能力进行多设备(或多窗口尺寸)适配,保证应用在不同设备或不同窗口尺寸下可以正常显示。 | ArkTS | +| 元能力、文件管理 | [Share:分享](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/Share/Share) | 分享的主要工作是实现:发送方将文本,链接,图片文件三种类型分享给三方应用,同时能够在三方应用中分别呈现出来。 | ArkTS | +| 元能力 | [GalleryForm:图库卡片](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/ability/GalleryForm) | 本示例是模拟图库卡片,实现对图库中的照片在卡片中显示,定时刷新卡片内容等功能。 | ArkTS | +| ArkUI | [AppMarket:一多应用市场首页](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/MultiDeviceAppDev/AppMarket) | 本示例展示了应用市场首页,页面中包括Tab栏、运营横幅、精品应用、精品游戏等。 | ArkTS | +| ArkUI | [Weather:一多天气](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/MultiDeviceAppDev/Weather) | 本示例展示一个天气应用界面,包括首页、城市管理、添加城市、更新时间弹窗,体现一次开发,多端部署的能力。 | ArkTS | +| 媒体 | [MediaCollections:媒体管理合集](https://gitee.com/openharmony/applications_app_samples/tree/monthly_20221018/media/MediaCollections) | 本示例展示了网络流播放能力、音视频播控能力、音量调节能力等。 | ArkTS | 请访问[Samples](https://gitee.com/openharmony/applications_app_samples)仓了解更多信息。 diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.3/changelogs-nfc.md b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.3/changelogs-nfc.md new file mode 100644 index 0000000000000000000000000000000000000000..506de8014aa3d4ea26c6a36c63e51eaa133e1499 --- /dev/null +++ b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.3/changelogs-nfc.md @@ -0,0 +1,61 @@ +# 公共通信子系统NFC JS API变更Changelog + +OpenHarmony 3.2.10.2(Mr)版本相较于OpenHarmony 3.2.beta4版本,分布式数据管理子系统的API变更如下 + +## cl.nfc.1 接口变更 +NFC部分API6到API8部分JS接口不支持抛出错误码,需要删除废弃,然后使用新的API9替换。 + +开发者需要根据以下说明对应用进行适配。 + + **变更影响** + +影响部分API6到API8部分JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- | +| api/@ohos.nfc.cardEmulation.d.ts | cardEmulation | FeatureType | 废弃 | +| api/@ohos.nfc.cardEmulation.d.ts | cardEmulation | isSupported | 废弃 | +| api/@ohos.nfc.cardEmulation.d.ts | cardEmulation | hasHceCapability | 新增 | +| api/@ohos.nfc.controller.d.ts | nfcController | isNfcAvailable | 废弃 | +| api/@ohos.nfc.controller.d.ts | nfcController | openNfc | 废弃 | +| api/@ohos.nfc.controller.d.ts | nfcController | closeNfc | 废弃 | +| api/@ohos.nfc.controller.d.ts | nfcController | enableNfc | 新增 | +| api/@ohos.nfc.controller.d.ts | nfcController | disableNfc | 新增 | +| api/@ohos.nfc.tag.d.ts | tag | getNfcATag | 废弃 | +| api/@ohos.nfc.tag.d.ts | tag | getNfcBTag | 废弃 | +| api/@ohos.nfc.tag.d.ts | tag | getNfcFTag | 废弃 | +| api/@ohos.nfc.tag.d.ts | tag | getNfcVTag | 废弃 | +| api/@ohos.nfc.tag.d.ts | tag | getNfcA | 新增 | +| api/@ohos.nfc.tag.d.ts | tag | getNfcB | 新增 | +| api/@ohos.nfc.tag.d.ts | tag | getNfcF | 新增 | +| api/@ohos.nfc.tag.d.ts | tag | getNfcV | 新增 | +| api/tag/tagSession.d.ts | TagSession | getTagInfo | 废弃 | +| api/tag/tagSession.d.ts | TagSession | connectTag | 废弃 | +| api/tag/tagSession.d.ts | TagSession | reset | 废弃 | +| api/tag/tagSession.d.ts | TagSession | isTagConnected | 废弃 | +| api/tag/tagSession.d.ts | TagSession | setSendDataTimeout | 废弃 | +| api/tag/tagSession.d.ts | TagSession | getSendDataTimeout | 废弃 | +| api/tag/tagSession.d.ts | TagSession | sendData | 废弃 | +| api/tag/tagSession.d.ts | TagSession | getMaxSendLength | 废弃 | +| api/tag/tagSession.d.ts | TagSession | connect | 新增 | +| api/tag/tagSession.d.ts | TagSession | resetConnection | 新增 | +| api/tag/tagSession.d.ts | TagSession | isConnected | 新增 | +| api/tag/tagSession.d.ts | TagSession | setTimeout | 新增 | +| api/tag/tagSession.d.ts | TagSession | getTimeout | 新增 | +| api/tag/tagSession.d.ts | TagSession | transmit | 新增 | +| api/tag/tagSession.d.ts | TagSession | getMaxTransmitSize | 新增 | + +**适配指导** + +查看API开发指南: +[cardEmulation-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-cardEmulation.md) + +[nfcController-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-nfcController.md) + +[tag-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-nfcTag.md) + +[TagSession-API参考](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-tagSession.md) +``` + diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_4.0.3.2/changelogs-account_os_account.md b/zh-cn/release-notes/changelogs/OpenHarmony_4.0.3.2/changelogs-account_os_account.md new file mode 100644 index 0000000000000000000000000000000000000000..ab3394f4e13afe53c829846576a323b719b69dec --- /dev/null +++ b/zh-cn/release-notes/changelogs/OpenHarmony_4.0.3.2/changelogs-account_os_account.md @@ -0,0 +1,391 @@ +# 帐号子系统ChangeLog + +OpenHarmony4.0.3.2版本相较于OpenHarmony之前的版本,帐号模块的API变更如下。 + +## cl.account_os_account.1 应用帐号isAccountRemovable命名变更 + +类Authenticator中的成员函数isAccountRemovable由于命名不统一问题,名称变更为checkAccountRemovable。 + +**变更影响** + +类Authenticator中的成员函数isAccountRemovable,在4.0.3.2版本及后续版本中无法继续正常使用,由checkAccountRemovable代替。 + +**关键的接口/组件变更** + +- 涉及接口 + ```ts + class Authenticator { + ... + isAccountRemovable + ... + } + ``` +- 变更前: + + ```ts + class Authenticator { + ... + /** + * Checks whether the specified account can be removed. + * @param name Indicates the account name. + * @param callback Indicates the authenticator callback. + * @returns void. + * @since 9 + */ + isAccountRemovable(name: string, callback: AuthCallback): void; + ... + } + ``` + +- 变更后: + + ```ts + class Authenticator { + ... + /** + * Checks whether the specified account can be removed. + * @param name Indicates the account name. + * @param callback Indicates the authenticator callback. + * @returns void. + * @since 9 + */ + checkAccountRemovable(name: string, callback: AuthCallback): void; + ... + } + ``` + +## cl.account_os_account.2 系统帐号checkConstraintEnabled命名变更 + +checkConstraintEnabled由于命名不统一问题,名称变更为checkOsAccountConstraintEnabled。 + +**变更影响** + +checkConstraintEnabled接口,在4.0.3.2版本及后续版本中无法继续正常使用,由checkOsAccountConstraintEnabled代替。 + +**关键的接口/组件变更** + +- 涉及接口 +``` +interface AccountManager { + ... + checkConstraintEnabled + ... +} +``` + +- 变更前: + + ```ts + checkConstraintEnabled(localId: number, constraint: string, callback: AsyncCallback): void; + checkConstraintEnabled(localId: number, constraint: string): Promise; + ``` + +- 变更后: + + ```ts + checkOsAccountConstraintEnabled(localId: number, constraint: string, callback: AsyncCallback): void; + checkOsAccountConstraintEnabled(localId: number, constraint: string): Promise; + ``` + +## cl.account_os_account.3 系统帐号checkOsAccountConstraintEnabled权限场景变更 + +checkOsAccountConstraintEnabled接口的权限管控新增可选权限:ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS。 + +**变更影响** + +在4.0.3.2版本及后续版本中,应用申请ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS权限亦可调用checkOsAccountConstraintEnabled, +切此前版本申请ohos.permission.MANAGE_LOCAL_ACCOUNTS权限的不影响使用 + +**关键的接口/组件变更** + +- 涉及接口 +``` +interface AccountManager { + ... + checkOsAccountConstraintEnabled + ... +} +``` + +- 变更前: + + ```ts + ... + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS + ... + checkOsAccountConstraintEnabled(localId: number, constraint: string, callback: AsyncCallback): void; + checkOsAccountConstraintEnabled(localId: number, constraint: string): Promise; + ``` + +- 变更后: + + ```ts + ... + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + ... + checkOsAccountConstraintEnabled(localId: number, constraint: string, callback: AsyncCallback): void; + checkOsAccountConstraintEnabled(localId: number, constraint: string): Promise; + ``` + +## cl.account_os_account.4 系统帐号queryOsAccountLocalIdFromProcessd命名变更 + +queryOsAccountLocalIdFromProcess由于命名不统一问题,名称变更为getOsAccountLocalId。 + +**变更影响** + +queryOsAccountLocalIdFromProcess接口,在4.0.3.2版本及后续版本中无法继续正常使用,由getOsAccountLocalId代替。 + +**关键的接口/组件变更** + +- 涉及接口 +``` +interface AccountManager { + ... + queryOsAccountLocalIdFromProcess + ... +} +``` +- 变更前: + + ```ts + queryOsAccountLocalIdFromProcess(callback: AsyncCallback): void; + queryOsAccountLocalIdFromProcess(): Promise; + ``` + +- 变更后: + + ```ts + getOsAccountLocalId(callback: AsyncCallback): void; + getOsAccountLocalId(): Promise; + ``` + +## cl.account_os_account.5 系统帐号queryOsAccountLocalIdFromUid命名变更 + +queryOsAccountLocalIdFromUid由于命名不统一问题,名称变更为getOsAccountLocalIdForUid。 + +**变更影响** + +queryOsAccountLocalIdFromUid接口,在4.0.3.2版本及后续版本中无法继续正常使用,由getOsAccountLocalIdForUid代替。 + +**关键的接口/组件变更** + +- 涉及接口 +``` +interface AccountManager { + ... + queryOsAccountLocalIdFromUid + ... +} +``` + +- 变更前: + + ```ts + queryOsAccountLocalIdFromUid(uid: number, callback: AsyncCallback): void; + queryOsAccountLocalIdFromUid(uid: number): Promise; + ``` + +- 变更后: + + ```ts + getOsAccountLocalIdForUid(uid: number, callback: AsyncCallback): void; + getOsAccountLocalIdForUid(uid: number): Promise; + ``` + +## cl.account_os_account.6 系统帐号queryOsAccountLocalIdFromDomain命名变更 + +queryOsAccountLocalIdFromDomain由于命名不统一问题,名称变更为getOsAccountLocalIdForDomain。 + +**变更影响** + +queryOsAccountLocalIdFromDomain接口,在4.0.3.2版本及后续版本中无法继续正常使用,由getOsAccountLocalIdForDomain代替。 + +**关键的接口/组件变更** + +- 涉及接口 +``` +interface AccountManager { + ... + queryOsAccountLocalIdFromDomain + ... +} +``` + +- 变更前: + + ```ts + queryOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo, callback: AsyncCallback): void; + queryOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo): Promise; + ``` + +- 变更后: + + ```ts + getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo, callback: AsyncCallback): void; + getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo): Promise; + ``` + +## cl.account_os_account.7 系统帐号getActivatedOsAccountIds命名变更 + +getActivatedOsAccountIds由于命名不统一问题,名称变更为getActivatedOsAccountLocalIds。 + +**变更影响** + +getActivatedOsAccountIds接口,在4.0.3.2版本及后续版本中无法继续正常使用,由getActivatedOsAccountLocalIds代替。 + +**关键的接口/组件变更** + +- 涉及接口 +``` +interface AccountManager { + ... + getActivatedOsAccountIds + ... +} +``` + +- 变更前: + + ```ts + getActivatedOsAccountIds(callback: AsyncCallback>): void; + getActivatedOsAccountIds(): Promise>; + ``` + +- 变更后: + + ```ts + getActivatedOsAccountLocalIds(callback: AsyncCallback>): void; + getActivatedOsAccountLocalIds(): Promise>; + ``` + +## cl.account_os_account.8 系统帐号queryOsAccountLocalIdBySerialNumber命名变更 + +queryOsAccountLocalIdBySerialNumber由于命名不统一问题,名称变更为getOsAccountLocalIdForSerialNumber。 + +**变更影响** + +queryOsAccountLocalIdBySerialNumber接口,在4.0.3.2版本及后续版本中无法继续正常使用,由getOsAccountLocalIdForSerialNumber代替。 + +**关键的接口/组件变更** + +- 涉及接口 +``` +interface AccountManager { + ... + queryOsAccountLocalIdBySerialNumber + ... +} +``` + +- 变更前: + + ```ts + queryOsAccountLocalIdBySerialNumber(serialNumber: number, callback: AsyncCallback): void; + queryOsAccountLocalIdBySerialNumber(serialNumber: number): Promise; + ``` + +- 变更后: + + ```ts + getOsAccountLocalIdForSerialNumber(serialNumber: number, callback: AsyncCallback): void; + getOsAccountLocalIdForSerialNumber(serialNumber: number): Promise; + ``` + +## cl.account_os_account.9 系统帐号querySerialNumberByOsAccountLocalId命名变更 + +querySerialNumberByOsAccountLocalId由于命名不统一问题,名称变更为getSerialNumberForOsAccountLocalId。 + +**变更影响** + +querySerialNumberByOsAccountLocalId接口,在4.0.3.2版本及后续版本中无法继续正常使用,由getSerialNumberForOsAccountLocalId代替。 + +**关键的接口/组件变更** + +- 涉及接口 +``` +interface AccountManager { + ... + querySerialNumberByOsAccountLocalId + ... +} +``` + +- 变更前: + + ```ts + querySerialNumberByOsAccountLocalId(localId: number, callback: AsyncCallback): void; + querySerialNumberByOsAccountLocalId(localId: number): Promise; + ``` + +- 变更后: + + ```ts + getSerialNumberForOsAccountLocalId(localId: number, callback: AsyncCallback): void; + getSerialNumberForOsAccountLocalId(localId: number): Promise; + ``` + +## cl.account_os_account.10 系统帐号getBundleIdFromUid命名变更 + +getBundleIdFromUid由于命名不统一问题,名称变更为getBundleIdForUid。 + +**变更影响** + +getBundleIdFromUid接口,在4.0.3.2版本及后续版本中无法继续正常使用,由getBundleIdForUid代替。 + +**关键的接口/组件变更** + +- 涉及接口 +``` +interface AccountManager { + ... + getBundleIdFromUid + ... +} +``` + +- 变更前: + + ```ts + getBundleIdFromUid(uid: number, callback: AsyncCallback): void; + getBundleIdFromUid(uid: number): Promise; + ``` + +- 变更后: + + ```ts + getBundleIdForUid(uid: number, callback: AsyncCallback): void; + getBundleIdForUid(uid: number): Promise; + ``` + +## cl.account_os_account.11 系统帐号queryOsAccountConstraintSourceTypes命名变更 + +queryOsAccountConstraintSourceTypes由于命名不统一问题,名称变更为getOsAccountConstraintSourceTypes。 + +**变更影响** + +queryOsAccountConstraintSourceTypes接口,在4.0.3.2版本及后续版本中无法继续正常使用,由getOsAccountConstraintSourceTypes代替。 + +**关键的接口/组件变更** + +- 涉及接口 +``` +interface AccountManager { + ... + queryOsAccountConstraintSourceTypes + ... +} +``` + +- 变更前: + + ```ts + queryOsAccountConstraintSourceTypes(localId: number, constraint: string, callback: AsyncCallback>): void; + queryOsAccountConstraintSourceTypes(localId: number, constraint: string): Promise>; + ``` + +- 变更后: + + ```ts + getOsAccountConstraintSourceTypes(localId: number, constraint: string, callback: AsyncCallback>): void; + getOsAccountConstraintSourceTypes(localId: number, constraint: string): Promise>; + ``` \ No newline at end of file