force-closing an app with a service: onDestroy() is not called in service?

前端 未结 3 1683
时光取名叫无心
时光取名叫无心 2021-01-18 06:05

I\'ve implemented a sticky service and when I force close the app I see that the Activity\'s onDestroy() is called. But the service doesn\'t apparently do anything.


3条回答
  •  不知归路
    2021-01-18 06:55

    how do I know when the service is force closed?

    You don't. onDestroy() is not guaranteed to be called, on any component.

    I need to trap that event so that I can close files.

    Then don't leave them open.

提交回复
热议问题