我正在尝试在Android2.2上添加一个来自网络链接的vCard到用户的联系人列表中。当我将用户定向到.vcf文件时,我得到的只是移动浏览器中的文本输出。我已确认正在使用MIME类型text/v-card传输文件。这看起来应该很简单。有什么想法吗?
发布于 2010-12-08 05:38:32
AFAIK Android不支持开箱即用的vCard文件,至少在2.2之前不支持。
您可以使用应用程序vCardIO从您的SD卡读取vcf文件,并保存到您的联系人。所以你必须先把它们保存在你的SD卡上,然后再导入。
vCardIO也可以在市场上买到。
发布于 2012-12-02 04:31:06
我只是想让你知道:我只是尝试使用一个根据vCard 2.1 spec创建的vCard 2.1文件。我发现,尽管是一个旧版本,vCard 2.1已经涵盖了我需要的一切,包括base64编码的照片和国际字符集。
它在我的未修改的Android 4.1.1设备(Galaxy S3)上运行得很好。它还可以在旧的iPhone 3GS (iOS 5,通过Evernote app)和一位同事未经修改的旧Android2.1设备上运行。您只需按照上面的建议将Content-disposition
设置为attachment
。
一个小问题是,我使用Microsoft Tag app扫描的QR code触发了VCF下载。这个应用程序告诉我,安卓不能处理text/x-vcard
媒体类型(或者只处理text/vcard
,不要紧)。一旦我在Web浏览器中打开了这个链接(我尝试了Chrome和Android默认浏览器),它就工作得很好。
发布于 2012-07-25 00:31:18
这可用于将文件下载到使用Android 2.3.3和4.0.3版本进行测试的SD卡
======= 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>
https://stackoverflow.com/questions/4381766
复制相似问题