gpt4 book ai didi

android - 如何让我的应用程序出现在 whatsapp 画廊中 ShareIntent Provider

转载 作者:行者123 更新时间:2023-11-29 21:29:20 25 4
gpt4 key购买 nike

我想通过我在 Whatsapp 中的应用程序选择图片附件。

在 Whatsapp 从 Gallery 页面发送附件时,ShareIntentProvider 将提供原生 Gallery 应用程序和 Google 的照片来选择图像。我怎样才能使我的应用程序支持它?

我知道如何从我的应用程序分享图像到 Whatsapp,但我不知道如何让 Whatsapp 允许我的应用程序选择图像作为附件。

最佳答案

在您的 AndroidManifest.xml 中,为您要打开(来自 whatsapp)的 Activity 添加以下 Intent 过滤器:

<intent-filter>
<action android:name="android.intent.action.GET_CONTENT" />
<category android:name="android.intent.category.OPENABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
<data android:mimeType="video/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.PICK" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
<data android:mimeType="video/*" />
</intent-filter>

您的应用程序现在应该显示在 whatsapp 画廊列表中,

关于android - 如何让我的应用程序出现在 whatsapp 画廊中 ShareIntent Provider,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19828341/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com