casolorz
casolorz

Reputation: 9574

Handling share and other actions from Chrome

I have an app which can play some videos, think MXPlayer plus a light browser. So I would like to get the opportunity to handle certain video files when someone clicks on a link in chrome of one those files, and also I would like to appear on the share popup of chrome when someone wants to share the link (so that my app may open the page). I have so far gotten my app to show up on the share popups of other apps but I just can not get it to show up on the share popup of Chrome. Here are my intent filters:

        <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:scheme="https"/>
            <data android:mimeType="video/*"/>
            <data android:mimeType="*/avi"/>
            <data android:mimeType="*/mkv"/>
            <data android:mimeType="application/mp4"/>

        </intent-filter>
        <intent-filter android:icon="@drawable/ic_launcher">
            <action android:name="android.intent.action.SEND"/>
            <data android:mimeType="*/*"/>
            <data android:scheme="http"/>
            <data android:scheme="https"/>


            <category android:name="android.intent.category.DEFAULT"/>
        </intent-filter>

Can someone tell me what I am doing wrong? Also I should mention I only want http/https streams, I do not want local files.

Thanks.

Upvotes: 2

Views: 1067

Answers (1)

casolorz
casolorz

Reputation: 9574

I managed to get it working by using this for the share menu option:

        <intent-filter>
            <action android:name="android.intent.action.SEND"/>
            <category android:name="android.intent.category.DEFAULT"/>
            <category android:name="android.intent.category.BROWSABLE"/>
            <data android:mimeType="text/plain"></data>
        </intent-filter>

and this for when someone clicks on a link and chrome pops a dialog of where to open it:

        <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:scheme="https"/>
        </intent-filter>

Upvotes: 1

Related Questions