Request data from my Google Glass to Mirror API? - google-glass

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

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.

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.

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

Related

React Native voice call for android and iOS 13+

My client wants me to develop one to one voice call facility for iOS and Android mobile app. Its a simple voice calling app.
We are using aws for authentication and data storage of the user. So I checked aws services for voice calling facility. I went through aws chime but as I understood it is only for meeting initiation, video calling and screen sharing facility. Not immediate voice calling like whatsapp.
I went through documentations of react-native-callkeep and react-native-voip-call but I did not understood do they need any server for voice calling or it can be done directly without any server support.
Please help me with the correct way to implement voice calling feature. What all libraries and servers do we need for this feature.
Thank you

Authentication using Glass

We have an existing Android and iOS application that consumes REST API from our servers. The API provides a token to the authenticated users after they log in using their credentials (username, password combo.) from the mobile applications.
Now, we're planning to create a Google Glass application for the same. In this case, we'd like to use the existing REST API along with Glass also. The Glass app will be built natively using the GDK.
My concern is, how would the users be able to input credentials? Because, users may have signed up for the service using non-google accounts?
Many thanks in advance.
At the moment, there is no supported way for apps made with GDK Early Access to authenticate the user or provide a way to connect the Glass account to your auth system. The Glass team has indicated such methods are coming, however - the Strava Cycling app, for example, does this, and it is expected that a similar feature will become widely available as the GDK matures.
Strava Cycling appears to get its credentials at the time you setup the app through MyGlass. When you turn it on it redirects you to a website to log into Strava's service before completing the install.
I just gave a talk on this exact topic at Wearables DevCon. The solution I proposed is purely done through GDK. All the user has to do is sign into their Google Account on a phone/tablet/computer and enter a code that is shown on Glass.
Check out the slides here:
https://docs.google.com/presentation/d/1NepYwlKdEvLV0QH9ix2I8l-JY1kHjBR9AXKBNpgTI6g/edit
And the code here:
https://github.com/victorkp/GlassWebNotes
The latest Glass release (XE16) publishes the remote authentication API for apps distributed through MyGlass:
https://developers.google.com/glass/develop/gdk/authentication

How would I call a web-service from Google Glass

I was exploring Google glass. From the dev guides it is clear that to call web services I need to Mirror Apis. But mirror APIs seems to me a platform that helps inserting cards into Glass timeline from remote location.
Can Mirror API help me to get the data from some remote server and return a JSON or XML response ? Or Otherwise via Mirror API I need to parse the response and prepare a Card there to push it to Glass Timeline.
Anyone please help me out on this query.
Neither API, Mirror or GDK, will actually do the work of calling the remote server and getting a response - those are normal things that you should be able to do with the underlying tools they are built on (whatever platform you choose to develop with, if you're using Mirror, or Android if you're using the GDK).
What both APIs support, however, is helping you deliver that information to Glass in the most appropriate way possible.
The Mirror API is good for Glassware that is accessed over the Internet and work with the native timeline operations that Glass provides. The GDK is useful for more immersive or dynamic applications that don't necessarily work with the timeline or the network.
It's the second one: Otherwise via Mirror API I need to parse the response and prepare a Card there to push it to Glass Timeline. . This answer discusses the notion of accessing web services from the Mirror API, but to answer your question, your web server will need to get and parse the XML/JSON data, create a card (using the data) and push it to your Glass device.

Can Mirror Api call an external web service?

I want to develop an app with mirror api for the novel google glasses. Is it possible to call an external web service from the glassware? I have to use this web service to obtain the informations to display in the timeline cards.
If it is possible, how I can do it?
You need to provide a web service that interacts with the user's timeline to insert cards, but you can interact with whatever other web services you want from within yours in order to get the data that you push. Something like this:
insert timeline get 3rd party
cards data response
User's <-------------- Your Mirror <------------- Third party
Glass --------------> web service -------------> web service
subscribed make request
notifications for 3rd party
(menu items, data
location)
The simple answer is YES.
You'll probably want to develop your Glassware using the Google Mirror API as a server-based web application. (This doesn't require you to run any code on Glass, instead your application is written in PHP, Java, Python, .NET or one of the other languages supported by the Mirror API and resides on a web/cloud server.)
Your web-based application can then make any sorts of web-based API calls to other external web services or APIs, retrieve data or information and then format and send this information to your Google Glass device. How you consume these 3rd party web-services depends on your choice of programming language, but pretty much all of these languages have support for consuming external web service via XML, REST, JSON or SOAP.

Facebook app requesting Youtube watch history

We are working on an idea of a FB app which let's us retrieve youtube watch histories of app users.
I know there's the possibility to retrieve watch histories through youtube's api, but in combination with a FB app I couldn't find examples.
Any input on this is much appreciated, thanks!
These two are orthogonal. Since you didn't specify a language, I'll assume you're using Python.
Write an FB app using Canvas to display output to users ... I assume you are using Canvas.
Use the YouTube API and Python client to make API calls. You'll need to use a database or some other storage engine to link a user's Facebook API auth token with their Google auth token. Both are using OAuth 2.0 (though they are different flavors), so once you learn one, the other should be easy.
Before I answer anymore questions, it's probably a good idea for you to work through the getting started guides for both Facebook's API and YouTube API first. After you have some understanding of both, pick a stack and you should more or less be ready to go.