Merge "add the JD docs for the Android Wear docs (delte the HTML versions) This depends on the following CL that makes this all work with template changes: I848f442b3bc66ee2fb87db8200df370d13762d29" into klp-docs

This commit is contained in:
Scott Main
2014-03-27 06:24:15 +00:00
committed by Android (Google) Code Review
18 changed files with 1209 additions and 5414 deletions

View File

@@ -1,609 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
<title>Design Principles of Android Wear | Android Developers</title>
<!-- STYLESHEETS -->
<link rel="stylesheet"
href="//fonts.googleapis.com/css?family=Roboto:light,regular,medium,thin,italic,mediumitalic,bold" title="roboto">
<link href="/assets/css/default.css" rel="stylesheet" type="text/css">
<!-- JAVASCRIPT -->
<script src="//www.google.com/jsapi" type="text/javascript"></script>
<script src="/assets/js/android_3p-bundle.js" type="text/javascript"></script>
<script type="text/javascript">
var toRoot = "/";
var metaTags = [];
var devsite = false;
</script>
<script src="/assets/js/docs.js" type="text/javascript"></script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-5831155-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body class="gc-documentation
" itemscope itemtype="http://schema.org/Article">
<a name="top"></a>
<!-- Header -->
<div id="header">
<div class="wrap" id="header-wrap">
<div class="col-3 logo-wear">
<a href="/wear/index.html">
<img src="/wear/images/android-wear.png" height="16" alt="Android Wear" />
</a>
</div>
<div class="col-8" style="margin:0"><h1 style="margin:1px 0 0 20px;padding:0;line-height:16px;
color:#666;font-weight:100;font-size:24px;">Developer Preview</h1></div>
<!-- New Search -->
<div class="menu-container">
<div class="moremenu">
<div id="more-btn"></div>
</div>
<div class="morehover" id="moremenu">
<div class="top"></div>
<div class="mid">
<div class="header">Links</div>
<ul>
<li><a href="https://play.google.com/apps/publish/">Google Play Developer Console</a></li>
<li><a href="http://android-developers.blogspot.com/">Android Developers Blog</a></li>
<li><a href="/about/index.html">About Android</a></li>
</ul>
<div class="header">Android Sites</div>
<ul>
<li><a href="http://www.android.com">Android.com</a></li>
<li class="active"><a>Android Developers</a></li>
<li><a href="http://source.android.com">Android Open Source Project</a></li>
</ul>
<div class="header">Language</div>
<div id="language" class="locales">
<select name="language" onChange="changeLangPref(this.value, true)">
<option value="en">English</option>
<option value="es">Español</option>
<option value="ja">日本語</option>
<option value="ko">한국어</option>
<option value="ru">Русский</option>
<option value="zh-cn">中文 (中国)</option>
<option value="zh-tw">中文 (台灣)</option>
</select>
</div>
<script type="text/javascript">
<!--
loadLangPref();
//-->
</script>
<br class="clearfix" />
</div><!-- end mid -->
<div class="bottom"></div>
</div><!-- end morehover -->
<div class="search" id="search-container">
<div class="search-inner">
<div id="search-btn"></div>
<div class="left"></div>
<form onsubmit="return submit_search()">
<input id="search_autocomplete" type="text" value="" autocomplete="off" name="q"
onfocus="search_focus_changed(this, true)" onblur="search_focus_changed(this, false)"
onkeydown="return search_changed(event, true, '/')"
onkeyup="return search_changed(event, false, '/')" />
</form>
<div class="right"></div>
<a class="close hide">close</a>
<div class="left"></div>
<div class="right"></div>
</div>
</div><!-- end search -->
<div class="search_filtered_wrapper reference">
<div class="suggest-card reference no-display">
<ul class="search_filtered">
</ul>
</div>
</div>
<div class="search_filtered_wrapper docs">
<div class="suggest-card dummy no-display">&nbsp;</div>
<div class="suggest-card develop no-display">
<ul class="search_filtered">
</ul>
<div class="child-card guides no-display">
</div>
<div class="child-card training no-display">
</div>
<div class="child-card samples no-display">
</div>
</div>
<div class="suggest-card design no-display">
<ul class="search_filtered">
</ul>
</div>
<div class="suggest-card distribute no-display">
<ul class="search_filtered">
</ul>
</div>
</div><!-- end search_filtered_wrapper -->
</div>
<!-- end menu_container -->
</div><!-- end header-wrap -->
</div>
<!-- /Header -->
<div id="searchResults" class="wrap" style="display:none;">
<h2 id="searchTitle">Results</h2>
<div id="leftSearchControl" class="search-control">Loading...</div>
</div>
<div class="wrap clearfix" id="body-content">
<div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
<div id="devdoc-nav" class="scroll-pane">
<a class="totop" href="#top" data-g-event="left-nav-top">to top</a>
<ul id="nav">
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/preview/start.html">Get Started
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/design/user-interface.html">UI Overview
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/design/index.html">Design Principles
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/notifications/creating.html">Creating Notifications for Android Wear
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/notifications/remote-input.html">Receiving Voice Input from a Notification
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/notifications/pages.html">Adding Pages to a Notification
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/notifications/stacks.html">Stacking Notifications
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header"><a href="/reference/android/preview/support/package-summary.html">Notification Reference</a></div>
<ul class="tree-list-children">
<li class="nav-section">
<div class="nav-section-header-ref"><span class="tree-list-subtitle package" title="android.preview.support.v4.app">android.preview.support.v4.app</span></div>
<ul>
<li><a href="/reference/android/preview/support/v4/app/NotificationManagerCompat.html">NotificationManagerCompat</a></li>
</ul>
</li>
<li class="nav-section">
<div class="nav-section-header-ref"><span class="tree-list-subtitle package" title="android.preview.support.wearable.notifications">android.preview.support.wearable.notifications</span></div>
<ul>
<li><a href="/reference/android/preview/support/wearable/notifications/RemoteInput.html">RemoteInput</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/RemoteInput.Builder.html" >RemoteInput.Builder</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.html">WearableNotifications</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Action.html">WearableNotifications.Action</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Action.Builder.html">WearableNotifications.Action.Builder</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html">WearableNotifications.Builder</a></li>
</ul>
</li>
</ul>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/license.html">License Agreement</a></div>
</li>
</ul>
</div>
</div> <!-- end side-nav -->
<script>
$(document).ready(function() {
scrollIntoView("devdoc-nav");
});
</script>
<div class="col-12" id="doc-col" >
<h1 itemprop="name" >Design Principles of Android Wear</h1>
<div id="jd-content">
<div class="jd-descr" itemprop="articleBody">
<style>
h3 {
padding:30px 0 10px;
}
</style>
<p>
Android wearables provide just the right information at just the right time, allowing you to be connected to the virtual world and present in the real world.</p>
<img src="/wear/images/05_images.png" height="200" width="169" style="float:right;clear:right;margin:0 0 60px 60px" />
<p>Here youll find some guidelines for designing great user experiences on the Android Wear
platform. Designing for Android Wear is substantially different than designing for phones or
tablets, so well start by describing how your content can work in tandem with the overall
Android Wear vision. To better understand the user experience on Android Wear, also be sure
to read the <a href="/wear/design/user-interface.html">UI Overview</a>.</p>
<img src="/wear/images/02_notifications.png" height="200" width="169" style="float:right;clear:right;margin:0 0 20px 60px" />
<p>Android Wear experiences are:</p>
<ul>
<li><strong>Contextually aware and smart.</strong> These devices bring a new level of awareness to computing. Rather than requiring attention and input from users, Android wearables are aware of their situation and state, and helpfully display the right information at the right time. <em>Timely, relevant, specific</em>.</li>
<li><strong>Glanceable.</strong> Wearable devices are used all throughout the day, even when they sit in our peripheral vision. Effective apps provide the maximum payload of information with a minimum of fuss, optimized to provide tiny snippets of relevant information throughout the day. <em>Short, sharp, immediate.</em></li>
<li><strong>Zero/low interaction.</strong> Staying true to the strengths afforded by a smaller form factor, Android Wear focuses on simple interactions, only requiring input by the user when absolutely necessary. Most inputs are based around touch swipes or voice, and inputs requiring fine-grained motor skills are avoided. <em>Gestural, simple, fast.</em></li>
<li><strong>Helpful.</strong> Android Wear is like a great personal assistant: it knows you and your preferences, it only interrupts you when absolutely necessary, and its always on hand to provide a ready answer. <em>Efficient, respectful, responsive.</em></li>
</ul>
<p>
By providing a smart connection to the rest of the world while respecting the users attention, Android Wear feels personal and global, simple and smart, unobtrusive and ever-ready. Notifications that respect these principles will feel most at home in the overall Android Wear experience.
</p>
<h2 id="Notifications" style="clear:both">Notification UI Patterns</h2>
<p>Android notifications appear as cards in the main stream and form the core of the Android Wear experience. Many of the main <a href="http://developer.android.com/design/patterns/notifications.html">Android Design guidelines for notifications</a> apply in Android Wear. Be respectful of users' attention and aware of how unnecessary interruptions will reflect on your applications reputation.</p>
<p>Omit needless text from your notifications. Design for glanceability, not reading. Use words and phrases, not sentences. Show, don't tell: where possible use simple icons, glyphs, and visualizations to convey your message.</p>
<img src="/wear/images/circle_message2.png" height="200" style="float:right;clear:right;margin:0 0 20px 60px" />
<p>In some cases, particularly with messaging applications, cards will contain dynamic content which may not fit on a single screen. In these cases the content will be automatically truncated to fit on the card and the user may tap to expand, so the full message should be provided.</p>
<p>Notification priority should reflect the urgency of your notification, with only time-sensitive notifications carrying a high priority. Active notifications that is, those that cause the device to vibrate should only be used in cases that need the user's urgent attention or action (e.g. a time-based reminder, a message from a friend). Non-urgent notifications (e.g. a transit times card, daily pedometer count, social network updates) should be silently added to the card stream.</p>
<h3 id="NotifictionActions" style="clear:both">Actions</h3>
<img src="/wear/images/circle_message2_reply.png" height="200" style="float:right;clear:right;margin:0 0 20px 40px" />
<p>Actions appear to the right of your notification, allowing the user to act on your notification. Up to three actions are permitted. The most-used action should be placed first, so that it is a single swipe away from your content.</p>
<p>Actions consist of an icon and a caption. Icons should be PNG files, white on transparent background, 32 × 32 dp (with 8 dp padding), as specified in the <a href="/design/style/iconography.html#action-bar">Iconography</a> design guide
for the action bar icons. Captions should be verb-driven and short, and will be automatically truncated at one line.</p>
<p>Actions are optional. Many useful notifications will not need to include actions at all.</p>
<p>For developer details about action buttons, see <a href="/wear/notifications/creating.html">Creating
Notifications for Android Wear</a>.</p>
<h3 id="Images" style="clear:both">Images</h3>
<img src="/wear/images/circle_badge_B.png" height="200" style="float:right;clear:right;margin:0 0 20px 40px" />
<p>Images appear behind cards in the stream, providing context and additional glanceability. Your image should support the core message of the notification; for example, a card about a sports team could include the team color and logo; a message from a contact should display that person's profile photo.</p>
<p>Bear in mind that the card will partially cover the lower part of the image. Images should be sized as
appropriate for the notification appearance on handsets, which is 64 x 64 dp. Image backgrounds move when horizontally swiped, so landscape-oriented images work better on notifications that include pages or actions.</p>
<p>To add large images, use <code><a href="/reference/android/support/v4/app/NotificationCompat.Builder.html#setLargeIcon(android.graphics.Bitmap)">setLargeIcon()</a></code> with any notification, as
shown in <a href="/wear/notifications/creating.html">Creating
Notifications for Android Wear</a>.</p>
<h3 id="AppIcons" style="clear:both">Application Icons</h3>
<img src="/wear/images/07_appicons.png" height="200" style="float:right;margin:0 0 20px 60px" />
<p>Your applications launcher icon will be automatically placed on the card, identifying your notification. Do not use the notification title or background image to identify or brand your application. Instead, allow your icon to identify itself and focus on delivering a clear, succinct message in the card and image. You can choose not to display this icon using
<a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html#setHintHideIcon(boolean)"><code>setHintHideIcon()</code></a>.
</p>
<h3 id="NotificationPages" style="clear:both">Pages</h3>
<p>Pages are additional cards that can appear to the right of your main card in the stream. If your core message is longer than a short snippet, do not sacrifice glanceability by packing a lot of information into your primary notification. Instead, use pages to provide additional content.</p>
<img src="/wear/images/08_pages.png" height="200" style="float:left;margin:0 0 20px 0px" />
<img src="/wear/images/09_pages.png" height="200" style="float:left;margin:0 0 20px 60px" />
<img src="/wear/images/10_pages.png" height="200" style="float:left;margin:0 0 20px 60px" />
<p style="clear:left">Pages appear immediately to the right of the main notification card. They are typically used to provide additional details or alternate views of the main cards content. For example:</p>
<ul>
<li>A current weather card might provide an additional page showing a three-day forecast.</li>
<li>A next train departure card might provide an additional page showing subsequent departures times.</li>
<li>A daily step count card might provide an additional page showing the same measurement in calories and distance.</li>
</ul>
<p>There is no imposed limit on the number of pages you may add. However, notifications that provide actions should show no more than three pages to ensure that the actions remain easily accessible.</p>
<p>Pages are optional. Many useful notifications will not need to include pages at all.</p>
<p>For developer details about pages, see
described in <a href="/wear/notifications/pages.html">Adding
Pages to a Notification</a>.</p>
<h3 id="NotificationStacks" style="clear:both">Notification Stacks</h3>
<img src="/wear/images/11_bundles_B.png" height="200" style="float:right;margin:0 0 20px 60px" />
<img src="/wear/images/11_bundles_A.png" height="200" style="float:right;margin:0 0 20px 60px" />
<p>Stacks may be used to collect multiple notifications from the same application into a single stack of cards. Whereas pages are used to provide additional detail on a single notification, stacks are used to collect multiple sibling notifications together. A stack may be expanded by the user to access each individual card contained within.</p>
<p>Stacks are a way of adding multiple useful notifications without overwhelming the users stream. If your application may produce multiple concurrent notifications, consider combining them into a stack.</p>
<p>Each notification within a stack can contain separate pages and separate actions that are relevant to that specific notification. The user can access these actions after expanding that notification's card within the stack.</p>
<p>For developer details about stacks, see
described in <a href="/wear/notifications/stacks.html">Stacking
Notifications</a>.</p>
<h3 id="VoiceReplies" style="clear:both">Voice Replies</h3>
<img src="/wear/images/circle_voice_B.png" height="200" style="float:right;margin:0 0 20px 40px" />
<img src="/wear/images/circle_voice_A.png" height="200" style="float:right;margin:0 0 20px 40px" />
<p>Voice replies are primarily used by messaging applications to provide a hands-free way of dictating a short message. You can also provide a up to five suggested replies or “canned responses” that are useful in a wide range of cases. These canned responses can be tapped by the user, allowing for a fast method of sending simple replies in cases where speaking may not be desirable.</p>
<p>You should attempt to cover a range of simple, neutral replies in your choices. Longer voice replies may be automatically truncated in the Voice reply UI.</p>
<p>For developer details about enabling voice replies, see
described in <a href="/wear/notifications/remote-input.html">Receiving Voice Input from
a Notification</a>.</p>
</div>
<div class="content-footer layout-content-row"
itemscope itemtype="http://schema.org/SiteNavigationElement">
<div class="layout-content-col col-9" style="padding-top:4px">
<div class="g-plusone" data-size="medium"></div>
</div>
<div class="paging-links layout-content-col col-4">
</div>
</div>
</div> <!-- end jd-content -->
<div id="footer" class="wrap" >
<div id="copyright">
Except as noted, this content is
licensed under <a href="http://creativecommons.org/licenses/by/2.5/">
Creative Commons Attribution 2.5</a>. For details and
restrictions, see the <a href="/license.html">Content
License</a>.
</div>
<div id="footerlinks">
<p>
<a href="/about/index.html">About Android</a>&nbsp;&nbsp;|&nbsp;
<a href="/legal.html">Legal</a>&nbsp;&nbsp;|&nbsp;
<a href="/support.html">Support</a>
</p>
</div>
</div> <!-- end footer -->
</div><!-- end doc-content -->
</div> <!-- end body-content -->
<!-- Start of Tag -->
<script type="text/javascript">
var axel = Math.random() + "";
var a = axel * 10000000000000;
document.write('<iframe src="https://2507573.fls.doubleclick.net/activityi;src=2507573;type=other026;cat=googl348;ord=' + a + '?" width="1" height="1" frameborder="0" style="display:none"></iframe>');
</script>
<noscript>
<iframe src="https://2507573.fls.doubleclick.net/activityi;src=2507573;type=other026;cat=googl348;ord=1?" width="1" height="1" frameborder="0" style="display:none"></iframe>
</noscript>
<!-- End of Tag -->
</body>
</html>

View File

@@ -0,0 +1,173 @@
page.title=Design Principles of Android Wear
@jd:body
<style>
h3 {
padding:30px 0 10px;
}
</style>
<p>
Android wearables provide just the right information at just the right time, allowing you to be connected to the virtual world and present in the real world.</p>
<img src="{@docRoot}wear/images/05_images.png" height="200" width="169" style="float:right;clear:right;margin:0 0 60px 60px" />
<p>Here youll find some guidelines for designing great user experiences on the Android Wear
platform. Designing for Android Wear is substantially different than designing for phones or
tablets, so well start by describing how your content can work in tandem with the overall
Android Wear vision. To better understand the user experience on Android Wear, also be sure
to read the <a href="{@docRoot}wear/design/user-interface.html">UI Overview</a>.</p>
<img src="{@docRoot}wear/images/02_notifications.png" height="200" width="169" style="float:right;clear:right;margin:0 0 20px 60px" />
<p>Android Wear experiences are:</p>
<ul>
<li><strong>Contextually aware and smart.</strong> These devices bring a new level of awareness to computing. Rather than requiring attention and input from users, Android wearables are aware of their situation and state, and helpfully display the right information at the right time. <em>Timely, relevant, specific</em>.</li>
<li><strong>Glanceable.</strong> Wearable devices are used all throughout the day, even when they sit in our peripheral vision. Effective apps provide the maximum payload of information with a minimum of fuss, optimized to provide tiny snippets of relevant information throughout the day. <em>Short, sharp, immediate.</em></li>
<li><strong>Zero/low interaction.</strong> Staying true to the strengths afforded by a smaller form factor, Android Wear focuses on simple interactions, only requiring input by the user when absolutely necessary. Most inputs are based around touch swipes or voice, and inputs requiring fine-grained motor skills are avoided. <em>Gestural, simple, fast.</em></li>
<li><strong>Helpful.</strong> Android Wear is like a great personal assistant: it knows you and your preferences, it only interrupts you when absolutely necessary, and its always on hand to provide a ready answer. <em>Efficient, respectful, responsive.</em></li>
</ul>
<p>
By providing a smart connection to the rest of the world while respecting the users attention, Android Wear feels personal and global, simple and smart, unobtrusive and ever-ready. Notifications that respect these principles will feel most at home in the overall Android Wear experience.
</p>
<h2 id="Notifications" style="clear:both">Notification UI Patterns</h2>
<p>Android notifications appear as cards in the main stream and form the core of the Android Wear experience. Many of the main <a href="http://developer.android.com/design/patterns/notifications.html">Android Design guidelines for notifications</a> apply in Android Wear. Be respectful of users' attention and aware of how unnecessary interruptions will reflect on your applications reputation.</p>
<p>Omit needless text from your notifications. Design for glanceability, not reading. Use words and phrases, not sentences. Show, don't tell: where possible use simple icons, glyphs, and visualizations to convey your message.</p>
<img src="{@docRoot}wear/images/circle_message2.png" height="200" style="float:right;clear:right;margin:0 0 20px 60px" />
<p>In some cases, particularly with messaging applications, cards will contain dynamic content which may not fit on a single screen. In these cases the content will be automatically truncated to fit on the card and the user may tap to expand, so the full message should be provided.</p>
<p>Notification priority should reflect the urgency of your notification, with only time-sensitive notifications carrying a high priority. Active notifications that is, those that cause the device to vibrate should only be used in cases that need the user's urgent attention or action (e.g. a time-based reminder, a message from a friend). Non-urgent notifications (e.g. a transit times card, daily pedometer count, social network updates) should be silently added to the card stream.</p>
<h3 id="NotifictionActions" style="clear:both">Actions</h3>
<img src="{@docRoot}wear/images/circle_message2_reply.png" height="200" style="float:right;clear:right;margin:0 0 20px 40px" />
<p>Actions appear to the right of your notification, allowing the user to act on your notification. Up to three actions are permitted. The most-used action should be placed first, so that it is a single swipe away from your content.</p>
<p>Actions consist of an icon and a caption. Icons should be PNG files, white on transparent
background, 32 × 32 dp (with 8 dp padding), as specified in the <a
href="/design/style/iconography.html#action-bar">Iconography</a> design guide for action bar
icons. Captions should be verb-driven and short, and will be automatically truncated at one line.
</p>
<p>Actions are optional. Many useful notifications will not need to include actions at all.</p>
<p>For developer details about action buttons, see <a href="{@docRoot}wear/notifications/creating.html">Creating
Notifications for Android Wear</a>.</p>
<h3 id="Images" style="clear:both">Images</h3>
<img src="{@docRoot}wear/images/circle_badge_B.png" height="200" style="float:right;clear:right;margin:0 0 20px 40px" />
<p>Images appear behind cards in the stream, providing context and additional glanceability. Your image should support the core message of the notification; for example, a card about a sports team could include the team color and logo; a message from a contact should display that person's profile photo.</p>
<p>Bear in mind that the card will partially cover the lower part of the image. Images should
be sized as appropriate for the notification appearance on handsets, which is 64 x 64 dp. Image backgrounds move when horizontally swiped, so landscape-oriented images work better on notifications that include pages or actions.</p>
<p>To add large images, use {@link android.support.v4.app.NotificationCompat.Builder#setLargeIcon
setLargeIcon()} with any notification, as
shown in <a href="{@docRoot}wear/notifications/creating.html">Creating
Notifications for Android Wear</a>.</p>
<h3 id="AppIcons" style="clear:both">Application Icons</h3>
<img src="{@docRoot}wear/images/07_appicons.png" height="200" style="float:right;margin:0 0 20px 60px" />
<p>Your applications launcher icon will be automatically placed on the card, identifying your notification. Do not use the notification title or background image to identify or brand your application. Instead, allow your icon to identify itself and focus on delivering a clear, succinct message in the card and image. You can choose not to display this icon using
<a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html#setHintHideIcon(boolean)"><code>setHintHideIcon()</code></a>.
</p>
<h3 id="NotificationPages" style="clear:both">Pages</h3>
<p>Pages are additional cards that can appear to the right of your main card in the stream. If your core message is longer than a short snippet, do not sacrifice glanceability by packing a lot of information into your primary notification. Instead, use pages to provide additional content.</p>
<img src="{@docRoot}wear/images/08_pages.png" height="200" style="float:left;margin:0 0 20px 0px" />
<img src="{@docRoot}wear/images/09_pages.png" height="200" style="float:left;margin:0 0 20px 60px" />
<img src="{@docRoot}wear/images/10_pages.png" height="200" style="float:left;margin:0 0 20px 60px" />
<p style="clear:left">Pages appear immediately to the right of the main notification card. They are typically used to provide additional details or alternate views of the main cards content. For example:</p>
<ul>
<li>A current weather card might provide an additional page showing a three-day forecast.</li>
<li>A next train departure card might provide an additional page showing subsequent departures times.</li>
<li>A daily step count card might provide an additional page showing the same measurement in calories and distance.</li>
</ul>
<p>There is no imposed limit on the number of pages you may add. However, notifications that provide actions should show no more than three pages to ensure that the actions remain easily accessible.</p>
<p>Pages are optional. Many useful notifications will not need to include pages at all.</p>
<p>For developer details about pages, see
described in <a href="{@docRoot}wear/notifications/pages.html">Adding
Pages to a Notification</a>.</p>
<h3 id="NotificationStacks" style="clear:both">Notification Stacks</h3>
<img src="{@docRoot}wear/images/11_bundles_B.png" height="200" style="float:right;margin:0 0 20px 60px" />
<img src="{@docRoot}wear/images/11_bundles_A.png" height="200" style="float:right;margin:0 0 20px 60px" />
<p>Stacks may be used to collect multiple notifications from the same application into a single stack of cards. Whereas pages are used to provide additional detail on a single notification, stacks are used to collect multiple sibling notifications together. A stack may be expanded by the user to access each individual card contained within.</p>
<p>Stacks are a way of adding multiple useful notifications without overwhelming the users stream. If your application may produce multiple concurrent notifications, consider combining them into a stack.</p>
<p>Each notification within a stack can contain separate pages and separate actions that are relevant to that specific notification. The user can access these actions after expanding that notification's card within the stack.</p>
<p>For developer details about stacks, see
described in <a href="{@docRoot}wear/notifications/stacks.html">Stacking
Notifications</a>.</p>
<h3 id="VoiceReplies" style="clear:both">Voice Replies</h3>
<img src="{@docRoot}wear/images/circle_voice_B.png" height="200" style="float:right;margin:0 0 20px 40px" />
<img src="{@docRoot}wear/images/circle_voice_A.png" height="200" style="float:right;margin:0 0 20px 40px" />
<p>Voice replies are primarily used by messaging applications to provide a hands-free way of dictating a short message. You can also provide a up to five suggested replies or “canned responses” that are useful in a wide range of cases. These canned responses can be tapped by the user, allowing for a fast method of sending simple replies in cases where speaking may not be desirable.</p>
<p>You should attempt to cover a range of simple, neutral replies in your choices. Longer voice replies may be automatically truncated in the Voice reply UI.</p>
<p>For developer details about enabling voice replies, see
described in <a href="{@docRoot}wear/notifications/remote-input.html">Receiving Voice Input from
a Notification</a>.</p>

