
Public static MainActivity Activit圜urrent Īnd Finally we create our Android foreground service.

set an activity on main application to get the reference on the service Then, before platform code we need to add Android Permissions on AndroidManifest.xml: Īndroid Main Activity public class MainActivity : MauiAppCompatActivity Since we are working with ANDROID, on MauiProgram we will add the following: /// Add dependecy injection to main pageĪnd we create our Interface for DI which provides us the methods to start and stop the foreground service public interface IServiceTest

I know it's beign a while but will post an answer for future users!įirst we need to understand that background services depends on which platform we use.(thanks Jason) And i will focus on ANDROID, based on Xamarin Documentation (thanks Eli), adapted to Maui.
