Roger Travis
Roger Travis

Reputation: 8538

How to tag video player for opening video files from other apps?

I wrote a vidoeplayer and was wondering... when you click a video file from some other app, say a file browser, a list of apps appear, that can open this video file.

How do I make my player also appear on that list?

Thanks!

Upvotes: 2

Views: 625

Answers (1)

Madushan
Madushan

Reputation: 7458

You have to register the Intent you want in your activity.

From API 15, you need to add CATEGORY_APP_MUSIC to your app manifest, possibly under ACTION_MAIN intent filter.

If you want to target down to API 8, also use INTENT_ACTION_MUSIC_PLAYER in the intent filter. Here's a sample manifest part..

<activity android:name=".ui.MyActivity" >
<intent-filter>
    <category android:name="android.intent.action.MAIN" /> <!--  If this is the main activity -->
    <action android:name="android.intent.action.MUSIC_PLAYER" />
    <action android:name="android.intent.category.APP_MUSIC" />
    <data android:mimeType="video/*" /> <!-- To make sure we let Android know that we accept video -->
</intent-filter>
</activity>

Hope this helps.

Upvotes: 2

Related Questions