get Place id As Ndef - Android Network

Android examples for Network:NFC Ndef

Description

get Place id As Ndef

Demo Code


//package com.java2s;

import android.nfc.NdefMessage;
import android.nfc.NdefRecord;

public class Main {
    public static NdefMessage getPlaceidAsNdef(int idtoWrite) {
        String msg = Integer.toString(idtoWrite);
        byte[] textBytes = msg.getBytes();
        NdefRecord textRecord = new NdefRecord(NdefRecord.TNF_MIME_MEDIA,
                "application/tap.europe".getBytes(), new byte[] {},
                textBytes);/*from  www.j ava 2 s  .c o  m*/
        return new NdefMessage(new NdefRecord[] { textRecord });
    }
}

Related Tutorials