videoguy
videoguy

Reputation: 1918

What am I doing wrong in my Android service def that it is not visible service?

I have an Android service mycompany.service.Agent. That is the only thing defined in the app. It is "started" type service.

I was able to build and install it on Emulator just fine. I verified it by going to "Manage Apps" part of settings app.

I don't have any Activity to start this service. I am trying to start it manually like below from adb shell.

am startservice mycompany.service.STARTAGENT

Starting service: Intent { act=android.intent.action.VIEW dat=mycompany.service.STARTAGENT } Error: Not found; no service started.

Below is copy of my manifest file. What am I doing wrong?

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="polycom.service"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:label="@string/app_name" android:icon="@drawable/icon">
        <service android:name=".APIAgent" android:exported="true" >
            <intent-filter>
                <action android:name="mycompany.service.STARTAGENT" />
                <action android:name="mycompany.service.STOPAGENT" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>            
        </service>
    </application>
</manifest> 

Thanks
Video Guy

Upvotes: 2

Views: 2245

Answers (1)

videoguy
videoguy

Reputation: 1918

I am dumb. I should have read am documentation first.

This is how it should be invoked

am startservice -a mycompany.service.STARTAGENT

I missed "-a" part.

Upvotes: 3

Related Questions