Develop an Android app to emulate an NFC Forum tag

There is an Android app example, which has been produced by Dot Origin, to demonstrate how an Android phone can interact, using NFC, to deliver a payload from the phone to a VTAP reader. Contact vtap‑support@dotorigin.com for a copy of this example. This APK can be modified to build your own application.

Example Android HCE app

When you receive the example, the pre‑built APK file, which can be side‑loaded to an Android phone, will be found in the built apk folder.

For more details about how it works, you can refer to the comments at the top of the file:
/app/src/main/java/com/dotorigin/vtapandroidhce/myHostApduService.java

Choosing an AID

The application ID (AID) used by the Android HCE example app is a default NFC Forum NDEF AID: D2760000850101

An end-user's phone could have a number of host card emulation apps running, each using a different AID. So we recommend that, when you incorporate this functionality into your own app, your organisation should register and use a custom AID for your app. There is a registration system for AIDs here:
https://www.ansi.org/about/roles/registration-program/rid

Alternatively, ISO7816‑5 reserves a range of AIDs for free use as unregistered custom AIDs. AIDs in this range start with F0. If you choose a custom AID in this range, at random, there is no guarantee that this will not conflict with another app using the same AID. However, the large number of possibilities in this range means that conflicts are unlikely.

When you have chosen your custom AID, you will need to change the AID used by the app. In the example code, the AID needs to be edited in two places:

  • the AID defined in myHostApduService.java

    must match

  • the aid-filter in /app/src/main/res/xml/apduservice.xml

You will also need to change the AID expected by the VTAP reader, away from its default. Use a setting NDEFTagType4AID=F0123456123456 in the config.txt file on a VTAP reader, if F0123456123456 was your chosen AID value.