gpt4 book ai didi

Android 与主题电子邮件/Whatsapp 共享

转载 作者:太空宇宙 更新时间:2023-11-03 10:43:54 25 4
gpt4 key购买 nike

我正在通过此代码使用 android 原生共享:

Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_TEXT, "I like to share with you some stuff.");
intent.putExtra(Intent.EXTRA_SUBJECT, "I like to share with you.");
intent.setType(CONTENT_TYPE_TEXT);
startActivity(Intent.createChooser(intent, "Share");

当我使用电子邮件作为共享 channel 时,我得到了我想要的:

Subject: I like to share with you.
Text: I like to share with you some stuff.

当我使用 WhatsApp 作为分享 channel 时,我收到以下文本:

I like to share with you.

I like to share with you some stuff.

与 Whatsapp 分享时我期望什么:

I like to share with you some stuff.

是否有任何选项/标志指示共享 channel 抑制主题,如果共享 channel 基本上不支持主题。

例如电子邮件支持主题 -> 使用额外提供的 Intent 。WhatsApp 不支持主题 -> 不要额外使用提供的 Intent 。

最佳答案

使用 PackageManager 类的 queryIntentActivities() 方法,您可以根据包名称设置额外的 Intent 。

有关更多信息,请查看此链接:How to filter specific apps for ACTION_SEND intent (and set a different text for each app)

关于Android 与主题电子邮件/Whatsapp 共享,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28605120/

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