Reputation: 7181
I'm in a mobile programming class right now and we have to make a simple media player. Right now I'm trying to make it so that when a user opens an mp3 my app comes up as a possible default? How do I code this?
Upvotes: 0
Views: 80
Reputation: 1006674
How to make an app a default for a certain task?
You can't "make an app a default". The user makes it their default.
Right now I'm trying to make it so that when a user opens an mp3 my app comes up as a possible default? How do I code this?
Try the following <intent-filter>
on your activity that sets up the media playback:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="audio/mpeg"/>
</intent-filter>
Then, if some app fires off an ACTION_VIEW
Intent
on an MP3 file, your activity should appear along with other activities from other apps in a chooser dialog.
Upvotes: 2