⚙️
View DocsApp Lifecycle
SystemHandle 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
| Property | Type | Description |
|---|---|---|
| isActive | boolean | null | Whether app is currently in foreground |
| launchUrl | string | null | URL that launched the app (deep link) |
| error | Error | null | Current 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) |