Creating a Google Glass App With C# and Xamarin

Learn to develop apps for Google Glass with C# and Xamarin by building a full-featured Scavenger Hunt game using the Xamarin Glass Development Kit component.
Course info
Rating
(16)
Level
Intermediate
Updated
Jul 28, 2014
Duration
3h 8m
Table of contents
Getting Started
Creating Scavenger Hunt for Glass
Adding Interactivity to Glass
Managing Photo Capture on Glass
Creating a CardScrollAdapter
Creating Scrolling Cards Within Your Glass App
Bringing the Scavenger Hunt for Glass Game Features Together
Description
Course info
Rating
(16)
Level
Intermediate
Updated
Jul 28, 2014
Duration
3h 8m
Description

In this course, you will learn to create apps that run directly on Google Glass by creating a full-featured Scavenger Hunt game using C#, Xamarin, and the Xamarin Glass Development Kit component. This course takes you through the complete process of building a Scavenger Hunt game that runs entirely on Google Glass. In the process of creating this game, you will learn how to use C# and Xamarin to develop apps for Google Glass that interact with the Glass Timeline and incorporate the distinct behaviors of a wearable computing device like Google Glass. This includes using voice commands to launch your app, capturing photos, and incorporating touch-based-gestures to navigate the app. In this game, the player is able to walk around wearing Google Glass and use the built-in camera to capture photos corresponding to a randomly generated list of Scavenger Hunt categories. As each photo is captured, the player uses touch-based-gesture navigation to associate the photo with the appropriate category. The game uses a Google Glass LiveCard to display the player's ongoing game status on the Glass Timeline with gameplay continuing until the player has captured a photo for every category.

About the author
About the author

Jim Wilson is president of JW Hedgehog, Inc., a consulting firm specializing in solutions for the Android, iOS, and Microsoft platforms. Jim has over 30 years of software engineering experience, with the past 15 years heavily focused on creating mobile device and location-based solutions.

More from the author
More courses by Jim Wilson
Section Introduction Transcripts
Section Introduction Transcripts

Creating Scavenger Hunt for Glass
Welcome to this module on Creating Scavenger Hunt for Glass. My name is Jim Wilson. In this module we're going to talk about how to build our Glass project from scratch. We're going to start building our Scavenger Hunt application entirely from scratch. So, the things we need to talk about are: First, how do we create a new project for Glass, and again we're going to use Xamarin Studio to do that. Now, the project that we build there's no one specific project type provided that's for Glass, so what we have to do is use one of the standard Android project types, and then we'll configure the project settings so that it builds appropriately to work with the Glass environment. Now, the Glass APIs are not part of the standard Android environment, so we need access to the Glass Development Kit. The way we do that in Xamarin is that we add the Glass Development Kit component, and it's a component that brings in that Glass environment and provides. NET classes to give us access to that environment. Once we have everything set up, we're then going to create our LiveCard management service. As we talked about in the last module, we use a service generally as kind of the core piece of our Glass applications. So, we build that service, and then we'll take our LiveCard and display it into the Glass timeline because as we talked about kind of the starting point for most Glass projects are in the actual Glass timelines. We build our LiveCard and display it into the timeline. And the last thing we're going to talk about in this module is how do we connect up to the 'OK Glass' menu. So, how do we make our application accessible from that top-level menu in the Glass environment?

Adding Interactivity to Glass
Welcome to this module on Adding Interactivity to Glass. My name is Jim Wilson. So, throughout this module we'll be adding interactivity to our application primarily by adding a menu to the LiveCard or at least what appears to be to the LiveCard. The key part of doing that is going to require that we create a transparent activity that overlays our LiveCard and handles all the work of actually displaying and interacting with the menu. So, throughout this module we'll go through that in steps. So, the first thing we'll look at is how do we actually create this activity that's responsible for displaying the menu over the LiveCard, but creating the illusion that it's actually part of the LiveCard? We'll then dig into how we actually manage the menu state throughout that activity. There are a number of things that have to happen in terms of automatically opening the menu when the activity is shown, automatically shutting down the activity when the menu closes, so we'll deal with all those issues. We'll then get into adding the actual menu handling. We'll see that this is very familiar if you've actually worked in Android at all before. We'll just do some standard menu handling work there. We'll then start to add some of the gaming behavior to our application, so we'll bring in some classes that manage our gaming state, and we'll call it the game manager, and we'll get that all hooked in to our application and tied into some of the menu options. And then the last thing we have to do is if we're going to present this illusion that the menu is tied to the LiveCard what we actually need to do is take the menu activity and associate that with the LiveCard, so we'll see how to do that.

Managing Photo Capture on Glass
Welcome to this module on Managing Photo Capture on Glass. My name is Jim Wilson. So, throughout this module we're going to see how we add the ability to basically capture photos in our application, so how we actually initiate that process, how do we actually harvest the results. Alright, so we're going to break this into kind of three parts. The first thing we'll look at is how do we actually take the picture? How do we initiate that process of presenting an image to the user for them to accept or reject? Once the user accepts the picture, how do we find out what they've selected? How do we find out the filename associated with the image that they selected? And as we'll see we can get a full resolution image or just a thumbnail of that image. And one of the things we have to think about is that there are some special considerations in terms of activity lifetime. There's a close association between the lifetime of our menu activity that starts the photo process and then getting those results back, so some special handling we have to add to our menu activity so we can actually harvest the results of the photo that the user captures within our application.

Creating a CardScrollAdapter
Welcome to this module on Creating a CardScrollAdapter. My name is Jim Wilson. In order to create a card scrolling effect within our application, in other words not in the timeline, but in our application itself, we have to construct in something called a CardScrollAdapter that feeds data into the viewing system for this scrolling experience for the user. So, in order to do that there are a few steps we have to follow. The first thing we have to do is actually create our own CardScrollAdapter, so we're going to create our own class that inherits from the base class CardScrollAdapter and to provide our functionality inside of there. Now, one of kind of housekeeping jobs that a scroll adaptor is responsible for is to manage the underlying content. In our case, that's going to be the categories that the user is interacting with, so that's things like how many items there are, positioning information, that sort of thing. But now the key thing that goes on in a CardScrollAdapter though is constructing the individual card view. So, we actually have to inflate a layout, and then we'll push our data inside of that and then pass that into the system to be displayed to the user.

Bringing the Scavenger Hunt for Glass Game Features Together
Welcome to this module on Bringing the Scavenger Hunt for Glass Game Features Together. My name is Jim Wilson. So, here we are at the last part of our course in terms of building our application, and what we really want to do is just kind of add these final features to our game so it provides a really kind of intuitive and clean experience to the user. So, one of the things we're going to do is implement the ability to view categories, and the thing we're really looking at there is just provide the user with the ability to kind of evaluate the state of the game to see what's going on inside of there. Now, one of the key things we'll do is that we're going to actually update our service so that the LiveCard display values can be updated throughout the life of our application. So, as the state of the game begins to change, the users can constantly within a timecard see the things that are changing that go along with the app. Now, as part of updating the service itself to support modifying the LiveCard throughout the application, we also want to provide the ability for other parts of the application to let the service know that we need to have the LiveCard updated, so we'll add those features in. And the last thing we'll do is kind of finalize the game state, so things like how do the applications start up in a place that's very intuitive for the user as they begin things, getting menus out of the way that the user is not going to use at certain points in the game, so make the game kind of transition its state correctly, and also it just makes things easy and natural for the user.