External NFC Service API (native style) for Android
This API is for interacting with the External NFC Service app found in Google Play.
Background
The External NFC Service app offers NFC functionality similar to the built-in Android NFC API - for external NFC readers:
- External NFC reader management and interaction
- NFC Tag access using Andriod built-in (native) types (Ndef, MifareUltralight, IsoDep, etc).
This very much simplifies implementation in use-cases where external NFC readers is required, so it will save a lot of development time.
Overview
This repository contains source code for
- An Android library project (the actual API), and
- Demo client apps demonstrating actual usage
- Basic client app
- NXP API client for MIFARE SDK
- Web Kiosk client with javascript bindings
There is also a Host Card Emulation client app for use with the Basic client app.
API
The API defines
- broadcast actions
- service start / stop and status
- reader open / close and status
- tag connect / disconnect
- 'extras' objects for interaction with readers
- disable beeps
- display text
- configure NFC tech types (PICC)
- enable/disable LEDs
- run custom commands
- abstract activities for interaction with built-in and external NFC (in parallel)
- these currently depend on the NDEF Tools for Android project.
- Programmatically start and stop the service (see methods startService() and stopService() in the NfcExternalDetectorActivity class in for an example).
Note that tag interaction is performed via the native NFC classes and so these are not included in the API itself.
Supported readers
Currently the ACS readers
are supported and must be connected to your Android device via an On-The-Go (OTG) USB cable.
Supported tag technology
Mifare Ultralight and Mifare Classic (including NTAG203, NTAG213) tags are supported. I recommend Mifare Ultralights / NTAG203. Desfire EV1 tags are supported but without NDEF support. Host card emulation (IsoDep) targets are also supported.
Please note:
- ACR 122U the Mifare Classic does not work.
Troubleshooting
Note that not all Android devices actually have an USB hub.
Does the ACR reader not light up when connected to your device, even after the service asks for USB permissions? The ACR reader shuts down if there is not enough battery, so try charging your battery more.
Please report any issues to skjolber@gmail.com.
Related apps
You might be interested in
- ACR 1222L USB NFC Reader Utils
- ACR 122 USB NFC Reader Utils
- ACR 1251 USB NFC Reader Utils
- ACR 1281 USB NFC Reader Utils
for configuration of your reader. Approximately the same configuration options are available using this API.
Feature requests
Please email feature requests to skjolber@gmail.com.
Distribution
Get in touch for bulk and/or offline distribution. A library jar is also available, simplifying distribution of your own app(s).
Need help?
If you need professional assistance with an NFC project, get in touch. I also do
- Host Card Emulation (HCE) for Android
- Desfire EV1 tech (with encryption)
- Smartcard-related workflows and integrations
- Tag emulation
Feel free to connect with me on LinkedIn.