Book Image

Near Field Communication with Android Cookbook

By : Subtil
Book Image

Near Field Communication with Android Cookbook

By: Subtil

Overview of this book

An easy-to-follow guide, full of hands-on examples of and real-world applications. Each recipe is explained and placed in context. If you want to learn how to create NFC-enabled Android applications, this is the book for you. Perhaps you already know a bit about Android application developments but have never used NFC, or perhaps you know a little about NFC android development but want some more advanced features and examples. In either case, this book will get you up and running quickly. You are expected to have Android programming knowledge.
Table of Contents (12 chapters)
11
Index

Inviting a friend to play a game – Part 1


Most of us have certainly played games that involve challenging someone to beat your record or inviting your friend to play against you. These invites are normally made using Facebook, or on e-mail, or even by SMS. In this recipe, we will create a simple application and implement an NFC-invite system that can be used together with the traditional invite methods.

How to do it…

In this application, we will create a simple method to share the player's information through an external-typed NDEF message. This information will be used later to allow Bluetooth pairing. This can be done by performing the following steps:

  1. Open Eclipse and create a new Android application project named NfcBookCh7Example4 and a package named nfcbook.ch7.example4.

  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 the minimum SDK version to 16 with the following code:

    <uses-sdk...