Professional Android Wearables
Buy Rights Online Buy Rights

Rights Contact Login For More Details

More About This Title Professional Android Wearables

English

The fast and easy way to get up and running on Android wearables

Written by an expert author team with years of hands-on experience in designing and building wearables, Professional Android Wearables covers how to use the Android Wear platform and other techniques to build real-world apps for a variety of wearables including smartbands, smartwatches, and smart glasses. In no time, you'll grasp how wearables can connect us to the Internet in more pervasive ways than with PCs, tablets, or mobile devices; how to build code using Google's Wear SDK for Android-enabled hardware devices; how Android Wear and other Android development techniques are capable of building several presented example projects; and much more.

Wearables are the next generation of smart mobile devices, it's no wonder you will want to master Android Wear SDK to build smart wearable apps for a multitude of form factors and applications.

Shows you how to navigate Android Wear SDKClearly explains how to use the Android Wear platform to build real-world appsThe companion website includes source code for all of the projects described in the book

If you're an experienced Android developer looking to master Android Wear SDK to build wearable apps, you've come to the right place.

English

David Cuartielles Ruiz is cofounder of the Arduino platform and creator of the Prototyping Laboratory at Malmö University in Sweden, where he also teaches. He has written libraries that enable Arduino to communicate with Android phones over Bluetooth.

Andreas Göransson has been researching and developing wearable projects for over 5 years. His work has included research on connecting to and controlling full-body haptic and audio-augmented suits from Android phones.

English

INTRODUCTION xix

PART I: CONCEPTS

CHAPTER 1: INTRODUCTION TO ANDROID WEARABLES 3

The Wearable Revolution 3

Dismantling the Computer: The Cyborg Dream 4

Software Everywhere 5

Fashion is More than Ski Jackets 6

Fitness 6

Time 7

Glasses 8

Summary 9

Recommended Reading 10

CHAPTER 2: THE INTERNET OF THINGS 11

How Wearables Relate to IoT 11

The Promise of Connectivity 12

Cisco’s Vision 13

Big Data 13

Connected Devices in the Home 14

Connected Devices on the Go 15

Wireless Sensor Networks 16

A Scenario of Use of WSN 16

Bluetooth Versus ZigBee 17

Smart Cities 17

Summary 18

Recommended Reading 18

CHAPTER 3: PLATFORMS AND TECHNOLOGY 19

Android Wear 19

Installing the Wear SDK 20

Working with the Android Wear Emulator 20

Working with a Real Wear?]Enabled Device 22

Kick?]starting Your Wear Development 24

Distributing Wear Apps on Google Play 25

Summary 26

PART II: BASIC BUILDING BLOCKS

CHAPTER 4: NOTIFICATIONS ON SMALL SCREENS 29

About Notifications 29

Pre?]Wear Notification API 30

Wear Notifications 30

Building Notifications 32

The Simple Notification 33

Adding a Large Icon 34

Big Text Notification 35

Big Picture Notification 36

Updating a Notification 38

Adding Pages to Your Notifications 38

Adding Actions to Your Notifications 39

Adding a Standard Action 39

Adding Multiple Actions 41

Adding Wear?]Only Actions 41

Adding an Action without the Extra Page 42

Extra Options 43

Hiding the Application Icon 43

Moving the Notification 44

Setting the Scroll to the Bottom 44

Removing a Notification 45

Stacking Notifications 45

Summary 48

Recommended Reading 48

CHAPTER 5: DEVELOPING WEAR APPS 49

The Wear SDK 49

Design Considerations 49

Wearable UI Library 50

Creating the Wear Project 51

Editing the Gradle Files 55

Loading Layouts 56

Using WatchViewStub 56

Using InsetActivity 58

Building the User Interface 61

Adding Text to Your User Interface 61

CardFrame 61

CardScrollView 62

CardFragment 63

Displaying Images 66

Loading a Static Image 67

Adding a Progress Update 68

Handling Lists in Wear 69

Using WearableListView 69

The 2D Picker 72

Providing Positive Feedback 74

Starting the Success Feedback 75

Starting the Open?]on?]Phone Animation 76

Starting the Failure Feedback 76

Summary 77

Recommended Reading 77

