O'Reilly logo

Near Field Communication with Android Cookbook by Vitor Subtil

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Sending texts to other devices

Android Beam uses the standard NdefMessage parameter to share data between devices, and as we learned in Chapter 3, Writing Tag Content, we can encapsulate the text to NdefMessage. In this recipe, we will create a simple application that sends texts to other devices.

How to do it…

In this application, we will send the content of TextView to another device through an NdefMessage, which is formatted as RTD_TEXT, as shown in the following steps:

  1. Open Eclipse and create a new Android application project named NfcBookCh7Example2 and a package named nfcbook.ch7.example2.
  2. Make sure the AndroidManifest.xml file is configured correctly. Refer to the Requesting NFC permissions recipe in Chapter 1, Getting Started with NFC.
  3. Set ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required