Will the Android OS kill my IntentService under normal circumstances?
-
27-10-2019 - |
문제
Will the Android OS kill my IntentService
under normal circumstances or do I need to worry about any variables being reset?
해결책
Will the Android OS kill my IntentService under normal circumstances
Yes. IntentServices will be paused,stopped and destroyed when there are no waiting intents at the whim of the OS.
do I need to worry about any variables being reset?
There are no guarantees about variable values being retained. You should use onCreate to configure the initial state of the service and, in my experience, it works best if you don't maintain state outside of the lifecycle of the service.
제휴하지 않습니다 StackOverflow