diff --git a/en/application-dev/reference/apis/js-apis-application-abilityConstant.md b/en/application-dev/reference/apis/js-apis-application-abilityConstant.md new file mode 100644 index 0000000000000000000000000000000000000000..4e00922ba0efccb12fe03fb7fc0c46a607b2f4d3 --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-application-abilityConstant.md @@ -0,0 +1,56 @@ +# AbilityConstant + +> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> The initial APIs of this module are supported since API version 9. + + +Provides parameters related to ability launch. + + +## Modules to Import + + +```js +import AbilityConstant from '@ohos.application.AbilityConstant'; +``` + + +## Attributes + +| Name| Type| Readable| Writable| Description| +| -------- | -------- | -------- | -------- | -------- | +| launchReason | LaunchReason| Yes| Yes| Ability launch reason.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core| +| lastExitReason | LastExitReason | Yes| Yes| Reason for the last exit.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core| + +## AbilityConstant.LaunchReason + +Enumerates ability launch reasons. + +| Name | Value | Description | +| ----------------------------- | ---- | ------------------------------------------------------------ | +| UNKNOWN | 0 | Unknown reason.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core| +| START_ABILITY | 1 | Ability startup.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core| +| CALL | 2 | Call.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core| +| CONTINUATION | 3 | Ability continuation.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core| + + +## AbilityConstant.LaunchReason + +Enumerates reasons for the last exit. + +| Name | Value | Description | +| ----------------------------- | ---- | ------------------------------------------------------------ | +| UNKNOWN | 0 | Unknown reason.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core| +| ABILITY_NOT_RESPONDING | 1 | The ability does not respond.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core| +| NORMAL | 2 | Normal status.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core| + + +## AbilityConstant.OnContinueResult + +Enumerates ability continuation results. + +| Name | Value | Description | +| ----------------------------- | ---- | ------------------------------------------------------------ | +| AGREE | 0 | Continuation agreed.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core| +| REJECT | 1 | Continuation denied.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core| +| MISMATCH | 2 | Mismatch.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core| diff --git a/en/application-dev/reference/apis/js-apis-basic-features-app-context.md b/en/application-dev/reference/apis/js-apis-basic-features-app-context.md deleted file mode 100644 index 01ee2571a8fb5275a2099acbca13458e8a561e32..0000000000000000000000000000000000000000 --- a/en/application-dev/reference/apis/js-apis-basic-features-app-context.md +++ /dev/null @@ -1,89 +0,0 @@ -# Application Context - -## Module to Import - -``` -import app from '@system.app'; -``` - -## Required Permissions - -None - -## app.getInfo - -getInfo\(\): <[AppResponse](#t3e93239d9b134b80957bcdd4acb05291)\> - -Obtains the declared information in the **config.json** file of an application. - -- Return values - - **Table 1** AppResponse - - - - - - - - - - - - - - - - - - - - - - - -

Name

-

Type

-

Description

-

appID6+

-

string

-

Bundle name of the application. It uniquely identifies the application.

-

appName

-

string

-

Application name

-

versionName

-

string

-

Application version name

-

versionCode

-

number

-

Application version

-
- -- Example - - ``` - export default { - getInfo(){ - var info = app.getInfo(); - console.log(JSON.stringify(info)); - } - } - ``` - - -## app.terminate - -terminate\(\): void - -Destroys the current ability. - -- Example - - ``` - export default { - terminate(){ - app.terminate(); - }} - ``` - - diff --git a/en/application-dev/reference/apis/js-apis-basic-features-configuration.md b/en/application-dev/reference/apis/js-apis-basic-features-configuration.md deleted file mode 100644 index 4980558fae443cc47c6931e30c73d26fc77ef5d0..0000000000000000000000000000000000000000 --- a/en/application-dev/reference/apis/js-apis-basic-features-configuration.md +++ /dev/null @@ -1,77 +0,0 @@ -# Application Configuration - -## Module to Import - -``` -import configuration from '@system.configuration'; -``` - -## Required Permissions - -None - -## configuration.getLocale - -getLocale\(\): <[LocaleResponse](#table1544853546)\> - -Obtains the current locale of the application, which is the same as the system locale. - -- Return values - - **Table 1** LocaleResponse - - - - - - - - - - - - - - - - - - - - - - - - -

Name

-

Type

-

Description

-

language

-

string

-

Current language of the application, for example, zh.

-

countryOrRegion

-

string

-

Country or region, for example, CN.

-

dir

-

string

-

Text layout direction. Available values are as follows:

-
  • ltr: The text direction is from left to right.
  • rtl: The text direction is from right to left.
-

unicodeSetting5+

-

string

-

Unicode key set determined by the locale.

-

For example, {"nu":"arab"} indicates that the current locale uses Arabic numerals.

-

If the current locale does not have a specific key set, an empty set is returned.

