如何从网站上获取Android密码的vCard(.vcf文件)

问题描述 投票:13回答:7

我正在尝试将网络链接中的vCard添加到Android 2.2上的用户联系人列表中。当我将用户定向到.vcf文件时,我得到的只是移动浏览器中的文本输出。我已确认使用MIME类型text / v-card传输文件。这看起来应该很简单。有任何想法吗?

android vcard vcf
7个回答
5
投票

AFAIK Android至少在2.2之前不支持开箱即用的vCard文件。

您可以使用应用程序vCardIO从SD卡读取vcf文件并保存给您的联系人。因此,您必须首先将它们保存在SD卡上,然后再导入它们。

CardIO也可通过市场上市。


4
投票

只是为了让你知道:我只是尝试使用根据vCard 2.1 spec创建的vCard 2.1文件。我发现vCard 2.1虽然是旧版本,但已经涵盖了我需要的一切,包括base64编码的照片和国际字符集。

它在我未经修改的Android 4.1.1设备(Galaxy S3)上运行良好。它也适用于旧的iPhone 3GS(iOS 5,通过Evernote app)和同事未经修改的旧Android 2.1设备。你只需要按照上面的建议将Content-disposition设置为attachment

一个小问题是我使用QR code触发VCF下载,我用Microsoft Tag app扫描。那个应用告诉我Android无法处理text/x-vcard媒体类型(或者只是text/vcard,无论如何)。一旦我在Web浏览器中打开链接(我尝试使用Chrome和Android默认浏览器),它运行正常。


4
投票

Android ICS 4.0.4现在有导入功能。

首先,您必须将.vcf文件保存在存储设备(USB存储设备或SD卡)上。 Android将扫描选定的存储以检测任何.vcf文件,并将其导入选定的地址簿。该功能位于联系人列表的选项菜单中。

!注意:这样做时要小心! Android将导入存储中.vcf的所有内容。这是全有或全无,后果可能会破坏你的地址簿。


3
投票

这可用于将文件下载到SD卡中使用Android版本2.3.3和4.0.3进行测试

======= php =========================

<?php
     // this php file (example saved as name is vCardDL.php) is placed in my html subdirectory
     //  
     header('Content-Type: application/octet-stream');
     // the above line is needed or else the .vcf file will be downloaded as a .htm file
     header('Content-disposition: attachment; filename="xxxxxxxxxx.vcf"');
     // 
     //header('Content-type: application/vcf'); remove this so android doesn't complain that it does not have a valid application
     readfile('../aaa/bbb/xxxxxxxxxx.vcf');
     //The above is the parth to where the file is located - if in same directory as the php, then just the file name
?>

======= html ========================

<FONT COLOR="#CC0033"><a href="vCardDL.php">Download vCARD</A></FONT>

2
投票

我正在运行2.2并没有任何变化,其他人在2.3上的报道也是如此。 Android(bug)不通过端口80处理.vcf或网页上此类文件的链接,也不通过http标头或直接流式处理。它根本不支持。


2
投票

我在使用标准的通讯录应用程序在Android 7(LineageOS)上导入VERSION:4.0 vcard文件时遇到了问题。

由于这是“不支持android vcard格式”的热门搜索点击,我只想注意我能够使用简单联系人应用程序(PlayF-Droid)导入它们。


1
投票

我还注意到你必须将文件保存为UnicodeUTF-8,没有BOM的Windows格式与CRLF(回车,换行)。因为如果不这样做,导入将会中断。 (在文件中说一些奇怪的字符)

祝你好运:)希德

© www.soinside.com 2019 - 2024. All rights reserved.