未验证 提交 cb59c070 编写于 作者: O openharmony_ci 提交者: Gitee

!23880 翻译完成:22255+22190 onCreate()与onNewWant()接口中参数名修改

Merge pull request !23880 from wusongqing/TR22255
# Cross-Device Migration # Cross-Device Migration
## When to Use ## When to Use
The main task of cross-device migration is to migrate the current mission (including the page component status) of an application to the target device so that the mission can continue on that device. Cross-device migration supports the following features: Cross-device migration is used to migrate the current mission (including the page component status) of an application to the target device so that the mission can continue on that device. Cross-device migration supports the following features:
- Storage and restoration of custom data
- Storage and restoration of page routing information and page component status data
- Application compatibility detection
- Setting the mission continuation state (**ACTIVE** by default) dynamically
For example, for an editing application, only the text editing page needs to be migrated to the target service. In this case, you can call [setMissionContinueState](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextsetmissioncontinuestate10) for precise control.
- Determining whether to restore the page stack (page stack restored by default) - Saving and restoring custom data
- Saving and restoring page routing information and page component status data
- Checking application compatibility
- Dynamically setting the mission continuation state (**ACTIVE** by default)
If an application wants to customize the page to be displayed after being migrated to the target device, the application can use [SUPPORT_CONTINUE_PAGE_STACK_KEY](../reference/apis/js-apis-app-ability-wantConstant.md#wantconstantparams) for precise control. For example, for an editing application, only the text editing page needs to be migrated to the target device. In this case, you can call [setMissionContinueState](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextsetmissioncontinuestate10) for precise control.
- Determining whether to restore the page stack (restored by default)
If an application wants to customize the page to be displayed after being migrated to the target device, you can use [SUPPORT_CONTINUE_PAGE_STACK_KEY](../reference/apis/js-apis-app-ability-wantConstant.md#wantconstantparams) for precise control.
- Determining whether to exit the application on the initiator after a successful migration (application exit by default) - Determining whether to exit the application on the initiator after a successful migration (application exit by default)
You can use [SUPPORT_CONTINUE_SOURCE_EXIT_KEY](../reference/apis/js-apis-app-ability-wantConstant.md#wantconstantparams) for precise control. You can use [SUPPORT_CONTINUE_SOURCE_EXIT_KEY](../reference/apis/js-apis-app-ability-wantConstant.md#wantconstantparams) for precise control.
...@@ -35,14 +29,9 @@ The following figure shows the cross-device migration process. ...@@ -35,14 +29,9 @@ The following figure shows the cross-device migration process.
## Constraints ## Constraints
- Since cross-device migration mission management is not available, you can only develop applications that support cross-device migration. Your application cannot initiate migration. - The initiation of mission migration depends on system application control. You can implement the control capabilities by following the instructions provided in [Verification Guide](#verification-guide).
- Cross-device migration must be performed between the same UIAbility component. In other words, **bundleName**, **abilityName**, and **signature** of the component on the two devices must be the same.
- Cross-device migration must be performed between the same UIAbility component. In other words, the components must have the same **bundleName**, **abilityName**, and **signature**. - For better user experience, you are advised to use the **wantParam** parameter to transmit data smaller than 100 KB.
## Best Practices
For better user experience, you are advised to use the **wantParam** parameter to transmit data smaller than 100 KB.
## Available APIs ## Available APIs
...@@ -53,24 +42,25 @@ The table below describes the main APIs used for cross-device migration. For det ...@@ -53,24 +42,25 @@ The table below describes the main APIs used for cross-device migration. For det
| **API**| Description| | **API**| Description|
| -------- | -------- | | -------- | -------- |
| onContinue(wantParam : {[key: string]: Object}): OnContinueResult | Called by the initiator to store the data required for migration and indicate whether the migration is accepted.<br>- **AGREE**: The migration is accepted.<br>- **REJECT**: The migration is rejected, for example, when an application is abnormal in **onContinue()**.<br>- **MISMATCH**: The version does not match. The application on the initiator can obtain the version number of the target application from **onContinue()**. If the migration cannot be performed due to version mismatch, this error code is returned.| | onContinue(wantParam : {[key: string]: Object}): OnContinueResult | Called by the initiator to save the data required for migration and specify whether the migration is accepted.<br>- **AGREE**: The migration is accepted.<br>- **REJECT**: The migration is rejected. If the application is abnormal in **onContinue**, which results in abnormal display during data restoration, this error code is returned.<br>- **MISMATCH**: The version does not match. The application on the initiator can obtain the version of the target application from **onContinue**. If the migration cannot be performed due to version mismatch, this error code is returned.|
| onCreate(want: Want, param: AbilityConstant.LaunchParam): void; | Called by the target to restore the data and UI page when the target uses cold start or the target is a multiton application and uses hot start. For details, see [UIAbility Component Launch Type](uiability-launch-type.md).| | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void; | Called by the target to restore the data and UI page if the target uses cold start or the target is a multiton application and uses hot start. For details, see [UIAbility Component Launch Type](uiability-launch-type.md).|
| onNewWant(want: Want, launchParams: AbilityConstant.LaunchParam): void; | Called by the target to restore the data and UI page when the target is a singleton application and uses hot start. For details, see [UIAbility Component Launch Type](uiability-launch-type.md).| | onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void; | Called by the target to restore the data and UI page if the target is a singleton application and uses hot start. For details, see [UIAbility Component Launch Type](uiability-launch-type.md).|
## How to Develop ## How to Develop
1. Request the **ohos.permission.DISTRIBUTED_DATASYNC** permission. For details, see [Declaring Permissions in the Configuration File](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file). 1. Request the **ohos.permission.DISTRIBUTED_DATASYNC** permission.
2. Display a dialog box to ask for authorization from the user when the application is started for the first time. For details, see [Requesting User Authorization](../security/accesstoken-guidelines.md#requesting-user-authorization). For details, see [Declaring Permissions in the Configuration File](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file).
3. Configure the fields related to cross-device migration in the configuration file. 2. Display a dialog box to ask for authorization from the user when the application is started for the first time.
Configure the application to support migration. For details, see [Requesting User Authorization](../security/accesstoken-guidelines.md##requesting-user-authorization).
Set the **continuable** field in the **module.json5** file to **true**. The default value is **false**. If this parameter is set to **false**, the application cannot be continued on the target device. 3. Configure the fields related to cross-device migration in the configuration file.
Configure the application to support migration. Set the **continuable** field in the **module.json5** file to **true**. The default value is **false**. If this parameter is set to **false**, the application cannot be continued on the target device.
```json ```json
{ {
...@@ -88,139 +78,273 @@ The table below describes the main APIs used for cross-device migration. For det ...@@ -88,139 +78,273 @@ The table below describes the main APIs used for cross-device migration. For det
Configure the application launch type. For details, see [UIAbility Component Launch Type](uiability-launch-type.md). Configure the application launch type. For details, see [UIAbility Component Launch Type](uiability-launch-type.md).
4. Implement [onContinue()](../reference/apis/js-apis-app-ability-uiAbility.md#abilityoncontinue) in the UIAbility of the initiator. 4. Implement [onContinue](../reference/apis/js-apis-app-ability-uiAbility.md#abilityoncontinue) in the UIAbility of the initiator.
[onContinue](../reference/apis/js-apis-app-ability-uiAbility.md#abilityoncontinue) is called on the initiator. You can save the data in this method to implement application compatibility check and migration decision-making.
- Saving data to migrate: You can save the data to migrate in key-value pairs in **wantParam**.
- Checking application compatibility: You can obtain the version of the target application from **wantParam.version** of the **onContinue** callback. Then you can check the compatibility between that version and the version of the current application.
- Making a migration decision: You can determine migration is supported based on the return value of **onContinue**. For details about the return values, see [Available APIs](#available-apis).
The sample code is as follows:
```ts
import UIAbility from '@ohos.app.ability.UIAbility';
import AbilityConstant from '@ohos.app.ability.AbilityConstant';
onContinue(wantParam : {[key: string]: Object}) {
console.info(`onContinue version = ${wantParam.version}, targetDevice: ${wantParam.targetDevice}`) // Prepare data to migrate.
let continueInput = 'Data to migrate';
// Save the data to migrate in the custom field (for example, data) of wantParam.
wantParam["data"] = continueInput
console.info(`onContinue input = ${wantParam["input"]}`);
return AbilityConstant.OnContinueResult.AGREE
}
```
5. Restore data and load the UI.
In the stage model, applications with different launch types can call different APIs to restore data and load the UI, as shown below.
![hop-cross-device-migration](figures/hop-cross-device-migration1.png)
Implement **onCreate** and **onNewWant** in the UIAbility on the target device to implement data restoration.
- Implementation example of **onCreate**
- The target device determines whether the startup is **LaunchReason.CONTINUATION** based on **launchReason** in **onCreate**.
- You can obtain the saved data from the **want** parameter.
- After data restoration is complete, call **restoreWindowStage** to trigger page restoration, including page stack information.
```ts
import UIAbility from '@ohos.app.ability.UIAbility';
import AbilityConstant from '@ohos.app.ability.AbilityConstant';
export default class EntryAbility extends UIAbility {
storage : LocalStorage;
onCreate(want, launchParam) {
console.info(`EntryAbility onCreate ${AbilityConstant.LaunchReason.CONTINUATION}`)
if (launchParam.launchReason == AbilityConstant.LaunchReason.CONTINUATION) {
// Obtain the data saved.
let continueInput = want.parameters.data
console.info(`continue input ${continueInput}`)
// Display the data on the current page.
this.storage = new LocalStorage();
this.context.restoreWindowStage(this.storage);
}
}
}
```
- For a singleton application, you must also implement **onNewWant**, in the same way as **onCreate**.
Determine the migration scenario, restore data, and trigger page restoration in **onNewWant**.
```ts
export default class EntryAbility extends UIAbility {
storage : LocalStorage;
onNewWant(want, launchParam) {
console.info(`EntryAbility onNewWant ${AbilityConstant.LaunchReason.CONTINUATION}`)
if (launchParam.launchReason == AbilityConstant.LaunchReason.CONTINUATION) {
// Obtain the user data from the want parameter.
let continueInput = want.parameters.data
console.info(`continue input ${continueInput}`)
this.storage = new LocalStorage();
this.context.restoreWindowStage(this.storage);
}
}
}
```
[onContinue()](../reference/apis/js-apis-app-ability-uiAbility.md#abilityoncontinue) is called on the initiator. You can save the data in this method to implement application compatibility check and migration decision.
- Saving migrated data: You can save the data to be migrated in key-value pairs in **wantParam**.
- Checking application compatibility: You can obtain the version number of the target application from **wantParam** and that of the current application from **wantParam.version** of the **onContinue()** callback. Then you can check the compatibility between the two.
- Making a migration decision: You can determine whether to support the migration based on the return value of **onContinue()**. For details about the return values, see [Available APIs](#available-apis). ## Configuring Optional Migration Features
### Dynamically Setting the Mission Continuation State
Since API version 10, you can dynamically set the mission continuation state. Specifically, you can enable or disable mission migration as required by calling [setMissionContinueState](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextsetmissioncontinuestate10). By default, **ACTIVE** is set for an application that supports migration, indicating that mission continuation is enabled.
| Value | Description |
| :------------------------------------- | ---------------------- |
| AbilityConstant.ContinueState.ACTIVE | Mission continuation is enabled for the application.|
| AbilityConstant.ContinueState.INACTIVE | Mission continuation is disabled for the application.|
**Time for Setting the Mission Continuation State**
The change of the mission migration state can be implemented based on service requirements. Typical methods are as follows:
Call the API in the **onCreate** callback function of the UIAbility to set the mission continuation state when the application is created.
```ts
// EntryAbility.ets
onCreate(want, launchParam) {
...
this.context.setMissionContinueState(AbilityConstant.ContinueState.ACTIVE, (result) => {
console.info('setMissionContinueState ACTIVE result: ', JSON.stringify(result));
};
...
}
```
Call the API in the **onPageShow** callback function of the page to set the mission continuation state when a single page is displayed.
```ts
// PageName.ets
struct PageName {
Build() {
...
}
...
onPageShow(){
// When the page is displayed, set the mission continuation state to ACTIVE.
this.context.setMissionContinueState(AbilityConstant.ContinueState.ACTIVE, (result) => {
console.info('setMissionContinueState ACTIVE result: ', JSON.stringify(result));
};
}
}
```
Set the mission continuation state in the event of a component. For example, set the state in the **onClick** event of the **Button** component.
The sample code is as follows: ```ts
// xxx.ets
```ts Button(){
import UIAbility from '@ohos.app.ability.UIAbility'; ...
import AbilityConstant from '@ohos.app.ability.AbilityConstant'; }
.onClick(()=>{
onContinue(wantParam : {[key: string]: any}) { // When the button is clicked, set the mission continuation state to ACTIVE.
console.info(`onContinue version = ${wantParam.version}, targetDevice: ${wantParam.targetDevice}`) this.context.setMissionContinueState(AbilityConstant.ContinueState.ACTIVE, (result) => {
let workInput = AppStorage.Get<string>('ContinueWork'); console.info('setMissionContinueState ACTIVE result: ', JSON.stringify(result));
// Set the user input data into wantParam. };
wantParam["work"] = workInput // set user input data into want params })
console.info(`onContinue input = ${wantParam["input"]}`); ```
return AbilityConstant.OnContinueResult.AGREE
}
```
5. Implement **onCreate()** and **onNewWant()** in the UIAbility of the target application to implement data restoration. **Ensuring Mission Continuation Continuity**
- Implementation example of **onCreate**
- The target device determines whether the startup is **LaunchReason.CONTINUATION** based on **launchReason** in **onCreate()**. During UI page loading, the target application may have executed the command to set its own mission continuation state (for example, set the state to **INACTIVE** in **onCreate** during cold start or to **INACTIVE** during hot start since the peer has opened a page that cannot be migrated). To ensure a migration back to the initiator, you must set the mission continuation state to **ACTIVE** in **onCreate** and **onNewWant**.
- You can obtain the saved migration data from the **want** parameter.
- After data restoration is complete, call **restoreWindowStage** to trigger page restoration, including page stack information. ```ts
// EntryAbility.ets
```ts onCreate(want, launchparam) {
import UIAbility from '@ohos.app.ability.UIAbility'; ...
import AbilityConstant from '@ohos.app.ability.AbilityConstant'; // Set the mission continuation state to ACTIVE when the launch is caused by continuation. This setting copes with cold start.
import distributedObject from '@ohos.data.distributedDataObject'; if (launchParam.launchReason == AbilityConstant.LaunchReason.CONTINUATION) {
this.context.setMissionContinueState(AbilityConstant.ContinueState.ACTIVE, (result) => {
export default class EntryAbility extends UIAbility { console.info('setMissionContinueState ACTIVE result: ', JSON.stringify(result));
storage : LocalStorage; };
onCreate(want, launchParam) { }
console.info(`EntryAbility onCreate ${AbilityConstant.LaunchReason.CONTINUATION}`) }
if (launchParam.launchReason == AbilityConstant.LaunchReason.CONTINUATION) {
// Obtain the user data from the want parameter. onNewWant(want, launchparam) {
let workInput = want.parameters.work ...
console.info(`work input ${workInput}`) // Set the mission continuation state to ACTIVE when the launch is caused by continuation. This setting copes with hot start.
AppStorage.SetOrCreate<string>('ContinueWork', workInput) if (launchParam.launchReason == AbilityConstant.LaunchReason.CONTINUATION) {
this.storage = new LocalStorage(); this.context.setMissionContinueState(AbilityConstant.ContinueState.ACTIVE, (result) => {
this.context.restoreWindowStage(this.storage); console.info('setMissionContinueState ACTIVE result: ', JSON.stringify(result));
} };
} }
} }
``` ```
- For a singleton application, you must also implement **onNewWant()**, in the same way as **onCreate()**.
- Determine the migration scenario in **onNewWant()**, restore data, and trigger page restoration. ### Migrating the Page Stack on Demand
```ts Configure whether to restore the page stack. By default, the page stack is restored. If an application does not want to use the page stack restored by the system, you can set the page to be displayed on the target device in **onWindowStageRestore**. For details about the configuration, see [SUPPORT_CONTINUE_PAGE_STACK_KEY](../reference/apis/js-apis-app-ability-wantConstant.md#wantconstantparams).
export default class EntryAbility extends UIAbility {
storage : LocalStorage; The index and second routes exist in the page stack of the initiator. However, the target application wants to display a specified page, rather than that of the initiator.
onNewWant(want, launchParam) {
console.info(`EntryAbility onNewWant ${AbilityConstant.LaunchReason.CONTINUATION}`) Example: An application does not want automatically restored page stack information.
if (launchParam.launchReason == AbilityConstant.LaunchReason.CONTINUATION) {
// Obtain the user data from the want parameter. ```ts
let workInput = want.parameters.work import UIAbility from '@ohos.app.ability.UIAbility';
console.info(`work input ${workInput}`) import wantConstant from '@ohos.app.ability.wantConstant';
AppStorage.SetOrCreate<string>('ContinueWork', workInput)
this.storage = new LocalStorage(); onContinue(wantParam : {[key: string]: Object}) {
this.context.restoreWindowStage(this.storage); console.info(`onContinue version = ${wantParam.version}, targetDevice: ${wantParam.targetDevice}`)
} wantParam[wantConstant.Params.SUPPORT_CONTINUE_PAGE_STACK_KEY] = false;
} return AbilityConstant.OnContinueResult.AGREE;
} }
```
onWindowStageRestore(windowStage) {
6. (Optional) Call [setMissionContinueState](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextsetmissioncontinuestate10) to set the mission continuation state. // Set the page to be displayed after the migration.
windowStage.setUIContent(this.contex, "pages/index", null);
}
```
### Exiting the Application on Demand
Configure whether to exit the application on the initiator after a successful migration. By default, the application on the initiator exits. If you do not want the application on the initiator to automatically exit after a successful migration, set the [SUPPORT_CONTINUE_SOURCE_EXIT_KEY](../reference/apis/js-apis-app-ability-wantConstant.md#wantconstantparams) parameter.
Example: An application on the initiator does not exit after a successful migration.
```ts
import UIAbility from '@ohos.app.ability.UIAbility';
import wantConstant from '@ohos.app.ability.wantConstant';
onContinue(wantParam : {[key: string]: Object}) {
console.info(`onContinue version = ${wantParam.version}, targetDevice: ${wantParam.targetDevice}`)
wantParam[wantConstant.Params.SUPPORT_CONTINUE_SOURCE_EXIT_KEY] = false;
return AbilityConstant.OnContinueResult.AGREE;
}
```
## Verification Guide
A mission center demo is provided for you to verify the mission continuation capability of your application. The following walks you through on how to verify mission continuation by using the demo.
### Compiling and Installing the Demo
#### Environment Configuration
[Switch to the full SDK](../faqs/full-sdk-switch-guide.md) on DevEco Studio. This is because the mission center uses the system API [@ohos.distributedDeviceManager](../reference/apis/js-apis-distributedDeviceManager.md), which is not provided in the public SDK.
**NOTE**: The screenshots in this section are for reference only. The DevEco Studio and SDK versions in use prevail.
#### Demo Download
Download the mission center demo from [Sample Code](https://gitee.com/openharmony/ability_dmsfwk/tree/master/services/dtbschedmgr/test/missionCenterDemo/dmsDemo/entry/src/main).
#### Building Project Files
1. Create an empty OpenHarmony project and replace the corresponding folders with the downloaded files.
![hop-cross-device-migration](figures/hop-cross-device-migration2.png)
2. Complete the signature, build, and installation.
The default signature permission provided by the automatic signature template of DevEco Studio is normal. The mission center demo requires the **ohos.permission.MANAGE_MISSIONS** permission, which is at the system_core level. Therefore, you must escalate the permission to the system_core level. Specifically, change **"apl":"normal_core"** to **"apl":"system_core"** in the **UnsgnedReleasedProfileTemplate.json** file in **openharmony\*apiVersion*\toolchains\lib**. Then sign the files as follows:
1. Choose **File > Project Structure**.
For an application that supports migration, mission migration is enabled by default, and the system notifies peripheral trusted devices that a mission can be migrated or canceled based on the gain/loss focus state of the mission. If you want the system to send a notification to peripheral devices only when your application is in a specific scenario, set the migration continuation state to **INACTIVE** when the application is started and change it to **ACTIVE** when the application enters that specific scenario. ![hop-cross-device-migration](figures/hop-cross-device-migration3.png)
- Example: An application does not require migration during startup. 2. Click **Signing Configs** and click **OK**.
```ts ![hop-cross-device-migration](figures/hop-cross-device-migration4.png)
import UIAbility from '@ohos.app.ability.UIAbility';
import AbilityConstant from '@ohos.app.ability.AbilityConstant';
onCreate(want, launchParam) { 3. Connect to the developer board and run the demo.
this.context.setMissionContinueState(AbilityConstant.ContinueState.INACTIVE, (result) => {
console.info(`setMissionContinueState: ${JSON.stringify(result)}`);
});
}
```
- Example: The application requires migration in a specific service process.
```ts ### Device Networking
import UIAbility from '@ohos.app.ability.UIAbility';
import AbilityConstant from '@ohos.app.ability.AbilityConstant';
this.context.setMissionContinueState(AbilityConstant.ContinueState.ACTIVE, (result) => { 1. Open the calculators of devices A and B.
console.info(`setMissionContinueState: ${JSON.stringify(result)}`);
});
```
7. (Optional) Configure whether to restore the page stack. 2. Click the arrow in the upper right corner to select device B.
By default, the page stack is restored. If an application does not want to use the page stack restored by the system, you can set the page to be displayed in **onWindowStageRestore()**. For details about the configuration, see [SUPPORT_CONTINUE_PAGE_STACK_KEY](../reference/apis/js-apis-app-ability-wantConstant.md#wantconstantparams). 3. Select a trusted device on device B. The PIN is displayed.
- Example: An application does not want automatically restored page stack information. 4. Enter the PIN on device A.
```ts 5. Verify the networking. Enter a number on device A. If the number is displayed on device B, the networking is successful.
import UIAbility from '@ohos.app.ability.UIAbility';
import wantConstant from '@ohos.app.ability.wantConstant.d.ts';
onContinue(wantParam : {[key: string]: any}) { ### Initiation Migration
console.info(`onContinue version = ${wantParam.version}, targetDevice: ${wantParam.targetDevice}`)
wantParam[wantConstant.Params.SUPPORT_CONTINUE_PAGE_STACK_KEY] = false;
return AbilityConstant.OnContinueResult.AGREE;
}
onWindowStageRestore(windowStage) { 1. Open your application on device B, and open the mission center demo on device A. The name of device A (Local: OpenHarmony 3.2) and the name of device B (OpenHarmony 3.2) are displayed on device A.
// Set the page to be displayed after the migration.
windowStage.setUIContent(this.contex, "pages/index", null);
}
```
8. (Optional) Configure whether to exit the application on the initiator after a successful migration. ![hop-cross-device-migration](figures/hop-cross-device-migration5.png)
By default, the application on the initiator exits. If you do not want the application on the initiator to automatically exit after a successful migration, set the [SUPPORT_CONTINUE_SOURCE_EXIT_KEY](../reference/apis/js-apis-app-ability-wantConstant.md#wantconstantparams) parameter. 2. Click the name of device B. The application of device B is displayed.
- Example: An application on the initiator does not exit after a successful migration. ![hop-cross-device-migration](figures/hop-cross-device-migration6.png)
```ts 3. Drag the application to the name of device A. The application on device A is started, and the application on device B exits.
import UIAbility from '@ohos.app.ability.UIAbility';
import wantConstant from '@ohos.app.ability.wantConstant.d.ts';
onContinue(wantParam : {[key: string]: any}) { ![hop-cross-device-migration](figures/hop-cross-device-migration7.png)
console.info(`onContinue version = ${wantParam.version}, targetDevice: ${wantParam.targetDevice}`)
wantParam[wantConstant.Params.SUPPORT_CONTINUE_SOURCE_EXIT_KEY] = false;
return AbilityConstant.OnContinueResult.AGREE;
}
```
# Multi-device Collaboration (for System Applications Only) # Multi-device Collaboration
## When to Use ## When to Use
...@@ -57,29 +57,31 @@ On device A, touch the **Start** button provided by the initiator application to ...@@ -57,29 +57,31 @@ On device A, touch the **Start** button provided by the initiator application to
3. Obtain the device ID of the target device. 3. Obtain the device ID of the target device.
```ts ```ts
import deviceManager from '@ohos.distributedHardware.deviceManager'; import deviceManager from '@ohos.distributedDeviceManager';
let dmClass; let dmClass: deviceManager.DeviceManager;
function initDmClass() { function initDmClass() {
// createDeviceManager is a system API. // createDeviceManager is a system API.
deviceManager.createDeviceManager('ohos.samples.demo', (err, dm) => { try{
if (err) { dmClass = deviceManager.createDeviceManager('ohos.samples.demo');
... } catch(err) {
return console.error("createDeviceManager errCode:" + err.code + ",errMessage:" + err.message);
} }
dmClass = dm
})
} }
function getRemoteDeviceId() { function getRemoteDeviceId() {
if (typeof dmClass === 'object' && dmClass !== null) { if (typeof dmClass === 'object' && dmClass !== null) {
let list = dmClass.getTrustedDeviceListSync() let list = dmClass.getAvailableDeviceListSync();
if (typeof (list) === 'undefined' || typeof (list.length) === 'undefined') { if (typeof (list) === 'undefined' || typeof (list.length) === 'undefined') {
console.info('EntryAbility onButtonClick getRemoteDeviceId err: list is null') console.info('getRemoteDeviceId err: list is null');
return;
}
if (list.length === 0) {
console.info("getRemoteDeviceId err: list is empty");
return; return;
} }
return list[0].deviceId return list[0].networkId;
} else { } else {
console.info('EntryAbility onButtonClick getRemoteDeviceId err: dmClass is null') console.info('getRemoteDeviceId err: dmClass is null');
} }
} }
``` ```
...@@ -90,8 +92,8 @@ On device A, touch the **Start** button provided by the initiator application to ...@@ -90,8 +92,8 @@ On device A, touch the **Start** button provided by the initiator application to
let want = { let want = {
deviceId: getRemoteDeviceId(), deviceId: getRemoteDeviceId(),
bundleName: 'com.example.myapplication', bundleName: 'com.example.myapplication',
abilityName: 'FuncAbility', abilityName: 'EntryAbility',
moduleName: 'module1', // moduleName is optional. moduleName: 'entry', // moduleName is optional.
} }
// context is the AbilityContext of the initiator UIAbility. // context is the AbilityContext of the initiator UIAbility.
this.context.startAbility(want).then(() => { this.context.startAbility(want).then(() => {
...@@ -217,7 +219,7 @@ A system application can connect to a service on another device by calling [conn ...@@ -217,7 +219,7 @@ A system application can connect to a service on another device by calling [conn
2. Display a dialog box to ask for authorization from the user when the application is started for the first time. For details, see [Requesting User Authorization](../security/accesstoken-guidelines.md#requesting-user-authorization). 2. Display a dialog box to ask for authorization from the user when the application is started for the first time. For details, see [Requesting User Authorization](../security/accesstoken-guidelines.md#requesting-user-authorization).
3. (Optional) [Implement a background service](serviceextensionability.md#implementing-a-background-service). Perform this operation only if no background service is available. 3. (Optional) [Implement a background service](serviceextensionability.md#implementing-a-background-service-for-system-applications-only). Perform this operation only if no background service is available.
4. Connect to the background service. 4. Connect to the background service.
- Implement the **IAbilityConnection** class. **IAbilityConnection** provides the following callbacks that you should implement: **onConnect()**, **onDisconnect()**, and **onFailed()**. The **onConnect()** callback is invoked when a service is connected, **onDisconnect()** is invoked when a service is unexpectedly disconnected, and **onFailed()** is invoked when the connection to a service fails. - Implement the **IAbilityConnection** class. **IAbilityConnection** provides the following callbacks that you should implement: **onConnect()**, **onDisconnect()**, and **onFailed()**. The **onConnect()** callback is invoked when a service is connected, **onDisconnect()** is invoked when a service is unexpectedly disconnected, and **onFailed()** is invoked when the connection to a service fails.
...@@ -477,8 +479,8 @@ The following describes how to implement multi-device collaboration through cros ...@@ -477,8 +479,8 @@ The following describes how to implement multi-device collaboration through cros
```ts ```ts
const MSG_SEND_METHOD: string = 'CallSendMsg'; const MSG_SEND_METHOD: string = 'CallSendMsg';
originMsg: string = ''; let originMsg: string = '';
backMsg: string = ''; let backMsg: string = '';
async onButtonCallWithResult(originMsg, backMsg) { async onButtonCallWithResult(originMsg, backMsg) {
try { try {
let msg = new MyParcelable(1, originMsg); let msg = new MyParcelable(1, originMsg);
......
...@@ -20,12 +20,15 @@ In OpenHarmony, distributed operations across devices are called continuation (a ...@@ -20,12 +20,15 @@ In OpenHarmony, distributed operations across devices are called continuation (a
- **Multi-device collaboration** - **Multi-device collaboration**
Multi-device collaboration provides users with more efficient and immersive experience than with a single device. A typical multi-device collaboration scenario is as follows: You open the same note on devices A and B. On device A, you select images from the local Gallery, insert them to the note, and edit them. On device B, you edit the text. Another typical scenario is as follows: You are chatting with a customer on device A, and the customer asks for a file, which is stored on device B. You can use the chat software to open the file application on device B, select the required file, and send it back to device A. Then, you use the chat software to send it to the customer. From the perspective of application development, multi-device collaboration enables different UIAbility or ServiceExtensionAbility components to run simultaneously or alternately on multiple devices to provide a complete service, or enables the same UIAbility and ServiceExtensionAbility component to run simultaneously on multiple devices to provide a complete service. Multi-device collaboration provides users with more efficient and immersive experience than with a single device. Multi-device collaboration is used in the following typical scenarios:
- Scenario 1: You open the same note on devices A and B. On device A, you select images from the local Gallery, insert them to the note, and edit them. On device B, you edit the text.
- Scenario 2: : You are chatting with a customer on device A, and the customer asks for a file, which is stored on device B. You can use the chat software to open the file application on device B, select the required file, and send it back to device A. Then, you use the chat software to send it to the customer. From the perspective of application development, multi-device collaboration enables different UIAbility or ServiceExtensionAbility components to run simultaneously or alternately on multiple devices to provide a complete service, or enables the same UIAbility and ServiceExtensionAbility component to run simultaneously on multiple devices to provide a complete service.
## Continuation Architecture ## Continuation Architecture
OpenHarmony provides a set of APIs for you to implement continuation in your applications. The continuation architecture has the following advantages: OpenHarmony provides APIs for you to implement continuation in your applications. The continuation architecture has the following advantages:
- Capabilities such as remote service invocation to facilitate service design - Capabilities such as remote service invocation to facilitate service design
...@@ -39,9 +42,9 @@ The following figure shows the continuation architecture. ...@@ -39,9 +42,9 @@ The following figure shows the continuation architecture.
![hop-structure](figures/hop-structure.png) ![hop-structure](figures/hop-structure.png)
- Cross-device migration mission management: The initiator accepts a migration request from the user, provides a migration entry, and displays the migration result. (This capability is unavailable yet.) - Cross-device migration mission management: The initiator accepts a migration request from the user, provides a migration entry, and displays the migration result.
- Multi-device collaboration mission management: The initiator accepts an application registration request and provides management capabilities such as starting or stopping collaboration and status display. (This capability is unavailable yet.) - Multi-device collaboration mission management: The initiator accepts an application registration request and provides management capabilities such as starting or stopping collaboration and status display.
- Distributed component management: provides capabilities such as remote service startup, remote service connection, and remote migration, and provides applications with cross-device migration or multi-device collaboration based on a combination of these capabilities. - Distributed component management: provides capabilities such as remote service startup, remote service connection, and remote migration, and provides applications with cross-device migration or multi-device collaboration based on a combination of these capabilities.
......
...@@ -6,16 +6,16 @@ ...@@ -6,16 +6,16 @@
| onShow?(): void; | \@ohos.window.d.ts | [on(eventType: 'windowStageEvent', callback: Callback&lt;WindowStageEventType&gt;): void;](../reference/apis/js-apis-window.md#onwindowstageevent9)<br>Listens for the switching to the [foreground](../reference/apis/js-apis-window.md#windowstageeventtype9).| | onShow?(): void; | \@ohos.window.d.ts | [on(eventType: 'windowStageEvent', callback: Callback&lt;WindowStageEventType&gt;): void;](../reference/apis/js-apis-window.md#onwindowstageevent9)<br>Listens for the switching to the [foreground](../reference/apis/js-apis-window.md#windowstageeventtype9).|
| onHide?(): void; | \@ohos.window.d.ts | [on(eventType: 'windowStageEvent', callback: Callback&lt;WindowStageEventType&gt;): void;](../reference/apis/js-apis-window.md#onwindowstageevent9)<br>Listens for the switching to the [background](../reference/apis/js-apis-window.md#windowstageeventtype9).| | onHide?(): void; | \@ohos.window.d.ts | [on(eventType: 'windowStageEvent', callback: Callback&lt;WindowStageEventType&gt;): void;](../reference/apis/js-apis-window.md#onwindowstageevent9)<br>Listens for the switching to the [background](../reference/apis/js-apis-window.md#windowstageeventtype9).|
| onDestroy?(): void; | \@ohos.app.ability.UIAbility.d.ts | [onDestroy(): void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityondestroy) | | onDestroy?(): void; | \@ohos.app.ability.UIAbility.d.ts | [onDestroy(): void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityondestroy) |
| onCreate?(): void; | \@ohos.app.ability.UIAbility.d.ts | [onCreate(want: Want, param: AbilityConstant.LaunchParam): void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityoncreate) | | onCreate?(): void; | \@ohos.app.ability.UIAbility.d.ts | [onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityoncreate) |
| onWindowDisplayModeChanged?(isShownInMultiWindow: boolean, newConfig: resourceManager.Configuration): void; | There is no corresponding API in the stage model.| No corresponding API is provided.| | onWindowDisplayModeChanged?(isShownInMultiWindow: boolean, newConfig: resourceManager.Configuration): void; | There is no corresponding API in the stage model.| No corresponding API is provided.|
| onStartContinuation?(): boolean; | There is no corresponding API in the stage model.| In the stage model, an application does not need to detect whether the continuation is successful (detected when the application initiates the continuation request). Therefore, the **onStartContinuation()** callback is deprecated.| | onStartContinuation?(): boolean; | There is no corresponding API in the stage model.| In the stage model, an application does not need to detect whether the continuation is successful (detected when the application initiates the continuation request). Therefore, the **onStartContinuation()** callback is deprecated.|
| onSaveData?(data: Object): boolean; | \@ohos.app.ability.UIAbility.d.ts | [onContinue(wantParam : {[key: string]: Object}): AbilityConstant.OnContinueResult;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityoncontinue) | | onSaveData?(data: Object): boolean; | \@ohos.app.ability.UIAbility.d.ts | [onContinue(wantParam : {[key: string]: Object}): AbilityConstant.OnContinueResult;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityoncontinue) |
| onCompleteContinuation?(result: number): void; | application\ContinueCallback.d.ts | [onContinueDone(result: number): void;](../reference/apis/js-apis-distributedMissionManager.md#continuecallback) | | onCompleteContinuation?(result: number): void; | application\ContinueCallback.d.ts | [onContinueDone(result: number): void;](../reference/apis/js-apis-distributedMissionManager.md#continuecallback) |
| onRestoreData?(data: Object): void; | \@ohos.app.ability.UIAbility.d.ts | [onCreate(want: Want, param: AbilityConstant.LaunchParam): void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityoncreate)<br>[onNewWant(want: Want, launchParams: AbilityConstant.LaunchParam): void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonnewwant)<br>In multiton or singleton mode, the target ability completes data restoration in the **onCreate()** callback. In the callback, **launchParam.launchReason** is used to determine whether it is a continuation-based launch scenario. If it is, the data saved before continuation can be obtained from the **want** parameter.| | onRestoreData?(data: Object): void; | \@ohos.app.ability.UIAbility.d.ts | [onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityoncreate)<br>[onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonnewwant)<br>In multiton or singleton mode, the target ability completes data restoration in the **onCreate()** callback. In the callback, **launchParam.launchReason** is used to determine whether it is a continuation-based launch scenario. If it is, the data saved before continuation can be obtained from the **want** parameter.|
| onRemoteTerminated?(): void; | application\ContinueCallback.d.ts | [onContinueDone(result: number): void;](../reference/apis/js-apis-distributedMissionManager.md#continuecallback) | | onRemoteTerminated?(): void; | application\ContinueCallback.d.ts | [onContinueDone(result: number): void;](../reference/apis/js-apis-distributedMissionManager.md#continuecallback) |
| onSaveAbilityState?(outState: PacMap): void; | \@ohos.app.ability.UIAbility.d.ts | [onSaveState(reason: AbilityConstant.StateType, wantParam : {[key: string]: Object}): AbilityConstant.OnSaveResult;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonsavestate) | | onSaveAbilityState?(outState: PacMap): void; | \@ohos.app.ability.UIAbility.d.ts | [onSaveState(reason: AbilityConstant.StateType, wantParam : {[key: string]: Object}): AbilityConstant.OnSaveResult;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonsavestate) |
| onRestoreAbilityState?(inState: PacMap): void; | \@ohos.app.ability.UIAbility.d.ts | [onCreate(want: Want, param: AbilityConstant.LaunchParam): void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityoncreate)<br>After an application is restarted, the **onCreate()** callback is triggered. In the callback, **launchParam.launchReason** is used to determine whether it is a self-recovery scenario. If it is, the data saved before the restart can be obtained from the **want** parameter.| | onRestoreAbilityState?(inState: PacMap): void; | \@ohos.app.ability.UIAbility.d.ts | [onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityoncreate)<br>After an application is restarted, the **onCreate()** callback is triggered. In the callback, **launchParam.launchReason** is used to determine whether it is a self-recovery scenario. If it is, the data saved before the restart can be obtained from the **want** parameter.|
| onInactive?(): void; | \@ohos.app.ability.UIAbility.d.ts | [onBackground(): void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonbackground) | | onInactive?(): void; | \@ohos.app.ability.UIAbility.d.ts | [onBackground(): void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonbackground) |
| onActive?(): void; | \@ohos.app.ability.UIAbility.d.ts | [onForeground(): void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonforeground) | | onActive?(): void; | \@ohos.app.ability.UIAbility.d.ts | [onForeground(): void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonforeground) |
| onNewWant?(want: Want): void; | \@ohos.app.ability.UIAbility.d.ts | [onNewWant(want: Want, launchParams: AbilityConstant.LaunchParam): void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonnewwant) | | onNewWant?(want: Want): void; | \@ohos.app.ability.UIAbility.d.ts | [onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void;](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonnewwant) |
| onMemoryLevel?(level: number): void | \@ohos.app.ability.UIAbility.d.ts | [onMemoryLevel(level: AbilityConstant.MemoryLevel): void;](../reference/apis/js-apis-app-ability-ability.md#abilityonmemorylevel) | | onMemoryLevel?(level: number): void | \@ohos.app.ability.UIAbility.d.ts | [onMemoryLevel(level: AbilityConstant.MemoryLevel): void;](../reference/apis/js-apis-app-ability-ability.md#abilityonmemorylevel) |
...@@ -8,30 +8,30 @@ The PageAbility component in the FA model corresponds to the UIAbility component ...@@ -8,30 +8,30 @@ The PageAbility component in the FA model corresponds to the UIAbility component
2. Migrate the PageAbility code to the UIAbility. 2. Migrate the PageAbility code to the UIAbility.
The PageAbility lifecycle is basically the same as the UIAbility lifecycle. The table below describes the details. The PageAbility lifecycle is basically the same as the UIAbility lifecycle. The table below describes the details.
| PageAbility| UIAbility| Mapping Description| | PageAbility| UIAbility| Mapping Description|
| -------- | -------- | -------- | | -------- | -------- | -------- |
| onCreate(): void| onCreate(want: Want, param: AbilityConstant.LaunchParam): void | The two methods have the same meaning and invoking time. In the stage model, parameters are added to the callback so that you can obtain startup-related data during creation.| | onCreate(): void| onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void | The two methods have the same meaning and invoking time. In the stage model, parameters are added to the callback so that you can obtain startup-related data during creation.|
| NA | onWindowStageCreate(windowStage: window.WindowStage): void| This method is available only in the stage model. The callback is invoked when a window is created.| | NA | onWindowStageCreate(windowStage: window.WindowStage): void| This method is available only in the stage model. The callback is invoked when a window is created.|
| onActive(): void | on(eventType: 'windowStageEvent', callback: Callback&lt;WindowStageEventType&gt;): void;<br>WindowStageEventType.ACTIVE | The two methods have the same meaning and invoking time. In the stage model, this method is moved to the window object.| | onActive(): void | on(eventType: 'windowStageEvent', callback: Callback&lt;WindowStageEventType&gt;): void;<br>WindowStageEventType.ACTIVE | The two methods have the same meaning and invoking time. In the stage model, this method is moved to the window object.|
| onShow(): void | onForeground(): void | The two methods have the same meaning, invoking time, and parameters.| | onShow(): void | onForeground(): void | The two methods have the same meaning, invoking time, and parameters.|
| onNewWant(want: Want): void| onNewWant(want: Want, launchParams: AbilityConstant.LaunchParam): void| The two methods have the same meaning and invoking time. In the stage model, the **LaunchParam** parameter is added to notify the application of the startup cause.| | onNewWant(want: Want): void| onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void | The two methods have the same meaning and invoking time. In the stage model, the **LaunchParam** parameter is added to notify the application of the startup cause.|
| onInactive(): void| on(eventType: 'windowStageEvent', callback: Callback&lt;WindowStageEventType&gt;): void;<br>WindowStageEventType.INACTIVE | The two methods have the same meaning and invoking time. In the stage model, this method is moved to the window object.| | onInactive(): void| on(eventType: 'windowStageEvent', callback: Callback&lt;WindowStageEventType&gt;): void;<br>WindowStageEventType.INACTIVE | The two methods have the same meaning and invoking time. In the stage model, this method is moved to the window object.|
| onHide(): void | onBackground(): void | The two methods have the same meaning, invoking time, and parameters.| | onHide(): void | onBackground(): void | The two methods have the same meaning, invoking time, and parameters.|
| NA | onWindowStageDestroy(): void | This method is available only in the stage model. The callback is invoked when a window is destroyed.| | NA | onWindowStageDestroy(): void | This method is available only in the stage model. The callback is invoked when a window is destroyed.|
| onDestroy(): void | onDestroy(): void | The two methods have the same meaning, invoking time, and parameters.| | onDestroy(): void | onDestroy(): void | The two methods have the same meaning, invoking time, and parameters.|
![pageability-switch](figures/pageability-switch.png) ![pageability-switch](figures/pageability-switch.png)
3. Adjust the migrated code, since the methods of loading pages are different. 3. Adjust the migrated code, since the methods of loading pages are different.
- In the FA model, you can configure the page to be loaded by setting page information in **config.json**. - In the FA model, you can configure the page to be loaded by setting page information in **config.json**.
- In the stage model, call **windowStage.loadContent** in the **onWindowStageCreate** callback to load a page. - In the stage model, call **windowStage.loadContent** in the **onWindowStageCreate** callback to load a page.
For example, to load the **pages/Index** page after the ability is started, use the following code in the **config.json** file in the FA model: For example, to load the **pages/Index** page after the ability is started, use the following code in the **config.json** file in the FA model:
```json ```json
"pages" : [ "pages" : [
"pages/Index" "pages/Index"
...@@ -39,8 +39,7 @@ The PageAbility lifecycle is basically the same as the UIAbility lifecycle. The ...@@ -39,8 +39,7 @@ The PageAbility lifecycle is basically the same as the UIAbility lifecycle. The
``` ```
In the stage model, implement the following method in **MainAbility**: In the stage model, implement the following method in **MainAbility**:
```ts ```ts
import Window from '@ohos.window' import Window from '@ohos.window'
...@@ -53,4 +52,4 @@ The PageAbility lifecycle is basically the same as the UIAbility lifecycle. The ...@@ -53,4 +52,4 @@ The PageAbility lifecycle is basically the same as the UIAbility lifecycle. The
} }
}); });
} }
``` ```
\ No newline at end of file
...@@ -29,7 +29,7 @@ This scenario is possible when an application contains multiple UIAbility compon ...@@ -29,7 +29,7 @@ This scenario is possible when an application contains multiple UIAbility compon
Assume that your application has two UIAbility components: EntryAbility and FuncAbility, either in the same module or different modules. To start FuncAbility from EntryAbility, proceed as follows: Assume that your application has two UIAbility components: EntryAbility and FuncAbility, either in the same module or different modules. To start FuncAbility from EntryAbility, proceed as follows:
1. In EntryAbility, call [startAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability) and pass the [want](../reference/apis/js-apis-app-ability-want.md) parameter to start the UIAbility instance. In the **want** parameter, **bundleName** indicates the bundle name of the application to start; **abilityName** indicates the name of the UIAbility to start; **moduleName** is required only when the target UIAbility belongs to a different module from EntryAbility; **parameters** is used to carry custom information. For details about how to obtain the context in the example, see [Obtaining the Context of UIAbility](uiability-usage.md#obtaining-the-context-of-uiability). 1. In EntryAbility, call [startAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability) and pass the [want](../reference/apis/js-apis-app-ability-want.md) parameter to start the UIAbility instance. In the **want** parameter, **bundleName** indicates the bundle name of the application to start; **abilityName** indicates the name of the UIAbility to start; **moduleName** is required only when the target UIAbility belongs to a different module from EntryAbility; **parameters** is used to carry custom information. For details about how to obtain the context in the example, see [Obtaining the Context of UIAbility](uiability-usage.md#obtaining-the-context-of-uiability).
```ts ```ts
let context = ...; // UIAbilityContext let context = ...; // UIAbilityContext
let want = { let want = {
...@@ -48,12 +48,12 @@ Assume that your application has two UIAbility components: EntryAbility and Func ...@@ -48,12 +48,12 @@ Assume that your application has two UIAbility components: EntryAbility and Func
console.error(`Failed to start ability. Code is ${err.code}, message is ${err.message}`); console.error(`Failed to start ability. Code is ${err.code}, message is ${err.message}`);
}) })
``` ```
2. In FuncAbility, use [onCreate()](../reference/apis/js-apis-app-ability-uiAbility.md#uiabilityoncreate) or [onNewWant()](../reference/apis/js-apis-app-ability-uiAbility.md#uiabilityonnewwant) to receive the parameters passed in by EntryAbility. 2. In FuncAbility, use [onCreate()](../reference/apis/js-apis-app-ability-uiAbility.md#uiabilityoncreate) or [onNewWant()](../reference/apis/js-apis-app-ability-uiAbility.md#uiabilityonnewwant) to receive the parameters passed in by EntryAbility.
```ts ```ts
import UIAbility from '@ohos.app.ability.UIAbility'; import UIAbility from '@ohos.app.ability.UIAbility';
export default class FuncAbility extends UIAbility { export default class FuncAbility extends UIAbility {
onCreate(want, launchParam) { onCreate(want, launchParam) {
// Receive the parameters passed by the initiator UIAbility. // Receive the parameters passed by the initiator UIAbility.
...@@ -63,16 +63,16 @@ Assume that your application has two UIAbility components: EntryAbility and Func ...@@ -63,16 +63,16 @@ Assume that your application has two UIAbility components: EntryAbility and Func
} }
} }
``` ```
> **NOTE** > **NOTE**
> >
> In FuncAbility started, you can obtain the PID and bundle name of the UIAbility through **parameters** in the passed **want** parameter. > In FuncAbility started, you can obtain the PID and bundle name of the UIAbility through **parameters** in the passed **want** parameter.
3. To stop the **UIAbility** instance after the FuncAbility service is not needed, call [terminateSelf()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateself) in FuncAbility. 3. To stop the **UIAbility** instance after the FuncAbility service is not needed, call [terminateSelf()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateself) in FuncAbility.
```ts ```ts
let context = ...; // UIAbilityContext let context = ...; // UIAbilityContext
// context is the UIAbilityContext of the UIAbility instance to stop. // context is the UIAbilityContext of the UIAbility instance to stop.
context.terminateSelf((err) => { context.terminateSelf((err) => {
if (err.code) { if (err.code) {
...@@ -81,11 +81,11 @@ Assume that your application has two UIAbility components: EntryAbility and Func ...@@ -81,11 +81,11 @@ Assume that your application has two UIAbility components: EntryAbility and Func
} }
}); });
``` ```
> **NOTE** > **NOTE**
> >
> When [terminateSelf()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateself) is called to stop the **UIAbility** instance, the snapshot of the instance is retained by default. That is, the mission corresponding to the instance is still displayed in Recents. If you do not want to retain the snapshot, set **removeMissionAfterTerminate** under the [abilities](../quick-start/module-configuration-file.md#abilities) tag to **true** in the [module.json5 file](../quick-start/module-configuration-file.md) of the corresponding UIAbility. > When [terminateSelf()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateself) is called to stop the **UIAbility** instance, the snapshot of the instance is retained by default. That is, the mission corresponding to the instance is still displayed in Recents. If you do not want to retain the snapshot, set **removeMissionAfterTerminate** under the [abilities](../quick-start/module-configuration-file.md#abilities) tag to **true** in the [module.json5 file](../quick-start/module-configuration-file.md) of the corresponding UIAbility.
4. To stop all UIAbility instances of the application, call [killProcessBySelf()](../reference/apis/js-apis-inner-application-applicationContext.md#applicationcontextkillallprocesses9) of [ApplicationContext](../reference/apis/js-apis-inner-application-applicationContext.md). 4. To stop all UIAbility instances of the application, call [killProcessBySelf()](../reference/apis/js-apis-inner-application-applicationContext.md#applicationcontextkillallprocesses9) of [ApplicationContext](../reference/apis/js-apis-inner-application-applicationContext.md).
...@@ -94,7 +94,7 @@ Assume that your application has two UIAbility components: EntryAbility and Func ...@@ -94,7 +94,7 @@ Assume that your application has two UIAbility components: EntryAbility and Func
When starting FuncAbility from EntryAbility, you may want the result to be returned after the FuncAbility service is finished. For example, after the sign-in operation is finished in the sign-in UIAbility of your application, you want the sign-in result to be returned to the entry UIAbility. When starting FuncAbility from EntryAbility, you may want the result to be returned after the FuncAbility service is finished. For example, after the sign-in operation is finished in the sign-in UIAbility of your application, you want the sign-in result to be returned to the entry UIAbility.
1. In EntryAbility, call [startAbilityForResult()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateselfwithresult) to start FuncAbility. Use **data** in the asynchronous callback to receive information returned after FuncAbility stops itself. For details about how to obtain the context in the example, see [Obtaining the Context of UIAbility](uiability-usage.md#obtaining-the-context-of-uiability). 1. In EntryAbility, call [startAbilityForResult()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateselfwithresult) to start FuncAbility. Use **data** in the asynchronous callback to receive information returned after FuncAbility stops itself. For details about how to obtain the context in the example, see [Obtaining the Context of UIAbility](uiability-usage.md#obtaining-the-context-of-uiability).
```ts ```ts
let context = ...; // UIAbilityContext let context = ...; // UIAbilityContext
let want = { let want = {
...@@ -113,9 +113,9 @@ When starting FuncAbility from EntryAbility, you may want the result to be retur ...@@ -113,9 +113,9 @@ When starting FuncAbility from EntryAbility, you may want the result to be retur
console.error(`Failed to start ability for result. Code is ${err.code}, message is ${err.message}`); console.error(`Failed to start ability for result. Code is ${err.code}, message is ${err.message}`);
}) })
``` ```
2. Call [terminateSelfWithResult()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateselfwithresult) to stop FuncAbility. Use the input parameter **abilityResult** to carry the information that FuncAbility needs to return to EntryAbility. 2. Call [terminateSelfWithResult()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateselfwithresult) to stop FuncAbility. Use the input parameter **abilityResult** to carry the information that FuncAbility needs to return to EntryAbility.
```ts ```ts
let context = ...; // UIAbilityContext let context = ...; // UIAbilityContext
const RESULT_CODE: number = 1001; const RESULT_CODE: number = 1001;
...@@ -138,15 +138,15 @@ When starting FuncAbility from EntryAbility, you may want the result to be retur ...@@ -138,15 +138,15 @@ When starting FuncAbility from EntryAbility, you may want the result to be retur
} }
}); });
``` ```
3. After FuncAbility stops itself, EntryAbility uses [startAbilityForResult()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateselfwithresult) to receive the information returned by FuncAbility. The value of **RESULT_CODE** must be the same as that specified in the preceding step. 3. After FuncAbility stops itself, EntryAbility uses [startAbilityForResult()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateselfwithresult) to receive the information returned by FuncAbility. The value of **RESULT_CODE** must be the same as that specified in the preceding step.
```ts ```ts
let context = ...; // UIAbilityContext let context = ...; // UIAbilityContext
const RESULT_CODE: number = 1001; const RESULT_CODE: number = 1001;
... ...
// context is the UIAbilityContext of the initiator UIAbility. // context is the UIAbilityContext of the initiator UIAbility.
context.startAbilityForResult(want).then((data) => { context.startAbilityForResult(want).then((data) => {
if (data?.resultCode === RESULT_CODE) { if (data?.resultCode === RESULT_CODE) {
...@@ -173,7 +173,7 @@ There are two ways to start **UIAbility**: [explicit and implicit](want-overview ...@@ -173,7 +173,7 @@ There are two ways to start **UIAbility**: [explicit and implicit](want-overview
The following example describes how to start the UIAbility of another application through implicit Want. The following example describes how to start the UIAbility of another application through implicit Want.
1. Install multiple document applications on your device. In the [module.json5 file](../quick-start/module-configuration-file.md) of each UIAbility component, configure **entities** and **actions** under **skills**. 1. Install multiple document applications on your device. In the [module.json5 file](../quick-start/module-configuration-file.md) of each UIAbility component, configure **entities** and **actions** under **skills**.
```json ```json
{ {
"module": { "module": {
...@@ -199,7 +199,7 @@ The following example describes how to start the UIAbility of another applicatio ...@@ -199,7 +199,7 @@ The following example describes how to start the UIAbility of another applicatio
``` ```
2. Include **entities** and **actions** of the initiator UIAbility's **want** parameter into **entities** and **actions** under **skills** of the target UIAbility. After the system identifies the UIAbility instances that match the **entities** and **actions** information, a dialog box is displayed, showing the list of matching UIAbility instances for users to select. For details about how to obtain the context in the example, see [Obtaining the Context of UIAbility](uiability-usage.md#obtaining-the-context-of-uiability). 2. Include **entities** and **actions** of the initiator UIAbility's **want** parameter into **entities** and **actions** under **skills** of the target UIAbility. After the system identifies the UIAbility instances that match the **entities** and **actions** information, a dialog box is displayed, showing the list of matching UIAbility instances for users to select. For details about how to obtain the context in the example, see [Obtaining the Context of UIAbility](uiability-usage.md#obtaining-the-context-of-uiability).
```ts ```ts
let context = ...; // UIAbilityContext let context = ...; // UIAbilityContext
let want = { let want = {
...@@ -210,7 +210,7 @@ The following example describes how to start the UIAbility of another applicatio ...@@ -210,7 +210,7 @@ The following example describes how to start the UIAbility of another applicatio
// entities can be omitted. // entities can be omitted.
entities: ['entity.system.default'], entities: ['entity.system.default'],
} }
// context is the UIAbilityContext of the initiator UIAbility. // context is the UIAbilityContext of the initiator UIAbility.
context.startAbility(want).then(() => { context.startAbility(want).then(() => {
console.info('Succeeded in starting ability.'); console.info('Succeeded in starting ability.');
...@@ -218,16 +218,16 @@ The following example describes how to start the UIAbility of another applicatio ...@@ -218,16 +218,16 @@ The following example describes how to start the UIAbility of another applicatio
console.error(`Failed to start ability. Code is ${err.code}, message is ${err.message}`); console.error(`Failed to start ability. Code is ${err.code}, message is ${err.message}`);
}) })
``` ```
The following figure shows the effect. When you click **Open PDF**, a dialog box is displayed for you to select the application to use. The following figure shows the effect. When you click **Open PDF**, a dialog box is displayed for you to select the application to use.
![](figures/uiability-intra-device-interaction.png) ![](figures/uiability-intra-device-interaction.png)
3. To stop the **UIAbility** instance when the document application is not in use, call [terminateSelf()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateself). 3. To stop the **UIAbility** instance when the document application is not in use, call [terminateSelf()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateself).
```ts ```ts
let context = ...; // UIAbilityContext let context = ...; // UIAbilityContext
// context is the UIAbilityContext of the UIAbility instance to stop. // context is the UIAbilityContext of the UIAbility instance to stop.
context.terminateSelf((err) => { context.terminateSelf((err) => {
if (err.code) { if (err.code) {
...@@ -243,7 +243,7 @@ The following example describes how to start the UIAbility of another applicatio ...@@ -243,7 +243,7 @@ The following example describes how to start the UIAbility of another applicatio
If you want to obtain the return result when using implicit Want to start the UIAbility of another application, use [startAbilityForResult()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateselfwithresult). An example scenario is that your application needs to start a third-party payment application and obtain the payment result. If you want to obtain the return result when using implicit Want to start the UIAbility of another application, use [startAbilityForResult()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateselfwithresult). An example scenario is that your application needs to start a third-party payment application and obtain the payment result.
1. In the [module.json5 file](../quick-start/module-configuration-file.md) of the UIAbility corresponding to the payment application, set **entities** and **actions** under **skills**. 1. In the [module.json5 file](../quick-start/module-configuration-file.md) of the UIAbility corresponding to the payment application, set **entities** and **actions** under **skills**.
```json ```json
{ {
"module": { "module": {
...@@ -269,7 +269,7 @@ If you want to obtain the return result when using implicit Want to start the UI ...@@ -269,7 +269,7 @@ If you want to obtain the return result when using implicit Want to start the UI
``` ```
2. Call [startAbilityForResult()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateselfwithresult) to start the UIAbility of the payment application. Include **entities** and **actions** of the initiator UIAbility's **want** parameter into **entities** and **actions** under **skills** of the target UIAbility. Use **data** in the asynchronous callback to receive the information returned to the initiator UIAbility after the payment UIAbility stops itself. After the system identifies the UIAbility instances that match the **entities** and **actions** information, a dialog box is displayed, showing the list of matching UIAbility instances for users to select. 2. Call [startAbilityForResult()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateselfwithresult) to start the UIAbility of the payment application. Include **entities** and **actions** of the initiator UIAbility's **want** parameter into **entities** and **actions** under **skills** of the target UIAbility. Use **data** in the asynchronous callback to receive the information returned to the initiator UIAbility after the payment UIAbility stops itself. After the system identifies the UIAbility instances that match the **entities** and **actions** information, a dialog box is displayed, showing the list of matching UIAbility instances for users to select.
```ts ```ts
let context = ...; // UIAbilityContext let context = ...; // UIAbilityContext
let want = { let want = {
...@@ -280,7 +280,7 @@ If you want to obtain the return result when using implicit Want to start the UI ...@@ -280,7 +280,7 @@ If you want to obtain the return result when using implicit Want to start the UI
// entities can be omitted. // entities can be omitted.
entities: ['entity.system.default'] entities: ['entity.system.default']
} }
// context is the UIAbilityContext of the initiator UIAbility. // context is the UIAbilityContext of the initiator UIAbility.
context.startAbilityForResult(want).then((data) => { context.startAbilityForResult(want).then((data) => {
... ...
...@@ -288,9 +288,9 @@ If you want to obtain the return result when using implicit Want to start the UI ...@@ -288,9 +288,9 @@ If you want to obtain the return result when using implicit Want to start the UI
console.error(`Failed to start ability for result. Code is ${err.code}, message is ${err.message}`); console.error(`Failed to start ability for result. Code is ${err.code}, message is ${err.message}`);
}) })
``` ```
3. After the payment is finished, call [terminateSelfWithResult()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateselfwithresult) to stop the payment UIAbility and return the **abilityResult** parameter. 3. After the payment is finished, call [terminateSelfWithResult()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateselfwithresult) to stop the payment UIAbility and return the **abilityResult** parameter.
```ts ```ts
let context = ...; // UIAbilityContext let context = ...; // UIAbilityContext
const RESULT_CODE: number = 1001; const RESULT_CODE: number = 1001;
...@@ -313,17 +313,17 @@ If you want to obtain the return result when using implicit Want to start the UI ...@@ -313,17 +313,17 @@ If you want to obtain the return result when using implicit Want to start the UI
} }
}); });
``` ```
4. Receive the information returned by the payment application in the callback of the [startAbilityForResult()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateselfwithresult) method. The value of **RESULT_CODE** must be the same as that returned by [terminateSelfWithResult()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateselfwithresult). 4. Receive the information returned by the payment application in the callback of the [startAbilityForResult()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateselfwithresult) method. The value of **RESULT_CODE** must be the same as that returned by [terminateSelfWithResult()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateselfwithresult).
```ts ```ts
let context = ...; // UIAbilityContext let context = ...; // UIAbilityContext
const RESULT_CODE: number = 1001; const RESULT_CODE: number = 1001;
let want = { let want = {
// Want parameter information. // Want parameter information.
}; };
// context is the UIAbilityContext of the initiator UIAbility. // context is the UIAbilityContext of the initiator UIAbility.
context.startAbilityForResult(want).then((data) => { context.startAbilityForResult(want).then((data) => {
if (data?.resultCode === RESULT_CODE) { if (data?.resultCode === RESULT_CODE) {
...@@ -350,8 +350,8 @@ The window mode is specified by the **windowMode** field in the [StartOptions](. ...@@ -350,8 +350,8 @@ The window mode is specified by the **windowMode** field in the [StartOptions](.
> **NOTE** > **NOTE**
> >
> 1. If the **windowMode** field is not specified, the UIAbility is started in the default window mode. > - If the **windowMode** field is not specified, the UIAbility is started in the default window mode.
> 2. To ensure that the application can be displayed in the required window mode, check the **supportWindowMode** field under [abilities](../quick-start/module-configuration-file.md#abilities) in the [module.json5 file](../quick-start/module-configuration-file.md) of the UIAbility and make sure the specified window mode is supported. > - To ensure that the application can be displayed in the required window mode, check the **supportWindowMode** field under [abilities](../quick-start/module-configuration-file.md#abilities) in the [module.json5 file](../quick-start/module-configuration-file.md) of the UIAbility and make sure the specified window mode is supported.
The following describes how to start the FuncAbility from the EntryAbility page and display it in floating window mode. The following describes how to start the FuncAbility from the EntryAbility page and display it in floating window mode.
...@@ -472,7 +472,7 @@ U->>S: Open the SMS app. ...@@ -472,7 +472,7 @@ U->>S: Open the SMS app.
S-->>U: The home page of the SMS app is displayed. S-->>U: The home page of the SMS app is displayed.
U->>S: Return to the home screen. U->>S: Return to the home screen.
S->>S: The SMS app enters the background. S->>S: The SMS app enters the background.
U->>C: Open the Contacts app. U->>C: Open the Contacts app.
C-->>U: The page of the Contact app is displayed. C-->>U: The page of the Contact app is displayed.
U->>C: Touch the SMS button next to a contact. U->>C: Touch the SMS button next to a contact.
C->>S: Start the SMS app with Want. C->>S: Start the SMS app with Want.
...@@ -488,19 +488,19 @@ The development procedure is as follows: ...@@ -488,19 +488,19 @@ The development procedure is as follows:
import UIAbility from '@ohos.app.ability.UIAbility'; import UIAbility from '@ohos.app.ability.UIAbility';
import Want from '@ohos.app.ability.Want'; import Want from '@ohos.app.ability.Want';
import window from '@ohos.window'; import window from '@ohos.window';
import { Router, UIContext } from '@ohos.arkui.UIContext'; import { Router, UIContext } from '@ohos.arkui.UIContext';
export default class EntryAbility extends UIAbility { export default class EntryAbility extends UIAbility {
funcAbilityWant: Want; funcAbilityWant: Want;
uiContext: UIContext; uiContext: UIContext;
... ...
onWindowStageCreate(windowStage: window.WindowStage) { onWindowStageCreate(windowStage: window.WindowStage) {
// Main window is created. Set a main page for this UIAbility. // Main window is created. Set a main page for this UIAbility.
... ...
let windowClass: window.Window; let windowClass: window.Window;
windowStage.getMainWindow((err, data) => { windowStage.getMainWindow((err, data) => {
if (err.code) { if (err.code) {
...@@ -520,8 +520,8 @@ The development procedure is as follows: ...@@ -520,8 +520,8 @@ The development procedure is as follows:
export default class EntryAbility extends UIAbility { export default class EntryAbility extends UIAbility {
funcAbilityWant: Want; funcAbilityWant: Want;
uiContext: UIContext; uiContext: UIContext;
onNewWant(want: Want, launchParams: AbilityConstant.LaunchParam) { onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam) {
if (want?.parameters?.router && want.parameters.router === 'funcA') { if (want?.parameters?.router && want.parameters.router === 'funcA') {
let funcAUrl = 'pages/Second'; let funcAUrl = 'pages/Second';
let router: Router = this.uiContext.getRouter(); let router: Router = this.uiContext.getRouter();
...@@ -532,7 +532,7 @@ The development procedure is as follows: ...@@ -532,7 +532,7 @@ The development procedure is as follows:
}) })
} }
} }
... ...
} }
``` ```
...@@ -580,9 +580,9 @@ The following figure shows the call process. ...@@ -580,9 +580,9 @@ The following figure shows the call process.
> **NOTE** > **NOTE**
> - Currently, only system applications can use the call. > - Currently, only system applications can use the call.
> >
> - The launch type of the CalleeAbility must be **singleton**. > - The launch type of the CalleeAbility must be **singleton**.
> >
> - Both local (intra-device) and cross-device calls are supported. The following describes how to initiate a local call. For details about how to initiate a cross-device call, see [Using Cross-Device Call](hop-multi-device-collaboration.md#using-cross-device-call). > - Both local (intra-device) and cross-device calls are supported. The following describes how to initiate a local call. For details about how to initiate a cross-device call, see [Using Cross-Device Call](hop-multi-device-collaboration.md#using-cross-device-call).
...@@ -614,24 +614,24 @@ The implementation of using the call for UIAbility interaction involves two part ...@@ -614,24 +614,24 @@ The implementation of using the call for UIAbility interaction involves two part
For the CalleeAbility, implement the callback to receive data and the methods to marshal and unmarshal data. When data needs to be received, use **on()** to register a listener. When data does not need to be received, use **off()** to deregister the listener. For the CalleeAbility, implement the callback to receive data and the methods to marshal and unmarshal data. When data needs to be received, use **on()** to register a listener. When data does not need to be received, use **off()** to deregister the listener.
1. Configure the launch type of the CalleeAbility. 1. Configure the launch type of the CalleeAbility.
For example, set the launch type of the CalleeAbility to **singleton**. For details, see [UIAbility Component Launch Type](uiability-launch-type.md). For example, set the launch type of the CalleeAbility to **singleton**. For details, see [UIAbility Component Launch Type](uiability-launch-type.md).
2. Import the **UIAbility** module. 2. Import the **UIAbility** module.
```ts ```ts
import UIAbility from '@ohos.app.ability.UIAbility'; import UIAbility from '@ohos.app.ability.UIAbility';
``` ```
3. Define the agreed parcelable data. 3. Define the agreed parcelable data.
The data formats sent and received by the CallerAbility and CalleeAbility must be consistent. In the following example, the data formats are number and string.
The data formats sent and received by the CallerAbility and CalleeAbility must be consistent. In the following example, the data formats are number and string.
```ts ```ts
export default class MyParcelable { export default class MyParcelable {
num: number = 0; num: number = 0;
str: string = ''; str: string = '';
constructor(num, string) { constructor(num, string) {
this.num = num; this.num = num;
this.str = string; this.str = string;
...@@ -650,9 +650,9 @@ For the CalleeAbility, implement the callback to receive data and the methods to ...@@ -650,9 +650,9 @@ For the CalleeAbility, implement the callback to receive data and the methods to
} }
} }
``` ```
4. Implement **Callee.on** and **Callee.off**.
4. Implement **Callee.on** and **Callee.off**.
The time to register a listener for the CalleeAbility depends on your application. The data sent and received before the listener is registered and that after the listener is deregistered are not processed. In the following example, the **MSG_SEND_METHOD** listener is registered in **onCreate** of the UIAbility and deregistered in **onDestroy**. After receiving parcelable data, the application processes the data and returns the data result. You need to implement processing based on service requirements. The sample code is as follows: The time to register a listener for the CalleeAbility depends on your application. The data sent and received before the listener is registered and that after the listener is deregistered are not processed. In the following example, the **MSG_SEND_METHOD** listener is registered in **onCreate** of the UIAbility and deregistered in **onDestroy**. After receiving parcelable data, the application processes the data and returns the data result. You need to implement processing based on service requirements. The sample code is as follows:
...@@ -696,7 +696,7 @@ For the CalleeAbility, implement the callback to receive data and the methods to ...@@ -696,7 +696,7 @@ For the CalleeAbility, implement the callback to receive data and the methods to
### Accessing the CalleeAbility ### Accessing the CalleeAbility
1. Import the **UIAbility** module. 1. Import the **UIAbility** module.
```ts ```ts
import UIAbility from '@ohos.app.ability.UIAbility'; import UIAbility from '@ohos.app.ability.UIAbility';
``` ```
...@@ -735,4 +735,4 @@ For the CalleeAbility, implement the callback to receive data and the methods to ...@@ -735,4 +735,4 @@ For the CalleeAbility, implement the callback to receive data and the methods to
console.err(`Failed to get caller. Code is ${err.code}, message is ${err.message}`); console.err(`Failed to get caller. Code is ${err.code}, message is ${err.message}`);
} }
} }
``` ```
\ No newline at end of file
...@@ -6,8 +6,8 @@ UIAbility is an application component that has the UI. The **UIAbility** module ...@@ -6,8 +6,8 @@ UIAbility is an application component that has the UI. The **UIAbility** module
- [Callee](#callee): an internal object of UIAbility. The CalleeAbility (callee) uses this object to communicate with the CallerAbility (caller). - [Callee](#callee): an internal object of UIAbility. The CalleeAbility (callee) uses this object to communicate with the CallerAbility (caller).
> **NOTE** > **NOTE**
> >
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. > 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 APIs of this module can be used only in the stage model.
## Modules to Import ## Modules to Import
...@@ -29,7 +29,7 @@ import UIAbility from '@ohos.app.ability.UIAbility'; ...@@ -29,7 +29,7 @@ import UIAbility from '@ohos.app.ability.UIAbility';
## UIAbility.onCreate ## UIAbility.onCreate
onCreate(want: Want, param: AbilityConstant.LaunchParam): void; onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void;
Called to initialize the service logic when a UIAbility is created. Called to initialize the service logic when a UIAbility is created.
...@@ -46,7 +46,7 @@ Called to initialize the service logic when a UIAbility is created. ...@@ -46,7 +46,7 @@ Called to initialize the service logic when a UIAbility is created.
```ts ```ts
class MyUIAbility extends UIAbility { class MyUIAbility extends UIAbility {
onCreate(want, param) { onCreate(want, launchParam) {
console.log('onCreate, want: ${want.abilityName}'); console.log('onCreate, want: ${want.abilityName}');
} }
} }
...@@ -68,7 +68,7 @@ Called when a **WindowStage** is created for this UIAbility. ...@@ -68,7 +68,7 @@ Called when a **WindowStage** is created for this UIAbility.
| windowStage | [window.WindowStage](js-apis-window.md#windowstage9) | Yes| **WindowStage** information.| | windowStage | [window.WindowStage](js-apis-window.md#windowstage9) | Yes| **WindowStage** information.|
**Example** **Example**
```ts ```ts
class MyUIAbility extends UIAbility { class MyUIAbility extends UIAbility {
onWindowStageCreate(windowStage) { onWindowStageCreate(windowStage) {
...@@ -87,7 +87,7 @@ Called when the **WindowStage** is destroyed for this UIAbility. ...@@ -87,7 +87,7 @@ Called when the **WindowStage** is destroyed for this UIAbility.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Example** **Example**
```ts ```ts
class MyUIAbility extends UIAbility { class MyUIAbility extends UIAbility {
onWindowStageDestroy() { onWindowStageDestroy() {
...@@ -112,7 +112,7 @@ Called when the **WindowStage** is restored during the migration of this UIAbili ...@@ -112,7 +112,7 @@ Called when the **WindowStage** is restored during the migration of this UIAbili
| windowStage | [window.WindowStage](js-apis-window.md#windowstage9) | Yes| **WindowStage** information.| | windowStage | [window.WindowStage](js-apis-window.md#windowstage9) | Yes| **WindowStage** information.|
**Example** **Example**
```ts ```ts
class MyUIAbility extends UIAbility { class MyUIAbility extends UIAbility {
onWindowStageRestore(windowStage) { onWindowStageRestore(windowStage) {
...@@ -131,7 +131,7 @@ Called when this UIAbility is destroyed to clear resources. ...@@ -131,7 +131,7 @@ Called when this UIAbility is destroyed to clear resources.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Example** **Example**
```ts ```ts
class MyUIAbility extends UIAbility { class MyUIAbility extends UIAbility {
...@@ -161,7 +161,7 @@ Called when this UIAbility is switched from the background to the foreground. ...@@ -161,7 +161,7 @@ Called when this UIAbility is switched from the background to the foreground.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Example** **Example**
```ts ```ts
class MyUIAbility extends UIAbility { class MyUIAbility extends UIAbility {
onForeground() { onForeground() {
...@@ -180,7 +180,7 @@ Called when this UIAbility is switched from the foreground to the background. ...@@ -180,7 +180,7 @@ Called when this UIAbility is switched from the foreground to the background.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Example** **Example**
```ts ```ts
class MyUIAbility extends UIAbility { class MyUIAbility extends UIAbility {
onBackground() { onBackground() {
...@@ -211,7 +211,7 @@ Called to save data during the ability migration preparation process. ...@@ -211,7 +211,7 @@ Called to save data during the ability migration preparation process.
| [AbilityConstant.OnContinueResult](js-apis-app-ability-abilityConstant.md#abilityconstantoncontinueresult) | Continuation result.| | [AbilityConstant.OnContinueResult](js-apis-app-ability-abilityConstant.md#abilityconstantoncontinueresult) | Continuation result.|
**Example** **Example**
```ts ```ts
import AbilityConstant from '@ohos.app.ability.AbilityConstant'; import AbilityConstant from '@ohos.app.ability.AbilityConstant';
class MyUIAbility extends UIAbility { class MyUIAbility extends UIAbility {
...@@ -226,7 +226,7 @@ Called to save data during the ability migration preparation process. ...@@ -226,7 +226,7 @@ Called to save data during the ability migration preparation process.
## UIAbility.onNewWant ## UIAbility.onNewWant
onNewWant(want: Want, launchParams: AbilityConstant.LaunchParam): void; onNewWant(want: Want, launchParam: 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 UIAbility is started again.
...@@ -237,15 +237,15 @@ Called when a new Want is passed in and this UIAbility is started again. ...@@ -237,15 +237,15 @@ Called when a new Want is passed in and this UIAbility is started again.
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| want | [Want](js-apis-app-ability-want.md) | Yes| Want information, such as the ability name and bundle name.| | 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.| | launchParam | [AbilityConstant.LaunchParam](js-apis-app-ability-abilityConstant.md#abilityconstantlaunchparam) | Yes| Reason for the UIAbility startup and the last abnormal exit.|
**Example** **Example**
```ts ```ts
class MyUIAbility extends UIAbility { class MyUIAbility extends UIAbility {
onNewWant(want, launchParams) { onNewWant(want, launchParam) {
console.log('onNewWant, want: ${want.abilityName}'); console.log('onNewWant, want: ${want.abilityName}');
console.log('onNewWant, launchParams: ${JSON.stringify(launchParams)}'); console.log('onNewWant, launchParam: ${JSON.stringify(launchParam)}');
} }
} }
``` ```
...@@ -265,7 +265,7 @@ Dumps client information. ...@@ -265,7 +265,7 @@ Dumps client information.
| params | Array\<string> | Yes| Parameters in the form of a command.| | params | Array\<string> | Yes| Parameters in the form of a command.|
**Example** **Example**
```ts ```ts
class MyUIAbility extends UIAbility { class MyUIAbility extends UIAbility {
onDump(params) { onDump(params) {
...@@ -315,7 +315,7 @@ class MyUIAbility extends UIAbility { ...@@ -315,7 +315,7 @@ class MyUIAbility extends UIAbility {
onShare(wantParam:{ [key: string]: Object }): void; onShare(wantParam:{ [key: string]: Object }): void;
Called by this UIAbility to set data to share. **ohos.extra.param.key.shareUrl** indicates the online address of the service. Called by this UIAbility to set data to share in the cross-device sharing scenario.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
...@@ -323,10 +323,10 @@ Called by this UIAbility to set data to share. **ohos.extra.param.key.shareUrl** ...@@ -323,10 +323,10 @@ Called by this UIAbility to set data to share. **ohos.extra.param.key.shareUrl**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| wantParam | {[key:&nbsp;string]:&nbsp;Object} | Yes| **want** parameter.| | wantParam | {[key:&nbsp;string]:&nbsp;Object} | Yes| Data to share.|
**Example** **Example**
```ts ```ts
import AbilityConstant from '@ohos.app.ability.AbilityConstant'; import AbilityConstant from '@ohos.app.ability.AbilityConstant';
class MyUIAbility extends UIAbility { class MyUIAbility extends UIAbility {
...@@ -419,7 +419,7 @@ Sends sequenceable data to the target ability. ...@@ -419,7 +419,7 @@ Sends sequenceable data to the target ability.
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example** **Example**
```ts ```ts
class MyMessageAble{ // Custom parcelable data structure. class MyMessageAble{ // Custom parcelable data structure.
name:'' name:''
...@@ -569,7 +569,7 @@ Releases the caller interface of the target ability. ...@@ -569,7 +569,7 @@ Releases the caller interface of the target ability.
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example** **Example**
```ts ```ts
let caller; let caller;
export default class MainUIAbility extends UIAbility { export default class MainUIAbility extends UIAbility {
...@@ -615,7 +615,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error ...@@ -615,7 +615,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
| callback | [OnReleaseCallback](#onreleasecallback) | Yes| Callback used to return the result.| | callback | [OnReleaseCallback](#onreleasecallback) | Yes| Callback used to return the result.|
**Example** **Example**
```ts ```ts
let caller; let caller;
export default class MainUIAbility extends UIAbility { export default class MainUIAbility extends UIAbility {
...@@ -663,7 +663,7 @@ Registers a callback that is invoked when the remote ability state changes in th ...@@ -663,7 +663,7 @@ Registers a callback that is invoked when the remote ability state changes in th
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example** **Example**
```ts ```ts
import UIAbility from '@ohos.app.ability.UIAbility'; import UIAbility from '@ohos.app.ability.UIAbility';
import window from '@ohos.window'; import window from '@ohos.window';
...@@ -717,7 +717,7 @@ Registers a callback that is invoked when the stub on the target ability is disc ...@@ -717,7 +717,7 @@ Registers a callback that is invoked when the stub on the target ability is disc
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example** **Example**
```ts ```ts
let caller; let caller;
export default class MainUIAbility extends UIAbility { export default class MainUIAbility extends UIAbility {
...@@ -764,7 +764,7 @@ Deregisters a callback that is invoked when the stub on the target ability is di ...@@ -764,7 +764,7 @@ Deregisters a callback that is invoked when the stub on the target ability is di
| 401 | If the input parameter is not valid parameter. | | 401 | If the input parameter is not valid parameter. |
**Example** **Example**
```ts ```ts
let caller; let caller;
export default class MainUIAbility extends UIAbility { export default class MainUIAbility extends UIAbility {
...@@ -806,7 +806,7 @@ Deregisters a callback that is invoked when the stub on the target ability is di ...@@ -806,7 +806,7 @@ Deregisters a callback that is invoked when the stub on the target ability is di
| type | string | Yes| Event type. The value is fixed at **release**.| | type | string | Yes| Event type. The value is fixed at **release**.|
**Example** **Example**
```ts ```ts
let caller; let caller;
export default class MainUIAbility extends UIAbility { export default class MainUIAbility extends UIAbility {
...@@ -823,7 +823,7 @@ Deregisters a callback that is invoked when the stub on the target ability is di ...@@ -823,7 +823,7 @@ Deregisters a callback that is invoked when the stub on the target ability is di
}; };
caller.on('release', onReleaseCallBack); caller.on('release', onReleaseCallBack);
caller.off('release'); caller.off('release');
} catch (error) { } catch (error) {
console.error('Caller.on or Caller.off catch error, error.code: ${error.code}, error.message: ${error.message}'); console.error('Caller.on or Caller.off catch error, error.code: ${error.code}, error.message: ${error.message}');
} }
}).catch((err) => { }).catch((err) => {
...@@ -929,7 +929,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error ...@@ -929,7 +929,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
**Example** **Example**
```ts ```ts
let method = 'call_Function'; let method = 'call_Function';
export default class MainUIAbility extends UIAbility { export default class MainUIAbility extends UIAbility {
......
...@@ -257,7 +257,7 @@ ...@@ -257,7 +257,7 @@
|Added|NA|Module name: ohos.app.ability.UIAbility<br>Class name: UIAbility<br>Method or attribute name: launchWant: Want;|@ohos.app.ability.UIAbility.d.ts| |Added|NA|Module name: ohos.app.ability.UIAbility<br>Class name: UIAbility<br>Method or attribute name: launchWant: Want;|@ohos.app.ability.UIAbility.d.ts|
|Added|NA|Module name: ohos.app.ability.UIAbility<br>Class name: UIAbility<br>Method or attribute name: lastRequestWant: Want;|@ohos.app.ability.UIAbility.d.ts| |Added|NA|Module name: ohos.app.ability.UIAbility<br>Class name: UIAbility<br>Method or attribute name: lastRequestWant: Want;|@ohos.app.ability.UIAbility.d.ts|
|Added|NA|Module name: ohos.app.ability.UIAbility<br>Class name: UIAbility<br>Method or attribute name: callee: Callee;|@ohos.app.ability.UIAbility.d.ts| |Added|NA|Module name: ohos.app.ability.UIAbility<br>Class name: UIAbility<br>Method or attribute name: callee: Callee;|@ohos.app.ability.UIAbility.d.ts|
|Added|NA|Module name: ohos.app.ability.UIAbility<br>Class name: UIAbility<br>Method or attribute name: onCreate(want: Want, param: AbilityConstant.LaunchParam): void;|@ohos.app.ability.UIAbility.d.ts| |Added|NA|Module name: ohos.app.ability.UIAbility<br>Class name: UIAbility<br>Method or attribute name: onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void;|@ohos.app.ability.UIAbility.d.ts|
|Added|NA|Module name: ohos.app.ability.UIAbility<br>Class name: UIAbility<br>Method or attribute name: onWindowStageCreate(windowStage: window.WindowStage): void;|@ohos.app.ability.UIAbility.d.ts| |Added|NA|Module name: ohos.app.ability.UIAbility<br>Class name: UIAbility<br>Method or attribute name: onWindowStageCreate(windowStage: window.WindowStage): void;|@ohos.app.ability.UIAbility.d.ts|
|Added|NA|Module name: ohos.app.ability.UIAbility<br>Class name: UIAbility<br>Method or attribute name: onWindowStageDestroy(): void;|@ohos.app.ability.UIAbility.d.ts| |Added|NA|Module name: ohos.app.ability.UIAbility<br>Class name: UIAbility<br>Method or attribute name: onWindowStageDestroy(): void;|@ohos.app.ability.UIAbility.d.ts|
|Added|NA|Module name: ohos.app.ability.UIAbility<br>Class name: UIAbility<br>Method or attribute name: onWindowStageRestore(windowStage: window.WindowStage): void;|@ohos.app.ability.UIAbility.d.ts| |Added|NA|Module name: ohos.app.ability.UIAbility<br>Class name: UIAbility<br>Method or attribute name: onWindowStageRestore(windowStage: window.WindowStage): void;|@ohos.app.ability.UIAbility.d.ts|
...@@ -265,7 +265,7 @@ ...@@ -265,7 +265,7 @@
|Added|NA|Module name: ohos.app.ability.UIAbility<br>Class name: UIAbility<br>Method or attribute name: onForeground(): void;|@ohos.app.ability.UIAbility.d.ts| |Added|NA|Module name: ohos.app.ability.UIAbility<br>Class name: UIAbility<br>Method or attribute name: onForeground(): void;|@ohos.app.ability.UIAbility.d.ts|
|Added|NA|Module name: ohos.app.ability.UIAbility<br>Class name: UIAbility<br>Method or attribute name: onBackground(): void;|@ohos.app.ability.UIAbility.d.ts| |Added|NA|Module name: ohos.app.ability.UIAbility<br>Class name: UIAbility<br>Method or attribute name: onBackground(): void;|@ohos.app.ability.UIAbility.d.ts|
|Added|NA|Module name: ohos.app.ability.UIAbility<br>Class name: UIAbility<br>Method or attribute name: onContinue(wantParam: { [key: string]: Object }): AbilityConstant.OnContinueResult;|@ohos.app.ability.UIAbility.d.ts| |Added|NA|Module name: ohos.app.ability.UIAbility<br>Class name: UIAbility<br>Method or attribute name: onContinue(wantParam: { [key: string]: Object }): AbilityConstant.OnContinueResult;|@ohos.app.ability.UIAbility.d.ts|
|Added|NA|Module name: ohos.app.ability.UIAbility<br>Class name: UIAbility<br>Method or attribute name: onNewWant(want: Want, launchParams: AbilityConstant.LaunchParam): void;|@ohos.app.ability.UIAbility.d.ts| |Added|NA|Module name: ohos.app.ability.UIAbility<br>Class name: UIAbility<br>Method or attribute name: onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void;|@ohos.app.ability.UIAbility.d.ts|
|Added|NA|Module name: ohos.app.ability.UIAbility<br>Class name: UIAbility<br>Method or attribute name: onDump(params: Array\<string>): Array\<string>;|@ohos.app.ability.UIAbility.d.ts| |Added|NA|Module name: ohos.app.ability.UIAbility<br>Class name: UIAbility<br>Method or attribute name: onDump(params: Array\<string>): Array\<string>;|@ohos.app.ability.UIAbility.d.ts|
|Added|NA|Module name: ohos.app.ability.UIAbility<br>Class name: UIAbility<br>Method or attribute name: onSaveState(reason: AbilityConstant.StateType, wantParam : {[key: string]: Object}): AbilityConstant.OnSaveResult;|@ohos.app.ability.UIAbility.d.ts| |Added|NA|Module name: ohos.app.ability.UIAbility<br>Class name: UIAbility<br>Method or attribute name: onSaveState(reason: AbilityConstant.StateType, wantParam : {[key: string]: Object}): AbilityConstant.OnSaveResult;|@ohos.app.ability.UIAbility.d.ts|
|Added|NA|Module name: ohos.app.ability.Want<br>Class name: Want|@ohos.app.ability.Want.d.ts| |Added|NA|Module name: ohos.app.ability.Want<br>Class name: Want|@ohos.app.ability.Want.d.ts|
......
...@@ -73,5 +73,5 @@ The table below lists the APIs changes of the ability framework in OpenHarmony 3 ...@@ -73,5 +73,5 @@ The table below lists the APIs changes of the ability framework in OpenHarmony 3
| FormExtensionContext | FormExtensionContext | updateForm(formId: string, formBindingData: formBindingData.FormBindingData, callback: AsyncCallback\<void>): void;<br>updateForm(formId: string, formBindingData: formBindingData.FormBindingData): Promise\<void>; | Deleted| | FormExtensionContext | FormExtensionContext | updateForm(formId: string, formBindingData: formBindingData.FormBindingData, callback: AsyncCallback\<void>): void;<br>updateForm(formId: string, formBindingData: formBindingData.FormBindingData): Promise\<void>; | Deleted|
| ServiceExtensionContext | ServiceExtensionContext | extensionAbilityInfo: ExtensionAbilityInfo; | Deleted| | ServiceExtensionContext | ServiceExtensionContext | extensionAbilityInfo: ExtensionAbilityInfo; | Deleted|
| ohos.application.appManager | appManager | getProcessRunningInfos(): Promise\<Array\<ProcessRunningInfo>>;<br>getProcessRunningInfos(callback: AsyncCallback\<Array\<ProcessRunningInfo>>): void; | Deprecated| | ohos.application.appManager | appManager | getProcessRunningInfos(): Promise\<Array\<ProcessRunningInfo>>;<br>getProcessRunningInfos(callback: AsyncCallback\<Array\<ProcessRunningInfo>>): void; | Deprecated|
| ohos.application.Ability | Ability | old : onNewWant(want: Want): void;<br>new : onNewWant(want: Want, launchParams: AbilityConstant.LaunchParam): void; | Updated| | ohos.application.Ability | Ability | old : onNewWant(want: Want): void;<br>new : onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void; | Updated|
| ohos.application.Ability | Callee | old : on(method: string, callback: CaleeCallBack): void;<br>new : on(method: string, callback: CalleeCallBack): void; | Updated| | ohos.application.Ability | Callee | old : on(method: string, callback: CaleeCallBack): void;<br>new : on(method: string, callback: CalleeCallBack): void; | Updated|
\ No newline at end of file
| Change Type | Old Version | New Version | d.ts File | | Change Type | Old Version | New Version | .d.ts File |
| ---- | ------ | ------ | -------- | | ---- | ------ | ------ | -------- |
|Added|NA|Module name: ohos.app.ability.dataUriUtils<br>Class name: dataUriUtils|@ohos.app.ability.dataUriUtils.d.ts| |Added|NA|Module name: ohos.app.ability.dataUriUtils<br>Class name: dataUriUtils|@ohos.app.ability.dataUriUtils.d.ts|
|Added|NA|Module name: ohos.app.ability.dataUriUtils<br>Class name: dataUriUtils<br>Method or attribute name: function getId(uri: string): number|@ohos.app.ability.dataUriUtils.d.ts| |Added|NA|Module name: ohos.app.ability.dataUriUtils<br>Class name: dataUriUtils<br>Method or attribute name: function getId(uri: string): number|@ohos.app.ability.dataUriUtils.d.ts|
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
|Deleted|Module name: ohos.application.Ability<br>Class name: Ability<br>Method or attribute name: launchWant: Want;|NA|@ohos.application.Ability.d.ts| |Deleted|Module name: ohos.application.Ability<br>Class name: Ability<br>Method or attribute name: launchWant: Want;|NA|@ohos.application.Ability.d.ts|
|Deleted|Module name: ohos.application.Ability<br>Class name: Ability<br>Method or attribute name: lastRequestWant: Want;|NA|@ohos.application.Ability.d.ts| |Deleted|Module name: ohos.application.Ability<br>Class name: Ability<br>Method or attribute name: lastRequestWant: Want;|NA|@ohos.application.Ability.d.ts|
|Deleted|Module name: ohos.application.Ability<br>Class name: Ability<br>Method or attribute name: callee: Callee;|NA|@ohos.application.Ability.d.ts| |Deleted|Module name: ohos.application.Ability<br>Class name: Ability<br>Method or attribute name: callee: Callee;|NA|@ohos.application.Ability.d.ts|
|Deleted|Module name: ohos.application.Ability<br>Class name: Ability<br>Method or attribute name: onCreate(want: Want, param: AbilityConstant.LaunchParam): void;|NA|@ohos.application.Ability.d.ts| |Deleted|Module name: ohos.application.Ability<br>Class name: Ability<br>Method or attribute name: onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void;|NA|@ohos.application.Ability.d.ts|
|Deleted|Module name: ohos.application.Ability<br>Class name: Ability<br>Method or attribute name: onWindowStageCreate(windowStage: window.WindowStage): void;|NA|@ohos.application.Ability.d.ts| |Deleted|Module name: ohos.application.Ability<br>Class name: Ability<br>Method or attribute name: onWindowStageCreate(windowStage: window.WindowStage): void;|NA|@ohos.application.Ability.d.ts|
|Deleted|Module name: ohos.application.Ability<br>Class name: Ability<br>Method or attribute name: onWindowStageDestroy(): void;|NA|@ohos.application.Ability.d.ts| |Deleted|Module name: ohos.application.Ability<br>Class name: Ability<br>Method or attribute name: onWindowStageDestroy(): void;|NA|@ohos.application.Ability.d.ts|
|Deleted|Module name: ohos.application.Ability<br>Class name: Ability<br>Method or attribute name: onWindowStageRestore(windowStage: window.WindowStage): void;|NA|@ohos.application.Ability.d.ts| |Deleted|Module name: ohos.application.Ability<br>Class name: Ability<br>Method or attribute name: onWindowStageRestore(windowStage: window.WindowStage): void;|NA|@ohos.application.Ability.d.ts|
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
|Deleted|Module name: ohos.application.Ability<br>Class name: Ability<br>Method or attribute name: onForeground(): void;|NA|@ohos.application.Ability.d.ts| |Deleted|Module name: ohos.application.Ability<br>Class name: Ability<br>Method or attribute name: onForeground(): void;|NA|@ohos.application.Ability.d.ts|
|Deleted|Module name: ohos.application.Ability<br>Class name: Ability<br>Method or attribute name: onBackground(): void;|NA|@ohos.application.Ability.d.ts| |Deleted|Module name: ohos.application.Ability<br>Class name: Ability<br>Method or attribute name: onBackground(): void;|NA|@ohos.application.Ability.d.ts|
|Deleted|Module name: ohos.application.Ability<br>Class name: Ability<br>Method or attribute name: onContinue(wantParam : {[key: string]: any}): AbilityConstant.OnContinueResult;|NA|@ohos.application.Ability.d.ts| |Deleted|Module name: ohos.application.Ability<br>Class name: Ability<br>Method or attribute name: onContinue(wantParam : {[key: string]: any}): AbilityConstant.OnContinueResult;|NA|@ohos.application.Ability.d.ts|
|Deleted|Module name: ohos.application.Ability<br>Class name: Ability<br>Method or attribute name: onNewWant(want: Want, launchParams: AbilityConstant.LaunchParam): void;|NA|@ohos.application.Ability.d.ts| |Deleted|Module name: ohos.application.Ability<br>Class name: Ability<br>Method or attribute name: onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void;|NA|@ohos.application.Ability.d.ts|
|Deleted|Module name: ohos.application.Ability<br>Class name: Ability<br>Method or attribute name: onConfigurationUpdated(config: Configuration): void;|NA|@ohos.application.Ability.d.ts| |Deleted|Module name: ohos.application.Ability<br>Class name: Ability<br>Method or attribute name: onConfigurationUpdated(config: Configuration): void;|NA|@ohos.application.Ability.d.ts|
|Deleted|Module name: ohos.application.Ability<br>Class name: Ability<br>Method or attribute name: dump(params: Array<string>): Array<string>;|NA|@ohos.application.Ability.d.ts| |Deleted|Module name: ohos.application.Ability<br>Class name: Ability<br>Method or attribute name: dump(params: Array<string>): Array<string>;|NA|@ohos.application.Ability.d.ts|
|Deleted|Module name: ohos.application.Ability<br>Class name: Ability<br>Method or attribute name: onMemoryLevel(level: AbilityConstant.MemoryLevel): void;|NA|@ohos.application.Ability.d.ts| |Deleted|Module name: ohos.application.Ability<br>Class name: Ability<br>Method or attribute name: onMemoryLevel(level: AbilityConstant.MemoryLevel): void;|NA|@ohos.application.Ability.d.ts|
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册