i have specific workflow in android application, don't know should bind billing service.
initially app starts first background task determines location of user , afterwards calls second background task, because can run after location has been determined.
now want second background task execute if subscription active.
the problem both events - start of second task , obtaining service connection - undetermined in time, don't know how synchronize between them.
example activity:
public class myactivity extends activity { public void onlocationchanged(location location) { // callback called when location obtained } public void onserviceconnected(componentname name, ibinder service) { // called when service connected mservice = iinappbillingservice.stub.asinterface(service); } }
you can use synchronized int counter, each of steps you've completed, increase one. , every time complete step, call method see if task complete , next task can started, psudo code:
public synchroized boolean executenext() { completedcount++; if(completedcount == total_steps) { //starts next task here return true; } return false; }
Comments
Post a Comment