Example usage for android.nfc NdefRecord getId

List of usage examples for android.nfc NdefRecord getId

Introduction

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

Prototype

public byte[] getId() 

Source Link

Document

Returns the variable length ID.

Usage

From source file:Main.java

static JSONObject recordToJSON(NdefRecord record) {
    JSONObject json = new JSONObject();
    try {/* w ww. ja v a 2 s. c om*/
        json.put("tnf", record.getTnf());
        json.put("type", byteArrayToJSON(record.getType()));
        json.put("id", byteArrayToJSON(record.getId()));
        json.put("payload", byteArrayToJSON(record.getPayload()));
    } catch (JSONException e) {
        //Not sure why this would happen, documentation is unclear.
        Log.e(TAG, "Failed to convert ndef record into json: " + record.toString(), e);
    }
    return json;
}