繁体   English   中英

如何锁定NFC标签?

[英]How to lock NFC tags ?

我正在开发一个在NFC标签中写入NDEF记录的android应用程序。 我没有使用启动器来编写标签。 只是将代码编写到我的应用程序中,我想知道如何保护标签,使其无法被重写?

这是写记录的代码:

            Intent intent = getIntent();
    if(intent.getType() != null && intent.getType().equals(MimeType.NFC_DEMO)) {
        Parcelable[] rawMsgs = getIntent().getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES);
        NdefMessage msg = (NdefMessage) rawMsgs[0];
        NdefRecord cardRecord = msg.getRecords()[0];
        String tableName = new String(cardRecord.getPayload());
        displayCard(tableName);
    }

Ndef类具有makeReadOnly方法( http://developer.android.com/reference/android/nfc/tech/Ndef.html#makeReadOnly()

要获取该对象的实例,您将使用Ndef.get(tag)。 查看高级NFC教程,了解如何获取标签对象( http://developer.android.com/guide/topics/connectivity/nfc/advanced-nfc.html

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM