Question

Someone please help me out on using Google APIs in google Glass. I need to use Calendar API in Glass what approach I should take for user authentication?

Do I need to use Mirror API for this ?

[EDIT]

My confusion lies here :- I have installed the APK into glass. Now my app requires an authenticated (OAUTH) request to access the Google Calendar APIs. So how the Mirror API would communicate with the app build through GDK? Or before installation I need to authenticate first?

Was it helpful?

Solution

The calendar can be used with google apis for calendar after you get authenticated. For this purpose the communication with calendar rest web service will be conducted by server side technology (java, php, whatever).

Mirror API is needed only as a bridge between your server side app and glass.

  • First download the sample mirror api app:https://developers.google.com/glass/samples/mirror
  • then you will need to create the app in google app console: https://code.google.com/apis/console/?pli=1
  • then enable the calendar api and mirror api for your app throught the console, some steps might require google's approval, but it's quick
  • after that create webapp credentials in console
  • update oauth.properties in your mirror sample app to use your oauth props you can see in console
  • update the authentication code to include calendar privileges in addition to default ones (this will reflect on initial acceptance form for the user, like the app request access to manafge your claendar and see your basic profile info)
  • prepare a public IP available server (use any hosting provider for that)
  • run your mirror api sample on that server with https enabled
  • register name for this ip address, raw IP address will not work
  • access the app - you will see the acceptance form, accept it
  • now develop one more operation in your sample mirror api appwhich will insert calendar entry. all google apis use Credential object to communicate with service - you will have it there available on server side. so you cann just add some button "add calendar entry" and attach post action to it to trigger the servlet with needed operation name.

This will give you the basic understanding how to use google apis with glass

OTHER TIPS

It depends on exactly what you're trying to do with the Calendar API, but yes, it sounds like your Glassware is a good candidate for the Mirror API.

User authentication and authorization should be done with OAuth2. See https://developers.google.com/glass/develop/mirror/authorization for more about auth using the Mirror API and https://developers.google.com/google-apps/calendar/auth for more about Calendar's auth.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top