Tsunaze
Tsunaze

Reputation: 3254

Open my Android app when clicking on .mp3 link

I'm trying to create an activity that opens up when i click an .mp3 link in the browser.

Here's my Intent Filter :

<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="file" />
            <data android:scheme="http" />
            <data android:host="*" />
            <data android:mimeType="application/mp3" />
        </intent-filter>

Nothing works.

Upvotes: 2

Views: 562

Answers (2)

Tsunaze
Tsunaze

Reputation: 3254

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

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

            <data
                android:host="*"
                android:pathPattern=".*.mp3"
                android:scheme="http" />
        </intent-filter>

It didn't work because i put : <action android:name="android.intent.action.SEND" /> inside of the intent-filter. Now i just have multiple intent-filters inside my activity.

Upvotes: 1

Mark Ormesher
Mark Ormesher

Reputation: 2408

As an alternative, you can also try this:

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

Upvotes: 0

Related Questions