• Stars
    star
    139
  • Rank 262,954 (Top 6 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created over 9 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

NDEF Tools for Android

Overview

This site hosts a library for Near Field Communication on Android using the NDEF format.

The current (version <= 10.0) Android SDK only comes with a low-level NDEF API which does not expose developers to the full potential of the NDEF format. Rather than sweating over byte arrays, developers should have access to high-level representations.

Features:

  • NDEF object representation library (no more byte arrays!)
    • Simple conversion to and from Android SDK low-level equivalent
  • JSE module with the corresponding Android classes for use in regular Java

In short, this projects helps you to handle dynamic NDEF content at runtime.

License

Apache 2.0

Obtain

The project is built with Gradle and is available on the central Maven repository. For Gradle, configure the property

ext {
  ndefToolsForAndroidVersion = '2.0.0'
}

and add the dependency

api("com.github.skjolber.ndef-tools-for-android:ndeftools:${ndefToolsForAndroidVersion}")

Usage

So a Message consists of a list of Records in the NDEF standard. Browse the source for an overview of supported record types.

Creating new NDEF records

Compose an Android Application Record:

AndroidApplicationRecord aar = new AndroidApplicationRecord();
aar.setPackageName("org.ndeftools.boilerplate");

Compose a Mime Record

MimeRecord mimeRecord = new MimeRecord();
mimeRecord.setMimeType("text/plain");
mimeRecord.setData("This is my data".getBytes("UTF-8"));

Create new NDEF message

From above, simply

Message message = new Message(); //  com.github.skjolber.ndef.Message
message.add(androidApplicationRecord);
message.add(mimeRecord);

or from bytes

byte[] messageBytes = ...; // get your bytes
Message message = Message.parseNdefMessage(messageBytes);

Converting to and from native Android NdefMessage

Use

NdefMessage lowLevel = ...; // get from existing code
Message highLevel = new Message(lowLevel);
// read from high-level records

or

Message highLevel = ...// compose high-level records
NdefMessage lowLevel = highLevel.getNdefMessage();
// .. pass low-level NdefMessage to existing code

JSE module

A few NFC classes copied from the Android open source project, so that the NDEF library can be used on regular Java (i.e. Java 8 or 11).

Example

For a working example see android-nfc-lifecycle-wrapper.

See also

For a graphical NDEF editor, try NFC Eclipse plugin. It creates static NDEF content, and so is good for getting to know the NDEF format. Recommended for developers new to NFC.

Acknowledgements

This project springs out the NFC Tools for Java and NFC Eclipse plugin projects.

History

August 2020: Version 2.0.0 maintainance release:

  • Maven coordinates updated; group is now com.github.skjolber.ndef-tools-for-android
  • Packages renamed to com.github.skjolber.ndef
  • Added Gradle build (now dual builds with Maven)
  • Moved utilities and examples to seperate project
  • Minor improvements

March 28th 2013: Version 1.2.3 released.
February 5th 2013: Version 1.2.2 released.
January 1st 2013: Version 1.2.1 released.
October 18th 2012: Version 1.2 released.
September 15th 2012: Initial release.

More Repositories

1

3d-bin-container-packing

A variant of the Largest Area Fit First (LAFF) algorithm + brute force algorithm
Java
391
star
2

external-nfc-api

Interaction with external NFC readers in Android
Java
171
star
3

desfire-tools-for-android

Open source MIFARE DESFire EV1 NFC library for Android
Java
75
star
4

mockito-soap-cxf

Test SOAP services using JUnit and Mockito
Java
49
star
5

xswi

The simple, standalone XML Stream Writer for iOS
Objective-C
30
star
6

Fagmote

Java
28
star
7

aotc-gradle-plugin

Ahead-of-Time Compilation in Gradle projects.
Java
16
star
8

nfc-tags

15
star
9

nfc-eclipse-plugin

Eclipse plugin for working with NDEF in NFC tags
Java
14
star
10

java-jwt-benchmark

Project for benchmarking popular Json Web Token (JWT) frameworks for Java using JMH.
Java
10
star
11

maven-cache-github-action

Github Action for caching of the Maven repository (at ~/.m2)
TypeScript
10
star
12

sesseltjonna-csv

World's fastest CSV parser / databinding for Java
Java
10
star
13

json-log-filter

World's fastest JSON filter for the JVM
Java
7
star
14

mockito-rest-spring

REST web-service mocking utility for Spring
Java
6
star
15

android-nfc-lifecycle-wrapper

Library for NFC on Android using androidx lifecycle extensions and functional interfaces.
Java
6
star
16

json-log-domain

Library supporting JSON-logging with Logback and Stackdriver
Java
6
star
17

jackson-syntax-highlight

Syntax highlighting (via ANSI) for JSON output using Jackson
Java
6
star
18

logback-logstash-syntax-highlighting-decorators

Syntax highlighting JSON decorator for logstash-logback-encoder
Java
6
star
19

google

This is my working repository for Google APIs.
HTML
4
star
20

async-stax-utils

Asynchronous StAX-utils
Java
4
star
21

xml-log-filter

High-performance filtering of to-be-logged XML
Java
4
star
22

mule-module-dxpath

Dynamic XPath module for Mule ESB
Java
3
star
23

gtfs-neo4j-import

GTFS Neo4j import
Java
3
star
24

gtfs-databinding

High-performance reading of zipped GTFS files
Java
3
star
25

gradle-jfrog-artifactory-multimodule-library-example

Pattern for multimodule open-source library using gradle and JFrog Artifactory
Java
2
star
26

MIFAREClassicRefactor

Java
2
star
27

csv-benchmark

Benchmarking high-performance open source CSV parsers using JMH
Java
2
star
28

unzip-csv

High-performance (i.e. multi-threaded) unpacking and processing of CSV files directly from ZIP archives.
Java
1
star
29

inline-histogram

Inline text histogram
Java
1
star
30

spring-boot-maven3-jdk8-centos

Openshift docker image with s2i file and descriptor.
Shell
1
star
31

gradle-cache-cleaner

Removed unused dependencies from Gradle cache
Java
1
star
32

datasets-json-benchmark

Json parser benchmarks for specific datasets
Java
1
star
33

skjolber.github.io

Thomas
JavaScript
1
star