Hi, has anyone got any insight in how to make a Vcard QR Code; i.e. so someone can scan the QR Code and it inserts your details into their contacts list? Plenty of websites offer such a function, but I`d like to make a small app for creating it on the phone?
QRGenerator is a class that generates QR codes. It is written in B4X and it is compatible with B4A, B4i and B4J. iPhone default camera app recognizing the QR code displayed in a B4A app: Can create codes made of up to 2953 bytes. It depends on XUI library and B4XCollections v1.50+. It uses...
www.b4x.com
Now, the hard part is to create the proper string of text to generate the QR code from. A quick search for the Vcard format found this:
Ok, gave it a try... it makes a pretty huge QR code and when I scan it with my phone it does open Contacts but the information is not transfered?
I`m building the string mentioned above with stringbuilder.
B4X:
Dim sb As StringBuilder
sb.Initialize
sb.Append("BEGIN:VCARD")
sb.Append("VERSION:3.0")
sb.Append("N:Costello;James")
sb.Append("FN:James Costello")
sb.Append("ORG:xxx")
sb.Append("URL:http://xxxxxxxx/")
sb.Append("EMAIL:xxxxxxxxx")
sb.Append("TEL;TYPE=voice,work,pref:xxxx")
sb.Append("ADR;TYPE=intl,work,postal,parcel:;;xxxx;;;xxxx;xxxxx")
sb.Append("End:VCARD")
Dim qr As QRGenerator
qr.Initialize(my_qr.Width)
my_qr.SetBitmap(qr.Create(sb.tostring))
Also, I'm pretty sure that if you stuff less info into the Vcard string (like only your name, email and phone), the resulting QR Code will be much smaller.