diff --git a/en/application-dev/IDL/idl-guidelines.md b/en/application-dev/IDL/idl-guidelines.md
index f165215bad4d663b794c249f8029d33aeeda5863..b770a7bb881b780ff7b231f04fe02bc18aa3026e 100644
--- a/en/application-dev/IDL/idl-guidelines.md
+++ b/en/application-dev/IDL/idl-guidelines.md
@@ -158,7 +158,7 @@ Go to the local installation path, choose **toolchains > 3.x.x.x** (the folder n
> **NOTE**: Use the SDK of the latest version. The use of an earlier version may cause errors in some statements.
-If the executable file does not exist, download the SDK package from the mirror as instructed in the [Release Notes](../../release-notes). The following uses the [3.2 Beta3](../../release-notes/OpenHarmony-v3.2-beta3.md#acquiring-source-code-from-mirrors) as an example.
+If the executable file does not exist, download the SDK package from the mirror as instructed in the [Release Notes](../../release-notes). The following uses the [3.2 Beta5]((../../release-notes/OpenHarmony-v3.2-beta5.md#acquiring-source-code-from-mirrors) as an example.
For details about how to replace the SDK package, see [Guide to Switching to Full SDK](../quick-start/full-sdk-switch-guide.md).
diff --git a/en/application-dev/application-models/fa-model-development-overview.md b/en/application-dev/application-models/fa-model-development-overview.md
index 07e7ef8a0bdaea927762c15e4123ae728c026cb7..b717de91538d4369881cb5c62bdc52f56a11b62c 100644
--- a/en/application-dev/application-models/fa-model-development-overview.md
+++ b/en/application-dev/application-models/fa-model-development-overview.md
@@ -12,4 +12,4 @@ During application development based on the Feature Ability (FA) model, the foll
| Inter-process communication (IPC)| Learn the process model and common IPC modes of the FA model.| [Common Events](common-event-fa.md)
[Background Services](rpc.md) |
| Inter-thread communication| Learn the thread model and common inter-thread communication modes of the FA model.| [Inter-Thread Communication](itc-fa-overview.md)|
| Mission management| Learn the basic concepts and typical scenarios of mission management in the FA model.| [Mission Management](mission-management-fa.md)|
-| Application configuration file| Learn the requirements for developing application configuration files in the FA model.| [Application Configuration File](config-file-fa.md) |
+| Application configuration file| Learn the requirements for developing application configuration files in the FA model.| [Application Configuration File](../quick-start/application-configuration-file-overview-fa.md) |
diff --git a/en/application-dev/application-models/hop-multi-device-collaboration.md b/en/application-dev/application-models/hop-multi-device-collaboration.md
index 50fa38b975f137a508063869ac2760beb2dbbcdb..1bea57d43a5b3a3284a1a20a0abc6f888c8a6c33 100644
--- a/en/application-dev/application-models/hop-multi-device-collaboration.md
+++ b/en/application-dev/application-models/hop-multi-device-collaboration.md
@@ -47,19 +47,19 @@ On device A, touch the **Start** button provided by the initiator application to
### How to Develop
-1. Request the **ohos.permission.DISTRIBUTED_DATASYNC** permission. For details, see [Permission Application Guide](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file).
+1. Request the **ohos.permission.DISTRIBUTED_DATASYNC** permission. For details, see [Applying for Permissions](../security/accesstoken-guidelines.md#stage-model).
2. Request the data synchronization permission. The sample code for displaying a dialog box to request the permission is as follows:
```ts
requestPermission() {
- let context = this.context;
- let permissions: Array = ['ohos.permission.DISTRIBUTED_DATASYNC'];
- context.requestPermissionsFromUser(permissions).then((data) => {
- console.info("Succeed to request permission from user with data: "+ JSON.stringify(data));
- }).catch((error) => {
- console.info("Failed to request permission from user with error: "+ JSON.stringify(error));
- })
+ let context = this.context
+ let permissions: Array = ['ohos.permission.DISTRIBUTED_DATASYNC']
+ context.requestPermissionsFromUser(permissions).then((data) => {
+ console.info("Succeed to request permission from user with data: "+ JSON.stringify(data))
+ }).catch((error) => {
+ console.info("Failed to request permission from user with error: "+ JSON.stringify(error))
+ })
}
```
@@ -129,19 +129,19 @@ On device A, touch the **Start** button provided by the initiator application to
### How to Develop
-1. Request the **ohos.permission.DISTRIBUTED_DATASYNC** permission. For details, see [Permission Application Guide](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file).
+1. Request the **ohos.permission.DISTRIBUTED_DATASYNC** permission. For details, see [Applying for Permissions](../security/accesstoken-guidelines.md#stage-model).
2. Request the data synchronization permission. The sample code for displaying a dialog box to request the permission is as follows:
```ts
requestPermission() {
- let context = this.context;
- let permissions: Array = ['ohos.permission.DISTRIBUTED_DATASYNC'];
- context.requestPermissionsFromUser(permissions).then((data) => {
- console.info("Succeed to request permission from user with data: "+ JSON.stringify(data));
- }).catch((error) => {
- console.info("Failed to request permission from user with error: "+ JSON.stringify(error));
- })
+ let context = this.context
+ let permissions: Array = ['ohos.permission.DISTRIBUTED_DATASYNC']
+ context.requestPermissionsFromUser(permissions).then((data) => {
+ console.info("Succeed to request permission from user with data: "+ JSON.stringify(data))
+ }).catch((error) => {
+ console.info("Failed to request permission from user with error: "+ JSON.stringify(error))
+ })
}
```
@@ -218,19 +218,31 @@ A system application can connect to a service on another device by calling [conn
### How to Develop
-1. Request the **ohos.permission.DISTRIBUTED_DATASYNC** permission. For details, see [Permission Application Guide](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file).
+1. Configure the data synchronization permission in the **module.json5** file. The sample code is as follows:
+ ```json
+ {
+ "module": {
+ "requestPermissions":[
+ {
+ "name" : "ohos.permission.DISTRIBUTED_DATASYNC",
+ }
+ ]
+ }
+ }
+ ```
+
2. Request the data synchronization permission. The sample code for displaying a dialog box to request the permission is as follows:
```ts
requestPermission() {
- let context = this.context;
- let permissions: Array = ['ohos.permission.DISTRIBUTED_DATASYNC'];
- context.requestPermissionsFromUser(permissions).then((data) => {
- console.info("Succeed to request permission from user with data: "+ JSON.stringify(data));
- }).catch((error) => {
- console.info("Failed to request permission from user with error: "+ JSON.stringify(error));
- })
+ let context = this.context
+ let permissions: Array = ['ohos.permission.DISTRIBUTED_DATASYNC']
+ context.requestPermissionsFromUser(permissions).then((data) => {
+ console.info("Succeed to request permission from user with data: "+ JSON.stringify(data))
+ }).catch((error) => {
+ console.info("Failed to request permission from user with error: "+ JSON.stringify(error))
+ })
}
```
@@ -279,10 +291,10 @@ A system application can connect to a service on another device by calling [conn
});
},
onDisconnect(elementName) {
- console.info('onDisconnect callback');
+ console.info('onDisconnect callback')
},
onFailed(code) {
- console.info('onFailed callback');
+ console.info('onFailed callback')
}
}
// The ID returned after the connection is set up must be saved. The ID will be passed for service disconnection.
@@ -305,7 +317,7 @@ A system application can connect to a service on another device by calling [conn
## Using Cross-Device Ability Call
-The basic principle of cross-device ability call is the same as that of intra-device ability call. For details, see [Using Ability Call to Implement UIAbility Interaction](uiability-intra-device-interaction.md#using-ability-call-to-implement-uiability-interaction).
+The basic principle of cross-device ability call is the same as that of intra-device ability call. For details, see [Using Ability Call to Implement UIAbility Interaction (System Applications Only)](uiability-intra-device-interaction.md#using-ability-call-to-implement-uiability-interaction-system-applications-only).
The following describes how to implement multi-device collaboration through cross-device ability call.
@@ -319,45 +331,56 @@ The following describes how to implement multi-device collaboration through cros
| startAbilityByCall(want: Want): Promise<Caller>; | Starts a UIAbility in the foreground or background and obtains the caller object for communicating with the UIAbility.|
| on(method: string, callback: CalleeCallBack): void | Callback invoked when the callee ability registers a method.|
| off(method: string): void | Callback invoked when the callee ability deregisters a method.|
-| call(method: string, data: rpc.Sequenceable): Promise<void> | Sends agreed sequenceable data to the callee ability.|
-| callWithResult(method: string, data: rpc.Sequenceable): Promise<rpc.MessageParcel> | Sends agreed sequenceable data to the callee ability and obtains the agreed sequenceable data returned by the callee ability.|
+| call(method: string, data: rpc.Parcelable): Promise<void> | Sends agreed parcelable data to the callee ability.|
+| callWithResult(method: string, data: rpc.Parcelable): Promise<rpc.MessageSequence> | Sends agreed parcelable data to the callee ability and obtains the agreed parcelable data returned by the callee ability.|
| release(): void | Releases the caller object.|
-| on(type: "release", callback: OnReleaseCallback): void | Callback invoked when the caller object is released.|
+| on(type: "release", callback: OnReleaseCallback): void | Callback invoked when the caller object is released.|
### How to Develop
-1. Request the **ohos.permission.DISTRIBUTED_DATASYNC** permission. For details, see [Permission Application Guide](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file).
+1. Configure the data synchronization permission in the **module.json5** file. The sample code is as follows:
+ ```json
+ {
+ "module": {
+ "requestPermissions":[
+ {
+ "name" : "ohos.permission.DISTRIBUTED_DATASYNC",
+ }
+ ]
+ }
+ }
+ ```
+
2. Request the data synchronization permission. The sample code for displaying a dialog box to request the permission is as follows:
```ts
requestPermission() {
- let context = this.context;
- let permissions: Array = ['ohos.permission.DISTRIBUTED_DATASYNC'];
- context.requestPermissionsFromUser(permissions).then((data) => {
- console.info("Succeed to request permission from user with data: "+ JSON.stringify(data));
- }).catch((error) => {
- console.info("Failed to request permission from user with error: "+ JSON.stringify(error));
- })
+ let context = this.context
+ let permissions: Array = ['ohos.permission.DISTRIBUTED_DATASYNC']
+ context.requestPermissionsFromUser(permissions).then((data) => {
+ console.info("Succeed to request permission from user with data: "+ JSON.stringify(data))
+ }).catch((error) => {
+ console.info("Failed to request permission from user with error: "+ JSON.stringify(error))
+ })
}
```
3. Create the callee ability.
-
- For the callee ability, 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 callee ability, 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 UIAbility.
Set **launchType** of the callee ability to **singleton** in the **module.json5** file.
| JSON Field| Description|
| -------- | -------- |
- | "launchType"| Ability launch type. Set this parameter to **singleton**.|
+ | "launchType"| Ability launch type. Set this parameter to **singleton**.|
An example of the UIAbility configuration is as follows:
-
```json
"abilities":[{
"name": ".CalleeAbility",
@@ -371,17 +394,17 @@ The following describes how to implement multi-device collaboration through cros
```
2. Import the **UIAbility** module.
-
+
```ts
- import Ability from '@ohos.app.ability.UIAbility';
+ import Ability from '@ohos.app.ability.UIAbility'
```
+
+ 3. Define the agreed parcelable data.
- 3. Define the agreed sequenceable data.
-
- The data formats sent and received by the caller and callee abilities must be consistent. In the following example, the data formats are number and string.
-
+ The data formats sent and received by the caller and callee abilities must be consistent. In the following example, the data formats are number and string.
+
```ts
- export default class MySequenceable {
+ export default class MyParcelable {
num: number = 0
str: string = ""
@@ -390,24 +413,24 @@ The following describes how to implement multi-device collaboration through cros
this.str = string
}
- marshalling(messageParcel) {
- messageParcel.writeInt(this.num)
- messageParcel.writeString(this.str)
+ marshalling(messageSequence) {
+ messageSequence.writeInt(this.num)
+ messageSequence.writeString(this.str)
return true
}
- unmarshalling(messageParcel) {
- this.num = messageParcel.readInt()
- this.str = messageParcel.readString()
+ unmarshalling(messageSequence) {
+ this.num = messageSequence.readInt()
+ this.str = messageSequence.readString()
return true
}
}
```
-
- 4. Implement **Callee.on** and **Callee.off**.
- In the following example, the **MSG_SEND_METHOD** listener is registered in **onCreate()** of the ability and deregistered in **onDestroy()**. After receiving sequenceable data, the application processes the data and returns the data result. You need to implement processing based on service requirements.
-
+ 4. Implement **Callee.on** and **Callee.off**.
+
+ In the following example, the **MSG_SEND_METHOD** listener is registered in **onCreate()** of the ability 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.
+
```ts
const TAG: string = '[CalleeAbility]'
const MSG_SEND_METHOD: string = 'CallSendMsg'
@@ -415,14 +438,14 @@ The following describes how to implement multi-device collaboration through cros
function sendMsgCallback(data) {
console.info('CalleeSortFunc called')
- // Obtain the sequenceable data sent by the caller ability.
- let receivedData = new MySequenceable(0, '')
- data.readSequenceable(receivedData)
+ // Obtain the parcelable data sent by the caller ability.
+ let receivedData = new MyParcelable(0, '')
+ data.readParcelable(receivedData)
console.info(`receiveData[${receivedData.num}, ${receivedData.str}]`)
// Process the data.
- // Return the sequenceable data result to the caller ability.
- return new MySequenceable(receivedData.num + 1, `send ${receivedData.str} succeed`)
+ // Return the parcelable data result to the caller ability.
+ return new MyParcelable(receivedData.num + 1, `send ${receivedData.str} succeed`)
}
export default class CalleeAbility extends Ability {
@@ -436,7 +459,7 @@ The following describes how to implement multi-device collaboration through cros
onDestroy() {
try {
- this.callee.off(MSG_SEND_METHOD)
+ this.callee.off(MSG_SEND_METHOD)
} catch (error) {
console.error(TAG, `${MSG_SEND_METHOD} unregister failed with error ${JSON.stringify(error)}`)
}
@@ -448,14 +471,13 @@ The following describes how to implement multi-device collaboration through cros
1. Import the **UIAbility** module.
```ts
- import Ability from '@ohos.app.ability.UIAbility';
+ import Ability from '@ohos.app.ability.UIAbility'
```
2. Obtain the caller object.
-
+
The **context** attribute of the ability implements **startAbilityByCall** to obtain the caller object for communication. The following example uses **this.context** to obtain the **context** attribute of the ability, uses **startAbilityByCall** to start the callee ability, obtain the caller object, and register the **onRelease** listener of the caller ability. You need to implement processing based on service requirements.
-
-
+
```ts
async onButtonGetRemoteCaller() {
var caller = undefined
@@ -469,7 +491,7 @@ The following describes how to implement multi-device collaboration through cros
if (data != null) {
caller = data
console.info('get remote caller success')
- // Register the onRelease() listener of the caller ability.
+ // 注册caller的release监听
caller.onRelease((msg) => {
console.info(`remote caller onRelease is called ${msg}`)
})
@@ -483,38 +505,39 @@ The following describes how to implement multi-device collaboration through cros
For details about how to implement **getRemoteDeviceId()**, see [Starting UIAbility and ServiceExtensionAbility Across Devices (No Data Returned)](#starting-uiability-and-serviceextensionability-across-devices-no-data-returned).
-5. Sends agreed sequenceable data to the callee ability.
- 1. The sequenceable data can be sent to the callee ability with or without a return value. The method and sequenceable data must be consistent with those of the callee ability. The following example describes how to send data to the callee ability.
+5. Sends agreed parcelable data to the callee ability.
+ 1. The parcelable data can be sent to the callee ability with or without a return value. The method and parcelable data must be consistent with those of the callee ability. The following example describes how to send data to the callee ability.
```ts
- const MSG_SEND_METHOD: string = 'CallSendMsg';
+ const MSG_SEND_METHOD: string = 'CallSendMsg'
async onButtonCall() {
try {
- let msg = new MySequenceable(1, 'origin_Msg');
- await this.caller.call(MSG_SEND_METHOD, msg);
+ let msg = new MyParcelable(1, 'origin_Msg')
+ await this.caller.call(MSG_SEND_METHOD, msg)
} catch (error) {
- console.info(`caller call failed with ${error}`);
+ console.info(`caller call failed with ${error}`)
}
}
```
+
2. In the following, **CallWithResult** is used to send data **originMsg** to the callee ability and assign the data processed by the **CallSendMsg** method to **backMsg**.
```ts
- const MSG_SEND_METHOD: string = 'CallSendMsg';
- originMsg: string = '';
- backMsg: string = '';
+ const MSG_SEND_METHOD: string = 'CallSendMsg'
+ originMsg: string = ''
+ backMsg: string = ''
async onButtonCallWithResult(originMsg, backMsg) {
try {
- let msg = new MySequenceable(1, originMsg);
- const data = await this.caller.callWithResult(MSG_SEND_METHOD, msg);
- console.info('caller callWithResult succeed');
+ let msg = new MyParcelable(1, originMsg)
+ const data = await this.caller.callWithResult(MSG_SEND_METHOD, msg)
+ console.info('caller callWithResult succeed')
- let result = new MySequenceable(0, '');
- data.readSequenceable(result);
- backMsg(result.str);
- console.info(`caller result is [${result.num}, ${result.str}]`);
+ let result = new MyParcelable(0, '')
+ data.readParcelable(result)
+ backMsg(result.str)
+ console.info(`caller result is [${result.num}, ${result.str}]`)
} catch (error) {
- console.info(`caller callWithResult failed with ${error}`);
+ console.info(`caller callWithResult failed with ${error}`)
}
}
```
@@ -526,11 +549,11 @@ The following describes how to implement multi-device collaboration through cros
```ts
releaseCall() {
try {
- this.caller.release();
+ this.caller.release()
this.caller = undefined
- console.info('caller release succeed');
+ console.info('caller release succeed')
} catch (error) {
- console.info(`caller release failed with ${error}`);
+ console.info(`caller release failed with ${error}`)
}
}
- ```
+ ```
\ No newline at end of file
diff --git a/en/application-dev/application-models/stage-model-development-overview.md b/en/application-dev/application-models/stage-model-development-overview.md
index 6fbf06baa44d4c0f2196fa3c1b00a0761a71a161..3436d29e5816cbe5b1ed30eba10e2435c34777e2 100644
--- a/en/application-dev/application-models/stage-model-development-overview.md
+++ b/en/application-dev/application-models/stage-model-development-overview.md
@@ -40,4 +40,4 @@ During application development based on the stage model, the following tasks are
| Inter-process communication (IPC)| Learn the process model and common IPC modes of the stage model.| - [Common Events](common-event-overview.md)
- [Background Services](background-services.md)|
| Inter-thread communication| Learn the thread model and common inter-thread communication modes of the stage model.| - [Emitter](itc-with-emitter.md)
- [Worker](itc-with-worker.md)|
| Mission management| Learn the basic concepts and typical scenarios of mission management in the stage model.| - [Mission Management Scenarios](mission-management-overview.md)
- [Mission Management and Launch Type](mission-management-launch-type.md)
- [Page Stack and Mission List](page-mission-stack.md)|
-| Application configuration file| Learn the requirements for developing application configuration files in the stage model.| [Application Configuration File](config-file-stage.md)|
+| Application configuration file| Learn the requirements for developing application configuration files in the stage model.| [Application Configuration File](../quick-start/application-configuration-file-overview-stage.md)|
diff --git a/en/application-dev/application-models/uiability-intra-device-interaction.md b/en/application-dev/application-models/uiability-intra-device-interaction.md
index 4ec507ae7043e9b95f47a2ec954f1e95c52d53cb..065cd62fa005e91747b0ca2e1ef0e6657d333f73 100644
--- a/en/application-dev/application-models/uiability-intra-device-interaction.md
+++ b/en/application-dev/application-models/uiability-intra-device-interaction.md
@@ -50,7 +50,7 @@ Assume that your application has two UIAbility components: EntryAbility and Func
```ts
import UIAbility from '@ohos.app.ability.UIAbility';
- import window from '@ohos.window';
+ import Window from '@ohos.window';
export default class FuncAbility extends UIAbility {
onCreate(want, launchParam) {
@@ -65,7 +65,7 @@ Assume that your application has two UIAbility components: EntryAbility and Func
3. To stop the **UIAbility** instance after the FuncAbility service is complete, call **terminateSelf()** in FuncAbility.
```ts
- // context is the ability context of the UIAbility instance to stop.
+ // context is the ability-level context of the UIAbility instance to stop.
this.context.terminateSelf((err) => {
// ...
});
@@ -111,7 +111,7 @@ When starting FuncAbility from EntryAbility, you want the result to be returned
},
},
}
- // context is the ability context of the callee UIAbility.
+ // context is the ability-level context of the callee UIAbility.
this.context.terminateSelfWithResult(abilityResult, (err) => {
// ...
});
@@ -196,13 +196,13 @@ This section describes how to start the UIAbility of another application through
```
The following figure shows the effect. When you click **Open PDF**, a dialog box is displayed for you to select.
-
- 
+
+ 
3. To stop the **UIAbility** instance after the document application is used, call **terminateSelf()**.
```ts
- // context is the ability context of the UIAbility instance to stop.
+ // context is the ability-level context of the UIAbility instance to stop.
this.context.terminateSelf((err) => {
// ...
});
@@ -274,7 +274,7 @@ If you want to obtain the return result when using implicit Want to start the UI
},
},
}
- // context is the ability context of the callee UIAbility.
+ // context is the ability-level context of the callee UIAbility.
this.context.terminateSelfWithResult(abilityResult, (err) => {
// ...
});
@@ -412,7 +412,6 @@ In summary, when a UIAbility instance of application A has been created and the
```
> **NOTE**
->
> When the [launch type of the callee UIAbility](uiability-launch-type.md) is set to **standard**, a new instance is created each time the callee UIAbility is started. In this case, the [onNewWant()](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonnewwant) callback will not be invoked.
@@ -432,7 +431,7 @@ Ability call is usually used in the following scenarios:
- Starting the callee ability in the background
-**Table 1** Terms used in the ability call
+ **Table 1** Terms used in the ability call
| **Term**| Description|
| -------- | -------- |
@@ -443,9 +442,9 @@ Ability call is usually used in the following scenarios:
The following figure shows the ability call process.
-**Figure 1** Ability call process
+ Figure 1 Ability call process
-
+ 
- The caller ability uses **startAbilityByCall** to obtain a caller object and uses **call()** of the caller object to send data to the callee ability.
@@ -463,15 +462,15 @@ The following figure shows the ability call process.
The following table describes the main APIs used for the ability call. For details, see [AbilityContext](../reference/apis/js-apis-app-ability-uiAbility.md#caller).
-**Table 2** Ability call APIs
+ **Table 2** Ability call APIs
| API| Description|
| -------- | -------- |
| startAbilityByCall(want: Want): Promise<Caller> | Starts a UIAbility in the foreground (through the **want** configuration) or background (default) and obtains the caller object for communication with the UIAbility. For details, see [AbilityContext](../reference/apis/js-apis-inner-application-uiAbilityContext.md#abilitycontextstartabilitybycall) or [ServiceExtensionContext](../reference/apis/js-apis-inner-application-serviceExtensionContext.md#serviceextensioncontextstartabilitybycall).|
| on(method: string, callback: CalleeCallBack): void | Callback invoked when the callee ability registers a method.|
| off(method: string): void | Callback invoked when the callee ability deregisters a method.|
-| call(method: string, data: rpc.Sequenceable): Promise<void> | Sends agreed sequenceable data to the callee ability.|
-| callWithResult(method: string, data: rpc.Sequenceable): Promise<rpc.MessageParcel> | Sends agreed sequenceable data to the callee ability and obtains the agreed sequenceable data returned by the callee ability.|
+| call(method: string, data: rpc.Parcelable): Promise<void> | Sends agreed parcelable data to the callee ability.|
+| callWithResult(method: string, data: rpc.Parcelable): Promise<rpc.MessageSequence> | Sends agreed parcelable data to the callee ability and obtains the agreed parcelable data returned by the callee ability.|
| release(): void | Releases the caller object.|
| on(type: "release", callback: OnReleaseCallback): void | Callback invoked when the caller object is released.|
@@ -487,16 +486,15 @@ The implementation of using the ability call for UIAbility interaction involves
For the callee ability, 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 ability launch type.
-
Set **launchType** of the callee ability to **singleton** in the **module.json5** file.
-| JSON Field| Description|
-| -------- | -------- |
-| "launchType" | Ability launch type. Set this parameter to **singleton**.|
-
-An example of the ability configuration is as follows:
+ | JSON Field| Description|
+ | -------- | -------- |
+ | "launchType" | Ability launch type. Set this parameter to **singleton**.|
+ An example of the ability configuration is as follows:
+
```json
"abilities":[{
"name": ".CalleeAbility",
@@ -510,18 +508,17 @@ An example of the ability configuration is as follows:
```
2. Import the **UIAbility** module.
-
+
```ts
import Ability from '@ohos.app.ability.UIAbility';
```
-3. Define the agreed sequenceable data.
-
+3. Define the agreed parcelable data.
The data formats sent and received by the caller and callee abilities must be consistent. In the following example, the data formats are number and string.
-
+
```ts
- export default class MySequenceable {
+ export default class MyParcelable {
num: number = 0
str: string = ""
@@ -530,25 +527,24 @@ An example of the ability configuration is as follows:
this.str = string
}
- marshalling(messageParcel) {
- messageParcel.writeInt(this.num)
- messageParcel.writeString(this.str)
+ marshalling(messageSequence) {
+ messageSequence.writeInt(this.num)
+ messageSequence.writeString(this.str)
return true
}
- unmarshalling(messageParcel) {
- this.num = messageParcel.readInt()
- this.str = messageParcel.readString()
+ unmarshalling(messageSequence) {
+ this.num = messageSequence.readInt()
+ this.str = messageSequence.readString()
return true
}
}
```
4. Implement **Callee.on** and **Callee.off**.
+ The time to register a listener for the callee ability 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 ability 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 callee ability 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 ability and deregistered in **onDestroy**. After receiving sequenceable 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:
-
-
+
```ts
const TAG: string = '[CalleeAbility]';
const MSG_SEND_METHOD: string = 'CallSendMsg';
@@ -556,14 +552,14 @@ An example of the ability configuration is as follows:
function sendMsgCallback(data) {
console.info('CalleeSortFunc called');
- // Obtain the sequenceable data sent by the caller ability.
- let receivedData = new MySequenceable(0, '');
- data.readSequenceable(receivedData);
+ // Obtain the parcelable data sent by the caller ability.
+ let receivedData = new MyParcelable(0, '');
+ data.readParcelable(receivedData);
console.info(`receiveData[${receivedData.num}, ${receivedData.str}]`);
// Process the data.
- // Return the sequenceable data result to the caller ability.
- return new MySequenceable(receivedData.num + 1, `send ${receivedData.str} succeed`);
+ // Return the parcelable data result to the caller ability.
+ return new MyParcelable(receivedData.num + 1, `send ${receivedData.str} succeed`);
}
export default class CalleeAbility extends Ability {
@@ -595,10 +591,9 @@ An example of the ability configuration is as follows:
```
2. Obtain the caller interface.
-
The **context** attribute of the ability implements **startAbilityByCall** to obtain the caller object for communication. The following example uses **this.context** to obtain the **context** attribute of the ability, uses **startAbilityByCall** to start the callee ability, obtain the caller object, and register the **onRelease** listener of the caller ability. You need to implement processing based on service requirements.
-
+
```ts
// Register the onRelease() listener of the caller ability.
private regOnRelease(caller) {
diff --git a/en/application-dev/reference/apis/js-apis-ability-featureAbility.md b/en/application-dev/reference/apis/js-apis-ability-featureAbility.md
index 476e721fbdc1437a706a882ba38e0a39c369793c..06a12e5a27300dd5683fd7e4c6154033c00fcb3d 100644
--- a/en/application-dev/reference/apis/js-apis-ability-featureAbility.md
+++ b/en/application-dev/reference/apis/js-apis-ability-featureAbility.md
@@ -365,7 +365,7 @@ featureAbility.terminateSelfWithResult(
});
```
-## featureAbility.hasWindowFocus7+
+## featureAbility.hasWindowFocus7+
hasWindowFocus(callback: AsyncCallback\): void
@@ -388,7 +388,7 @@ featureAbility.hasWindowFocus((err, data) => {
});
```
-## featureAbility.hasWindowFocus7+
+## featureAbility.hasWindowFocus7+
hasWindowFocus(): Promise\
@@ -812,6 +812,6 @@ Enumerates the flags that specify how the Want will be handled.
| FLAG_ABILITY_CONTINUATION_REVERSIBLE | 0x00000400 | Indicates that the migration is reversible. |
| FLAG_INSTALL_ON_DEMAND | 0x00000800 | Indicates that the specific ability will be installed if it has not been installed. |
| FLAG_INSTALL_WITH_BACKGROUND_MODE | 0x80000000 | Indicates that the specific ability will be installed in the background if it has not been installed. |
-| FLAG_ABILITY_CLEAR_MISSION | 0x00008000 | Clears other operation missions. This flag can be set for the **Want** object in the **startAbility** API passed to [ohos.app.Context](js-apis-ability-context.md) and must be used together with **flag_ABILITY_NEW_MISSION**.|
+| FLAG_ABILITY_CLEAR_MISSION | 0x00008000 | Clears other operation missions. This flag can be set for the [Want](js-apis-application-want.md) object under [parameter](js-apis-inner-ability-startAbilityParameter.md) in the [startAbility](#featureabilitystartability) API passed to the **FeatureAbility** module and must be used together with **flag_ABILITY_NEW_MISSION**.|
| FLAG_ABILITY_NEW_MISSION | 0x10000000 | Creates a mission on an existing mission stack. |
| FLAG_ABILITY_MISSION_TOP | 0x20000000 | Reuses an ability instance if it is on the top of an existing mission stack; creates an ability instance otherwise.|
diff --git a/en/application-dev/reference/apis/js-apis-ability-wantConstant.md b/en/application-dev/reference/apis/js-apis-ability-wantConstant.md
index b30cb6fd73a6a78613a6beab3e9f320bc78a59aa..b3e7045d414d247acd5f6658f688de7fbd2db700 100644
--- a/en/application-dev/reference/apis/js-apis-ability-wantConstant.md
+++ b/en/application-dev/reference/apis/js-apis-ability-wantConstant.md
@@ -84,6 +84,6 @@ Enumerates the flags that specify how the Want will be handled.
| FLAG_ABILITY_CONTINUATION_REVERSIBLE | 0x00000400 | Indicates that ability continuation is reversible.
**System API**: This is a system API and cannot be called by third-party applications. |
| FLAG_INSTALL_ON_DEMAND | 0x00000800 | Indicates that the specific ability will be installed if it has not been installed. |
| FLAG_INSTALL_WITH_BACKGROUND_MODE | 0x80000000 | Indicates that the specific ability will be installed in the background if it has not been installed. |
-| FLAG_ABILITY_CLEAR_MISSION | 0x00008000 | Clears other operation missions. This flag can be set for the **Want** object in the **startAbility** API passed to [ohos.app.Context](js-apis-ability-context.md) and must be used together with **flag_ABILITY_NEW_MISSION**.|
+| FLAG_ABILITY_CLEAR_MISSION | 0x00008000 | Clears other operation missions. This flag can be set for the **Want** object in the [startAbility](js-apis-ability-featureAbility.md#startability) API passed to the **FeatureAbility** module and must be used together with **flag_ABILITY_NEW_MISSION**.|
| FLAG_ABILITY_NEW_MISSION | 0x10000000 | Creates a mission on the history mission stack. |
| FLAG_ABILITY_MISSION_TOP | 0x20000000 | Reuses an ability instance if it is on the top of an existing mission stack; creates an ability instance otherwise.|
diff --git a/en/application-dev/reference/apis/js-apis-app-ability-abilityConstant.md b/en/application-dev/reference/apis/js-apis-app-ability-abilityConstant.md
index d4419f96f9177cd2f1ba169f0c84a1caaf57abb1..ff1bbfa2187c2a5ad868e28e11e08ae1a77ed705 100644
--- a/en/application-dev/reference/apis/js-apis-app-ability-abilityConstant.md
+++ b/en/application-dev/reference/apis/js-apis-app-ability-abilityConstant.md
@@ -35,8 +35,8 @@ Enumerates the initial ability launch reasons. You can use it together with [onC
| Name | Value | Description |
| ----------------------------- | ---- | ------------------------------------------------------------ |
| UNKNOWN | 0 | Unknown reason.|
-| START_ABILITY | 1 | The ability is started by calling [startAbility](js-apis-ability-context.md#abilitycontextstartability).|
-| CALL | 2 | The ability is started by calling [startAbilityByCall](js-apis-ability-context.md#abilitycontextstartabilitybycall).|
+| START_ABILITY | 1 | The ability is started by calling [startAbility](js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability).|
+| CALL | 2 | The ability is started by calling [startAbilityByCall](js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartabilitybycall).|
| CONTINUATION | 3 | The ability is started by means of cross-device migration.|
| APP_RECOVERY | 4 | The ability is automatically started when the application is restored from a fault.|
@@ -124,8 +124,8 @@ Enumerates the window modes in which an ability can be displayed at startup. It
```ts
let want = {
- bundleName: 'com.test.example',
- abilityName: 'MainAbility'
+ bundleName: 'com.example.myapplication',
+ abilityName: 'EntryAbility'
};
let option = {
windowMode: AbilityConstant.WindowMode.WINDOW_MODE_FULLSCREEN
@@ -135,7 +135,7 @@ let option = {
this.context.startAbility(want, option).then(()=>{
console.log('Succeed to start ability.');
}).catch((error)=>{
- console.log('Failed to start ability with error: ' + JSON.stringify(error));
+ console.error('Failed to start ability with error: ${JSON.stringify(error)}');
});
```
diff --git a/en/application-dev/reference/apis/js-apis-app-ability-common.md b/en/application-dev/reference/apis/js-apis-app-ability-common.md
index 44e7922bd5004e27e994dc61f8e473d3b02209d1..497867de9df35f93bc04b818a305e32b3a5dee3a 100644
--- a/en/application-dev/reference/apis/js-apis-app-ability-common.md
+++ b/en/application-dev/reference/apis/js-apis-app-ability-common.md
@@ -24,8 +24,8 @@ import common from '@ohos.app.ability.common';
| Context | [Context](js-apis-inner-application-context.md) | Level-2 module **Context**.|
| ExtensionContext | [ExtensionContext](js-apis-inner-application-extensionContext.md) | Level-2 module **ExtensionContext**.|
| FormExtensionContext | [FormExtensionContext](js-apis-inner-application-formExtensionContext.md) | Level-2 module **FormExtensionContext**.|
+| ServiceExtensionContext | [ServiceExtensionContext](js-apis-inner-application-serviceExtensionContext.md) | Level-2 module **ServiceExtensionContext**.|
| EventHub | [EventHub](js-apis-inner-application-eventHub.md) | Level-2 module **EventHub**.|
-| PermissionRequestResult | [PermissionRequestResult](js-apis-inner-application-permissionRequestResult.md) | Level-2 module **PermissionRequestResult**.|
| PacMap | [PacMap](js-apis-inner-ability-dataAbilityHelper.md#PacMap) | Level-2 module **PacMap**.|
| AbilityResult | [AbilityResult](js-apis-inner-ability-abilityResult.md) | Level-2 module **AbilityResult**.|
| ConnectOptions | [ConnectOptions](js-apis-inner-ability-connectOptions.md) | Level-2 module **ConnectOptions**.|
@@ -42,19 +42,7 @@ let context: common.Context;
let extensionContext: common.ExtensionContext;
let formExtensionContext: common.FormExtensionContext;
let eventHub: common.EventHub;
-let permissionRequestResult: common.PermissionRequestResult;
let pacMap: common.PacMap;
let abilityResult: common.AbilityResult;
let connectOptions: common.ConnectOptions;
```
-
-## AreaMode
-
-Enumerates the data encryption levels.
-
-**System capability**: SystemCapability.Ability.AbilityRuntime.Core
-
-| Name | Value | Description |
-| --------------- | ---- | --------------- |
-| EL1 | 0 | Device-level encryption area, which is accessible after the device is powered on. |
-| EL2 | 1 | User-level encryption area, which is accessible only after the device is powered on and the password is entered (for the first time).|
diff --git a/en/application-dev/reference/apis/js-apis-app-ability-extensionAbility.md b/en/application-dev/reference/apis/js-apis-app-ability-extensionAbility.md
index d532723b43a1c31f2b01b35799747ec689df5099..14d3eb1c084173646eeec6ece05ada654a45ac84 100644
--- a/en/application-dev/reference/apis/js-apis-app-ability-extensionAbility.md
+++ b/en/application-dev/reference/apis/js-apis-app-ability-extensionAbility.md
@@ -1,10 +1,31 @@
# @ohos.app.ability.ExtensionAbility (ExtensionAbility Base Class)
-**ExtensionAbility** is the base class for scenario-specific ExtensionAbilities. It is inherited from [Ability](js-apis-app-ability-ability.md), with no attribute or method added. You cannot inherit from this base class.
+**ExtensionAbility** is the base class for scenario-specific ExtensionAbilities. It provides the callbacks for system configuration updates and memory level updates.
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be used only in the stage model.
+## Modules to Import
+
+```ts
+import ExtensionAbility from '@ohos.app.ability.ExtensionAbility';
+```
+
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
+
+**Example**
+
+ ```ts
+ class MyExtensionAbility extends ExtensionAbility {
+ onConfigurationUpdated(config) {
+ console.log('onConfigurationUpdated, config:' + JSON.stringify(config));
+ }
+
+ onMemoryLevel(level) {
+ console.log('onMemoryLevel, level:' + JSON.stringify(level));
+ }
+ }
+ ```
+
diff --git a/en/application-dev/reference/apis/js-apis-app-ability-serviceExtensionAbility.md b/en/application-dev/reference/apis/js-apis-app-ability-serviceExtensionAbility.md
index eca749eef4accc20828572a8a85466f23b6b9c1b..d9d9db6fdfe71ed60275638085b17c314233882c 100644
--- a/en/application-dev/reference/apis/js-apis-app-ability-serviceExtensionAbility.md
+++ b/en/application-dev/reference/apis/js-apis-app-ability-serviceExtensionAbility.md
@@ -1,6 +1,6 @@
# @ohos.app.ability.ServiceExtensionAbility (ServiceExtensionAbility)
-The **ServiceExtensionAbility** module provides APIs for ServiceExtensionAbilities.
+The **ServiceExtensionAbility** module provides lifecycle callbacks when a ServiceExtensionAbility (background service) is created, destroyed, connected, or disconnected.
> **NOTE**
>
@@ -150,7 +150,7 @@ Called following **onCreate()** when a ServiceExtensionAbility is started by cal
onDisconnect(want: Want): void | Promise;
-Called when this ServiceExtensionAbility is disconnected.
+Called when a client is disconnected from this ServiceExtensionAbility.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
@@ -176,7 +176,7 @@ Called when this ServiceExtensionAbility is disconnected.
onReconnect(want: Want): void;
-Called when this ServiceExtensionAbility is reconnected.
+Called when a new client attempts to connect to this ServiceExtensionAbility after all previous clients are disconnected. This capability is reserved.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
diff --git a/en/application-dev/reference/apis/js-apis-app-ability-startOptions.md b/en/application-dev/reference/apis/js-apis-app-ability-startOptions.md
index b750094435503f6b54a5826fcab9995ca5aa33be..aceabe2bece920ca9034689c2425f4d34b5a69c7 100644
--- a/en/application-dev/reference/apis/js-apis-app-ability-startOptions.md
+++ b/en/application-dev/reference/apis/js-apis-app-ability-startOptions.md
@@ -1,6 +1,6 @@
# @ohos.app.ability.StartOptions (StartOptions)
-The **StartOptions** module implements ability startup options.
+**StartOptions** is used as an input parameter of [startAbility](js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability-1) to specify the window mode of an ability.
> **NOTE**
>
diff --git a/en/application-dev/reference/apis/js-apis-app-ability-uiAbility.md b/en/application-dev/reference/apis/js-apis-app-ability-uiAbility.md
index 72114bd58c0b28ad1411780e4e78ef6053d8b4e6..2c0fa34611d102078e71cc83e25c3a45ac1a1beb 100644
--- a/en/application-dev/reference/apis/js-apis-app-ability-uiAbility.md
+++ b/en/application-dev/reference/apis/js-apis-app-ability-uiAbility.md
@@ -1,10 +1,9 @@
# @ohos.app.ability.UIAbility (UIAbility)
-The **Ability** module manages the ability lifecycle and context, such as creating and destroying an ability, and dumping client information.
+UIAbility is an application component that has the UI. The **UIAbility** module provides lifecycle callback such as component creation, destruction, and foreground/background switching. It also provides the following capabilities related to component collaboration:
-This module provides the following common ability-related functions:
-- [Caller](#caller): implements sending of sequenceable data to the target ability when an ability (caller ability) invokes the target ability (callee ability).
-- [Callee](#callee): implements callbacks for registration and deregistration of caller notifications.
+- [Caller](#caller): an object returned by [startAbilityByCall](js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartabilitybycall). The CallerAbility (caller) uses this object to communicate with the CalleeAbility (callee).
+- [Callee](#callee): an internal object of UIAbility. The CalleeAbility (callee) uses this object to communicate with the CallerAbility (caller).
> **NOTE**
>
@@ -23,12 +22,12 @@ import Ability from '@ohos.app.ability.UIAbility';
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
-| context | [UIAbilityContext](js-apis-inner-application-uiAbilityContext.md) | Yes| No| Context of the ability.|
-| launchWant | [Want](js-apis-app-ability-want.md) | Yes| No| Parameters for starting the ability.|
-| lastRequestWant | [Want](js-apis-app-ability-want.md) | Yes| No| Parameters used when the ability was started last time.|
+| context | [UIAbilityContext](js-apis-inner-application-uiAbilityContext.md) | Yes| No| Context of the UIAbility.|
+| launchWant | [Want](js-apis-app-ability-want.md) | Yes| No| Parameters for starting the UIAbility.|
+| lastRequestWant | [Want](js-apis-app-ability-want.md) | Yes| No| Parameters used when the UIAbility was started last time.|
| callee | [Callee](#callee) | Yes| No| Object that invokes the stub service.|
-## Ability.onCreate
+## UIAbility.onCreate
onCreate(want: Want, param: AbilityConstant.LaunchParam): void;
@@ -40,7 +39,7 @@ Called to initialize the service logic when an ability is created.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
-| want | [Want](js-apis-app-ability-want.md) | Yes| Information related to this ability, including the ability name and bundle name.|
+| want | [Want](js-apis-app-ability-want.md) | Yes| Information related to this UIAbility, including the ability name and bundle name.|
| param | [AbilityConstant.LaunchParam](js-apis-app-ability-abilityConstant.md#abilityconstantlaunchparam) | Yes| Parameters for starting the ability, and the reason for the last abnormal exit.|
**Example**
@@ -54,11 +53,11 @@ Called to initialize the service logic when an ability is created.
```
-## Ability.onWindowStageCreate
+## UIAbility.onWindowStageCreate
onWindowStageCreate(windowStage: window.WindowStage): void
-Called when a **WindowStage** is created for this ability.
+Called when a **WindowStage** is created for this UIAbility.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
@@ -79,11 +78,11 @@ Called when a **WindowStage** is created for this ability.
```
-## Ability.onWindowStageDestroy
+## UIAbility.onWindowStageDestroy
onWindowStageDestroy(): void
-Called when the **WindowStage** is destroyed for this ability.
+Called when the **WindowStage** is destroyed for this UIAbility.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
@@ -98,11 +97,11 @@ Called when the **WindowStage** is destroyed for this ability.
```
-## Ability.onWindowStageRestore
+## UIAbility.onWindowStageRestore
onWindowStageRestore(windowStage: window.WindowStage): void
-Called when the **WindowStage** is restored during the migration of this ability, which is a multi-instance ability.
+Called when the **WindowStage** is restored during the migration of this UIAbility, which is a multi-instance ability.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
@@ -123,7 +122,7 @@ Called when the **WindowStage** is restored during the migration of this ability
```
-## Ability.onDestroy
+## UIAbility.onDestroy
onDestroy(): void | Promise<void>;
@@ -142,7 +141,7 @@ Called when this ability is destroyed to clear resources.
```
-## Ability.onForeground
+## UIAbility.onForeground
onForeground(): void;
@@ -161,7 +160,7 @@ Called when this ability is switched from the background to the foreground.
```
-## Ability.onBackground
+## UIAbility.onBackground
onBackground(): void;
@@ -180,7 +179,7 @@ Called when this ability is switched from the foreground to the background.
```
-## Ability.onContinue
+## UIAbility.onContinue
onContinue(wantParam: { [key: string]: Object }): AbilityConstant.OnContinueResult;
@@ -214,11 +213,11 @@ Called to save data during the ability migration preparation process.
```
-## Ability.onNewWant
+## UIAbility.onNewWant
onNewWant(want: Want, launchParams: AbilityConstant.LaunchParam): void;
-Called when a new Want is passed in and this ability is started again.
+Called when a new Want is passed in and this UIAbility is started again.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
@@ -227,7 +226,7 @@ Called when a new Want is passed in and this ability is started again.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| want | [Want](js-apis-app-ability-want.md) | Yes| Want information, such as the ability name and bundle name.|
-| launchParams | [AbilityConstant.LaunchParam](js-apis-app-ability-abilityConstant.md#abilityconstantlaunchparam) | Yes| Reason for the ability startup and the last abnormal exit.|
+| launchParams | [AbilityConstant.LaunchParam](js-apis-app-ability-abilityConstant.md#abilityconstantlaunchparam) | Yes| Reason for the UIAbility startup and the last abnormal exit.|
**Example**
@@ -240,7 +239,7 @@ Called when a new Want is passed in and this ability is started again.
}
```
-## Ability.onDump
+## UIAbility.onDump
onDump(params: Array\): Array\;
@@ -266,11 +265,11 @@ Dumps client information.
```
-## Ability.onSaveState
+## UIAbility.onSaveState
onSaveState(reason: AbilityConstant.StateType, wantParam : {[key: string]: Object}): AbilityConstant.OnSaveResult;
-Called when the framework automatically saves the ability state in the case of an application fault. This API is used together with [appRecovery](js-apis-app-ability-appRecovery.md). If automatic state saving is enabled, **onSaveState** is called to save the state of this ability.
+Called when the framework automatically saves the UIAbility state in the case of an application fault. This API is used together with [appRecovery](js-apis-app-ability-appRecovery.md). If automatic state saving is enabled, **onSaveState** is called to save the state of this ability.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
@@ -278,7 +277,7 @@ Called when the framework automatically saves the ability state in the case of a
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
-| reason | [AbilityConstant.StateType](js-apis-application-abilityConstant.md#abilityconstantstatetype) | Yes| Reason for triggering the callback to save the ability state.|
+| reason | [AbilityConstant.StateType](js-apis-app-ability-abilityConstant.md#abilityconstantstatetype) | Yes| Reason for triggering the callback to save the UIAbility state.|
| wantParam | {[key: string]: any} | Yes| **want** parameter.|
**Return value**
@@ -305,22 +304,22 @@ class MyUIAbility extends Ability {
## Caller
-Implements sending of sequenceable data to the target ability when the CallerAbility invokes the target ability (CalleeAbility).
+Implements sending of parcelable data to the target ability when the CallerAbility invokes the target ability (CalleeAbility).
## Caller.call
call(method: string, data: rpc.Parcelable): Promise<void>;
-Sends sequenceable data to the target ability.
+Sends parcelable data to the target ability.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Parameters**
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| method | string | Yes| Notification message string negotiated between the two abilities. The message is used to instruct the callee to register a function to receive the sequenceable data.|
-| data | [rpc.Parcelable](js-apis-rpc.md#parcelabledeprecated) | Yes| Sequenceable data. You need to customize the data.|
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | method | string | Yes| Notification message string negotiated between the two abilities. The message is used to instruct the callee to register a function to receive the parcelable data.|
+ | data | [rpc.Parcelable](js-apis-rpc.md#parcelable9) | Yes| Parcelable data. You need to customize the data.|
**Return value**
@@ -333,13 +332,12 @@ Sends sequenceable data to the target ability.
| ID| Error Message|
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
-
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example**
```ts
- class MyMessageAble{ // Custom sequenceable data structure.
+ class MyMessageAble{ // Custom parcelable data structure.
name:''
str:''
num: 1
@@ -347,15 +345,15 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
this.name = name;
this.str = str;
}
- marshalling(messageParcel) {
- messageParcel.writeInt(this.num);
- messageParcel.writeString(this.str);
+ marshalling(messageSequence) {
+ messageSequence.writeInt(this.num);
+ messageSequence.writeString(this.str);
console.log('MyMessageAble marshalling num[' + this.num + '] str[' + this.str + ']');
return true;
}
- unmarshalling(messageParcel) {
- this.num = messageParcel.readInt();
- this.str = messageParcel.readString();
+ unmarshalling(messageSequence) {
+ this.num = messageSequence.readInt();
+ this.str = messageSequence.readString();
console.log('MyMessageAble unmarshalling num[' + this.num + '] str[' + this.str + ']');
return true;
}
@@ -370,7 +368,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
deviceId: ''
}).then((obj) => {
caller = obj;
- let msg = new MyMessageAble('msg', 'world'); // See the definition of Sequenceable.
+ let msg = new MyMessageAble('msg', 'world'); // See the definition of Parcelable.
caller.call(method, msg)
.then(() => {
console.log('Caller call() called');
@@ -390,31 +388,30 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
## Caller.callWithResult
-callWithResult(method: string, data: rpc.Parcelable): Promise<rpc.MessageParcel>;
+callWithResult(method: string, data: rpc.Parcelable): Promise<rpc.MessageSequence>;
-Sends sequenceable data to the target ability and obtains the sequenceable data returned by the target ability.
+Sends parcelable data to the target ability and obtains the parcelable data returned by the target ability.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Parameters**
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| method | string | Yes| Notification message string negotiated between the two abilities. The message is used to instruct the callee to register a function to receive the sequenceable data.|
-| data | [rpc.Parcelable](js-apis-rpc.md#parcelabledeprecated) | Yes| Sequenceable data. You need to customize the data.|
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | method | string | Yes| Notification message string negotiated between the two abilities. The message is used to instruct the callee to register a function to receive the parcelable data.|
+ | data | [rpc.Parcelable](js-apis-rpc.md#parcelable9) | Yes| Parcelable data. You need to customize the data.|
**Return value**
-| Type| Description|
-| -------- | -------- |
-| Promise<[rpc.MessageParcel](js-apis-rpc.md#sequenceabledeprecated)> | Promise used to return the sequenceable data from the target ability.|
+ | Type| Description|
+ | -------- | -------- |
+ | Promise<[rpc.MessageSequence](js-apis-rpc.md#messagesequence9)> | Promise used to return the parcelable data from the target ability.|
**Error codes**
| ID| Error Message|
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
-
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example**
@@ -428,15 +425,15 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
this.name = name;
this.str = str;
}
- marshalling(messageParcel) {
- messageParcel.writeInt(this.num);
- messageParcel.writeString(this.str);
+ marshalling(messageSequence) {
+ messageSequence.writeInt(this.num);
+ messageSequence.writeString(this.str);
console.log('MyMessageAble marshalling num[' + this.num + '] str[' + this.str + ']');
return true;
}
- unmarshalling(messageParcel) {
- this.num = messageParcel.readInt();
- this.str = messageParcel.readString();
+ unmarshalling(messageSequence) {
+ this.num = messageSequence.readInt();
+ this.str = messageSequence.readString();
console.log('MyMessageAble unmarshalling num[' + this.num + '] str[' + this.str + ']');
return true;
}
@@ -456,7 +453,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
.then((data) => {
console.log('Caller callWithResult() called');
let retmsg = new MyMessageAble(0, '');
- data.readSequenceable(retmsg);
+ data.readParcelable(retmsg);
})
.catch((callErr) => {
console.log('Caller.callWithResult catch error, error.code: ' + JSON.stringify(callErr.code) +
@@ -477,7 +474,7 @@ release(): void;
Releases the caller interface of the target ability.
-**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
+**System capability**: SystemCapability.UIAbility.UIAbilityRuntime.UIAbilityCore
**Error codes**
@@ -576,7 +573,6 @@ Registers a callback that is invoked when the stub on the target ability is disc
| ID| Error Message|
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
-
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example**
@@ -627,7 +623,7 @@ Deregisters a callback that is invoked when the stub on the target ability is di
| ID| Error Message|
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
-For other IDs, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
+For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example**
@@ -678,7 +674,7 @@ Deregisters a callback that is invoked when the stub on the target ability is di
| ID| Error Message|
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
-For other IDs, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
+For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example**
@@ -724,17 +720,16 @@ Registers a caller notification callback, which is invoked when the target abili
**Parameters**
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| method | string | Yes| Notification message string negotiated between the two abilities.|
-| callback | [CalleeCallback](#calleecallback) | Yes| JS notification synchronization callback of the [rpc.MessageParcel](js-apis-rpc.md#sequenceabledeprecated) type. The callback must return at least one empty [rpc.Sequenceable](js-apis-rpc.md#sequenceabledeprecated) object. Otherwise, the function execution fails.|
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | method | string | Yes| Notification message string negotiated between the two abilities.|
+ | callback | [CalleeCallback](#calleecallback) | Yes| JS notification synchronization callback of the [rpc.MessageSequence](js-apis-rpc.md#messagesequence9) type. The callback must return at least one empty [rpc.Parcelable](js-apis-rpc.md#parcelable9) object. Otherwise, the function execution fails.|
**Error codes**
| ID| Error Message|
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
-
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
**Example**
@@ -748,15 +743,15 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
this.name = name;
this.str = str;
}
- marshalling(messageParcel) {
- messageParcel.writeInt(this.num);
- messageParcel.writeString(this.str);
+ marshalling(messageSequence) {
+ messageSequence.writeInt(this.num);
+ messageSequence.writeString(this.str);
console.log('MyMessageAble marshalling num[' + this.num + '] str[' + this.str + ']');
return true;
}
- unmarshalling(messageParcel) {
- this.num = messageParcel.readInt();
- this.str = messageParcel.readString();
+ unmarshalling(messageSequence) {
+ this.num = messageSequence.readInt();
+ this.str = messageSequence.readString();
console.log('MyMessageAble unmarshalling num[' + this.num + '] str[' + this.str + ']');
return true;
}
@@ -765,7 +760,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
function funcCallBack(pdata) {
console.log('Callee funcCallBack is called ' + pdata);
let msg = new MyMessageAble('test', '');
- pdata.readSequenceable(msg);
+ pdata.readParcelable(msg);
return new MyMessageAble('test1', 'Callee test');
}
export default class MainAbility extends Ability {
@@ -787,7 +782,7 @@ off(method: string): void;
Deregisters a caller notification callback, which is invoked when the target ability registers a function.
-**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
+**System capability**: SystemCapability.UIAbility.UIAbilityRuntime.UIAbilityCore
**Parameters**
@@ -800,7 +795,6 @@ Deregisters a caller notification callback, which is invoked when the target abi
| ID| Error Message|
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
-
For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
@@ -833,10 +827,10 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
## CalleeCallback
-(indata: rpc.MessageParcel): rpc.Parcelable;
+(indata: rpc.MessageSequence): rpc.Parcelable;
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
| Name| Readable| Writable| Type| Description|
| -------- | -------- | -------- | -------- | -------- |
-| (indata: [rpc.MessageParcel](js-apis-rpc.md#sequenceabledeprecated)) | Yes| No| [rpc.Parcelable](js-apis-rpc.md#parcelabledeprecated) | Prototype of the listener function registered by the callee.|
+| (indata: [rpc.MessageSequence](js-apis-rpc.md#messagesequence9)) | Yes| No| [rpc.Parcelable](js-apis-rpc.md#parcelable9) | Prototype of the listener function registered by the callee.|
diff --git a/en/application-dev/reference/apis/js-apis-app-form-formExtensionAbility.md b/en/application-dev/reference/apis/js-apis-app-form-formExtensionAbility.md
index 80677a5b42a89bf8fba1aa543e811babdfcd396a..137c59a9765655de7c1b727e9769977897f6c2ca 100644
--- a/en/application-dev/reference/apis/js-apis-app-form-formExtensionAbility.md
+++ b/en/application-dev/reference/apis/js-apis-app-form-formExtensionAbility.md
@@ -1,6 +1,6 @@
# @ohos.app.form.FormExtensionAbility (FormExtensionAbility)
-The **FormExtensionAbility** module provides APIs related to FormExtensionAbilities.
+The **FormExtensionAbility** module provides lifecycle callbacks invoked when a widget is created, destroyed, or updated.
> **NOTE**
>
@@ -19,7 +19,7 @@ import FormExtensionAbility from '@ohos.app.form.FormExtensionAbility';
| Name | Type | Readable| Writable| Description |
| ------- | ------------------------------------------------------------ | ---- | ---- | ------------------------------------------------------------ |
-| context | [FormExtensionContext](js-apis-inner-application-formExtensionContext.md) | Yes | No | Context of the FormExtensionAbility. This context is inherited from **ExtensionContext**.|
+| context | [FormExtensionContext](js-apis-inner-application-formExtensionContext.md) | Yes | No | Context of the FormExtensionAbility. This context is inherited from [ExtensionContext](js-apis-inner-application-extensionContext.md).|
## onAddForm
@@ -33,7 +33,7 @@ Called to notify the widget provider that a **Form** instance (widget) has been
| Name| Type | Mandatory| Description |
| ------ | -------------------------------------- | ---- | ------------------------------------------------------------ |
-| want | [Want](js-apis-application-want.md) | Yes | Want information related to the ExtensionAbility, including the widget ID, name, and style. The information must be managed as persistent data to facilitate subsequent widget update and deletion.|
+| want | [Want](js-apis-application-want.md) | Yes | Want information related to the FormExtensionAbility, including the widget ID, name, and style. The information must be managed as persistent data to facilitate subsequent widget update and deletion.|
**Return value**
@@ -145,7 +145,7 @@ export default class MyFormExtensionAbility extends FormExtensionAbility {
console.error('Operation updateForm failed. Cause: ' + error);});
}
}
-}
+};
```
## onFormEvent
diff --git a/en/application-dev/reference/apis/js-apis-backgroundTaskManager.md b/en/application-dev/reference/apis/js-apis-backgroundTaskManager.md
index c05f331ad7f1fa1a9db31080bd1cc06ad9767054..68dbb2a9b09191de76d68cb42ac76977ee50f824 100644
--- a/en/application-dev/reference/apis/js-apis-backgroundTaskManager.md
+++ b/en/application-dev/reference/apis/js-apis-backgroundTaskManager.md
@@ -161,7 +161,7 @@ Requests a continuous task from the system. This API uses an asynchronous callba
| Name | Type | Mandatory| Description |
| --------- | --------------------------------------------- | ---- | ------------------------------------------------------------ |
-| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).|
+| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-context.md).|
| bgMode | [BackgroundMode](#backgroundmode8) | Yes | Background mode requested. |
| wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | Yes | Notification parameter, which is used to specify the target page that is redirected to when a continuous task notification is clicked. |
| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
@@ -253,7 +253,7 @@ Requests a continuous task from the system. This API uses a promise to return th
| Name | Type | Mandatory| Description |
| --------- | --------------------------------------------- | ---- | ------------------------------------------------------------ |
-| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).|
+| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-context.md).|
| bgMode | [BackgroundMode](#backgroundmode8) | Yes | Background mode requested. |
| wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | Yes | Notification parameter, which is used to specify the target page that is redirected to when a continuous task notification is clicked. |
@@ -339,7 +339,7 @@ Requests to cancel a continuous task. This API uses an asynchronous callback to
| Name | Type | Mandatory | Description |
| -------- | ------------------------- | ---- | ---------------------------------------- |
-| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).|
+| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-context.md).|
| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
**Example**
@@ -395,7 +395,7 @@ Requests to cancel a continuous task. This API uses a promise to return the resu
| Name | Type | Mandatory | Description |
| ------- | ------- | ---- | ---------------------------------------- |
-| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).|
+| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-context.md).|
**Return value**
diff --git a/en/application-dev/reference/apis/js-apis-resourceschedule-backgroundTaskManager.md b/en/application-dev/reference/apis/js-apis-resourceschedule-backgroundTaskManager.md
index 9ff197787fb1ce1eaaab9f26f993edef2f364ea3..3479e06ffebf2cc53b2a9d40248bc632e9f01a82 100644
--- a/en/application-dev/reference/apis/js-apis-resourceschedule-backgroundTaskManager.md
+++ b/en/application-dev/reference/apis/js-apis-resourceschedule-backgroundTaskManager.md
@@ -234,7 +234,7 @@ Requests a continuous task from the system. This API uses an asynchronous callba
| Name | Type | Mandatory | Description |
| --------- | ---------------------------------- | ---- | ---------------------------------------- |
-| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).|
+| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-context.md).|
| bgMode | [BackgroundMode](#backgroundmode) | Yes | Background mode requested. |
| wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | Yes | Notification parameter, which is used to specify the target page that is redirected to when a continuous task notification is clicked. |
| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
@@ -312,7 +312,7 @@ Requests a continuous task from the system. This API uses a promise to return th
| Name | Type | Mandatory | Description |
| --------- | ---------------------------------- | ---- | ---------------------------------------- |
-| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).|
+| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-context.md).|
| bgMode | [BackgroundMode](#backgroundmode) | Yes | Background mode requested. |
| wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | Yes | Notification parameter, which is used to specify the target page that is redirected to when a continuous task notification is clicked. |
@@ -389,7 +389,7 @@ Requests to cancel a continuous task. This API uses an asynchronous callback to
| Name | Type | Mandatory | Description |
| -------- | ------------------------- | ---- | ---------------------------------------- |
-| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).|
+| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-context.md).|
| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
**Error codes**
@@ -445,7 +445,7 @@ Requests to cancel a continuous task. This API uses a promise to return the resu
| Name | Type | Mandatory | Description |
| ------- | ------- | ---- | ---------------------------------------- |
-| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).|
+| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-context.md).|
**Return value**
diff --git a/en/application-dev/task-management/continuous-task-dev-guide.md b/en/application-dev/task-management/continuous-task-dev-guide.md
index 79280f8d301f75f45fbe2f0eb0724c17e7576e67..ff3ff065c3eacea69898cea1c280eb73b910f355 100644
--- a/en/application-dev/task-management/continuous-task-dev-guide.md
+++ b/en/application-dev/task-management/continuous-task-dev-guide.md
@@ -58,7 +58,7 @@ If an application needs to interact with a continuous task in the background (fo
],
"reqPermissions": [
{
- "name": "ohos.permission.KEEP_BACKGROUND_RUNNING" // Continuous task permission
+ "name": "ohos.permission.KEEP_BACKGROUND_RUNNING" // Continuous task permission
}
]
}
@@ -345,7 +345,7 @@ For details about the stage model, see [Stage Model Development Overview](../app
}
}
- class MySequenceable {
+ class MyParcelable {
num: number = 0;
str: String = "";
@@ -354,31 +354,31 @@ For details about the stage model, see [Stage Model Development Overview](../app
this.str = string;
}
- marshalling(messageParcel) {
- messageParcel.writeInt(this.num);
- messageParcel.writeString(this.str);
+ marshalling(messageSequence) {
+ messageSequence.writeInt(this.num);
+ messageSequence.writeString(this.str);
return true;
}
- unmarshalling(messageParcel) {
- this.num = messageParcel.readInt();
- this.str = messageParcel.readString();
+ unmarshalling(messageSequence) {
+ this.num = messageSequence.readInt();
+ this.str = messageSequence.readString();
return true;
}
}
function sendMsgCallback(data) {
console.info('BgTaskAbility funcCallBack is called ' + data)
- let receivedData = new MySequenceable(0, "")
- data.readSequenceable(receivedData)
+ let receivedData = new MyParcelable(0, "")
+ data.readParcelable(receivedData)
console.info(`receiveData[${receivedData.num}, ${receivedData.str}]`)
- // You can execute different methods based on the str value in the sequenceable data sent by the caller.
+ // You can execute different methods based on the str value in the parcelable data sent by the caller.
if (receivedData.str === 'start_bgtask') {
startContinuousTask()
} else if (receivedData.str === 'stop_bgtask') {
stopContinuousTask();
}
- return new MySequenceable(10, "Callee test");
+ return new MyParcelable(10, "Callee test");
}
export default class BgTaskAbility extends Ability {