95 lines
4.6 KiB
Plaintext
Executable File
95 lines
4.6 KiB
Plaintext
Executable File
page.title=Creating Wearable Apps
|
|
page.tags=wear
|
|
helpoutsWidget=true
|
|
page.image=wear/images/01_create.png
|
|
|
|
@jd:body
|
|
|
|
<div id="tb-wrapper">
|
|
<div id="tb">
|
|
<h2>Dependencies and Prerequisites</h2>
|
|
<ul>
|
|
<li>An Android Wear device</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
|
|
<p>
|
|
Wearable apps run directly on the device, giving you access to hardware such as sensors and the
|
|
GPU. They are fundamentally the same as apps built for other devices using the Android SDK, but
|
|
differ greatly in design and usability and the amount of functionality provided.
|
|
These are the main differences between handheld and wearable apps:</p>
|
|
|
|
<ul>
|
|
<li>Wearable apps are relatively small in size and functionality compared to handheld apps.
|
|
They contain only what makes sense on the wearable, which is usually a small
|
|
subset of the corresponding handheld app. In general, you should carry out operations on the
|
|
handheld when possible and send the results to the wearable.
|
|
</li>
|
|
<li>Users don't download apps directly onto the wearable. Instead, you bundle
|
|
the wearable app inside the handheld app. When users install the handheld app,
|
|
the system automatically installs the wearable app. However, for development
|
|
purposes, you can still install the wearable app directly to the wearable.</li>
|
|
<li><p>Wearable apps can access much of the standard Android APIs, but don't support
|
|
the following APIs:</p>
|
|
<ul>
|
|
<li>{@link android.webkit}</li>
|
|
<li>{@link android.print}</li>
|
|
<li>{@link android.app.backup}</li>
|
|
<li>{@link android.appwidget}</li>
|
|
<li>{@link android.hardware.usb}</li>
|
|
</ul>
|
|
<p>
|
|
You can check if a wearable supports a feature by calling
|
|
{@link android.content.pm.PackageManager#hasSystemFeature hasSystemFeature()}
|
|
before trying to use an API.</p>
|
|
</li>
|
|
</ul>
|
|
|
|
<p>To conserve power on a wearable device, you can enable ambient mode for your Wear app.
|
|
Devices transition from interactive to ambient mode when the user is idle on an activity or when
|
|
the user covers the screen with their palm. Wearable apps that can transition into ambient mode are
|
|
called <i>always-on</i> apps. The following describes the two modes of operation for always-on apps:
|
|
</p>
|
|
<dl>
|
|
<dt><strong>Interactive</strong></dt>
|
|
<dd>Use full color with fluid animation in this mode. The app is also responsive to
|
|
input.</dd>
|
|
<dt><strong>Ambient</strong></dt>
|
|
<dd>Render the screen with grayscale graphics and do not present any input cues in this mode.
|
|
This display mode is only supported on devices running Android 5.1 or higher.</dd>
|
|
</dl>
|
|
|
|
<p>On devices running versions prior to Android 5.1 or for apps that do not support ambient mode,
|
|
when a user is idle on an activity or when the user covers the screen with their palm on an
|
|
activity, the Wear home screen is displayed instead of your activity in ambient mode. If you
|
|
need to show persistent content on versions prior to Android 5.1, create a notification in the
|
|
context stream instead.</p>
|
|
|
|
<p class="note"><b>Note:</b> We recommend using Android Studio for Android Wear development,
|
|
as it provides project setup, library inclusion, and packaging conveniences. The rest of this
|
|
training assumes you're using Android Studio.</p>
|
|
|
|
<h2>Lessons</h2>
|
|
<dl>
|
|
<dt><a href="{@docRoot}training/wearables/apps/creating.html">Creating and Running a Wearable App</a></dt>
|
|
<dd>Learn how to create an Android Studio project that
|
|
contains both the wearable and handheld app modules and how to run the app on a device
|
|
or emulator.</dd>
|
|
<dt><a href="{@docRoot}training/wearables/apps/layouts.html">Creating Custom Layouts</a></dt>
|
|
<dd>Learn how to create and display custom layouts for notifications and
|
|
activities.</dd>
|
|
<dt><a href="{@docRoot}training/wearables/apps/always-on.html">Keeping Your App Visible</a></dt>
|
|
<dd>Learn how to enable ambient mode for your apps, so they remain visible while still saving
|
|
battery power.</dd>
|
|
<dt><a href="{@docRoot}training/wearables/apps/voice.html">Adding Voice Capabilities</a></dt>
|
|
<dd>Learn how to launch an activity with voice actions and how to start the
|
|
system speech recognizer app to obtain free-form voice input.</dd>
|
|
<dt><a href="{@docRoot}training/wearables/apps/packaging.html">Packaging Wearable Apps</a></dt>
|
|
<dd>Learn how to package a wearable app inside a
|
|
handheld app. This allows the system to install the wearable app automatically when
|
|
users install the companion handheld app from the Google Play store.</dd>
|
|
<dt><a href="{@docRoot}training/wearables/apps/bt-debugging.html">Debugging over Bluetooth</a></dt>
|
|
<dd>Learn how to debug your wearable over Bluetooth instead of USB.</dd>
|
|
</dl>
|