
In this codelab, you’ll learn how to add Push Notifications to web applications.
This will enable you to re-engage users with breaking news and information about new content.
You’ll also learn the basics of service workers.
What you’ll learn
- Service worker basics: installation and event handling
- How to set up a Google Cloud Messaging (GCM) account
- How to add a web manifest
- Techniques for requesting GCM to send a notification to a web client
- Notification display
- Notification click handling
What you’ll need
- Chrome 42 or above
- A basic understanding of git, and Chrome DevTools
- Experience of Promises and service worker would also be useful, but is not crucial
- The sample code
- A text editor
- A terminal window to run command line tools
- Python or a simple local web server (see below)
Topics
- Get the sample code
- Run a local web server
- Get started with Service Worker
- Make a project on the Google Developers Console
- Add a manifest
- Subscribe to Push Notifications
- Send a request from the command line for GCM to push a message
- Send a push notification request using XHR (Ajax)
- Show a notification
- Handle notification clicks
- Unsubscribe from notifications
- Congratulations
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 3.0 License, and code samples are licensed under the Apache 2.0 License. For details, see our Terms of Service.
