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=开发者_StackOverflow".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.The service needs to be specified in the Manifest for your application, not the library.
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)
I created aidl for these and its working fine now.
精彩评论