I am developing an Music app in android which create MediaPlayer in android.Currently I have developed simple prototype for that it works well.
Now my main question is How can I set my mediaplayer to provide the default functionality to users or provide my media player in the list of application that are similar.
After reading on google I have found out that you have to use INTENT.setType() but how can I use that with service or when the user selects the file from filemanager of android.
Please provide some usefull pointers.
Add this code in the manifest
<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>
I think you should take a look at intents and intent filters, here is the link to google developer website
When the user clicks on the audio file from a file explorer program, if there is more than one program that could handling playing the file, the android os does intent resolution and brings up the list of compatible programs, and it is that the USER's choice to make an app the default, you cannot do this programmatically