Example usage for android.nfc NdefRecord RTD_HANDOVER_REQUEST

List of usage examples for android.nfc NdefRecord RTD_HANDOVER_REQUEST

Introduction

In this page you can find the example usage for android.nfc NdefRecord RTD_HANDOVER_REQUEST.

Prototype

null RTD_HANDOVER_REQUEST

To view the source code for android.nfc NdefRecord RTD_HANDOVER_REQUEST.

Click Source Link

Document

RTD Handover Request type.

Usage

From source file:mobisocial.nfcserver.DesktopNfcServer.java

private static NdefMessage getHandoverNdef(String ref) {
    NdefRecord[] records = new NdefRecord[3];

    /* Handover Request */
    byte[] version = new byte[] { (0x1 << 4) | (0x2) };
    records[0] = new NdefRecord(NdefRecord.TNF_WELL_KNOWN, NdefRecord.RTD_HANDOVER_REQUEST, new byte[0],
            version);//from w w  w  .  j a v a  2 s  .com

    /* Collision Resolution */
    records[1] = new NdefRecord(NdefRecord.TNF_WELL_KNOWN, new byte[] { 0x63, 0x72 }, new byte[0],
            new byte[] { 0x0, 0x0 });

    /* Handover record */
    byte[] payload = new byte[ref.length() + 1];
    System.arraycopy(ref.getBytes(), 0, payload, 1, ref.length());
    records[2] = new NdefRecord(NdefRecord.TNF_WELL_KNOWN, NdefRecord.RTD_URI, new byte[0], payload);

    return new NdefMessage(records);
}