Search code examples
google-glassgoogle-mirror-api

Subscription handling complexity


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?


Solution

  • 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.