create NFC NdefMessage - Android Network

Android examples for Network:NFC Message

Description

create NFC NdefMessage

Demo Code


//package com.java2s;
import android.nfc.NdefMessage;
import android.nfc.NdefRecord;

public class Main {
    public static final String MIME_TYPE_VCARD = "text/x-vCard";

    public static NdefMessage createNdefVCard(String vcard) {
        NdefRecord record = new NdefRecord(NdefRecord.TNF_MIME_MEDIA,
                MIME_TYPE_VCARD.getBytes(), new byte[] {}, vcard.getBytes());
        return new NdefMessage(new NdefRecord[] { record });
    }// w w w .  j ava 2  s  . co m
}

Related Tutorials