harmony 鸿蒙AbilityResult

  • 2025-06-12
  • 浏览 (4)

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 '@kit.AbilityKit';

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 Optional Description
resultCode number No No Result code returned by the target party to the caller after the ability 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 ability is terminated.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Ability Kit

harmony 鸿蒙AbilityAccessControl

harmony 鸿蒙AbilityBase

harmony 鸿蒙AbilityBase_Element

harmony 鸿蒙AbilityRuntime

harmony 鸿蒙bundle

harmony 鸿蒙OH_NativeBundle_ApplicationInfo

harmony 鸿蒙OH_NativeBundle_ElementName

harmony 鸿蒙ability_access_control.h

harmony 鸿蒙ability_base_common.h

0  赞