如何从网站将 vCard(.vcf 文件)添加到 Android 联系人中
我正在尝试将 vCard 从 Web 链接添加到 Android 2.2 上的用户联系人列表。当我将用户定向到 .vcf 文件时,我得到的只是移动浏览器中的文本输出。我已确认文件正在使用 MIME 类型文本/v-card 进行传输。这看起来应该是很简单的事情。有什么想法吗?
I'm trying to add a vCard from a web link to the user's contact list on Android 2.2. When I direct the user to .vcf file, all I get is text output in the mobile browser. I have confirmed that the files is being transferred with MIME type text/v-card. This seems like it should be pretty simple to do. Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
据我所知,Android 至少在 2.2 之前不支持开箱即用的 vCard 文件。
您可以使用应用 vCardIO 从 SD 卡读取 vcf 文件并将其保存到您的通讯录中。
因此,您必须首先将它们保存在 SD 卡上,然后再导入。
vCardIO 也可通过市场购买。
AFAIK Android doesn't support vCard files out of the Box at least not until 2.2.
You could use the app vCardIO to read vcf files from your SD card and save to you contacts.
So you have to save them on your SD card in the first place and import them afterwards.
vCardIO is also available trough the market.
只是为了让您知道:我刚刚使用根据 vCard 2.1 规范创建的 vCard 2.1 文件进行了尝试< /a>.我发现 vCard 2.1 尽管是旧版本,但已经涵盖了我需要的一切,包括 Base64 编码的照片和国际字符集。
它在我未经修改的 Android 4.1.1 设备 (Galaxy S3) 上完美运行。它还可以在旧的 iPhone 3GS(iOS 5,通过 Evernote 应用)和同事未经修改的旧 Android 2.1 设备上运行。您只需按照上面的建议将
Content-disposition
设置为attachment
即可。一个小问题是我使用 QR 码 触发了 VCF 下载,我用 < a href="http://gettag.mobi" rel="noreferrer">Microsoft Tag 应用。该应用告诉我 Android 无法处理
text/x-vcard
媒体类型(或者只是text/vcard
,无论如何)。当我在 Web 浏览器(我尝试了 Chrome 和 Android 默认浏览器)中打开链接后,它工作得很好。Just to let you know: I just tried it using a vCard 2.1 file created according to the vCard 2.1 spec. I found that vCard 2.1, despite being an old version, already covered everything I needed, including a base64-encoded photo and international character sets.
It worked perfectly on my unmodified Android 4.1.1 device (Galaxy S3). It also worked on an old iPhone 3GS (iOS 5, via the Evernote app) and a coworker's unmodified old Android 2.1 device. You only need to set the
Content-disposition
toattachment
as suggested above.A minor problem was that I triggered the VCF download using a QR code, which I scanned with the Microsoft Tag app. That app told me Android couldn't handle the
text/x-vcard
media type (or justtext/vcard
, no matter). Once I opened the link in a Web browser (I tried Chrome and the Android default browser), it worked fine.Android ICS 4.0.4 现已提供导入功能。
首先,您必须将
.vcf
文件保存在存储设备(USB 存储设备或 SD 卡)上。Android 将扫描所选存储以检测任何
.vcf
文件并将其导入到所选地址簿中。该功能位于联系人列表的选项菜单中。
!注意: 执行此操作时要小心! Android 将导入您存储中的所有内容,即
.vcf
。要么全有,要么全无,结果可能会毁掉你的地址簿。There is now an import functionality on Android ICS 4.0.4.
First you must save your
.vcf
file on a storage (USB storage, or SDcard).Android will scan the selected storage to detect any
.vcf
file and will import it on the selected address book.The functionality is in the option menu of your contact list.
!Note: Be careful while doing this! Android will import EVERYTHING that is a
.vcf
in your storage. It's all or nothing, and the consequence can be trashing your address book.这可用于将文件下载到您的 SD 卡
使用 Android 版本 2.3.3 和 4.0.3 进行测试
======= php ===========================
====== = html ==========================
This can be used to download the file to your SD card
Tested with Android version 2.3.3 and 4.0.3
======= php =========================
======= html ========================
我正在运行 2.2,没有任何变化,其他人关于 2.3 的报告也是如此。 Android(bug)不处理 .vcf ,也不通过端口 80 处理网页上此类文件的链接,也不通过 http 标头或直接流处理。它根本不受支持。
I'm running 2.2 and there is no change, reports from others on 2.3 say the same. Android (bug) does not handle a .vcf nor a link to such a file on a web page via port 80, neither via http headers or direct streaming. It just is NOT SUPPORTED AT ALL.
我在 Android 7 (LineageOS) 上使用标准通讯录应用导入
VERSION:4.0
vcard 文件时遇到问题。由于这是“不支持 android vcard 格式”的热门搜索结果,我只是想指出,我可以使用 Simple Contacts 应用程序 (Play 或 F-Droid)。
I had problems with importing a
VERSION:4.0
vcard file on Android 7 (LineageOS) with the standard Contacts app.Since this is on the top search hits for "android vcard format not supported", I just wanted to note that I was able to import them with the Simple Contacts app (Play or F-Droid).
我还注意到,您必须使用
将文件保存为 Windows 格式的
(回车、换行)。因为如果不这样做,导入就会中断。 (谈论文件中奇怪的字符)Unicode
、UTF-8
、无BOM
>CRLF祝你好运:)
席德
What i have also noticed is that you have to save the file as
Unicode
,UTF-8
, noBOM
in an Windows format withCRLF
(Carriage Return, Line Feed). Because if you don't, the import will break. (Saying something about weird chars in the file)Good luck :)
Sid
我花了2天时间才找到一个真正的用于生成vcf文件的php库,你可以尝试这个库 。
它适用于我的项目希望它也适用于您的项目:)
It took me 2 days to find a php library for generating vcf files that is genuine you can try this library.
It worked for my project hopefully it may work for yours too :)