I am trying to bind a service from a library project that is added to another library project that is added to an application project. So library A is referenced by library B and library B is added to my app. The app starts Service A. Another app starts Service B. Service B binds to service A but fails
ActivityManager(593): Unable to start service Intent { act=com.xx.yy.zz/.Service } U=0: not found
-I can find the jar containing the service in the application (in android dependencies). -I declared the app in the manifest (application).
<service android:name="com.xx.yy.zz.Service"
android:exported="true"
android:enabled="true">
</service>
-The service declaration is within the application tag. -The service extends Service -Both services produce Logs so they are both started
This is how I try to bind the service
private void bindToService() {
Toast.makeText(getApplicationContext(), "Binding service", Toast.LENGTH_SHORT).show();
Intent intent = new Intent();
intent.setClassName("com.xx.yy.zz", "com.xx.yy.zz.Service");
mBound = getApplicationContext().bindService(intent, this, BIND_AUTO_CREATE);
Log.d(TAG, "bindService returned " + mBound);
}
mBound always returns false. The services have been binded before (in a testapp which uses allot of the same code). the services bind using AIDL (nothing changed to that code).
I cant paste more code so I hope this is enough to get me on the way. Thanks in advance.
I fixed it, it turns out i had to provide the application package name and the library package name.
So instead of:
I had to do:
I hope this helps someone else! I wasted allot of time on this.