Skip to main content
⚙️

App Lifecycle

System
View Docs

Handle app state changes, deep links, and back button

backgroundforegrounddeeplinkurlbackbutton

Demo

🔄

Checking...

The app is running in the background

Deep Link / Launch URL

No launch URL detected. The app was opened normally.

Back Button (Android only)

0

Back button presses

Only available on Android devices

Actions

Note: Minimize and Exit are Android-only features. On iOS, apps cannot programmatically exit.

Event History

No events yet. Try minimizing and restoring the app.

Note: App lifecycle events are essential for mobile apps to save state, pause operations, and handle deep links. On web, these events map to page visibility changes. Deep links require proper configuration in your app's native project settings.

Usage

import { useAppLifecycle } from '@classic-homes/native/svelte';
// or for React:
import { useAppLifecycle } from '@classic-homes/native/react';

API Reference

PropertyTypeDescription
isActiveboolean | nullWhether app is currently in foreground
launchUrlstring | nullURL that launched the app (deep link)
errorError | nullCurrent error if any
getState() => Promise<{ isActive: boolean }>Get current app state
getLaunchUrl() => Promise<string | null>Get URL that launched the app
exitApp() => Promise<void>Exit the app (Android only)
minimizeApp() => Promise<void>Minimize the app (Android only)

Related Features