-
- -- Example - - ``` - export default { - getLocale() { - const localeInfo = configuration.getLocale(); - console.info(localeInfo.language); - } - } - ``` - - diff --git a/en/application-dev/reference/apis/js-apis-basic-features-pop-up.md b/en/application-dev/reference/apis/js-apis-basic-features-pop-up.md deleted file mode 100644 index eefc43e94dd0fcedc89e03850d2b431b6d8dd0b1..0000000000000000000000000000000000000000 --- a/en/application-dev/reference/apis/js-apis-basic-features-pop-up.md +++ /dev/null @@ -1,322 +0,0 @@ -# Pop-up Window - ->![](../../public_sys-resources/icon-note.gif) **NOTE:** ->The initial APIs of this module are supported since API version 4. Newly added APIs will be marked with a superscript to indicate their earliest API version. - -## Module to Import - -``` -import prompt from '@system.prompt'; -``` - -## Required Permissions - -None - -## prompt.showToast - -showToast\(Object\): void - -Displays the toast dialog box. - -- Parameter - - - - - - - - - - - - - - - - - - - - - - - - -

Name

-

Type

-

Mandatory

-

Description

-

message

-

string

-

Yes

-

Text to display.

-

duration

-

number

-

No

-

Duration of the toast dialog box. The default value is 1500. The recommended value ranges from 1500 ms to 10000 ms.

-
NOTE:

A value less than 1500 is automatically changed to 1500. The maximum value is 10000 ms.

-
-

[bottom]5+

-

<length>

-

No

-

Distance between the dialog border and the bottom of the screen.

-
NOTE:

This parameter is only supported on phones and tablets.

-
-
- -- Example - - ``` - export default { - showToast() { - prompt.showToast({ - message: 'Message Info', - duration: 2000, - }); - } - } - ``` - - -## prompt.showDialog - -showDialog\(\): void - -Displays the dialog box. - -- Parameter - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Name

-

Type

-

Mandatory

-

Description

-

title

-

string

-

No

-

Title of the text to display.

-

message

-

string

-

No

-

Text body.

-

buttons

-

Array

-

No

-

Array of buttons in the dialog box. The array structure is {text:'button', color: '#666666'}. One to three buttons are supported. The first button is of the positiveButton type, the second is of the negativeButton type, and the third is of the neutralButton type.

-

success

-

Function

-

No

-

Called when the dialog box is displayed. For the return value, see return values of the success callback.

-

cancel

-

Function

-

No

-

Called when the operation is cancelled.

-

complete

-

Function

-

No

-

Called when the dialog box is closed.

-
- - Return values of the **success** callback - - - - - - - - - - - - -

Parameter

-

Type

-

Description

-

index

-

number

-

Index of the selected button in the buttons array

-
- -- Example - - ``` - export default { - showDialog() { - prompt.showDialog({ - title: 'Title Info', - message: 'Message Info', - buttons: [ - { - text: 'button', - color: '#666666', - }, - ], - success: function(data) { - console.log('dialog success callback,click button : ' + data.index); - }, - cancel: function() { - console.log('dialog cancel callback'); - }, - }); - } - } - ``` - - -## prompt.showActionMenu6+ - -showActionMenu\(Object\): void - -Displays the operation menu. - -- Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Name

-

Type

-

Mandatory

-

Description

-

title

-

string

-

No

-

Title of the text to display.

-

buttons

-

Array

-

Yes

-

Array of buttons in the dialog box. The array structure is {text:'button', color: '#666666'}. One to six buttons are supported. If there are more than six buttons, the pop-up window will not be displayed.

-

success

-

(data: TapIndex) => void

-

No

-

Called when the operation is successful.

-

cancel

-

() => void

-

No

-

Called when the operation fails.

-

complete

-

() => void

-

No

-

Called when the operation is complete.

-
- - **Table 1** TapIndex - - - - - - - - - - - - -

Name

-

Type

-

Description

-

tapIndex

-

number

-

Index of the selected button in the buttons array, starting from 0.

-
- -- Example - - ``` - export default { - showActionMenu() { - prompt.showActionMenu({ - title: 'Title Info', - buttons: [ - { - text: 'item1', - color: '#666666', - }, - { - text: 'item2', - color: '#000000', - }, - ], - success: function(data) { - console.log('Operation succeeded. Click button: ' + data.tapIndex); - }, - fail: function(data) { - console.log('Operation failed' + data.errMsg); - }, - }); - } - } - ``` - - diff --git a/en/application-dev/reference/apis/js-apis-basic-features-routes.md b/en/application-dev/reference/apis/js-apis-basic-features-routes.md deleted file mode 100644 index b11f4372be2e27168601d9257285065649be1ad2..0000000000000000000000000000000000000000 --- a/en/application-dev/reference/apis/js-apis-basic-features-routes.md +++ /dev/null @@ -1,492 +0,0 @@ -# Page Routing - ->![](../../public_sys-resources/icon-notice.gif) **NOTICE:** ->Page routing APIs can be invoked only after page rendering is complete. Do not call the APIs in **onInit** and **onReady** when the page is still in the rendering phase. - -## Module to Import - -``` -import router from '@system.router'; -``` - -## Required Permissions - -None. - -## router.push - -push\(Object\): void - -Navigates to a specified page in the application based on the page URL and parameters. - -- Parameters - - - - - - - - - - - - - - - - - - - -

Name

-

Type

-

Mandatory

-

Description

-

uri

-

string

-

