NDefContact
com.rvi.domain.NDefContact · Record · SocialCard 1.0.3
A contact encoded as a vCard 4.0 NDEF record.
When to use it
Section titled “When to use it”Supply at least a first or last name. Leave optional email, phone and website fields unset by using the builder, or pass null to the record constructor. Use an HTTP or HTTPS address for the website.
Java example
Section titled “Java example”final NDefContact contact = new NDefContact( "Alex", "Example", "alex@example.com", null, "https://example.com");final NDefMessage message = new NDefMessageCreator().add(contact).build();
System.out.println(new TlvEncoder().encode(message).length);Java imports
import com.rvi.application.TlvEncoder;import com.rvi.application.creator.NDefMessageCreator;import com.rvi.domain.NDefContact;import com.rvi.domain.NDefMessage;vCards can occupy considerably more tag space than a URI. This example measures the stored bytes without NFC hardware.
How it works
Section titled “How it works”The record strips surrounding whitespace from fields and stores omitted fields as empty strings. The encoder serialises the supported fields as a text/vcard payload. The decoder accepts the library’s limited vCard shape, so test third-party vCards before assuming they will round-trip.
Related API
Section titled “Related API”NDefContactCreator · NDefDecoder · TlvEncoder · NDefValueException