# NFC

Supported platform: Android

Support HCE (Host Based Card Emulation) mode, which simulates Android phones as physical smart cards. Support NFC read and write, that is, the phone is used as a card reader.

  • Applicable models: NFC support, and the system version of Android 5.0 and above mobile phone
  • Card range: CPU cards according to ISO 14443-4
  • Support for Reader / Writer mode, that is, NFC devices can read or write passive NFC tags and stickers
  • Applicable models: NFC support, and the system version of Android 5.0 and above mobile phone
  • Scope of application:
    • 支持 NFC-A (ISO 14443-3A) / NFC-B (ISO 14443-3B) / NFC-F (JIS 6319-4) / NFC-V (ISO 15693) / ISO-DEP (ISO 14443-4) 标准的读写
    • (Some Android phones) Support reading and writing of Mifare Classic / Mifare Ultralight tags
    • Supports reading and writing of NDEF data on NFC tags in NDEF format

# Basic processes

Previous NFC-A card writing apdu instructions as an example

  • Call wx.getNFCAdapter () to get an instance of the NFC Adapter
  • Call NFCAdapter.onDiscovered (function callback) to register sticker listening callback
  • Call NFCAdapter.startDiscovery (Object object) to start listening on the sticker
  • Paste card, onDiscovered callback
    • Match to card according to techs field of onDiscovered callback res object supports NFC - A standard
    • Get an instance of NfcA by NFCAdapter.getNfcA ()
  • Read and write using NfcA instances
    • Call NfcA.connect () and the NFC card to establish a connection
    • Invokes NfcA.transceive (Object object) to write apdu instructions to the NFC card and receive the card's return data
    • After reading and writing, call NfcA.close () to disconnect
  • Call NFCAdapter.stopDiscovery (Object object) to end listening sticker

# NFC tag open Weixin Mini Program

In addition to the above Weixin Mini Program basic NFC capabilities, WeChat also supports the ability to quickly pull up Mini Program pages via NFC cards.It can be used in scenarios such as rapid network distribution, quick control of smart devices.

Please refer to: NFC tag open Weixin Mini Program .