AbilityMonitor

NOTE

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

Modules to Import

import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'

AbilityMonitor

Describes an ability monitor.

Name Type Readable Writable Description
abilityName string Yes Yes Name of the ability bound to the ability monitor.
System capability: SystemCapability.Ability.AbilityRuntime.Core
onAbilityCreate?:(data: Ability) function Yes Yes Called when the ability is created.
If this attribute is not set, the corresponding lifecycle callback cannot be received.
System capability: SystemCapability.Ability.AbilityRuntime.Core
onAbilityForeground?:(data: Ability) function Yes Yes Called when the ability starts to run in the foreground.
If this attribute is not set, the corresponding lifecycle callback cannot be received.
System capability: SystemCapability.Ability.AbilityRuntime.Core
onAbilityBackground?:(data: Ability) function Yes Yes Called when the ability starts to run in the background.
If this attribute is not set, the corresponding lifecycle callback cannot be received.
System capability: SystemCapability.Ability.AbilityRuntime.Core
onAbilityDestroy?:(data: Ability) function Yes Yes Called when the ability is destroyed.
If this attribute is not set, the corresponding lifecycle callback cannot be received.
System capability: SystemCapability.Ability.AbilityRuntime.Core
onWindowStageCreate?:(data: Ability) function Yes Yes Called when the window stage is created.
If this attribute is not set, the corresponding lifecycle callback cannot be received.
System capability: SystemCapability.Ability.AbilityRuntime.Core
onWindowStageRestore?:(data: Ability) function Yes Yes Called when the window stage is restored.
If this attribute is not set, the corresponding lifecycle callback cannot be received.
System capability: SystemCapability.Ability.AbilityRuntime.Core
onWindowStageDestroy?:(data: Ability) function Yes Yes Called when the window stage is destroyed.
If this attribute is not set, the corresponding lifecycle callback cannot be received.
System capability: SystemCapability.Ability.AbilityRuntime.Core