Search code examples
androidintentfilteraudio-playerandroid-music-player

How do I make an intent-filter for playing an MP3 file?


I have created a music player application in Android. Now, when selecting a music file in the phone's file manager, I want my application to appear as one of the options in the "Complete action using" popup. My idea is to do this using intent filter but I have no idea what action, category, or data I need to supply to it. How do I create an intent filter for this?

I've also seen a related question here: How do I make an intent-filter for streaming an MP3 file? but mine is not streaming, i am just playing music from file.

Thank you in advance.


Solution

  • Hope this Intent Filter can help you

    <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:scheme="content"/>
            <data android:scheme="file"/>
            <data android:mimeType="audio/*"/>
        </intent-filter>