How to add another option to the share functionality of Google Glass?

笑着哭i 提交于 2019-12-10 22:18:44

问题


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:


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



来源:https://stackoverflow.com/questions/25462202/how-to-add-another-option-to-the-share-functionality-of-google-glass

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!