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.
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:
Open Eclipse and create a new Android application project named
NfcBookCh7Example2and a package named
Make sure the
AndroidManifest.xmlfile is configured correctly. Refer to the Requesting NFC permissions recipe in Chapter 1, Getting Started with NFC.
Set the minimum SDK version to
14with the following code:
<uses-sdk android:minSdkVersion="14" />
Add the following
<intent-filter> <action android:name="android.nfc.action.NDEF_DISCOVERED...