vcf download to mobile phone

164 views
Skip to first unread message

efrank

unread,
Feb 6, 2010, 10:02:51 PM2/6/10
to XMPie Interest Group
Hello everybody,

I'm working on a project that involves the generation of a qr-code
encoded with the contact information on a business card. The contact
info and the qr-code should than be printed together on a business
card. If done as described, it doesn't work with most phones due to
the data density on the code. Most phones aren't able to decode 2d-
codes that complex. The workaround consists in generating a simple qr-
code encoded with only a url. Being less complex, the phone has no
problem reading the qr-code, which sends the phone's browser to a page
where the user can click a link that downloads the vcard info to the
phone's contacts list.
My problem is with the last part. So far I have only been able to
download a .vcf file to the phone's file system, but no to write the
cards content into the contacts list.
Can somebody point me to resources where I can research how to solve
this? Any input is highly appreciated.
Eduardo Frank

Timothy Perrett

unread,
Feb 7, 2010, 6:47:26 AM2/7/10
to xmpie...@googlegroups.com
Im really not sure you are going to be able to write something completely agnostic. All phones have different interfaces for contact management: for instance, iphone vs blackberry.

VCF was invented as a serialised contact exchange format - your best bet is to let the phone "do the right thing" with the vcard. Not to mention that you couldn't code anything anyway to do it from within a browser because that would break the inherent security model present in HTTP - the only way you could inject right into a devices contact list would be to have a custom client-side application installed that had permission to local resources (for instance, the iphone SDK has a contacts api)

Cheers, Tim

> --
> You received this message because you are subscribed to the Google Groups "XMPie Interest Group" group.
> To post to this group, send email to xmpie...@googlegroups.com.
> To unsubscribe from this group, send email to xmpie-users...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/xmpie-users?hl=en.
>
>

efrank

unread,
Feb 7, 2010, 9:32:42 AM2/7/10
to XMPie Interest Group
Thanks Tim for your reply.
Here is a working example: http://www.scanlife.com/
They have a url workflow as described in my post. After scanning the
qr-code, you are directed to a page where your contact information is
displayed along side a link to write it to the phone's contact list.
It works like a charm on my Blackberry, but I have not tried it on
different phones yet.

Here is another example: http://www.mskynet.com/static/QRGenAPI/#bgcol
These people have a Blackberry only solution and a more agnostic one
too.

I would be content if I get it working at least with the Blackberry.
Cheers
Eduardo

Timothy Perrett

unread,
Feb 9, 2010, 10:00:51 AM2/9/10
to XMPie Interest Group
So something occurred to me last night. Why don't you just use the QR
code to load a URL that asynchronously sends them an SMS message...?

95% of all mobiles know what to do when receiving a VCF card, so that
would then negate a vendor tie in.

Thoughts?

Cheers, Tim

efrank

unread,
Feb 11, 2010, 8:49:44 AM2/11/10
to XMPie Interest Group
Hi Tim,

your proposal is certainly a good idea. Most phones can handle a .vcf
attached to a text message. The downside for me is that in our shop we
lack the infrastructure to send SMS. We've never done it and hence we
don't know what is necessary to get such a service going. I'll look
into it.
Cheers

Eduardo

efrank

unread,
Feb 24, 2010, 7:07:09 PM2/24/10
to XMPie Interest Group
Hi Timothy

I have a working solution in php. As discussed, a simple qr-code on
the business card sends you to a web site.
There you have a link to download the vcard. Clic that link and a
script fetches the vcard file and offers it as an attachment to be
downloaded.
It works on my BlackBerry and it might be completely 'agnostic', since
it is xhtml.
Here is the code:

this is the webpage wihich url is encoded in the 2d barcode

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>vcard Page</title>
</head>

<body>
<a href="get_vcard.php?path=vcard.vcf">Download vcard</a>
</body>
</html>

This is the script get_vcard.php

<?php
$filename = $_GET['path'];
$save_as = basename($filename); // this is the name the user sees.
$c_type = 'text/x-vcard';//what file type?
$file_size = filesize("$filename");
if ($fp = fopen("$filename", 'rb')) {
Header('Content-Type: '. $c_type); // this depends on file type!!!
Header('Content-Disposition: attachment; filename="'.
$save_as.'"');
Header('Content-Length: '.$file_size);
fpassthru($fp);
} else {
echo"cannot find file: <b>$filename</b>";
}
?>

It is not yet database driven, but it serves as a proof of concept.
To make it an xmpie project, I need now to translate the script into
asp, which I don't know enough of.
Can somebody recommend me a web page where to start learning to code
asp for xmpie.

Thanks a lot
Eduardo

On Feb 7, 7:47 am, Timothy Perrett <timo...@getintheloop.eu> wrote:

Reply all
Reply to author
Forward
0 new messages