On Android, if you type a URL to an MP3 file in the browser (or click on a link to the file) you get that "Complete action using" popup with some applications listed that can play the file (Music, StreamFurious, Streaming Media Player, Winamp, XiiaLive Lite, to name a few). How can I get my application to show up in that list?
I'm pretty sure there's an intent-filter I have to add to the AndroidManifest.xml but I have no idea what action, category, or data needs to be in it. Anyone know what I have to do? Also, is there some way I can trace intents that called on the system? That might make it easier to figure out how to do other things like this in the future.
Based on what I saw at code.google.com/p/andless/source/browse/trunk/AndroidManifest.xml?spec=svn86&r=86# I tried this:
<activity android:name=".Main"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="audio/mp3" android:scheme="file" />
</intent-filter>
</activity>
but that didn't do it. Then I downloaded andLess from the market and realized that app doesn't show in the "Complete action using" list either.
You might want to add this filter:
<action android:name="android.intent.action.MUSIC_PLAYER"/>
oh yeah...i totally forgot to mention you need receivers. in case you dont know that yet. broadcast receivers..like this
<receiver android:name="MyPhoneReceiver">
<intent-filter>
<action android:name="android.intent.action.MUSIC_PLAYER"></action>
</intent-filter>
</receiver>
what basically happens here is, when a file is launched/clicked maybe from a file browser, android broadcasts and sells the file to possible applications that may be interested with the kind of file. therefore, we need to establish which files our applications will/may respond to. and that's through broadcast receivers. but you probably know that already. i hope this helped..sorry for the delay i was afk.
i am editting this again...you need this inside your application tag. ^^
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With