Can bindService() be made to block?
<p>I have an Android application that uses a Remote Service and I bind to it with <code>bindService()</code>, which is asynchronous.</p>

<p>The app is useless until the service is bound, so I would like to simply wait until the binding is finished before any Activity is started. Is there a way to have the service bound before <code>onCreate()</code> or <code>onResume()</code> is called? I think there might be a way to do the binding in <code>Application</code>. Any ideas?</p>

<p>Edit:</p>

<p>if in <code>onCreate()</code> I do this.</p>

<pre><code>bindService(service, mWebServiceConnection, BIND_AUTO_CREATE);
synchronized (mLock) { mLock.wait(40000); }
</code></pre>

<p>The ServiceConnection.onServiceConnected doesn't get called for 40 seconds. It's clear that I have to let onCreate() return if I want the service to bind.</p>

<p>So it appears there's no way to do what I want.</p>

<p>Edit 2:
<a href="http://stackoverflow.com/questions/3055599/android-how-do-i-wait-until-a-service-is-actually-connected">Android how do I wait until a service is actually connected?</a> has some good commentary about what is going on in Android when binding a service.</p>
