Ashwin N Bhanushali
Ashwin N Bhanushali

Reputation: 3882

Starting service using custom action in Android library project

I had created one Android Library Project named MyLibrary which has following AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="test.myservice"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="8" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <service android:name="mytest.myservice.RemoteService" android:exported="true">
            <intent-filter >
                <action android:name="MYSERVICE"/>
            </intent-filter>
        </service>
    </application>

</manifest>

After Creating Library project I added the reference of this library project to my application named TestMyLibrayApp.I am starting service from My application as follows.

Intent playerservice = new Intent();
playerservice.setAction("MYSERVICE");
getBaseContext().bindService(playerservice,conn , Service.BIND_AUTO_CREATE);

Where conn is the service connection object. Now the problem is Serivce is not starting.Can anyone suggest where am I wrong?

Upvotes: 0

Views: 3104

Answers (1)

tom
tom

Reputation: 19163

You need to add the <service> section to TestMyLibraryApp's manifest. The library's manifest is not used.

Upvotes: 1

Related Questions