如何在Google Glass的共享功能中添加其他选项? [英] How to add another option to the share functionality of Google Glass?
问题描述
我有兴趣将我的服务添加到Google Glass的共享功能中,流程如下:
1.拍照/录制视频
2.与->我的服务分享
3.照片或视频应上传到我的网站
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
此功能可行吗?它与Facebook和G +共享选项非常相似.
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.
推荐答案
您正在寻找的是Mirror API称为联系人.您的Glassware可以设置一个或多个联系人,并指定可以与您共享的内容类型和/或是否有语音命令触发该联系人.
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.
您还需要设置一个订阅,该URL将是公共网址用于启用了HTTPS的服务器,Mirror API将使用该服务器向您发送与联系人共享的内容.
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:
- 添加订阅,以便您可以获取回调.
- 添加一个或多个联系人.在您的示例中,尽管您也可以省略acceptType以获取所有内容(包括文本),但您仍希望注册联系人的acceptTypes为
image/*
和video/*
.
您在订阅中注册的回调应该能够处理JSON正文,并应尽快返回HTTP代码200.一个好的过程是实际接受主体,将其放置在作业队列中以备后用,然后立即返回200代码.处理身体时,您可能想要做类似的事情
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
- 确认提供的
userToken
和verifyToken
有效. - 使用
itemId
,获取时间轴项,其中将包括附件信息关于与您分享的内容. - 如果附件标记为
isProcessingContent
,则说明内容尚未准备就绪,您应将作业返回队列,然后重试. - 如果
isProcessingContent
为false,则可以将附件URL与身份验证令牌一起使用,以供用户获取内容本身.
- Confirm the
userToken
andverifyToken
provided are valid. - Using the
itemId
, get the Timeline item, which will include attachment information about what was shared with you. - 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. - If
isProcessingContent
is false, you can use the attachment URL with the authentication token for the user to fetch the content itself.
我在这里掩盖了很多细节.有关流程的进一步概述,请参见 https://developers.google.com/glass/开发/镜像/联系人
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
这篇关于如何在Google Glass的共享功能中添加其他选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!