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

Understanding the foreground dispatch system


In Android, we can have multiple applications to complete the same task. For example, we can have multiple web browsers installed, and when we want to open a web page, the Android system prompts us to choose which application to open; NFC applications are no different. The foreground dispatch system allows an activity to intercept an NFC intent (tag detected or P2P events) and claim priority over other activities that are registered to handle the same intent. This way, when our application is in the foreground, users won't be prompted to choose which application to open, and the intent is sent to our application.

An Intent is a messaging object that describes an operation to be performed and is generally used to start activities, services, and facilitate data exchange among different applications.

How to do it...

We are going to create an application that demonstrates how the foreground dispatch system works and how it is useful to us. To do so,...