How to get a vCard (.vcf file) into Android contacts from website

前端 未结 7 1533
花落未央
花落未央 2020-12-08 22:46

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.

相关标签:
7条回答
  • 2020-12-08 23:42

    This can be used to download the file to your SD card Tested with Android version 2.3.3 and 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>
    
    0 讨论(0)
提交回复
热议问题