Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.skjolber:external-nfc-api:2.1.0'
}
dependencies {
implementation("com.github.skjolber:external-nfc-api:2.1.0")
}
<dependency>
<groupId>com.github.skjolber</groupId>
<artifactId>external-nfc-api</artifactId>
<version>2.1.0</version>
</dependency>
libraryDependencies += "com.github.skjolber" % "external-nfc-api" % "2.1.0"
:dependencies [[com.github.skjolber/external-nfc-api "2.1.0"]]
Library for interaction with ACS NFC readers over USB; external NFC support Android devices.
Features:
android.nfc
classes (Ndef, MifareUltralight, IsoDep, etc) for Android 10+ support.As this project very much simplifies implementation for use-cases requiring external NFC readers, it saves a lot of development time (2-8 weeks depending on use-case and previous knowledge).
Most of the code within this repository has been refined into Entur's android-nfc-lib. This does not include
This repository contains source code for
There is also a Host Card Emulation client app for use with the Basic client app as well as Android-to-Android communication.
The API defines
extras
objects for interaction with readers
Currently the ACS readers
are supported and must be connected to your Android device via an On-The-Go (OTG) USB cable.
Additional ACR readers might work depending on their command set, however custom reader commands will (like LED, beep etc) will not be available.
The following tags are supported by the service
The readers can for the most part can be enabled for all tag types at the same time, including Host Card Emulation.
Please note:
Configuration options
Note that not all Android devices actually have an USB hub, in which case no USB devices work.
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, or connect external power.
If you are using external power, be aware that the connection order (device, reader, power) might be important. Known symptom:
There is quite a few types of tags out there, and if your tag type is not recognized, please let me know. If the tag does not register at all, make sure that auto polling is configured, and that the right protocols are enabled. Use the below utility apps for tweaking your reader settings.
You might be interested in
for configuration of your reader. Approximately the same configuration options are available using this API.
This project contains adapted code from
android.nfc
NFC android classes + various refactorings.