Home | History | Annotate | Download | only in apps
      1 page.title=Creating Wearable Apps
      2 page.tags=wear
      3 helpoutsWidget=true
      4 page.image=wear/images/01_create.png
      5 
      6 @jd:body
      7 
      8 <div id="tb-wrapper">
      9   <div id="tb">
     10     <h2>Dependencies and Prerequisites</h2>
     11     <ul>
     12       <li>An Android Wear device</li>
     13     </ul>
     14   </div>
     15 </div>
     16 
     17 <p>
     18 Wearable apps run directly on the device, giving you access to hardware such as sensors and the
     19 GPU. They are fundamentally the same as apps built for other devices using the Android SDK, but
     20 differ greatly in design and usability and the amount of functionality provided.
     21 These are the main differences between handheld and wearable apps:</p>
     22 
     23 <ul>
     24   <li>Wearable apps are relatively small in size and functionality compared to handheld apps.
     25   They contain only what makes sense on the wearable, which is usually a small
     26   subset of the corresponding handheld app. In general, you should carry out operations on the
     27   handheld when possible and send the results to the wearable.
     28   </li>
     29   <li>Users don't download apps directly onto the wearable. Instead, you bundle
     30   the wearable app inside the handheld app. When users install the handheld app,
     31   the system automatically installs the wearable app. However, for development
     32   purposes, you can still install the wearable app directly to the wearable.</li>
     33   <li><p>Wearable apps can access much of the standard Android APIs, but don't support
     34   the following APIs:</p>
     35   <ul>
     36     <li>{@link android.webkit}</li>
     37     <li>{@link android.print}</li>
     38     <li>{@link android.app.backup}</li>
     39     <li>{@link android.appwidget}</li>
     40     <li>{@link android.hardware.usb}</li>
     41   </ul>
     42   <p>
     43   You can check if a wearable supports a feature by calling
     44   {@link android.content.pm.PackageManager#hasSystemFeature hasSystemFeature()}
     45   before trying to use an API.</p>
     46 </li>
     47 </ul>
     48 
     49 <p>To conserve power on a wearable device, you can enable ambient mode for your Wear app.
     50 Devices transition from interactive to ambient mode when the user is idle on an activity or when
     51 the user covers the screen with their palm. Wearable apps that can transition into ambient mode are
     52 called <i>always-on</i> apps. The following describes the two modes of operation for always-on apps:
     53 </p>
     54 <dl>
     55   <dt><strong>Interactive</strong></dt>
     56   <dd>Use full color with fluid animation in this mode. The app is also responsive to
     57   input.</dd>
     58   <dt><strong>Ambient</strong></dt>
     59   <dd>Render the screen with grayscale graphics and do not present any input cues in this mode.
     60   This display mode is only supported on devices running Android 5.1 or higher.</dd>
     61 </dl>
     62 
     63 <p>On devices running versions prior to Android 5.1 or for apps that do not support ambient mode,
     64 when a user is idle on an activity or when the user covers the screen with their palm on an
     65 activity, the Wear home screen is displayed instead of your activity in ambient mode. If you
     66 need to show persistent content on versions prior to Android 5.1, create a notification in the
     67 context stream instead.</p>
     68 
     69 <p class="note"><b>Note:</b> We recommend using Android Studio for Android Wear development,
     70 as it provides project setup, library inclusion, and packaging conveniences. The rest of this
     71 training assumes you're using Android Studio.</p>
     72 
     73 <h2>Lessons</h2>
     74   <dl>
     75     <dt><a href="{@docRoot}training/wearables/apps/creating.html">Creating and Running a Wearable App</a></dt>
     76       <dd>Learn how to create an Android Studio project that
     77       contains both the wearable and handheld app modules and how to run the app on a device
     78       or emulator.</dd>
     79     <dt><a href="{@docRoot}training/wearables/apps/layouts.html">Creating Custom Layouts</a></dt>
     80       <dd>Learn how to create and display custom layouts for notifications and
     81       activities.</dd>
     82     <dt><a href="{@docRoot}training/wearables/apps/always-on.html">Keeping Your App Visible</a></dt>
     83       <dd>Learn how to enable ambient mode for your apps, so they remain visible while still saving
     84       battery power.</dd>
     85     <dt><a href="{@docRoot}training/wearables/apps/voice.html">Adding Voice Capabilities</a></dt>
     86       <dd>Learn how to launch an activity with voice actions and how to start the
     87       system speech recognizer app to obtain free-form voice input.</dd>
     88     <dt><a href="{@docRoot}training/wearables/apps/packaging.html">Packaging Wearable Apps</a></dt>
     89       <dd>Learn how to package a wearable app inside a
     90       handheld app. This allows the system to install the wearable app automatically when
     91       users install the companion handheld app from the Google Play store.</dd>
     92     <dt><a href="{@docRoot}training/wearables/apps/bt-debugging.html">Debugging over Bluetooth</a></dt>
     93       <dd>Learn how to debug your wearable over Bluetooth instead of USB.</dd>
     94   </dl>
     95