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

前端 未结 3 1639
时光取名叫无心
时光取名叫无心 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:43

    Expecting a service to be force closed seems kinda weird to me. Anyways if the process is terminated i would expect any open file handle to be closed by the linux subsystem.

    Also as stated by CommonsWare onDestroy isn't guaranteed in any case.

提交回复
热议问题