Set the app as your default music player in Android software

When we click the mp3 file, we get a pop-up window showing the default applications that can play this file.

How to add an application to this list?

For application development, I called a tutorial on tuts + .

I use a service called a player service that links to a post on the Android Developers Blog.

I added the following code to the definition <service>in the manifest file

<intent-filter>
    <category android:name="android.intent.category.DEFAULT"/>
    <data android:scheme="file"/>
    <data android:mimeType="audio/*"/>
    <data android:mimeType="application/ogg"/>
    <data android:mimeType="application/x-ogg"/>
    <data android:mimeType="application/itunes"/>
</intent-filter>

What type of mime should I configure to make my app one of the default apps?

I can not see my application in the popup.

+4
1

. , , .

, manifest Android

<intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:scheme="content"/>
    <data android:host="media"/>
    <data android:mimeType="audio/*"/>
    <data android:mimeType="application/ogg"/>
    <data android:mimeType="application/x-ogg"/>
    <data android:mimeType="application/itunes"/>
</intent-filter>

, , - <action>. . . <data> .

+2

Source: https://habr.com/ru/post/1618064/


All Articles