App Lifecycle

Capture native Android foreground and background transitions automatically or from explicit calls.

The Android runtime tracks foreground/background state while active.

Automatic Capture

Ansight.initializeAndActivateDeveloperMode(
    application = application,
    clientName = "Android App",
)

The runtime registers activity lifecycle callbacks during activation.

Manual State

import ai.ansight.runtime.AppLifecycleState

AnsightRuntime.setAppLifecycleState(AppLifecycleState.Foreground)
AnsightRuntime.setAppLifecycleState(AppLifecycleState.Background)

Manual calls are useful when an app owns its lifecycle model or needs to correct route/lifecycle state from app code.