Now that Google Glass is quickly becoming a mainstream product, have you wondered how you can develop for Glass? Well, you don’t have to wonder anymore because Google has made available the Google Mirror API to help developers build web-based services that interact with Google Glass.
The developer guide gives a detailed explanation of how to develop timeline items, menu items, create subscriptions, enable location data, access to contacts and enable authorization. However, despite the ease of development for Glass, Google has also published developer guidelines to ensure that developers create applications that offer the desired user experience.
Timeline items or cards, display content on Glass and can either be swiped forwards or backwards to reveal more cards in the past or future. The guideline shows how to insert, attach update, read, and delete timeline cards.
In order to make your services interesting, you need to allow users to interact with timeline cards. This can be done through menu items where users can tell glass to read a card aloud, navigate to a location, share the card contents, or reply to a message. Menu items can populated from a list of built-in items or custom created.
When a user takes specific timeline actions or changes location, you can subscribe to such notifications. There are different notification types for different events. Some of these notification payloads include Shared timeline item, a reply, a delete notification, a custom menu item selected, or a location update.
User’s location be requested using the Google Mirror API including their last known location and periodic location updates. The API can also render maps and overlay makers and lines to signify important places and paths.
The Glass API can allow users to share your timeline items with other contacts by allow them to tap a share menu item which displays a list of possible contacts to share with. It can also allow users to share timeline items with Glassware where you create a contact that represents Glassware and allow users to share with this contact. This can be declared to limit sharing for only specific cards.
All requests to the Google Mirror API must be authorized using OAuth 2.0 credentials. When users load applications for the first time, they are presented with a dialog to grant permission to access their Google Glass account. This one-time authorization is all that is needed even when your app is being used offline.
Google has made available developer tools to help you get started with Glass Apps. The Google Mirror API Playground lets you experiment with content display while the Subscription Proxy can be used to subscribe to notifications in a production environment.