-6

As i know intentservice's OnHandleIntent run on separate thread same like asynctask, so can we use two or more webservice call in single IntentService? If we do so.. how android will execute both webservice call? Means is it return result of first webserive call and then execute another?

Brijesh Patel
  • 676
  • 1
  • 5
  • 13

2 Answers2

2

You can, as much as you could perform many sync http call in a separate thread. The caveat is that you need to perform synchronous http calls (if you use okhttp or retrofit you need to look for the blocking flavour) and that they will obviously be serialized.

fedepaol
  • 6,834
  • 3
  • 27
  • 34
  • 2
    *The caveat is that you need to perform synchronous http calls* this is important. Also note that if you're just doing http calls in your service, you are better off using a regular service so you don't have to worry about the synchronicity – Tim May 06 '16 at 09:04
  • I edit question..How android execute webserive calls in same scenario?Please suggest – Brijesh Patel May 06 '16 at 09:14
  • Yes, since they are synchronous and so blocking... – fedepaol May 06 '16 at 15:15
0

You can do multiple webservices call in single IntentService

Infinite Recursion
  • 6,511
  • 28
  • 39
  • 51