background-service

How to pass data from a controller to a background service

淺唱寂寞╮ 提交于 2021-02-08 10:20:57
问题 I'm trying to write a simple web api project with a background service executing a method every second. This method loops over a list and just prints out (for the moment) some statistics. I declared a new list in the constructor of the background service. I'm currently encountering some issues with adding and removing items from inside the controller. public UsersController(IUserBackgroundService userService) { private readonly IUserBackgroundService _userService; public UserController

.NET Core BackgroundService Run Only Once

最后都变了- 提交于 2021-01-25 06:20:59
问题 I am creating a .net core BackgroundService console application. The default template provides a Worker class that has ExecuteAsync() method, which is great. My plan is to use a Windows Task Scheduler to schedule to execute the console app once a day. However, I realized the ExecuteAsync() is a continuously executing method. So my question is -- how do I execute the codes in ExecuteAsync() only once and then terminate the Worker? I might have other processes still running, so each individual

How can I make this phone call states Broadcast receiver to work all the times?(non-stops)

﹥>﹥吖頭↗ 提交于 2020-08-20 06:38:19
问题 I'm creating an application, which will show toast messages before and after the call states. I generated and installed my application on my mobile. it was working well after a few days or sometimes a few hours. but after that, it's stopped, in order to run the application I need to open the application again. how can I modify my application to work very well? Thank you manifest <uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android

How to create a never ending background service in Xamarin.Forms?

你离开我真会死。 提交于 2020-07-19 06:58:25
问题 I am monitoring the user's location every 15 minutes and I just want the application to continue sending the location even if the user closes the application in the taskbar. I tried this sample but it's in Xamarin.Android https://docs.microsoft.com/en-us/xamarin/android/app-fundamentals/services/foreground-services i have to create a dependencyservice but i don't know how. 回答1: i have to create a dependencyservice but i don't know how. First, create an Interface in the Xamarin.forms project:

Service is not running in background when app is closed manually

走远了吗. 提交于 2020-06-17 13:12:19
问题 My service is not running is background when started manually and the app closed. I want to start the service automatically when my app is closed. But in this example when I close the application it prints 'service created' then 'service destroyed' but not prints as 'service running' after 'service created'. My service code. public class DataChangeService extends Service { Toaster toaster; // @Override public void onCreate() { super.onCreate(); toaster = new Toaster(getApplication()); toaster