发送名片的文件/字符串通过WhatsApp的或编程邮件 [英] Send VCard file/string via Whatsapp or mail programmatically

查看:1314
本文介绍了发送名片的文件/字符串通过WhatsApp的或编程邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过意图选择应用程序从字符串或文件发送vCard,例如WhatsApp的。你有什么想法?

I am trying to send a VCard from a String or file via Intents choosing the app, for example Whatsapp. Do you have any ideas?

感谢

编辑:

我已经试过这code。另外随着集合类型的文本/平原。电子名片变量是一个电子名片的字符串。

I have tried this code. Also with set type text/plain. The vcard variable is a String with a VCard.

Intent intent = new Intent(android.content.Intent.ACTION_SEND);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setType("text/x-vcard");
intent.putExtra(android.content.Intent.EXTRA_STREAM, vcard);
intent.setPackage(packageName);

如果我寄这封信给了WhatsApp我送名片像一个字符串,但不承认像卡

If I send this to Whatsapp I got to send the vcard like a string but not recognize like a card

推荐答案

尝试使用 EXTRA_TEXT 而不是 EXTRA_STREAM ,为 EXTRA_STREAM 应该指向文件。

Try using EXTRA_TEXT instead of EXTRA_STREAM, as EXTRA_STREAM is supposed to point to a file.

另外,请删除 setPackage()电话。你是不是比你的用户更重要。您的用户,因此,得到控制哪些应用程序与他们分享自己的名片,而不是你。

Also, please delete the setPackage() call. You are not more important than your user. Your user, therefore, gets to control what app they share their vCard with, not you.

除此之外,请联系WhatsApp的与他们的应用程序的帮助。特别是考虑到你的 setPackage()调用,它是完全可能的,WhatsApp的根本不通过 ACTION_SEND 支持电子名片。

Beyond that, please contact Whatsapp for assistance with their app. Particularly given your setPackage() call, it is entirely possible that Whatsapp simply does not support vCard via ACTION_SEND.

这篇关于发送名片的文件/字符串通过WhatsApp的或编程邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