openharmony 鸿蒙 js-apis-inner-application-abilityStateData

2025-06-12 浏览 (1)

AbilityStateData

The AbilityStateData module defines the ability state information, which can be obtained through the onAbilityStateChanged lifecycle callback of ApplicationStateObserver. The callback can be invoked after a lifecycle change listener is registered through on.

NOTE

The initial APIs of this module are supported since API version 14. Newly added APIs will be marked with a superscript to indicate their earliest API version.

Modules to Import

import { appManager } from '@kit.AbilityKit';

Properties

System capability: SystemCapability.Ability.AbilityRuntime.Core

NameTypeReadableWritableDescription
pidnumberYesNoProcess ID.
bundleNamestringYesNoBundle name.
abilityNamestringYesNoAbility name.
uidnumberYesNoUser ID.
statenumberYesNoAbility state.
- In the stage model, the states of a UIAbility are described in Ability States, and the states of an ExtensionAbility are described in ExtensionAbility States.
- In the FA model, the states of an ability are described in Ability States.
moduleNamestringYesNoName of the HAP file to which the ability belongs.
abilityTypenumberYesNoAbility type, which can be page or service.
isAtomicServicebooleanYesNoWhether the ability belongs to an atomic service.
true: The ability belongs to an atomic service.
false: The ability does not belong to an atomic service.
appCloneIndexnumberYesNoIndex of an application clone.

Ability States

ValueStateDescription
0ABILITY_STATE_CREATEThe ability is being created.
1ABILITY_STATE_READYThe ability has been created.
2ABILITY_STATE_FOREGROUNDThe ability is running in the foreground.
3ABILITY_STATE_FOCUSThe ability has focus.
4ABILITY_STATE_BACKGROUNDThe ability is running in the background.
5ABILITY_STATE_TERMINATEDThe ability is terminated.
7ABILITY_STATE_CONNECTEDThe background service is connected to the client.
8ABILITY_STATE_DISCONNECTEDThe background service is disconnected from the client.

ExtensionAbility States

ValueStateDescription
0EXTENSION_STATE_CREATEThe ExtensionAbility is being created.
1EXTENSION_STATE_READYThe ExtensionAbility has been created.
2EXTENSION_STATE_CONNECTEDThe ExtensionAbility is connected to the client.
3EXTENSION_STATE_DISCONNECTEDThe ExtensionAbility is disconnected from the client.
4EXTENSION_STATE_TERMINATEDThe ExtensionAbility is terminated.

Ability Types

ValueTypeDescription
0UNKNOWNUnknown type.
1PAGEAbility that has the UI.
2SERVICEAbility that provides the background service.
3DATAAbility that provides the data service.
4FORMAbility that provides the widget service.
5EXTENSIONAbility that provides extension capabilities.

你可能感兴趣的鸿蒙文章

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

  • 所属分类: 后端技术
  • 本文标签: 鸿蒙 软件
  • 版权声明: 本文链接 https://seaxiang.com/blog/TM55H6