nfc开关
nfc读写 读:id/.类型/Hash
nfc访真
其实很简单,开启设置中的NFC功能,把系统音量调到最大,
拿一张公交卡之类的放到手机背后,能够听到系统提示声音就代表NFC功能存在,电池为原版!
NFC技术在手机中可以有三种功能状态,一是卡模拟状态,利用RFID等技术,实现支付卡、门禁卡等功能;二是识读器状态,利用手机屏幕读取信息,包括智能标签、海报等;另一种则是自助支付功能。
private NdefRecord createRecord()throwsUnsupportedEncodingException{
String text ="Hello, World!";
String lang ="en";
byte[] textBytes = text.getBytes();
byte[] langBytes = lang.getBytes("US-ASCII");
int langLength = langBytes.length;
int textLength = textBytes.length;
byte[] payload =newbyte[1+ langLength+ textLength];
// set status byte (see NDEF spec for actual bits)
payload[0]=(byte) langLength;
// copy langbytes and textbytes into payload
System.arraycopy(langBytes,0, payload,1, langLength);
System.arraycopy(textBytes,0, payload,1+ langLength, textLength);
NdefRecord record =newNdefRecord(NdefRecord.TNF_WELL_KNOWN,
NdefRecord.RTD_TEXT,
newbyte[0],
payload);
return record;
}
Then we write the record as an NDEF message:
private void write(Tag tag) throws IOException, FormatException {
NdefRecord[] records = { createRecord() };
NdefMessage message = new NdefMessage(records);
// Get an instance of Ndef for the tag.
Ndef ndef = Ndef.get(tag);
// Enable I/O
ndef.connect();
// Write the message
ndef.writeNdefMessage(message);
// Close the connection
ndef.close();
}
http://code.google.com/p/openmobster/wiki/NFC
http://www.lvtafeiyan.com/article/xiaoshuo/123.html
http://www.cnblogs.com/doandroid/archive/2011/11/29/2267404.html