Add support for hosted services in .NET MAUI apps
See original GitHub issueLook into using hosted services. This would replace the icky IMauiInitializeService
that was added in https://github.com/dotnet/maui/pull/2137, and also to enable users to use hosted services. MAUI will automatically call StartAsync/StopAsync at the appropriate time. Sadly, this pattern is async-only, whereas in MAUI the call sites are always (or at least almost always) sync. But given that this is app startup/shutdown, doing async-over-sync might be OK (we would block).
This is a follow-up to PR https://github.com/dotnet/maui/pull/2137.
Other notes:
- Need to consider this when implementing: https://github.com/dotnet/aspnetcore/pull/36122
Issue Analytics
- State:
- Created 2 years ago
- Reactions:19
- Comments:16 (5 by maintainers)
Top Results From Across the Web
Connect to local web services from Android emulators and ...
Learn how a .NET MAUI app running in the Android emulator or iOS simulator can consume a ASP.NET Core web service running locally....
Read more >android - How to create a background service in .NET Maui
For Android, use a foreground service. The mobile will have a notification and you can open your app when the user taps on...
Read more >Learn Live - Consume REST web services in .NET MAUI apps
Full series information: https://aka.ms/learnlive-mobile-desktop- apps -dotnet- maui More info here: ...
Read more >Publishing Your .NET MAUI Apps | .NET Conf: Focus on MAUI
Join this session to learn how to publish your . NET MAUI applications to various platforms. Speaker: Olia Gavrysh Links: - .
Read more >Learn How to Use Dependency Injection in .NET MAUI
Step 1: Open the MauiProgram.cs file. Then, add a Microsoft.Extensions.DependencyInjection reference in it to access the service's extension ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@pjmagee yeah I think so. If we implement this, there would be proper support for hosted services so all the regular APIs that exist for that would work as expected (starting/stopping those services).
This kind of addition would definitely make it easier to work with an abstracted service model instead of platform specific service implementations.