I'm new to this field, I got a Nexus S ( CyanogenMod11 = Android Kitkat 4.4.2) And I need to use HCE (Host-Based Card Emulation) mode in order to emulate a contactless card.
Any guidance on the steps and the tips I need to follow in order to accomplish this? ( - Do I need to program the simulated Secure Element? put it on cloud? )
P.S: I have to use the new Reader Mode also, because my app is going to be read by another Android NfC-enabled phone and not by an NFC reader.
Thank you.
Before CyanogenMod 11, CyanogenMod supported its own host-based card emulation functionality. You could register a foreground dispatch for the android.nfc.tech.IsoPcdA
technology and could then emulate a smartcard by using the IsoPcdA.transceive()
method. See Nikolay Elenkov's blog post on how to use this API.
However, browsing through the CyanogenMod 11 source (specifically tht of the NFC service) it seems that this functionality has been dropped in version 11 in favor of Android 4.4's official HCE API.
The official Android 4.4 HCE API permits apps to emulate a contactless smartcard (ISO 14443-4 + ISO 7816-4 APDUs) in an Android service. That service would handle all incoming command APDUs for an application and generate proper response APDUs. See the official API user guide for further information on how to register such a HCE service and this answer on how to handle incoming command APDUs within your HCE service.
Unfortunately this API is not available either on devices that use libnfc-nxp as the low-level NFC stack (see the empty implementation of routeAid()
and enableRoutingToHost()
in the CyanogenMod 11 source code).
So to summarize this, it seems as if it's currently not possible to do host-based card emulation on a Nexus S with CM 11.
来源:https://stackoverflow.com/questions/24099849/host-based-card-emulation-any-guidance-please