You can use ApplicationContext.on() provided by the ApplicationContext module to subscribe to UIAbility lifecycle changes in a process.
Reference
Listening for UIAbility Lifecycle Changes, ApplicationContext.on