Back to results for “Android”
.NET MAUI › Project Structure & App Startup

How do the native entry points bootstrap a MAUI app on Android and iOS?

Intermediate

Answer

On Android, MainApplication overrides CreateMauiApp() to return MauiProgram.CreateMauiApp(), and MainActivity (a MauiAppCompatActivity) hosts it. On iOS/Mac Catalyst, AppDelegate (a MauiUIApplicationDelegate) does the same. These bridge the native app lifecycle to the shared MAUI host.
// Platforms/Android/MainApplication.cs
public class MainApplication : MauiApplication
{
    public MainApplication(IntPtr handle, JniHandleOwnership ownership)
        : base(handle, ownership) { }

    protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
}
Real-world example When adding a third-party SDK that needs Application.OnCreate, the developer hooks it in MainApplication before the base call.

Common follow-ups: What class does MainActivity inherit? | Where is CreateMauiApp defined?