The NFC Eclipse plugin editor creates static NDEF messages as files.
An NDEF message consists of a list of NDEF Records.
Later, you might want to handle NDEF messages dynamically at runtime using a library like NDEF Tools for Android.
Right-click on a folder and select
New -> Other -> Near Field Communications -> NDEF File
You should see something like
Then enter a file name,
press Finish and a new file is created.
Alternatively create a generic file with extension .ndef.
The editor consists of three parts:
The records are listed in a table of four columns:
Record | Value | Size | Hint |
---|---|---|---|
Record tree (record + property names) | Record property value | Record size | Useful hints or error messages |
There is also three tabs. The editor can display a custom QR code for your message, and so there is a tab for side-by-side display or QR-only.
Two status line items appear at the bottom of the screen:
NDEF Message size | NFC Reader status |
---|---|
0 bytes | No card reader |
Right-click on the editor to bring up a popup:
For this example we will use an Android Application Record.
The record is missing some required information. Input a package name,
and we have successfully created an NDEF message with a single record.
Right-click on a record to insert more records.
Top-level records can be rearranged by drag and drop.
Binary payloads can be loaded from files by clicking the field value (in blue, hovered, below). Once loaded, the field can be reloaded from the same file by right-clicking on the field name and choosing 'Reload previous file'. This applies to Mime Media, External Type and Unknown record types.
For some record types, like Text record and Mime record, tooltip are supported.
So far we have only created files, but this is not of much help unless we can interface some NFC hardware. Two approaches are supported:
- NFC-enabled Android device via the free NFC Developer app
- NFC reader
- ACR 122 and others Having an NFC reader is obiously better, but many have NFC-enabled smartphones these days, so why not put them to work? :-)
NFC Developer app
After installing from Google Play, there are two alternatives:
Switch to the NDEF+QR or QR tab to transfer the NDEF file by scanning the QR code on your screen.
Then just directly scan a tag to write. Simple, yet effective.
Transfer an NDEF file to your Android device's file-system, then select 'Load file' from the app menu. Save to file is also supported.
This option is best suited for big NDEF messages, as the QR code approach only supports up to 2953 bytes while tag capacity is currently up to 8k.
Then just scan a tag to write.
For your convenience, the app can auto-detect and preview some data types - like the greenbird at the bottom of the above screenshot:
Please note that using XML or JSON is not necessarily the best choice for small (64 byte) tags, but it is all good for prototyping.
If an NFC reader is present, for example connected via USB, it should show up in the status line. If so, new alternatives appear within the editor right-click popup:
- Read, or write to tag
- Auto-import tag into specific editor whenever a tag is placed on the reader
- Auto-export to tag whenever the message is edited (and valid).
- Mark tag as read-only, or format tag
By default, any tag placed on the scanner automatically appears as a new NDEF file :-)
NFC Reader interaction can also be enabled or disabled completely.
You might consider getting some tags to play with, order using this link to support this project at the same time.