Designing and Developing for Google Glass (2015)
A New (R)evolution in Computing
Google Glass has taken the popular imagination by storm like few other technologies have, potentially being the most transformative consumer device since the iPad…and it did so long before its commercial release. Scores of people have shown ardent interest in learning as much as they could about the mysterious machine and the ecosystem that encapsulates it, and many flocked to develop software for it in order to capitalize on its next-gen model of information delivery. Many producers of mobile services beat down the door to learn how to repurpose their existing data and codebases to establish presence for their applications in this new space.
And a significant number of people were hesitant to embrace Glass due to concerns with privacy, legality, health issues, and the personal image using it conveys.
This book effectively addresses all these issues by presenting a simple philosophy we’ve been heavily promoting to Glass enthusiasts: Think for Glass. While many forthcoming books will discuss coding conventions, design patterns, and development idioms, and will do so very well, our work presents a holistic view of Glass not only as hardware, but as a proper computing platform requiring the adoption of a new mindset for users to truly appreciate the product and with which architects can build maximum value.
Like many of you, we were captivated by our first glimpses of Google Glass in 2012. We immediately knew that Glass was going to be different, more than just a cell phone on our faces, and we wanted to help others understand how it would change our lives. In a series of Hangouts, at first, and later through presentations and helping in the various communities, we shaped our core philosophies of Glass. In this book, we hope to share those philosophies with you.
As two passionate members of the Google development community, each of us an experienced programmer, writer, and Glass enthusiast, we hope this book will serve as a primer to the device, an overview of the platform’s guiding principles, and a broad introduction to writing Glassware.
What We’re Bringing to the Table
What we need to state up front is that this isn’t just a “How to code for Google Glass” book—we wholeheartedly believe it’s much much more than that. Rather than merely copy and paste Google’s API documentation and run through the general environment for programming, testing, and distributing Glass applications, we seek to educate you with a philosophy centered on awareness of the Google Glass ecosystem—getting you to Think for Glass. By this merit, you’ll have a better understanding about the approach necessary to get the most out of this revolutionary new computing platform.
We’ll be looking at what Glass means for users, developers, and society as a whole.
This book is organized to be flexible to your interests while still presenting the material in a logical fashion to teach you all about Glass. We’ve essentially organized the material as a three-act play. While some of the more technical sections build upon concepts that preceded them in earlier chapters, the topics are largely arranged in such a way that they can be consumed completely out of order without losing focus, giving you the freedom to jump to the discussion that intrigues you most, or skip over stuff that doesn’t pique your interest. New Glass owners (or those of you contemplating taking the leap) will particularly enjoy the first few chapters, which deal with how to properly Discover the platform.
Maybe you just want to be one of the cool kids and talk to your peers with deep expertise about what Glass is and how they can use it. Living on the bleeding edge is totally awesome, and we’ve written Chapter 2 just for that reason.
If you’re a designer who wants to create for the hottest UI to hit the consumer tech industry in years, you’ll want to make sure you read the Design section. We’ll be talking about the Glass aesthetic and how to compose effective designs that maximize data in a minimal display, how the experience is fundamentally different than designing for other platforms, and what we mean when we say you should “Think for Glass.” Before you dive into code, you’ll want to consider Chapters 4 through 6 to make sure that what you want to do works well with the people who use Glass.
If you’re a programmer who’s heard the buzz about wearable computing, you’ll then want to continue to the third part of the book, Develop. In this section, it may behoove you to read Chapters 7 through 15 in order, as several of the concepts we’re presenting have a certain sequence. We begin that ambitious quest in Chapter 7, where we drill down into program structure, syntax, and the architecture that governs how RESTful Glassware works with the Google Mirror API. We also help those of you maintaining existing software platforms if you’re keen on integrating with Glass to get a leg up on the other guys. If you’re an Android developer, and you’re interested in exploring the similarities and differences when programming for Glass with Android framework code, head on over to Chapter 13 where we talk about the Glass Development Kit.
Or if you’ve been itching to create a slick mashup with some third-party web APIs and want to corner a very emerging space, we’ve got you covered, too—check out the latter chapters for insight.
And simply starting from page 1 and running through the entire book will give you a well-rounded Glass education in order to understand the Glass ecosystem and build effective Glassware. Being able to Think for Glass means that you have to understand the system in total. You’ll truly grasp what the system is all about and how to best make it work for you once you’re done reading.
And at the end of the book, we’ve included a helpful appendix that focuses on hacking Glass. We also feature “Glassware Done Right,” a series of case studies that highlight noteworthy third-party services and applications that are top-shelf examples of programs written specifically for the Glass experience that really get the job done. Some are simple, some are complex, but they’re all outstanding and all really fun to use, with each illustrating a positive lesson to follow about how to implement a specific software idea or challenge with this new model.
What we want to avoid at all costs is presenting you with content that just lets you rip code and not really comprehend what the Glass experience truly is. We don’t want to give rise to a generation of sloppily crafted apps that wind up being force-fit versions of existing services that don’t fully utilize the best aspects of the platform the way they were intended. Glass succeeds beautifully on both sides of the product development coin—form and function—so having mastery of this new toolset is critical.
As you’ll see, Glass isn’t purely another client-server web system or just the latest fork of Android. The input system, UI/UX, networking capabilities, and application framework—it’s an entirely different animal than what you’ve been used to. Everything about the ecosystem is a radical departure from traditional methods of distributed computing. A new paradigm requires a new mindset—and that’s precisely what we’re giving you. Even experienced developers should appreciate the effective simplicity of Glass’s mechanics for data delivery. This personal area network of sensors and displays provide the wearer with the information they want in exactly a form that’s extremely convenient, contextually relevant, and highly effective for them as they go about their day with their digital lifestyle, as well as doing things in the real world.
We feel that empowering you with the ability to explain, explore, and exploit Glass, confidently and competently, is invaluable because then you can teach others, too! Pay it forward, baby. Spread the gospel. Share the love.
Maybe you can charge people for your expertise as a Glass consultant and recoup your investment for buying this book. Viva capitalism!
How This Book is Organized
Chapter 1, The Revolution Will Be Wearable
We explore the fundamental question, “Why Glass?” What is Google trying to solve by creating the product, and why do they think people will want to buy it? What underlying technologies are going into it? What is new or different about Glass, and what is the same as what we have seen before? Why is this book a good way to learn all these things? Most importantly, we set the groundwork for the three major sections of the book that follow and start to guide the different types of readers into which parts might be most interesting.
Chapter 2, The Glass Ecosystem: What It Is and How It Is Different
This chapter is the core of educating people to what Glass currently is and the foundation for exploring how Glass apps should be designed. We go over the specifications of Glass. We highlight why the hardware represents a balance between user needs, aesthetics, and design constraints. In particular, we will focus on how this is a product unto itself—not a peripheral or accessory to something else. In conjunction with the hardware, we start to delve into how people use Glass, the timeline, and the software driving it.
Chapter 3, Societal Issues with Glass and How to Avoid Them in Your Projects
It is important, in both educating people about how to use Glass and what to expect from Glass applications, to make sure we are clear about what Glass isn’t and what it can’t do…yet. Although we will go into detail about this as part of designing and developing apps, it is important to take some time out and discuss false impressions that have already built up. In particular, we will discuss some of the controversial issues surrounding Glass—privacy, control, intrusiveness, aesthetics, and whether this is true augmented reality.
Chapter 4, Thinking for Glass: How Glass Is, and Should Be, Personal
We dive into the meat of the aesthetic philosophy for Glass. Much like the change in thinking that took place when people moved from text to graphic programs, then later to web design, and still later when moving from web to mobile apps, writing for Glass requires a totally new way of thinking. Glass is, in some ways, more personal and intimate than a smartphone, and people will be interacting with Glass very differently. Where existing examples do not exist, we will hypothesize other illustrative apps, showing how they can (or in some cases can’t) have counterparts in Glass and how they needed to be rethought.
Chapter 5, The Five Noble Truths of Great Glassware Design
We solidify the design for Glass with The Five Noble Truths, based on the initial guidelines presented by Google, and how they were ultimately expanded. Each of these guidelines will be complete with good and bad design examples that follow the guidelines.
Chapter 6, Glassware Antipatterns: Avoiding Poor Design
The natural inclination of people will be to think about developing for Glass as either being “just like” developing for other mobile platforms, or expect it to be tied to a mobile device. We’ll discuss why these perceptions may cause problems. We’ll also reiterate some of the design constraints in the system and how it constrains some of the applications that are available.
Chapter 7, Overview of the Mirror API
We present the prerequisites for developing for Glass using the RESTful Google Mirror API. We will also discuss how the Mirror API is language-agnostic but requires an understanding of how to build and host web apps. We’ll touch on Google App Engine as a container while emphasizing other available options. Finally, we’ll discuss the infrastructure for how Glass will communicate with your app and how we will present each of the concepts.
We talk about concepts, with a couple of language-specific code examples in some cases, and make sure people understand how those concepts will map to the Google-provided documentation and the language-specific APIs. Think of this entire section as providing a way to help you translate between Google’s documentation and your language experience.
Chapter 8, Security and OAuth
We talk about how to authenticate users with OAuth 2.0 and authorize services to communicate with Glass on their behalf.
Chapter 9, Working with Timeline Cards
The fundamental UI aspect of Glass is the timeline card, which we’ll have seen illustrated in earlier chapters. We’ll now learn more details about these cards, how they are bundled together, how Google helps you manage them, and how you can format them. Some of the tools that Google provides to help design them will also be reviewed, along with the various parameters and procedures involved in creating, editing, and deleting them.
Chapter 10, Card Actions and Subscriptions
It wouldn’t be a very interesting program if it couldn’t handle input from users. We’ll discuss how cards can have actions attached to them and how your program needs to define what actions are available, accept these actions, and verify that they are authentic responses to your cards.
Chapter 11, Sharing Resources with Glassware
Beyond attaching actions to your own cards, you can also allow photos, videos, and other resources captured through Glass to be shared with your application. We’ll discuss how you need to handle this data and what Google does to help you with it.
Chapter 12, Context Is King: Using Location and Other Signals
The curious topic of the use of geodata within the Glass ecosystem will be detailed here, alongside other forms of input for contextual computing, like identity, time, and activities. Particular attention will be given to the way Glass handles location data updates via the Mirror API.
Chapter 13, The GDK
We provide an overview of the SDK libraries that constitute the Glass Development Kit that makes writing Android framework code possible, giving Android programmers the ability to create installed applications for Glass.
Chapter 14, Getting on MyGlass: Glassware Submission, Review, and Distribution
Getting seen on MyGlass should be the destination you aim for after building an amazing product, as it yields the greatest rewards. You’ll learn how to prepare for Google’s review of your projects, how to be approved quickly, and then how to distribute and promote your Glassware to the masses.
Chapter 15, Reflections on the Future
This discussion addresses some more advanced topics and issues relative to the progression of the platform, how Glass might be used from an organizational standpoint, and how the Glass ecosystem can be extended.
Conventions Used in This Book
The following typographical conventions are used in this book:
Indicates new terms, URLs, email addresses, filenames, and file extensions.
Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords.
Constant width bold
Shows commands or other text that should be typed literally by the user.
Constant width italic
Shows text that should be replaced with user-supplied values or by values determined by context.
This element signifies a tip or suggestion.
This element signifies a general note.
This element indicates a warning or caution.