Android: Check if service is running via. bindService

前端 未结 7 1461
心在旅途
心在旅途 2021-02-18 15:28

What would be the best way to check if an Android Service is running? I am aware of the ActivityManager API, but it seems like the use of the API is not advised for

7条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-18 16:31

    What do you plan on doing if the service is running/not running? Why not just call startService(). That will create it if it's not running, and if it is it will call its onStart() method.

提交回复
热议问题