AbilityResult

The AbilityResult module defines the result code and data returned when an ability is terminated after being started.

In the stage model, you can use startAbilityForResult to obtain the AbilityResult object returned after the started ability is terminated by calling terminateSelfWithResult.

In the FA model, you can use startAbilityForResult to obtain the AbilityResult object returned after the started ability is terminated by calling terminateSelfWithResult.

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

Stage model:

import common from '@ohos.app.ability.common';

FA model:

import ability from '@ohos.ability.ability';

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 Mandatory Description
resultCode number No Yes Result code returned after the started ability is terminated.
want Want No No Data returned after the started ability is terminated.