3

Since you can´t do all the nice looking stuff with the GDK at this point (html, images and so on) on cards. I was wondering if there is a possibility to ask a Mirror API from within my application (created with GDK) to send me some data?

Example:

I see the flow like this:

  • The GDK app is started with "ok glass, search app"
  • You talk what you want to search for.
  • The app takes the word and asks the Mirror API for a result.
  • The Mirror API sends the result to the glass timeline.

Regards Joakim

Jokez80
  • 131
  • 7

3 Answers3

1

Absolutely. If it makes sense for your app to either communicate with an external service that sends data back via the Mirror API, or calls the Mirror API itself, then you can certainly do so. (Although you begin getting dangerously close to just doing it all in Mirror at that point.)

The biggest challenge you'll face is having your app go through the OAuth dance to get an auth token to use.

Prisoner
  • 49,922
  • 7
  • 53
  • 105
  • Is there any example of this? – Jokez80 Mar 04 '14 at 11:54
  • I'm not aware of any examples specific to this case, but there are a number of examples using Java with the Mirror API available from https://developers.google.com/glass/develop/mirror/index – Prisoner Mar 04 '14 at 12:55
  • All the examples I have seen there is just pushing data from the Mirror API to the glasses. Not any examples of the GDK asking for data. Or have I missed something? – Jokez80 Mar 04 '14 at 15:16
  • Ok, now I have no idea what you're trying to actually do. Perhaps you can update your question to clarify, with some detail, how you see the flow working. – Prisoner Mar 04 '14 at 16:21
  • Prisoner: I added how I see the flow. Maybe this is not possible. Just trying to figure out how to be able to get dynamic layouts like the Mirror API are possible to do in my Immersion flow of the app. – Jokez80 Mar 04 '14 at 17:19
1

It sounds like the core of your issues is that you want a richer way to display content in the static part of the timeline to the right of the clock. You have a couple of options.

GDK

If you'd like to stay pure GDK, you can create your own view, and flatten it into a bitmap. The steps to complete this are the same as for other Android devices.

Mirror API

You could also use the Mirror API to insert HTML static cards using timeline's insert method, but to do this you will need to communicate some authentication information to your GDK Glassware. For example, if you want to insert into the Mirror API directly from Glass, you would need a way to provide an access and refresh token to your GDK Glassware.

There is no graceful way to do this with the released APIs, but I've seen some people accomplish this using the OAuth 2.0 flow for devices or scannable QR codes.

If you go down this route, be prepared to update your implementation. Google has announced improved support for sending authentication information to GDK Glassware. Once it's available you will want to switch over to it.

Community
  • 1
  • 1
mimming
  • 13,974
  • 3
  • 45
  • 74
  • Has the PHP Mirror API client libraries changed? Because in [attachment-proxy.php](https://github.com/googleglass/mirror-quickstart-php/blob/master/attachment-proxy.php), I'm getting no image returned. Is this a problem with the code? Or is the library simply out of date? – hichris123 Mar 27 '14 at 22:22
-1

Mirror API allow you to communicate back to it from Glass through the contact that you can create using Mirror API.

How it works -

  • you create a contact,
  • then when you need to do wit GDK on step 2 of your flow is share a
    note with your contact
  • the words get transcribed and delivered to you Mirror notification listener.
  • the mirror notification listener on server get the text of what kind of app you would like to search, perform the search and deliver the result by simply publishing on your timeline.

That's the best that i can see right now. Here is a link how to declare voice menu commands (now only two are available, but you can propose more) https://developers.google.com/glass/develop/mirror/contacts#declaring_voice_menu_commands

P.S. To go through oauth2 challenge - download sample mirror app

  • https://developers.google.com/glass/samples/mirror edit you
  • oauth2.properties file with creds you will get on your google development web console (you will need to create the app with google and request to enable Mirror API)
  • then run mvn clean install
  • then run mvn jetty:jetty
Pavlonator
  • 879
  • 1
  • 9
  • 21
  • Thanks! I dont think Mirror API is the way to go for my application since I can only use limited voice commands right now. – Jokez80 Mar 06 '14 at 10:15
  • with GDK the commands are only limited by submission policies and approvals. Server side can be any convenient server technology as long as you don't need to use Google services like Mirror API or Docs or GMail, whatever. – Pavlonator Mar 06 '14 at 23:03