android - Id on Nfc tag not unique? -



android - Id on Nfc tag not unique? -

i reading nfc tags on android phone, there value written tag read this:

@override protected string doinbackground(tag... params) { tag tag = params[0]; ndef ndef = ndef.get(tag); if (ndef == null) { // ndef not supported tag. homecoming null; } ndefmessage ndefmessage = ndef.getcachedndefmessage(); ndefrecord[] records = ndefmessage.getrecords(); (ndefrecord ndefrecord : records) { if (ndefrecord.gettnf() == ndefrecord.tnf_well_known && arrays.equals(ndefrecord.gettype(), ndefrecord.rtd_text)) { seek { homecoming readtext(ndefrecord); } grab (unsupportedencodingexception e) { log.e(tag, "unsupported encoding", e); } } } homecoming null; } private string readtext(ndefrecord record) throws unsupportedencodingexception { byte[] payload = record.getpayload(); string textencoding = ((payload[0] & 128) == 0) ? "utf-8" : "utf-16"; // text encoding int languagecodelength = payload[0] & 0063; // language code homecoming new string(payload, languagecodelength + 1, payload.length - languagecodelength - 1, textencoding); // text }

and there should unique id of nfctag read only, tried:

tag tag = intent.getparcelableextra(nfcadapter.extra_tag); mnfcid = tag.getid().tostring();

but giving different results on next read !!! how can read unique read tag nfc tag ?

there tags don't have unique id privacy reasons. travel documents , credit cards contain nfc chip among them.

also: don't count on uniqueness of ids can read. these can faked. many manufacturers of nfc tags don't guarantee worldwide uniqueness of id.

android nfc

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -