How to execute parallel REST API calls in android -
hi developing android application. application contains rest api calls fetching data server. application requirements this:
consider have 2 rest api calls independent; mean both not dependent on each other; want parallel execution. result of both api calls associated 2 different activities.
i want run both network calls in background. don't want execute on ui thread.
i confuse following few solutions: use separate async task each network call. happen if execute 10 calls parallel async task?
use intent service: intent service solution handling multiple network calls parallel in background.
how handle in proper way. need solution this. need help. thank you.
executing on 2 asynctasks work. however, on android versions 3.0 or higher need call task.executeonexecutor(thread_pool_executor, params) instead of execute. if don't that, 3.0 implementation of asynctask runs 1 task @ time serially. if uses pool of 5 threads run them.
Comments
Post a Comment