Open SeppPenner opened 4 months ago
Hi I'm an AI powered bot that finds similar issues based off the issue title.
Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!
Note: You can give me feedback by thumbs upping or thumbs downing this comment.
Description
Since there is https://github.com/dotnet/maui/issues/19041 for iOS, I wanted to ask how background service in an app would run in MAUI for Android.
My tries so far.
Microsoft.Extensions.Hosting
NuGet package and try to run it asBackgroundService
as for ASP.Net (As described here https://learn.microsoft.com/en-US/dotnet/architecture/microservices/multi-container-microservice-net-applications/background-tasks-with-ihostedservice), e.g.--> Doesn't work, service is never executed. :collision:
--> Doesn't work, the
[Service]
attribute and theService
class do not exist. :collision:and implemented the service like this:
and
and in the
MainPage.xaml.cs
in the constructor:--> Seems to work, but not sure if background services should be used like this. 😕
Any advice / documentation on how to do this with MAUI on Android would be nice.
Steps to Reproduce
Check above.
Link to public reproduction project repository
No response
Version with bug
8.0.40 SR5
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
No response
Did you find any workaround?
Solution 3 seems to work, but not sure if this i correct. + This should get documented somewhere...
Relevant log output