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

Get Programming Google Glass now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.