INTRODUCTION
WEARABLES is an exciting field. It has existed commercially for more than a decade in the form of watches, headsets, clothes, activity trackers, and cameras. But only in the last few years have we seen devices so tiny and complex that we can truly call them wearable.
Google launched its Glass technology in 2012 with an impressive demo, showcasing not just how tiny the device is, but also all the functionality compressed into it. In 2014 Google continued on this path of wearable devices with its Android Wear SDK, which presents a new way of thinking about wearable devices. It is no longer a standalone device that can talk to your phone or computer; it is a device that extends your phone. This presents a unique new way of thinking about your personal devices. The phone is your primary device, and you can extend it with new functionality by connecting wearable devices to it.
Wearables is a field weve been researching for half a decade now, developing our own wearable devices that connect to personal devices for full functionality and connectivity. Weve seen the possibilities in the field, and Android Wear can help us achieve them.
This book is a hands-on guide to wearables, with a focus on the Android Wear SDK. You will learn about the Android Wear SDK by building small sample programsexamples that can easily be implemented in larger applications. This book covers all the basic functionality of Android Wear.
WHO THIS BOOK IS FOR
This book is for anyone who wants to dive into wearables in general and Android Wear application development in particular. The information in this book covers the major parts of the new and exciting platform called Android Wear.
This book works well both as a reference for the experienced Android developer and as an introductory guide if youve recently started your adventures in Android. You should have at least some understanding of Androids basic components to fully grasp the content of this book.
If youve never worked with any kind of wearable device, you may enjoy Chapter 1, which introduces the topics of wearable research and history, and Chapter 2, which introduces the closely related field of the Internet of Things (IoT).
If youre an inexperienced Android developer eager to get started coding, Chapter 3 may be a good starting point for instructions on setting up your development environment and test-running your first Android Wear app.
If youre an experienced Android developer, you might want to start with Chapters 4 through 8 which discuss the new Android Wear APIs in detail.
Chapters 9, 10, and 11 exemplify Android Wear development in three simple projects that you can use as starting points for your own ideas. Before doing so, you should read Part II.
WHAT THIS BOOK COVERS
The book is divided into three parts, Part I offers basic theory about wearables and the related field of the Internet of Things in an easily digested way. Part II will give you a foundation in Googles Wearable platform, Android Wear, and Part III contains three easy-to-build projects.
Chapter 1 introduces the history of and research into wearables. Chapter 2 introduces the closely related field of the Internet of Things. Chapter 3 covers installing your development environment and preparing devices and emulators before you compile and run your first Android Wear applicationRecipe Assistant.
Chapters 4 through 8 provide detailed reviews of the different APIs introduced with Android Wear, including notifications, Wear UIs, communicating with mobile apps, voice interactions and location-based services.
Chapters 9, 10, and 11 describe building wearable applications and projects that include Android Wear.
Android Wear is an area that is in constant motion, much like Android was in its infancy. Therefore, the technologies used for developing Android Wear change often. We used the latest versions, but you may see some discrepancies with your development environment.
HOW THIS BOOK IS STRUCTURED
The chapters stand on their own and therefore can be read in any order. But weve structured this book in a logical fashion to help introduce the wearable novice to this exciting field.
The more experienced Android developer who has a good understanding of wearable technology can start with Chapter 4. That chapter and the ones after it discuss the details of the new Wear-specific APIs using basic examples.
When youve read Chapters 4 through 8, youre ready to start developing your own application ideas. Or you can get inspiration from the sample projects in Chapters 9 through 11.
WHAT YOU NEED TO USE THIS BOOK
To run the examples found in this book, you must have a working development environment for Android Wear. For this you need an updated Java Development Kit, the SDK, and the development tools. Its highly recommended that you download Android Studio, because it contains the Wear-specific helper dialogs and makes development easier.
The examples in this book have been tested on Windows, Mac, and Linux computers. You can download the tools for all three systems from the Android website.
Although a real Android Wear device is recommended, you do not need one for most of the examples in this book. You may find that the examples in Chapters 9, 10, and 11 do not work well on an emulator.
The source code for the examples is available for download from the Wrox website at:
www.wrox.com/go/androidwearables
CONVENTIONS
To help you get the most from the text and keep track of whats happening, this book uses a number of conventions.
WARNING
Warnings hold important, not-to-be-forgotten information that is relevant to the surrounding text.
NOTE
This books also contains notes, tips, hints, tricks, and asides to the current discussion.
As for styles in the text:
- We highlight new terms and important words when we introduce them.
- We show keyboard strokes like this: Ctrl+A.
- We show filenames, URLs, and code within the text like this:
persistence.properties
. - We present code in two different ways:
We use a monofont type with no highlighting for most code examples. We use bold to emphasize code that is particularly important in the presentcontext or to show changes from a previous code snippet.
SOURCE CODE
As you work through the examples in this book, you can type in all the code manually, or you can use the accompanying source code files. All the source code used in this book is available for download at www.wrox.com
. The code downloads for this book are on the Download Code tab at:
www.wrox.com/go/androidwearables
Chapters that have companion code files are noted as such at the beginning of the chapter. The code files are named according to the code listing numbers throughout the chapter.
You can also search for this book at www.wrox.com
by ISBN (this books ISBN is 978-1-1189-8685-1) to find the code. A complete list of code downloads for all current Wrox books is available at www.wrox.com/dynamic/books/download.aspx
.
NOTE
Because many books have similar titles, you may find it easiest to search by ISBN.
Most of the code on www.wrox.com
is compressed in a .zip
file, a .rar
archive, or a similar archive format appropriate to the platform. After you download the code, just decompress it with an appropriate decompression tool. Alternatively, you can go to the main Wrox code download page at
Next page