-3

I have developed an app that emulates a contactless smartcard using Android HCE and an app that accesses (reads) this emulated card. Both run on Android 4.4 (KitKat) and above.

No I would like to develop the reader-side for devices that run Android 4.3 (or lower). Is it possible to access a device that uses Android HCE from a device with an API level < 19? I do not want to use the Android Beam feature.

Michael Roland
  • 36,432
  • 10
  • 81
  • 168
  • Before we can give you an answer, you should first understand your problem. What is it that you really need? – Cris Apr 23 '15 at 10:43

1 Answers1

0

No, that's not possible. By default, two Android devices (when held together) will communicate in peer-to-peer mode. This is the case even if one or both devices support host card emulation. Once an Android device successfully established a peer-to-peer mode link, it won't try to use reader/writer mode on the same target.

In order to permit the Android HCE-emulated card to be visible to (accessible from) a second Android device, that second device must disable its peer-to-peer mode capabilities and operate only in reader/writer mode.

This is exactly what you do with the Android reader mode API (that you seem to use in your reader app for Android 4.4). Using NfcAdapter.enableReaderMode() with the flags FLAG_READER_NFC_A and FLAG_READER_NFC_B forces Android to act in reader/writer mode and to disable peer-to-peer mode.

As this API (or something equivalent) is not available on Android 4.3 and below (i.e. before API level 19), you have no means to programmatically1 disable peer-to-peer mode. Consequently, your reader app on Android 4.3 can't communicate with an Android HCE emulated card.



1) Note that disabling Android Beam in Settings won't disable peer-to-peer mode either. This will just disable the Beam capabilities that would normally run on top of peer-to-peer-mode.

Michael Roland
  • 36,432
  • 10
  • 81
  • 168