I've been trying to bind a service that was started on boot from an activity. The code for starting on boot was mostly taken from the instant messenger.
This is the AndroidManifest.xml definition for the 3 main components:
<!-- Receiver -->
<receiver android:name=".receiver.LifestylePPAutoStarter"
android:process="android.process.lifestylepp">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
<!-- Service -->
<service android:name=".service.LifestylePPService"
android:process="android.process.lifestylepp"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="edu.gatech.lifestylepp.ILifestylePPService" />
<action android:name="edu.gatech.lifestylepp.SERVICE" />
</intent-filter>
</service>
<!-- Activity -->
<activity android:name=".app.LifestylePPActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
The receiver starts the service on boot without any problems. However when I try to bind the service from my activity, Context::bindService returns true, but ServiceConnection::onServiceConnected is never called. Also, when I start the service from the activity it works as expected (ServiceConnection::onServiceConnected is called).