| MAUI-Behaviors | MAUI-Device-APIs | |
.NET MAUI App Lifecycle |
App lifecycle across platforms in .NET MAUI, since it’s slightly different depending on whether you’re running on Android, iOS, Windows, or macOS.
Android → MainActivity.OnCreate() initializes the app, loads MauiProgram.CreateMauiApp().
iOS/macOS (Catalyst) → AppDelegate.FinishedLaunching() starts the app and loads the MAUI app.
Windows → WinUIApp.OnLaunched() initializes the app.
All platforms eventually call into MauiProgram.CreateMauiApp() which sets up services, resources, and the App class.
The app is active and visible.
Application.OnStart() is triggered when the app first runs.
Pages and Shell lifecycle events (OnAppearing, OnNavigated) occur during navigation.
Android → OnPause() is called when the app goes into the background.
iOS/macOS → OnResignActivation() or DidEnterBackground() is triggered.
Windows → OnSuspending() is called when the app is minimized or suspended.
In MAUI, this maps to Application.OnSleep().
Android → OnResume() when returning from background.
iOS/macOS → WillEnterForeground() or OnActivated().
Windows → OnResuming().
In MAUI, this maps to Application.OnResume().
Android → OnDestroy() when the activity is destroyed.
iOS/macOS → WillTerminate() when the app is killed.
Windows → OnSuspending() may be followed by termination.
In MAUI, this maps to Application.OnStop().
| Lifecycle Stage | Android | iOS/macOS | Windows | MAUI Abstraction |
|---|---|---|---|---|
| Start | OnCreate | FinishedLaunching | OnLaunched | OnStart |
| Sleep | OnPause | DidEnterBackground | OnSuspending | OnSleep |
| Resume | OnResume | WillEnterForeground | OnResuming | OnResume |
| Exit | OnDestroy | WillTerminate | Termination after suspend | OnStop |
App Lifecycle (platform-level) and the Shell Lifecycle (navigation/UI-level) fit together in .NET MAUI:
This is about the application process itself across Android, iOS/macOS, and Windows:
This is about the user interface and navigation container:
| Stage | App Lifecycle (Platform) | Shell Lifecycle (UI) |
|---|---|---|
| Launch | OnStart | Shell constructor + route registration |
| Visible | Running state | OnAppearing (Shell/page) |
| Background | OnSleep | Page disappears (OnDisappearing) |
| Resume | OnResume | OnAppearing again |
| Navigation | N/A (platform doesn’t handle this) | OnNavigating / OnNavigated |
| Exit | OnStop / Terminate | Shell disposed |
Think of it like two layers working together:
| MAUI-Behaviors | MAUI-Device-APIs | |