harmony 鸿蒙AbilityStateData

  • 2022-12-22
  • 浏览 (461)

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 registerApplicationStateObserver.

NOTE

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

Modules to Import

import appManager from '@ohos.application.appManager';

Attributes

System capability: SystemCapability.Ability.AbilityRuntime.Core

System API: This is a system API and cannot be called by third-party applications.

Name Type Readable Writable Description
pid number Yes No Process ID.
bundleName string Yes No Bundle name.
abilityName string Yes No Ability name.
uid number Yes No User ID.
state number Yes No Ability state.
moduleName9+ string Yes No Name of the HAP file to which the ability belongs.
abilityType number Yes No Ability type, which can be page or service.

Ability States

Value State Description
0 ABILITY_STATE_CREATE The ability is being created.
1 ABILITY_STATE_READY The ability has been created.
2 ABILITY_STATE_FOREGROUND The ability is running in the foreground.
3 ABILITY_STATE_FOCUS The ability has focus.
4 ABILITY_STATE_BACKGROUND The ability is running in the background.
5 ABILITY_STATE_TERMINATED The ability is terminated.
8 ABILITY_STATE_CONNECTED The background service is connected to the client.
9 ABILITY_STATE_DISCONNECTED The background service is disconnected from the client.

Ability Types

Value State Description
0 UNKNOWN Unknown type.
1 PAGE Ability that has the UI.
2 SERVICE Ability that provides the background service.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙APIs

harmony 鸿蒙System Common Events (To Be Deprecated Soon)

harmony 鸿蒙System Common Events

harmony 鸿蒙API Reference Document Description

harmony 鸿蒙Enterprise Device Management Overview (for System Applications Only)

harmony 鸿蒙BundleStatusCallback

harmony 鸿蒙@ohos.bundle.innerBundleManager (innerBundleManager)

harmony 鸿蒙@ohos.distributedBundle (Distributed Bundle Management)

harmony 鸿蒙@ohos.bundle (Bundle)

harmony 鸿蒙@ohos.enterprise.EnterpriseAdminExtensionAbility (EnterpriseAdminExtensionAbility)

0  赞