Shalini
Shalini

Reputation: 161

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

I am working on music player application. When you click a audio file from file browser, a list of apps appear, that can open this audio file.

How do I make my player also appear on that list? Below is the code which i have added in manifest for launching my activity.

<activity
 android:name="com.view.HomeActivity"
 android:label="@string/app_name"
 android:screenOrientation="portrait" >
 <intent-filter>
 <action android:name="android.intent.action.MAIN" />
 <category android:name="android.intent.category.LAUNCHER" />
 </intent-filter>
 </activity>

I tried with the following code as well taken from : How to tag video player for opening video files from other apps?

<intent-filter>
 <action android:name="android.intent.action.MUSIC_PLAYER" />
 <action android:name="android.intent.category.APP_MUSIC" /> 
 <action android:name="android.intent.action.MAIN" />
 <category android:name="android.intent.category.LAUNCHER" />
 <data android:mimeType="video/*" /> 
</intent-filter>

Thanks!

Upvotes: 0

Views: 595

Answers (1)

Miki Franko
Miki Franko

Reputation: 687

You do not have to use:

<data android:mimeType="video/*" />

you should use:

android:mimeType="audio/*" />

try this section:

<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:scheme="http" android:pathPattern=".*mp3" android:mimeType="audio/*" />
</intent-filter>

Upvotes: 1

Related Questions