mirror of
https://github.com/GoogleChrome/chrome-extensions-samples.git
synced 2026-03-26 13:19:49 +07:00
Drink Water Alarm
This example demonstrates how to use the Alarms API and Notifications API to remind users to drink water at set intervals.
Overview
The extension allows users to set a recurring reminder to stay hydrated. Users can choose from preset intervals (1, 15, or 30 minutes) through a popup interface. When the alarm fires, a notification appears prompting the user to drink water.
Implementation Notes
The extension uses several Chrome APIs together:
chrome.alarms- Creates and manages the reminder timerchrome.notifications- Displays the hydration reminder when the alarm fireschrome.storage.sync- Persists the user's selected interval across sessionschrome.action- Shows an "ON" badge when an alarm is active
When the notification appears, users can click "Keep it Flowing" to restart the timer with their previously selected interval.
Running this extension
- Clone this repository.
- Load this directory in Chrome as an unpacked extension.
- Click the extension icon to open the popup.
- Select a time interval (Sample minute, 15 Minutes, or 30 Minutes).
- Wait for the notification to appear reminding you to drink water.