franckbour / Plugin.NFC

A Cross-Platform NFC (Near Field Communication) plugin to easily read and write NFC tags in your application.
MIT License
236 stars 68 forks source link

Write VCARD data #150

Open bptf opened 9 months ago

bptf commented 9 months ago

Which NFCNdefTypeFormat can be used to write VCARD data to an NFC card?

Ex data:

BEGIN:VCARD
VERSION:3.0
FN;CHARSET=UTF-8:Name
...
CATEGORIES:BUSINESS,WORK
REV:2022-05-31T20:08:12.016Z
END:VCARD

Thanks!

bptf commented 9 months ago

I was thinking NFCNdefTypeFormat.Mime but I am not sure. In NFC Tools app, the field has Content-type: text/vCard. So something like this?

new NFCNdefRecord
{
    TypeFormat = NFCNdefTypeFormat.Mime,
    MimeType = "Content-type: text/vCard",
    Payload = NFCUtils.EncodeToByteArray(data)
}

Or do I need to use NFCNdefTypeFormat.WellKnown, and if so how do I assign the Content-type?