Puzzling question : How to write a proper 2.1 formatted VCF file to NFC tag [SOLVED]

what tool to write a proper 2.1 formatted VCF file to a tag , have tried using NFC tools pro, tag writer on android with no success ( ie file doe not open in contact etc on android ) when written as a text or file.This tag is formatted under 2.1 vcf format and opens porpely in contacts on windows.

What options to use to write a vcf file in NFC tools or tag writer so that it opens in contact once scanned.

A very puzzling question to me as this should be obvious but i have tired all the above with 0 success in reading it.

Note
In tag writer there is an option to write the vcf imported in contacts via business card option, but here the size strangely increases when a BASE64 photo is encoded.

Thanks

TagWriter is capable of doing this just fine. I’ve written a basic contact card to my tag with just my name and nothing else. It creates a vcard with N and FN fields, and the format is correct.

The problem might be with the way the data is being stored, but more likely it’s the opening process. Let’s start with some screenshots from taginfo that show how you’ve stored the data, then we can move on from there. Redact any data you don’t want to share.

Hi Amal sorry my bad it seems I did not explain. My situation properly.

it’s a custom handcoded VCF file with BASE64 encoded image and iam trying to write the created vcf file on the nfc tag using tag writer and nfc tools.

To elaborate further

These encoded vcf files with photo write fine as a file or text option in tag writer but these written file won’t open as contact in android when detected. When. Scanned they show tagwiter or taginfo as apps to open it.

On the other hand
I don’t have any issue in writing a business card via the internal options of tagwriter or nfc tools, they write fine and open fine in contacts on android when scanned.

Hope iam able to put it correct for experts here to point me in right direction

Ha, well Amal is THE most expert person here.

I did this last night, and started to reply, but realised it was not what you wanted so stopped, but maybe you could try it as a different approach :man_shrugging:


I dont have a FULL or ACTUAL answer for you.

What I have done so far is:

import a .vcf

and the options it gives me are

Precisely what I want but I want contacts to be there and mine does not show contacts. And I have a Embedded BASE64 encoded photo so how did you wite the external vcf file

The options in tagwiter and nfc tops is

  1. to write it as file which I did as text file
  2. as infill text, so I copied the entire vcf file contents in the text tab.

I did not select the box to open application in the option

And saved it and wrote the NFC tag. Tags written both the options show when scanned but show tagwiter, taginfo or nfc tools and Contact does not show in the options, that’s the concern.

Hope there is something that’s clearly misses my view and others know :sweat_smile:

I think the problem is that there is no VCF record type NDEF records. The record type for vCard is well known and the phone knows what to do with it when opening that type of record from an NFC tag. Because file storage is not a design goal for NFC, you might be able to write the binary data to the NFC tag, but the phone isn’t going to know what to do with it.

You could use a special application to read the data and properly create the contact file and then try to import it into Android contacts, but because it is not a native NFC well-known NDEF record type, you’re not going to get native support for that kind of data on an NFC tag.

I guess the other question I have is why do you need VCF file format? You can easily embed a photo into vCard NDEF records. Essentially they are the same but the vCard NDEF record type is critical for ensuring the phone understands the data contained in the record is a vCard.

Does it have to be BASE64 encoded ?
Could it be WEBP like in @roscos example

like in the thread you asked the question in

Yes it’s a WEBP but the encoding is base64 like the example, same here it’s become a desperate obsession now to cram it to max and sidetracking my other project :rofl:

Base64 is typically how photos are embedded in the vcard data because the actual file is binary and doesn’t comply with th vCard data encoding requirements unless it’s been converted to base64

Ah, my bad, I missed that.

A windows / android solution WOULD be nice.

I have a linux laptop, and would like to try @Roscos tool, but I am not exactly Linux proficient, so It has held firmly near the bottom of my project list

Even that’s fine can you share an example to how to do it. An VCard NDEF structure with photo also would be fine to check.

So how to convert a vcf to VCard NDEF and hwo to write it, an example would be great.

How are you writing the vcard data to the NFC tag? If you use tagwriter it will include the photo as long as if fits. Make a contact on your phone that includes a photo and tagwriter will write it.

Here’s a fun example.

BEGIN:VCARD
VERSION:2.1
N:Graafstra ;amal;
NOTE:this note be fire
URL:https://x.com/amal
URL:https://amal.net
PHOTO;JPEG;ENCODING=BASE64:/9j/4AAQSkZJRgABAQAAAQABAAD/4gIoSUNDX1BST0ZJTEUAAQEAAAIYAAAAAAQwAABtbnRyUkdCIFhZWiAAAAAAAAAAAAAAAABhY3NwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAA9tYAAQAAAADTLQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlkZXNjAAAA8AAAAHRyWFlaAAABZAAAABRnWFlaAAABeAAAABRiWFlaAAABjAAAABRyVFJDAAABoAAAAChnVFJDAAABoAAAAChi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QPxXI2FwojDIq2TKZXJzUt5lxpp1suAjxNrJt+EjbHuuj5foQSGIKUp1aVttgICjewvvf8XlghYS4i1a9iLjMTUjJfTDIqO5LfcfFoUFeG+rSbH87DEs7N0yrT8n15tVQeZiu1Ea46LBLlmmjvvvutQ+mNN2i6y3My7R4ccNqcVMSEtNLBKEjTe3qdgD6Ya/Z3ysig9LY5qiQxLlPqlkLXfY2CbEc7JvbywrYwxIroWvI/UYGXsvNNxm0FQIVe5WPcH/XBjmHMU7OV3aQttsWBSCN8GENJRACjAiXrsLOfVyrRZldcg0anRiHIlMgNqWltXylS1rUSs7XvYbHEll9CoEmjCVW626+6q6ksNI02sfXz54wYMN22NnEWrpTPkQfUPpw7kuX4nEvx3istLbNikA3udvRQwqptQnUZZcaPeXPK1cD32wYMHp+w7k3kKEYlY3Ml9ek1+IIMhKY/wyQlBSDe3GJaOoNOabZbQ0lJU6lJecUVH5gbgW5uEj6nBgwcqIZLnK+zRwMur6vZlpwio/wUZaZTqgoDSkq+Xf8ApVi0MyHHpcRmnBWhptDbLYSSd+Rf/NgwYStGDHaO1DH2cs0VURvW3IVqXztgwYMBjJn/2Q==
END:VCARD

How do you write in tagwiter or nfc tools what options did you exactly use.

I have similar NDEF ready to write. Thanks a ton for the help by everyone esp Amal

Of course that is a huge record. Requires a 4kB chip at least.

The easiest way would be to make a contact in your phone with all the data and photo you want. Then use tagwriter to write that contact to the tag. Easy peasy.

TagWriter can’t construct a vCard record from scratch it can only import a contact from your phone. Annoying but fine.

Nope thats the issue I am not able to write it using tagwiter by selecting contact as the size becomes bloated in contacts when I import the vcf card as contact import, so the only option is to write the NDEF directly on the tag as my vcf file with WEBP. Embedded photo is just about less than 700 byte.

The same when imported in contacts via vcf import turns to about 3000 byte that’s the issue.

Any other ideas to keep the size less than 700 byte as thats the size of my Embedded vcf file with photo.

How have others done in on n216 tag, or am I over attempting at my end, iam sure there is way to push the small less than 700 byte payload directly in it., iam clear missing something by using tagwiter and nfc tools

Use NFC Tools.

1 Like