How to stop service by itself?

前端 未结 11 1260
独厮守ぢ
独厮守ぢ 2020-12-02 14:10

I start a service in an activity then I want the service to stop itself after a while.

I called stopSelf() in the service but it doesn\'t work.

How to make t

11条回答
  •  忘掉有多难
    2020-12-02 14:57

    Another dirty hack not mentioned here is to throw an exception like NPE. One day I needed to stop InputMethodService and this hack was useful.

提交回复
热议问题