View File

@@ -1,498 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
<title>UI Overview | Android Developers</title>
<!-- STYLESHEETS -->
<link rel="stylesheet"
href="//fonts.googleapis.com/css?family=Roboto:light,regular,medium,thin,italic,mediumitalic,bold" title="roboto">
<link href="/assets/css/default.css" rel="stylesheet" type="text/css">
<!-- JAVASCRIPT -->
<script src="//www.google.com/jsapi" type="text/javascript"></script>
<script src="/assets/js/android_3p-bundle.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="/wear/css/wear.css">
<script type="text/javascript">
var toRoot = "/";
var metaTags = [];
var devsite = false;
</script>
<script src="/assets/js/docs.js" type="text/javascript"></script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-5831155-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body class="gc-documentation
" itemscope itemtype="http://schema.org/Article">
<a name="top"></a>
<!-- Header -->
<div id="header">
<div class="wrap" id="header-wrap">
<div class="col-3 logo-wear">
<a href="/wear/index.html">
<img src="/wear/images/android-wear.png" height="16" alt="Android Wear" />
</a>
</div>
<div class="col-8" style="margin:0"><h1 style="margin:1px 0 0 20px;padding:0;line-height:16px;
color:#666;font-weight:100;font-size:24px;">Developer Preview</h1></div>
<!-- New Search -->
<div class="menu-container">
<div class="moremenu">
<div id="more-btn"></div>
</div>
<div class="morehover" id="moremenu">
<div class="top"></div>
<div class="mid">
<div class="header">Links</div>
<ul>
<li><a href="https://play.google.com/apps/publish/">Google Play Developer Console</a></li>
<li><a href="http://android-developers.blogspot.com/">Android Developers Blog</a></li>
<li><a href="/about/index.html">About Android</a></li>
</ul>
<div class="header">Android Sites</div>
<ul>
<li><a href="http://www.android.com">Android.com</a></li>
<li class="active"><a>Android Developers</a></li>
<li><a href="http://source.android.com">Android Open Source Project</a></li>
</ul>
<div class="header">Language</div>
<div id="language" class="locales">
<select name="language" onChange="changeLangPref(this.value, true)">
<option value="en">English</option>
<option value="es">Español</option>
<option value="ja">日本語</option>
<option value="ko">한국어</option>
<option value="ru">Русский</option>
<option value="zh-cn">中文 (中国)</option>
<option value="zh-tw">中文 (台灣)</option>
</select>
</div>
<script type="text/javascript">
<!--
loadLangPref();
//-->
</script>
<br class="clearfix" />
</div><!-- end mid -->
<div class="bottom"></div>
</div><!-- end morehover -->
<div class="search" id="search-container">
<div class="search-inner">
<div id="search-btn"></div>
<div class="left"></div>
<form onsubmit="return submit_search()">
<input id="search_autocomplete" type="text" value="" autocomplete="off" name="q"
onfocus="search_focus_changed(this, true)" onblur="search_focus_changed(this, false)"
onkeydown="return search_changed(event, true, '/')"
onkeyup="return search_changed(event, false, '/')" />
</form>
<div class="right"></div>
<a class="close hide">close</a>
<div class="left"></div>
<div class="right"></div>
</div>
</div><!-- end search -->
<div class="search_filtered_wrapper reference">
<div class="suggest-card reference no-display">
<ul class="search_filtered">
</ul>
</div>
</div>
<div class="search_filtered_wrapper docs">
<div class="suggest-card dummy no-display">&nbsp;</div>
<div class="suggest-card develop no-display">
<ul class="search_filtered">
</ul>
<div class="child-card guides no-display">
</div>
<div class="child-card training no-display">
</div>
<div class="child-card samples no-display">
</div>
</div>
<div class="suggest-card design no-display">
<ul class="search_filtered">
</ul>
</div>
<div class="suggest-card distribute no-display">
<ul class="search_filtered">
</ul>
</div>
</div><!-- end search_filtered_wrapper -->
</div>
<!-- end menu_container -->
</div><!-- end header-wrap -->
</div>
<!-- /Header -->
<div id="searchResults" class="wrap" style="display:none;">
<h2 id="searchTitle">Results</h2>
<div id="leftSearchControl" class="search-control">Loading...</div>
</div>
<div class="wrap clearfix" id="body-content">
<div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
<div id="devdoc-nav" class="scroll-pane">
<a class="totop" href="#top" data-g-event="left-nav-top">to top</a>
<ul id="nav">
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/preview/start.html">Get Started
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/design/user-interface.html">UI Overview
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/design/index.html">Design Principles
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/notifications/creating.html">Creating Notifications for Android Wear
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/notifications/remote-input.html">Receiving Voice Input from a Notification
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/notifications/pages.html">Adding Pages to a Notification
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/notifications/stacks.html">Stacking Notifications
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header"><a href="/reference/android/preview/support/package-summary.html">Notification Reference</a></div>
<ul class="tree-list-children">
<li class="nav-section">
<div class="nav-section-header-ref"><span class="tree-list-subtitle package" title="android.preview.support.v4.app">android.preview.support.v4.app</span></div>
<ul>
<li><a href="/reference/android/preview/support/v4/app/NotificationManagerCompat.html">NotificationManagerCompat</a></li>
</ul>
</li>
<li class="nav-section">
<div class="nav-section-header-ref"><span class="tree-list-subtitle package" title="android.preview.support.wearable.notifications">android.preview.support.wearable.notifications</span></div>
<ul>
<li><a href="/reference/android/preview/support/wearable/notifications/RemoteInput.html">RemoteInput</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/RemoteInput.Builder.html" >RemoteInput.Builder</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.html">WearableNotifications</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Action.html">WearableNotifications.Action</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Action.Builder.html">WearableNotifications.Action.Builder</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html">WearableNotifications.Builder</a></li>
</ul>
</li>
</ul>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/license.html">License Agreement</a></div>
</li>
</ul>
</div>
</div> <!-- end side-nav -->
<script>
$(document).ready(function() {
scrollIntoView("devdoc-nav");
});
</script>
<div class="col-12" id="doc-col" >
<h1 itemprop="name" >UI Overview</h1>
<div id="jd-content">
<div class="jd-descr" itemprop="articleBody">
<style>
h3 {
padding:30px 0 10px;
}
</style>
<p>A new form factor deserves a new UI model. At a high level, the Android Wear UI consists of two
main spaces centered around the core functions of <strong>Suggest</strong> and
<strong>Demand</strong>. Your application will have an important role to play in both of these
spaces.</p>
<h3 id="Stream">Suggest: The Context Stream</h3>
<div class="wear-inset-video-container" style="float:right;margin:0 -22px 60px 40px">
<img class="wear-bezel-only" src="/wear/images/screens/bezel.png" alt="">
<img class="gif" src="/wear/images/screens/stream.gif">
</div>
<p>The context stream is a vertical list of cards, each showing a useful or timely piece of
information. Much like Google Now on Android phones and tablets, users swipe vertically to navigate
from card to card for a brief and comprehensive update about what's important to them. Only one card
is displayed on screen at a time, and background images are used to provide additional visual
information. Your application can create cards and inject them into the stream when they are most
likely to be useful.</p>
<p>Cards in the stream are more than simple notifications. They can be swiped horizontally to
reveal additional pages. Further horizontal swiping may reveal tappable buttons, allowing the user
to take action on the notification. Cards can also be dismissed by swiping left to right, removing
them from the stream until the next time they have useful information to display.
In the emulator, hovering the mouse over the top of the screen illuminates a blue bar at
the top of the device that takes you home when clicked.</p>
<h3 id="CueCard">Demand: The Cue Card</h3>
<div class="wear-inset-video-container" style="float:right;margin:0 -22px 60px 40px">
<img class="wear-bezel-only" src="/wear/images/screens/bezel.png" alt="">
<img class="gif" src="/wear/images/screens/cuecard.gif">
</div>
<p>For cases where the context stream can't anticipate what the user would like to do, the cue card
allows users to speak to their device. The cue card is opened by saying, "Ok Google" or by tapping
on the "g" icon on the home screen. Swiping up on the cue card shows a list of actions, which can
also be tapped.</p>
<p>The list of actions includes Android intents for voice actions. The upcoming Android Wear SDK
will enable developers to match their applications to these intents so users can perform actions
using these voice commands. Multiple applications may register for a single voice intent, and users
will have the opportunity to choose which application they prefer to use.</p>
</div>
<div class="content-footer layout-content-row"
itemscope itemtype="http://schema.org/SiteNavigationElement">
<div class="layout-content-col col-9" style="padding-top:4px">
<div class="g-plusone" data-size="medium"></div>
</div>
<div class="paging-links layout-content-col col-4">
</div>
</div>
</div> <!-- end jd-content -->
<div id="footer" class="wrap" >
<div id="copyright">
Except as noted, this content is
licensed under <a href="http://creativecommons.org/licenses/by/2.5/">
Creative Commons Attribution 2.5</a>. For details and
restrictions, see the <a href="/license.html">Content
License</a>.
</div>
<div id="footerlinks">
<p>
<a href="/about/index.html">About Android</a>&nbsp;&nbsp;|&nbsp;
<a href="/legal.html">Legal</a>&nbsp;&nbsp;|&nbsp;
<a href="/support.html">Support</a>
</p>
</div>
</div> <!-- end footer -->
</div><!-- end doc-content -->
</div> <!-- end body-content -->
<!-- Start of Tag -->
<script type="text/javascript">
var axel = Math.random() + "";
var a = axel * 10000000000000;
document.write('<iframe src="https://2507573.fls.doubleclick.net/activityi;src=2507573;type=other026;cat=googl348;ord=' + a + '?" width="1" height="1" frameborder="0" style="display:none"></iframe>');
</script>
<noscript>
<iframe src="https://2507573.fls.doubleclick.net/activityi;src=2507573;type=other026;cat=googl348;ord=1?" width="1" height="1" frameborder="0" style="display:none"></iframe>
</noscript>
<!-- End of Tag -->
</body>
</html>

View File

@@ -0,0 +1,58 @@
page.title=UI Overview
page.customHeadTag=<link rel="stylesheet" type="text/css" href="/wear/css/wear.css">
@jd:body
<style>
h3 {
padding:30px 0 10px;
}
</style>
<p>A new form factor deserves a new UI model. At a high level, the Android Wear UI consists of two
main spaces centered around the core functions of <strong>Suggest</strong> and
<strong>Demand</strong>. Your application will have an important role to play in both of these
spaces.</p>
<h3 id="Stream">Suggest: The Context Stream</h3>
<div class="wear-inset-video-container" style="float:right;margin:0 -22px 60px 40px">
<img class="wear-bezel-only" src="{@docRoot}wear/images/screens/bezel.png" alt="">
<img class="gif" src="{@docRoot}wear/images/screens/stream.gif">
</div>
<p>The context stream is a vertical list of cards, each showing a useful or timely piece of
information. Much like Google Now on Android phones and tablets, users swipe vertically to navigate
from card to card for a brief and comprehensive update about what's important to them. Only one card
is displayed on screen at a time, and background images are used to provide additional visual
information. Your application can create cards and inject them into the stream when they are most
likely to be useful.</p>
<p>Cards in the stream are more than simple notifications. They can be swiped horizontally to
reveal additional pages. Further horizontal swiping may reveal tappable buttons, allowing the user
to take action on the notification. Cards can also be dismissed by swiping left to right, removing
them from the stream until the next time they have useful information to display.
In the emulator, hovering the mouse over the top of the screen illuminates a blue bar at
the top of the device that takes you home when clicked.</p>
<h3 id="CueCard">Demand: The Cue Card</h3>
<div class="wear-inset-video-container" style="float:right;margin:0 -22px 60px 40px">
<img class="wear-bezel-only" src="{@docRoot}wear/images/screens/bezel.png" alt="">
<img class="gif" src="{@docRoot}wear/images/screens/cuecard.gif">
</div>
<p>For cases where the context stream can't anticipate what the user would like to do, the cue card
allows users to speak to their device. The cue card is opened by saying, "Ok Google" or by tapping
on the "g" icon on the home screen. Swiping up on the cue card shows a list of actions, which can
also be tapped.</p>
<p>The list of actions includes Android intents for voice actions. The upcoming Android Wear SDK
will enable developers to match their applications to these intents so users can perform actions
using these voice commands. Multiple applications may register for a single voice intent, and users
will have the opportunity to choose which application they prefer to use.</p>

View File

