Search code examples
javaandroidandroid-studioandroid-manifestandroid-videoview

How can I make my app as default video player?


I am building a video player and I want to make my app to be shown when someone want to play a video, like this :enter image description here

I searched for that for long time,but no results,any body can help me?


Solution

  • First of all add intent filter to manifest

     <intent-filter>
            <action android:name="android.intent.action.VIEW"/>
            <category android:name="android.intent.category.DEFAULT"/>
            <data android:mimeType="video/*"/>
            <data android:scheme="content"/>
            <data android:scheme="file"/>
        </intent-filter>
    

    Then to get video URI in you Activity:

    Uri uri = getIntent().getData();
    

    For more information check this