maui-app-lifecycle

Documents .NET MAUI app lifecycle events and window state preservation across platforms.

Updated Nov 27, 2025
One-click install
npx skills add https://github.com/seydakaratekeli/KamPay3 --skill maui-app-lifecycle-seydakaratekeli
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: maui-app-lifecycle
Source: https://github.com/seydakaratekeli/KamPay3/tree/main/KamPay/.github/skills/maui-app-lifecycle%20-%20Kopyala
Command: npx skills add https://github.com/seydakaratekeli/KamPay3 --skill maui-app-lifecycle-seydakaratekeli

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Helps developers correctly place initialization, save, and restore logic across .NET MAUI app lifecycle events to avoid missed state persistence, ANR/watchdog kills, and incorrect assumptions about first-launch vs resume behavior.

Core Features & Use Cases

  • Explains the four logical app states and cross-platform Window lifecycle events so developers can reason about where to run code.
  • Documents platform mappings for Android, iOS/Mac Catalyst, and Windows and warns about platform-specific gotchas such as Android back-button skipping Stopped and multiple independent windows.
  • Provides performance guidance and a state-preservation checklist for saving transient UI state, restoring on resume, and duplicating critical saves in destruction callbacks.

Quick Start

Explain where to place initialization, save, and restore logic for a .NET MAUI app to handle cold starts, deactivations, backgrounding, and Android back-button destruction.

Frequently Asked Questions about maui-app-lifecycle

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I handle .NET MAUI app lifecycle events for state preservation?

To handle .NET MAUI app lifecycle events for state preservation, place initialization, save, and restore logic across cross-platform Window lifecycle events, mapping to native callbacks on Android, iOS/Mac Catalyst, and Windows to avoid missed persistence.

What is the best way to save transient UI state during backgrounding in .NET MAUI?

The best way to save transient UI state during backgrounding in .NET MAUI is to perform fast synchronous saves under 1–2 seconds, preventing ANR or watchdog kills while ensuring data persists before the app enters a deactivated state.

Does the Android back-button skip lifecycle events in .NET MAUI?

Yes, the Android back-button can skip the Stopped lifecycle event in .NET MAUI. To avoid losing state, duplicate critical saves in destruction callbacks like OnDestroy to handle these platform-specific edge cases.

Can I manage multi-window state independently in cross-platform .NET MAUI apps?

Yes, you can manage multi-window state independently in cross-platform .NET MAUI apps. The framework supports multiple independent windows, requiring developers to reason about each window's lifecycle events separately for correct state save and restore behavior.

Why does my .NET MAUI app lose state on resume after first-launch?

Your .NET MAUI app loses state on resume due to incorrect assumptions about first-launch versus resume behavior. Properly mapping to native lifecycle callbacks and using a state-preservation checklist ensures transient UI state restores correctly on resume.

When do I need to duplicate critical saves in Android destruction callbacks for .NET MAUI?

You need to duplicate critical saves in Android destruction callbacks like OnStopped and OnDestroy when handling .NET MAUI app lifecycle events, ensuring state persistence against back-button skips and unexpected process termination edge cases.