如何在没有 activity 的情况下启动 android 服务

How to Start android service without activity

我创建了一个包含 Service 的应用程序,该应用程序从 Activity 的按钮单击开始。

但我想创建一个与上一个应用程序功能相同的新应用程序 - 但没有任何 GUI 界面 => 即没有任何 Activity

我想让应用程序在设备启动时启动并且永不停止(直到设备关闭)。

怎么做? 有什么办法吗?

How to do it ?

通过使用 Context.startService() or Context.bindService() 方法。

其中 Context 可能是 ActivityApplicationBroadcastReceiveronReceive() 方法的参数等