AbilityResult
The module defines the result code and data returned to the caller when a started UIAbility is terminated.
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
import { common } from '@kit.AbilityKit';
import ability from '@ohos.ability.ability';
How to Use
In the stage model, you can use startAbilityForResult to obtain the AbilityResult object returned when the started UIAbility is terminated by calling terminateSelfWithResult.
In the FA model, you can use startAbilityForResult to obtain the AbilityResult object returned after the started UIAbility is terminated by calling terminateSelfWithResult.
Attributes
Atomic service API: This API can be used in atomic services since API version 11.
System capability: SystemCapability.Ability.AbilityBase
| Name | Type | Read-only | Optional | Description |
|---|---|---|---|---|
| resultCode | number | No | No | Result code returned by the target party to the caller after the UIAbility of the target party is started and then terminated. - In normal cases, the result code sent by the target party is returned. - In abnormal cases, the value -1 is returned. |
| want | Want | No | Yes | Data returned after the started UIAbility is terminated. |