O'Reilly logo

Programming Google Glass by Eric Redmond

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Accepting Notifications

For a newspaper subscription, your house is like the callback URL. When the paper arrives, you can take any action you wish in response, from reading the paper to lining a birdcage with it. The callback URL you provide will receive a POST notification JSON object, allowing your service to take some action when the subscribed event has happened.

Google expects your service to respond with a 200 HTTP code within 10 seconds. This is a pretty standard requirement for web-service callbacks. If you need to execute a long-running job, you can put it in a task queue to be executed asynchronously.

Let’s dig into the steps required to accept notifications; we’ll craft a callback servlet that accepts notifications for the PIN menu ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required