How to stop service by itself?

前端 未结 11 1203
独厮守ぢ
独厮守ぢ 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:50

    I know this is an old question, but in my case (floating window as service) I had to remove the view first, and then call stopSelf().

    windowManager.removeView(floatingView);
    stopSelf();
    

提交回复
热议问题