Programming Google Glass The Mirror API

Programming Google Glass The Mirror API

Download

Preface

Google Glass is the new wearable computer that everyone is talking about. Not only does Glass offer a head-mounted optical display and touch interface, but it’s also programmable in two ways: by creating native applications using the Glass Development Kit (GDK), and by programming Glassware (Glass applications) using the HTTP-based Mirror API. This book is about the latter. You’ll get a glimpse of what Glass is and what it is not, and how users can interface with Glass. Then you’ll learn how to develop a Glass application fast, by using the Mirror API to manipulate timeline cards and menus, track a Glass’s geolocation, create rich interactions by responding to user inputs, and capture or serve user images and videos. You’ll see how to properly design new Glassware or update existing applications to become Glassware. This is the book to read if you want a shortcut to this brave new world.

What’s the Big Deal with Glass? 
The first future-facing movie that I can recall containing consumer HUD (heads-up display) goggles was Back to the Future 2. This HUD was worn in the future year 2015 (I know, right?), not by a military commander or an airship pilot, but by young Marty McFly, Jr., as he sat with his family around the kitchen table. This was a consumer device capable of, at least, displaying text and accepting phone calls. Google Glass has beaten that mark by a year. Although Glass is sometimes wrongly considered to be an augmented-reality device, it’s better thought of as an ever-present optical interface for a mobile device. It’s a self-contained computer, yes, but it is also reliant on an external paired smartphone for some actions, such as geolocation or continuous Internet access. Internet access is a necessary component for using Glassware with the Mirror API, in the same way that Twitter is usable only if you have online access. This is a powerful requirement, since it means your Glassware can connect users and allow them to share assets. You can store and retrieve each of your
Glass user’s information in the cloud, and easily connect the same data through Glass, smartphones, and the Web.

Is This Book for You? 
This book is designed to help experienced developers quickly start writing Google Glass applications with the Mirror API. Although this book covers using the interface with Google’s Java Mirror Client code, the Mirror API itself is an HTTP interface with support for many languages. This means that many of the lessons about the Mirror API itself can apply to languages beyond the simple Java client. The pertinent code is covered in the book, and the rest can be downloaded along with the book (or from GitHub.1 ) You needn’t be a Java expert to use this book, but it can help to know your way around the syntax and Eclipse editor. You may also get more out of this book if you’re familiar with Google App Engine, although you can use any Platform as a Service (PaaS) or host your own Glassware applications.

What’s in This Book? 
This book is about programming Google Glass by using the Mirror API, but there’s more information to know beyond the technicals of one API. We start with an overview of the Glass environment in Chapter 1, Wrapping Your Head Around Glass, on page 1. From there we set up our development and deployment environments in Chapter 2, The Google App Engine PaaS, on page 11, and follow the OAuth 2.0 steps for Chapter 3, Authorizing Your Glassware, on page 23. The middle of the book digs into the actual Mirror API, starting with Chapter 4, Building the Timeline, on page 37, then moving on to Chapter 5, Tracking Movement and User Responses, on page 55 and Chapter 6, Making Glass Social, on page 71. We wrap up the book with an eye on design in Chapter 7, Designing for Glass, on page 83, and a look at basing Glassware on a web app in Chapter 8, Turning a Web App to Glass, on page 95. This book is intended to be read linearly, from the first to last chapter. It does cover most of the Mirror API, but it’s not designed to be a reference book. However, there is a reference in Appendix 1, HTTP and HTML Resources, on page 107.
Share This