diff options
Diffstat (limited to 'docs')
35 files changed, 2322 insertions, 5431 deletions
diff --git a/docs/html/design/index.jd b/docs/html/design/index.jd index 9ba32dd..7c7c5d9 100644 --- a/docs/html/design/index.jd +++ b/docs/html/design/index.jd @@ -1,4 +1,5 @@ page.title=Design +page.viewport_width=970 header.hide=1 footer.hide=1 @jd:body diff --git a/docs/html/develop/index.jd b/docs/html/develop/index.jd index 3f88b9d..eb28da8 100644 --- a/docs/html/develop/index.jd +++ b/docs/html/develop/index.jd @@ -1,5 +1,6 @@ fullpage=true page.title=Develop +page.viewport_width=970 header.hide=1 carousel=1 tabbedList=1 diff --git a/docs/html/distribute/index.jd b/docs/html/distribute/index.jd index 544fdff..6c6e113 100644 --- a/docs/html/distribute/index.jd +++ b/docs/html/distribute/index.jd @@ -1,4 +1,5 @@ page.title=Distribute Apps +page.viewport_width=970 header.hide=1 @jd:body diff --git a/docs/html/google/play-services/index.jd b/docs/html/google/play-services/index.jd index 26b4ccc..5da0b75 100644 --- a/docs/html/google/play-services/index.jd +++ b/docs/html/google/play-services/index.jd @@ -71,7 +71,7 @@ announcement <a href="http://android-developers.blogspot.com/2014/03/google-play </li> <li><strong>Analytics</strong> - Google Analytics and Tag Manager are now part of Google Play services. <ul> - <li><a href="http://developers.google.com/analytics/devguides/collection/android/v3/" class="external-link">Getting Started with the Analytics API in Android</a></li> + <li><a href="http://developers.google.com/analytics/devguides/collection/android/v4/" class="external-link">Getting Started with the Analytics API in Android</a></li> <li><a href="/reference/com/google/android/gms/analytics/package-summary.html">Analytics API reference</a></li> <li><a href="http://developers.google.com/tag-manager/android/" class="external-link">Getting Started with the Tag Manager API in Android</a></li> <li><a href="/reference/com/google/android/gms/tagmanager/package-summary.html">Tag Manager API reference</a></li> diff --git a/docs/html/images/tools/as-buildvariants.png b/docs/html/images/tools/as-buildvariants.png Binary files differnew file mode 100644 index 0000000..a245163 --- /dev/null +++ b/docs/html/images/tools/as-buildvariants.png diff --git a/docs/html/images/tools/as-demoflavordirs.png b/docs/html/images/tools/as-demoflavordirs.png Binary files differnew file mode 100644 index 0000000..9d36a6d --- /dev/null +++ b/docs/html/images/tools/as-demoflavordirs.png diff --git a/docs/html/images/tools/as-gradlebutton.png b/docs/html/images/tools/as-gradlebutton.png Binary files differnew file mode 100644 index 0000000..091b935 --- /dev/null +++ b/docs/html/images/tools/as-gradlebutton.png diff --git a/docs/html/images/tools/as-gradleconsole.png b/docs/html/images/tools/as-gradleconsole.png Binary files differnew file mode 100644 index 0000000..c676c94 --- /dev/null +++ b/docs/html/images/tools/as-gradleconsole.png diff --git a/docs/html/images/tools/as-gradlepanel.png b/docs/html/images/tools/as-gradlepanel.png Binary files differnew file mode 100644 index 0000000..a409462 --- /dev/null +++ b/docs/html/images/tools/as-gradlepanel.png diff --git a/docs/html/images/tools/as-gradlesync.png b/docs/html/images/tools/as-gradlesync.png Binary files differnew file mode 100644 index 0000000..b312359 --- /dev/null +++ b/docs/html/images/tools/as-gradlesync.png diff --git a/docs/html/images/tools/as-mainscreen.png b/docs/html/images/tools/as-mainscreen.png Binary files differnew file mode 100644 index 0000000..da399d7 --- /dev/null +++ b/docs/html/images/tools/as-mainscreen.png diff --git a/docs/html/index.jd b/docs/html/index.jd index baeaa5b..99a469a 100644 --- a/docs/html/index.jd +++ b/docs/html/index.jd @@ -1,4 +1,5 @@ fullpage=true +page.viewport_width=970 no_footer_links=true carousel=true excludeFromSuggestions=true @@ -20,7 +21,7 @@ page.customHeadTag=<meta name="google-site-verification" content="sa-bIAI6GKvct3 <li class="item carousel-home"> <div class="content-left col-10" style="width:580px;"> - <a href="{@docRoot}design/patterns/new.html"> + <a href="{@docRoot}wear/index.html"> <img src="{@docRoot}images/home/aw_dac.png" style="margin-top:50px" > </a> </div> diff --git a/docs/html/sdk/installing/installing-adt.jd b/docs/html/sdk/installing/installing-adt.jd index 1f5ca11..e4cf1bc 100644 --- a/docs/html/sdk/installing/installing-adt.jd +++ b/docs/html/sdk/installing/installing-adt.jd @@ -35,10 +35,10 @@ Software</strong>.</li> <li>In the Add Repository dialog that appears, enter "ADT Plugin" for the <em>Name</em> and the following URL for the <em>Location</em>: <pre>https://dl-ssl.google.com/android/eclipse/</pre> + <p class="note"><strong>Note:</strong> The Android Developer Tools update site requires + a secure connection. Make sure the update site URL you enter starts with HTTPS.</p> </li> - <li>Click <strong>OK</strong>. - <p>If you have trouble acquiring the plugin, try using "http" in the Location URL, -instead of "https" (https is preferred for security reasons).</p></li> + <li>Click <strong>OK</strong>.</li> <li>In the Available Software dialog, select the checkbox next to Developer Tools and click <strong>Next</strong>.</li> <li>In the next window, you'll see a list of the tools to be downloaded. Click @@ -139,23 +139,16 @@ Software</strong>, uncheck "Contact all update sites during install to find requ <h2 id="Troubleshooting">Troubleshooting ADT Installation</h2> -<p> If you are having trouble downloading the ADT plugin after following the -steps above, here are some suggestions: </p> - -<ul> - <li>If Eclipse can not find the remote update site containing the ADT plugin, -try changing the remote site URL to use http, rather than https. That is, set -the Location for the remote site to: -<pre>http://dl-ssl.google.com/android/eclipse/</pre></li> -<li>If you are behind a firewall (such as a corporate firewall), make sure that +<p>If you are having trouble downloading the ADT plugin after following the +steps above and you are behind a firewall (such as a corporate firewall), make sure that you have properly configured your proxy settings in Eclipse. In Eclipse, you can configure proxy information from the main Eclipse menu in <strong>Window</strong> (on Mac OS X, <strong>Eclipse</strong>) > <strong>Preferences</strong> > <strong>General</strong> > <strong>Network -Connections</strong>.</li> -</ul> +Connections</strong>. +</p> -<p> If you are still unable to use Eclipse to download the ADT plugin as a +<p>If you are still unable to use Eclipse to download the ADT plugin as a remote update site, you can download the ADT zip file to your local machine and manually install it:</p> diff --git a/docs/html/sdk/installing/studio-build.jd b/docs/html/sdk/installing/studio-build.jd new file mode 100644 index 0000000..41ad5de --- /dev/null +++ b/docs/html/sdk/installing/studio-build.jd @@ -0,0 +1,1065 @@ +page.title=Building your Project + +@jd:body + +<div id="qv-wrapper"> +<div id="qv"> +<h2>In this document</h2> +<ol> + <li><a href="#overviewBuild">Overview of the Build System</a> + <ol> + <li><a href="#buildConf">Build configuration</a></li> + <li><a href="#buildConv">Build by convention</a></li> + <li><a href="#projectModules">Projects and modules</a></li> + <li><a href="#dependencies">Dependencies</a></li> + <li><a href="#buildTasks">Build tasks</a></li> + <li><a href="#gradleWrapper">The Gradle wrapper</a></li> + </ol> + </li> + <li><a href="#creatingBuilding">Create and Build a Project</a> + <ol> + <li><a href="#createProject">Create a project</a></li> + <li><a href="#projectStructure">Project structure</a></li> + <li><a href="#addLibModule">Add a library module</a></li> + <li><a href="#buildProject">Build the project</a></li> + <li><a href="#buildCmd">Build from the command line</a></li> + </ol> + </li> + <li><a href="#configBuild">Configure the Build</a> + <ol> + <li><a href="#buildFileBasics">Build file basics</a></li> + <li><a href="#declareDeps">Declare dependencies</a></li> + <li><a href="#runProguard">Run ProGuard</a></li> + <li><a href="#configureSigning">Configure signing settings</a></li> + <li><a href="#workBuildVariants">Work with build variants</a></li> + </ol> + </li> + <li><a href="#reference">Reference</a></li> +</ol> +<h2>See also</h2> +<ul> +<li><a href="{@docRoot}sdk/installing/studio.html"> +Getting Started with Android Studio</a></li> +<li><a href="{@docRoot}sdk/installing/studio-tips.html"> +Android Studio Tips and Tricks</a></li> +<li><a href="{@docRoot}sdk/installing/migrate.html"> +Migrating from Eclipse</a></li> +</div> +</div> + +<a class="notice-developers-video" +href="https://developers.google.com/events/io/sessions/324603352"> +<div> + <h3>Video</h3> + <p>What's New in Android Developer Tools</p> +</div> +</a> + +<p>The Android Studio build system is the toolkit you use to build, test, run and package +your apps. The build system is independent from Android Studio, so you can invoke it from Android +Studio or from the command line. After you write your application, you can use the features +of the build system to:</p> + +<ul> + <li>Customize, configure, and extend the build process.</li> + <li>Create multiple APKs for your app with different features using the same project.</li> + <li>Reuse code and resources.</li> +</ul> + +<p>The flexibility of the Android Studio build system enables you to achieve all of this without +modifying your app's core project files.</p> + + +<h2 id="overviewBuild">Overview of the Build System</h2> + +<p>The Android Studio build system consists of an Android plugin for <em>Gradle</em>. +<a href="http://www.gradle.org/">Gradle</a> is an advanced build toolkit that manages dependencies +and allows you to define custom build logic. Many software projects use Gradle to manage their +builds. The Android plugin for Gradle does not depend on Android Studio, although Android Studio +is fully integrated with it. This means that:</p> + +<ul> + <li>You can build your Android apps from the command line on your machine or on machines + where Android Studio is not installed (such as continuous integration servers).</li> + <li>You can build your Android apps from Android Studio with the same custom build + configuration and logic as when you build from the command line.</li> +</ul> + +<p>The output of the build is the same whether you are building a project from the command line, +on a remote machine, or using Android Studio.</p> + +<h3 id="buildConf">Build configuration</h3> + +<p>The build configuration for your project is defined inside <em>Gradle build files</em>, +which are plain text files that use the syntax and options from Gradle and the Android plugin +to configure the following aspects of your build:</p> + +<ul> + <li><em>Build variants</em>. The build system can generate multiple APKs with different + configurations for the same project. This is useful when you want to build different + versions of your application without having to create a separate project for each of + them.</li> + <li><em>Dependencies</em>. The build system manages project dependencies and supports + dependencies from your local filesystem and from remote repositories. This prevents you + from having to search, download, and copy binary packages for your dependencies into your + project directory.</li> + <li><em>Manifest entries</em>. The build system enables you to specify values for some + elements of the manifest file in the build configuration. These new values override the + existing values in the manifest file. This is useful if you want to generate multiple APKs + for your project where each of them has a different package name, minimum SDK version, or + target SDK version.</li> + <li><em>Signing</em>. The build system enables you to specify signing settings in the build + configuration, and it can sign your APKs during the build process.</li> + <li><em>ProGuard</em>. The build system enables you to specify a different + <a href="{@docRoot}tools/help/proguard.html">ProGuard</a> rules + file for each build variant. The build system can run ProGuard to obfuscate your classes + during the build process.</li> + <li><em>Testing</em>. The build system generates a test APK from the test sources in your + project, so you do not have to create a separate test project. The build system can run + your tests during the build process.</li> +</ul> + +<p>Gradle build files use <em>Groovy</em> syntax. +<a href="http://groovy.codehaus.org/">Groovy</a> is a dynamic language that you can use to +define custom build logic and to interact with the Android-specific elements provided by the +Android plugin for Gradle.</p> + +<h3 id="buildConv">Build by convention</h3> + +<p>The Android Studio build system assumes <em>sensible defaults</em> for the project structure +and other build options. If your project adheres to these conventions, your Gradle build files are +very simple. When some these conventions do not apply to your project, the flexibility of the +build system allows you to configure almost every aspect of the build process. For example, if +the sources for your project are located in a different directory than the default, you can +specify this location in the build file.</p> + +<h3 id="projectModules">Projects and modules</h3> + +<p>A <em>project</em> in Android Studio represents a complete Android app. Android Studio +projects consist of one or more modules. A <em>module</em> is a component of your app that you can +build, test, or debug independently. Modules contain the source code and resources for your app. +Android Studio projects contain three kinds of modules:</p> + +<ul> + <li><em>Java library modules</em> contain reusable code. The build system generates a + JAR package for Java library modules.</li> + <li><em>Android library modules</em> contain reusable Android-specific code and resources. + The build system generates an AAR (Android ARchive) package for library modules.</li> + <li><em>Android application modules</em> contain application code and may depend on library + modules, although many Android apps consists of only one application module. The build + system generates an APK package for application modules.</li> +</ul> + +<p>Android Studio projects contain a top-level Gradle build file that lists all the modules in +the project, and each module contains its own Gradle build file.</p> + +<h3 id="dependencies">Dependencies</h3> + +<p>The Android Studio build system manages project dependencies and supports module dependencies, +local binary dependencies, and remote binary dependencies.</p> + +<dl> + <dt><em>Module Dependencies</em></dt> + <dd><p>A project module can include in its build file a list of other modules it depends on. + When you build this module, the build system assembles and includes the required + modules.</p></dd> + <dt><em>Local Dependencies</em></dt> + <dd><p>If you have binary archives in your local filesystem that a module depends on, such as + JAR files, you can declare these dependencies in the build file for that + module.</p></dd> + <dt><em>Remote Dependencies</em></dt> + <dd><p>When some of your dependencies are available in a remote repository, you do not have + to download them and copy them into your project. The Android Studio build system supports + remote <em>Maven</em> dependencies. <a href="http://maven.apache.org/">Maven</a> is a + popular software project management tool that helps organize project dependencies using + repositories.</p> + <p>Many popular software libraries and tools are available in public Maven repositories. + For these dependencies you only have to specify their Maven coordinates, which uniquely + identify each element in a remote repository. The format for Maven coordinates used in the + build system is <code>group:name:version</code>. For example, the Maven coordinates for + version 16.0.1 of the Google Guava libraries are + <code>com.google.guava:guava:16.0.1</code>.</p> + <p>The <a href="http://search.maven.org">Maven Central Repository</a> is widely used to + distribute many libraries and tools.</p> + </dd> +</dl> + +<h3 id="buildTasks">Build tasks</h3> + +<p>The Android Studio build system defines a hierarchical set of build tasks: the top-level +tasks invoke the tasks they depend on to produce the necessary outcomes. The build system +provides project tasks to build your app and module tasks to build modules independently.</p> + +<p>You can view the list of available tasks and invoke any task from Android Studio and from +the command line, as described in +<a href="#buildProject">Build the project in Android Studio</a> and and +<a href="#buildCmd">Build the project from the command line</a>.</p> + +<h3 id="gradleWrapper">The Gradle wrapper</h3> + +<p>Android Studio projects contain the <em>Gradle wrapper</em>, which consists of:</p> + +<ul> + <li>A JAR file</li> + <li>A properties file</li> + <li>A shell script for Windows platforms</li> + <li>A shell script for Mac and Linux platforms</li> +</ul> + +<p class="note"><strong>Note:</strong> You should submit all of these files to your source +control system.</p> + +<p>Using the Gradle wrapper (instead of the local Gradle installation) ensures that +you always run the version of Gradle defined in the properties file. To configure your project +to use a newer version of Gradle, edit the properties file and specify the new version there. + +<p>Android Studio reads the properties file from the Gradle wrapper directory inside your project +and runs the wrapper from this directory, so you can seamlessly work with multiple projects +that require different versions of Gradle.</p> + +<p class="note"><strong>Note:</strong> Android Studio does not use the shell scripts, so any +changes you make to them won't work when building from the IDE. You should define your custom +logic inside Gradle build files instead.</p> + +<p>You can run the shell scripts to build your project from the command line on your development +machine and on other machines where Android Studio is not installed.</p> + + +<h2 id="creatingBuilding">Create and Build an Android Studio Project</h2> + +<p>This section builds on the concepts presented above and shows you how to:</p> + +<ul> + <li>Create projects and modules.</li> + <li>Work with the project structure.</li> + <li>Edit build files to configure the build process.</li> + <li>Build and run your app.</li> +</ul> + +<h3 id="createProject">Create a project in Android Studio</h3> + +<p>To create a new project in Android Studio:</p> + +<ol> + <li>Click <strong>File</strong> and select <strong>New Project</strong>.</li> + <li>In the window that appears, enter "BuildSystemExample" in the <em>Application</em> + name field.</li> + <li>Leave the rest of the values unchanged and click <strong>Next</strong>.</li> + <li>Leave the default icon settings unchanged and click <strong>Next</strong>.</li> + <li>Select <em>Blank Activity</em> and click <strong>Next</strong>.</li> + <li>Leave the default activity and layout names unchanged and click + <strong>Finish</strong>.</li> +</ol> + +<p>Figure 1 shows how the Android Studio window looks like after creating the project.</p> + +<img src="{@docRoot}images/tools/as-mainscreen.png" alt="" /> +<p class="img-caption"><strong>Figure 1.</strong> Previewing your app.</p> + +<h3 id="projectStructure">The project structure</h3> + +<p>Android Studio projects contain an application module by default (<code>app</code>). +Table 1 lists where the main components of your app are located inside this module.</p> + +<p class="table-caption" id="table1"> +<strong>Table 1.</strong> Default location of the components in an application module.</p> +<table> + <tr> + <th scope="col">Component</th> + <th scope="col">Location</th> + </tr> + <tr> + <td>Source files</td> + <td><code>app/src/main/java/<package>/</code></td> + </tr> + <tr> + <td>Resource files</td> + <td><code>app/src/main/res/</code></td> + </tr> + <tr> + <td>Manifest file</td> + <td><code>app/src/main/AndroidManifest.xml</code></td> + </tr> + <tr> + <td>Build file</td> + <td><code>app/build.gradle</code></td> + </tr> +</table> + +<p>When you add additional modules to your project, the directory structure for each module is +similar to the one shown in table 1, replacing <code>app</code> by the name of the module.</p> + +<h3 id="addLibModule">Add a library module</h3> + +<p>This section shows you how to add a library module to your project and how to add this +library as a dependency of an application module.</p> + +<h4>Create a new library module</h4> + +<p>It is good development practice to group functionality that you may reuse in other apps inside +a library module. To create a library module inside the <code>BuildSystemExample</code> +project:</p> + +<ol> + <li>Click <strong>File</strong> and select <strong>New Module</strong>.</li> + <li>On the window that appears, select <strong>Android Library</strong> and click + <strong>Next</strong>.</li> + <li>Leave the default module name (<code>lib</code>) unchanged and click + <strong>Next</strong>.</li> + <li>Select <em>Blank Activity</em> and click <strong>Next</strong>.</li> + <li>Type "LibActivity1" on the <em>Activity Name</em> field and click + <strong>Finish</strong>.</li> +</ol> + +<p>The project now contains two modules, <code>app</code> and <code>lib</code>, with one activity +in each module.</p> + +<h4 id="openActFromLib">Open an activity from a library module</h4> + +<p>Library modules contain activities and other logic that one or more application modules reuse. +In this example, <code>MainActivity</code> in the app module opens <code>LibActivity1</code> +from the <code>lib</code> module. To open <code>LibActivity1</code> from +<code>MainActivity</code>:</p> + +<ol> + <li> + <p>Edit the layout file for <code>MainActivity</code> in the <code>app</code> module. + This file is located in <code>app/src/main/res/layout/activity_main.xml</code>. Replace + the contents of this file with the following:</p> + <p><pre> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:context="com.buildsystemexample.app.MainActivity"> + + <Button + android:id="@+id/button1" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/button1" + android:onClick="onButton1Clicked"/> + +</LinearLayout> +</pre></p> + </li> + <li> + In this layout file, click on the line that contains + <code>android:text="@string/button1"</code> and press <strong>Alt+Enter</strong>. Follow + the suggestion from Android Studio to add a string resource with the value + "Open LibActivity1". + </li> + <li> + In this layout file, click on the line that contains + <code>android:onClick="onButton1Clicked"</code> and press <strong>Alt+Enter</strong>. + Follow the suggestion from Android Studio to add the <code>onButton1Clicked</code> + method to <code>MainActivity</code>. + </li> + <li> + <p>Copy the following code inside the <code>onButton1Clicked</code> method in + <code>MainActivity</code>:</p> + <p><pre> +public void onButton1Clicked(View view) { + Intent intent = new Intent(this, LibActivity1.class); + startActivity(intent); +}</pre></p> + </li> + <li> + Click on <code>LibActivity1</code> in the first line inside the + <code>onButton1Clicked</code> method of <code>MainActivity</code> and press + <strong>Alt+Enter</strong>. Follow the suggestion from Android Studio to add an import + for <code>LibActivity1</code> from the lib module. + </li> +</ol> + +<p>When the user taps the <strong>Open LibActivity1</strong> button on <code>MainActivity</code> +(from the <code>app</code> module), <code>LibActivity1</code> (from the <code>lib</code> module) +starts.</p> + +<h4>Add a dependency on a library module</h4> + +<p>The <code>app</code> module now depends on the <code>lib</code> module, but the build system +does not know about this yet. Edit the build file for the <code>app</code> module ( +<code>app/build.gradle</code>) and add a dependency on the <code>lib</code> module:</p> + +<pre> +... +dependencies { + ... + compile project(":lib") +} +</pre> + +<p>The <code>lib</code> module can still be built and tested independently, and the build system +creates an AAR package for it that you could reuse in other projects.</p> + +<h3 id="buildProject">Build the project in Android Studio</h3> + +<p>To build the project on Android Studio, click <strong>Build</strong> and select +<strong>Make Project</strong>. The status bar at the bottom of the window shows the current +progress of the build:</p> + +<p><code>Gradle: Executing tasks: [:app:assembleDebug, :lib:bundleDebug]</code></p> + +<p class="note">If your project uses product flavors, Android Studio invokes the task for the +selected build variant. For more information, see <a href="#workBuildVariants">Work with build +variants.</a></p> + +<p>Click <img src="{@docRoot}images/tools/as-gradlebutton.png" alt="" +style="vertical-align:bottom;margin:0;"/> on the bottom +right part of the window to show the <em>Gradle Console</em>, as shown in figure 2.</p> + +<img src="{@docRoot}images/tools/as-gradleconsole.png" alt="" /> +<p class="img-caption"><strong>Figure 2.</strong> The Gradle Console in Android Studio.</p> + +<p>The Gradle Console shows the build tasks and subtasks that the build system runs for +Android Studio. If the build fails, you can find more details on the console. To hide the Gradle +Console, click <img src="{@docRoot}images/tools/as-gradlebutton.png" alt="" +style="vertical-align:bottom;margin:0;"/> again.</p> + +<p>To view the list of all available build tasks in Android Studio, click <strong>Gradle</strong> +on the right side of the IDE window. The <em>Gradle tasks</em> panel appears as shown in +figure 3. Double-click any build task to run it in Android Studio. To hide the <em>Gradle tasks</em> +panel, click <strong>Gradle</strong> again.</p> + +<img src="{@docRoot}images/tools/as-gradlepanel.png" alt="" /> +<p class="img-caption"><strong>Figure 3.</strong> The list of build tasks in Android Studio.</p> + + +<h3 id="buildCmd">Build the project from the command line</h3> + +<p>To build the project from the command line, open a terminal window and navigate to the project +root. On Windows platforms, type this command:</p> + +<pre> +> gradlew.bat assembleDebug +</pre> + +<p>On Mac OS and Linux platforms, type these commands:</p> + +<pre> +$ chmod +x gradlew +$ ./gradlew assembleDebug +</pre> + +<p>The first command (<code>chmod</code>) adds the execution permission to the Gradle wrapper +script and is only necessary the first time you build this project from the command line.</p> + +<p>The output of <code>gradlew</code> is similar to the output in the Gradle Console from +figure 2.</p> + +<p>The <code>assembleDebug</code> build task builds the debug version of your app and signs it +with the default local certificate, so that you can install it on the emulator and on real devices +for debugging purposes.</p> + +<p>After you build the project, the output APK for the app module is located in +<code>app/build/apk/</code>, and the output AAR for the lib module is located in +<code>lib/build/libs/</code>.</p> + +<p>To see a list of all available build tasks for your project, type this command:</p> + +<pre> +$ ./gradlew tasks +</pre> + + +<h2 id="configBuild">Configure the Build</h2> + +<p>This section uses the <code>BuildSystemExample</code> project from the previous section and +shows you how to:</p> + +<ul> + <li>Use the syntax from the Android plugin for Gradle in build files.</li> + <li>Declare dependencies.</li> + <li>Configure ProGuard settings.</li> + <li>Configure signing settings.</li> + <li>Work with build variants.</li> +</ul> + +<h3 id="buildFileBasics">Build file basics</h3> + +<p>Android Studio projects contain a top-level build file and a build file for each module. The +build files are called <code>build.gradle</code>, and they are plain text files that use +<a href="http://groovy.codehaus.org">Groovy</a> syntax to configure the build with the elements +provided by the Android plugin for Gradle. In most cases, you only need to edit the build files +at the module level. For example, the build file for the app module in the +<code>BuildSystemExample</code> project looks like this:</p> + +<pre> +apply plugin: 'android' + +android { + compileSdkVersion 19 + buildToolsVersion "19.0.0" + + defaultConfig { + minSdkVersion 8 + targetSdkVersion 19 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + runProguard true + proguardFiles getDefaultProguardFile('proguard-android.txt'), \ + 'proguard-rules.txt' + } + } +} + +dependencies { + compile project(":lib") + compile 'com.android.support:appcompat-v7:19.0.1' + compile fileTree(dir: 'libs', include: ['*.jar']) +} +</pre> + +<p><code>apply plugin: 'android'</code> applies the Android plugin for Gradle to this build. +This adds Android-specific build tasks to the top-level build tasks and makes the +<code>android {...}</code> element available to specify Android-specific build options.</p> + +<p><code>android {...}</code> configures all the Android-specific build options:</p> + +<ul> + <li>The <code>compileSdkVersion</code> property specifies the compilation target.</li> + <li><p>The <code>buildToolsVersion</code> property specifies what version of the build tools + to use. To install several versions of the build tools, use the SDK Manager.</p> + <p class="note"><strong>Note:</strong> Always use a build tools version whose major + revision number is higher or equal to that of your compilation target and target SDK.</p> + </li> + <li><p>The <code>defaultConfig</code> element configures core settings and + entries in the manifest file (<code>AndroidManifest.xml</code>) dynamically from the + build system. The values in <code>defaultConfig</code> override those in the manifest + file.</p> + <p>The configuration specified in the <code>defaultConfig</code> element applies + to all build variants, unless the configuration for a build variant overrides some + of these values.</p> + </li> + <li>The <code>buildTypes</code> element controls how to build and package your app. + By default, the build system defines two build types: <em>debug</em> and + <em>release</em>. The debug build type includes debugging symbols and is signed with + the debug key. The release build type is not signed by default. + In this example the build file configures the release version to use + ProGuard.</li> +</ul> + +<p>The <code>dependencies</code> element is outside and after the <code>android</code> element. +This element declares the dependencies for this module. Dependencies are covered in the following +sections.</p> + +<p class="note"><strong>Note:</strong> When you make changes to the build files in your project, +Android Studio requires a project sync to import the build configuration changes. Click +<strong>Sync Now</strong> on the yellow notification bar that appears for Android Studio +to import the changes.</p> + +<img src="{@docRoot}images/tools/as-gradlesync.png" alt="" /> +<p class="img-caption"><strong>Figure 4.</strong> Sync the project in Android Studio.</p> + +<h3 id="declareDeps">Declare dependencies</h3> + +<p>The <code>app</code> module in <code>BuildSystemExample</code> declares three +dependencies:</p> + +<pre> +... +dependencies { + // Module dependency + compile project(":lib") + + // Remote binary dependency + compile 'com.android.support:appcompat-v7:19.0.1' + + // Local binary dependency + compile fileTree(dir: 'libs', include: ['*.jar']) +} +</pre> + +<p>Each of these dependencies is described below. The build system adds all the +<code>compile</code> dependencies to the compilation classpath and includes them in the final +package.</p> + +<h4>Module dependencies</h4> + +<p>The <code>app</code> module depends on the <code>lib</code> module, because +<code>MainActivity</code> launches <code>LibActivity1</code> as described in +<a href="#openActFromLib">Open an Activity from a Library Module</a>.</p> + +<p><code>compile project(":lib")</code> declares a dependency on the <code>lib</code> +module of <code>BuildSystemExample</code>. When you build the <code>app</code> module, +the build system assembles and includes the <code>lib</code> module.</p> + +<h4>Remote binary dependencies</h4> + +<p>The <code>app</code> and <code>lib</code> modules both use the <code>ActionBarActivity</code> +class from the Android Support Library, so these modules depend on it.</p> + +<p><code>compile 'com.android.support:appcompat-v7:19.0.1'</code> declares a dependency on +version 19.0.1 of the Android Support Library by specifying its Maven coordinates. The Android Support +Library is available in the <em>Android Repository</em> package of the Android SDK. If your +SDK installation does not have this package, download and install it using the SDK Manager.</p> + +Android Studio configures +projects to use the Maven Central Repository by default. (This configuration is included in the +top-level build file for the project.)</p> + +<h4>Local binary dependencies</h4> + +<p>The modules in <code>BuildSystemExample</code> do not use any binary dependencies from the +local file system. If you have modules that require local binary dependencies, copy the JAR +files for these dependencies into <code><moduleName>/libs</code> inside your project.</p> + +<p><code>compile fileTree(dir: 'libs', include: ['*.jar'])</code> tells the build system that any +JAR file inside <code>app/libs</code> is a dependency and should be included in the compilation +classpath and in the final package.</p> + +<p>For more information about dependencies in Gradle, see +<a href="http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html">Dependency +Management Basics</a> in the Gradle User Guide.</p> + +<h3 id="runProguard">Run ProGuard</h3> + +<p>The build system can run +<a href="http://developer.android.com/tools/help/proguard.html">ProGuard</a> to obfuscate your +classes during the build process. In <code>BuildSystemExample</code>, modify the build file for +the app module to run ProGuard for the release build:</p> + +<pre> +... +android { + ... + buildTypes { + release { + runProguard true + proguardFiles getDefaultProguardFile('proguard-android.txt'), \ + 'proguard-rules.txt' + } + } +} +... +</pre> + +<p><code>getDefaultProguardFile('proguard-android.txt')</code> obtains the default ProGuard +settings from the Android SDK installation. Android Studio adds the module-specific rules file +<code>proguard-rules.txt</code> at the root of the module, where you can add custom ProGuard +rules.</p> + +<p>You can build the release version of your application from the command line or using Android +Studio. To build it from the command line, invoke the <code>assembleRelease</code> build task using +the Gradle wrapper script (<code>gradlew assembleRelease</code>). To build it from Android +Studio:</p> + +<ol> + <li>Click <strong>Gradle</strong> on the right side of the IDE window.</li> + <li>On the <em>All tasks</em> section of the sidebar that appears, expand + <strong>BuildSystemExample</strong>.</li> + <li>Expand <strong>:app</strong> and double-click <strong>assembleRelease</strong>.</li> +</ol> + +<p>You can use this procedure to invoke any build task from Android Studio.</p> + +<h3 id="configureSigning">Configure signing settings</h3> + +<p>The debug and the release versions of the app differ on whether the application can be +debugged on secure devices and on how the APK is signed. The build system signs the debug +version with a default key and certificate using known credentials to avoid a password prompt at +build time. The build system does not sign the release version unless you explicitly define a +signing configuration for this build.</p> + +<p>To sign the release version of <code>BuildSystemExample</code>:</p> + +<ol> + <li><p>Copy your release key to the root directory of the <code>app</code> module + (<code>app/</code>).</p> + <p>This ensures that the build system can find your key when you move the location of your + project or when you build the project on a different machine. If you do not have a release + key, you can generate one as described in + <a href="{@docRoot}tools/publishing/app-signing.html">Signing your Applications</a>.</p> + </li> + <li><p>Add the signing configuration to the build file for the <code>app</code> module:</p> + <p><pre> +... +android { + ... + defaultConfig { ... } + signingConfigs { + release { + storeFile file("myreleasekey.keystore") + storePassword "password" + keyAlias "MyReleaseKey" + keyPassword "password" + } + } + buildTypes { + release { + ... + signingConfig signingConfigs.release + } + } +} +... +</pre></p> + </li> + <li>Invoke the <code>assembleRelease</code> build task from Android Studio or from the command + line.</li> +</ol> + +<p>The package in <code>app/build/apk/app-release.apk</code> is now signed with your release key.</p> + +<p class="note"><strong>Note:</strong> Including the passwords for your release key and keystore +inside the build file is not a good security practice. Alternatively, you can configure the build +file to obtain these passwords from environment variables or have the build process prompt you +for these passwords.</p> + +<p>To obtain these passwords from environment variables:</p> + +<pre> +storePassword System.getenv("KSTOREPWD") +keyPassword System.getenv("KEYPWD") +</pre> + +<p>To have the build process prompt you for these passwords if you are invoking the build from +the command line:</p> + +<pre> +storePassword System.console().readLine("\nKeystore password: ") +keyPassword System.console().readLIne("\nKey password: ") +</pre> + +<h3 id="workBuildVariants">Work with build variants</h3> + +<p>This section describes how the build system can help you create different versions of the same +application from a single project. This is useful when you have a demo version and a paid version +of your app, or if you want to distribute multiple APKs for different device configurations on +Google Play.</p> + +<p>The build system uses <em>product flavors</em> to create different versions of your app. Each +version of your app can have different features or device requirements. The build system generates +a different APK for each version of your app.</p> + +<h4>Build variants</h4> + +<p>Each version of your app is represented in the build system by a <em>build variant</em>. +Build variants are combinations of build types and product flavor configurations. Android Studio +projects define two build types (<em>debug</em> and <em>release</em>) and no product flavors by +default. These projects consists of two build variants, debug and release, and the build system +generates an APK for each.</p> + +<p>The exercise in this section defines two product flavors, <em>demo</em> and <em>full</em>. +This generates four build variants:</p> + +<ul> + <li>demo-debug</li> + <li>demo-release</li> + <li>full-debug</li> + <li>full-release</li> +</ul> + +<p>In this case the build system creates four APKs, one for each of these build variants.</p> + +<p>Some projects have complex combinations of features along more than one dimension, but they +still represent the same app. For example, in addition to having a demo and a full version of the +app, some games may contain binaries specific to a particular CPU/ABI. The flexibility of +the build system makes it possible to generate the following build variants for such a project:</p> + +<ul> + <li>x86-demo-debug</li> + <li>x86-demo-release</li> + <li>x86-full-debug</li> + <li>x86-full-release</li> + <li>arm-demo-debug</li> + <li>arm-demo-release</li> + <li>arm-full-debug</li> + <li>arm-full-release</li> + <li>mips-demo-debug</li> + <li>mips-demo-release</li> + <li>mips-full-debug</li> + <li>mips-full-release</li> +</ul> + +<p>This project would consist of two build types (<em>debug</em> and <em>release</em>) +and two <em>dimensions</em> of product flavors, one for app type (demo or full) and one for +CPU/ABI (x86, ARM, or MIPS). For more information on flavor dimensions, see the +<a href="http://tools.android.com/tech-docs/new-build-system/user-guide">Gradle Plugin User +Guide</a>.</p> + +<h4>Source directories</h4> + +<p>To build each version of your app, the build system combines source code and +resources from:</p> + +<ul> + <li><code>src/main/</code> - the main source directory (common to all variants)</li> + <li><code>src/<buildType>/</code> - the build type source directory</li> + <li><code>src/<flavorName>/</code> - the flavor source directory</li> +</ul> + +<p>The number of flavor source directories used in the build depends on the flavor configuration +of your project:</p> +<ul> + <li><p>For projects that do not define any flavors, the build system does not use any + flavor source directories. For example, to generate the <em>release</em> build variant + in projects with no flavors, the build system uses:</p> + <ul> + <li><code>src/main/</code></li> + <li><code>src/release/</code> (build type)</li> + </ul> + </li> + <li><p>For projects that define a set of flavors, the build system uses one flavor source + directory. For example, to generate the <em>full-debug</em> build variant in the example + in this section, the build system uses:</p> + <ul> + <li><code>src/main/</code></li> + <li><code>src/debug/</code> (build type)</li> + <li><code>src/full/</code> (flavor)</li> + </ul> + </li> + <li><p>For projects that use flavor dimensions, the build system uses one flavor source + directory per dimension. For example, to generate the <em>arm-demo-release</em> build + variant in the previous example, the build system uses:</p> + <ul> + <li><code>src/main/</code></li> + <li><code>src/release/</code> (build type)</li> + <li><code>src/demo/</code> (flavor - app type dimension)</li> + <li><code>src/arm/</code> (flavor - ABI dimension)</li> + </ul> + </li> +</ul> + +<p class="note"><strong>Note:</strong> The build type and flavor source directories are optional, +and Android Studio does not create these directories for you. The build system does not use them +if they are not present.</p> + +<p>The source code from these directories is used together to generate the output for a build +variant. You can have classes with the same name in different directories as long as those +directories are not used together in the same variant. The exercise in this section shows you +how to create different versions of the same activity class in different variants.</p> + +<p>The build system merges all the manifests into a single manifest, so each build variant +can define different components or permissions in the final manifest.</p> + +<p>The build system merges all the resources from the all the source directories. If different +folders contain resources with the same name for a build variant, the priority order is the +following: build type resources override those from the product flavor, which override the +resources in the main source directory.</p> + +<p class="note"><strong>Note:</strong> Build variants enable you to reuse common activities, +application logic, and resources across different versions of your app.</p> + +<h4>Product flavors in BuildSystemExample</h4> + +<p>To create different versions of your app:</p> + +<ol> + <li>Define product flavors in the build file.</li> + <li>Create additional source directories for each flavor.</li> + <li>Add the flavor-specific sources to your project.</li> +</ol> + +<p>The rest of this section walks you through these steps in detail using the +<code>BuildSystemExample</code> project. You create two flavors of the +<code>BuildSystemExample</code> app, a demo flavor and a full flavor. Both flavors share +<code>MainActivity</code>, to which you add a new button to launch a new activity, +<code>SecondActivity</code>. This new activity is different for each flavor, so you simulate a +situation where the new activity would have more features in the full flavor than in the demo +flavor. At the end of the exercise, you end up with two different APKs, one for each flavor.</p> + +<h4>Define product flavors in the build file</h4> + +<p>To define two product flavors, edit the build file for the app module to add the following +configuration:</p> + +<pre> +... +android { + ... + defaultConfig { ... } + signingConfigs { ... } + buildTypes { ... } + productFlavors { + demo { + packageName "com.buildsystemexample.app.demo" + versionName "1.0-demo" + } + full { + packageName "com.buildsystemexample.app.full" + versionName "1.0-full" + } + } +} +... +</pre> + +<p>The product flavor definitions support the same properties as the <code>defaultConfig</code> +element. The base configuration for all flavors is specified in <code>defaultConfig</code>, and each +flavor can override any value. The build file above assigns a different package name to each flavor: +since each flavor definition creates a different app, they each need a distinct package name.</p> + +<p class="note"><strong>Note:</strong> To distribute your app using +<a href="{@docRoot}google/play/publishing/multiple-apks.html">Multiple APK Support</a> in +Google Play, assign the same package name to all variants and give each variant a different +<code>versionCode</code>. To distribute different variants of your app as separate apps in Google +Play, assign a different package name to each variant.</p> + +<h4>Add additional source directories for each flavor</h4> + +<p>Now you create source folders and add a <code>SecondActivity</code> to each flavor. To create +the source directory structure for the demo flavor:</p> + +<ol> + <li>On the <em>Project</em> panel, expand <strong>BuildSystemExample</strong>, and then expand + the <strong>app</strong> directory.</li> + <li>Right click the <strong>src</strong> directory under <em>app</em> and select + <strong>New</strong> > <strong>Directory</strong>.</li> + <li>Enter "demo" as the name of the new directory and click <strong>OK</strong>.</li> + <li><p>Similarly, create the following directories:</p> + <ul> + <li><code>app/src/demo/java</code></li> + <li><code>app/src/demo/res</code></li> + <li><code>app/src/demo/res/layout</code></li> + <li><code>app/src/demo/res/values</code></li> + </ul> + </li> +</ol> + +<p>The resulting directory structure looks like figure 5.</p> + +<img src="{@docRoot}images/tools/as-demoflavordirs.png" alt="" /> +<p class="img-caption"><strong>Figure 5.</strong> New source directories for the demo flavor.</p> + +<h4>Add a new activity to each flavor</h4> + +<p>To add <code>SecondActivity</code> to the <code>demo</code> flavor:</p> + +<ol> + <li>On the <em>Project</em> panel, right click on the <strong>app</strong> module and select + <strong>New</strong> > <strong>Activity</strong>.</li> + <li>Select <strong>Blank Activity</strong> and click <strong>Next</strong>.</li> + <li>Enter "SecondActivity" as the activity name.</li> + <li>Enter "com.buildsystemexample.app" as the package name and click + <strong>Finish</strong>.</li> + <li>Right click on the <strong>java</strong> directory under <em>app/src/demo</em> and select + <strong>New</strong> > <strong>Package</strong>.</li> + <li>Enter "com.buildsystemexample.app" as the package name and click <strong>OK</strong>.</li> + <li>Drag <strong>SecondActivity</strong> and drop it under the new package in + <em>app/src/demo/java</em>.</li> + <li>Accept the default values and click <strong>Refactor</strong>.</li> +</ol> + +<p>To add the layout for <code>SecondActivity</code> and a strings resource to the demo flavor:</p> + +<ol> + <li>Drag <strong>activity_second.xml</strong> from <em>app/src/main/res/layout</em> and drop it + inside <em>app/src/demo/res/layout</em>.</li> + <li>Accept the default values on the window that appears and click <code>OK</code>.</li> + <li>Copy <strong>strings.xml</strong> from <em>app/src/main/res</em> into + <em>app/src/demo/res</em>.</li> + <li><p>Replace the contents of the new copy of <code>strings.xml</code> with the + following:</p> + <p><pre> +<?xml version="1.0" encoding="utf-8"?> +<resources> + <string name="hello_world">Demo version only.</string> +</resources> +</pre></p> + </li> +</ol> + +<p>Now you add source folders and <code>SecondActivity</code> to the full flavor by making a copy +of the <code>demo</code> flavor:</p> + +<ol> + <li>On the <em>Project</em> panel, right click on the <strong>demo</strong> directory under + <em>app/src</em> and select <strong>Copy</strong>.</li> + <li>Right-click on the <strong>src/</strong> directory under <em>app/</em> and select + <strong>Paste</strong>.</li> + <li>On the window that appears, enter "full" as the new name and click <strong>OK</strong>.</li> + <li><p>Replace the contents of <strong>strings.xml</strong> under <em>src/full/res/values</em> + with the following:</p> + <p><pre> +<?xml version="1.0" encoding="utf-8"?> +<resources> + <string name="hello_world">This is the full version!</string> +</resources> +</pre></p> + </li> +</ol> + +<p class="note"><strong>Note:</strong> From this point on, you could develop +<code>SecondActivity</code> independently inside each +flavor. You can add more features to this activity in the <code>full</code> flavor.</p> + +<p>To work on files from a particular flavor, click on <strong>Build Variants</strong> on the left +of the IDE window and select the flavor you want to modify in the <em>Build Variants</em> panel, +as shown in figure 5. Android Studio may show errors in source files from flavors other than the +one selected in the <em>Build Variants</em> panel, but this does not affect the outcome of the +build.</p> + +<img src="{@docRoot}images/tools/as-buildvariants.png" alt="" /> +<p class="img-caption"><strong>Figure 6.</strong> The Build Variants panel.</p> + +<h4>Launch a flavor-specific activity from the main activity</h4> + +<p>Since the flavor-specific activity (<code>SecondActivity</code>) has the same package name and +activity name in both flavors, you can launch it from the main activity, which is common to all +flavors. To modify the main activity:</p> + +<ol> + <li><p>Edit <code>activity_main.xml</code> and add a new button to + <code>MainActivity</code>:</p> + <p><pre> +<LinearLayout ...> + ... + <Button + android:id="@+id/button2" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/button2" + android:onClick="onButton2Clicked"/> +</LinearLayout> +</pre></p> + </li> + <li>Click on the areas marked in red in the layout file and press <strong>Alt</strong>+ + <strong>Enter</strong>. Follow the suggestions from Android Studio to add a new string + resource with value “Open Second Activity” and an <code>onButton2Clicked</code> method to + <code>MainActivity</code>.</li> + <li><p>Add the following code to the <code>onButton2Clicked</code> method of + <code>MainActivity</code>:</p> + <p><pre> +public void onButton2Clicked(View view) { + Intent intent = new Intent(this, SecondActivity.class); + startActivity(intent); +} +</pre></p> + </li> + <li><p>Edit the app's manifest to include a reference to <code>SecondActivity</code>:</p> + <p><pre> +<manifest ...> + <application ...> + ... + <activity + android:name="com.buildsystemexample.app.SecondActivity" + android:label="@string/title_activity_second" > + </activity> + </application> +</manifest> +</pre></p> + </li> +</ol> + +<h4>Build output</h4> + +<p>The <code>BuildSystemExample</code> app is now complete. To build it, invoke the +<code>assemble</code> task from Android Studio or from the command line.</p> + +<p>The build generates an APK for each build variant: +the <code>app/build/apk/</code> directory contains packages named +<code>app-<flavor>-<buildtype>.apk</code>; for example, <code>app-full-release.apk</code> and +<code>app-demo-debug.apk</code>.</p> + + +<h2 id="reference">Reference</h2> + +<p>The build system is very flexible and has more features than those described here. For a +complete reference, see the +<a href="http://tools.android.com/tech-docs/new-build-system/user-guide">Android Plugin for Gradle +User Guide</a>.</p> diff --git a/docs/html/tools/sdk/eclipse-adt.jd b/docs/html/tools/sdk/eclipse-adt.jd index 7d20d5e..d106f4a 100644 --- a/docs/html/tools/sdk/eclipse-adt.jd +++ b/docs/html/tools/sdk/eclipse-adt.jd @@ -78,6 +78,11 @@ href="http://tools.android.com/knownissues">http://tools.android.com/knownissues <dt>General Notes:</dt> <dd> <ul> + <li><p>Changed the URL for the Android Developer Tools update site to require HTTPS.</p> + <p class="note"><strong>Note:</strong> If you are + <a href="{@docRoot}sdk/installing/installing-adt.html">updating ADT</a>, make sure + you use HTTPS in the URL for the Android Developer Tools update site.</p> + </li> <li>Fixed a problem where Eclipse was non-responsive for a few seconds after opening an XML file. (<a href="http://b.android.com/67084">Issue 67084</a>)</li> <li>Fixed a problem where the SDK Manager threw a <code>NullPointerException</code> after @@ -88,7 +93,6 @@ href="http://tools.android.com/knownissues">http://tools.android.com/knownissues <code>drawable-large-*</code> directories.</li> <li>Fixed a problem with Nexus 5 Android virtual devices created from the command line where the SD card file system was read-only.</li> - <li>Changed the URL for the Android Developer Tools Update Site from HTTP to HTTPS.</li> </ul> </dd> </dl> diff --git a/docs/html/tools/support-library/index.jd b/docs/html/tools/support-library/index.jd index 389238f..e905285 100644 --- a/docs/html/tools/support-library/index.jd +++ b/docs/html/tools/support-library/index.jd @@ -58,10 +58,36 @@ page.title=Support Library <p>This section provides details about the Support Library package releases.</p> - <div class="toggle-content opened"> <p><a href="#" onclick="return toggleContent(this)"> <img src="{@docRoot}assets/images/triangle-opened.png" class="toggle-content-img" alt="" +/>Android Support Library, revision 19.1.0</a> <em>(March 2014)</em> + </p> + <div class="toggle-content-toggleme"> + <dl> + <dt>Changes for v4 support library:</dt> + <dd> + <ul> + <li>Added the {@link android.support.v4.widget.SwipeRefreshLayout} class, + which enables users to refresh the contents of a view with a vertical + swipe gesture.</li> + <li>Fixed accessibility issues with navigation drawers.</li> + </ul> + </dd> + + <dt>Changes for v7 appcompat library:</dt> + <dd> + <ul> + <li>Fixed background issues with the action bar.</li> + </ul> + </dd> + </dl> + </div> +</div> + +<div class="toggle-content closed"> + <p><a href="#" onclick="return toggleContent(this)"> + <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" alt="" />Android Support Library, revision 19.0.1</a> <em>(December 2013)</em> </p> <div class="toggle-content-toggleme"> diff --git a/docs/html/tools/tools_toc.cs b/docs/html/tools/tools_toc.cs index 382165c..0e543e4 100644 --- a/docs/html/tools/tools_toc.cs +++ b/docs/html/tools/tools_toc.cs @@ -36,6 +36,8 @@ Tips and Tricks</a></li> <li><a href="<?cs var:toroot ?>sdk/installing/studio-layout.html"> Using the Layout Editor</a></li> + <li><a href="<?cs var:toroot ?>sdk/installing/studio-build.html"> + Building your Project</a></li> </ul> </li> <li><a href="<?cs var:toroot ?>sdk/exploring.html"> diff --git a/docs/html/wear/design/index.html b/docs/html/wear/design/index.html deleted file mode 100644 index 9952490..0000000 --- a/docs/html/wear/design/index.html +++ /dev/null @@ -1,607 +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"> </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 you’ll 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 we’ll 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 it’s 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 user’s 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 application’s 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, 64 × 64 DP. 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 at least 320 × 320 pixels at hdpi. 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 application’s 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 card’s 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 user’s 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> | - <a href="/legal.html">Legal</a> | - <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> - - - diff --git a/docs/html/wear/design/index.jd b/docs/html/wear/design/index.jd new file mode 100644 index 0000000..247cc87 --- /dev/null +++ b/docs/html/wear/design/index.jd @@ -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 you’ll 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 we’ll 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 it’s 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 user’s 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 application’s 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 application’s 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 card’s 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 user’s 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> diff --git a/docs/html/wear/design/user-interface.html b/docs/html/wear/design/user-interface.html deleted file mode 100644 index c23d79c..0000000 --- a/docs/html/wear/design/user-interface.html +++ /dev/null @@ -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"> </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> | - <a href="/legal.html">Legal</a> | - <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> - - - diff --git a/docs/html/wear/design/user-interface.jd b/docs/html/wear/design/user-interface.jd new file mode 100644 index 0000000..2a3e9ef --- /dev/null +++ b/docs/html/wear/design/user-interface.jd @@ -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> + diff --git a/docs/html/wear/index.html b/docs/html/wear/index.jd index 9660463..a6a6460 100644 --- a/docs/html/wear/index.html +++ b/docs/html/wear/index.jd @@ -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"> </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> - - - diff --git a/docs/html/wear/license.html b/docs/html/wear/license.jd index c7569bc..b07dacf 100644 --- a/docs/html/wear/license.html +++ b/docs/html/wear/license.jd @@ -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"> </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> | - <a href="/legal.html">Legal</a> | - <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> - - - diff --git a/docs/html/wear/notifications/creating.html b/docs/html/wear/notifications/creating.html deleted file mode 100644 index 7ad6833..0000000 --- a/docs/html/wear/notifications/creating.html +++ /dev/null @@ -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"> </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> | - <a href="/legal.html">Legal</a> | - <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> - - - diff --git a/docs/html/wear/notifications/creating.jd b/docs/html/wear/notifications/creating.jd new file mode 100644 index 0000000..133d057 --- /dev/null +++ b/docs/html/wear/notifications/creating.jd @@ -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> diff --git a/docs/html/wear/notifications/pages.html b/docs/html/wear/notifications/pages.html deleted file mode 100644 index ce568eb..0000000 --- a/docs/html/wear/notifications/pages.html +++ /dev/null @@ -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"> </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> | - <a href="/legal.html">Legal</a> | - <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> - - - diff --git a/docs/html/wear/notifications/pages.jd b/docs/html/wear/notifications/pages.jd new file mode 100644 index 0000000..558f7b8 --- /dev/null +++ b/docs/html/wear/notifications/pages.jd @@ -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> diff --git a/docs/html/wear/notifications/remote-input.html b/docs/html/wear/notifications/remote-input.html deleted file mode 100644 index c8f6621..0000000 --- a/docs/html/wear/notifications/remote-input.html +++ /dev/null @@ -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"> </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"> -<?xml version="1.0" encoding="utf-8"?> -<resources> - <string-array name="reply_choices"> - <item>Yes</item> - <item>No</item> - <item>Maybe</item> - </string-array> -</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(replyAction) - .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> | - <a href="/legal.html">Legal</a> | - <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> - - - diff --git a/docs/html/wear/notifications/remote-input.jd b/docs/html/wear/notifications/remote-input.jd new file mode 100644 index 0000000..8243896 --- /dev/null +++ b/docs/html/wear/notifications/remote-input.jd @@ -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"> +<?xml version="1.0" encoding="utf-8"?> +<resources> + <string-array name="reply_choices"> + <item>Yes</item> + <item>No</item> + <item>Maybe</item> + </string-array> +</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(remoteInput) + .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> diff --git a/docs/html/wear/notifications/stacks.html b/docs/html/wear/notifications/stacks.html deleted file mode 100644 index e4f74a0..0000000 --- a/docs/html/wear/notifications/stacks.html +++ /dev/null @@ -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"> </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—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> | - <a href="/legal.html">Legal</a> | - <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> - - - diff --git a/docs/html/wear/notifications/stacks.jd b/docs/html/wear/notifications/stacks.jd new file mode 100644 index 0000000..7f955f6 --- /dev/null +++ b/docs/html/wear/notifications/stacks.jd @@ -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—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> diff --git a/docs/html/wear/preview/signup.html b/docs/html/wear/preview/signup.jd index ca50179..8e8ec9a 100644 --- a/docs/html/wear/preview/signup.html +++ b/docs/html/wear/preview/signup.jd @@ -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"> </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, you’ll 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> | - <a href="/legal.html">Legal</a> | - <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> - - - diff --git a/docs/html/wear/preview/start.html b/docs/html/wear/preview/start.html deleted file mode 100644 index b1861f5..0000000 --- a/docs/html/wear/preview/start.html +++ /dev/null @@ -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"> </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><sdk>/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 > 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> | - <a href="/legal.html">Legal</a> | - <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> - - - diff --git a/docs/html/wear/preview/start.jd b/docs/html/wear/preview/start.jd new file mode 100644 index 0000000..f8f0129 --- /dev/null +++ b/docs/html/wear/preview/start.jd @@ -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><sdk>/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 > 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> diff --git a/docs/html/wear/wear_toc.cs b/docs/html/wear/wear_toc.cs new file mode 100644 index 0000000..65ac2e9 --- /dev/null +++ b/docs/html/wear/wear_toc.cs @@ -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> |