@@ -1,286 +1,12 @@
<!DOCTYPE html>
page.title=Android Wear
page.viewport-width=970
fullpage=true
no_footer_links=true
page.customHeadTag=<link rel="stylesheet" type="text/css" href="/wear/css/wear.css">
@jd:body
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=970" />
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
<title>Android Wear | Android Developers</title>
<!-- STYLESHEETS -->
<link rel="stylesheet"
href="//fonts.googleapis.com/css?family=Roboto:light,regular,medium,thin,italic,mediumitalic,bold" title="roboto">
<link href="/assets/css/default.css" rel="stylesheet" type="text/css">
<!-- JAVASCRIPT -->
<script src="//www.google.com/jsapi" type="text/javascript"></script>
<script src="/assets/js/android_3p-bundle.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="/wear/css/wear.css">
<script type="text/javascript">
var toRoot = "/";
var metaTags = [];
var devsite = false;
</script>
<script src="/assets/js/docs.js" type="text/javascript"></script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-5831155-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body class="gc-documentation
" itemscope itemtype="http://schema.org/Article">
<a name="top"></a>
<!-- Header -->
<div id="header">
<div class="wrap" id="header-wrap">
<div class="col-3 logo-wear">
<a href="/wear/index.html">
<img src="/wear/images/android-wear.png" height="16" alt="Android Wear" />
</a>
</div>
<div class="col-8" style="margin:0"><h1 style="margin:1px 0 0 20px;padding:0;line-height:16px;
color:#666;font-weight:100;font-size:24px;">Developer Preview</h1></div>
<!-- New Search -->
<div class="menu-container">
<div class="moremenu">
<div id="more-btn"></div>
</div>
<div class="morehover" id="moremenu">
<div class="top"></div>
<div class="mid">
<div class="header">Links</div>
<ul>
<li><a href="https://play.google.com/apps/publish/">Google Play Developer Console</a></li>
<li><a href="http://android-developers.blogspot.com/">Android Developers Blog</a></li>
<li><a href="/about/index.html">About Android</a></li>
</ul>
<div class="header">Android Sites</div>
<ul>
<li><a href="http://www.android.com">Android.com</a></li>
<li class="active"><a>Android Developers</a></li>
<li><a href="http://source.android.com">Android Open Source Project</a></li>
</ul>
<div class="header">Language</div>
<div id="language" class="locales">
<select name="language" onChange="changeLangPref(this.value, true)">
<option value="en">English</option>
<option value="es">Español</option>
<option value="ja">日本語</option>
<option value="ko">한국어</option>
<option value="ru">Русский</option>
<option value="zh-cn">中文 (中国)</option>
<option value="zh-tw">中文 (台灣)</option>
</select>
</div>
<script type="text/javascript">
<!--
loadLangPref();
//-->
</script>
<br class="clearfix" />
</div><!-- end mid -->
<div class="bottom"></div>
</div><!-- end morehover -->
<div class="search" id="search-container">
<div class="search-inner">
<div id="search-btn"></div>
<div class="left"></div>
<form onsubmit="return submit_search()">
<input id="search_autocomplete" type="text" value="" autocomplete="off" name="q"
onfocus="search_focus_changed(this, true)" onblur="search_focus_changed(this, false)"
onkeydown="return search_changed(event, true, '/')"
onkeyup="return search_changed(event, false, '/')" />
</form>
<div class="right"></div>
<a class="close hide">close</a>
<div class="left"></div>
<div class="right"></div>
</div>
</div><!-- end search -->
<div class="search_filtered_wrapper reference">
<div class="suggest-card reference no-display">
<ul class="search_filtered">
</ul>
</div>
</div>
<div class="search_filtered_wrapper docs">
<div class="suggest-card dummy no-display">&nbsp;</div>
<div class="suggest-card develop no-display">
<ul class="search_filtered">
</ul>
<div class="child-card guides no-display">
</div>
<div class="child-card training no-display">
</div>
<div class="child-card samples no-display">
</div>
</div>
<div class="suggest-card design no-display">
<ul class="search_filtered">
</ul>
</div>
<div class="suggest-card distribute no-display">
<ul class="search_filtered">
</ul>
</div>
</div><!-- end search_filtered_wrapper -->
</div>
<!-- end menu_container -->
</div><!-- end header-wrap -->
</div>
<!-- /Header -->
<div id="searchResults" class="wrap" style="display:none;">
<h2 id="searchTitle">Results</h2>
<div id="leftSearchControl" class="search-control">Loading...</div>
</div>
<div id="body-content">
<div class="fullpage" >
<div id="jd-content">
<div class="jd-descr" itemprop="articleBody">
<style>
<style>
.fullpage>#footer,
#jd-content>.content-footer.wrap {
display:none;
@@ -471,10 +197,10 @@ $("#icon-video-close").on("click", function() {
</div>
<p>
You can also trigger your notifications contextually using existing Android APIs. For example, use <a href="/training/location/geofencing.html">geofences</a> to provide glanceable information to your users when they are at home, or use the <a href="/training/location/activity-recognition.html">activity detection APIs</a> to send messages to your users wrists while they are bicycling.
You can also trigger your notifications contextually using existing Android APIs. For example, use <a href="{@docRoot}training/location/geofencing.html">geofences</a> to provide glanceable information to your users when they are at home, or use the <a href="{@docRoot}training/location/activity-recognition.html">activity detection APIs</a> to send messages to your users wrists while they are bicycling.
</p>
<p>See the <a href="/wear/design/index.html">Android Wear Developer Preview Design Principles</a> for more suggestions on creating great wearable experiences.</p>
<p>See the <a href="{@docRoot}wear/design/index.html">Android Wear Developer Preview Design Principles</a> for more suggestions on creating great wearable experiences.</p>
</div>
</div> <!-- end .wrap -->
@@ -677,63 +403,3 @@ $("#icon-video-close").on("click", function() {
});
</script>
</div>
<div class="content-footer wrap"
itemscope itemtype="http://schema.org/SiteNavigationElement">
<div class="layout-content-col col-16" style="padding-top:4px">
<style>#___plusone_0 {float:right !important;}</style>
<div class="g-plusone" data-size="medium"></div>
</div>
<div class="paging-links layout-content-col col-4">
</div>
</div>
</div> <!-- end jd-content -->
<div id="footer" class="wrap" style="width:940px">
<div id="copyright">
Except as noted, this content is
licensed under <a href="http://creativecommons.org/licenses/by/2.5/">
Creative Commons Attribution 2.5</a>. For details and
restrictions, see the <a href="/license.html">Content
License</a>.
</div>
</div> <!-- end footer -->
</div><!-- end doc-content -->
</div> <!-- end body-content -->
<!-- Start of Tag -->
<script type="text/javascript">
var axel = Math.random() + "";
var a = axel * 10000000000000;
document.write('<iframe src="https://2507573.fls.doubleclick.net/activityi;src=2507573;type=other026;cat=googl348;ord=' + a + '?" width="1" height="1" frameborder="0" style="display:none"></iframe>');
</script>
<noscript>
<iframe src="https://2507573.fls.doubleclick.net/activityi;src=2507573;type=other026;cat=googl348;ord=1?" width="1" height="1" frameborder="0" style="display:none"></iframe>
</noscript>
<!-- End of Tag -->
</body>
</html>

View File

@@ -1,379 +1,9 @@
<!DOCTYPE html>
page.title=Developer Preview License Agreement
@jd:body
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
<title>Developer Preview License Agreement | Android Developers</title>
<!-- STYLESHEETS -->
<link rel="stylesheet"
href="//fonts.googleapis.com/css?family=Roboto:light,regular,medium,thin,italic,mediumitalic,bold" title="roboto">
<link href="/assets/css/default.css" rel="stylesheet" type="text/css">
<!-- JAVASCRIPT -->
<script src="//www.google.com/jsapi" type="text/javascript"></script>
<script src="/assets/js/android_3p-bundle.js" type="text/javascript"></script>
<script type="text/javascript">
var toRoot = "/";
var metaTags = [];
var devsite = false;
</script>
<script src="/assets/js/docs.js" type="text/javascript"></script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-5831155-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body class="gc-documentation
" itemscope itemtype="http://schema.org/Article">
<a name="top"></a>
<!-- Header -->
<div id="header">
<div class="wrap" id="header-wrap">
<div class="col-3 logo-wear">
<a href="/wear/index.html">
<img src="/wear/images/android-wear.png" height="16" alt="Android Wear" />
</a>
</div>
<div class="col-8" style="margin:0"><h1 style="margin:1px 0 0 20px;padding:0;line-height:16px;
color:#666;font-weight:100;font-size:24px;">Developer Preview</h1></div>
<!-- New Search -->
<div class="menu-container">
<div class="moremenu">
<div id="more-btn"></div>
</div>
<div class="morehover" id="moremenu">
<div class="top"></div>
<div class="mid">
<div class="header">Links</div>
<ul>
<li><a href="https://play.google.com/apps/publish/">Google Play Developer Console</a></li>
<li><a href="http://android-developers.blogspot.com/">Android Developers Blog</a></li>
<li><a href="/about/index.html">About Android</a></li>
</ul>
<div class="header">Android Sites</div>
<ul>
<li><a href="http://www.android.com">Android.com</a></li>
<li class="active"><a>Android Developers</a></li>
<li><a href="http://source.android.com">Android Open Source Project</a></li>
</ul>
<div class="header">Language</div>
<div id="language" class="locales">
<select name="language" onChange="changeLangPref(this.value, true)">
<option value="en">English</option>
<option value="es">Español</option>
<option value="ja">日本語</option>
<option value="ko">한국어</option>
<option value="ru">Русский</option>
<option value="zh-cn">中文 (中国)</option>
<option value="zh-tw">中文 (台灣)</option>
</select>
</div>
<script type="text/javascript">
<!--
loadLangPref();
//-->
</script>
<br class="clearfix" />
</div><!-- end mid -->
<div class="bottom"></div>
</div><!-- end morehover -->
<div class="search" id="search-container">
<div class="search-inner">
<div id="search-btn"></div>
<div class="left"></div>
<form onsubmit="return submit_search()">
<input id="search_autocomplete" type="text" value="" autocomplete="off" name="q"
onfocus="search_focus_changed(this, true)" onblur="search_focus_changed(this, false)"
onkeydown="return search_changed(event, true, '/')"
onkeyup="return search_changed(event, false, '/')" />
</form>
<div class="right"></div>
<a class="close hide">close</a>
<div class="left"></div>
<div class="right"></div>
</div>
</div><!-- end search -->
<div class="search_filtered_wrapper reference">
<div class="suggest-card reference no-display">
<ul class="search_filtered">
</ul>
</div>
</div>
<div class="search_filtered_wrapper docs">
<div class="suggest-card dummy no-display">&nbsp;</div>
<div class="suggest-card develop no-display">
<ul class="search_filtered">
</ul>
<div class="child-card guides no-display">
</div>
<div class="child-card training no-display">
</div>
<div class="child-card samples no-display">
</div>
</div>
<div class="suggest-card design no-display">
<ul class="search_filtered">
</ul>
</div>
<div class="suggest-card distribute no-display">
<ul class="search_filtered">
</ul>
</div>
</div><!-- end search_filtered_wrapper -->
</div>
<!-- end menu_container -->
</div><!-- end header-wrap -->
</div>
<!-- /Header -->
<div id="searchResults" class="wrap" style="display:none;">
<h2 id="searchTitle">Results</h2>
<div id="leftSearchControl" class="search-control">Loading...</div>
</div>
<div class="wrap clearfix" id="body-content">
<div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
<div id="devdoc-nav" class="scroll-pane">
<a class="totop" href="#top" data-g-event="left-nav-top">to top</a>
<ul id="nav">
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/preview/start.html">Get Started
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/design/user-interface.html">UI Overview
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/design/index.html">Design Principles
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/notifications/creating.html">Creating Notifications for Android Wear
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/notifications/remote-input.html">Receiving Voice Input from a Notification
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/notifications/pages.html">Adding Pages to a Notification
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/notifications/stacks.html">Stacking Notifications
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header"><a href="/reference/android/preview/support/package-summary.html">Notification Reference</a></div>
<ul class="tree-list-children">
<li class="nav-section">
<div class="nav-section-header-ref"><span class="tree-list-subtitle package" title="android.preview.support.v4.app">android.preview.support.v4.app</span></div>
<ul>
<li><a href="/reference/android/preview/support/v4/app/NotificationManagerCompat.html">NotificationManagerCompat</a></li>
</ul>
</li>
<li class="nav-section">
<div class="nav-section-header-ref"><span class="tree-list-subtitle package" title="android.preview.support.wearable.notifications">android.preview.support.wearable.notifications</span></div>
<ul>
<li><a href="/reference/android/preview/support/wearable/notifications/RemoteInput.html">RemoteInput</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/RemoteInput.Builder.html" >RemoteInput.Builder</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.html">WearableNotifications</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Action.html">WearableNotifications.Action</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Action.Builder.html">WearableNotifications.Action.Builder</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html">WearableNotifications.Builder</a></li>
</ul>
</li>
</ul>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/license.html">License Agreement</a></div>
</li>
</ul>
</div>
</div> <!-- end side-nav -->
<script>
$(document).ready(function() {
scrollIntoView("devdoc-nav");
});
</script>
<div class="col-12" id="doc-col" >
<h1 itemprop="name" >Developer Preview License Agreement</h1>
<div id="jd-content">
<div class="jd-descr" itemprop="articleBody">
<div class="sdk-terms" style="height:auto;border:0;padding:0;width:700px">
<div class="sdk-terms" style="height:auto;border:0;padding:0;width:700px">
This is the Android Wear Developer Preview License Agreement.
1. Introduction
@@ -510,72 +140,3 @@ This is the Android Wear Developer Preview License Agreement.
14.7 This License Agreement, and your relationship with Google under this License Agreement, shall be governed by the laws of the State of California without regard to its conflict of laws provisions. You and Google agree to submit to the exclusive jurisdiction of the courts located within the county of Santa Clara, California to resolve any legal matter arising from this License Agreement. Notwithstanding this, you agree that Google shall still be allowed to apply for injunctive remedies (or an equivalent type of urgent legal relief) in any jurisdiction.
</div>
</div>
<div class="content-footer layout-content-row"
itemscope itemtype="http://schema.org/SiteNavigationElement">
<div class="layout-content-col col-9" style="padding-top:4px">
<div class="g-plusone" data-size="medium"></div>
</div>
<div class="paging-links layout-content-col col-4">
</div>
</div>
</div> <!-- end jd-content -->
<div id="footer" class="wrap" >
<div id="copyright">
Except as noted, this content is
licensed under <a href="http://creativecommons.org/licenses/by/2.5/">
Creative Commons Attribution 2.5</a>. For details and
restrictions, see the <a href="/license.html">Content
License</a>.
</div>
<div id="footerlinks">
<p>
<a href="/about/index.html">About Android</a>&nbsp;&nbsp;|&nbsp;
<a href="/legal.html">Legal</a>&nbsp;&nbsp;|&nbsp;
<a href="/support.html">Support</a>
</p>
</div>
</div> <!-- end footer -->
</div><!-- end doc-content -->
</div> <!-- end body-content -->
<!-- Start of Tag -->
<script type="text/javascript">
var axel = Math.random() + "";
var a = axel * 10000000000000;
document.write('<iframe src="https://2507573.fls.doubleclick.net/activityi;src=2507573;type=other026;cat=googl348;ord=' + a + '?" width="1" height="1" frameborder="0" style="display:none"></iframe>');
</script>
<noscript>
<iframe src="https://2507573.fls.doubleclick.net/activityi;src=2507573;type=other026;cat=googl348;ord=1?" width="1" height="1" frameborder="0" style="display:none"></iframe>
</noscript>
<!-- End of Tag -->
</body>
</html>

View File

@@ -1,722 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
<title>Creating Notifications for Android Wear | Android Developers</title>
<!-- STYLESHEETS -->
<link rel="stylesheet"
href="//fonts.googleapis.com/css?family=Roboto:light,regular,medium,thin,italic,mediumitalic,bold" title="roboto">
<link href="/assets/css/default.css" rel="stylesheet" type="text/css">
<!-- JAVASCRIPT -->
<script src="//www.google.com/jsapi" type="text/javascript"></script>
<script src="/assets/js/android_3p-bundle.js" type="text/javascript"></script>
<script type="text/javascript">
var toRoot = "/";
var metaTags = [];
var devsite = false;
</script>
<script src="/assets/js/docs.js" type="text/javascript"></script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-5831155-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body class="gc-documentation
" itemscope itemtype="http://schema.org/Article">
<a name="top"></a>
<!-- Header -->
<div id="header">
<div class="wrap" id="header-wrap">
<div class="col-3 logo-wear">
<a href="/wear/index.html">
<img src="/wear/images/android-wear.png" height="16" alt="Android Wear" />
</a>
</div>
<div class="col-8" style="margin:0"><h1 style="margin:1px 0 0 20px;padding:0;line-height:16px;
color:#666;font-weight:100;font-size:24px;">Developer Preview</h1></div>
<!-- New Search -->
<div class="menu-container">
<div class="moremenu">
<div id="more-btn"></div>
</div>
<div class="morehover" id="moremenu">
<div class="top"></div>
<div class="mid">
<div class="header">Links</div>
<ul>
<li><a href="https://play.google.com/apps/publish/">Google Play Developer Console</a></li>
<li><a href="http://android-developers.blogspot.com/">Android Developers Blog</a></li>
<li><a href="/about/index.html">About Android</a></li>
</ul>
<div class="header">Android Sites</div>
<ul>
<li><a href="http://www.android.com">Android.com</a></li>
<li class="active"><a>Android Developers</a></li>
<li><a href="http://source.android.com">Android Open Source Project</a></li>
</ul>
<div class="header">Language</div>
<div id="language" class="locales">
<select name="language" onChange="changeLangPref(this.value, true)">
<option value="en">English</option>
<option value="es">Español</option>
<option value="ja">日本語</option>
<option value="ko">한국어</option>
<option value="ru">Русский</option>
<option value="zh-cn">中文 (中国)</option>
<option value="zh-tw">中文 (台灣)</option>
</select>
</div>
<script type="text/javascript">
<!--
loadLangPref();
//-->
</script>
<br class="clearfix" />
</div><!-- end mid -->
<div class="bottom"></div>
</div><!-- end morehover -->
<div class="search" id="search-container">
<div class="search-inner">
<div id="search-btn"></div>
<div class="left"></div>
<form onsubmit="return submit_search()">
<input id="search_autocomplete" type="text" value="" autocomplete="off" name="q"
onfocus="search_focus_changed(this, true)" onblur="search_focus_changed(this, false)"
onkeydown="return search_changed(event, true, '/')"
onkeyup="return search_changed(event, false, '/')" />
</form>
<div class="right"></div>
<a class="close hide">close</a>
<div class="left"></div>
<div class="right"></div>
</div>
</div><!-- end search -->
<div class="search_filtered_wrapper reference">
<div class="suggest-card reference no-display">
<ul class="search_filtered">
</ul>
</div>
</div>
<div class="search_filtered_wrapper docs">
<div class="suggest-card dummy no-display">&nbsp;</div>
<div class="suggest-card develop no-display">
<ul class="search_filtered">
</ul>
<div class="child-card guides no-display">
</div>
<div class="child-card training no-display">
</div>
<div class="child-card samples no-display">
</div>
</div>
<div class="suggest-card design no-display">
<ul class="search_filtered">
</ul>
</div>
<div class="suggest-card distribute no-display">
<ul class="search_filtered">
</ul>
</div>
</div><!-- end search_filtered_wrapper -->
</div>
<!-- end menu_container -->
</div><!-- end header-wrap -->
</div>
<!-- /Header -->
<div id="searchResults" class="wrap" style="display:none;">
<h2 id="searchTitle">Results</h2>
<div id="leftSearchControl" class="search-control">Loading...</div>
</div>
<div class="wrap clearfix" id="body-content">
<div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
<div id="devdoc-nav" class="scroll-pane">
<a class="totop" href="#top" data-g-event="left-nav-top">to top</a>
<ul id="nav">
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/preview/start.html">Get Started
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/design/user-interface.html">UI Overview
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/design/index.html">Design Principles
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/notifications/creating.html">Creating Notifications for Android Wear
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/notifications/remote-input.html">Receiving Voice Input from a Notification
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/notifications/pages.html">Adding Pages to a Notification
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/notifications/stacks.html">Stacking Notifications
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header"><a href="/reference/android/preview/support/package-summary.html">Notification Reference</a></div>
<ul class="tree-list-children">
<li class="nav-section">
<div class="nav-section-header-ref"><span class="tree-list-subtitle package" title="android.preview.support.v4.app">android.preview.support.v4.app</span></div>
<ul>
<li><a href="/reference/android/preview/support/v4/app/NotificationManagerCompat.html">NotificationManagerCompat</a></li>
</ul>
</li>
<li class="nav-section">
<div class="nav-section-header-ref"><span class="tree-list-subtitle package" title="android.preview.support.wearable.notifications">android.preview.support.wearable.notifications</span></div>
<ul>
<li><a href="/reference/android/preview/support/wearable/notifications/RemoteInput.html">RemoteInput</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/RemoteInput.Builder.html" >RemoteInput.Builder</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.html">WearableNotifications</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Action.html">WearableNotifications.Action</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Action.Builder.html">WearableNotifications.Action.Builder</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html">WearableNotifications.Builder</a></li>
</ul>
</li>
</ul>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/license.html">License Agreement</a></div>
</li>
</ul>
</div>
</div> <!-- end side-nav -->
<script>
$(document).ready(function() {
scrollIntoView("devdoc-nav");
});
</script>
<div class="col-12" id="doc-col" >
<h1 itemprop="name" >Creating Notifications for Android Wear</h1>
<div id="jd-content">
<div class="jd-descr" itemprop="articleBody">
<p>When an Android device such as a phone or tablet is connected to an Android wearable,
all notifications are shared between the devices by default. On the Android wearable, each
notification appears as a new card in the <a href="/wear/design/user-interface.html#Stream"
>context stream</a>.</p>
<img src="/wear/images/notification_phone@2x.png" width="700" height="265" />
<p>So without any effort, your app notifications are available to users on Android Wear.
However, you can enhance the user experience in several ways. For instance,
if users may respond to a notification by entering text, such as to reply to
a message, you can add the ability for users to reply by voice directly from the
wearable.</p>
<p>To help you provide the best user experience
for your notifications on Android Wear, this guide shows you how to
build notifications using standard templates in
the <code><a href="/reference/android/support/v4/app/NotificationCompat.Builder.html">NotificationCompat.Builder</a></code> APIs, plus how to begin
extending your notification's capabilities for the wearable user experience.</p>
<p class="note"><strong>Note:</strong>
Notifications using <code><a href="/reference/android/widget/RemoteViews.html">RemoteViews</a></code> are stripped of custom
layouts and the system uses only the text and icons in the
<code><a href="/reference/android/app/Notification.html">Notification</a></code> object to
display the notification in a card. However, custom card layouts will be supported by
the official Android Wear SDK that is coming later.</p>
</div>
<h2 id="Import">Import the Necessary Classes</h2>
<p>To begin development, you must first complete the instructions in the <a
href="/wear/preview/start">Get Started with the Developer Preview</a> document.
As mentioned in that document, your app must include
both the <a href="http://developer.android.com/tools/support-library/features.html#v4">v4 support
library</a> and the Developer Preview support library. So to get started,
you should include the following imports in your project code:</p>
<pre>
import android.preview.support.wearable.notifications.*;
import android.preview.support.v4.app.NotificationManagerCompat;
import android.support.v4.app.NotificationCompat;
</pre>
<p class="caution"><strong>Caution:</strong>
The APIs in the current Android Wear Developer Preview are intended for <b>development and testing purposes only</b>, not for production apps. Google may change this Developer Preview significantly prior to the official release of the Android Wear SDK. You may not publicly distribute or ship any application using this Developer Preview, as this Developer Preview will no longer be supported after the official SDK is released (which will cause applications based only on the Developer Preview to break).</p>
<h2 id="NotificationBuilder">Create Notifications with the Notification Builder</h2>
<p>The <a href="http://developer.android.com/tools/support-library/features.html#v4">v4
support library</a> allows you to create notifications using the latest notification features
such as action buttons and large icons, while remaining compatible with Android 1.6 (API level
4) and higher.</p>
<p>For example, here's some code that creates and issues a notification using the
<code><a href="/reference/android/support/v4/app/NotificationCompat.html">NotificationCompat</a></code> APIs combined with the new
<a href="/reference/android/preview/support/v4/app/NotificationManagerCompat.html">
<code>NotificationManagerCompat</code></a> API:</p>
<pre>
int notificationId = 001;
// Build intent for notification content
Intent viewIntent = new Intent(this, ViewEventActivity.class);
viewIntent.putExtra(EXTRA_EVENT_ID, eventId);
PendingIntent viewPendingIntent =
PendingIntent.getActivity(this, 0, viewIntent, 0);
NotificationCompat.Builder notificationBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_event)
.setContentTitle(eventTitle)
.setContentText(eventLocation)
.setContentIntent(viewPendingIntent);
// Get an instance of the NotificationManager service
NotificationManagerCompat notificationManager =
NotificationManagerCompat.from(this);
// Build the notification and issues it with notification manager.
notificationManager.notify(notificationId, notificationBuilder.build());
</pre>
<p>When this notification appears on a handheld device, the user can invoke the
<code><a href="/reference/android/app/PendingIntent.html">PendingIntent</a></code>
specified by the <code><a href="/reference/android/support/v4/app/NotificationCompat.Builder.html#setContentIntent(android.app.PendingIntent)">setContentIntent()</a></code> method by touching the notification. When this
notification appears on an Android wearable, the user can swipe the notification to the left to
reveal the <strong>Open</strong> action, which invokes the intent on the handheld device.</p>
<img src="/wear/images/circle_email_action.png" height="200" style="float:right;clear:right;margin:0 0 20px 60px" />
<h2 id="ActionButtons">Add Action Buttons</h2>
<p>In addition to the primary content action defined by
<code><a href="/reference/android/support/v4/app/NotificationCompat.Builder.html#setContentIntent(android.app.PendingIntent)">setContentIntent()</a></code>, you can add other actions by passing a <code><a href="/reference/android/app/PendingIntent.html">PendingIntent</a></code> to
the <code><a href="/reference/android/support/v4/app/NotificationCompat.Builder.html#addAction(int, java.lang.CharSequence, android.app.PendingIntent)">addAction()</a></code> method.</p>
<p>For example, the following code shows the same type of notification from above, but adds an
action to view the event location on a map.</p>
<pre style="clear:right">
// Build an intent for an action to view a map
Intent mapIntent = new Intent(Intent.ACTION_VIEW);
Uri geoUri = Uri.parse("geo:0,0?q=" + Uri.encode(location));
mapIntent.setData(geoUri);
PendingIntent mapPendingIntent =
PendingIntent.getActivity(this, 0, mapIntent, 0);
NotificationCompat.Builder notificationBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_event)
.setContentTitle(eventTitle)
.setContentText(eventLocation)
.setContentIntent(viewPendingIntent)
<b>.addAction(R.drawable.ic_map,
getString(R.string.map), mapPendingIntent);</b>
</pre>
<p>On a handheld device, the action appears as an
additional button attached to the notification. On an Android wearable, the action appears as
a large button when the user swipes the notification to the left. When the user taps the action,
the associated <code><a href="/reference/android/content/Intent.html">Intent</a></code> is invoked on the handheld device.</p>
<p class="note"><strong>Tip:</strong> If your notifications includes a "Reply" action
(such as for a messaging app), you can enhance the behavior by enabling
voice input replies directly from the Android wearable. For more information, read
<a href="/wear/notifications/remote-input.html">Receiving Voice Input from a Notification</a>.
</p>
<p>For details about designing action buttons (including the icon specifications), see the
<a href="/wear/design/index.html#NotifictionActions">Design Principles of Android
Wear</a>.</p>
<h2 id="BigView">Add a Big View</h2>
<img src="/wear/images/06_images.png" height="200" style="float:right;margin:0 0 20px 40px" />
<p>You can insert extended text content
to your notification by adding one of the "big view" styles to your notification. On a
handheld device, users can see the big view content by expanding the notification,
while on Android Wear, the big view content is visible by default.</p>
<p>To add the extended content to your notification, call <code><a href="/reference/android/support/v4/app/NotificationCompat.Builder.html#setStyle(android.support.v4.app.NotificationCompat.Style)">setStyle()</a></code> on the <code><a href="/reference/android/support/v4/app/NotificationCompat.Builder.html">NotificationCompat.Builder</a></code> object, passing it an instance of either
<code><a href="/reference/android/support/v4/app/NotificationCompat.BigTextStyle.html">BigTextStyle</a></code> or
<code><a href="/reference/android/support/v4/app/NotificationCompat.InboxStyle.html">InboxStyle</a></code>.</p>
<p>For example, the following code adds an instance of
<code><a href="/reference/android/support/v4/app/NotificationCompat.BigTextStyle.html">NotificationCompat.BigTextStyle</a></code> to the event notification,
in order to include the complete event description (which includes more text than can fit
into the space provided for <code><a href="/reference/android/support/v4/app/NotificationCompat.Builder.html#setContentText(java.lang.CharSequence)">setContentText()</a></code>).</p>
<pre style="clear:right">
// Specify the 'big view' content to display the long
// event description that may not fit the normal content text.
BigTextStyle bigStyle = new NotificationCompat.BigTextStyle();
bigStyle.bigText(eventDescription);
NotificationCompat.Builder notificationBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_event)
.setLargeIcon(BitmapFractory.decodeResource(
getResources(), R.drawable.notif_background))
.setContentTitle(eventTitle)
.setContentText(eventLocation)
.setContentIntent(viewPendingIntent)
.addAction(R.drawable.ic_map,
getString(R.string.map), mapPendingIntent)
<b>.setStyle(bigStyle);</b>
</pre>
<p>Notice that you can add a large background image to any notification using the
<code><a href="/reference/android/support/v4/app/NotificationCompat.Builder.html#setLargeIcon(android.graphics.Bitmap)">setLargeIcon()</a></code>
method. For more information about designing notifications with large images, see the
<a href="/wear/design/index.html#Images">Design Principles of Android
Wear</a>.</p>
<h2 id="NewFeatures">Add New Features for Wearables</h2>
<p>The Android Wear preview support library provides new APIs that
allow you to enhance the user experience for notifications on a wearable device. For example,
you can add additional pages of content that users can view by swiping to the left, or add the ability
for users to deliver your app a text response using voice input.</p>
<p>To use these new APIs, pass your instance of
<code><a href="/reference/android/support/v4/app/NotificationCompat.Builder.html">NotificationCompat.Builder</a></code> to the
<a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html#WearableNotifications.Builder(android.content.Context)"> <code>WearableNotifications.Builder()</code></a> constructor. You can then add new
features to your notification using the
<a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html"
><code>WearableNotifications.Builder</code></a> methods. For example:</p>
<pre>
// Create a NotificationCompat.Builder for standard notification features
NotificationCompat.Builder notificationBuilder =
new NotificationCompat.Builder(mContext)
.setContentTitle("New mail from " + sender.toString())
.setContentText(subject)
.setSmallIcon(R.drawable.new_mail);
// Create a WearablesNotification.Builder to add special functionality for wearables
Notification notification =
new WearableNotifications.Builder(notificationBuilder)
.setHintHideIcon(true)
.build();
</pre>
<p>The <a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html#setBigActionIcon(int)">
<code>setHintHideIcon()</code></a> method removes your app icon from the notification card.
This method is just one example of new notification features available from the
<a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html"
><code>WearableNotifications.Builder</code></a> class.</p>
<p>When you want to deliver your notifications, be certain to always use the
<a href="/reference/android/preview/support/v4/app/NotificationManagerCompat.html">
<code>NotificationManagerCompat</code></a> API:</p>
<pre>
// Get an instance of the NotificationManager service
NotificationManagerCompat notificationManager =
NotificationManagerCompat.from(this);
// Build the notification and issues it with notification manager.
notificationManager.notify(notificationId, notification);
</pre>
<p>If you instead use the framework's <code><a href="/reference/android/app/NotificationManager.html">NotificationManager</a></code>, some
features from <a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html"><code>WearableNotifications.Builder</code></a>
will not work.</p>
<p>To continue enhancing your notifications for wearables using
<a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html"
><code>WearableNotifications.Builder</code></a> and other APIs in the
preview support library, see the following developer guides:</p>
<dl>
<dt><a href="/wear/notifications/remote-input.html">Receiving Voice Input
from a Notification</a></dt>
<dd>Add an action that receives voice input from the user and delivers the
transcribed message to your app.</dd>
<dt><a href="/wear/notifications/pages.html">Adding Pages to a Notification</a></dt>
<dd>Add additional pages of information that are visible when the user
swipes to the left.</dd>
<dt><a href="/wear/notifications/stacks.html">Stacking Notifications</a></dt>
<dd>Place all similar notifications from your app in a stack, allowing each to be
viewed individually without adding multiple cards to the card stream.</dd>
</dl>
<div class="next-docs">
<div class="col-12">
<h2 class="norule">You might also want to read:</h2>
<dl>
<dt><a href="/training/notify-user/index.html">Notifying the User</a></dt>
<dd>Learn more about how to create notifications.</dd>
<dt><a href="/guide/components/intents-filters.html">Intents and Intent Filters</a></dt>
<dd>Learn everything you need to know about the <code><a href="/reference/android/content/Intent.html">Intent</a></code>
APIs, used by notificaton actions.</dd>
</dl>
</div>
</div>
</body>
</html>
</div>
<div class="content-footer layout-content-row"
itemscope itemtype="http://schema.org/SiteNavigationElement">
<div class="layout-content-col col-9" style="padding-top:4px">
<div class="g-plusone" data-size="medium"></div>
</div>
<div class="paging-links layout-content-col col-4">
</div>
</div>
</div> <!-- end jd-content -->
<div id="footer" class="wrap" >
<div id="copyright">
Except as noted, this content is
licensed under <a href="http://creativecommons.org/licenses/by/2.5/">
Creative Commons Attribution 2.5</a>. For details and
restrictions, see the <a href="/license.html">Content
License</a>.
</div>
<div id="footerlinks">
<p>
<a href="/about/index.html">About Android</a>&nbsp;&nbsp;|&nbsp;
<a href="/legal.html">Legal</a>&nbsp;&nbsp;|&nbsp;
<a href="/support.html">Support</a>
</p>
</div>
</div> <!-- end footer -->
</div><!-- end doc-content -->
</div> <!-- end body-content -->
<!-- Start of Tag -->
<script type="text/javascript">
var axel = Math.random() + "";
var a = axel * 10000000000000;
document.write('<iframe src="https://2507573.fls.doubleclick.net/activityi;src=2507573;type=other026;cat=googl348;ord=' + a + '?" width="1" height="1" frameborder="0" style="display:none"></iframe>');
</script>
<noscript>
<iframe src="https://2507573.fls.doubleclick.net/activityi;src=2507573;type=other026;cat=googl348;ord=1?" width="1" height="1" frameborder="0" style="display:none"></iframe>
</noscript>
<!-- End of Tag -->
</body>
</html>

View File

@@ -0,0 +1,289 @@
page.title=Creating Notifications for Android Wear
@jd:body
<p>When an Android device such as a phone or tablet is connected to an Android wearable,
all notifications are shared between the devices by default. On the Android wearable, each
notification appears as a new card in the <a href="{@docRoot}wear/design/user-interface.html#Stream"
>context stream</a>.</p>
<img src="{@docRoot}wear/images/notification_phone@2x.png" width="700" height="265" />
<p>So without any effort, your app notifications are available to users on Android Wear.
However, you can enhance the user experience in several ways. For instance,
if users may respond to a notification by entering text, such as to reply to
a message, you can add the ability for users to reply by voice directly from the
wearable.</p>
<p>To help you provide the best user experience
for your notifications on Android Wear, this guide shows you how to
build notifications using standard templates in
the {@link android.support.v4.app.NotificationCompat.Builder} APIs, plus how to begin
extending your notification's capabilities for the wearable user experience.</p>
<p class="note"><strong>Note:</strong>
Notifications using {@link android.widget.RemoteViews} are stripped of custom
layouts and the system uses only the text and icons in the
{@link android.app.Notification} object to
display the notification in a card. However, custom card layouts will be supported by
the official Android Wear SDK that is coming later.</p>
</div>
<h2 id="Import">Import the Necessary Classes</h2>
<p>To begin development, you must first complete the instructions in the <a
href="{@docRoot}wear/preview/start">Get Started with the Developer Preview</a> document.
As mentioned in that document, your app must include
both the <a href="http://developer.android.com/tools/support-library/features.html#v4">v4 support
library</a> and the Developer Preview support library. So to get started,
you should include the following imports in your project code:</p>
<pre>
import android.preview.support.wearable.notifications.*;
import android.preview.support.v4.app.NotificationManagerCompat;
import android.support.v4.app.NotificationCompat;
</pre>
<p class="caution"><strong>Caution:</strong>
The APIs in the current Android Wear Developer Preview are intended for <b>development and testing purposes only</b>, not for production apps. Google may change this Developer Preview significantly prior to the official release of the Android Wear SDK. You may not publicly distribute or ship any application using this Developer Preview, as this Developer Preview will no longer be supported after the official SDK is released (which will cause applications based only on the Developer Preview to break).</p>
<h2 id="NotificationBuilder">Create Notifications with the Notification Builder</h2>
<p>The <a href="http://developer.android.com/tools/support-library/features.html#v4">v4
support library</a> allows you to create notifications using the latest notification features
such as action buttons and large icons, while remaining compatible with Android 1.6 (API level
4) and higher.</p>
<p>For example, here's some code that creates and issues a notification using the
{@link android.support.v4.app.NotificationCompat} APIs combined with the new
<a href="{@docRoot}reference/android/preview/support/v4/app/NotificationManagerCompat.html">
<code>NotificationManagerCompat</code></a> API:</p>
<pre>
int notificationId = 001;
// Build intent for notification content
Intent viewIntent = new Intent(this, ViewEventActivity.class);
viewIntent.putExtra(EXTRA_EVENT_ID, eventId);
PendingIntent viewPendingIntent =
PendingIntent.getActivity(this, 0, viewIntent, 0);
NotificationCompat.Builder notificationBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_event)
.setContentTitle(eventTitle)
.setContentText(eventLocation)
.setContentIntent(viewPendingIntent);
// Get an instance of the NotificationManager service
NotificationManagerCompat notificationManager =
NotificationManagerCompat.from(this);
// Build the notification and issues it with notification manager.
notificationManager.notify(notificationId, notificationBuilder.build());
</pre>
<p>When this notification appears on a handheld device, the user can invoke the
{@link android.app.PendingIntent}
specified by the {@link android.support.v4.app.NotificationCompat.Builder#setContentIntent
setContentIntent()} method by touching the notification. When this
notification appears on an Android wearable, the user can swipe the notification to the left to
reveal the <strong>Open</strong> action, which invokes the intent on the handheld device.</p>
<img src="{@docRoot}wear/images/circle_email_action.png" height="200" style="float:right;clear:right;margin:0 0 20px 60px" />
<h2 id="ActionButtons">Add Action Buttons</h2>
<p>In addition to the primary content action defined by
{@link android.support.v4.app.NotificationCompat.Builder#setContentIntent
setContentIntent()}, you can add other actions by passing a {@link android.app.PendingIntent} to
the {@link android.support.v4.app.NotificationCompat.Builder#addAction
addAction()} method.</p>
<p>For example, the following code shows the same type of notification from above, but adds an
action to view the event location on a map.</p>
<pre style="clear:right">
// Build an intent for an action to view a map
Intent mapIntent = new Intent(Intent.ACTION_VIEW);
Uri geoUri = Uri.parse("geo:0,0?q=" + Uri.encode(location));
mapIntent.setData(geoUri);
PendingIntent mapPendingIntent =
PendingIntent.getActivity(this, 0, mapIntent, 0);
NotificationCompat.Builder notificationBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_event)
.setContentTitle(eventTitle)
.setContentText(eventLocation)
.setContentIntent(viewPendingIntent)
<b>.addAction(R.drawable.ic_map,
getString(R.string.map), mapPendingIntent);</b>
</pre>
<p>On a handheld device, the action appears as an
additional button attached to the notification. On an Android wearable, the action appears as
a large button when the user swipes the notification to the left. When the user taps the action,
the associated {@link android.content.Intent} is invoked on the handheld device.</p>
<p class="note"><strong>Tip:</strong> If your notifications includes a "Reply" action
(such as for a messaging app), you can enhance the behavior by enabling
voice input replies directly from the Android wearable. For more information, read
<a href="{@docRoot}wear/notifications/remote-input.html">Receiving Voice Input from a Notification</a>.
</p>
<p>For details about designing action buttons (including the icon specifications), see the
<a href="{@docRoot}wear/design/index.html#NotifictionActions">Design Principles of Android
Wear</a>.</p>
<h2 id="BigView">Add a Big View</h2>
<img src="{@docRoot}wear/images/06_images.png" height="200" style="float:right;margin:0 0 20px 40px" />
<p>You can insert extended text content
to your notification by adding one of the "big view" styles to your notification. On a
handheld device, users can see the big view content by expanding the notification,
while on Android Wear, the big view content is visible by default.</p>
<p>To add the extended content to your notification, call {@link
android.support.v4.app.NotificationCompat.Builder#setStyle setStyle()} on the {@link
android.support.v4.app.NotificationCompat.Builder} object, passing it an instance of either
{@link android.support.v4.app.NotificationCompat.BigTextStyle BigTextStyle} or
{@link android.support.v4.app.NotificationCompat.InboxStyle InboxStyle}.</p>
<p>For example, the following code adds an instance of
{@link android.support.v4.app.NotificationCompat.BigTextStyle} to the event notification,
in order to include the complete event description (which includes more text than can fit
into the space provided for {@link android.support.v4.app.NotificationCompat.Builder#setContentText
setContentText()}).</p>
<pre style="clear:right">
// Specify the 'big view' content to display the long
// event description that may not fit the normal content text.
BigTextStyle bigStyle = new NotificationCompat.BigTextStyle();
bigStyle.bigText(eventDescription);
NotificationCompat.Builder notificationBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_event)
.setLargeIcon(BitmapFractory.decodeResource(
getResources(), R.drawable.notif_background))
.setContentTitle(eventTitle)
.setContentText(eventLocation)
.setContentIntent(viewPendingIntent)
.addAction(R.drawable.ic_map,
getString(R.string.map), mapPendingIntent)
<b>.setStyle(bigStyle);</b>
</pre>
<p>Notice that you can add a large background image to any notification using the
{@link android.support.v4.app.NotificationCompat.Builder#setLargeIcon setLargeIcon()}
method. For more information about designing notifications with large images, see the
<a href="{@docRoot}wear/design/index.html#Images">Design Principles of Android
Wear</a>.</p>
<h2 id="NewFeatures">Add New Features for Wearables</h2>
<p>The Android Wear preview support library provides new APIs that
allow you to enhance the user experience for notifications on a wearable device. For example,
you can add additional pages of content that users can view by swiping to the left, or add the ability
for users to deliver your app a text response using voice input.</p>
<p>To use these new APIs, pass your instance of
{@link android.support.v4.app.NotificationCompat.Builder} to the
<a href="{@docRoot}reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html#WearableNotifications.Builder(android.content.Context)"> <code>WearableNotifications.Builder()</code></a> constructor. You can then add new
features to your notification using the
<a href="{@docRoot}reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html"
><code>WearableNotifications.Builder</code></a> methods. For example:</p>
<pre>
// Create a NotificationCompat.Builder for standard notification features
NotificationCompat.Builder notificationBuilder =
new NotificationCompat.Builder(mContext)
.setContentTitle("New mail from " + sender.toString())
.setContentText(subject)
.setSmallIcon(R.drawable.new_mail);
// Create a WearablesNotification.Builder to add special functionality for wearables
Notification notification =
new WearableNotifications.Builder(notificationBuilder)
.setHintHideIcon(true)
.build();
</pre>
<p>The <a href="{@docRoot}reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html#setBigActionIcon(int)">
<code>setHintHideIcon()</code></a> method removes your app icon from the notification card.
This method is just one example of new notification features available from the
<a href="{@docRoot}reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html"
><code>WearableNotifications.Builder</code></a> class.</p>
<p>When you want to deliver your notifications, be certain to always use the
<a href="{@docRoot}reference/android/preview/support/v4/app/NotificationManagerCompat.html">
<code>NotificationManagerCompat</code></a> API:</p>
<pre>
// Get an instance of the NotificationManager service
NotificationManagerCompat notificationManager =
NotificationManagerCompat.from(this);
// Build the notification and issues it with notification manager.
notificationManager.notify(notificationId, notification);
</pre>
<p>If you instead use the framework's {@link android.app.NotificationManager}, some
features from <a href="{@docRoot}reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html"><code>WearableNotifications.Builder</code></a>
will not work.</p>
<p>To continue enhancing your notifications for wearables using
<a href="{@docRoot}reference/android/preview/support/wearable/notifications/WearableNotifications.Builder"
><code>WearableNotifications.Builder</code></a> and other APIs in the
preview support library, see the following developer guides:</p>
<dl>
<dt><a href="{@docRoot}wear/notifications/remote-input.html">Receiving Voice Input
from a Notification</a></dt>
<dd>Add an action that receives voice input from the user and delivers the
transcribed message to your app.</dd>
<dt><a href="{@docRoot}wear/notifications/pages.html">Adding Pages to a Notification</a></dt>
<dd>Add additional pages of information that are visible when the user
swipes to the left.</dd>
<dt><a href="{@docRoot}wear/notifications/stacks.html">Stacking Notifications</a></dt>
<dd>Place all similar notifications from your app in a stack, allowing each to be
viewed individually without adding multiple cards to the card stream.</dd>
</dl>
<div class="next-docs">
<div class="col-12">
<h2 class="norule">You might also want to read:</h2>
<dl>
<dt><a href="{@docRoot}training/notify-user/index.html">Notifying the User</a></dt>
<dd>Learn more about how to create notifications.</dd>
<dt><a href="{@docRoot}guide/components/intents-filters.html">Intents and Intent Filters</a></dt>
<dd>Learn everything you need to know about the {@link android.content.Intent}
APIs, used by notificaton actions.</dd>
</dl>
</div>
</div>
</body>
</html>

View File

@@ -1,500 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
<title>Adding Pages to a Notification | Android Developers</title>
<!-- STYLESHEETS -->
<link rel="stylesheet"
href="//fonts.googleapis.com/css?family=Roboto:light,regular,medium,thin,italic,mediumitalic,bold" title="roboto">
<link href="/assets/css/default.css" rel="stylesheet" type="text/css">
<!-- JAVASCRIPT -->
<script src="//www.google.com/jsapi" type="text/javascript"></script>
<script src="/assets/js/android_3p-bundle.js" type="text/javascript"></script>
<script type="text/javascript">
var toRoot = "/";
var metaTags = [];
var devsite = false;
</script>
<script src="/assets/js/docs.js" type="text/javascript"></script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-5831155-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body class="gc-documentation
" itemscope itemtype="http://schema.org/Article">
<a name="top"></a>
<!-- Header -->
<div id="header">
<div class="wrap" id="header-wrap">
<div class="col-3 logo-wear">
<a href="/wear/index.html">
<img src="/wear/images/android-wear.png" height="16" alt="Android Wear" />
</a>
</div>
<div class="col-8" style="margin:0"><h1 style="margin:1px 0 0 20px;padding:0;line-height:16px;
color:#666;font-weight:100;font-size:24px;">Developer Preview</h1></div>
<!-- New Search -->
<div class="menu-container">
<div class="moremenu">
<div id="more-btn"></div>
</div>
<div class="morehover" id="moremenu">
<div class="top"></div>
<div class="mid">
<div class="header">Links</div>
<ul>
<li><a href="https://play.google.com/apps/publish/">Google Play Developer Console</a></li>
<li><a href="http://android-developers.blogspot.com/">Android Developers Blog</a></li>
<li><a href="/about/index.html">About Android</a></li>
</ul>
<div class="header">Android Sites</div>
<ul>
<li><a href="http://www.android.com">Android.com</a></li>
<li class="active"><a>Android Developers</a></li>
<li><a href="http://source.android.com">Android Open Source Project</a></li>
</ul>
<div class="header">Language</div>
<div id="language" class="locales">
<select name="language" onChange="changeLangPref(this.value, true)">
<option value="en">English</option>
<option value="es">Español</option>
<option value="ja">日本語</option>
<option value="ko">한국어</option>
<option value="ru">Русский</option>
<option value="zh-cn">中文 (中国)</option>
<option value="zh-tw">中文 (台灣)</option>
</select>
</div>
<script type="text/javascript">
<!--
loadLangPref();
//-->
</script>
<br class="clearfix" />
</div><!-- end mid -->
<div class="bottom"></div>
</div><!-- end morehover -->
<div class="search" id="search-container">
<div class="search-inner">
<div id="search-btn"></div>
<div class="left"></div>
<form onsubmit="return submit_search()">
<input id="search_autocomplete" type="text" value="" autocomplete="off" name="q"
onfocus="search_focus_changed(this, true)" onblur="search_focus_changed(this, false)"
onkeydown="return search_changed(event, true, '/')"
onkeyup="return search_changed(event, false, '/')" />
</form>
<div class="right"></div>
<a class="close hide">close</a>
<div class="left"></div>
<div class="right"></div>
</div>
</div><!-- end search -->
<div class="search_filtered_wrapper reference">
<div class="suggest-card reference no-display">
<ul class="search_filtered">
</ul>
</div>
</div>
<div class="search_filtered_wrapper docs">
<div class="suggest-card dummy no-display">&nbsp;</div>
<div class="suggest-card develop no-display">
<ul class="search_filtered">
</ul>
<div class="child-card guides no-display">
</div>
<div class="child-card training no-display">
</div>
<div class="child-card samples no-display">
</div>
</div>
<div class="suggest-card design no-display">
<ul class="search_filtered">
</ul>
</div>
<div class="suggest-card distribute no-display">
<ul class="search_filtered">
</ul>
</div>
</div><!-- end search_filtered_wrapper -->
</div>
<!-- end menu_container -->
</div><!-- end header-wrap -->
</div>
<!-- /Header -->
<div id="searchResults" class="wrap" style="display:none;">
<h2 id="searchTitle">Results</h2>
<div id="leftSearchControl" class="search-control">Loading...</div>
</div>
<div class="wrap clearfix" id="body-content">
<div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
<div id="devdoc-nav" class="scroll-pane">
<a class="totop" href="#top" data-g-event="left-nav-top">to top</a>
<ul id="nav">
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/preview/start.html">Get Started
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/design/user-interface.html">UI Overview
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/design/index.html">Design Principles
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/notifications/creating.html">Creating Notifications for Android Wear
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/notifications/remote-input.html">Receiving Voice Input from a Notification
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/notifications/pages.html">Adding Pages to a Notification
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/notifications/stacks.html">Stacking Notifications
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header"><a href="/reference/android/preview/support/package-summary.html">Notification Reference</a></div>
<ul class="tree-list-children">
<li class="nav-section">
<div class="nav-section-header-ref"><span class="tree-list-subtitle package" title="android.preview.support.v4.app">android.preview.support.v4.app</span></div>
<ul>
<li><a href="/reference/android/preview/support/v4/app/NotificationManagerCompat.html">NotificationManagerCompat</a></li>
</ul>
</li>
<li class="nav-section">
<div class="nav-section-header-ref"><span class="tree-list-subtitle package" title="android.preview.support.wearable.notifications">android.preview.support.wearable.notifications</span></div>
<ul>
<li><a href="/reference/android/preview/support/wearable/notifications/RemoteInput.html">RemoteInput</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/RemoteInput.Builder.html" >RemoteInput.Builder</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.html">WearableNotifications</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Action.html">WearableNotifications.Action</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Action.Builder.html">WearableNotifications.Action.Builder</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html">WearableNotifications.Builder</a></li>
</ul>
</li>
</ul>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/license.html">License Agreement</a></div>
</li>
</ul>
</div>
</div> <!-- end side-nav -->
<script>
$(document).ready(function() {
scrollIntoView("devdoc-nav");
});
</script>
<div class="col-12" id="doc-col" >
<h1 itemprop="name" >Adding Pages to a Notification</h1>
<div id="jd-content">
<div class="jd-descr" itemprop="articleBody">
<img src="/wear/images/09_pages.png" height="200" style="float:right;margin:0 0 20px 40px" />
<img src="/wear/images/08_pages.png" height="200" style="float:right;margin:0 0 20px 40px" />
<p>When you'd like to provide more information without requiring users
to open your app on their handheld device, you can
add one or more pages to the notification on Android Wear. The additional pages
appear immediately to the right of the main notification card.
For information about when to use and how to design
multiple pages, see the
<a href="/wear/design/index.html#NotificationPages">Design Principles of Android
Wear</a>.</p>
<p>When creating a notification with multiple pages, start by creating the main notification
(the first page) the way you'd like the notification to appear on a phone
or tablet. Then, add pages one at a time with the
<a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html#addPage(android.app.Notification)">
<code>addPage()</code></a> method, or add multiple pages in a <code><a href="/reference/java/util/Collection.html">Collection</a></code> with the
<a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html#addPages(java.util.Collection<android.app.Notification>)">
<code>addPages()</code></a> method.</p>
<p>For example, here's some code that adds a second page to a notification:</p>
<pre>
// Create builder for the main notification
NotificationCompat.Builder notificationBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.new_message)
.setContentTitle("Page 1")
.setContentText("Short message")
.setContentIntent(viewPendingIntent);
// Create a big text style for the second page
BigTextStyle secondPageStyle = new NotificationCompat.BigTextStyle();
secondPageStyle.setBigContentTitle("Page 2")
.bigText("A lot of text...");
// Create second page notification
Notification secondPageNotification =
new NotificationCompat.Builder(this)
.setStyle(secondPageStyle)
.build();
// Create main notification and add the second page
Notification twoPageNotification =
new WearableNotifications.Builder(notificationBuilder)
.addPage(secondPageNotification)
.build();
</pre>
</body>
</html>
</div>
<div class="content-footer layout-content-row"
itemscope itemtype="http://schema.org/SiteNavigationElement">
<div class="layout-content-col col-9" style="padding-top:4px">
<div class="g-plusone" data-size="medium"></div>
</div>
<div class="paging-links layout-content-col col-4">
</div>
</div>
</div> <!-- end jd-content -->
<div id="footer" class="wrap" >
<div id="copyright">
Except as noted, this content is
licensed under <a href="http://creativecommons.org/licenses/by/2.5/">
Creative Commons Attribution 2.5</a>. For details and
restrictions, see the <a href="/license.html">Content
License</a>.
</div>
<div id="footerlinks">
<p>
<a href="/about/index.html">About Android</a>&nbsp;&nbsp;|&nbsp;
<a href="/legal.html">Legal</a>&nbsp;&nbsp;|&nbsp;
<a href="/support.html">Support</a>
</p>
</div>
</div> <!-- end footer -->
</div><!-- end doc-content -->
</div> <!-- end body-content -->
<!-- Start of Tag -->
<script type="text/javascript">
var axel = Math.random() + "";
var a = axel * 10000000000000;
document.write('<iframe src="https://2507573.fls.doubleclick.net/activityi;src=2507573;type=other026;cat=googl348;ord=' + a + '?" width="1" height="1" frameborder="0" style="display:none"></iframe>');
</script>
<noscript>
<iframe src="https://2507573.fls.doubleclick.net/activityi;src=2507573;type=other026;cat=googl348;ord=1?" width="1" height="1" frameborder="0" style="display:none"></iframe>
</noscript>
<!-- End of Tag -->
</body>
</html>

View File

@@ -0,0 +1,61 @@
page.title=Adding Pages to a Notification
@jd:body
<img src="{@docRoot}wear/images/09_pages.png" height="200" style="float:right;margin:0 0 20px 40px" />
<img src="{@docRoot}wear/images/08_pages.png" height="200" style="float:right;margin:0 0 20px 40px" />
<p>When you'd like to provide more information without requiring users
to open your app on their handheld device, you can
add one or more pages to the notification on Android Wear. The additional pages
appear immediately to the right of the main notification card.
For information about when to use and how to design
multiple pages, see the
<a href="{@docRoot}wear/design/index.html#NotificationPages">Design Principles of Android
Wear</a>.</p>
<p>When creating a notification with multiple pages, start by creating the main notification
(the first page) the way you'd like the notification to appear on a phone
or tablet. Then, add pages one at a time with the
<a href="{@docRoot}reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html#addPage(android.app.Notification)">
<code>addPage()</code></a> method, or add multiple pages in a {@link java.util.Collection} with the
<a href="{@docRoot}reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html#addPages(java.util.Collection<android.app.Notification>)">
<code>addPages()</code></a> method.</p>
<p>For example, here's some code that adds a second page to a notification:</p>
<pre>
// Create builder for the main notification
NotificationCompat.Builder notificationBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.new_message)
.setContentTitle("Page 1")
.setContentText("Short message")
.setContentIntent(viewPendingIntent);
// Create a big text style for the second page
BigTextStyle secondPageStyle = new NotificationCompat.BigTextStyle();
secondPageStyle.setBigContentTitle("Page 2")
.bigText("A lot of text...");
// Create second page notification
Notification secondPageNotification =
new NotificationCompat.Builder(this)
.setStyle(secondPageStyle)
.build();
// Create main notification and add the second page
Notification twoPageNotification =
new WearableNotifications.Builder(notificationBuilder)
.addPage(secondPageNotification)
.build();
</pre>
</body>
</html>

View File

@@ -1,652 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
<title>Receiving Voice Input from a Notification | Android Developers</title>
<!-- STYLESHEETS -->
<link rel="stylesheet"
href="//fonts.googleapis.com/css?family=Roboto:light,regular,medium,thin,italic,mediumitalic,bold" title="roboto">
<link href="/assets/css/default.css" rel="stylesheet" type="text/css">
<!-- JAVASCRIPT -->
<script src="//www.google.com/jsapi" type="text/javascript"></script>
<script src="/assets/js/android_3p-bundle.js" type="text/javascript"></script>
<script type="text/javascript">
var toRoot = "/";
var metaTags = [];
var devsite = false;
</script>
<script src="/assets/js/docs.js" type="text/javascript"></script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-5831155-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body class="gc-documentation
" itemscope itemtype="http://schema.org/Article">
<a name="top"></a>
<!-- Header -->
<div id="header">
<div class="wrap" id="header-wrap">
<div class="col-3 logo-wear">
<a href="/wear/index.html">
<img src="/wear/images/android-wear.png" height="16" alt="Android Wear" />
</a>
</div>
<div class="col-8" style="margin:0"><h1 style="margin:1px 0 0 20px;padding:0;line-height:16px;
color:#666;font-weight:100;font-size:24px;">Developer Preview</h1></div>
<!-- New Search -->
<div class="menu-container">
<div class="moremenu">
<div id="more-btn"></div>
</div>
<div class="morehover" id="moremenu">
<div class="top"></div>
<div class="mid">
<div class="header">Links</div>
<ul>
<li><a href="https://play.google.com/apps/publish/">Google Play Developer Console</a></li>
<li><a href="http://android-developers.blogspot.com/">Android Developers Blog</a></li>
<li><a href="/about/index.html">About Android</a></li>
</ul>
<div class="header">Android Sites</div>
<ul>
<li><a href="http://www.android.com">Android.com</a></li>
<li class="active"><a>Android Developers</a></li>
<li><a href="http://source.android.com">Android Open Source Project</a></li>
</ul>
<div class="header">Language</div>
<div id="language" class="locales">
<select name="language" onChange="changeLangPref(this.value, true)">
<option value="en">English</option>
<option value="es">Español</option>
<option value="ja">日本語</option>
<option value="ko">한국어</option>
<option value="ru">Русский</option>
<option value="zh-cn">中文 (中国)</option>
<option value="zh-tw">中文 (台灣)</option>
</select>
</div>
<script type="text/javascript">
<!--
loadLangPref();
//-->
</script>
<br class="clearfix" />
</div><!-- end mid -->
<div class="bottom"></div>
</div><!-- end morehover -->
<div class="search" id="search-container">
<div class="search-inner">
<div id="search-btn"></div>
<div class="left"></div>
<form onsubmit="return submit_search()">
<input id="search_autocomplete" type="text" value="" autocomplete="off" name="q"
onfocus="search_focus_changed(this, true)" onblur="search_focus_changed(this, false)"
onkeydown="return search_changed(event, true, '/')"
onkeyup="return search_changed(event, false, '/')" />
</form>
<div class="right"></div>
<a class="close hide">close</a>
<div class="left"></div>
<div class="right"></div>
</div>
</div><!-- end search -->
<div class="search_filtered_wrapper reference">
<div class="suggest-card reference no-display">
<ul class="search_filtered">
</ul>
</div>
</div>
<div class="search_filtered_wrapper docs">
<div class="suggest-card dummy no-display">&nbsp;</div>
<div class="suggest-card develop no-display">
<ul class="search_filtered">
</ul>
<div class="child-card guides no-display">
</div>
<div class="child-card training no-display">
</div>
<div class="child-card samples no-display">
</div>
</div>
<div class="suggest-card design no-display">
<ul class="search_filtered">
</ul>
</div>
<div class="suggest-card distribute no-display">
<ul class="search_filtered">
</ul>
</div>
</div><!-- end search_filtered_wrapper -->
</div>
<!-- end menu_container -->
</div><!-- end header-wrap -->
</div>
<!-- /Header -->
<div id="searchResults" class="wrap" style="display:none;">
<h2 id="searchTitle">Results</h2>
<div id="leftSearchControl" class="search-control">Loading...</div>
</div>
<div class="wrap clearfix" id="body-content">
<div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
<div id="devdoc-nav" class="scroll-pane">
<a class="totop" href="#top" data-g-event="left-nav-top">to top</a>
<ul id="nav">
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/preview/start.html">Get Started
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/design/user-interface.html">UI Overview
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/design/index.html">Design Principles
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/notifications/creating.html">Creating Notifications for Android Wear
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/notifications/remote-input.html">Receiving Voice Input from a Notification
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/notifications/pages.html">Adding Pages to a Notification
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/notifications/stacks.html">Stacking Notifications
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header"><a href="/reference/android/preview/support/package-summary.html">Notification Reference</a></div>
<ul class="tree-list-children">
<li class="nav-section">
<div class="nav-section-header-ref"><span class="tree-list-subtitle package" title="android.preview.support.v4.app">android.preview.support.v4.app</span></div>
<ul>
<li><a href="/reference/android/preview/support/v4/app/NotificationManagerCompat.html">NotificationManagerCompat</a></li>
</ul>
</li>
<li class="nav-section">
<div class="nav-section-header-ref"><span class="tree-list-subtitle package" title="android.preview.support.wearable.notifications">android.preview.support.wearable.notifications</span></div>
<ul>
<li><a href="/reference/android/preview/support/wearable/notifications/RemoteInput.html">RemoteInput</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/RemoteInput.Builder.html" >RemoteInput.Builder</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.html">WearableNotifications</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Action.html">WearableNotifications.Action</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Action.Builder.html">WearableNotifications.Action.Builder</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html">WearableNotifications.Builder</a></li>
</ul>
</li>
</ul>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/license.html">License Agreement</a></div>
</li>
</ul>
</div>
</div> <!-- end side-nav -->
<script>
$(document).ready(function() {
scrollIntoView("devdoc-nav");
});
</script>
<div class="col-12" id="doc-col" >
<h1 itemprop="name" >Receiving Voice Input from a Notification</h1>
<div id="jd-content">
<div class="jd-descr" itemprop="articleBody">
<img src="/wear/images/13_voicereply.png" height="200" width="169" style="float:right;margin:0 0 20px 40px" />
<img src="/wear/images/03_actions.png" height="200" width="169" style="float:right;margin:0 0 20px 40px" />
<p>If your notification includes an action to respond with text,
such as to reply to an email, it should normally launch an activity
on the handheld device. However, when your notification appears on an Android wearable, you can
allow users to dictate a reply with voice input. You can also provide pre-defined text
messages for the user to select.</p>
<p>When the user replies with voice or selects one of the available
messages, the system sends the message to your app on the connected handheld device.
The message is attached as an extra in the <code><a href="/reference/android/content/Intent.html">Intent</a></code> you specified
to be used for the notification action.</p>
<p class="note"><strong>Note:</strong> When developing with the Android emulator,
you must type text replies into the voice input field, so be sure you have enabled
<strong>Hardware keyboard present</strong> in the AVD settings.</p>
<h2 id="RemoteInput">Define the Remote Input</h2>
<p>To create an action that supports voice input, first create an instance of
<a href="/reference/android/preview/support/wearable/notifications/RemoteInput.html">
<code>RemoteInput</code></a> using the
<a href="/reference/android/preview/support/wearable/notifications/RemoteInput.Builder.html"><code>RemoteInput.Builder</code></a> APIs.
The
<a href="/reference/android/preview/support/wearable/notifications/RemoteInput.Builder.html"><code>RemoteInput.Builder</code></a> constructor takes a string that the system
will use as a key for the <code><a href="/reference/android/content/Intent.html">Intent</a></code> extra that carries the reply message
to your app on the handheld.</p>
<p>For example, here's how to create a new
<a href="/reference/android/preview/support/wearable/notifications/RemoteInput.html">
<code>RemoteInput</code></a> object that provides a custom
label for the voice input prompt:</p>
<pre class="prettyprint">
// Key for the string that's delivered in the action's intent
private static final String EXTRA_VOICE_REPLY = "extra_voice_reply";
String replyLabel = getResources().getString(R.string.reply_label);
RemoteInput remoteInput = new RemoteInput.Builder(EXTRA_VOICE_REPLY)
.setLabel(replyLabel)
.build();
</pre>
<h3>Add Pre-defined Text Responses</h3>
<img src="/wear/images/12_voicereply.png" height="200" style="float:right;margin:0 0 20px 40px" />
<p>In addition to allowing voice input, you can
provide up to five text responses that the user can select for quick replies. Call
<a href="/reference/android/preview/support/wearable/notifications/RemoteInput.Builder.html#setChoices(java.lang.String[])"><code>setChoices()</code></a> and pass it a string array.</p>
<p>For example, you may define some responses in a resource array:</p>
<p class="code-caption">res/values/strings.xml</code>
<pre class="prettyprint">
&lt;?xml version="1.0" encoding="utf-8"?>
&lt;resources>
&lt;string-array name="reply_choices">
&lt;item>Yes&lt;/item>
&lt;item>No&lt;/item>
&lt;item>Maybe&lt;/item>
&lt;/string-array>
&lt;/resources>
</pre>
<p>Then, inflate the string array and add it to the
<a href="/reference/android/preview/support/wearable/notifications/RemoteInput.html"><code>RemoteInput</code></a>:</p>
<pre>
String replyLabel = getResources().getString(R.string.reply_label);
String[] replyChoices = getResources().getStringArray(R.array.reply_choices);
RemoteInput remoteInput = new RemoteInput.Builder(EXTRA_VOICE_REPLY)
.setLabel(replyLabel)
.setChoices(replyChoices)
.build();
</pre>
<h2 id="PrimaryAction">Receive Voice Input for the Primary Action</h2>
<p>If "Reply" is your notification's primary action (defined by the <code><a href="/reference/android/support/v4/app/NotificationCompat.Builder.html#setContentIntent(android.app.PendingIntent)">setContentIntent()</a></code>
method), then you should attach the
<a href="/reference/android/preview/support/wearable/notifications/RemoteInput.html"><code>RemoteInput</code></a> to the main action using
<a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html#addRemoteInputForContentIntent(android.preview.support.wearable.notifications.RemoteInput)">
<code>addRemoteInputForContentIntent()</code></a>. For example:</p>
<pre>
// Create intent for reply action
Intent replyIntent = new Intent(this, ReplyActivity.class);
PendingIntent replyPendingIntent =
PendingIntent.getActivity(this, 0, replyIntent, 0);
// Build the notification
NotificationCompat.Builder replyNotificationBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_new_message)
.setContentTitle("Message from Travis")
.setContentText("I love key lime pie!")
.setContentIntent(replyPendingIntent);
// Create the remote input
RemoteInput remoteInput = new RemoteInput.Builder(EXTRA_VOICE_REPLY)
.setLabel(replyLabel)
.build();
// Create wearable notification and add remote input
Notification replyNotification =
new WearableNotifications.Builder(replyNotificationBuilder)
.addRemoteInputForContentIntent(remoteInput)
.build();
</pre>
<p>By using
<a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html#addRemoteInputForContentIntent(android.preview.support.wearable.notifications.RemoteInput)">
<code>addRemoteInputForContentIntent()</code></a> to add the
<a href="/reference/android/preview/support/wearable/notifications/RemoteInput.html"><code>RemoteInput</code></a> object to the notification's primary action,
the button that normally appears as an "Open" action becomes the "Reply" action
and starts the voice input UI when users select it on Android Wear.</p>
<h2 id="NewAction">Receive Voice Input for a Secondary Action</h2>
<p>If the "Reply" action is not your notification's primary action and you want to enable
voice input for a secondary action, add the
<a href="/reference/android/preview/support/wearable/notifications/RemoteInput.html"><code>RemoteInput</code></a> to a new action button defined by an
<a href="/reference/android/preview/support/wearable/notifications/Action.html">
<code>Action</code></a> object.</p>
<p>You should instantiate the
<a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Action.html">
<code>Action</code></a> with the
<a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Action.Builder.html"><code>Action.Builder()</code></a>
constructor, which takes an icon and text label for the action button, plus the
<code><a href="/reference/android/app/PendingIntent.html">PendingIntent</a></code>
the system should use to invoke your app when the user selects the action. For example:</p>
<pre>
// Create the pending intent to fire when the user selects the action
Intent replyIntent = new Intent(this, ReplyActivity.class);
PendingIntent pendingReplyIntent =
PendingIntent.getActivity(this, 0, replyIntent, 0);
// Create the remote input
RemoteInput remoteInput = new RemoteInput.Builder(EXTRA_VOICE_REPLY)
.setLabel(replyLabel)
.build();
// Create the notification action
Action replyAction = new Action.Builder(R.drawable.ic_message,
"Reply", pendingIntent)
.addRemoteInput(remoteInput)
.build();
</pre>
<p>After you add the
<a href="/reference/android/preview/support/wearable/notifications/RemoteInput.html"><code>RemoteInput</code></a> to the
<a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Action.html">
<code>Action</code></a>, add the
<a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Action.html">
<code>Action</code></a> to the
<a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html"><code>WearableNotifications.Builder</code></a> using
<a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html#addAction(Action)"><code>addAction()</code></a>.
For example:</p>
<pre>
// Create basic notification builder
NotificationCompat.Builder replyNotificationBuilder =
new NotificationCompat.Builder(this)
.setContentTitle("New message");
// Create the notification action and add remote input
Action replyAction = new Action.Builder(R.drawable.ic_message,
"Reply", pendingIntent)
.addRemoteInput(remoteInput)
.build();
// Create wearable notification and add action
Notification replyNotification =
new WearableNotifications.Builder(replyNotificationBuilder)
.addAction(replyAction)
.build();
</pre>
<p>Now, when the user selects "Reply" from an Android wearable, the system prompts the user
for voice input (and shows the list of pre-defined replies, if provided).
Once the user completes a response, the system invokes
the <code><a href="/reference/android/content/Intent.html">Intent</a></code> attached to the action and adds the
<code>EXTRA_VOICE_REPLY</code> extra (the string
you passed to the
<a href="/reference/android/preview/support/wearable/notifications/RemoteInput.Builder.html"><code>RemoteInput.Builder</code></a> constructor)
with the user's message as the string value.</p>
</body>
</html>
</div>
<div class="content-footer layout-content-row"
itemscope itemtype="http://schema.org/SiteNavigationElement">
<div class="layout-content-col col-9" style="padding-top:4px">
<div class="g-plusone" data-size="medium"></div>
</div>
<div class="paging-links layout-content-col col-4">
</div>
</div>
</div> <!-- end jd-content -->
<div id="footer" class="wrap" >
<div id="copyright">
Except as noted, this content is
licensed under <a href="http://creativecommons.org/licenses/by/2.5/">
Creative Commons Attribution 2.5</a>. For details and
restrictions, see the <a href="/license.html">Content
License</a>.
</div>
<div id="footerlinks">
<p>
<a href="/about/index.html">About Android</a>&nbsp;&nbsp;|&nbsp;
<a href="/legal.html">Legal</a>&nbsp;&nbsp;|&nbsp;
<a href="/support.html">Support</a>
</p>
</div>
</div> <!-- end footer -->
</div><!-- end doc-content -->
</div> <!-- end body-content -->
<!-- Start of Tag -->
<script type="text/javascript">
var axel = Math.random() + "";
var a = axel * 10000000000000;
document.write('<iframe src="https://2507573.fls.doubleclick.net/activityi;src=2507573;type=other026;cat=googl348;ord=' + a + '?" width="1" height="1" frameborder="0" style="display:none"></iframe>');
</script>
<noscript>
<iframe src="https://2507573.fls.doubleclick.net/activityi;src=2507573;type=other026;cat=googl348;ord=1?" width="1" height="1" frameborder="0" style="display:none"></iframe>
</noscript>
<!-- End of Tag -->
</body>
</html>

View File

@@ -0,0 +1,213 @@
page.title=Receiving Voice Input from a Notification
@jd:body
<img src="{@docRoot}wear/images/13_voicereply.png" height="200" width="169" style="float:right;margin:0 0 20px 40px" />
<img src="{@docRoot}wear/images/03_actions.png" height="200" width="169" style="float:right;margin:0 0 20px 40px" />
<p>If your notification includes an action to respond with text,
such as to reply to an email, it should normally launch an activity
on the handheld device. However, when your notification appears on an Android wearable, you can
allow users to dictate a reply with voice input. You can also provide pre-defined text
messages for the user to select.</p>
<p>When the user replies with voice or selects one of the available
messages, the system sends the message to your app on the connected handheld device.
The message is attached as an extra in the {@link android.content.Intent} you specified
to be used for the notification action.</p>
<p class="note"><strong>Note:</strong> When developing with the Android emulator,
you must type text replies into the voice input field, so be sure you have enabled
<strong>Hardware keyboard present</strong> in the AVD settings.</p>
<h2 id="RemoteInput">Define the Remote Input</h2>
<p>To create an action that supports voice input, first create an instance of
<a href="{@docRoot}reference/android/preview/support/wearable/notifications/RemoteInput.html">
<code>RemoteInput</code></a> using the
<a href="{@docRoot}reference/android/preview/support/wearable/notifications/RemoteInput.Builder.html"><code>RemoteInput.Builder</code></a> APIs.
The
<a href="{@docRoot}reference/android/preview/support/wearable/notifications/RemoteInput.Builder.html"><code>RemoteInput.Builder</code></a> constructor takes a string that the system
will use as a key for the {@link android.content.Intent} extra that carries the reply message
to your app on the handheld.</p>
<p>For example, here's how to create a new
<a href="{@docRoot}reference/android/preview/support/wearable/notifications/RemoteInput.html">
<code>RemoteInput</code></a> object that provides a custom
label for the voice input prompt:</p>
<pre class="prettyprint">
// Key for the string that's delivered in the action's intent
private static final String EXTRA_VOICE_REPLY = "extra_voice_reply";
String replyLabel = getResources().getString(R.string.reply_label);
RemoteInput remoteInput = new RemoteInput.Builder(EXTRA_VOICE_REPLY)
.setLabel(replyLabel)
.build();
</pre>
<h3>Add Pre-defined Text Responses</h3>
<img src="{@docRoot}wear/images/12_voicereply.png" height="200" style="float:right;margin:0 0 20px 40px" />
<p>In addition to allowing voice input, you can
provide up to five text responses that the user can select for quick replies. Call
<a href="{@docRoot}reference/android/preview/support/wearable/notifications/RemoteInput.Builder.html#setChoices(java.lang.String[])"><code>setChoices()</code></a> and pass it a string array.</p>
<p>For example, you may define some responses in a resource array:</p>
<p class="code-caption">res/values/strings.xml</code>
<pre class="prettyprint">
&lt;?xml version="1.0" encoding="utf-8"?>
&lt;resources>
&lt;string-array name="reply_choices">
&lt;item>Yes&lt;/item>
&lt;item>No&lt;/item>
&lt;item>Maybe&lt;/item>
&lt;/string-array>
&lt;/resources>
</pre>
<p>Then, inflate the string array and add it to the
<a href="{@docRoot}reference/android/preview/support/wearable/notifications/RemoteInput.html"><code>RemoteInput</code></a>:</p>
<pre>
String replyLabel = getResources().getString(R.string.reply_label);
String[] replyChoices = getResources().getStringArray(R.array.reply_choices);
RemoteInput remoteInput = new RemoteInput.Builder(EXTRA_VOICE_REPLY)
.setLabel(replyLabel)
.setChoices(replyChoices)
.build();
</pre>
<h2 id="PrimaryAction">Receive Voice Input for the Primary Action</h2>
<p>If "Reply" is your notification's primary action (defined by the {@link
android.support.v4.app.NotificationCompat.Builder#setContentIntent setContentIntent()}
method), then you should attach the
<a href="{@docRoot}reference/android/preview/support/wearable/notifications/RemoteInput.html"><code>RemoteInput</code></a> to the main action using
<a href="{@docRoot}reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html#addRemoteInputForContentIntent(android.preview.support.wearable.notifications.RemoteInput)">
<code>addRemoteInputForContentIntent()</code></a>. For example:</p>
<pre>
// Create intent for reply action
Intent replyIntent = new Intent(this, ReplyActivity.class);
PendingIntent replyPendingIntent =
PendingIntent.getActivity(this, 0, replyIntent, 0);
// Build the notification
NotificationCompat.Builder replyNotificationBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_new_message)
.setContentTitle("Message from Travis")
.setContentText("I love key lime pie!")
.setContentIntent(replyPendingIntent);
// Create the remote input
RemoteInput remoteInput = new RemoteInput.Builder(EXTRA_VOICE_REPLY)
.setLabel(replyLabel)
.build();
// Create wearable notification and add remote input
Notification replyNotification =
new WearableNotifications.Builder(replyNotificationBuilder)
.addRemoteInputForContentIntent(replyAction)
.build();
</pre>
<p>By using
<a href="{@docRoot}reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html#addRemoteInputForContentIntent(android.preview.support.wearable.notifications.RemoteInput)">
<code>addRemoteInputForContentIntent()</code></a> to add the
<a href="{@docRoot}reference/android/preview/support/wearable/notifications/RemoteInput.html"><code>RemoteInput</code></a> object to the notification's primary action,
the button that normally appears as an "Open" action becomes the "Reply" action
and starts the voice input UI when users select it on Android Wear.</p>
<h2 id="NewAction">Receive Voice Input for a Secondary Action</h2>
<p>If the "Reply" action is not your notification's primary action and you want to enable
voice input for a secondary action, add the
<a href="{@docRoot}reference/android/preview/support/wearable/notifications/RemoteInput.html"><code>RemoteInput</code></a> to a new action button defined by an
<a href="{@docRoot}reference/android/preview/support/wearable/notifications/Action.html">
<code>Action</code></a> object.</p>
<p>You should instantiate the
<a href="{@docRoot}reference/android/preview/support/wearable/notifications/WearableNotifications.Action.html">
<code>Action</code></a> with the
<a href="{@docRoot}reference/android/preview/support/wearable/notifications/WearableNotifications.Action.Builder.html"><code>Action.Builder()</code></a>
constructor, which takes an icon and text label for the action button, plus the
{@link android.app.PendingIntent}
the system should use to invoke your app when the user selects the action. For example:</p>
<pre>
// Create the pending intent to fire when the user selects the action
Intent replyIntent = new Intent(this, ReplyActivity.class);
PendingIntent pendingReplyIntent =
PendingIntent.getActivity(this, 0, replyIntent, 0);
// Create the remote input
RemoteInput remoteInput = new RemoteInput.Builder(EXTRA_VOICE_REPLY)
.setLabel(replyLabel)
.build();
// Create the notification action
Action replyAction = new Action.Builder(R.drawable.ic_message,
"Reply", pendingIntent)
.addRemoteInput(remoteInput)
.build();
</pre>
<p>After you add the
<a href="{@docRoot}reference/android/preview/support/wearable/notifications/RemoteInput.html"><code>RemoteInput</code></a> to the
<a href="{@docRoot}reference/android/preview/support/wearable/notifications/WearableNotifications.Action.html">
<code>Action</code></a>, add the
<a href="{@docRoot}reference/android/preview/support/wearable/notifications/WearableNotifications.Action.html">
<code>Action</code></a> to the
<a href="{@docRoot}reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html"><code>WearableNotifications.Builder</code></a> using
<a href="{@docRoot}reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html#addAction(Action)"><code>addAction()</code></a>.
For example:</p>
<pre>
// Create basic notification builder
NotificationCompat.Builder replyNotificationBuilder =
new NotificationCompat.Builder(this)
.setContentTitle("New message");
// Create the notification action and add remote input
Action replyAction = new Action.Builder(R.drawable.ic_message,
"Reply", pendingIntent)
.addRemoteInput(remoteInput)
.build();
// Create wearable notification and add action
Notification replyNotification =
new WearableNotifications.Builder(replyNotificationBuilder)
.addAction(replyAction)
.build();
</pre>
<p>Now, when the user selects "Reply" from an Android wearable, the system prompts the user
for voice input (and shows the list of pre-defined replies, if provided).
Once the user completes a response, the system invokes
the {@link android.content.Intent} attached to the action and adds the
<code>EXTRA_VOICE_REPLY</code> extra (the string
you passed to the
<a href="{@docRoot}reference/android/preview/support/wearable/notifications/RemoteInput.Builder.html"><code>RemoteInput.Builder</code></a> constructor)
with the user's message as the string value.</p>
</body>
</html>

View File

@@ -1,512 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
<title>Stacking Notifications | Android Developers</title>
<!-- STYLESHEETS -->
<link rel="stylesheet"
href="//fonts.googleapis.com/css?family=Roboto:light,regular,medium,thin,italic,mediumitalic,bold" title="roboto">
<link href="/assets/css/default.css" rel="stylesheet" type="text/css">
<!-- JAVASCRIPT -->
<script src="//www.google.com/jsapi" type="text/javascript"></script>
<script src="/assets/js/android_3p-bundle.js" type="text/javascript"></script>
<script type="text/javascript">
var toRoot = "/";
var metaTags = [];
var devsite = false;
</script>
<script src="/assets/js/docs.js" type="text/javascript"></script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-5831155-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body class="gc-documentation
" itemscope itemtype="http://schema.org/Article">
<a name="top"></a>
<!-- Header -->
<div id="header">
<div class="wrap" id="header-wrap">
<div class="col-3 logo-wear">
<a href="/wear/index.html">
<img src="/wear/images/android-wear.png" height="16" alt="Android Wear" />
</a>
</div>
<div class="col-8" style="margin:0"><h1 style="margin:1px 0 0 20px;padding:0;line-height:16px;
color:#666;font-weight:100;font-size:24px;">Developer Preview</h1></div>
<!-- New Search -->
<div class="menu-container">
<div class="moremenu">
<div id="more-btn"></div>
</div>
<div class="morehover" id="moremenu">
<div class="top"></div>
<div class="mid">
<div class="header">Links</div>
<ul>
<li><a href="https://play.google.com/apps/publish/">Google Play Developer Console</a></li>
<li><a href="http://android-developers.blogspot.com/">Android Developers Blog</a></li>
<li><a href="/about/index.html">About Android</a></li>
</ul>
<div class="header">Android Sites</div>
<ul>
<li><a href="http://www.android.com">Android.com</a></li>
<li class="active"><a>Android Developers</a></li>
<li><a href="http://source.android.com">Android Open Source Project</a></li>
</ul>
<div class="header">Language</div>
<div id="language" class="locales">
<select name="language" onChange="changeLangPref(this.value, true)">
<option value="en">English</option>
<option value="es">Español</option>
<option value="ja">日本語</option>
<option value="ko">한국어</option>
<option value="ru">Русский</option>
<option value="zh-cn">中文 (中国)</option>
<option value="zh-tw">中文 (台灣)</option>
</select>
</div>
<script type="text/javascript">
<!--
loadLangPref();
//-->
</script>
<br class="clearfix" />
</div><!-- end mid -->
<div class="bottom"></div>
</div><!-- end morehover -->
<div class="search" id="search-container">
<div class="search-inner">
<div id="search-btn"></div>
<div class="left"></div>
<form onsubmit="return submit_search()">
<input id="search_autocomplete" type="text" value="" autocomplete="off" name="q"
onfocus="search_focus_changed(this, true)" onblur="search_focus_changed(this, false)"
onkeydown="return search_changed(event, true, '/')"
onkeyup="return search_changed(event, false, '/')" />
</form>
<div class="right"></div>
<a class="close hide">close</a>
<div class="left"></div>
<div class="right"></div>
</div>
</div><!-- end search -->
<div class="search_filtered_wrapper reference">
<div class="suggest-card reference no-display">
<ul class="search_filtered">
</ul>
</div>
</div>
<div class="search_filtered_wrapper docs">
<div class="suggest-card dummy no-display">&nbsp;</div>
<div class="suggest-card develop no-display">
<ul class="search_filtered">
</ul>
<div class="child-card guides no-display">
</div>
<div class="child-card training no-display">
</div>
<div class="child-card samples no-display">
</div>
</div>
<div class="suggest-card design no-display">
<ul class="search_filtered">
</ul>
</div>
<div class="suggest-card distribute no-display">
<ul class="search_filtered">
</ul>
</div>
</div><!-- end search_filtered_wrapper -->
</div>
<!-- end menu_container -->
</div><!-- end header-wrap -->
</div>
<!-- /Header -->
<div id="searchResults" class="wrap" style="display:none;">
<h2 id="searchTitle">Results</h2>
<div id="leftSearchControl" class="search-control">Loading...</div>
</div>
<div class="wrap clearfix" id="body-content">
<div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
<div id="devdoc-nav" class="scroll-pane">
<a class="totop" href="#top" data-g-event="left-nav-top">to top</a>
<ul id="nav">
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/preview/start.html">Get Started
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/design/user-interface.html">UI Overview
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/design/index.html">Design Principles
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/notifications/creating.html">Creating Notifications for Android Wear
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/notifications/remote-input.html">Receiving Voice Input from a Notification
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/notifications/pages.html">Adding Pages to a Notification
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/notifications/stacks.html">Stacking Notifications
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header"><a href="/reference/android/preview/support/package-summary.html">Notification Reference</a></div>
<ul class="tree-list-children">
<li class="nav-section">
<div class="nav-section-header-ref"><span class="tree-list-subtitle package" title="android.preview.support.v4.app">android.preview.support.v4.app</span></div>
<ul>
<li><a href="/reference/android/preview/support/v4/app/NotificationManagerCompat.html">NotificationManagerCompat</a></li>
</ul>
</li>
<li class="nav-section">
<div class="nav-section-header-ref"><span class="tree-list-subtitle package" title="android.preview.support.wearable.notifications">android.preview.support.wearable.notifications</span></div>
<ul>
<li><a href="/reference/android/preview/support/wearable/notifications/RemoteInput.html">RemoteInput</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/RemoteInput.Builder.html" >RemoteInput.Builder</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.html">WearableNotifications</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Action.html">WearableNotifications.Action</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Action.Builder.html">WearableNotifications.Action.Builder</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html">WearableNotifications.Builder</a></li>
</ul>
</li>
</ul>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/license.html">License Agreement</a></div>
</li>
</ul>
</div>
</div> <!-- end side-nav -->
<script>
$(document).ready(function() {
scrollIntoView("devdoc-nav");
});
</script>
<div class="col-12" id="doc-col" >
<h1 itemprop="name" >Stacking Notifications</h1>
<div id="jd-content">
<div class="jd-descr" itemprop="articleBody">
<img src="/wear/images/11_bundles_B.png" height="200" width="169" style="float:right;margin:0 0 20px 40px" />
<img src="/wear/images/11_bundles_A.png" height="200" width="169" style="float:right;margin:0 0 20px 40px" />
<p>When creating notifications for a handheld device, you should always aggregate similar
notifications into a single summary notification. For example, if your app creates notifications
for received messages, you should not show more than one notification
on a handheld device&mdash;when more than one is message is received, use a single notification
to provide a summary such as "2 new messages."</p>
<p>However, a summary notification is less useful on an Android wearable because users
are not able to read details from each message on the wearable (they must open your app on the
handheld to view more information). So for the wearable device, you should
group all the notifications together in a stack. The stack of notifications appears as a single
card, which users can expand to view the details from each notification separately. The new
<a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html#setGroup(java.lang.String, int)">
<code>setGroup()</code></a> method makes this possible while allowing you to still provide
only one summary notification on the handheld device.</p>
<p>For details about designing notification stacks, see the
<a href="/wear/design/index.html#NotificationStacks">Design Principles of Android
Wear</a>.</p>
<h2 id="AddGroup">Add Each Notification to a Group</h2>
<p>To create a stack, call <a
href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html#setGroup(java.lang.String, int)">
<code>setGroup()</code></a> for each notification you want in the stack, passing the same
group key. For example:</p>
<pre style="clear:right">
final static String GROUP_KEY_EMAILS = "group_key_emails";
NotificationCompat.Builder builder = new NotificationCompat.Builder(mContext)
.setContentTitle("New mail from " + sender)
.setContentText(subject)
.setSmallIcon(R.drawable.new_mail);
Notification notif = new WearableNotifications.Builder(builder)
.setGroup(GROUP_KEY_EMAILS)
.build();
</pre>
<p>By default, notifications appear in the order in which you added them, with the most recent
notification visible at the top. You can define a specific position in the group
by passing an order position as the second parameter for <a
href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html#setGroup(java.lang.String, int)">
<code>setGroup()</code></a>.</p>
<h2 id="AddSummary">Add a Summary Notification</h2>
<p>It's important that you still provide a summary notification that appears on handheld devices.
So in addition to adding each unique notification to the same stack group, also add a summary
notification, but set its order position to be <a
href="/reference/android/preview/support/wearable/notifications/WearableNotifications.html#GROUP_ORDER_SUMMARY"><code>GROUP_ORDER_SUMMARY</code></a>.</p>
<pre>
Notification summaryNotification = new WearableNotifications.Builder(builder)
.setGroup(GROUP_KEY_EMAILS, WearableNotifications.GROUP_ORDER_SUMMARY)
.build();
</pre>
<p>This notification will not appear in your stack of notifications on the wearable, but
appears as the only notification on the handheld device.
</body>
</html>
</div>
<div class="content-footer layout-content-row"
itemscope itemtype="http://schema.org/SiteNavigationElement">
<div class="layout-content-col col-9" style="padding-top:4px">
<div class="g-plusone" data-size="medium"></div>
</div>
<div class="paging-links layout-content-col col-4">
</div>
</div>
</div> <!-- end jd-content -->
<div id="footer" class="wrap" >
<div id="copyright">
Except as noted, this content is
licensed under <a href="http://creativecommons.org/licenses/by/2.5/">
Creative Commons Attribution 2.5</a>. For details and
restrictions, see the <a href="/license.html">Content
License</a>.
</div>
<div id="footerlinks">
<p>
<a href="/about/index.html">About Android</a>&nbsp;&nbsp;|&nbsp;
<a href="/legal.html">Legal</a>&nbsp;&nbsp;|&nbsp;
<a href="/support.html">Support</a>
</p>
</div>
</div> <!-- end footer -->
</div><!-- end doc-content -->
</div> <!-- end body-content -->
<!-- Start of Tag -->
<script type="text/javascript">
var axel = Math.random() + "";
var a = axel * 10000000000000;
document.write('<iframe src="https://2507573.fls.doubleclick.net/activityi;src=2507573;type=other026;cat=googl348;ord=' + a + '?" width="1" height="1" frameborder="0" style="display:none"></iframe>');
</script>
<noscript>
<iframe src="https://2507573.fls.doubleclick.net/activityi;src=2507573;type=other026;cat=googl348;ord=1?" width="1" height="1" frameborder="0" style="display:none"></iframe>
</noscript>
<!-- End of Tag -->
</body>
</html>

View File

@@ -0,0 +1,72 @@
page.title=Stacking Notifications
@jd:body
<img src="{@docRoot}wear/images/11_bundles_B.png" height="200" width="169" style="float:right;margin:0 0 20px 40px" />
<img src="{@docRoot}wear/images/11_bundles_A.png" height="200" width="169" style="float:right;margin:0 0 20px 40px" />
<p>When creating notifications for a handheld device, you should always aggregate similar
notifications into a single summary notification. For example, if your app creates notifications
for received messages, you should not show more than one notification
on a handheld device&mdash;when more than one is message is received, use a single notification
to provide a summary such as "2 new messages."</p>
<p>However, a summary notification is less useful on an Android wearable because users
are not able to read details from each message on the wearable (they must open your app on the
handheld to view more information). So for the wearable device, you should
group all the notifications together in a stack. The stack of notifications appears as a single
card, which users can expand to view the details from each notification separately. The new
<a href="{@docRoot}reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html#setGroup(java.lang.String, int)">
<code>setGroup()</code></a> method makes this possible while allowing you to still provide
only one summary notification on the handheld device.</p>
<p>For details about designing notification stacks, see the
<a href="{@docRoot}wear/design/index.html#NotificationStacks">Design Principles of Android
Wear</a>.</p>
<h2 id="AddGroup">Add Each Notification to a Group</h2>
<p>To create a stack, call <a
href="{@docRoot}reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html#setGroup(java.lang.String, int)">
<code>setGroup()</code></a> for each notification you want in the stack, passing the same
group key. For example:</p>
<pre style="clear:right">
final static String GROUP_KEY_EMAILS = "group_key_emails";
NotificationCompat.Builder builder = new NotificationCompat.Builder(mContext)
.setContentTitle("New mail from " + sender)
.setContentText(subject)
.setSmallIcon(R.drawable.new_mail);
Notification notif = new WearableNotifications.Builder(builder)
.setGroup(GROUP_KEY_EMAILS)
.build();
</pre>
<p>By default, notifications appear in the order in which you added them, with the most recent
notification visible at the top. You can define a specific position in the group
by passing an order position as the second parameter for <a
href="{@docRoot}reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html#setGroup(java.lang.String, int)">
<code>setGroup()</code></a>.</p>
<h2 id="AddSummary">Add a Summary Notification</h2>
<p>It's important that you still provide a summary notification that appears on handheld devices.
So in addition to adding each unique notification to the same stack group, also add a summary
notification, but set its order position to be <a
href="{@docRoot}reference/android/preview/support/wearable/notifications/WearableNotifications.html#GROUP_ORDER_SUMMARY"><code>GROUP_ORDER_SUMMARY</code></a>.</p>
<pre>
Notification summaryNotification = new WearableNotifications.Builder(builder)
.setGroup(GROUP_KEY_EMAILS, WearableNotifications.GROUP_ORDER_SUMMARY)
.build();
</pre>
<p>This notification will not appear in your stack of notifications on the wearable, but
appears as the only notification on the handheld device.
</body>
</html>

View File

@@ -1,379 +1,8 @@
<!DOCTYPE html>
page.title=Sign Up for the Developer Preview
@jd:body
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
<title>Sign Up for the Developer Preview | Android Developers</title>
<!-- STYLESHEETS -->
<link rel="stylesheet"
href="//fonts.googleapis.com/css?family=Roboto:light,regular,medium,thin,italic,mediumitalic,bold" title="roboto">
<link href="/assets/css/default.css" rel="stylesheet" type="text/css">
<!-- JAVASCRIPT -->
<script src="//www.google.com/jsapi" type="text/javascript"></script>
<script src="/assets/js/android_3p-bundle.js" type="text/javascript"></script>
<script type="text/javascript">
var toRoot = "/";
var metaTags = [];
var devsite = false;
</script>
<script src="/assets/js/docs.js" type="text/javascript"></script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-5831155-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body class="gc-documentation
" itemscope itemtype="http://schema.org/Article">
<a name="top"></a>
<!-- Header -->
<div id="header">
<div class="wrap" id="header-wrap">
<div class="col-3 logo-wear">
<a href="/wear/index.html">
<img src="/wear/images/android-wear.png" height="16" alt="Android Wear" />
</a>
</div>
<div class="col-8" style="margin:0"><h1 style="margin:1px 0 0 20px;padding:0;line-height:16px;
color:#666;font-weight:100;font-size:24px;">Developer Preview</h1></div>
<!-- New Search -->
<div class="menu-container">
<div class="moremenu">
<div id="more-btn"></div>
</div>
<div class="morehover" id="moremenu">
<div class="top"></div>
<div class="mid">
<div class="header">Links</div>
<ul>
<li><a href="https://play.google.com/apps/publish/">Google Play Developer Console</a></li>
<li><a href="http://android-developers.blogspot.com/">Android Developers Blog</a></li>
<li><a href="/about/index.html">About Android</a></li>
</ul>
<div class="header">Android Sites</div>
<ul>
<li><a href="http://www.android.com">Android.com</a></li>
<li class="active"><a>Android Developers</a></li>
<li><a href="http://source.android.com">Android Open Source Project</a></li>
</ul>
<div class="header">Language</div>
<div id="language" class="locales">
<select name="language" onChange="changeLangPref(this.value, true)">
<option value="en">English</option>
<option value="es">Español</option>
<option value="ja">日本語</option>
<option value="ko">한국어</option>
<option value="ru">Русский</option>
<option value="zh-cn">中文 (中国)</option>
<option value="zh-tw">中文 (台灣)</option>
</select>
</div>
<script type="text/javascript">
<!--
loadLangPref();
//-->
</script>
<br class="clearfix" />
</div><!-- end mid -->
<div class="bottom"></div>
</div><!-- end morehover -->
<div class="search" id="search-container">
<div class="search-inner">
<div id="search-btn"></div>
<div class="left"></div>
<form onsubmit="return submit_search()">
<input id="search_autocomplete" type="text" value="" autocomplete="off" name="q"
onfocus="search_focus_changed(this, true)" onblur="search_focus_changed(this, false)"
onkeydown="return search_changed(event, true, '/')"
onkeyup="return search_changed(event, false, '/')" />
</form>
<div class="right"></div>
<a class="close hide">close</a>
<div class="left"></div>
<div class="right"></div>
</div>
</div><!-- end search -->
<div class="search_filtered_wrapper reference">
<div class="suggest-card reference no-display">
<ul class="search_filtered">
</ul>
</div>
</div>
<div class="search_filtered_wrapper docs">
<div class="suggest-card dummy no-display">&nbsp;</div>
<div class="suggest-card develop no-display">
<ul class="search_filtered">
</ul>
<div class="child-card guides no-display">
</div>
<div class="child-card training no-display">
</div>
<div class="child-card samples no-display">
</div>
</div>
<div class="suggest-card design no-display">
<ul class="search_filtered">
</ul>
</div>
<div class="suggest-card distribute no-display">
<ul class="search_filtered">
</ul>
</div>
</div><!-- end search_filtered_wrapper -->
</div>
<!-- end menu_container -->
</div><!-- end header-wrap -->
</div>
<!-- /Header -->
<div id="searchResults" class="wrap" style="display:none;">
<h2 id="searchTitle">Results</h2>
<div id="leftSearchControl" class="search-control">Loading...</div>
</div>
<div class="wrap clearfix" id="body-content">
<div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
<div id="devdoc-nav" class="scroll-pane">
<a class="totop" href="#top" data-g-event="left-nav-top">to top</a>
<ul id="nav">
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/preview/start.html">Get Started
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/design/user-interface.html">UI Overview
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/design/index.html">Design Principles
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/notifications/creating.html">Creating Notifications for Android Wear
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/notifications/remote-input.html">Receiving Voice Input from a Notification
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/notifications/pages.html">Adding Pages to a Notification
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/notifications/stacks.html">Stacking Notifications
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header"><a href="/reference/android/preview/support/package-summary.html">Notification Reference</a></div>
<ul class="tree-list-children">
<li class="nav-section">
<div class="nav-section-header-ref"><span class="tree-list-subtitle package" title="android.preview.support.v4.app">android.preview.support.v4.app</span></div>
<ul>
<li><a href="/reference/android/preview/support/v4/app/NotificationManagerCompat.html">NotificationManagerCompat</a></li>
</ul>
</li>
<li class="nav-section">
<div class="nav-section-header-ref"><span class="tree-list-subtitle package" title="android.preview.support.wearable.notifications">android.preview.support.wearable.notifications</span></div>
<ul>
<li><a href="/reference/android/preview/support/wearable/notifications/RemoteInput.html">RemoteInput</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/RemoteInput.Builder.html" >RemoteInput.Builder</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.html">WearableNotifications</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Action.html">WearableNotifications.Action</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Action.Builder.html">WearableNotifications.Action.Builder</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html">WearableNotifications.Builder</a></li>
</ul>
</li>
</ul>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/license.html">License Agreement</a></div>
</li>
</ul>
</div>
</div> <!-- end side-nav -->
<script>
$(document).ready(function() {
scrollIntoView("devdoc-nav");
});
</script>
<div class="col-12" id="doc-col" >
<h1 itemprop="name" >Sign Up for the Developer Preview</h1>
<div id="jd-content">
<div class="jd-descr" itemprop="articleBody">
<p>To get started with the Android Wear Developer Preview, you must agree to the
<p>To get started with the Android Wear Developer Preview, you must agree to the
following terms and conditions and provide the email address for your Google account.
After signing up, youll have access to:</p>
<ul>
@@ -538,72 +167,3 @@ This is the Android Wear Developer Preview License Agreement.
</body>
</html>
</div>
<div class="content-footer layout-content-row"
itemscope itemtype="http://schema.org/SiteNavigationElement">
<div class="layout-content-col col-9" style="padding-top:4px">
<div class="g-plusone" data-size="medium"></div>
</div>
<div class="paging-links layout-content-col col-4">
</div>
</div>
</div> <!-- end jd-content -->
<div id="footer" class="wrap" >
<div id="copyright">
Except as noted, this content is
licensed under <a href="http://creativecommons.org/licenses/by/2.5/">
Creative Commons Attribution 2.5</a>. For details and
restrictions, see the <a href="/license.html">Content
License</a>.
</div>
<div id="footerlinks">
<p>
<a href="/about/index.html">About Android</a>&nbsp;&nbsp;|&nbsp;
<a href="/legal.html">Legal</a>&nbsp;&nbsp;|&nbsp;
<a href="/support.html">Support</a>
</p>
</div>
</div> <!-- end footer -->
</div><!-- end doc-content -->
</div> <!-- end body-content -->
<!-- Start of Tag -->
<script type="text/javascript">
var axel = Math.random() + "";
var a = axel * 10000000000000;
document.write('<iframe src="https://2507573.fls.doubleclick.net/activityi;src=2507573;type=other026;cat=googl348;ord=' + a + '?" width="1" height="1" frameborder="0" style="display:none"></iframe>');
</script>
<noscript>
<iframe src="https://2507573.fls.doubleclick.net/activityi;src=2507573;type=other026;cat=googl348;ord=1?" width="1" height="1" frameborder="0" style="display:none"></iframe>
</noscript>
<!-- End of Tag -->
</body>
</html>

View File

@@ -1,693 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
<title>Get Started with the Developer Preview | Android Developers</title>
<!-- STYLESHEETS -->
<link rel="stylesheet"
href="//fonts.googleapis.com/css?family=Roboto:light,regular,medium,thin,italic,mediumitalic,bold" title="roboto">
<link href="/assets/css/default.css" rel="stylesheet" type="text/css">
<!-- JAVASCRIPT -->
<script src="//www.google.com/jsapi" type="text/javascript"></script>
<script src="/assets/js/android_3p-bundle.js" type="text/javascript"></script>
<script type="text/javascript">
var toRoot = "/";
var metaTags = [];
var devsite = false;
</script>
<script src="/assets/js/docs.js" type="text/javascript"></script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-5831155-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body class="gc-documentation
" itemscope itemtype="http://schema.org/Article">
<a name="top"></a>
<!-- Header -->
<div id="header">
<div class="wrap" id="header-wrap">
<div class="col-3 logo-wear">
<a href="/wear/index.html">
<img src="/wear/images/android-wear.png" height="16" alt="Android Wear" />
</a>
</div>
<div class="col-8" style="margin:0"><h1 style="margin:1px 0 0 20px;padding:0;line-height:16px;
color:#666;font-weight:100;font-size:24px;">Developer Preview</h1></div>
<!-- New Search -->
<div class="menu-container">
<div class="moremenu">
<div id="more-btn"></div>
</div>
<div class="morehover" id="moremenu">
<div class="top"></div>
<div class="mid">
<div class="header">Links</div>
<ul>
<li><a href="https://play.google.com/apps/publish/">Google Play Developer Console</a></li>
<li><a href="http://android-developers.blogspot.com/">Android Developers Blog</a></li>
<li><a href="/about/index.html">About Android</a></li>
</ul>
<div class="header">Android Sites</div>
<ul>
<li><a href="http://www.android.com">Android.com</a></li>
<li class="active"><a>Android Developers</a></li>
<li><a href="http://source.android.com">Android Open Source Project</a></li>
</ul>
<div class="header">Language</div>
<div id="language" class="locales">
<select name="language" onChange="changeLangPref(this.value, true)">
<option value="en">English</option>
<option value="es">Español</option>
<option value="ja">日本語</option>
<option value="ko">한국어</option>
<option value="ru">Русский</option>
<option value="zh-cn">中文 (中国)</option>
<option value="zh-tw">中文 (台灣)</option>
</select>
</div>
<script type="text/javascript">
<!--
loadLangPref();
//-->
</script>
<br class="clearfix" />
</div><!-- end mid -->
<div class="bottom"></div>
</div><!-- end morehover -->
<div class="search" id="search-container">
<div class="search-inner">
<div id="search-btn"></div>
<div class="left"></div>
<form onsubmit="return submit_search()">
<input id="search_autocomplete" type="text" value="" autocomplete="off" name="q"
onfocus="search_focus_changed(this, true)" onblur="search_focus_changed(this, false)"
onkeydown="return search_changed(event, true, '/')"
onkeyup="return search_changed(event, false, '/')" />
</form>
<div class="right"></div>
<a class="close hide">close</a>
<div class="left"></div>
<div class="right"></div>
</div>
</div><!-- end search -->
<div class="search_filtered_wrapper reference">
<div class="suggest-card reference no-display">
<ul class="search_filtered">
</ul>
</div>
</div>
<div class="search_filtered_wrapper docs">
<div class="suggest-card dummy no-display">&nbsp;</div>
<div class="suggest-card develop no-display">
<ul class="search_filtered">
</ul>
<div class="child-card guides no-display">
</div>
<div class="child-card training no-display">
</div>
<div class="child-card samples no-display">
</div>
</div>
<div class="suggest-card design no-display">
<ul class="search_filtered">
</ul>
</div>
<div class="suggest-card distribute no-display">
<ul class="search_filtered">
</ul>
</div>
</div><!-- end search_filtered_wrapper -->
</div>
<!-- end menu_container -->
</div><!-- end header-wrap -->
</div>
<!-- /Header -->
<div id="searchResults" class="wrap" style="display:none;">
<h2 id="searchTitle">Results</h2>
<div id="leftSearchControl" class="search-control">Loading...</div>
</div>
<div class="wrap clearfix" id="body-content">
<div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
<div id="devdoc-nav" class="scroll-pane">
<a class="totop" href="#top" data-g-event="left-nav-top">to top</a>
<ul id="nav">
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/preview/start.html">Get Started
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/design/user-interface.html">UI Overview
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/design/index.html">Design Principles
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/notifications/creating.html">Creating Notifications for Android Wear
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/notifications/remote-input.html">Receiving Voice Input from a Notification
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/notifications/pages.html">Adding Pages to a Notification
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/notifications/stacks.html">Stacking Notifications
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header"><a href="/reference/android/preview/support/package-summary.html">Notification Reference</a></div>
<ul class="tree-list-children">
<li class="nav-section">
<div class="nav-section-header-ref"><span class="tree-list-subtitle package" title="android.preview.support.v4.app">android.preview.support.v4.app</span></div>
<ul>
<li><a href="/reference/android/preview/support/v4/app/NotificationManagerCompat.html">NotificationManagerCompat</a></li>
</ul>
</li>
<li class="nav-section">
<div class="nav-section-header-ref"><span class="tree-list-subtitle package" title="android.preview.support.wearable.notifications">android.preview.support.wearable.notifications</span></div>
<ul>
<li><a href="/reference/android/preview/support/wearable/notifications/RemoteInput.html">RemoteInput</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/RemoteInput.Builder.html" >RemoteInput.Builder</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.html">WearableNotifications</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Action.html">WearableNotifications.Action</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Action.Builder.html">WearableNotifications.Action.Builder</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html">WearableNotifications.Builder</a></li>
</ul>
</li>
</ul>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/license.html">License Agreement</a></div>
</li>
</ul>
</div>
</div> <!-- end side-nav -->
<script>
$(document).ready(function() {
scrollIntoView("devdoc-nav");
});
</script>
<div class="col-12" id="doc-col" >
<h1 itemprop="name" >Get Started with the Developer Preview</h1>
<div id="jd-content">
<div class="jd-descr" itemprop="articleBody">
<div class="cols">
<div class="col-5">
<p>The Android Wear Developer Preview includes tools and APIs that allow you to
enhance your app notifications
to provide an optimized user experience on Android wearables.</p>
<p>With the Android Wear Developer Preview, you can:</p>
<ul>
<li>Run the Android Wear platform in the Android emulator.</li>
<li>Connect your Android device to the emulator and view notifications from the
device as cards on Android Wear.</li>
<li>Try new APIs in the preview support library that enhance your app's notifications
with features such as voice replies and notification pages.</li>
</ul>
<p>To get access to the Developer Preview tools,
click the sign up button on the right, then follow the setup instructions below.</p>
</div>
<div class="col-7">
<img src="/wear/images/laptop-bridge.png" width="400" height="222" alt="" />
<a href="/wear/preview/signup.html" class="button" style="
width: 370px;
margin: 10px 0 20px;
font-weight: bold;
font-size: 16px;
">Sign Up for the Developer Preview</a>
<p>Signing up provides you access to:</p>
<ul>
<li>New notification APIs in the preview support library.</li>
<li>Sample apps using the new notification APIs.</li>
<li>The <em>Android Wear Preview</em> app for your mobile device, which connects
your device to the Android Wear emulator.</li>
</ul>
</div>
</div>
<p class="caution"><strong>Caution:</strong>
The current Android Wear Developer Preview is intended for <b>development and testing purposes only</b>, not for production apps. Google may change this Developer Preview significantly prior to the official release of the Android Wear SDK. You may not publicly distribute or ship any application using this Developer Preview, as this Developer Preview will no longer be supported after the official SDK is released (which will cause applications based only on the Developer Preview to break).</p>
<h2 id="Prereq">Prerequisites</h2>
<p>Before you begin the setup, you must:</p>
<ol>
<li><a href="/sdk/index.html"><b>Install the Android SDK</b></a>.
<p>The Android SDK includes all the developer tools required to build
apps for Android (optional IDEs are also available for download).</p></li>
<li><a href="/wear/preview/signup.html"><b>Sign up for the Android Wear Developer Preview</b></a>.
<p>You must sign up with a Gmail or other Google account in order to download the
preview support library and receive access to the
<em>Android Wear Preview</em> beta app on Google Play Store.</p></li>
</ol>
<p class="note"><strong>Note:</strong>
If you're using the ADT plugin for Eclipse, you must update to version 22.6.1 or higher.
If you're using Android Studio, you must update to version 0.5.1 or higher</p>
<h2 id="Install">1. Install the Android Wear System Image</h2>
<ol>
<li>Launch <a href="/tools/help/sdk-manager.html"
>Android SDK Manager</a>.
<ul>
<li>From Eclipse, select <b>Window > Android SDK Manager</b>.</li>
<li>From Android Studio, select <b>Tools > Android > SDK Manager</b>.</li>
</ul>
</li>
<li>Below Tools, verify that you have Android SDK Tools revision 22.6 or higher.
<p>If your version of Android SDK Tools is lower than 22.6, you must update:</p>
<ol>
<li>Select <strong>Android SDK Tools</strong>.</li>
<li>Click <strong>Install package</strong>.</li>
<li>Accept the license and click <strong>Install</strong>.</li>
<li>When the installation completes, restart Android SDK Manager.</li>
</ol>
</li>
<li>Below Android 4.4.2, select <strong>Android Wear ARM EABI v7a System Image</strong>.
<p class="note"><strong>Note:</strong> Android Wear is designed to support multiple processor architectures.
</p></li>
<li>Below Extras, ensure that you have the latest version of the
<a href="/tools/support-library/index.html">Android Support Library</a>.
If an update is available, select <strong>Android Support Library</strong>. If you're using Android Studio, also select <strong>Android Support Repository</strong>.</li>
<li>Click <strong>Install packages</strong>.</li>
<li>Accept the license and click <strong>Install</strong>.</li>
</ol>
<h2 id="SetupEmulator">2. Set Up the Android Wear Emulator</h2>
<ol>
<li>Launch the <a href="/tools/help/avd-manager.html"
>Android Virtual Device Manager</a>.
<ul>
<li>From Eclipse, select <b>Window > Android Virtual Device Manager</b>.</li>
<li>From Android Studio, select <b>Tools > Android > AVD Manager</b>.</li>
</ul>
</li>
<li>Click <strong>New</strong>.</li>
<li>For the AVD Name, enter "AndroidWearSquare" or "AndroidWearRound", depending on whether
you want to create an emulator with a square or round display.</li>
<li>For the Device, select <strong>Android Wear Square</strong> or
<strong>Android Wear Round</strong>.</li>
<li>For the Target, select <strong>Android 4.4.2 - API Level 19</strong> (or higher).</li>
<li>For the CPU/ABI, select <strong>Android Wear ARM (armeabi-v7a)</strong>.
<p class="note"><strong>Note:</strong> Android Wear is designed to support multiple processor architectures.
</p></li>
<li>For the Skin, select <strong>AndroidWearSquare</strong> or
<strong>AndroidWearRound</strong>.</li>
<li>Leave all other options set to their defaults and click <strong>OK</strong>.
<p>Although real Android wearables do not provide a keyboard as an input method,
you should keep <strong>Hardware keyboard present</strong> selected so you can
provide text input on screens where users will instead provide voice input.</p>
</li>
<!--
<li>Click <strong>Device Definitions</strong>.</li>
<li>Select <strong>Android WearSquare</strong> then click <strong>Create AVD</strong>.</li>
<li>Click <strong>OK</strong>.</li>
-->
<li>In the list of AVDs, select the one you just created and click
<strong>Start</strong>. In the following window, click <strong>Launch</strong>.</li>
</ol>
<p>The Android Wear emulator now starts. To begin testing your app's notifications,
you must now pair the emulator to your development device
that has the <em>Android Wear Preview</em> app installed.</p>
<p class="note"><strong>Tip:</strong> To improve the emulator startup time, edit your AVD
and enable <strong>Snapshot</strong> under Emulator Options. When you start the emulator,
select <strong>Save to snapshot</strong> then click <strong>Launch</strong>. Once the emulator
is running, close it to save a snapshot of the system.
Start the AVD again, but select <strong>Launch from snapshot</strong> and
deselect <strong>Save to snapshot</strong>.</p>
<p class="caution"><strong>Caution:</strong> Do not install apps on the Android Wear emulator.
The system does not support traditional Android apps and the result of running such apps is
unpredictable.</p>
<h2 id="SetupApp">3. Set Up the Android Wear Preview App</h2>
<p>To view your app's notifications on the Android Wear emulator, you must have the
<em>Android Wear Preview</em> app installed on your Android device (a phone or tablet).</p>
<p>To receive the Android Wear Preview app, you must <a
href="/wear/preview/signup.html">sign up for the Developer Preview</a> using the same
Gmail or Google account you use with Google Play Store.</p>
</p>
<p class="note"><strong>Note:</strong> The <em>Android Wear Preview</em> app is compatible with
Android 4.3 and higher and is not available for the Android emulator.</p>
<p>After you've signed up for the Developer Preview,
you'll receive a confirmation email that includes a link to opt-in to the
<em>Android Wear Preview</em> app beta program. Once you opt-in, it may take up to 24 hours for the
app to become available in Google Play Store.</p>
<p>After you install the <em>Android Wear Preview</em> app, you can set up
your device to communicate with the Android Wear emulator:</p>
<ol>
<li>Open the <em>Android Wear Preview</em> app. You should see a notice that the app is currently
not enabled as a notification listener. Tap the message to open the system settings,
then select Android Wear Preview to grant it notification access.</li>
<li>Connect your device to your development machine over USB. Be sure that no other
Android devices are connected to the machine.</li>
<li>Ensure that the Android Wear emulator (created in the previous section) is running.
The emulator should show the time and an icon that indicates no device is connected.</li>
<li>Open a command line terminal, navigate to your Android SDK's <code>platform-tools/</code>
directory, then execute:
<pre style="margin-top:.5em">adb -d forward tcp:5601 tcp:5601</pre>
<p class="note"><strong>Note:</strong> You must execute this command each time you connect your
device over USB.</p>
</li>
<li>Return to the Android Wear Preview app. It should now indicate that it is connected to
the emulator. The Android Wear emulator should now show the 'g' orb icon, indicating
that is is connected to your device.
</ol>
<p>Now, notifications from your device also appear in the Android Wear emulator.</p>
<h2 id="AddLibrary">4. Add the Support Library to Your Project</h2>
<p>The Android Wear preview support library includes several APIs that allow you to
optimize your app's notifications for the Android Wear user experience.</p>
<p>To receive the preview support library, you must <a
href="/wear/preview/signup.html">sign up for the Developer Preview</a>. The
confirmation email you receive after you sign up includes a link to download a ZIP file,
which contains the preview support library and some sample apps.</p>
<p>After you download and unzip the package, add the preview support library
sto your Android project:</p>
<p><b>If you're using Eclipse:</b></p>
<ol>
<li>In your Android app project, create a <code>libs/</code> directory in your project root
(the same location as the <code>AndroidManifest.xml</code> file).</li>
<li>Copy the v4 support library JAR file from your Android SDK directory (e.g.,
<code>&lt;sdk&gt;/extras/android/support/v4/android-support-v4.jar</code>) into your
project <code>libs/</code> directory.
<li>Also save the <code>wearable-preview-support.jar</code> file in the <code>libs/</code> directory.
<li>Right click each JAR file and select <strong>Build Path &gt; Add to Build Path</strong>.</li>
</ol>
<p><b>If you're using Android Studio:</b></p>
<ol>
<li>In your Android app project, create a <code>libs/</code> directory in your project root
(the same location as the <code>AndroidManifest.xml</code> file).</li>
<li>Save the <code>wearable-preview-support.jar</code> file in the <code>libs/</code> directory.
<li>Open the <code>build.gradle</code> file in your app module.</li>
<li>Add a dependency rule for both the v4 support library and the Android Wear
preview support library:
<pre>
dependencies {
compile "com.android.support:support-v4:18.0.+"
compile files('../libs/wearable-preview-support.jar')
}
</pre>
</li>
<li>Click <strong>Sync Project with Gradle Files</strong> in the toolbar.</li>
</ol>
<p>To start optimizing your notifications for Android Wear,
read <a href="/wear/notifications/creating.html"
>Creating Notifications for Android Wear</a>.</p>
</body>
</html>
</div>
<div class="content-footer layout-content-row"
itemscope itemtype="http://schema.org/SiteNavigationElement">
<div class="layout-content-col col-9" style="padding-top:4px">
<div class="g-plusone" data-size="medium"></div>
</div>
<div class="paging-links layout-content-col col-4">
</div>
</div>
</div> <!-- end jd-content -->
<div id="footer" class="wrap" >
<div id="copyright">
Except as noted, this content is
licensed under <a href="http://creativecommons.org/licenses/by/2.5/">
Creative Commons Attribution 2.5</a>. For details and
restrictions, see the <a href="/license.html">Content
License</a>.
</div>
<div id="footerlinks">
<p>
<a href="/about/index.html">About Android</a>&nbsp;&nbsp;|&nbsp;
<a href="/legal.html">Legal</a>&nbsp;&nbsp;|&nbsp;
<a href="/support.html">Support</a>
</p>
</div>
</div> <!-- end footer -->
</div><!-- end doc-content -->
</div> <!-- end body-content -->
<!-- Start of Tag -->
<script type="text/javascript">
var axel = Math.random() + "";
var a = axel * 10000000000000;
document.write('<iframe src="https://2507573.fls.doubleclick.net/activityi;src=2507573;type=other026;cat=googl348;ord=' + a + '?" width="1" height="1" frameborder="0" style="display:none"></iframe>');
</script>
<noscript>
<iframe src="https://2507573.fls.doubleclick.net/activityi;src=2507573;type=other026;cat=googl348;ord=1?" width="1" height="1" frameborder="0" style="display:none"></iframe>
</noscript>
<!-- End of Tag -->
</body>
</html>

View File

@@ -0,0 +1,254 @@
page.title=Get Started with the Developer Preview
@jd:body
<div class="cols">
<div class="col-5">
<p>The Android Wear Developer Preview includes tools and APIs that allow you to
enhance your app notifications
to provide an optimized user experience on Android wearables.</p>
<p>With the Android Wear Developer Preview, you can:</p>
<ul>
<li>Run the Android Wear platform in the Android emulator.</li>
<li>Connect your Android device to the emulator and view notifications from the
device as cards on Android Wear.</li>
<li>Try new APIs in the preview support library that enhance your app's notifications
with features such as voice replies and notification pages.</li>
</ul>
<p>To get access to the Developer Preview tools,
click the sign up button on the right, then follow the setup instructions below.</p>
</div>
<div class="col-7">
<img src="/wear/images/laptop-bridge.png" width="400" height="222" alt="" />
<a href="/wear/preview/signup.html" class="button" style="
width: 370px;
margin: 10px 0 20px;
font-weight: bold;
font-size: 16px;
">Sign Up for the Developer Preview</a>
<p>Signing up provides you access to:</p>
<ul>
<li>New notification APIs in the preview support library.</li>
<li>Sample apps using the new notification APIs.</li>
<li>The <em>Android Wear Preview</em> app for your mobile device, which connects
your device to the Android Wear emulator.</li>
</ul>
</div>
</div>
<p class="caution"><strong>Caution:</strong>
The current Android Wear Developer Preview is intended for <b>development and testing purposes only</b>, not for production apps. Google may change this Developer Preview significantly prior to the official release of the Android Wear SDK. You may not publicly distribute or ship any application using this Developer Preview, as this Developer Preview will no longer be supported after the official SDK is released (which will cause applications based only on the Developer Preview to break).</p>
<h2 id="Prereq">Prerequisites</h2>
<p>Before you begin the setup, you must:</p>
<ol>
<li><a href="{@docRoot}sdk/index.html"><b>Install the Android SDK</b></a>.
<p>The Android SDK includes all the developer tools required to build
apps for Android (optional IDEs are also available for download).</p></li>
<li><a href="{@docRoot}wear/preview/signup.html"><b>Sign up for the Android Wear Developer Preview</b></a>.
<p>You must sign up with a Gmail or other Google account in order to download the
preview support library and receive access to the
<em>Android Wear Preview</em> beta app on Google Play Store.</p></li>
</ol>
<p class="note"><strong>Note:</strong>
If you're using the ADT plugin for Eclipse, you must update to version 22.6.1 or higher.
If you're using Android Studio, you must update to version 0.5.1 or higher</p>
<h2 id="Install">1. Install the Android Wear System Image</h2>
<ol>
<li>Launch <a href="{@docRoot}tools/help/sdk-manager.html"
>Android SDK Manager</a>.
<ul>
<li>From Eclipse, select <b>Window > Android SDK Manager</b>.</li>
<li>From Android Studio, select <b>Tools > Android > SDK Manager</b>.</li>
</ul>
</li>
<li>Below Tools, verify that you have Android SDK Tools revision 22.6 or higher.
<p>If your version of Android SDK Tools is lower than 22.6, you must update:</p>
<ol>
<li>Select <strong>Android SDK Tools</strong>.</li>
<li>Click <strong>Install package</strong>.</li>
<li>Accept the license and click <strong>Install</strong>.</li>
<li>When the installation completes, restart Android SDK Manager.</li>
</ol>
</li>
<li>Below Android 4.4.2, select <strong>Android Wear ARM EABI v7a System Image</strong>.
<p class="note"><strong>Note:</strong> Android Wear is designed to support multiple processor architectures.
</p></li>
<li>Below Extras, ensure that you have the latest version of the
<a href="{@docRoot}tools/support-library/index.html">Android Support Library</a>.
If an update is available, select <strong>Android Support Library</strong>. If you're using Android Studio, also select <strong>Android Support Repository</strong>.</li>
<li>Click <strong>Install packages</strong>.</li>
<li>Accept the license and click <strong>Install</strong>.</li>
</ol>
<h2 id="SetupEmulator">2. Set Up the Android Wear Emulator</h2>
<ol>
<li>Launch the <a href="{@docRoot}tools/help/avd-manager.html"
>Android Virtual Device Manager</a>.
<ul>
<li>From Eclipse, select <b>Window > Android Virtual Device Manager</b>.</li>
<li>From Android Studio, select <b>Tools > Android > AVD Manager</b>.</li>
</ul>
</li>
<li>Click <strong>New</strong>.</li>
<li>For the AVD Name, enter "AndroidWearSquare" or "AndroidWearRound", depending on whether
you want to create an emulator with a square or round display.</li>
<li>For the Device, select <strong>Android Wear Square</strong> or
<strong>Android Wear Round</strong>.</li>
<li>For the Target, select <strong>Android 4.4.2 - API Level 19</strong> (or higher).</li>
<li>For the CPU/ABI, select <strong>Android Wear ARM (armeabi-v7a)</strong>.
<p class="note"><strong>Note:</strong> Android Wear is designed to support multiple processor architectures.
</p></li>
<li>For the Skin, select <strong>AndroidWearSquare</strong> or
<strong>AndroidWearRound</strong>.</li>
<li>Leave all other options set to their defaults and click <strong>OK</strong>.
<p>Although real Android wearables do not provide a keyboard as an input method,
you should keep <strong>Hardware keyboard present</strong> selected so you can
provide text input on screens where users will instead provide voice input.</p>
</li>
<!--
<li>Click <strong>Device Definitions</strong>.</li>
<li>Select <strong>Android WearSquare</strong> then click <strong>Create AVD</strong>.</li>
<li>Click <strong>OK</strong>.</li>
-->
<li>In the list of AVDs, select the one you just created and click
<strong>Start</strong>. In the following window, click <strong>Launch</strong>.</li>
</ol>
<p>The Android Wear emulator now starts. To begin testing your app's notifications,
you must now pair the emulator to your development device
that has the <em>Android Wear Preview</em> app installed.</p>
<p class="note"><strong>Tip:</strong> To improve the emulator startup time, edit your AVD
and enable <strong>Snapshot</strong> under Emulator Options. When you start the emulator,
select <strong>Save to snapshot</strong> then click <strong>Launch</strong>. Once the emulator
is running, close it to save a snapshot of the system.
Start the AVD again, but select <strong>Launch from snapshot</strong> and
deselect <strong>Save to snapshot</strong>.</p>
<p class="caution"><strong>Caution:</strong> Do not install apps on the Android Wear emulator.
The system does not support traditional Android apps and the result of running such apps is
unpredictable.</p>
<h2 id="SetupApp">3. Set Up the Android Wear Preview App</h2>
<p>To view your app's notifications on the Android Wear emulator, you must have the
<em>Android Wear Preview</em> app installed on your Android device (a phone or tablet).</p>
<p>To receive the Android Wear Preview app, you must <a
href="{@docRoot}wear/preview/signup.html">sign up for the Developer Preview</a> using the same
Gmail or Google account you use with Google Play Store.</p>
</p>
<p class="note"><strong>Note:</strong> The <em>Android Wear Preview</em> app is compatible with
Android 4.3 and higher and is not available for the Android emulator.</p>
<p>After you've signed up for the Developer Preview,
you'll receive a confirmation email that includes a link to opt-in to the
<em>Android Wear Preview</em> app beta program. Once you opt-in, it may take up to 24 hours for the
app to become available in Google Play Store.</p>
<p>After you install the <em>Android Wear Preview</em> app, you can set up
your device to communicate with the Android Wear emulator:</p>
<ol>
<li>Open the <em>Android Wear Preview</em> app. You should see a notice that the app is currently
not enabled as a notification listener. Tap the message to open the system settings,
then select Android Wear Preview to grant it notification access.</li>
<li>Connect your device to your development machine over USB. Be sure that no other
Android devices are connected to the machine.</li>
<li>Ensure that the Android Wear emulator (created in the previous section) is running.
The emulator should show the time and an icon that indicates no device is connected.</li>
<li>Open a command line terminal, navigate to your Android SDK's <code>platform-tools/</code>
directory, then execute:
<pre style="margin-top:.5em">adb -d forward tcp:5601 tcp:5601</pre>
<p class="note"><strong>Note:</strong> You must execute this command each time you connect your
device over USB.</p>
</li>
<li>Return to the Android Wear Preview app. It should now indicate that it is connected to
the emulator. The Android Wear emulator should now show the 'g' orb icon, indicating
that is is connected to your device.
</ol>
<p>Now, notifications from your device also appear in the Android Wear emulator.</p>
<h2 id="AddLibrary">4. Add the Support Library to Your Project</h2>
<p>The Android Wear preview support library includes several APIs that allow you to
optimize your app's notifications for the Android Wear user experience.</p>
<p>To receive the preview support library, you must <a
href="{@docRoot}wear/preview/signup.html">sign up for the Developer Preview</a>. The
confirmation email you receive after you sign up includes a link to download a ZIP file,
which contains the preview support library and some sample apps.</p>
<p>After you download and unzip the package, add the preview support library
sto your Android project:</p>
<p><b>If you're using Eclipse:</b></p>
<ol>
<li>In your Android app project, create a <code>libs/</code> directory in your project root
(the same location as the <code>AndroidManifest.xml</code> file).</li>
<li>Copy the v4 support library JAR file from your Android SDK directory (e.g.,
<code>&lt;sdk&gt;/extras/android/support/v4/android-support-v4.jar</code>) into your
project <code>libs/</code> directory.
<li>Also save the <code>wearable-preview-support.jar</code> file in the <code>libs/</code> directory.
<li>Right click each JAR file and select <strong>Build Path &gt; Add to Build Path</strong>.</li>
</ol>
<p><b>If you're using Android Studio:</b></p>
<ol>
<li>In your Android app project, create a <code>libs/</code> directory in your project root
(the same location as the <code>AndroidManifest.xml</code> file).</li>
<li>Save the <code>wearable-preview-support.jar</code> file in the <code>libs/</code> directory.
<li>Open the <code>build.gradle</code> file in your app module.</li>
<li>Add a dependency rule for both the v4 support library and the Android Wear
preview support library:
<pre>
dependencies {
compile "com.android.support:support-v4:18.0.+"
compile files('../libs/wearable-preview-support.jar')
}
</pre>
</li>
<li>Click <strong>Sync Project with Gradle Files</strong> in the toolbar.</li>
</ol>
<p>To start optimizing your notifications for Android Wear,
read <a href="{@docRoot}wear/notifications/creating.html"
>Creating Notifications for Android Wear</a>.</p>
</body>
</html>

View File

@@ -0,0 +1,74 @@
<ul id="nav">
<li class="nav-section">
<div class="nav-section-header empty"><a href="<?cs var:toroot ?>wear/preview/start.html">Get Started
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="<?cs var:toroot ?>wear/design/user-interface.html">UI Overview
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="<?cs var:toroot ?>wear/design/index.html">Design Principles
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="<?cs var:toroot ?>wear/notifications/creating.html">Creating Notifications for Android Wear
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="<?cs var:toroot ?>wear/notifications/remote-input.html">Receiving Voice Input from a Notification
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="<?cs var:toroot ?>wear/notifications/pages.html">Adding Pages to a Notification
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="<?cs var:toroot ?>wear/notifications/stacks.html">Stacking Notifications
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header"><a href="<?cs var:toroot ?>reference/android/preview/support/package-summary.html">Notification Reference</a></div>
<ul class="tree-list-children">
<li class="nav-section">
<div class="nav-section-header-ref"><span class="tree-list-subtitle package" title="android.preview.support.v4.app">android.preview.support.v4.app</span></div>
<ul>
<li><a href="<?cs var:toroot ?>reference/android/preview/support/v4/app/NotificationManagerCompat.html">NotificationManagerCompat</a></li>
</ul>
</li>
<li class="nav-section">
<div class="nav-section-header-ref"><span class="tree-list-subtitle package" title="android.preview.support.wearable.notifications">android.preview.support.wearable.notifications</span></div>
<ul>
<li><a href="<?cs var:toroot ?>reference/android/preview/support/wearable/notifications/RemoteInput.html">RemoteInput</a></li>
<li><a href="<?cs var:toroot ?>reference/android/preview/support/wearable/notifications/RemoteInput.Builder.html" >RemoteInput.Builder</a></li>
<li><a href="<?cs var:toroot ?>reference/android/preview/support/wearable/notifications/WearableNotifications.html">WearableNotifications</a></li>
<li><a href="<?cs var:toroot ?>reference/android/preview/support/wearable/notifications/WearableNotifications.Action.html">WearableNotifications.Action</a></li>
<li><a href="<?cs var:toroot ?>reference/android/preview/support/wearable/notifications/WearableNotifications.Action.Builder.html">WearableNotifications.Action.Builder</a></li>
<li><a href="<?cs var:toroot ?>reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html">WearableNotifications.Builder</a></li>
</ul>
</li>
</ul>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="<?cs var:toroot ?>wear/license.html">License Agreement</a></div>
</li>
</ul>