每当您想要启动服务时,您所需要做的就是
startService(new Intent(this, MainService.class));
并随时停止服务
stopService(new Intent(this, MainService.class));
请记住,服务需要在AndroidManifest.xml中声明。如您所说,您的服务正在运行。我确定你已经做到了。还是AndroidManifest.xml
<service android:enabled="true" android:name=".MainService" />



