.NET MAUI › App Lifecycle & Windows
How do you handle platform lifecycle events not exposed by MAUI?
AdvancedAnswer
Use ConfigureLifecycleEvents in MauiProgram to hook native events (e.g., Android OnCreate/OnResume, iOS WillEnterForeground) with strongly-typed delegates. This lets you integrate SDKs or run platform code at precise lifecycle points without editing the platform entry classes directly.
builder.ConfigureLifecycleEvents(events =>
{
#if ANDROID
events.AddAndroid(a => a.OnResume(activity =>
_sdk.OnResume()));
#endif
});Real-world example An analytics SDK that needs Activity.OnResume is wired through ConfigureLifecycleEvents instead of subclassing MainActivity.