Android Wearables (2015)
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 we’ve been researching for half a decade now, developing our own wearable devices that connect to personal devices for full functionality and connectivity. We’ve 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 programs’examples 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 you’ve recently started your adventures in Android. You should have at least some understanding of Android’s basic components to fully grasp the content of this book.
If you’ve 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 you’re 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 you’re 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 application’Recipe 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 we’ve 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 you’ve read Chapters 4 through 8, you’re 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. It’s 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:
To help you get the most from the text and keep track of what’s happening, this book uses a number of conventions.
Warnings hold important, not-to-be-forgotten information that is relevant to the surrounding text.
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 present
context or to show changes from a previous code snippet.
For author and peer discussion, join the P2P forums at http://p2p.wrox.com. The forums are a web-based system for you to post messages about Wrox books and related technologies and to interact with other readers and technology users. The forums offer a subscription feature that e-mails you topics of interest when new posts are made to the forums. Wrox authors, editors, other industry experts, and your fellow readers are present on these forums. The forums will help you not only as you read this book, but also as you develop your own applications. To join the forums, follow these steps:
1. Go to http://p2p.wrox.com, and click the Register link.
3. Complete the required information to join, as well as any optional information you want to provide, and click Submit.
4. You receive an e-mail describing how to verify your account and complete the joining process.
You can read messages in the forums without joining P2P, but to post messages, you must join.
After you join, you can post new messages and respond to messages other users post. You can read messages at any time. If you would like to have new messages from a particular forum e-mailed to you, click the Subscribe to this Forum icon by the forum name in the forum listing.
For more information on how to use the Wrox P2P, read the P2P FAQs. You’ll find answers to questions about how the forum software works, as well as answers to many common questions specific to P2P and Wrox books. To read the FAQs, click the FAQ link on any P2P page.