Pintac
Pintac

Reputation: 1585

Android service in library

i created a library with a service in that i want to be able to bind to in more than one apk.

This is in my libraries manifest

<service class=".service.MyService" android:permission="com.wissen.permission.MY_SERVICE_PERMISSION">
<intent-filter>
<action android:value="com.wissen.testApp.service.MY_SERVICE" />
</intent-filter>
</service>

and this is in my apk manifest

<uses-permission android:name="com.wissen.permission.MY_SERVICE_PERMISSION"></uses-permission>

and i of course added the lib to the apk. i keep on getting service not found (warning). What am i doing wrong.

i bind it this way

bindService(new Intent("com.wissen.testApp.service.MY_SERVICE"), conn, Context.BIND_AUTO_CREATE);

Solution:
I created aidl for these and its working fine now.

Upvotes: 9

Views: 19826

Answers (3)

UAS
UAS

Reputation: 415

Your service must be a remote service. You should create an *.aidl (interface to your service) and start it in it's own process. You can read about it here: Android Interface Definition Language (AIDL)

Upvotes: 1

Pintac
Pintac

Reputation: 1585

I created aidl for these and its working fine now.

Upvotes: 1

Robby Pond
Robby Pond

Reputation: 73484

The service needs to be specified in the Manifest for your application, not the library.

Upvotes: 27

Related Questions