我带有process_text意图的应用程序并未出现在所有应用中'复制菜单

发布于 2025-02-13 23:49:01 字数 3138 浏览 3 评论 0原文

我正在尝试扩展复制/粘贴菜单,以在我的应用中打开特定的活动。

问题是,我的应用程序出现在某些应用中,其中大多数应用程序都不出现。

AndroidManifest.xml:

<manifest ....>

 <queries>
        <intent>
            <action android:name="android.intent.action.PROCESS_TEXT" />
            <data android:mimeType="text/plain" />
        </intent>
        <intent>
            <action android:name="android.intent.action.SEND" />
            <data android:mimeType="text/plain" />
        </intent>
        <intent>
            <action android:name="android.intent.action.VIEW" />
            <data android:mimeType="text/plain"/>
        </intent>
    </queries>

<application ...>

<activity
            android:name=".component.popupActivity.PopUpActivity"
            android:exported="true"
            android:theme="@style/Theme.Transparent.SemiBlack">

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

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

            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.BROWSABLE" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:scheme="http" />
                <data android:scheme="https" />
                <data android:mimeType="text/html"/>
                <data android:mimeType="text/plain"/>
                <data android:mimeType="application/xhtml+xml"/>
            </intent-filter>

        </activity>

    </application>

</manifest>

我的实现有什么问题吗?

我已经使用WhatsApp,Instagram,Facebook,FB Messenger进行了测试。 仅与WhatsApp一起使用

Translate Outlook Ideaseo购物 Firefox Focus 等其他应用程序。 总是能够将其应用程序添加到复制/糊菜单中。

Firefox Focus 是开源的,我没有注意到AndroidManifest.xml

I am trying to extend the copy/paste menu to open a specific activity in my app.

The problem is, that my app appears in some applications, and in most of them do not.

AndroidManifest.xml:

<manifest ....>

 <queries>
        <intent>
            <action android:name="android.intent.action.PROCESS_TEXT" />
            <data android:mimeType="text/plain" />
        </intent>
        <intent>
            <action android:name="android.intent.action.SEND" />
            <data android:mimeType="text/plain" />
        </intent>
        <intent>
            <action android:name="android.intent.action.VIEW" />
            <data android:mimeType="text/plain"/>
        </intent>
    </queries>

<application ...>

<activity
            android:name=".component.popupActivity.PopUpActivity"
            android:exported="true"
            android:theme="@style/Theme.Transparent.SemiBlack">

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

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

            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.BROWSABLE" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:scheme="http" />
                <data android:scheme="https" />
                <data android:mimeType="text/html"/>
                <data android:mimeType="text/plain"/>
                <data android:mimeType="application/xhtml+xml"/>
            </intent-filter>

        </activity>

    </application>

</manifest>

Is there anything wrong with my implementation?

I have tested it with WhatsApp, Instagram, Facebook, FB messenger.
Only works with Whatsapp.

Other apps like Translate, Outlook, idealo Shopping, Firefox Focus.
was always able to add their apps to the copy/paste menu.

Firefox Focus is open source, I did not notice anything different in AndroidManifest.xml

enter image description here
enter image description here
enter image description here
enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

小姐丶请自重 2025-02-20 23:49:01

研究后,我发现以下内容:

必须将此意图过滤器添加到活动中。
我已经用 android 11 android 12 对其进行了测试。
androidmanifest.xml

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

After researching, I found the following:

This intent-filter must be added to the activity.
I have tested it with Android 11 and Android 12.
AndroidManifest.xml:

            <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>
趁微风不噪 2025-02-20 23:49:01

确保Process_Text意图过滤器位于顶部。

<activity
    android:name=".Navigation.HandleText"
    android:excludeFromRecents="true"
    android:exported="true"
    android:label="@string/action_translate"
    android:launchMode="singleTop">
    <intent-filter>
        <action android:name="android.intent.action.PROCESS_TEXT" />
        <category android:name="android.intent.category.DEFAULT" />
        <data android:mimeType="text/plain" />
    </intent-filter>
    <intent-filter android:label="@string/action_translate">
        <action android:name="android.intent.action.SEND" />
        <category android:name="android.intent.category.DEFAULT" />
        <data android:mimeType="text/plain" />
    </intent-filter>
    <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="https" />
    </intent-filter>
</activity>

就我而言,我有两个意图过滤器,并将Process_text意图过滤器移至第一个位置是修复的。现在它出现在Chrome,Samsung浏览器和所有其他应用程序中。

Make sure the PROCESS_TEXT intent filter is at the top.

<activity
    android:name=".Navigation.HandleText"
    android:excludeFromRecents="true"
    android:exported="true"
    android:label="@string/action_translate"
    android:launchMode="singleTop">
    <intent-filter>
        <action android:name="android.intent.action.PROCESS_TEXT" />
        <category android:name="android.intent.category.DEFAULT" />
        <data android:mimeType="text/plain" />
    </intent-filter>
    <intent-filter android:label="@string/action_translate">
        <action android:name="android.intent.action.SEND" />
        <category android:name="android.intent.category.DEFAULT" />
        <data android:mimeType="text/plain" />
    </intent-filter>
    <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="https" />
    </intent-filter>
</activity>

In my case I had two intent filters and moving the PROCESS_TEXT intent filter to the first position is what fixed it. Now it appears in Chrome, Samsung Browser and all other apps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文