NFC Flashcards
What is NFC?
A set of short-range wireless technologies which allow you to share small payloads of data between an NFC tag & Android device or between 2 Android devices
What are the 3 modes of operations simultaneously supported by Android devices with NFC?
- Reader/Writer mode: NFC device can read/write a passive NFC tag
- P2P mode: NFC device can exchange data with other NFC peers
- Card Emulation mode: NFC device can act as an NFC card, then be accessed by another NFC reader
What are the 2 major use cases when working with NDEF data and Android?
- Reading NDEF data from NFC tags
- Beaming NDEF from one device to another
How should you develop your activity given that the NFC communications occur in a very short distance?
You should develop your activity to only handle the data you care about and prevent activity chooser from appearing
How does the tag dispatch system work in 3 steps?
- Parses the NFC tag, then figures out the MIME type/URI and the payload
- Encapsulates the MIME type/URI and the payload into an intent
- Starts an activity based on the intent
How is NDEF data structured when coming to Android?
It has a NdefMessage which has one or more NdefRecords. Each NdefRecord much follow NDEF specification.
What does a well formatted NDEF data contain in the first NdefRecord in the NdefMessage?
- 3-bit Type Name Format
- Variable Length type
- Variable Length ID
- Variable Length payload
What does 3-bit TNF(Type Name Format) do?
It acts as an indicator on how to interpret the variable length type
What does variable length type do?
It describes the type of the record, if TNF is “TNF_WELL_KNOWN”, use this field to specify RTD(Record Type Definition)
What does variable length ID do?
It uniquely identifies a record
What does variable length payload do?
It contains the actual payload data
What are the 3 types of intent that could be sent as a result of NFC tag scan?
- ACTION_NDEF_DISCOVERED
- ACTION_TECH_DISCOVERED
- ACTION_TAG_DISCOVERED
What are the 3 TNF that will fall back to ACTION_TECH_DISCOVERED intent?
- TNF_EMPTY
- TNF_UNCHANGED
- TNF_UNKNOWN
What are the 4 RTD that will fall back to ACTION_TECH_DISCOVERED intent?
- RTD_ALTERNATIVE_CARRIER
- RTD_HANDOVER_CARRIER
- RTD_HANDOVER_REQUEST
- RTD_HANDOVER_SELECT
How are NFC tags are dispatched by the system?