I have a somewhat specific workflow in my android application, so that I don't know where I should bind the Billing service.
Initially my app starts the first background task which determines location of a user and afterwards calls the second background task, because it can run only after location has been determined.
Now I want the second background task to execute only if certain subscription is active.
The problem is that both events - start of the second task and obtaining service connection - are undetermined in time, so I don't know how to synchronize between them.
Example activity:
public class MyActivity extends Activity
{
public void onLocationChanged(Location location)
{
// callback is called when location is obtained
}
public void onServiceConnected(ComponentName name, IBinder service)
{
// called when service is connected
mService = IInAppBillingService.Stub.asInterface(service);
}
}