ohos.ability.ability_result

Note:

Currently in the beta phase.

This module defines the result codes and data returned after an Ability is started and terminated.

Import Module

import kit.AbilityKit.*

Permission List

ohos.permission.DISTRIBUTED_DATASYNC

ohos.permission.PREPARE_APP_TERMINATE

ohos.permission.PRIVACY_WINDOW

Usage Guidelines

API sample code usage guidelines:

  • If the first line of sample code contains a "// index.cj" comment, it indicates the sample can be compiled and run in the "index.cj" file of the Cangjie template project.
  • If the sample requires obtaining the Context application context, it needs to be configured in the "main_ability.cj" file of the Cangjie template project.

For details about the sample project and configuration template mentioned above, refer to Cangjie Sample Code Description.

class AbilityResult

public class AbilityResult {
    public var resultCode: Int32
    public var want: Want
    public init(resultCode: Int32, want!: Want = Want())
}

Description: Defines the result codes and data returned after an Ability is started and terminated.

System Capability: SystemCapability.Ability.AbilityBase

Since: 22

var resultCode

public var resultCode: Int32

Description: Defines the returned result code.

Type: Int32

Readable/Writable: Readable and Writable

System Capability: SystemCapability.Ability.AbilityBase

Since: 22

var want

public var want: Want

Description: Represents Want type information, such as ability name, package name, etc.

Type: Want

Readable/Writable: Readable and Writable

System Capability: SystemCapability.Ability.AbilityBase

Since: 22

init(Int32, Want)

public init(resultCode: Int32, want!: Want = Want())

Description: Constructs the AbilityResult class.

System Capability: SystemCapability.Ability.AbilityBase

Since: 22

Parameters:

Parameter Name Type Required Default Value Description
resultCode Int32 Yes - Indicates the result code.
want Want No Want() Represents Want type information, such as ability name, package name, etc.

Example:

import kit.AbilityKit.*

let abilityResult = AbilityResult(0)