Home | History | Annotate | Download | only in preview
      1 page.title=Preview API Overview
      2 meta.tags="wear", "wear-preview"
      3 page.tags="wear"
      4 page.image=images/cards/card-n-apis_2x.png
      5 @jd:body
      6 
      7 <div id="qv-wrapper">
      8 <div id="qv">
      9   <h2>Key developer features</h2>
     10   <ol>
     11       <ul style="list-style-type:none;">
     12         <li><a href="#ui">User Interface Improvements</a>
     13           <ol>
     14             <li><a href="#complications">Complications</a></li>
     15             <li><a href="#drawers">Navigation and Action Drawers</a></li>
     16           </ol>
     17         </li>
     18 
     19         <li><a href="#notify">Notifications and Input</a>
     20           <ol>
     21             <li><a href="#expanded">Expanded Notification</a></li>
     22             <li><a href="#messaging">Messaging Style Notification</a></li>
     23             <li><a href="#smart-replies">Smart Reply</a></li>
     24             <li><a href="#content-action">Notification Content Action</a>
     25             <li><a href="#remote-input">Remote Input</a></li>
     26             <li><a href="#bridging">Bridging Mode</a></li>
     27             <li><a href="#imf">Input Method Framework</a></li>
     28             <li><a href="#wrist-gestures">Wrist Gestures</a></li>
     29           </ol>
     30         </li>
     31 
     32         <li><a href="#stand-alone">Standalone Devices</a>
     33           <ol>
     34             <li><a href="#wear-apk">Wear-Specific APKs</a></li>
     35             <li><a href="#network">Network Access</a></li>
     36             <li><a href="#auth">Authentication</a></li>
     37           </ol>
     38         </li>
     39       </ol>
     40 </div>
     41 </div>
     42 
     43 
     44 
     45 <p>
     46   The Android Wear Preview API is still in active development, but you can try
     47   it now as part of the Wear 2.0 Developer Preview. The sections below
     48   highlight some of the new features for Android Wear developers.
     49 </p>
     50 
     51 
     52 <h2 id="ui">User Interface Improvements</h2>
     53 
     54 <p>
     55   The preview introduces powerful additions to the user interface, opening up
     56   exciting possibilities to developers. A complication
     57   is any feature in a watch face that displays more than hours and
     58   minutes. With the Complications API, watch faces can display extra information
     59   and separate apps can expose complication data. The navigation and action
     60   drawers provide users with new ways to interact with apps.
     61 </p>
     62 
     63 
     64 <h3 id="complications">Complications</h3>
     65 <img src="{@docRoot}wear/preview/images/complications-main-image.png"
     66   height="320" style="float:right;margin:10px 0 0 40px" />
     67 
     68 <p>
     69   A <a href=
     70   "https://en.wikipedia.org/wiki/Complication_(horology)">complication</a> is a
     71   feature of a watch face that displays more than hours and minutes, such as a
     72   battery indicator or a step counter. The Complications API thus helps watch face
     73   developers create visual features and the data connections they
     74   require.
     75 </p>
     76 
     77 <p>
     78   Watch faces that use this API can display extra information without needing
     79   code for getting the underlying data. Data providers can supply data to any
     80   watch face using the API.
     81 </p>
     82 
     83 <p>For information about this API,
     84 see <a href="{@docRoot}wear/preview/features/complications.html">
     85  Watch Face Complications</a>.
     86 </p>
     87 
     88 <h3 id="drawers">Navigation and Action drawers</h3>
     89 
     90 <p>Wear 2.0 introduces two new widgets, navigation drawer and action drawer. These
     91  widgets give your users new ways to interact with your app. The navigation drawer
     92   appears at the top of the screen and allows users to navigate between app views.
     93    The  action drawer appears at the bottom of the screen and allows users to choose
     94     from a list of actions associated with the current usage context.  These drawers
     95      are accessible to users when they edge swipe from the top or bottom of the
     96      screen; they peek when users scroll in an opposite direction.
     97 </p>
     98 
     99 <div class="cols">
    100   <div class="col-2of6">
    101     <img src="{@docRoot}wear/preview/images/nav_drawer.gif"
    102       height="240" alt="" style="padding:.5em">
    103   </div>
    104   <div class="col-2of6">
    105     <img src="{@docRoot}wear/preview/images/action_drawer.gif"
    106       height="240" alt="" style="padding:.5em;">
    107   </div>
    108 </div>
    109 
    110 <p>
    111   To learn how to add these widgets to your app, see
    112   <a href="{@docRoot}wear/preview/features/ui-nav-actions.html">
    113   Wear Navigation and Actions</a>.
    114 </p>
    115 
    116 
    117 <h2 id="notify">Notifications and Input</h2>
    118 
    119 <p>In Wear 2.0, weve redesigned the key experiences on the watch to be even more
    120  intuitive and provide users new ways to respond to messages. Some of the highlights
    121   are below; for a complete list of changes, see
    122   <a href="{@docRoot}wear/preview/features/notifications.html">Notification Changes in Wear 2.0</a>.
    123 
    124 
    125 <img src="{@docRoot}wear/preview/images/expanded_diagram.png" height="340"
    126   style="float:left;margin:10px 20px 0 0" />
    127 <h3 id="expanded">Expanded notifications</h3>
    128 
    129 <p>
    130   When a user taps on a notification that is bridged from the phone to the
    131   watch or that lacks a
    132   <a href="{@docRoot}reference/android/support/v4/app/NotificationCompat.Builder.html#setContentIntent(android.app.PendingIntent)">
    133   {@code contentIntent}</a>, the user will be taken to the expanded view of
    134   that notification. When you <a href=
    135   "{@docRoot}training/wearables/notifications/pages.html">specify additional
    136   content pages</a> and actions for a notification, those are available to the
    137   user within the expanded notification. Each expanded notification follows
    138   <a href="https://google.com/design/spec-wear">Material Design for Android
    139   Wear</a>, so the user gets an app-like experience.
    140 </p>
    141 
    142 
    143 <h3 id="messaging">Messaging Style notification</h3>
    144 <p> If you have a chat messaging app, your notifications should use
    145 {@code Notification.MessagingStyle}, which is new in Android 6.0. Wear 2.0 uses
    146 the chat messages included in a
    147 <a href="{@docRoot}preview/features/notification-updates.html#style">{@code MessagingStyle}</a>
    148  notification
    149 (see {@code addMessage()}) to provide a rich chat app-like experience in the
    150 expanded notification.
    151 </p>
    152 
    153 
    154 <h3 id="smart-replies">Smart Reply</h3>
    155 
    156 <p>Android Wear 2.0 introduces support for Smart Reply in
    157 <a href="{@docRoot}wear/preview/features/notifications.html#messaging">{@code MessagingStyle}</a>
    158  notifications. Smart Reply provides the user with contextually relevant,
    159  touchable choices in the expanded notification and in
    160  <a href="{@docRoot}reference/android/app/RemoteInput.html">{@code RemoteInput}</a>.
    161 </p>
    162 
    163 <p>By enabling Smart Reply for your {@code MessagingStyle} notifications, you provide
    164 users a fast (single tap), discreet (no speaking aloud), and reliable way to respond
    165  to chat messages they receive.
    166  </p>
    167 
    168 
    169 <img src="{@docRoot}wear/preview/images/remoteinput.png" height="350"
    170   style="float:right;margin:10px 0 0 40px" />
    171 
    172 <h3 id="remote-input">Remote Input</h3>
    173 
    174 <p>Wear 2.0 users can choose between various input options from
    175 <a href="{@docRoot}reference/android/app/RemoteInput.html">Remote Input</a>.
    176  These options include:
    177 </p>
    178 <ul>
    179 <li>Dictation</li>
    180 <li>Emoji</li>
    181 <li>Canned responses</li>
    182 <li>Smart Reply</i>
    183 <li>Default IME </i>
    184 </ul>
    185 
    186 <p>
    187 For messaging notifications with Smart Reply, the system-generated Smart Reply
    188  appears within <a href="{@docRoot}reference/android/app/RemoteInput.html">{@code RemoteInput}</a>
    189   above the developer-provided list of canned responses.
    190   You can also use the
    191   <a href="{@docRoot}reference/android/app/RemoteInput.Builder.html#setChoices(java.lang.CharSequence[])">setChoices()</a>
    192    method in the {@code RemoteInput} API to enable users to select from a list
    193    of canned responses.
    194 </p>
    195 
    196 <h3 id="bridging"> Bridging Mode </h3>
    197 <p>By default, notifications are
    198 <a href="{@docRoot}training/wearables/notifications/index.html">
    199 bridged</a> (shared) from an app on a companion phone
    200 to the watch. Since a phone app and a standalone watch app may be sources of the
    201  same notifications, the Android Wear 2.0 Preview includes a Bridging mode feature.
    202   Developers can begin planning to change the behavior of notifications with the
    203   following:
    204 </p>
    205 
    206 <ul>
    207 <li>Specifying in the standalone app's Android manifest file that notifications from
    208  the corresponding phone app should not be bridged to the watch. </li>
    209 <li>Setting a dismissal ID so notification dismissals (by users) are synced across
    210 devices.</li>
    211 </ul>
    212 
    213 <p>For an example of how to use this feature, see <a href="{@docRoot}wear/preview/features/bridger.html">
    214 Bridging Mode for Notifications</a>.</p>
    215 
    216 <h3 id="imf">Input Method Framework</h3>
    217 
    218 <p>Wear 2.0 extends the Android input method framework (IMF) to Android Wear.
    219 This allows users to enter text on Wear using the system default IME or third party
    220  IMEs.  The Wear IME lets the user enter text via gesture typing as well as tapping
    221   individual keys. The IMF APIs used for Wear devices are the same as other form
    222   factors, though usage is slightly different due to limited screen real estate.
    223 </p>
    224 
    225 <p>Wear provides user settings on the watch that let the user:</p>
    226 <ul>
    227 <li>Enable multiple IMEs from the list of installed IMEs.</li>
    228 <li>Set a single default IME from the list of enabled IMEs.</li>
    229 <li>Change languages for various IMEs.</li>
    230 </ul>
    231 
    232 <p>To learn how to create an IME for Wear, see <a href="{@docRoot}wear/preview/features/ime.html">
    233 Input Method Framework</a>.
    234 </p>
    235 
    236 <h3 id="wrist-gestures">Wrist Gestures</h3>
    237 
    238 <p>
    239   Wrist gestures can enable quick, one-handed interactions with your app
    240   when use of a touch screen is inconvenient. The following
    241   <a href="https://support.google.com/androidwear/answer/6312406">wrist gestures</a>
    242   are available for use by apps:
    243 </p>
    244 
    245 <ul>
    246   <li>Flick wrist out</li>
    247   <li>Flick wrist in</li>
    248 </ul>
    249 
    250 <p>For more information, see
    251 <a href="{@docRoot}wear/preview/features/gestures.html">
    252  Wrist Gestures</a>.
    253 </p>
    254 
    255 <h2 id="stand-alone">Standalone Devices</h2>
    256 
    257 <p>Standalone watches will enable Android Wear apps to work independently of phone
    258  apps. This means your app can continue to offer full functionality even if the
    259  paired phone is far away or turned off. </p>
    260 
    261 <h3 id="wear-apk">Wear-Specific APKs</h3>
    262 
    263 <p>For delivery to a watch, an Android Wear app is currently embedded in its corresponding
    264 phone app. This delivery method can result in an increased download size for users,
    265  regardless of whether they have an Android Wear device.
    266 </p>
    267 
    268 <p>With standalone devices, the
    269 <a href ="{@docRoot}google/play/publishing/multiple-apks.html">Multi-APK</a>
    270  delivery method will be used. Developers will have the ability to release Android
    271   Wear apps independently of the corresponding phone apps. Please stay tuned for
    272    more information about this change.
    273 </p>
    274 
    275 <h3 id="network">Network Access</h3>
    276 
    277 <p>Since Android Wear apps will work independently of phone apps, Android Wear's
    278  network access will no longer require the
    279  <a href="{@docRoot}training/wearables/data-layer/index.html">
    280  Wearable Data Layer API</a>. Android Wear apps will have the ability to make
    281  their own network requests. Additionally, they will be able to directly use
    282  Google Cloud Messaging.
    283 </p>
    284 
    285 <p>No APIs for network access or GCM are specific to Android Wear; refer to the
    286 existing documentation about
    287 <a href="{@docRoot}training/basics/network-ops/connecting.html">
    288 Connecting to the Network</a> and
    289 <a href="https://developers.google.com/cloud-messaging/">Cloud Messaging</a>.
    290 </p>
    291 
    292 <p>We recommend using the following libraries:</p>
    293 <ul>
    294 <li><a href="{@docRoot}reference/android/app/job/JobScheduler.html">
    295 JobScheduler</a> for asynchronous jobs, including polling at regular intervals
    296 </li>
    297 <li>Multi-networking APIs if you need to connect to specific network types; see
    298 the <a href="{@docRoot}about/versions/android-5.0.html#Wireless">
    299 Multiple Network Connections</a>
    300 </li>
    301 </ul>
    302 
    303 <p>You will still be able to use the
    304 <a href="{@docRoot}training/wearables/data-layer/index.html">
    305  Wearable Data Layer API</a> to communicate with a phone app.
    306  However, use of this API to connect to a network will be discouraged.
    307  </p>
    308 
    309 
    310 <h3 id="auth">Authentication</h3>
    311 
    312 <p>Since Android Wear apps will work independently of phone apps, Android Wear's
    313  authentication capabilities will be more powerful; apps will have new ways to
    314  authenticate.</p>
    315 
    316 <h4>Users can enter a username and password on a watch</h4>
    317 
    318 <p>Google Keyboard will be standard on Android Wear, allowing for direct text
    319 entry. This feature will work as expected with standard
    320 <a href="{@docRoot}reference/android/widget/EditText.html">EditText widgets</a>.
    321 For passwords, the {@code textPassword} attribute will be used.</p>
    322 
    323 <h4>Utilizing Account Manager</h4>
    324 
    325 <p>Android Wear will include the
    326 <a href="{@docRoot}reference/android/accounts/AccountManager.html">
    327 AccountManager</a>, which will be accessible for syncing and storing account
    328 data, as it is on an Android phone.</p>
    329 
    330 <h4>Authentication tokens can be passed over the Wearable Data Layer</h4>
    331 
    332 <p>For Android-paired watches (only), a phone securely
    333 transfers authentication credentials to a watch app via the
    334 <a href="{@docRoot}training/wearables/data-layer/index.html">
    335 Wearable Data Layer API</a>. The credentials can be transferred as
    336 messages or data items.</p>
    337 
    338 <p>If your watch app needs to determine if your phone app is installed, you can
    339 advertise a capability on the phone app and retrieve the capability on the
    340 watch. For more information, see the following sections of
    341 <a href="{@docRoot}training/wearables/data-layer/messages.html">
    342 Sending and Receiving Messages</a>:</p>
    343 
    344 <ul>
    345   <li>Advertise Capabilities</li>
    346   <li>Retrieve the Nodes with the Required Capabilities</li>
    347 </ul>
    348