grundid / nfctools-examples

Examples for the nfctools library
69 stars 55 forks source link

== Examples for the NFC Tools for Java ==

This repository contains some examples for the NFCTools for Java: https://github.com/grundid/nfctools

== Download compiled JAR file ==

Your can download all examples together with the dependencies as a JAR file from this URL: https://github.com/grundid/nfctools-examples/releases

To launch the demos execute the following commands. To end a demo press CTRL-C at any time.

Host-based Card Emulation demo:

java -cp nfctools-examples.jar org.nfctools.examples.hce.HceDemo

SnepDemo demo:

java -cp nfctools-examples.jar org.nfctools.examples.snep.SnepDemo -url -target -terminal

-target : activates target mode, please use it with Android 4.1 -terminal : pass a string as terminal name if you have several NFC devices connected

LlcpDemo demo:

java -cp nfctools-examples.jar org.nfctools.examples.llcp.LlcpDemo

LlcpService demo (old):

java -cp nfctools-examples.jar org.nfctools.examples.llcp.LlcpService

NdefReaderDemo: java -cp nfctools-examples.jar org.nfctools.examples.ndefreader.NdefReaderDemo

ClearCardDemo:

java -cp nfctools-examples.jar org.nfctools.examples.clearcard.ClearCardDemo

ScanWholeCardDemo

java -cp nfctools-examples.jar org.nfctools.examples.scancard.ScanWholeCardDemo

== Demo descriptions ==

ClearCardDemo will try to delete all data on a Mifare Classic card and put the card back into transport mode. It will use some known keys to access the sectors.

NdefReaderDemo reads an NDEF message from a Mifare Classic card and shows it in the log.

NdefWriterDemo writes an NDEF message on a Mifare Classic card.

ScanWholeCardDemo scans the whole Mifare Classic card and shows the contents in the log.

LlcpService demonstrates a P2P connection with an Android phone. It will receive any Android Beam and NDEF Push messages and show them in the log. With Android 2.3 and 4.1 please set initiatorMode to false, with Android 4.0 it works best in initiatorMode set to true.