Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hosting Asp .Net Core API on Android

My API doesn't use any database or any authentication. API supports just basic functions. Is there any way to host a .Net Core API on Android?

like image 668
emert117 Avatar asked May 31 '26 06:05

emert117


1 Answers

Assume your Android app is written in .NET MAUI, you just need to inject the initialization of ASP.NET Core in App.xaml.cs,

namespace MauiApp;

public partial class App : Application
{
    public App(WebAppHost webAppHost)
    {
        InitializeComponent();

        MainPage = new AppShell();

        // Start web app server.
        _ = Task.Run(() => webAppHost.StartAsync());
    }
}

The full sample can be found on GitHub.

like image 125
Lex Li Avatar answered Jun 02 '26 21:06

Lex Li



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!