Home Register as music player and play song
Reply: 0

Register as music player and play song

user7602
1#
user7602 Published in September 20, 2018, 12:55 pm

I'm creating a music player app and I want to register the app as a music player. So that when a user clicks on any song to play, my app should be suggested as one of the music players. I followed this guide .

After I added the necessary code in manifest.xml, it only shows my app in suggestions. When I select my app, nothing is played. I think there should be something like receiver in main activity to receive the media path to play the selected song. But I don't know how to implement this.

I've added following code to my manifest.xml (for reference):

<intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <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>
    <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" />
        <data android:mimeType="audio/*"/>
        <data android:mimeType="application/ogg"/>
        <data android:mimeType="application/x-ogg"/>
        <data android:mimeType="application/itunes"/>
    </intent-filter>
    <intent-filter
        android:priority="-1">
        <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:mimeType="audio/*"/>
        <data android:mimeType="application/ogg"/>
        <data android:mimeType="application/x-ogg"/>
        <data android:mimeType="application/itunes"/>
    </intent-filter>
share|improve this question
  • Have you tried this? I`m pretty sure that's what you want. stackoverflow.com/a/33783826/7094632 – Gabe Nov 3 '16 at 17:48
  • yes this isn't working – user6649667 Nov 3 '16 at 17:50

5 Answers 5

active oldest votes
up vote 1 down vote
+25
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.330286 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO