maui-app-lifecycle

Map .NET MAUI Window lifecycle events to platform-native callbacks for state preservation.

1|Updated May 21, 2026
One-click install
npx skills add https://github.com/1k-off/umbraco-observability-playground --skill maui-app-lifecycle-1k-off
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: maui-app-lifecycle
Source: https://github.com/1k-off/umbraco-observability-playground/tree/main/.agents/skills/maui-app-lifecycle
Command: npx skills add https://github.com/1k-off/umbraco-observability-playground --skill maui-app-lifecycle-1k-off

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill solves incorrect .NET MAUI app lifecycle handling that can cause lost user work, broken refresh logic, or unexpected multi-platform behavior during backgrounding and resume.

Core Features & Use Cases

  • Window lifecycle event wiring: Use Window events (Created, Activated, Deactivated, Stopped, Resumed, Destroying) to run the right logic at the right time.
  • Platform lifecycle mapping: Translate cross-platform window events to native callbacks on Android, iOS/Mac Catalyst, and Windows (WinUI).
  • State preservation patterns: Save transient UI/form state on background and restore it on resume, including platform-specific nuances like Android back-button behavior.
  • Common pitfall guidance: Prevent misuse of Deactivated vs Stopped and ensure handlers stay fast to avoid ANR/background execution issues.

Quick Start

Ask the AI to map your target page refresh and state-save logic to the correct MAUI lifecycle events for Android and iOS, and to show where to place code for preserving draft text and scroll position.

Frequently Asked Questions about maui-app-lifecycle

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

FAQPage Schema
How do I preserve .NET MAUI app state when backgrounding and resuming?

To preserve .NET MAUI app state during backgrounding and resume, subscribe to Window lifecycle events like Stopped and Resumed to save and restore transient UI data. Implement fast save workflows using Preferences-style approaches to avoid blocking the main thread.

What is the difference between Deactivated and Stopped events in .NET MAUI lifecycle?

In the .NET MAUI lifecycle, Deactivated fires when a window loses focus but remains visible, while Stopped fires when the window is fully hidden. Misusing them can break refresh logic, so map them carefully to native platform callbacks.

How do I use ConfigureLifecycleEvents in .NET MAUI for Android and iOS?

Use ConfigureLifecycleEvents in .NET MAUI to map cross-platform Window events to native Android, iOS/Mac Catalyst, and Windows callbacks. This ensures correct lifecycle handling and state preservation across all target platforms.

Why does my MAUI app lose draft text and scroll position on resume?

Your MAUI app loses draft text and scroll position on resume because state preservation logic is missing or mapped to the wrong lifecycle event. Save transient form state during the Stopped event and restore it during Resumed.

Does .NET MAUI app lifecycle handling work across Android, iOS, and Windows?

.NET MAUI app lifecycle handling works across Android, iOS/Mac Catalyst, and Windows. It translates cross-platform Window lifecycle events to platform-native callbacks, ensuring consistent state preservation and resume behavior.

What are the limitations of MAUI backgrounding handlers regarding ANR issues?

MAUI backgrounding handlers must execute quickly to avoid Application Not Responding (ANR) issues or background execution limits. Keep state save and restore logic fast, avoiding heavy processing during Deactivated or Stopped events.