Wrox Home  
Search

Topic: Mobile

Professional Android Wearables (1118986857) cover image

Professional Android Wearables

David Cuartielles Ruiz, Andreas Goransson
ISBN: 978-1-118-98685-1
Paperback
240 pages
February 2015
This title is out-of-print and not currently available for purchase from this site.


About This Title  |  Download Code  |  Errata  |  P2P Forum for This Title
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

Printer-Ready Version   Share This
With you wherever you go: pdf + ePub + kindle -- DRM-free