Naroju
Naroju

Reputation: 2667

Intent-filter for service start

I want to start a service, the service is basically a videoview on windowmanager. I want to start this videoview service even from other applications. this is my code intent-filter, Don't know where I went wrong.

  <service android:name=".VideoWindow">
     <intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />

            <data android:mimeType="video/*"  />
            <data android:mimeType="application/x-quicktimeplayer*" />
            <data android:mimeType="application/x-mpeg" />
            <data android:mimeType="application/vnd.dvd*" />
            <data android:mimeType="application/vnd.3gp*" />
            <data android:mimeType="application/3gpp*" />
            <data android:mimeType="application/vnd.rn-realmedia*" />
            <data android:mimeType="application/mp4*" />
            <data android:mimeType="application/mpeg*" />
            <data android:mimeType="application/sdp" />
            <data android:mimeType="application/vnd.wap.mms-message"/>
     </intent-filter>
</service>

Upvotes: 1

Views: 1853

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006944

I want to start this videoview service even from other applications

Unless you are the one writing those other applications, or you hire people to write those other applications, no other applications will start your service.

My guess, from your <intent-filter>, is that you think that if another app calls startActivity() on an ACTION_VIEW Intent, that this will start your service. This is incorrect. startActivity() starts an activity. It will not start a service, no matter what <intent-filter> that service has.

Upvotes: 1

Related Questions