Yes

-

URI of the destination page, in either of the following formats:

-
  • Absolute path of the page. The value is available in the pages list in the config.json file, for example:
    • pages/index/index
    • pages/detail/detail
    -
  • Particular path. If the URI is a slash (/), the home page is displayed.
-

params

-

Object

-

No

-

Data that needs to be passed to the destination page during navigation. After the destination page is displayed, it can use the passed data, for example, this.data1 (data1 is a key in params). If there is the same key (for example, data1) on the destination page, the passed data1 value will overwrite the original value on the destination page.

-
- -- Example - - ``` - // Example code for the current page - export default { - pushPage() { - router.push({ - uri: 'pages/routerpage2/routerpage2', - params: { - data1: 'message', - data2: { - data3: [123, 456, 789] - }, - }, - }); - } - } - // Example code for the routerpage2 page - export default { - data: { - data1: 'default', - data2: { - data3: [1, 2, 3] - } - }, - onInit() { - console.info('showData1:' + this.data1); - console.info('showData3:' + this.data2.data3); - } - } - ``` - - >![](../../public_sys-resources/icon-note.gif) **NOTE:** - >The page routing stack supports a maximum of 32 pages. - - -## router.replace - -replace\(Object\): void - -Replaces the current page with another one in the application and destroys the current page. - -- Parameter - - - - - - - - - - - - - - - - - - - -

Name

-

Type

-

Mandatory

-

Description

-

uri

-

string

-

Yes

-

URI of the destination page, in either of the following formats:

-
  • Absolute path of the page. The value is available in the pages list in the config.json file, for example:
    • pages/index/index
    • pages/detail/detail
    -
  • Particular path. If the URI is a slash (/), the home page is displayed.
-

params

-

Object

-

No

-

Data that needs to be passed to the destination page during navigation. After the destination page is displayed, it can use the passed data, for example, this.data1 (data1 is a key in params). If there is the same key (for example, data1) on the destination page, the passed data1 value will overwrite the original value on the destination page.

-
- -- Example - - ``` - // Example code for the current page - export default { - replacePage() { - router.replace({ - uri: 'pages/detail/detail', - params: { - data1: 'message', - }, - }); - } - } - // Example code for the detail page - export default { - data: { - data1: 'default' - }, - onInit() { - console.info('showData1:' + this.data1) - } - } - ``` - - -## router.back - -back\(Object\): void - -Returns to the previous page or a specified page. - -- Parameter - - - - - - - - - - - - - - -

Name

-

Type

-

Mandatory

-

Description

-

uri

-

string

-

No

-

URI of the page to return to. If the specified page does not exist in the page stack, the app does not respond. If this parameter is not set, the app returns to the previous page.

-
- -- Example - - ``` - // index page - export default { - indexPushPage() { - router.push({ - uri: 'pages/detail/detail', - }); - } - } - - // detail page - export default { - detailPushPage() { - router.push({ - uri: 'pages/mall/mall', - }); - } - } - - // Navigate from the mall page to the detail page through router.back(). - export default { - mallBackPage() { - router.back(); - } - } - // Navigate from the detail page to the index page through router.back(). - export default { - defaultBack() { - router.back(); - } - } - // Return to the detail page through router.back(). - export default { - backToDetail() { - router.back({uri:'pages/detail/detail'}); - } - } - ``` - - >![](../../public_sys-resources/icon-note.gif) **NOTE:** - >In the example, the **uri** field indicates the page route, which is specified by the **pages** list in the **config.json** file. - - -## router.clear - -clear\(\): void - -Clears all historical pages and retains only the current page at the top of the stack. - -- Example - - ``` - export default { - clearPage() { - router.clear(); - } - } - ``` - - -## router.getLength - -getLength\(\): string - -Obtains the number of pages in the current stack. - -- Return values - - - - - - - - - - -

Type

-

Description

-

string

-

Number of pages in the stack. The maximum value is 32.

-
- -- Example - - ``` - export default { - getLength() { - var size = router.getLength(); - console.log('pages stack size = ' + size); - } - } - ``` - - -## router.getState - -getState\(\): <[RouterState](#tf9e3eb9ef0aa4d9880f996fe6afa6d1b)\> - -Obtains information about the current page state. - -- Return values - - **Table 1** RouterState - - - - - - - - - - - - - - - - - - - - -

Name

-

Type

-

Description

-

index

-

number

-

Index of the current page in the stack.

-
NOTE:

The index starts from 1 from the bottom to the top of the stack.

-
-

name

-

string

-

Name of the current page, that is, the file name.

-

path

-

string

-

Path of the current page.

-
- -- Example - - ``` - export default { - getState() { - var page = router.getState(); - console.log('current index = ' + page.index); - console.log('current name = ' + page.name); - console.log('current path = ' + page.path); - } - } - ``` - - -## router.enableAlertBeforeBackPage6+ - -enableAlertBeforeBackPage\(Object\): void - -Enables the display of a confirm dialog for returning to the previous page. - -- Parameter - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Name

-

Type

-

Mandatory

-

Description

-

message

-

string

-

Yes

-

Content of the confirm dialog.

-

success

-

() => void

-

