2

I am interested to add my service into the share functionality of the Google Glass, my flow is below:
1. Take photo / Record video
2. Share with -> My service
3. the photo or video should be uploaded to my site

Is this functionality possible? it is very similar to Facebook and G+ share options.

I will be happy to know how to do it, Thanks.

1 Answer 1

3

What you are looking for is what the Mirror API calls a Contact. Your Glassware can setup one or more Contacts, specifying what content type can be shared with you and/or if there are voice commands which will trigger the Contact.

You will also need to setup a Subscription which will be the public URL for an HTTPS enabled server that the Mirror API will use to send you the content that was shared with the Contact.

In general, the flow when a user first authorizes you to write to their time would be something like this:

  1. Add a Subscription, so you can get callbacks.
  2. Add one or more Contacts. In your example, you would want to register the Contacts to have acceptTypes of image/* and video/*, although you can also omit the acceptTypes to get everything (including text).

The callback you register with the subscription should be able to handle a JSON body, and should return HTTP code 200 as quickly as possible. A good procedure is to actually accept the body, place it on a job queue for processing later, and immediately return the 200 code. When processing the body, you may want to do something like

  1. Confirm the userToken and verifyToken provided are valid.
  2. Using the itemId, get the Timeline item, which will include attachment information about what was shared with you.
  3. If the attachment is marked as isProcessingContent, then the content isn't ready for you and you should return the job to the queue and try again soon.
  4. If isProcessingContent is false, you can use the attachment URL with the authentication token for the user to fetch the content itself.

There are a lot of details I've glossed over here. For a further overview of the flow, see https://developers.google.com/glass/develop/mirror/contacts

4
  • Thank you @Prisoner, very clear, I will write the code and then I will share my input.
    – kimo
    Aug 24, 2014 at 12:34
  • Hi @Prisoner, I followed your details and was able to receive notification from Glass when I share picture, then I pull the list items and I can see that some cards have attachments, now, do I need to use the selfLink to pull the picture from googleapi ? how to generate request that include selfLink + the token I have? (FYI my server is based on JavaScript NodeJS)
    – kimo
    Sep 4, 2014 at 21:48
  • @kimo - Glad that it worked! You may wish to ask your followup question as a new SO question, since it is not directly related to this one. Provide as much details and code as you can to show what you've done so far, and I'm sure we'll be able to point you in the right direction.
    – Prisoner
    Sep 4, 2014 at 23:58
  • done, stackoverflow.com/questions/25685220/… - @Prisoner
    – kimo
    Sep 5, 2014 at 11:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.