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