Most visited

Recently visited

Added in API level 9

android.nfc

提供对近场通信(NFC)功能的访问,允许应用程序读取NFC标签中的NDEF消息。 “标签”实际上可能是另一个以标签形式出现的设备。

有关更多信息,请参阅 Near Field Communication指南。

以下是这些课程的总结:

NfcManager
This is the high level manager, used to obtain this device's NfcAdapter. You can acquire an instance using getSystemService(Class ) .
NfcAdapter
This represents the device's NFC adapter, which is your entry-point to performing NFC operations. You can acquire an instance with getDefaultAdapter(), or getDefaultAdapter(android.content.Context).
NdefMessage
Represents an NDEF data message, which is the standard format in which "records" carrying data are transmitted between devices and tags. Your application can receive these messages from an ACTION_TAG_DISCOVERED intent.
NdefRecord
Represents a record, which is delivered in a NdefMessage and describes the type of data being shared and carries the data itself.

注意:并非所有基于Android的设备都提供NFC功能。

Interfaces

NfcAdapter.CreateBeamUrisCallback  
NfcAdapter.CreateNdefMessageCallback 当另一个能够进行NDEF推送的NFC设备(Android Beam)处于范围内时,要调用的回调。
NfcAdapter.OnNdefPushCompleteCallback 系统成功将您的 NdefMessage到其他设备时要调用的回调。
NfcAdapter.OnTagRemovedListener 将标记从字段中删除时调用的回调。
NfcAdapter.ReaderCallback 当前台活动在阅读器模式下运行时系统找到标签时要调用的回调。

Classes

NdefMessage 代表不可变的NDEF消息。
NdefRecord 代表不可变的NDEF记录。
NfcAdapter 代表本地NFC适配器。
NfcEvent 包装与任何NFC事件相关的信息。
NfcManager 高级经理用于获取 NfcAdapter的实例。
Tag 代表已发现的NFC标签。

Exceptions

FormatException  
TagLostException  

Hooray!