Showing posts with label nfc. Show all posts
Showing posts with label nfc. Show all posts

Friday, May 25, 2012

Read and Write NFC Tags with PhoneGap

The phonegap-nfc plugin allows you to read and write NFC tags from a PhoneGap application using JavaScript.

The plugin originally supported Android. The latest release adds support for Blackberry 7.0.

After installing the plugin into your PhoneGap app (See README) it is easy to start scanning tags.

Create a function that will handle the NFC events.

function onNfc(nfcEvent) {
    // display the tag as JSON
    alert(JSON.stringify(nfcEvent.tag));
}

Create the optional success and failure callbacks. These callbacks are for success and failure of adding the listener.

function success(result) {
    console.log("Listening for NFC Messages");
}

function failure(reason) {
    alert("Failed to add NDEF listener");
}

Register listener. When the listener is added, the plugin will generate an NFC Event whenever a tag is scanned.

nfc.addNdefListener(onNfc, success, failure);

Deploy the application and scan a tag.

Example Project

The NFC Reader example project has been updated for Blackberry.

More info

The PhoneGap NFC API is documented in the README file.

Kevin wrote Building NFC applications with Android last year. Most of that information still applies.

Tuesday, November 16, 2010

NFC. What does it all mean?

NFC: Near Field Communications: a short-range high frequency wireless communication technology which enables the exchange of data between devices over about a 10 centimeter (around 4 inches) distance (via Wikipedia).

Well that's great, but what does it mean, especially when mentioned in conjunction with Gingerbread?

As you may (or may not) have heard this week at the Web2.0 Summit Eric Schmidt talk about Android 2.3 and its support for NFC. This could indeed lead the way for mobile payments on devices. NFC will allow for the transmission of credit card data over a defined radio frequency (13.56 MHz).

This isn't new, Japanese handsets (Keitai) have had this type of technology for a while (I want to say up to 10 years, but I can't back that up right now). Go google Osaifu-Keitai/keitai credit.

However this *is* all exciting news. There is potential for integrating it with conferences, museums, travel, healthcare, payment systems, and countless other things. Lets not forget though, some of these things already exist already:

  • Exxon SpeedPass
  • Debit cards with Visa PayWave.

Now we have another new way to gain information about our surroundings. #mobilefirst anyone?

Some interesting articles to peruse at your leisure.

RFID in Museums - Another Growing Market

Who Will Win the Mobile Payments Battle: Gadgets, NFC or Apps?

Intuit Squares Off In Mobile Credit, With A Little Help From Apple

Future Credit Cards: Electronic and RFID?

Web 2.0 Summit 2010: Eric Schmidt, "A Conversation with Eric Schmidt"