BT

Google Releases Mirror API for Glass

by Abel Avram on Apr 16, 2013 |

Google has released the Mirror API for writing Glassware applications and the final specification for Glass devices.

Google Glass uses the timeline concept consisting of a series of cards containing text, images, video or rich HTML. The user swipes his finger on the glass’ frame to navigate through cards. Cards are generated by the user, by taking a picture for example, or are received from a service the user has subscribed to. Cards can be grouped in a bundle, the user having the option to navigate through the entire set of cards or seeing just the cover of the bundle. Certain commands can be associated with cards: built-in ones such as Reply or Read Aloud, or custom ones created by a card developer.

From a developer’s perspective, working with Glass devices means writing a Glassware application using the Google Mirror API. This is a RESTful API using JSON for transferring data between devices and back end services. OAuth 2.0 is used for user authentication. Google intermediates all communication between these services and Glass devices.

Google is providing Java and Python starter projects along with a number of libraries for Go, PHP, .NET, Ruby and Dart programming.  The Java starter project can be demoed at https://glass-java-starter-demo.appspot.com/. Following is an example of inserting a card into the timelines using HTTP, Java and Python:

POST /mirror/v1/timeline HTTP/1.1
Host: www.googleapis.com
Authorization: Bearer {auth token}
Content-Type: application/json
Content-Length: 26

{ "text": "Hello world" }
TimelineItem timelineItem = new TimelineItem();
timelineItem.setText("Hello world");
service.timeline().insert(timelineItem).execute();
timeline_item = {'text': 'Hello world'}
service.timeline().insert(body=timeline_item).execute()

On success, the server is supposed to return a 201 message with complete information regarding the item created:

HTTP/1.1 201 Created
Date: Tue, 25 Sep 2012 23:30:11 GMT
Content-Type: application/json
Content-Length: 303

{
"kind": "glass#timelineItem",
"id": "1234567890",
"selfLink": "https://www.googleapis.com/mirror/v1/timeline/1234567890",
"created": "2012-09-25T23:28:43.192Z",
"updated": "2012-09-25T23:28:43.192Z",
"etag": "\"G5BI0RWvj-0jWdBrdWrPZV7xPKw/t25selcGS3uDEVT6FB09hAG-QQ\"",
"text": "Hello world"
}

Other timeline-related operations are: reading cards in the timeline, bundling cards and accessing card attachments, the later containing binary information such as pictures.

Glassware applications can include subscriptions, the user being notified when accessing the timeline or when his location changes, location related operations such as rendering maps on cards, or managing contacts. All API calls are OAuth protected. The user can also interact with Google Now requesting information, dictating emails, setting appointments, etc. by issuing voice commands.

As the first Glass devices are coming out of the production line, Google has published MyGlass, a companion Android application for managing a Glass device, and the final specifications:

  • Display: 640 x 360p, the “equivalent of a 25 inch high definition screen from eight feet away”
  • Camera: Photo – 5MP, Video – 720p
  • Audio: bone conduction transducer
  • Connectivity: WiFi and Bluetooth
  • Storage: 16GB total, 12GB usable, synced with Google cloud
  • Battery: lasts one day for typical usage

Glass devices connect to the Internet though WiFi or via a Bluetooth-capable phone.

Hello stranger!

You need to Register an InfoQ account or to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2013 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT