【问题标题】:Handling share and other actions from Chrome处理来自 Chrome 的共享和其他操作
【发布时间】:2014-03-25 04:15:35
【问题描述】:

我有一个可以播放一些视频的应用程序,比如 MXPlayer 加上一个轻量级浏览器。因此,当有人单击其中一个文件的 chrome 中的链接时,我希望有机会处理某些视频文件,并且当有人想要共享链接时,我希望出现在 chrome 的共享弹出窗口中(这样我的应用程序可能会打开页面)。到目前为止,我已经让我的应用程序显示在其他应用程序的共享弹出窗口中,但我无法让它显示在 Chrome 的共享弹出窗口中。这是我的意图过滤器:

        <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>

谁能告诉我我做错了什么?另外我应该提到我只想要 http/https 流,我不想要本地文件。

谢谢。

【问题讨论】:

    标签: android android-intent android-browser


    【解决方案1】:

    我设法将它用于共享菜单选项:

            <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>
    

    当有人点击一个链接时,chrome会弹出一个对话框,告诉你在哪里打开它:

            <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>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-10
      • 1970-01-01
      • 1970-01-01
      • 2014-11-03
      • 2014-03-28
      • 1970-01-01
      相关资源
      最近更新 更多