service

In WorkerService File generation not working only for Linux .Net Core

旧时模样 提交于 2020-06-17 15:51:05
问题 I have to create a text file on linux when the service is starting. I tried to keep IsOSPlatform to recognize OS and based on it, I have written code to create a text file for logs. Below is the code which not generating the file only for linux , for windows it creates a file. public static void Main(string[] args) { bool isLinux = System.Runtime.InteropServices.RuntimeInformation .IsOSPlatform(OSPlatform.Linux); if(isLinux) { string sourceFile = System.IO.Path.Combine("~", "MyLog", "Config

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

Constant background running process - even when app is not in use

柔情痞子 提交于 2020-06-17 04:19:06
问题 I am working with other contributors on an open-source project in which we have made an Android App. Whenever the app is opened we get a notification that the app is running in the background and even when the app session is terminated, the notification doesn't go away. Here is the link for the project The app has a lot of classes which could be the reason but we are not able to narrow it down. Though we do think that it could be the BluetoothService activity which uses Bluetooth signals. The

how to unregister an OSGi service

折月煮酒 提交于 2020-06-16 04:40:10
问题 I have the following test code, which should register and than unregister a test service. I tested it in an Eclipse 4.5.2 Mail-Demo appliation. The problem is that the service is not unregisted, the second call for the service is not null. BundleContext bundleContext = Activator.getDefault().getBundle().getBundleContext(); ServiceRegistration<ITestService> registration = bundleContext.registerService(ITestService.class, new TestService(), null); ServiceReference<ITestService> serviceReference

How to mock service with symfony 4 in functional tests?

…衆ロ難τιáo~ 提交于 2020-06-10 14:54:54
问题 I have an commandbus handler, which injects some service: class SomeHandler { private $service; public function __construct(SomeService $service) { $this->service = $service; } public test(CommandTest $command) { $this->service->doSomeStuff(); } } SomeService has method doSomeStuff with external calls, which I want not to use during testing. class SomeService { private $someBindedVariable; public function __construct($someBindedVariable) { $this->someBindedVariable = $someBindedVariable; }

Never Ending Background Service - Java for Android

我与影子孤独终老i 提交于 2020-06-01 06:43:46
问题 I wanted to make this service a never ending service, even if the app is killed by the user. That service starts with the app - when it is background, the service still runs-, but when I clear the background tasks on phone, it is also killed. I wanted that final part to be different, wanted this service to keep running on the device... Is that possible? Thanks for the help public class BackgroundService extends Service { public static Runnable runnable = null; public Context context = this;

What's the difference between the Service Locator and the Factory Design pattern?

淺唱寂寞╮ 提交于 2020-05-25 04:11:04
问题 I'm using unity and I'm creating a class that wrapps it and I dont' know how to call it, service locator or factory, both encapsulate the creation of the objects, so.... what's the difference? 回答1: A factory creates objects for you, when requested. Service locator returns objects that may already exist, that is services that may already exist somewhere for you. Just think about the meaning of the names: Factory: is a place where objects are created. Service: is something that can do something

What's the difference between the Service Locator and the Factory Design pattern?

岁酱吖の 提交于 2020-05-25 04:09:33
问题 I'm using unity and I'm creating a class that wrapps it and I dont' know how to call it, service locator or factory, both encapsulate the creation of the objects, so.... what's the difference? 回答1: A factory creates objects for you, when requested. Service locator returns objects that may already exist, that is services that may already exist somewhere for you. Just think about the meaning of the names: Factory: is a place where objects are created. Service: is something that can do something

How to make Angular mock service tree-shakeable

百般思念 提交于 2020-05-17 05:43:10
问题 Context In an Angular 9 project, I am working with two environments: production & mock . In the Core Module, I check for mock environment. If build is made with mock configuration I inject mocked services that return mocked data, so no external http requests are made. If build is made with prod configuration, real services are injected. I do it like this: core.module.ts @NgModule({ declarations: [], providers: [], imports: [BrowserModule, HttpClientModule], exports: [], }) export class