The web has many articles (and videos) on starting a new Maui app. Microsoft's Maui documentation does discuss the MauiApp lifecycle and enumerates delegates to trigger the appropriate events for each of the supported platforms. I have been unable to find any concrete example of how to initiate any of these events other than creation. Specifically, how do I initiate a MauiApp shutdown, whether that involves putting the app to sleep or actually removing it from memory, as appropriate for the platform? Maui metadata mentions such procedures as Quit()
, StopAsync()
, and CloseWindow()
but I have been unable to get any of these (at least while debugging) to actually visibly terminate the app.
Asked
Active
Viewed 5,968 times
10
-
1on iOS you don't do this, and on Android you shouldn't – Jason Feb 07 '22 at 17:12
2 Answers
16
For Android apps:
Application.Current.Quit();
I tested it and it works.
It is compatible with other platforms, but I didn't test.

Mahdi Ataollahi
- 4,544
- 4
- 30
- 38
2
For Windows desktop this works:
Application.Current?.CloseWindow(Application.Current.MainPage.Window);

Rob
- 21
- 3