ndef-lib/index.js
function (ndefRecords, id) {
        var payload = [];

        if (!id) { id = []; }

        if (ndefRecords)
        {
            // make sure we have an array of something like NDEF records before encoding
            if (ndefRecords[0] instanceof Object && ndefRecords[0].hasOwnProperty('tnf')) {
                payload = ndef.encodeMessage(ndefRecords);
            } else {
                // assume the caller has already encoded the NDEF records into a byte array
                payload = ndefRecords;
            }
        } else {
            console.log("WARNING: Expecting an array of NDEF records");
        }

        return ndef.record(ndef.TNF_WELL_KNOWN, ndef.RTD_SMART_POSTER, id, payload);
    }
function (ndefRecords, id) {
        var payload = [];

        if (!id) { id = []; }

        if (ndefRecords)
        {
            // make sure we have an array of something like NDEF records before encoding
            if (ndefRecords[0] instanceof Object && ndefRecords[0].hasOwnProperty('tnf')) {
                payload = ndef.encodeMessage(ndefRecords);
            } else {
                // assume the caller has already encoded the NDEF records into a byte array
                payload = ndefRecords;
            }
        } else {
            console.log("WARNING: Expecting an array of NDEF records");
        }

        return ndef.record(ndef.TNF_WELL_KNOWN, ndef.RTD_SMART_POSTER, id, payload);
    }
function ( ndefRecords , id ) { var payload = [ ] ; if ( ! id ) { id = [ ] ; } if ( ndefRecords ) { // make sure we have an array of something like NDEF records before encoding if ( ndefRecords [ 0 ] instanceof Object && ndefRecords [ 0 ] . hasOwnProperty ( 'tnf' ) ) { payload = ndef . encodeMessage ( ndefRecords ) ; } else { // assume the caller has already encoded the NDEF records into a byte array payload = ndefRecords ; } } else { console . log ( "WARNING: Expecting an array of NDEF records" ) ; } return ndef . record ( ndef . TNF_WELL_KNOWN , ndef . RTD_SMART_POSTER , id , payload ) ; }
Helper that creates an NDEF record containing an Smart Poster.

@ndefRecords array of NDEF Records
@id byte[] (optional)
Helper that creates an NDEF record containing an Smart Poster .