1 <p> 2 Near-field Communication or NFC is a standard defined by the 3 <a href=http://www.nfc-forum.org/home>NFC Forum 4 </a>. 5 NFC Data Exchange Format (NDEF) defines a common data format between NFC-compliant devices and tags. 6 This demo application shows how to read a NDEF Tags using using Android 2.3 SDK APIs. 7 The NFC Tags consist of data encoded in NDEF Message format specified by NFC Forum Type 2 Specification. 8 Each NDEF message consists of one or more NDEF Records. 9 10 You need a NFC compliant device and a NFC compliant Tag to use this sample app. Or else, you could use 11 the FakeTagsActivity displayed at launch of this sample app, to generate fake Tag broadcasts from the emulator. 12 </p> 13 14 <p>The application includes: 15 </p> 16 <ul> 17 <li> 18 <a href="src/com/example/android/nfc/TagViewer.html"> 19 <code>TagViewer 20 </code> 21 </a> 22 — an 23 <code>Activity 24 </code> that handles a broadcast of a new tag that the device 25 just discovered, parses it, and displays its record contents in a 26 <code>ListActivity 27 </code> 28 </li> 29 <li> 30 <a href="src/com/example/android/nfc/NdefMessageParser.html"> 31 <code> NdefMessageParser 32 </code> 33 </a> 34 — parses the record type of records within the NDEF message. 35 </li> 36 <li> 37 <a href="src/com/example/android/nfc/record/ParsedNdefRecord.html"> 38 <code>ParsedNdefRecord 39 </code> 40 </a> 41 — an interface implemented by all parsed NdefRecord types. 42 </li> 43 <li> 44 <a href="src/com/example/android/nfc/record/SmartPoster.html"> 45 <code>SmartPoster 46 </code> 47 </a> 48 — a representation of an NFC Forum Smart Poster Record Type. 49 </li> 50 <li> 51 <a href="src/com/example/android/nfc/record/TextRecord.html"> 52 <code>TextRecord 53 </code> 54 </a> 55 — a representation of an NFC Forum Text Record Type. 56 </li> 57 <li> 58 <a href="src/com/example/android/nfc/record/UriRecord.html"> 59 <code>UriRecord 60 </code> 61 </a> 62 — a representation of an NFC Forum Uri Record Type. 63 </li> 64 <li> 65 <a href="src/com/example/android/nfc/simulator/FakeTagsActivity.html"> 66 <code>FakeTagsActivity 67 </code> 68 </a> 69 — A activity that launches tags as if they had been scanned. 70 This is useful if you don't have access to NFC enabled device or tag. 71 </li> 72 <li> 73 <a href="src/com/example/android/nfc/simulator/MockNdefMessages.html"> 74 <code>MockNdefMessages 75 </code> 76 </a> 77 — this class provides a list of fake NFC Ndef format Tags. 78 </li> 79 80 </ul> 81 <p>If you are developing an application that uses the NFC API, remember that the feature 82 is supported only on Android 2.3 (API level 9) and higher versions of the platform. Also, 83 among devices running Android 2.3 (API level 9) or higher, not all devices will offer NFC 84 support. To ensure that your application can only be installed on devices that are capable 85 of supporting NFC, remember to add the following to the application's manifest before 86 publishing to Android Market: 87 </p> 88 <ul> 89 <li> 90 <code><uses-sdk android:minSdkVersion="9" /> 91 </code>, 92 which indicates to Android Market and the platform that your application requires 93 Android 2.3 or higher. For more information, see 94 <a href="../../../guide/appendix/api-levels.html">API Levels 95 </a> 96 and the documentation for the 97 <a href="../../../guide/topics/manifest/uses-sdk-element.html"> 98 <code><uses-sdk> 99 </code> 100 </a> element. 101 </li> 102 </ul> 103 <p>To control how Android Market filters your application 104 from devices that do not support NFC, remember to add the following to the application's manifest 105 <ul> 106 <li> 107 <code><uses-feature android:name="android.hardware.nfc" /> 108 </code>, 109 which tells Android Market that your application uses the NFC API. The declaration 110 should include an 111 <code>android:required 112 </code> attribute that indicates whether you want 113 Android Market to filter the application from devices that do not offer NFC support. Other 114 <code><uses-feature> 115 </code> declarations may also be needed, depending on your 116 implementation. For more information, see the documentation for the 117 <a href="../../../guide/topics/manifest/uses-feature-element.html"> 118 <code><uses-feature> 119 </code> 120 </a> element. 121 </li> 122 </ul> 123 <p>For more information about using the NFC API, see the 124 <a href="../../../reference/android/nfc/package-summary.html"> 125 <code>android.nfc</code> 126 </a> 127 documentation. 128 </p> 129 <img alt="" src="../images/NfcDemo.png"/> 130