Git Product home page Git Product logo

ndef-tools-for-android's Introduction

Overview

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

Background

The current (version <= 6.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

The most important features are

  • NDEF object representation library (no more byte arrays!)
    • Simple conversion to and from Android SDK low-level equivalent
  • NFC utility library. Abstract activities for:

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

NDEF object representation library

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

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(); //  org.ndeftools.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

NFC utility module

The utility module adds support for interacting with NFC from Android activities. Default implementations are provided in the boilerplate module, for reading and writing and beaming.

A working demo is available in Google Play, search for keywords 'ndef tools demo'. Browse the source for further details.

NFCDemo reworked

If you are familiar with the Android SDK NFCDemo, there is a reworked version using code from this project.

Getting started / tutorial

Visit the getting started overview page or try the beginner Android Tutorial. Alternatively try a tutorial-like workshop (solution included).

NFC Eclipse plugin

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.

Tags

Order yourself some NFC tags, read more in the NFC Eclipse plugin wiki.

Forum

Please post comments and questions at the NFC developers Google forum group.

Acknowledgements

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

News

16th of March 2015: Project migrated from Google Code. Final stats: Approximately 14.8k downloads.
March 17th 2014: Fixed Maven dependency.

History

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.

Need help?

If you need professional help with an NFC project, get in touch. Have a look at my apps.

Donate

Chip in to help me buy some more NFC tags and readers and divert time from paid work.

ndef-tools-for-android's People

Contributors

skjolber avatar michal-klimek avatar

Watchers

scarlett avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.