仅启动服务一次

仅启动服务一次

问题描述:

Hi
我想在第一次启动应用程序时启动服务,活动类在第一次加载时调用service.How它可能吗?

Hi I want Start Service when first time application start and activity class load first time at that time call service.How it possible?

你想启动Windows服务吗?



you want to start Windows Services?

1. You revoke services in your code (in the first time)<br />
<br />
2. Run next time (check status of the service.)<br />
   2.1. If service have "started" status ==> ignore<br />
   2.2. if stopped ==> start service





在.Net中我们可以轻松使用Windows服务。



希望对你有用



Trong Anh



In .Net we can work with windows services easy.

Hope that is useful for you

Trong Anh


System.ServiceProcess可以帮助你,通过下面的CP链接

使用ServiceController进入C#停止并启动服务 [ ^ ]



谢谢

--RA
System.ServiceProcess May helps you, go through the below CP link
Using the ServiceController in C# to stop and start a service[^]

Thanks
--RA