android - Blocking/Synchronous function call in AIDL -


i working on android service, service provided aidl interface applications, application calls function getdata() using aidl interface, function implemented in service , network operation, connect server , fetch data, network transaction happen in background thread, problem want function getdata() should not return until network operation complete, result comes server , want return getdata(), getdata function returns , network operation in background thread keep on running in parallel, how avoid this, cannot call network operation in main thread. read countdownlatch, possible solution?

                        service main thread                              getdata                                  getdatafromserver-----------> in background thread       /*this problem */  getdata returns;                         |                                                                      |                                                                      |                                                               communication in progress                                                                      |                                                                      |                                                                      |       /*i want getdata should return here <-------------------transaction complete 

create interface , implement interface in class , pass interface object particular service after response came network pass data interface object.

i think you.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -