OLD | NEW |
1 <h1 id="add-alarms-notifications"> | 1 <h1 id="add-alarms-notifications"> |
2 <span class="h1-step">Step 3:</span> | 2 <span class="h1-step">Step 3:</span> |
3 Add Alarms and Notifications | 3 Add Alarms and Notifications |
4 </h1> | 4 </h1> |
5 | 5 |
6 <p class="note"> | 6 <p class="note"> |
7 <strong>Want to start fresh from here?</strong> | 7 <strong>Want to start fresh from here?</strong> |
8 Find the previous step's code in the <a href="https://github.com/mangini/io13-
codelab/archive/master.zip">reference code zip</a> under <strong><em>cheat_code
> solution_for_step2</strong></em>. | 8 Find the previous step's code in the <a href="https://github.com/mangini/io13-
codelab/archive/master.zip">reference code zip</a> under <strong><em>cheat_code
> solution_for_step2</strong></em>. |
9 </p> | 9 </p> |
10 | 10 |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 in the Console every time the alarm "rings":</p> | 149 in the Console every time the alarm "rings":</p> |
150 | 150 |
151 <figure> | 151 <figure> |
152 <img src="{{static}}/images/app_codelab/alarm-console-logs.png" alt="Alarm mes
sages printing to the Console"/> | 152 <img src="{{static}}/images/app_codelab/alarm-console-logs.png" alt="Alarm mes
sages printing to the Console"/> |
153 </figure> | 153 </figure> |
154 | 154 |
155 <p>You should notice that:</p> | 155 <p>You should notice that:</p> |
156 | 156 |
157 <ul> | 157 <ul> |
158 <li>Even when you close the Todo app window, the alarms will keep coming.</li> | 158 <li>Even when you close the Todo app window, the alarms will keep coming.</li> |
159 <li>On platforms other than ChromeOS, if you completely close all Chrome brows
er instances, alarms won't trigger.</li> | 159 <li>On platforms other than Chrome OS, if you completely close all Chrome brow
ser instances, alarms won't trigger.</li> |
160 </ul> | 160 </ul> |
161 | 161 |
162 <p>Let's go over some of the pieces in <em>alarms.js</em> that use <code>chrome.
alarms</code> methods one by one.</p> | 162 <p>Let's go over some of the pieces in <em>alarms.js</em> that use <code>chrome.
alarms</code> methods one by one.</p> |
163 | 163 |
164 <h3 id="create-alarms">Create alarms</h3> | 164 <h3 id="create-alarms">Create alarms</h3> |
165 | 165 |
166 <p>In <code>createAlarm()</code>, use the <a href="/apps/alarms#method-create"><
code>chrome.alarms.create()</code></a> API to create an alarm when <strong>Activ
ate alarm</strong> is toggled.</p> | 166 <p>In <code>createAlarm()</code>, use the <a href="/apps/alarms#method-create"><
code>chrome.alarms.create()</code></a> API to create an alarm when <strong>Activ
ate alarm</strong> is toggled.</p> |
167 | 167 |
168 <pre data-filename="alarms.js"> | 168 <pre data-filename="alarms.js"> |
169 chrome.alarms.create(alarmName, {delayInMinutes: 0.1, periodInMinutes: 0.1}); | 169 chrome.alarms.create(alarmName, {delayInMinutes: 0.1, periodInMinutes: 0.1}); |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 <a href="/apps/notifications" title="Read 'chrome.notifications.clear()' in
the Chrome developer docs">chrome.notifications.clear()</a> | 409 <a href="/apps/notifications" title="Read 'chrome.notifications.clear()' in
the Chrome developer docs">chrome.notifications.clear()</a> |
410 <a href="#clear-notification" class="anchor-link-icon" title="This feature m
entioned in 'Clear the notification'">↑</a> | 410 <a href="#clear-notification" class="anchor-link-icon" title="This feature m
entioned in 'Clear the notification'">↑</a> |
411 </li> --> | 411 </li> --> |
412 <!-- <li> | 412 <!-- <li> |
413 <a href="/apps/desktop_notifications" title="Read 'Rich Notifications' in th
e Chrome developer docs">Rich Notifications</a> | 413 <a href="/apps/desktop_notifications" title="Read 'Rich Notifications' in th
e Chrome developer docs">Rich Notifications</a> |
414 <a href="#rich-notifications" class="anchor-link-icon" title="This feature m
entioned in 'Learn more about rich notifications'">↑</a> | 414 <a href="#rich-notifications" class="anchor-link-icon" title="This feature m
entioned in 'Learn more about rich notifications'">↑</a> |
415 </li> --> | 415 </li> --> |
416 </ul> | 416 </ul> |
417 | 417 |
418 <p>Ready to continue onto the next step? Go to <a href="app_codelab_webview.html
">Step 4 - Open external links with a webview »</a></p> | 418 <p>Ready to continue onto the next step? Go to <a href="app_codelab_webview.html
">Step 4 - Open external links with a webview »</a></p> |
OLD | NEW |