1
我正在开发一个在NFC标签中写NDEF记录的android应用程序。我没有使用启动器来写标签。只是将代码写入我的应用程序,我想知道如何保护标签,使其不能被重写。如何锁定NFC标签?
,这里是其写入记录代码:
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);
}
Thanx的解决方案,它的工作原理绝对没问题,但有没有办法再次使标签可写一旦我使用“makeReadOnly()”功能? –
@Ranvijay正如Neiti01所解释的那样,makeReadOnly()方法是单向过程,无法恢复。 – JackAW