CONTENTS
INTRODUCTION
Who This Book Is For
What This Book Covers
How This Book Is Structured
What You Need to Use This Book
Conventions
Source Code
Errata
p2p.wrox.com
PART I CONCEPTS
1 INTRODUCTION TO ANDROID WEARABLES
The Wearable Revolution
Dismantling the Computer: the Cyborg Dream
Software Everywhere
Fashion Is More than Ski Jackets
Fitness
Time
Glasses
Summary
Recommended Reading
2 THE INTERNET OF THINGS
How Wearables Relate to IoT
The Promise of Connectivity
Connected Devices in the Home
Connected Devices on the Go
Wireless Sensor Networks
Smart Cities
Summary
Recommended Reading
3 PLATFORMS AND TECHNOLOGY
Android Wear
Installing the Wear SDK
Working with the Android Wear Emulator
Working with a Real Wear-Enabled Device
Kick-starting Your Wear Development
Distributing Wear Apps on Google Play
Summary
PART II BASIC BUILDING BLOCKS
4 NOTIFICATIONS ON SMALL SCREENS
About Notifications
Building Notifications
Stacking Notifications
Summary
Recommended Reading
5 DEVELOPING WEAR APPS
The Wear SDK
Creating the Wear Project
Building the User Interface
Providing Positive Feedback
Summary
Recommended Reading
6 VOICE INPUT
Talking to Your Wrist
Types of Voice Interaction
Using System-Provided Voice Commands
The Wear APIs
Answering to Notifications: Capturing Your Voice into an App
Summary
Recommended Reading
7 PUSHING DATA
Checking the Example
Making Your Google API Client from Scratch
Summary
Recommended Reading
8 LOCATION-BASED SERVICES ON ANDROID WEAR
Changing How Location Works
Summary
Recommended Reading
PART III PROJECTS
9 ANDROID WEAR AS ACTIVITY TRACKER
What Are Activity Trackers?
Wear as an Activity Tracker
Building the WalkKeeper App
Improvements
Summary
10 SMARTWATCH AS INPUT
Android Wear as a Game Controller
Building the Dice Game
The Dice Game
Improvements
Summary
Recommended Reading
11 BUILD YOUR OWN GLASS
Augmented Reality and Virtual Reality
Building Your Own Glasses
The Simplest App
Summary
TITLEPAGE
COPYRIGHT
DEDICATION
ABOUT THE AUTHORS
ABOUT THE TECHNICAL EDITOR
CREDITS
ACKNOWLEDGMENTS
ADVERT
END USER LICENSE AGREEMENT
List of Tables
Chapter 4
TABLE 4.1
TABLE 4.2
TABLE 4.3
Chapter 5
TABLE 5.1
TABLE 5.2
TABLE 5.3
TABLE 5.4
TABLE 5.5
Chapter 6
TABLE 6.1
TABLE 6.2
Chapter 7
TABLE 7.1
Chapter 8
TABLE 8.1
Chapter 9
TABLE 9.1
Chapter 10
TABLE 10.1
List of Illustrations
Chapter 1
FIGURE 1.1
Sony SmartWatch v1 hacked to be programmed using the Arduino IDE by Arduino Verkstad (image by Asier Arranz)
Chapter 2
FIGURE 2.1
Information and communication technologies (ICT) disruptive potential versus speed of uptake by field of application (source: Cisco)
FIGURE 2.2
Connected coffeemaker for the SandS EU research project (source: Arduino)
FIGURE 2.3
Mesh network architecture
Chapter 3
FIGURE 3.1
Round Android Wear emulator
FIGURE 3.2
Square Android Wear emulator
FIGURE 3.3
The Android Wear App screen
FIGURE 3.4
Successful connection between the Wear emulator and an Android device
FIGURE 3.5
Allow USB Debugging on Wear
FIGURE 3.6
Recipe Assistant
FIGURE 3.7
Steps 1 through 3 of preparing beef brisket chili
Chapter 4
FIGURE 4.1
Wear navigation
FIGURE 4.2
Basic text notification
FIGURE 4.3
Using the Wrox logotype for Wear notifications
FIGURE 4.4
Big text notification
FIGURE 4.5
Big text notification on mobile
FIGURE 4.6
Big text notification, collapsed
FIGURE 4.7
Big picture notification
FIGURE 4.8
Updating a notification
FIGURE 4.9
A simple multipage notification
FIGURE 4.10
Adding a standard action to Wear notifications
FIGURE 4.11
Standard actions on Wear notifications
FIGURE 4.12
Interactive Wear notification
FIGURE 4.13
Hidden icon for Wear notifications
FIGURE 4.14
A notification that sticks to the top of the screen
FIGURE 4.15
Default sorted stack of notifications
FIGURE 4.16
Custom-sorted stack of notifications
FIGURE 4.17
Handheld summary for stacked notifications
Chapter 5
FIGURE 5.1
New project startup
FIGURE 5.2
Entering project information
FIGURE 5.3
Select form factors and API levels for your app
FIGURE 5.4
Add a blank phone activity
FIGURE 5.5
Add a blank Wear activity
FIGURE 5.6
Edit the properties for your Wear activity and layouts
FIGURE 5.7
InsetActivity running on both screen types
FIGURE 5.8
The exit app button as shown on a round device
FIGURE 5.9
CardFrame
FIGURE 5.10
The basic CardFragment
FIGURE 5.11
The custom CardFragment
FIGURE 5.12
The basic CircledImageView
FIGURE 5.13
The progress bar at 60%
FIGURE 5.14
The list view with custom row layout
FIGURE 5.15
The 2D Picker
FIGURE 5.16
The success animation
FIGURE 5.17
The open-on-phone animation
FIGURE 5.18
The failure animation
Chapter 6
FIGURE 6.1
Enter project information
FIGURE 6.2
Select form factors and API levels for your app
FIGURE 6.3
Add a blank phone activity
FIGURE 6.4
Choose a name for the activity
FIGURE 6.5
Add a blank Wear activity
FIGURE 6.6
Edit the properties for your Wear activity and layouts
FIGURE 6.7
The default layout of the mobile app on the simulator
FIGURE 6.8
An app with an extra button on the simulator
FIGURE 6.9
App with the Wrox logo
FIGURE 6.10
Notification sent to the smartwatch simulator
FIGURE 6.11
Text field added to the UI
FIGURE 6.12
Wear notification inviting you to enter a voice reply
FIGURE 6.13
Reply button
FIGURE 6.14
Reply button
FIGURE 6.15
Wear device sending back data
FIGURE 6.16
Phone app showing the text
Chapter 7
FIGURE 7.1
Diagram of the data transmission example
FIGURE 7.2
The Data transmission app on a phone
FIGURE 7.3
The Data transmission app on a wearable
FIGURE 7.4
The Data transmission app on a phone
FIGURE 7.5
The watch after the screen changes color
Chapter 8
FIGURE 8.1
Displaying GPS coordinates on the device
Chapter 9
FIGURE 9.1
The Fit app
FIGURE 9.2
The select gender list
FIGURE 9.3
The finished select weight list
FIGURE 9.4
Select Height activity
FIGURE 9.5
The touch-to-close option
FIGURE 9.6
The finished WalkKeeper app
Chapter 10
FIGURE 10.1
The shake gesture as the computer sees it
FIGURE 10.2
The finished Wear app
FIGURE 10.3
The finished mobile app
Chapter 11
FIGURE 11.1
Augmented reality application (image courtesy of Amnon Owed)
FIGURE 11.2
Google Glass (image by Mickepanhu, Creative Commons Attribution-ShareAlike 3.0 Unported)
FIGURE 11.3
Oculus Rift (image courtesy of Sebastian Stabinger, CC BY 3.0)
FIGURE 11.4
Unfolded Cardboard (image courtesy of Runner1928 Creative Commons Attribution-ShareAlike 4.0 International)
FIGURE 11.5
My personal Cardboard
FIGURE 11.6
Lenses
FIGURE 11.7
Box design
FIGURE 11.8
The final version of my Cardboard
FIGURE 11.9
Treasure hunt app (the colors have been inverted for better visibility)
Guide
Cover
Table of Contents
Part
Pages
ixx
xx
xxi
xxii
xxiii
1
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
79
80
81
82
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
124
125
126
127
128
129
130
131
132
133
134
135
136
137
139
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
162
164
165
167
168
169
170
171
172
173
175
176
178
181
182
183
185
186
187
188
189
190
191
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216