question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for hosted services in .NET MAUI apps

See original GitHub issue

Look 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:

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:19
  • Comments:16 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
Eiloncommented, Sep 30, 2021

@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).

2reactions
JohnHunterACScommented, Jan 26, 2023

This kind of addition would definitely make it easier to work with an abstracted service model instead of platform specific service implementations.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found