Near Field Communication with Android Cookbook
eBook - ePub

Near Field Communication with Android Cookbook

  1. 286 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Near Field Communication with Android Cookbook

About this book

In Detail

Near Field Communication, or simply NFC, is an emerging technology with endless applicability. Its low battery consumption and simplicity are the keys to its success.

Near Field Communication with Android Cookbook is a hands-on book that will help you to set up your development environment, get to know the basics of NFC, and then use what you learn to create more enhanced and practical applications. This practical guide will teach you all you need know about NFC to get you started in developing outstanding out-of-the-box applications.

Approach

An easy-to-follow guide, full of hands-on examples of and real-world applications. Each recipe is explained and placed in context.

Who this book is for

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.

Trusted by 375,005 students

Access to over 1.5 million titles for a fair monthly price.

Study more efficiently using our study tools.

Information

Year
2014
Edition
1
eBook ISBN
9781783289653

Near Field Communication with Android Cookbook


Table of Contents

Near Field Communication with Android Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Getting Started with NFC
Introduction
Requesting NFC permissions
Getting ready
How to do it…
How it works…
Indicating that your app uses NFC
How to do it…
How it works…
Defining minimal requirements
How to do it…
How it works…
Verifying whether the device has an NFC adapter
How to do it…
How it works…
There's more…
Downloading Open NFC Android Edition
Getting ready
How to do it…
Downloading Open NFC SDK Edition
How to do it…
Configuring the Open NFC Android add-on into your Android SDK
Getting ready
How to do it…
How it works…
Configuring an NFC-enabled testing AVD
Getting ready
How to do it…
How it works…
There's more…
Configuring the Connection Center tool
Getting ready
How to do it…
How it works…
Testing your app all together
Getting ready
How to do it…
How it works…
2. Detecting a Tag
Introduction
Understanding the foreground dispatch system
How to do it...
How it works...
Understanding the tag dispatch system
How to do it...
How it works...
Verifying if your app started because of an NFC intent
How to do it...
How it works...
Filtering tags by their content type
How to do it...
How it works...
Filtering tags by their content type programmatically
How to do it...
How it works...
Filtering tags by their technology
How to do it...
How it works...
Filtering tags by their technology using programs
How to do it...
How it works...
Filtering URI tags
How to do it...
How it works...
3. Writing Tag Content
Introduction
Working with the NDEF record
Getting ready
How to do it...
How it works...
Writing a URI-formatted record
How to do it...
How it works...
Writing a text-formatted record
How to do it...
How it works...
Using Android Application Record
How to do it...
How it works...
Working with external types
How to do it...
How it works...
Working with custom mimes
How to do it...
How it works...
4. Writing Tag Content – Real-life Examples
Introduction
Making a phone call with one tap – Part 1
Getting ready
How to do it…
How it works…
Sending a predefined SMS – Part 1
How to do it…
How it works…
Visiting our website
How to do it…
How it works…
Leaving a (small) note – Part 1
How to do it…
How it works…
5. Reading Tag Content
Introduction
Obtaining NDEF Message from Intent
Getting ready
How to do it…
How it works…
Getting the data out of the message
How to do it…
How it works…
Reading a text-formatted record
Getting ready
How to do it…
How it works…
Reading a URI-formatted record
How to do it…
How it works…
Reading external types
How to do it…
How it works…
Reading custom mimes
How to do it…
How it works…
6. Reading Tag Content – Real-life Examples
Introduction
Making a phone call with one tap – Part 2
Getting ready
How to do it...
How it works...
Sending a predefined SMS – Part 2
Getting ready
How to do it...
How it works...
Leaving a (small) note – Part 2
Getting ready
How to do it...
How it works...
Getting the tag information
How to do it...
How it works...
7. Sharing Content across Devices
Introduction
Creating a basic peer-to-peer Hello World application
Getting ready
How to do it…
How it works…
Sending texts to other devices
How to do it…
How it works…
Sending a friend invite on Facebook
Getting ready
How to do it…
How it works…
Inviting a friend to play a game – Part 1
How to do it…
How it works…
8. Error Handling and Content Validation
Introduction
Handling tag-writing errors
Getting ready
How to do it...
How it works...
Handling tag-reading errors
Getting ready
How to do it...
How it works...
Testing the tag data for integrity
Getting ready
How to do it...
How it works...
9. Extending NFC
Introduction
Turning other adapters on/off
Getting ready
How to do it...
How it works...
Configuring a Wi-Fi network
How to do it...
How it works...
Starting a Wi-Fi hotspot
How to do it...
How it works...
Inviting a friend to play a game – Part 2
How to do it...
How it works...
Controlling hotel room access with Arduino and NFC – Part 1
How to do it...
How it works...
Controlling hotel room access with Arduino and NFC – Part 2
Getting ready
How to do it...
How it works...
10. Real-life Examples – NFC Utilities
Introduction
Creating multi-action tags
Getting ready
How to do it…
How it works…
Choosing the best format for our data
How to do it…
How it works…
Locking tags
How to do it…
How it works…
Joking with a friend
Getting ready
How to do it…
How it works…
Index

Near Field Communication with Android Cookbook

Copyright © 2014 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: June 2014
Production Reference: 1060614
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78328-965-3
www.packtpub.com
Cover Image by Ravaji Babu ()

Credits

Author
Vitor Subtil
Reviewers
Dion Loughry
Michael Roland
Commissioning Editor
Kunal Parikh
Acquisition Editor
Rebecca Youé
Content Development Editors
Athira Laji
Rikshith Shetty
Technical Editors
Shubhangi Dhamgaye
Novina Kewalramani
Pratik More
Pratish Soman
Copy Editors
Alisha Aranha
Mradula Hegde
Adithi Shetty
Project Coordinator
Wendell Palmer
Proofreaders
Simran Bhogal
Maria Gould
Ameesha Green
Paul Hindle
Indexer
Mariammal Chettiyar
Production Coordinator
Adonia Jones
Cover Work
Adonia Jones

About the Author

Vitor Subtil has been a web developer s...

Table of contents

  1. Near Field Communication with Android Cookbook

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn how to download books offline
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.5M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1.5 million books across 990+ topics, we’ve got you covered! Learn about our mission
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more about Read Aloud
Yes! You can use the Perlego app on both iOS and Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app
Yes, you can access Near Field Communication with Android Cookbook by Vitor Subtil in PDF and/or ePUB format, as well as other popular books in Informatique & Applications de bureau. We have over 1.5 million books available in our catalogue for you to explore.