Host Card What?
• Where data is routed ?
• Support for many different protocols
• Android NFC devices functioning as readers
( IsoDep class).
Host Card Why?
• No more complex SE cards.
• Multiple NFC payment wallets can be on the
No worrying about SE storage size.
No need to pay the Carrier for Over-the-air SE
provisioning and lifecycle management.
Enabling any wallet to use it to communicate to
ISO/IEC 7816-4 specification
Application ID (AID).
Length between 5 and 16 bytes
AID well-known and publicly registered
What if you want to deploy new reader infrastructure for
your own application ?
• AID group is a list of AIDs that should be
considered as belonging together by the OS
HCE service may need to register multiple AIDs
to implement a certain application
Android guarantees one of the following
o All AIDs in the group are routed to this HCE service
o No AIDs in the group are routed to this HCE service
AID groups and categories
• Each AID group can be associated with a
avoid mentioning AIDs in any user-facing
parts of your application.
Android 4.4 supports two categories:
Checking for HCE support
Your application can check whether a device supports
HCE by checking for the
The first step is therefore to extend HostApduService.
HostApduService declares two abstract methods that
need to be overridden and implemented
Service implementation (2)
processCommandApdu() is called whenever a NFC
reader sends an Application Protocol Data Unit (APDU)
to your service
"SELECT AID" APDU.
processCommandApdu() run on the main thread.
When Android will stop forwarding new APDUs from the
reader to your service ?
o The NFC reader sends another "SELECT AID" APDU, which the OS
resolves to a different service
o The NFC link between the NFC reader and your device is broke.
In both of these cases,onDeactivated() implementation is called
Android Protocol Data Unit (APDU)
APDUs are the application-level packets being
exchanged between the NFC reader and your HCE
APDU is a half-duplex.
Android’s HCE implementation only supports a single