1

I create a google glass app with custom menu using mirror api. But when I click the menu it shows a synchronization icon over timeline item and the timeline becomes first position of my app.

But I cannot get the menu's click event from my notification servlet. And the Redirect Uri are:

http://localhost:8080/oauth2callback
http://localhost:8080
https://mirrornotifications.appspot.com/forward?url=http://localhost:8080/notify   

How can I solve it?

Moddasir
  • 1,449
  • 13
  • 33

2 Answers2

3

I think you're mixing up two different concepts here.

The Redirect URLs are used as part of the OAuth dance and are only important as part of a user for your Glassware authenticating themselves to your service.

You will, however, also need to subscribe to notifications in order to receive information about the menu commands. This isn't done through the API console but, instead, you will need to issue a subscriptions.insert command as documented at https://developers.google.com/glass/v1/reference/subscriptions/insert. Your Glassware only needs to do this once, however, although it may wish to update subscriptions.

Prisoner
  • 49,922
  • 7
  • 53
  • 105
2

Timeline subscriptions will not work with localhost — the callback URLs must be to a server that is publicly visible to the Mirror API servers that are pushing the notifications and must also support SSL.

So to test subscriptions in development, you have a couple options:

  1. Deploy to a staging server
  2. Try one of a handful of localhost proxies that are available
  3. Use curl as described in this post to manually push the notification payload to your callback URL

I've found during my own development that #3 was the easiest, but as your application gets more complex you may want to look into the other options.

Community
  • 1
  • 1
Tony Allevato
  • 6,429
  • 1
  • 29
  • 34
  • for the image I am using public server, because image cannot load from local host. And for subscription I am using google proxy server. but I do not get event from my notification class. – Moddasir Dec 18 '13 at 07:24
  • Trying to use Google's proxy server, like the example you posted in your question, won't work with localhost because localhost doesn't refer to your machine when the request is made from the proxy server. The URL that you give the proxy must be something that it can access. – Tony Allevato Dec 18 '13 at 14:49