Stanford researchers develop first Android NFC P2P apps

A team from Stanford’s MobiSocial lab has developed two applications for the Google Nexus S that use NFC’s peer-to-peer capabilty: A phone-to-phone file transfer service and a collaborative whiteboard.

Android NFC sharing
P2P: The Stanford team added NFC sharing to Android

Researchers at Stanford University’s MobiSocial lab have found a way to unlock Android’s NFC peer-to-peer capabilities and have developed two P2P NFC applications, a phone-to-phone file transfer service and a ‘collaborative whiteboard’.

“We were fortunate enough to get our hands on a pair of Nexus S phones to play with,” the project team behind the NFC apps explain in a blog post. “We were inspired to look into the state of NFC on Android a bit more in-depth to see if it’d be possible to push our own P2P applications.”

The team’s investigations led to the discovery that, like Android 2.3’s tag writing capabilities, it is already possible to develop peer-to-peer NFC applications for the Nexus S — albeit in a more complicated manner than will be possible in future. The team explain that:

As it turns out, P2P mode wasn’t completely ignored in the Gingerbread cycle. After looking through some of the commits for Gingerbread (long live open source!), we found an initial implementation of P2P in Android. And, with a bit of work, we were able to run P2P mode successfully between our two devices.

The initial implementation was called MyTag, and allowed a phone to present an NFC tag to another phone. Note that although NFC has a mode for “card emulation”, this implementation uses a true P2P connection to send a tag between phones, with a socket established between the MyTagServer and MyTagClient.

The team then worked on two demonstrations. The first shows how a file can be transferred between two phones:

“We modified the built-in Gallery application to allow a picture to be shared simply by opening it on one phone and touching it to another,” says the team. “The receiver is then prompted to download the file. Note that in our implementation, the actual file is transferred between phones over HTTP. We simply use NFC to share a URL representing the image. NFC is not the speediest transfer protocol and requires the devices to remain in contact for the duration of the transfer, so we simply use it to kick off our transfer.”

The second demonstration is a collaborative whiteboard application:

“The URL contains enough information to tell the joining device (a) which application is being used, and (b) which application session to join,” says the team.

The demonstrations have been developed using the team’s own custom NFC API and they point out that running the demonstrations currently requires a custom build of the Android OS. The team also make use of the Junction platform, also developed at the MobiSocial lab, which allows an application to be run across phones even if a joining phone doesn’t yet have the application being used. Junction applications are multiparty, enabling several phones to be joined together by simply touching one interested party to any device that’s already in the session.

“Junction and NFC complement each other well for launching applications across devices,” say the team. “NFC provides the bootstrapping necessary to start the application, and Junction allows the application to run across devices.”

Full details on the project are available on the Stanford Mobile and Social Computing Research Group’s MobiSocial lab blog.

Next: Visit the NFCW Expo to find new suppliers and solutions