stopService doesn't stop's my service… why?

前端 未结 11 911
旧巷少年郎
旧巷少年郎 2020-12-03 07:02

i have a background service on my android APP that is getting my GPS position and sending it to a remote db. It work\'s fine.

The problem is when i want to stop the

11条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-03 07:47

    Have you implemented onDestroy()? If not, I believe that might be the solution - and you stop your Timer or whatever you're using to run the service within onDestroy().

    A service can be stopped by calling its stopSelf() method, or by calling Context.stopService().

    See this link for some more information.

提交回复
热议问题