How to make an Android phone act like a contactles

2019-08-10 20:11发布

问题:

In order to help debug a HCE app I would like to make an Android phone act as a contactless terminal.

Is this possible without rooting the phone and using NFCProxy? (http://sourceforge.net/projects/nfcproxy/)

i.e. I have two phones and want to run my app on one while making the other act as a reader.

回答1:

This is only possible if your reader Android device (the one that acts as contactless terminal) has Android 4.4 or later.

The problem is that Android's HCE capabilities run in parallel with its peer-to-peer mode capablities (regardless of whether the device has support for Android Beam enabled or not). As a consequence, other Android devices will detect Android HCE devices as peer-to-peer devices and, by default, communicate with them in peer-to-peer mode. Therefore, other Android devices will normally be unable to access an Android HCE emulated smartcard application.

Starting with Android 4.4, you can prevent this by disabling peer-to-peer mode discovery using the reader mode API.



回答2:

Looks like this project does emulation of a contactless terminal (for at least some of the conversation) https://github.com/doc-rj/smartcard-reader