2010-12-07 75 views

回答

5

AFAIK Android不支持vCard文件,至少在2.2版之前不支持vCard文件。

您可以使用應用程序vCardIO從SD卡中讀取vcf文件並保存到您的聯繫人。 因此,您必須首先將它們保存在SD卡上,然後再導入它們。

vCardIO也可通過市場。

+9

我發現的最佳解決方案是通過設置content-disposition來強制下載。Apache httpd.conf或.htaccess文件中的vcf文件。然後用戶必須打開文件,並詢問他們希望如何將聯繫人信息插入到他們的聯繫人列表中。這個帖子有很多幫助:http://code.google.com/p/android/issues/detail?id=9215 – ARolek 2010-12-08 06:56:34

1

我也注意到的是,你必須將文件保存爲UnicodeUTF-8,沒有BOM在Windows格式與CRLF(回車,換行)。因爲如果你不這樣做,導入就會中斷。 (說一些關於奇怪的字符在文件中)

祝你好運:) 希德

2

我運行2.2並沒有變化,從報告人對2.3說的一樣。 Android(bug)不處理.vcf文件,也不處理通過端口80的網頁上的這種文件的鏈接,無論是通過http頭還是直接流。它只是不支持。

+0

試圖讓這個工作,這是我的Android的經驗,直到幷包括4.0,以及... – 2012-03-29 17:09:27

4

Android ICS 4.0.4現在有一個導入功能。 首先,您必須將vcf保存在存儲設備(USB存儲設備或SD卡)上。 Android將掃描選定的存儲以檢測任何vcf文件並將其導入選定的地址簿。 該功能位於聯繫人列表的選項菜單中。

3

這可以用於將文件下載到具有Android版本2.3.3和4.0.3

======= PHP測試你的SD卡 ========== ===============

<?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> 
4

只是爲了讓你知道:我剛剛試了一下使用根據vCard 2.1 spec創建一個電子名片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默認瀏覽器),它工作正常。

相關問題