1# postCardAction
2
3Provides information for interaction between the widget and widget provider. Currently, router, message, and call events are supported. This API can only be called within the widget.
4
5> **NOTE**
6>
7> This API is supported since API version 9.
8
9## postCardAction
10
11postCardAction(component: Object, action: Object): void
12
13Performs internal interactions within a function and processes operations related to the **component** and **action** objects. This API does not return any value.
14
15**Atomic service API**: This API can be used in atomic services since API version 11.
16
17**System capability**: SystemCapability.ArkUI.ArkUI.Full
18
19**Parameters**
20
21
22| **Name** | **Type** | **Mandatory** | **Description** |
23| -------- | -------- | -------- | -------- |
24| component | Object | Yes | Instance of the current custom component. Generally, **this** is passed in. |
25| action | Object | Yes | Action description. For details, see the following table. |
26
27
28**Description of the action parameter**
29
30
31| **Name** | **Type** |  **Mandatory** | **Description** |
32| -------- | -------- | -------- | -------- |
33| action | string | Yes |Action type.<br>- **"router"**: redirection to the specified UIAbility of the widget provider.<br>- **"message"**: custom message. If this type of action is triggered, the [onFormEvent()](../apis-form-kit/js-apis-app-form-formExtensionAbility.md#onformevent) lifecycle callback of the provider FormExtensionAbility is called.<br>- **"call"**: launch of the widget provider in the background. If this type of action is triggered, the specified UIAbility (whose [launch type](../../application-models/uiability-launch-type.md) must be singleton) of the widget provider is started in the background, but not displayed in the foreground. This action type requires that the widget provider should have the [ohos.permission.KEEP_BACKGROUND_RUNNING](../../security/AccessToken/permissions-for-all.md#ohospermissionkeep_background_running) permission. |
34| bundleName | string | No | Name of the target bundle when **action** is **"router"** or **"call"**. |
35| moduleName | string | No | Name of the target module when **action** is **"router"** or **"call"**. |
36| abilityName | string | No | Name of the target UIAbility when **action** is **"router"** or **"call"**. |
37| uri<sup>11+</sup> | string   | No  | URI of the target UIAbility when **action** is **"router"**. If both **uri** and **abilityName** are set, **abilityName** takes precedence. |
38| params | Object | No | Additional parameters carried in the current action. The value is a key-value pair in JSON format. |
39
40>**NOTE**
41>
42>When **action** is **"call"**, a string value of **'method'** must be passed to **params** to trigger the corresponding method in the UIAbility.
43
44**Example**
45
46<!--code_no_check-->
47
48```ts
49Button('Redirect')
50  .width('40%')
51  .height('20%')
52  .onClick(() => {
53    postCardAction(this, {
54      action: 'router',
55      bundleName: 'com.example.myapplication',
56      abilityName: 'EntryAbility',
57      params: {
58        message: 'testForRouter' // Customize the message to send.
59      }
60    });
61  })
62
63Button('Start in Background')
64  .width('40%')
65  .height('20%')
66  .onClick(() => {
67    postCardAction(this, {
68      action: 'call',
69      bundleName: 'com.example.myapplication',
70      abilityName: 'EntryAbility',
71      params: {
72        method: 'fun', // Set the name of the method to call. It is mandatory.
73        message: 'testForCall' // Customize the message to send.
74      }
75    });
76  })
77
78Button('Redirect URI')
79  .width('40%')
80  .height('20%')
81  .onClick(() => {
82    postCardAction(this, {
83      action: 'router',
84      uri: 'example://uri.ohos.com/link_page',
85      params: {
86        message: 'router msg for dynamic uri deeplink' // Customize the message to send.
87      }
88    });
89  })
90
91```
92
93The following is an example of **uris** configuration in the [module.json5](../../quick-start/module-configuration-file.md#skills) file of the target application:
94
95```json
96"abilities": [
97  {
98    "skills": [
99      {
100        "uris": [
101          {
102            "scheme": "example",
103            "host": "uri.ohos.com",
104            "path": "link_page"
105          },
106        ]
107      }
108    ],
109  }
110]
111```
112