Glass Dev: What is Mirror API?
Google Mirror API allows you to build Glassware, which are web-based services delivered to Google Glass through the cloud. Glassware are similar to apps, but they run in the cloud and not in Google Glass itself. Mirror API is a very simple method of sending information to Glass and it can manage timeline cards, menu items, timeline locations, contact sharing and user location.
The Mirror API is a very simple way of doing it and it works through POST, which is compatible with most programming languages, meaning that every developer is able to write Glassware.
You can do a lot of stuff through Mirror API, but nothing very advanced, because it’s just an API and not a way of developing Glass apps. I’ll summarize further what can be done through the Mirror API, along with some examples and the videos created by the Google Glass team. If you want to learn how to use it, we are going to release some tutorials very soon.
Timeline cards
Timeline cards are what the user sees and can be perceived as homescreens on a smartphone. But these are more simple, as Glass’ display is really small and only has a resolution of 640×360. Timeline cards can contain HTML, text, images and even video. But not all HTML elements are allowed and you can read here what’s allowed and what’s removed.
Through the Mirror API you can create, update or delete timeline cards. More actions might be possible with future updates.
Timeline notifications
The Mirror API can send notifications based on the user’s actions or location. In order to receive the notification, the user must subscribe to it and an URL will receive a notification indicating the user’s action or location. Then the developer can append an action to that notification.
Some examples of user events that you can subscribe to are the user’s location, which can be checked at a specified interval, a menu selection or when the user shares something with a contact.
Menu items
By using the Mirror API you can interact with the existing menu items or create your own. It’s pretty straightforward to interact with or create new menu items and we will be writing about this more in-depth in the upcoming days.
Some examples of existing menu items you can interact to are read aloud, reply by voice, or navigate to.
Contact sharing
Contacts can be either users or another Glassware. A user can share cards with any contact representing text, photos or videos. You can specify through Glass what MIME types the contacts can handle, so users can only share those.
User location
You can receive the user’s location if he allows you to. Then the location can be used to interact with the timeline or it can trigger notifications, by subscribing to it.