CHAPTER 6: VOICE INPUT 79

Talking to Your Wrist 79

Types of Voice Interaction 80

Using System?]Provided Voice Commands 82

Just Launch an App 84

Hack an Existing Intent to Launch Your App 85

Launch Your App with Voice the “Right” Way 85

The Wear APIs 85

Data API 86

Message API 86

Node API 86

Answering to Notifications: Capturing Your Voice into an App 86

Creating a Simple App Sending a Notification 87

Creating Your Empty Project 87

Modifying the Gradle File 90

Modifying the App’s Layout 91

Adding the Right Callback Function 93

Getting Your App to Receive a Voice Command 95

Revising the Callback Function 95

Adding a Broadcast Receiver 97

Modifying the App’s Layout to Include a Text Field 98

Adding the New Class to the Manifest File 99

Adding the Reply String to the Strings File 100

How It Works 100

Showing the Answer on the App’s Screen 101

Summary 103

Recommended Reading 104

CHAPTER 7: PUSHING DATA 105

Checking the Example 106

Phone’s MyActivityPhone.java 107

Phone’s AndroidManifest.xml 111

Wearable’s MyActivityWear.java 112

Wearable’s AndroidManifest.xml 114

Wearable’s Listener 115

Making Your Google API Client from Scratch 116

Start with a Clean Project 117

The Phone’s MyActivityPhone.java 117

The Phone’s AndroidManifest.xml 119

The Phone’s DataLayerListenerService 120

MyActivityWear.java 121

Wear’s Android Manifest File 124

The Listener on the Wearable’s Side 124

The Final Result 125

Summary 126

Recommended Reading 126

CHAPTER 8: LOCATION-BASED SERVICES ON ANDROID WEAR 127

Changing How Location Works 127

Accessing the Current Location 128

Enabling GPS support 128

Using the New APIs 128

Determining GPS Availability 131

Requesting the Last Known Location 131

Requesting Location Updates 132

Being Picky About Location Updates 134

Showing Your Street Address 135

Testing Geocoder Availability 135

Getting the Current Address for a Location 135

Summary 137

Recommended Reading 137

PART III: PROJECTS

CHAPTER 9: ANDROID WEAR AS ACTIVITY TRACKER 141

What Are Activity Trackers? 141

Wear as an Activity Tracker 142

Step Detector 142

Step Counter 143

Building the WalkKeeper App 143

Calculating Calories 143

Creating the Project 145

Selecting Gender 145

Selecting Weight 150

Selecting Height 152

The WalkKeeper Activity 154

Building the User Interface 154

Connecting the User Interface 155

Getting the Stored Settings 157

Reading the Sensor Data 158

Calculating and Updating the User Interface 160

Keeping the Activity Open 162

Improvements 165

Summary 165

CHAPTER 10: SMARTWATCH AS INPUT 167

Android Wear as a Game Controller 167

A Note on Sensors 168

Detecting Gestures 169

Building the Dice Game 169

Creating the Project 169

Designing a User Interface 169

Android Wear GUI 170

Mobile GUI 171

Accessing Sensors 173

Generating the Die Value 175

Connecting to Mobile 176

The Mobile Connection 176

The Wear Connection 178

Keeping the Screen On 182

The Dice Game 182

Improvements 182

Summary 183

Recommended Reading 183

CHAPTER 11: BUILD YOUR OWN GLASS 185

Augmented Reality and Virtual Reality 186

Augmented Reality 186

Google Glass 187

Virtual Reality 188

VR on a Phone 189

Building Your Own Glasses 190

Lenses 190

The Simplest Box Possible 191

The Simplest App 193

The cardboard.jar Library 193

Looking at the Code 194

The Glasses’ MyActivityPhone.java 194

The Glasses’ AndroidManifest.xml 196

A Couple More Classes 197

Getting Your Cardboard to Talk to Your Smartwatch 200

Start from the Previous Project 200

The Phone’s MyActivityPhone.java 200

The Phone’s AndroidManifest.xml 202

The Phone’s DataLayerListenerService 203

MyActivityWear.java 204

The Wear Android Manifest File 207

The Final Result 207

Summary 207

INDEX 209

loading