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

!19720 【翻译完成】#I76U45

Merge pull request !19720 from Annie_wang/cherry-pick-1686790140
...@@ -2397,7 +2397,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode ...@@ -2397,7 +2397,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode
```ts ```ts
// Import @ohos.ability.featureAbility only for the application developed based on the FA model. // Import @ohos.ability.featureAbility only for the application developed based on the FA model.
// import FA from "@ohos.ability.featureAbility"; // import FA from "@ohos.ability.featureAbility";
let proxy; let proxy;
let connect = { let connect = {
onConnect: function(elementName, remoteProxy) { onConnect: function(elementName, remoteProxy) {
...@@ -2415,10 +2415,10 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode ...@@ -2415,10 +2415,10 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode
"bundleName": "com.ohos.server", "bundleName": "com.ohos.server",
"abilityName": "com.ohos.server.EntryAbility", "abilityName": "com.ohos.server.EntryAbility",
}; };
// Use this method to connect to the ability for the FA model. // Use this method to connect to the ability for the FA model.
// FA.connectAbility(want,connect); // FA.connectAbility(want,connect);
globalThis.context.connectServiceExtensionAbility(want, connect); globalThis.context.connectServiceExtensionAbility(want, connect);
``` ```
...@@ -4860,7 +4860,7 @@ Reads the exception information from this **MessageParcel** object. ...@@ -4860,7 +4860,7 @@ Reads the exception information from this **MessageParcel** object.
```ts ```ts
// Import @ohos.ability.featureAbility only for the application developed based on the FA model. // Import @ohos.ability.featureAbility only for the application developed based on the FA model.
// import FA from "@ohos.ability.featureAbility"; // import FA from "@ohos.ability.featureAbility";
let proxy; let proxy;
let connect = { let connect = {
onConnect: function(elementName, remoteProxy) { onConnect: function(elementName, remoteProxy) {
...@@ -4878,10 +4878,10 @@ Reads the exception information from this **MessageParcel** object. ...@@ -4878,10 +4878,10 @@ Reads the exception information from this **MessageParcel** object.
"bundleName": "com.ohos.server", "bundleName": "com.ohos.server",
"abilityName": "com.ohos.server.EntryAbility", "abilityName": "com.ohos.server.EntryAbility",
}; };
// Use this method to connect to the ability for the FA model. // Use this method to connect to the ability for the FA model.
// FA.connectAbility(want,connect); // FA.connectAbility(want,connect);
globalThis.context.connectServiceExtensionAbility(want, connect); globalThis.context.connectServiceExtensionAbility(want, connect);
``` ```
...@@ -5452,6 +5452,7 @@ Marshals this **Parcelable** object into a **MessageSequence** object. ...@@ -5452,6 +5452,7 @@ Marshals this **Parcelable** object into a **MessageSequence** object.
| Type | Description | | Type | Description |
| ------- | -------------------------------- | | ------- | -------------------------------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
**Example** **Example**
```ts ```ts
...@@ -5557,6 +5558,7 @@ Marshals the sequenceable object into a **MessageParcel** object. ...@@ -5557,6 +5558,7 @@ Marshals the sequenceable object into a **MessageParcel** object.
| Type | Description | | Type | Description |
| ------- | -------------------------------- | | ------- | -------------------------------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
**Example** **Example**
```ts ```ts
...@@ -5673,7 +5675,7 @@ Obtains a proxy or remote object. This API must be implemented by its derived cl ...@@ -5673,7 +5675,7 @@ Obtains a proxy or remote object. This API must be implemented by its derived cl
```ts ```ts
// Import @ohos.ability.featureAbility only for the application developed based on the FA model. // Import @ohos.ability.featureAbility only for the application developed based on the FA model.
// import FA from "@ohos.ability.featureAbility"; // import FA from "@ohos.ability.featureAbility";
let proxy; let proxy;
let connect = { let connect = {
onConnect: function(elementName, remoteProxy) { onConnect: function(elementName, remoteProxy) {
...@@ -5691,10 +5693,10 @@ Obtains a proxy or remote object. This API must be implemented by its derived cl ...@@ -5691,10 +5693,10 @@ Obtains a proxy or remote object. This API must be implemented by its derived cl
"bundleName": "com.ohos.server", "bundleName": "com.ohos.server",
"abilityName": "com.ohos.server.EntryAbility", "abilityName": "com.ohos.server.EntryAbility",
}; };
// Use this method to connect to the ability for the FA model. // Use this method to connect to the ability for the FA model.
// FA.connectAbility(want,connect); // FA.connectAbility(want,connect);
globalThis.context.connectServiceExtensionAbility(want, connect); globalThis.context.connectServiceExtensionAbility(want, connect);
``` ```
...@@ -6117,7 +6119,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch ...@@ -6117,7 +6119,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
```ts ```ts
// Import @ohos.ability.featureAbility only for the application developed based on the FA model. // Import @ohos.ability.featureAbility only for the application developed based on the FA model.
// import FA from "@ohos.ability.featureAbility"; // import FA from "@ohos.ability.featureAbility";
let proxy; let proxy;
let connect = { let connect = {
onConnect: function(elementName, remoteProxy) { onConnect: function(elementName, remoteProxy) {
...@@ -6135,10 +6137,10 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch ...@@ -6135,10 +6137,10 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
"bundleName": "com.ohos.server", "bundleName": "com.ohos.server",
"abilityName": "com.ohos.server.EntryAbility", "abilityName": "com.ohos.server.EntryAbility",
}; };
// Use this method to connect to the ability for the FA model. // Use this method to connect to the ability for the FA model.
// FA.connectAbility(want,connect); // FA.connectAbility(want,connect);
globalThis.context.connectServiceExtensionAbility(want, connect); globalThis.context.connectServiceExtensionAbility(want, connect);
``` ```
...@@ -6193,7 +6195,7 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn ...@@ -6193,7 +6195,7 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn
```ts ```ts
// Import @ohos.ability.featureAbility only for the application developed based on the FA model. // Import @ohos.ability.featureAbility only for the application developed based on the FA model.
// import FA from "@ohos.ability.featureAbility"; // import FA from "@ohos.ability.featureAbility";
let proxy; let proxy;
let connect = { let connect = {
onConnect: function(elementName, remoteProxy) { onConnect: function(elementName, remoteProxy) {
...@@ -6211,10 +6213,10 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn ...@@ -6211,10 +6213,10 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn
"bundleName": "com.ohos.server", "bundleName": "com.ohos.server",
"abilityName": "com.ohos.server.EntryAbility", "abilityName": "com.ohos.server.EntryAbility",
}; };
// Use this method to connect to the ability for the FA model. // Use this method to connect to the ability for the FA model.
// FA.connectAbility(want,connect); // FA.connectAbility(want,connect);
globalThis.context.connectServiceExtensionAbility(want, connect); globalThis.context.connectServiceExtensionAbility(want, connect);
``` ```
...@@ -6277,7 +6279,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch ...@@ -6277,7 +6279,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
```ts ```ts
// Import @ohos.ability.featureAbility only for the application developed based on the FA model. // Import @ohos.ability.featureAbility only for the application developed based on the FA model.
// import FA from "@ohos.ability.featureAbility"; // import FA from "@ohos.ability.featureAbility";
let proxy; let proxy;
let connect = { let connect = {
onConnect: function(elementName, remoteProxy) { onConnect: function(elementName, remoteProxy) {
...@@ -6295,10 +6297,10 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch ...@@ -6295,10 +6297,10 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
"bundleName": "com.ohos.server", "bundleName": "com.ohos.server",
"abilityName": "com.ohos.server.EntryAbility", "abilityName": "com.ohos.server.EntryAbility",
}; };
// Use this method to connect to the ability for the FA model. // Use this method to connect to the ability for the FA model.
// FA.connectAbility(want,connect); // FA.connectAbility(want,connect);
globalThis.context.connectServiceExtensionAbility(want, connect); globalThis.context.connectServiceExtensionAbility(want, connect);
``` ```
...@@ -6354,7 +6356,7 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn ...@@ -6354,7 +6356,7 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn
```ts ```ts
// Import @ohos.ability.featureAbility only for the application developed based on the FA model. // Import @ohos.ability.featureAbility only for the application developed based on the FA model.
// import FA from "@ohos.ability.featureAbility"; // import FA from "@ohos.ability.featureAbility";
let proxy; let proxy;
let connect = { let connect = {
onConnect: function(elementName, remoteProxy) { onConnect: function(elementName, remoteProxy) {
...@@ -6385,10 +6387,10 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn ...@@ -6385,10 +6387,10 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn
result.data.reclaim(); result.data.reclaim();
result.reply.reclaim(); result.reply.reclaim();
} }
// Use this method to connect to the ability for the FA model. // Use this method to connect to the ability for the FA model.
// FA.connectAbility(want,connect); // FA.connectAbility(want,connect);
globalThis.context.connectServiceExtensionAbility(want, connect); globalThis.context.connectServiceExtensionAbility(want, connect);
``` ```
...@@ -6435,7 +6437,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch ...@@ -6435,7 +6437,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
```ts ```ts
// Import @ohos.ability.featureAbility only for the application developed based on the FA model. // Import @ohos.ability.featureAbility only for the application developed based on the FA model.
// import FA from "@ohos.ability.featureAbility"; // import FA from "@ohos.ability.featureAbility";
let proxy; let proxy;
let connect = { let connect = {
onConnect: function(elementName, remoteProxy) { onConnect: function(elementName, remoteProxy) {
...@@ -6466,10 +6468,10 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch ...@@ -6466,10 +6468,10 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch
result.data.reclaim(); result.data.reclaim();
result.reply.reclaim(); result.reply.reclaim();
} }
// Use this method to connect to the ability for the FA model. // Use this method to connect to the ability for the FA model.
// FA.connectAbility(want,connect); // FA.connectAbility(want,connect);
globalThis.context.connectServiceExtensionAbility(want, connect); globalThis.context.connectServiceExtensionAbility(want, connect);
``` ```
...@@ -6519,7 +6521,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode ...@@ -6519,7 +6521,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode
```ts ```ts
// Import @ohos.ability.featureAbility only for the application developed based on the FA model. // Import @ohos.ability.featureAbility only for the application developed based on the FA model.
// import FA from "@ohos.ability.featureAbility"; // import FA from "@ohos.ability.featureAbility";
let proxy; let proxy;
let connect = { let connect = {
onConnect: function(elementName, remoteProxy) { onConnect: function(elementName, remoteProxy) {
...@@ -6537,10 +6539,10 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode ...@@ -6537,10 +6539,10 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode
"bundleName": "com.ohos.server", "bundleName": "com.ohos.server",
"abilityName": "com.ohos.server.EntryAbility", "abilityName": "com.ohos.server.EntryAbility",
}; };
// Use this method to connect to the ability for the FA model. // Use this method to connect to the ability for the FA model.
// FA.connectAbility(want,connect); // FA.connectAbility(want,connect);
globalThis.context.connectServiceExtensionAbility(want, connect); globalThis.context.connectServiceExtensionAbility(want, connect);
``` ```
...@@ -6585,7 +6587,7 @@ Obtains the **LocalInterface** object of an interface token. ...@@ -6585,7 +6587,7 @@ Obtains the **LocalInterface** object of an interface token.
```ts ```ts
// Import @ohos.ability.featureAbility only for the application developed based on the FA model. // Import @ohos.ability.featureAbility only for the application developed based on the FA model.
// import FA from "@ohos.ability.featureAbility"; // import FA from "@ohos.ability.featureAbility";
let proxy; let proxy;
let connect = { let connect = {
onConnect: function(elementName, remoteProxy) { onConnect: function(elementName, remoteProxy) {
...@@ -6603,10 +6605,10 @@ Obtains the **LocalInterface** object of an interface token. ...@@ -6603,10 +6605,10 @@ Obtains the **LocalInterface** object of an interface token.
"bundleName": "com.ohos.server", "bundleName": "com.ohos.server",
"abilityName": "com.ohos.server.EntryAbility", "abilityName": "com.ohos.server.EntryAbility",
}; };
// Use this method to connect to the ability for the FA model. // Use this method to connect to the ability for the FA model.
// FA.connectAbility(want,connect); // FA.connectAbility(want,connect);
globalThis.context.connectServiceExtensionAbility(want, connect); globalThis.context.connectServiceExtensionAbility(want, connect);
``` ```
...@@ -6647,7 +6649,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode ...@@ -6647,7 +6649,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode
```ts ```ts
// Import @ohos.ability.featureAbility only for the application developed based on the FA model. // Import @ohos.ability.featureAbility only for the application developed based on the FA model.
// import FA from "@ohos.ability.featureAbility"; // import FA from "@ohos.ability.featureAbility";
let proxy; let proxy;
let connect = { let connect = {
onConnect: function(elementName, remoteProxy) { onConnect: function(elementName, remoteProxy) {
...@@ -6665,10 +6667,10 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode ...@@ -6665,10 +6667,10 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode
"bundleName": "com.ohos.server", "bundleName": "com.ohos.server",
"abilityName": "com.ohos.server.EntryAbility", "abilityName": "com.ohos.server.EntryAbility",
}; };
// Use this method to connect to the ability for the FA model. // Use this method to connect to the ability for the FA model.
// FA.connectAbility(want,connect); // FA.connectAbility(want,connect);
globalThis.context.connectServiceExtensionAbility(want, connect); globalThis.context.connectServiceExtensionAbility(want, connect);
``` ```
...@@ -6689,7 +6691,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode ...@@ -6689,7 +6691,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode
} }
``` ```
### addDeathRecippient<sup>(deprecated)</sup> ### addDeathRecipient<sup>(deprecated)</sup>
>This API is no longer maintained since API version 9. You are advised to use [registerDeathRecipient](#registerdeathrecipient9). >This API is no longer maintained since API version 9. You are advised to use [registerDeathRecipient](#registerdeathrecipient9).
...@@ -6719,7 +6721,7 @@ Adds a callback for receiving the death notifications of the remote object, incl ...@@ -6719,7 +6721,7 @@ Adds a callback for receiving the death notifications of the remote object, incl
```ts ```ts
// Import @ohos.ability.featureAbility only for the application developed based on the FA model. // Import @ohos.ability.featureAbility only for the application developed based on the FA model.
// import FA from "@ohos.ability.featureAbility"; // import FA from "@ohos.ability.featureAbility";
let proxy; let proxy;
let connect = { let connect = {
onConnect: function(elementName, remoteProxy) { onConnect: function(elementName, remoteProxy) {
...@@ -6737,14 +6739,14 @@ Adds a callback for receiving the death notifications of the remote object, incl ...@@ -6737,14 +6739,14 @@ Adds a callback for receiving the death notifications of the remote object, incl
"bundleName": "com.ohos.server", "bundleName": "com.ohos.server",
"abilityName": "com.ohos.server.EntryAbility", "abilityName": "com.ohos.server.EntryAbility",
}; };
// Use this method to connect to the ability for the FA model. // Use this method to connect to the ability for the FA model.
// FA.connectAbility(want,connect); // FA.connectAbility(want,connect);
globalThis.context.connectServiceExtensionAbility(want, connect); globalThis.context.connectServiceExtensionAbility(want, connect);
``` ```
The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **addDeathRecippient()** of the proxy object is called to add a callback for receiving the death notification of the remove object. The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **addDeathRecipient()** of the proxy object is called to add a callback for receiving the death notification of the remove object.
```ts ```ts
class MyDeathRecipient { class MyDeathRecipient {
...@@ -6786,7 +6788,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode ...@@ -6786,7 +6788,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode
```ts ```ts
// Import @ohos.ability.featureAbility only for the application developed based on the FA model. // Import @ohos.ability.featureAbility only for the application developed based on the FA model.
// import FA from "@ohos.ability.featureAbility"; // import FA from "@ohos.ability.featureAbility";
let proxy; let proxy;
let connect = { let connect = {
onConnect: function(elementName, remoteProxy) { onConnect: function(elementName, remoteProxy) {
...@@ -6804,10 +6806,10 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode ...@@ -6804,10 +6806,10 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode
"bundleName": "com.ohos.server", "bundleName": "com.ohos.server",
"abilityName": "com.ohos.server.EntryAbility", "abilityName": "com.ohos.server.EntryAbility",
}; };
// Use this method to connect to the ability for the FA model. // Use this method to connect to the ability for the FA model.
// FA.connectAbility(want,connect); // FA.connectAbility(want,connect);
globalThis.context.connectServiceExtensionAbility(want, connect); globalThis.context.connectServiceExtensionAbility(want, connect);
``` ```
...@@ -6859,7 +6861,7 @@ Removes the callback used to receive death notifications of the remote object. ...@@ -6859,7 +6861,7 @@ Removes the callback used to receive death notifications of the remote object.
```ts ```ts
// Import @ohos.ability.featureAbility only for the application developed based on the FA model. // Import @ohos.ability.featureAbility only for the application developed based on the FA model.
// import FA from "@ohos.ability.featureAbility"; // import FA from "@ohos.ability.featureAbility";
let proxy; let proxy;
let connect = { let connect = {
onConnect: function(elementName, remoteProxy) { onConnect: function(elementName, remoteProxy) {
...@@ -6877,10 +6879,10 @@ Removes the callback used to receive death notifications of the remote object. ...@@ -6877,10 +6879,10 @@ Removes the callback used to receive death notifications of the remote object.
"bundleName": "com.ohos.server", "bundleName": "com.ohos.server",
"abilityName": "com.ohos.server.EntryAbility", "abilityName": "com.ohos.server.EntryAbility",
}; };
// Use this method to connect to the ability for the FA model. // Use this method to connect to the ability for the FA model.
// FA.connectAbility(want,connect); // FA.connectAbility(want,connect);
globalThis.context.connectServiceExtensionAbility(want, connect); globalThis.context.connectServiceExtensionAbility(want, connect);
``` ```
...@@ -6927,7 +6929,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode ...@@ -6927,7 +6929,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode
```ts ```ts
// Import @ohos.ability.featureAbility only for the application developed based on the FA model. // Import @ohos.ability.featureAbility only for the application developed based on the FA model.
// import FA from "@ohos.ability.featureAbility"; // import FA from "@ohos.ability.featureAbility";
let proxy; let proxy;
let connect = { let connect = {
onConnect: function(elementName, remoteProxy) { onConnect: function(elementName, remoteProxy) {
...@@ -6945,10 +6947,10 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode ...@@ -6945,10 +6947,10 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode
"bundleName": "com.ohos.server", "bundleName": "com.ohos.server",
"abilityName": "com.ohos.server.EntryAbility", "abilityName": "com.ohos.server.EntryAbility",
}; };
// Use this method to connect to the ability for the FA model. // Use this method to connect to the ability for the FA model.
// FA.connectAbility(want,connect); // FA.connectAbility(want,connect);
globalThis.context.connectServiceExtensionAbility(want, connect); globalThis.context.connectServiceExtensionAbility(want, connect);
``` ```
The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **getDescriptor()** of the proxy object is called to obtain the interface descriptor of the object. The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **getDescriptor()** of the proxy object is called to obtain the interface descriptor of the object.
...@@ -6986,7 +6988,7 @@ Obtains the interface descriptor of this proxy object. ...@@ -6986,7 +6988,7 @@ Obtains the interface descriptor of this proxy object.
```ts ```ts
// Import @ohos.ability.featureAbility only for the application developed based on the FA model. // Import @ohos.ability.featureAbility only for the application developed based on the FA model.
// import FA from "@ohos.ability.featureAbility"; // import FA from "@ohos.ability.featureAbility";
let proxy; let proxy;
let connect = { let connect = {
onConnect: function(elementName, remoteProxy) { onConnect: function(elementName, remoteProxy) {
...@@ -7004,10 +7006,10 @@ Obtains the interface descriptor of this proxy object. ...@@ -7004,10 +7006,10 @@ Obtains the interface descriptor of this proxy object.
"bundleName": "com.ohos.server", "bundleName": "com.ohos.server",
"abilityName": "com.ohos.server.EntryAbility", "abilityName": "com.ohos.server.EntryAbility",
}; };
// Use this method to connect to the ability for the FA model. // Use this method to connect to the ability for the FA model.
// FA.connectAbility(want,connect); // FA.connectAbility(want,connect);
globalThis.context.connectServiceExtensionAbility(want, connect); globalThis.context.connectServiceExtensionAbility(want, connect);
``` ```
...@@ -7039,7 +7041,7 @@ Checks whether the **RemoteObject** is dead. ...@@ -7039,7 +7041,7 @@ Checks whether the **RemoteObject** is dead.
```ts ```ts
// Import @ohos.ability.featureAbility only for the application developed based on the FA model. // Import @ohos.ability.featureAbility only for the application developed based on the FA model.
// import FA from "@ohos.ability.featureAbility"; // import FA from "@ohos.ability.featureAbility";
let proxy; let proxy;
let connect = { let connect = {
onConnect: function(elementName, remoteProxy) { onConnect: function(elementName, remoteProxy) {
...@@ -7057,10 +7059,10 @@ Checks whether the **RemoteObject** is dead. ...@@ -7057,10 +7059,10 @@ Checks whether the **RemoteObject** is dead.
"bundleName": "com.ohos.server", "bundleName": "com.ohos.server",
"abilityName": "com.ohos.server.EntryAbility", "abilityName": "com.ohos.server.EntryAbility",
}; };
// Use this method to connect to the ability for the FA model. // Use this method to connect to the ability for the FA model.
// FA.connectAbility(want,connect); // FA.connectAbility(want,connect);
globalThis.context.connectServiceExtensionAbility(want, connect); globalThis.context.connectServiceExtensionAbility(want, connect);
``` ```
...@@ -7095,9 +7097,9 @@ A constructor used to create a **MessageOption** object. ...@@ -7095,9 +7097,9 @@ A constructor used to create a **MessageOption** object.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| --------- | ------ | ---- | -------------------------------------- | | ------ | ------- | ---- | -------------------------------------- |
| syncFlags | number | No | Call flag, which can be synchronous or asynchronous. The default value is **synchronous**.| | async | boolean | No | Call flag, which can be synchronous or asynchronous. The default value is **synchronous**.|
**Example** **Example**
...@@ -7146,7 +7148,7 @@ Checks whether **SendMessageRequest** is called synchronously or asynchronously. ...@@ -7146,7 +7148,7 @@ Checks whether **SendMessageRequest** is called synchronously or asynchronously.
| Type | Description | | Type | Description |
| ------- | ---------------------------------------- | | ------- | ---------------------------------------- |
| boolean | Returns **true** if **SendMessageRequest** is called synchronously; returns **false** if **SendMessageRequest** is called asynchronously.| | boolean | Returns **true** if **SendMessageRequest** is called asynchronously; returns **false** if it is called synchronously.|
**Example** **Example**
...@@ -7825,7 +7827,7 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn ...@@ -7825,7 +7827,7 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn
| Type | Description | | Type | Description |
| ---------------------------- | --------------------------------------------- | | ---------------------------- | --------------------------------------------- |
| Promise&lt;RequestResult&gt; | Promise used to return the **sendRequestResult** object.| | Promise&lt;RequestResult&gt; | Promise used to return the **RequestResult** instance. |
**Example** **Example**
...@@ -9101,29 +9103,30 @@ Reads data from the shared file associated with this **Ashmem** object. ...@@ -9101,29 +9103,30 @@ Reads data from the shared file associated with this **Ashmem** object.
```ts ```ts
import Ability from '@ohos.app.ability.UIAbility'; import Ability from '@ohos.app.ability.UIAbility';
export default class MainAbility extends Ability { export default class MainAbility extends Ability {
onCreate(want, launchParam) { onCreate(want, launchParam) {
console.log("[Demo] MainAbility onCreate"); console.log("[Demo] MainAbility onCreate");
globalThis.context = this.context; globalThis.context = this.context;
} }
onDestroy() { onDestroy() {
console.log("[Demo] MainAbility onDestroy"); console.log("[Demo] MainAbility onDestroy");
} }
onWindowStageCreate(windowStage) { onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability // Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate"); console.log("[Demo] MainAbility onWindowStageCreate");
} }
onWindowStageDestroy() { onWindowStageDestroy() {
// Main window is destroyed, release UI related resources // Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility onWindowStageDestroy"); console.log("[Demo] MainAbility onWindowStageDestroy");
} }
onForeground() { onForeground() {
// Ability has brought to foreground // Ability has brought to foreground
console.log("[Demo] MainAbility onForeground"); console.log("[Demo] MainAbility onForeground");
} }
onBackground() { onBackground() {
// Ability has back to background // Ability has back to background
console.log("[Demo] MainAbility onBackground"); console.log("[Demo] MainAbility onBackground");
} }
}; };
``` ```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册