Based on my understanding, an IntentService will get stopped when its current request is done.
Consider the below scenario, i will be triggering a request to the IntentSerivce for every 100ms and the processing time will be 90 ms for that request.
So for every my request - startSerivce call, service will get invoked and after 90ms (once the processing is done), onDestroy of the IntentServicee will get invoked.
I would like to have this IntentServicee running till i say stop. Is that possible?
assume that i am going to do the below in my service
- Do configure it
- Send some request
- wait for response
- read the response
- Broadcast to activity that invoked
Steps 1 is common for all my requests, so i thought i can do them when service is started initially once and then do 3-6 in HandleIntent based on the requests.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…