No

-

Called when the operation is successful.

-

fail

-

() => void

-

No

-

Called when the operation fails.

-

complete

-

() => void

-

No

-

Called when the operation is complete.

-
- -- Example - - ``` - export default { - enableAlertBeforeBackPage() { - router.enableAlertBeforeBackPage({ - message: 'Message Info', - success: function() { - console.log('success'); - }, - fail: function() { - console.log('fail'); - }, - }); - } - } - ``` - - -## router.disableAlertBeforeBackPage6+ - -disableAlertBeforeBackPage\(Object\): void - -Disables the display of a confirm dialog for returning to the previous page. - -- Parameters - - - - - - - - - - - - - - - - - - - - - - - - -

Name

-

Type

-

Mandatory

-

Description

-

success

-

() => void

-

No

-

Called when the operation is successful.

-

fail

-

() => void

-

No

-

Called when the operation fails.

-

complete

-

() => void

-

No

-

Called when the operation is complete.

-
- -- Example - - ``` - export default { - disableAlertBeforeBackPage() { - router.disableAlertBeforeBackPage({ - success: function() { - console.log('success'); - }, - fail: function() { - console.log('fail'); - }, - }); - } - } - ``` - - diff --git a/en/application-dev/reference/apis/js-apis-service-extension.md b/en/application-dev/reference/apis/js-apis-service-extension-ability.md similarity index 91% rename from en/application-dev/reference/apis/js-apis-service-extension.md rename to en/application-dev/reference/apis/js-apis-service-extension-ability.md index 76b55db35209bcf3b6bcbfc97f3d7d974dc05db2..c78d82cad48b93519c6b01729e753e6f4d746cb9 100644 --- a/en/application-dev/reference/apis/js-apis-service-extension.md +++ b/en/application-dev/reference/apis/js-apis-service-extension-ability.md @@ -1,7 +1,7 @@ -# ServiceExtension +# ServiceExtensionAbility > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** -> The initial APIs of this module are supported since API 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. Provides APIs related to **ServiceExtension**. @@ -10,13 +10,13 @@ Provides APIs related to **ServiceExtension**. ## Modules to Import ``` -import ServiceExtension from '@ohos.application.ServiceExtension'; +import ServiceExtension from '@ohos.application.ServiceExtensionAbility'; ``` ## Required Permissions -None +None. ## Attributes @@ -26,7 +26,7 @@ None | context | [ServiceExtensionContext](js-apis-service-extension-context.md) | Yes| No| Service extension context, which is inherited from **ExtensionContext**.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core| -## onCreate +## ServiceExtensionAbility.onCreate onCreate(want: Want): void; @@ -51,7 +51,7 @@ Called when an extension is created to initialize the service logic. ``` -## onDestroy +## ServiceExtensionAbility.onDestroy onDestroy(): void; @@ -70,7 +70,7 @@ Called when this extension is destroyed to clear resources. ``` -## onRequest +## ServiceExtensionAbility.onRequest onRequest(want: Want, startId: number): void; @@ -96,7 +96,7 @@ Called after **onCreate** is invoked when an ability is started by calling **sta ``` -## onConnect +## ServiceExtensionAbility.onConnect onConnect(want: Want): rpc.RemoteObject; @@ -136,7 +136,7 @@ Called after **onCreate** is invoked when an ability is started by calling **con ``` -## onDisconnect +## ServiceExtensionAbility.onDisconnect onDisconnect(want: Want): void; diff --git a/en/application-dev/reference/apis/js-apis-wantAgent.md b/en/application-dev/reference/apis/js-apis-wantAgent.md new file mode 100644 index 0000000000000000000000000000000000000000..5b51de9baa01f675421059ab5acdeddd563208e5 --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-wantAgent.md @@ -0,0 +1,984 @@ +# WantAgent Module + +>**NOTE** +> +>The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. + +## Modules to Import + +```js +import WantAgent from '@ohos.wantAgent'; +``` + +## WantAgent.getWantAgent + +getWantAgent(info: WantAgentInfo, callback: AsyncCallback\): void + +Obtains a **WantAgent** object. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name | Readable| Writable | Type | Mandatory| Description | +| -------- | --- | ---- | -------------------------- | ---- | ----------------------- | +| info | Yes | No | WantAgentInfo | Yes | Information about the **WantAgent** object to obtain. | +| callback | Yes | No | AsyncCallback\ | Yes | Callback used to return the **WantAgent** object.| + +**Example** + +```js +import WantAgent from '@ohos.wantAgent'; +import { OperationType, WantAgentFlags } from '@ohos.wantagent'; + +// getWantAgent callback +function getWantAgentCallback(err, data) { + console.info("==========================>getWantAgentCallback=======================>"); +} +// WantAgentInfo object +var wantAgentInfo = { + wants: [ + { + deviceId: "deviceId", + bundleName: "com.neu.setResultOnAbilityResultTest1", + abilityName: "com.example.test.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + } + ], + operationType: OperationType.START_ABILITIES, + requestCode: 0, + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] +} + +WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback) +``` + + + +## WantAgent.getWantAgent + +getWantAgent(info: WantAgentInfo): Promise\ + +Obtains a **WantAgent** object. This API uses a promise to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name| Readable| Writable | Type | Mandatory| Description | +| ---- | --- | ---- | ------------- | ---- | ------------- | +| info | Yes | No | WantAgentInfo | Yes | Information about the **WantAgent** object to obtain.| + +**Return value** + +| Type | Description | +| ----------------------------------------------------------- | ------------------------------------------------------------ | +| Promise\ | Promise used to return the **WantAgent** object.| + +**Example** + +```js +import WantAgent from '@ohos.wantAgent'; +import { OperationType, WantAgentFlags } from '@ohos.wantagent'; + +// WantAgentInfo object +var wantAgentInfo = { + wants: [ + { + deviceId: "deviceId", + bundleName: "com.neu.setResultOnAbilityResultTest1", + abilityName: "com.example.test.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + } + ], + operationType: OperationType.START_ABILITIES, + requestCode: 0, + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] +} + +WantAgent.getWantAgent(wantAgentInfo).then((data) => { + console.info("==========================>getWantAgentCallback=======================>"); +}); +``` + + + +## WantAgent.getBundleName + +getBundleName(agent: WantAgent, callback: AsyncCallback\): void + +Obtains the bundle name of a **WantAgent** object. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name | Readable| Writable | Type | Mandatory| Description | +| -------- | --- | ---- | ----------------------- | ---- | --------------------------------- | +| agent | Yes | No | WantAgent | Yes | **WantAgent** object whose bundle name is to be obtained. | +| callback | Yes | No | AsyncCallback\ | Yes | Callback used to return the bundle name.| + +**Example** + +```js +import WantAgent from '@ohos.wantAgent'; +import { OperationType, WantAgentFlags } from '@ohos.wantagent'; + +// WantAgent object +var wantAgent; + +// getWantAgent callback +function getWantAgentCallback(err, data) { + console.info("==========================>getWantAgentCallback=======================>"); + if (err.code == 0) { + wantAgent = data; + } else { + console.info('----getWantAgent failed!----'); + } +} +// WantAgentInfo object +var wantAgentInfo = { + wants: [ + { + deviceId: "deviceId", + bundleName: "com.neu.setResultOnAbilityResultTest1", + abilityName: "com.example.test.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + } + ], + operationType: OperationType.START_ABILITIES, + requestCode: 0, + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] +} + +WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback) + +// getBundleName callback +function getBundleNameCallback(err, data) { + console.info("==========================>getBundleNameCallback=======================>"); +} +WantAgent.getBundleName(wantAgent, getBundleNameCallback) +``` + + + +## WantAgent.getBundleName + +getBundleName(agent: WantAgent): Promise\ + +Obtains the bundle name of a **WantAgent** object. This API uses a promise to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name | Readable| Writable| Type | Mandatory| Description | +| ----- | --- | ---- | --------- | ---- | ------------- | +| agent | Yes | No | WantAgent | Yes | **WantAgent** object whose bundle name is to be obtained.| + +**Return value** + +| Type | Description | +| ----------------------------------------------------------- | ------------------------------------------------------------ | +| Promise\ | Promise used to return the bundle name.| + +**Example** + +```js +import WantAgent from '@ohos.wantAgent'; +import { OperationType, WantAgentFlags } from '@ohos.wantagent'; + +// WantAgent object +var wantAgent; + +// WantAgentInfo object +var wantAgentInfo = { + wants: [ + { + deviceId: "deviceId", + bundleName: "com.neu.setResultOnAbilityResultTest1", + abilityName: "com.example.test.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + } + ], + operationType: OperationType.START_ABILITIES, + requestCode: 0, + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] +} + +WantAgent.getWantAgent(wantAgentInfo).then((data) => { + console.info("==========================>getWantAgentCallback=======================>"); + wantAgent = data; +}); + +WantAgent.getBundleName(wantAgent).then((data) => { + console.info("==========================>getBundleNameCallback=======================>"); +}); +``` + + + +## WantAgent.getUid + +getUid(agent: WantAgent, callback: AsyncCallback\): void + +Obtains the user ID of a **WantAgent** object. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name | Readable| Writable| Type | Mandatory| Description | +| -------- | --- | ---- | ----------------------- | ---- | ----------------------------------- | +| agent | Yes | No | WantAgent | Yes | **WantAgent** object whose user ID is to be obtained. | +| callback | Yes | No | AsyncCallback\ | Yes | Callback used to return the user ID.| + +**Example** + +```js +import WantAgent from '@ohos.wantAgent'; +import { OperationType, WantAgentFlags } from '@ohos.wantagent'; + +// WantAgent object +var wantAgent; + +// getWantAgent callback +function getWantAgentCallback(err, data) { + console.info("==========================>getWantAgentCallback=======================>"); + if (err.code == 0) { + wantAgent = data; + } else { + console.info('----getWantAgent failed!----'); + } +} +// WantAgentInfo object +var wantAgentInfo = { + wants: [ + { + deviceId: "deviceId", + bundleName: "com.neu.setResultOnAbilityResultTest1", + abilityName: "com.example.test.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + } + ], + operationType: OperationType.START_ABILITIES, + requestCode: 0, + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] +} + +WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback) + +// getUid callback +function getUidCallback(err, data) { + console.info("==========================>getUidCallback=======================>"); +} +WantAgent.getUid(wantAgent, getUidCallback) +``` + + + +## WantAgent.getUid + +getUid(agent: WantAgent): Promise\ + +Obtains the user ID of a **WantAgent** object. This API uses a promise to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name | Readable| Writable| Type | Mandatory| Description | +| ----- | --- | ---- | --------- | ---- | ------------- | +| agent | Yes | No | WantAgent | Yes | **WantAgent** object whose user ID is to be obtained.| + +**Return value** + +| Type | Description | +| ----------------------------------------------------------- | ------------------------------------------------------------ | +| Promise\ | Promise used to return the user ID.| + +**Example** + +```js +import WantAgent from '@ohos.wantAgent'; +import { OperationType, WantAgentFlags } from '@ohos.wantagent'; + +// WantAgent object +var wantAgent; + +// WantAgentInfo object +var wantAgentInfo = { + wants: [ + { + deviceId: "deviceId", + bundleName: "com.neu.setResultOnAbilityResultTest1", + abilityName: "com.example.test.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + } + ], + operationType: OperationType.START_ABILITIES, + requestCode: 0, + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] +} + +WantAgent.getWantAgent(wantAgentInfo).then((data) => { + console.info("==========================>getWantAgentCallback=======================>"); + wantAgent = data; +}); + +WantAgent.getUid(wantAgent).then((data) => { + console.info("==========================>getUidCallback=======================>"); +}); +``` + + + +## WantAgent.getWant + +getWant(agent: WantAgent, callback: AsyncCallback\): void + +Obtains the want in a **WantAgent** object. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name | Readable| Writable| Type | Mandatory| Description | +| -------- | --- | ---- | --------------------- | ---- | ------------------------------- | +| agent | Yes | No | WantAgent | Yes | **WantAgent** object whose want is to be obtained. | +| callback | Yes | No | AsyncCallback\ | Yes | Callback used to return the want.| + +**Example** + +```js +import WantAgent from '@ohos.wantAgent'; +import { OperationType, WantAgentFlags } from '@ohos.wantagent'; + +// WantAgent object +var wantAgent; + +// getWantAgent callback +function getWantAgentCallback(err, data) { + console.info("==========================>getWantAgentCallback=======================>"); + if (err.code == 0) { + wantAgent = data; + } else { + console.info('----getWantAgent failed!----'); + } +} +// WantAgentInfo object +var wantAgentInfo = { + wants: [ + { + deviceId: "deviceId", + bundleName: "com.neu.setResultOnAbilityResultTest1", + abilityName: "com.example.test.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + } + ], + operationType: OperationType.START_ABILITIES, + requestCode: 0, + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] +} + +WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback) + +// getWant callback +function getWantCallback(err, data) { + console.info("==========================>getWantCallback=======================>"); +} +WantAgent.getWant(wantAgent, getWantCallback) +``` + + + +## WantAgent.getWant + +getWant(agent: WantAgent): Promise\ + +Obtains the want in a **WantAgent** object. This API uses a promise to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name | Readable| Writable| Type | Mandatory| Description | +| ----- | --- | ---- | --------- | ---- | ------------- | +| agent | Yes | No | WantAgent | Yes | **WantAgent** object whose want is to be obtained.| + +**Return value** + +| Type | Description | +| ----------------------------------------------------------- | ------------------------------------------------------------ | +| Promise\ | Promise used to return the want.| + +**Example** + +```js +import WantAgent from '@ohos.wantAgent'; +import { OperationType, WantAgentFlags } from '@ohos.wantagent'; + +// WantAgent object +var wantAgent; + +// WantAgentInfo object +var wantAgentInfo = { + wants: [ + { + deviceId: "deviceId", + bundleName: "com.neu.setResultOnAbilityResultTest1", + abilityName: "com.example.test.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + } + ], + operationType: OperationType.START_ABILITIES, + requestCode: 0, + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] +} + +WantAgent.getWantAgent(wantAgentInfo).then((data) => { + console.info("==========================>getWantAgentCallback=======================>"); + wantAgent = data; +}); + +WantAgent.getWant(wantAgent).then((data) => { + console.info("==========================>getWantCallback=======================>"); +}); +``` + + + +## WantAgent.cancel + +cancel(agent: WantAgent, callback: AsyncCallback\): void + +Cancels a **WantAgent** object. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name | Readable| Writable| Type | Mandatory| Description | +| -------- | --- | ---- | --------------------- | ---- | --------------------------- | +| agent | Yes | No | WantAgent | Yes | **WantAgent** object to cancel. | +| callback | Yes | No | AsyncCallback\ | Yes | Callback used to return the result.| + +**Example** + +```js +import WantAgent from '@ohos.wantAgent'; +import { OperationType, WantAgentFlags } from '@ohos.wantagent'; + +// WantAgent object +var wantAgent; + +// getWantAgent callback +function getWantAgentCallback(err, data) { + console.info("==========================>getWantAgentCallback=======================>"); + if (err.code == 0) { + wantAgent = data; + } else { + console.info('----getWantAgent failed!----'); + } +} +// WantAgentInfo object +var wantAgentInfo = { + wants: [ + { + deviceId: "deviceId", + bundleName: "com.neu.setResultOnAbilityResultTest1", + abilityName: "com.example.test.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + } + ], + operationType: OperationType.START_ABILITIES, + requestCode: 0, + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] +} + +WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback) + +// cancel callback +function cancelCallback(err, data) { + console.info("==========================>cancelCallback=======================>"); +} +WantAgent.cancel(wantAgent, cancelCallback) +``` + + + +## WantAgent.cancel + +cancel(agent: WantAgent): Promise\ + +Cancels a **WantAgent** object. This API uses a promise to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name | Readable| Writable| Type | Mandatory| Description | +| ----- | --- | ---- | --------- | ---- | ------------- | +| agent | Yes | No | WantAgent | Yes | **WantAgent** object to cancel.| + +**Example** + +```js +import WantAgent from '@ohos.wantAgent'; +import { OperationType, WantAgentFlags } from '@ohos.wantagent'; + +// WantAgent object +var wantAgent; + +// WantAgentInfo object +var wantAgentInfo = { + wants: [ + { + deviceId: "deviceId", + bundleName: "com.neu.setResultOnAbilityResultTest1", + abilityName: "com.example.test.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + } + ], + operationType: OperationType.START_ABILITIES, + requestCode: 0, + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] +} + +WantAgent.getWantAgent(wantAgentInfo).then((data) => { + console.info("==========================>getWantAgentCallback=======================>"); + wantAgent = data; +}); + +WantAgent.cancel(wantAgent).then((data) => { + console.info("==========================>cancelCallback=======================>"); +}); +``` + + + +## WantAgent.trigger + +trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: Callback\): void + +Triggers a **WantAgent** object. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name | Readable| Writable| Type | Mandatory| Description | +| ----------- | --- | ---- | ----------------------------- | ---- | ------------------------------- | +| agent | Yes | No | WantAgent | Yes | **WantAgent** object to trigger. | +| triggerInfo | Yes | No | TriggerInfo | Yes | **TriggerInfo** object. | +| callback | Yes | No | AsyncCallback\ | Yes | Callback used to return the result.| + +**Example** + +```js +import WantAgent from '@ohos.wantAgent'; +import { OperationType, WantAgentFlags } from '@ohos.wantagent'; + +// WantAgent object +var wantAgent; + +// getWantAgent callback +function getWantAgentCallback(err, data) { + console.info("==========================>getWantAgentCallback=======================>"); + if (err.code == 0) { + wantAgent = data; + } else { + console.info('----getWantAgent failed!----'); + } +} +// WantAgentInfo object +var wantAgentInfo = { + wants: [ + { + deviceId: "deviceId", + bundleName: "com.neu.setResultOnAbilityResultTest1", + abilityName: "com.example.test.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + } + ], + operationType: OperationType.START_ABILITIES, + requestCode: 0, + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] +} + +WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback) + +// trigger callback +function triggerCallback(err, data) { + console.info("==========================>triggerCallback=======================>"); +} + +var triggerInfo = { + code:0 +} +WantAgent.trigger(wantAgent, triggerInfo, triggerCallback) +``` + + + +## WantAgent.equal + +equal(agent: WantAgent, otherAgent: WantAgent, callback: AsyncCallback\): void + +Checks whether two **WantAgent** objects are equal. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name | Readable| Writable| Type | Mandatory| Description | +| ---------- | --- | ---- | ------------------------ | ---- | --------------------------------------- | +| agent | Yes | No | WantAgent | Yes | The first **WantAgent** object. | +| otherAgent | Yes | No | WantAgent | Yes | The second **WantAgent** object. | +| callback | Yes | No | AsyncCallback\ | Yes | Callback used to return the result.| + +**Example** + +```js +import WantAgent from '@ohos.wantAgent'; +import { OperationType, WantAgentFlags } from '@ohos.wantagent'; + +// WantAgent object +var wantAgent1; +var wantAgent2; + +// getWantAgent callback +function getWantAgentCallback(err, data) { + console.info("==========================>getWantAgentCallback=======================>"); + if (err.code == 0) { + wantAgent1 = data; + wantAgent2 = data; + } else { + console.info('----getWantAgent failed!----'); + } +} +// WantAgentInfo object +var wantAgentInfo = { + wants: [ + { + deviceId: "deviceId", + bundleName: "com.neu.setResultOnAbilityResultTest1", + abilityName: "com.example.test.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + } + ], + operationType: OperationType.START_ABILITIES, + requestCode: 0, + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] +} + +WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback) + +// equal callback +function equalCallback(err, data) { + console.info("==========================>equalCallback=======================>"); +} +WantAgent.equal(wantAgent1, wantAgent2, equalCallback) +``` + + + +## WantAgent.equal + +equal(agent: WantAgent, otherAgent: WantAgent): Promise\ + +Checks whether two **WantAgent** objects are equal. This API uses a promise to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name | Readable| Writable| Type | Mandatory| Description | +| ---------- | --- | ---- | --------- | ---- | ------------- | +| agent | Yes | No | WantAgent | Yes | The first **WantAgent** object.| +| otherAgent | Yes | No | WantAgent | Yes | The second **WantAgent** object.| + +**Return value** + +| Type | Description | +| ----------------------------------------------------------- | ------------------------------------------------------------ | +| Promise\ | Promise used to return the result.| + +**Example** + +```js +import WantAgent from '@ohos.wantAgent'; +import { OperationType, WantAgentFlags } from '@ohos.wantagent'; + +// WantAgent object +var wantAgent1; +var wantAgent2; + +// WantAgentInfo object +var wantAgentInfo = { + wants: [ + { + deviceId: "deviceId", + bundleName: "com.neu.setResultOnAbilityResultTest1", + abilityName: "com.example.test.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + } + } + ], + operationType: OperationType.START_ABILITIES, + requestCode: 0, + wantAgentFlags:[WantAgentFlags.UPDATE_PRESENT_FLAG] +} + +WantAgent.getWantAgent(wantAgentInfo).then((data) => { + console.info("==========================>getWantAgentCallback=======================>"); + wantAgent1 = data; + wantAgent2 = data; +}); + +WantAgent.equal(wantAgent1, wantAgent2).then((data) => { + console.info("==========================>equalCallback=======================>"); +}); +``` + + + +## WantAgentInfo + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +| Name | Readable| Writable| Type | Mandatory| Description | +| -------------- | --- | ---- | ------------------------------- | ---- | ---------------------- | +| wants | Yes | Yes | Array\ | Yes | Array of all **Want** objects. | +| operationType | Yes | Yes | wantAgent.OperationType | Yes | Action type. | +| requestCode | Yes | Yes | number | Yes | Request code defined by the user.| +| wantAgentFlags | Yes | Yes | Array | No | Array of flags for using the **WantAgent** object. | +| extraInfo | Yes | Yes | {[key: string]: any} | No | Extra information. | + + + +## WantAgentFlags + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +| Name | Value | Description | +| ------------------- | -------------- | ------------------------------------------------------------ | +| ONE_TIME_FLAG | WantAgentFlags | The **WantAgent** object can be used only once. | +| NO_BUILD_FLAG | WantAgentFlags | The **WantAgent** object does not exist and hence it is not created. In this case, **null** is returned. | +| CANCEL_PRESENT_FLAG | WantAgentFlags | The existing **WantAgent** object should be canceled before a new object is generated.| +| UPDATE_PRESENT_FLAG | WantAgentFlags | Extra information of the existing **WantAgent** object is replaced with that of the new object.| +| CONSTANT_FLAG | WantAgentFlags | The **WantAgent** object is immutable. | +| REPLACE_ELEMENT | WantAgentFlags | The **element** attribute of the current **Want** can be replaced by the **element** attribute of the **Want** in **WantAgent.trigger()**.| +| REPLACE_ACTION | WantAgentFlags | The **action** attribute of the current **Want** can be replaced by the **action** attribute of the **Want** in **WantAgent.trigger()**.| +| REPLACE_URI | WantAgentFlags | The **uri** attribute of the current **Want** can be replaced by the **uri** attribute of the **Want** in **WantAgent.trigger()**.| +| REPLACE_ENTITIES | WantAgentFlags | The **entities** attribute of the current **Want** can be replaced by the **entities** attribute of the **Want** in **WantAgent.trigger()**.| +| REPLACE_BUNDLE | WantAgentFlags | The **bundleName** attribute of the current **Want** can be replaced by the **bundleName** attribute of **Want** in **WantAgent.trigger()**.| + + + +## OperationType + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +| Name | Value | Description | +| ----------------- | ------------- | ------------------------- | +| UNKNOWN_TYPE | OperationType | Unknown operation type. | +| START_ABILITY | OperationType | Starts an ability with a UI.| +| START_ABILITIES | OperationType | Starts multiple abilities with a UI.| +| START_SERVICE | OperationType | Starts an ability without a UI.| +| SEND_COMMON_EVENT | OperationType | Sends a common event. | + + + +## CompleteData + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +| Name | Readable| Writable| Type | Mandatory| Description | +| -------------- | --- | ---- | ------------------------------ | ---- | ---------------------- | +| info | Yes | Yes | WantAgent | Yes | A triggered **WantAgent** object. | +| want | Yes | Yes | Want | Yes | An existing triggered **want**. | +| finalCode | Yes | Yes | number | Yes | Request code that triggers the **WantAgent** object.| +| finalData | Yes | Yes | string | No | Final data collected by the common event. | +| extraInfo | Yes | Yes | {[key: string]: any} | No | Extra information. | + + + +## TriggerInfo + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +| Name | Readable| Writable| Type | Mandatory| Description | +| ---------- | --- | ---- | -------------------- | ---- | ----------- | +| code | Yes | Yes | number | Yes | Result code.| +| want | Yes | Yes | Want | No | Want. | +| permission | Yes | Yes | string | No | Permission. | +| extraInfo | Yes | Yes | {[key: string]: any} | No | Extra information. |