page.title=Preview API Overview meta.tags="wear", "wear-preview" page.tags="wear" page.image=images/cards/card-n-apis_2x.png @jd:body
Wear 2.0 is still in active development, but you can try it as part of the Wear 2.0 Developer Preview. The sections below highlight some of the new features for developers.
The preview introduces powerful additions to the user interface, opening up exciting possibilities to developers.
A complication is a feature of a watch face that displays more than hours and minutes, such as a battery indicator or a step counter. The Complications API thus helps watch face developers create visual features and the data connections they require.
Watch faces that use this API can display extra information without needing code for getting the underlying data. Data providers can supply data to any watch face using the API.
For information about this API, see Watch Face Complications.
Wear 2.0 introduces two new widgets, navigation drawer and action drawer. These widgets give your users new ways to interact with your app. The navigation drawer appears at the top of the screen and allows users to navigate between app views. The action drawer appears at the bottom of the screen and allows users to choose from a list of actions associated with the current usage context. These drawers are accessible to users when they edge swipe from the top or bottom of the screen; they peek when users scroll in an opposite direction.
To learn how to add these widgets to your app, see Wear Navigation and Actions.
Wear 2.0 introduces the WearableRecyclerView
class for
displaying and manipulating a vertical list of items,
optimized for round displays.
The key features include the following:
To learn how to create a curved layout optimized for round devices, see Curved Layout.
In Wear 2.0, we’ve redesigned the key experiences on the watch to be even
more intuitive and provide users new ways to respond to messages. Some of
the highlights are below; for a complete list of changes, see Notification Changes
in Wear 2.0.
When a user taps on a notification that is bridged from the phone to the watch or that lacks a {@code contentIntent}, the user will be taken to the expanded view of that notification. When you specify additional content pages and actions for a notification, those are available to the user within the expanded notification. Each expanded notification follows Material Design for Android Wear, so the user gets an app-like experience.
If you have a chat messaging app, your notifications should use {@code Notification.MessagingStyle}, which is new in Android 6.0. Wear 2.0 uses the chat messages included in a {@code MessagingStyle} notification (see {@code addMessage()}) to provide a rich chat, app-like experience in the expanded notification.
Wear 2.0 enables you to add an inline action within the notification stream so that users can quickly take an action on a notification. Examples of good use cases for an inline action within a notification stream include replying to a text message, stopping a fitness activity, or archiving an email message.
To learn how to add an inline action to your notification stream, see Inline Action.
Android Wear 2.0 introduces support for Smart Reply in {@code MessagingStyle} notifications. Smart Reply provides the user with contextually relevant, touchable choices in the expanded notification and in {@code RemoteInput}.
By enabling Smart Reply for your {@code MessagingStyle} notifications, you provide users a fast (single tap), discreet (no speaking aloud), and reliable way to respond to chat messages they receive.
Wear 2.0 users can choose between various input options from Remote Input. These options include:
For messaging notifications with Smart Reply, the system-generated Smart Reply appears within {@code RemoteInput} above the developer-provided list of canned responses. You can also use the setChoices() method in the {@code RemoteInput} API to enable users to select from a list of canned responses.
By default, notifications are bridged (shared) from an app on a companion phone to the watch. Since a phone app and a standalone watch app may be sources of the same notifications, the Android Wear 2.0 Preview includes a Bridging mode feature.
For information about this feature, see Bridging Mode for Notifications.
Wear 2.0 extends the Android input method framework (IMF) to Android Wear. This allows users to enter text on Wear using the system default IME or third party IMEs. The Wear IME lets the user enter text via gesture typing as well as tapping individual keys. The IMF APIs used for Wear devices are the same as other form factors, though usage is slightly different due to limited screen real estate.
Wear provides user settings on the watch that let the user:
To learn how to create an IME for Wear, see Input Method Framework.
Wrist gestures can enable quick, one-handed interactions with your app when use of a touch screen is inconvenient. The following wrist gestures are available for use by apps:
For more information, see Wrist Gestures.
Standalone watches enable Android Wear apps to work independently of phone apps. This means your app can continue to offer full functionality even if the paired phone is far away or turned off.
For delivery to a watch, an Android Wear app is currently embedded in its corresponding phone app. This delivery method can result in an increased download size for users, regardless of whether they have an Android Wear device.
For information about planning and building your standalone app for Wear 2.0, see Standalone Apps.
For information about distributing your app, see App Distribution.
Since Android Wear apps will work independently of phone apps, Android Wear's network access will no longer require the Wearable Data Layer API. Android Wear apps will have the ability to make their own network requests. Additionally, they will be able to directly use Google Cloud Messaging. For more information, see Network Access and Cloud Messaging.
No APIs for network access or GCM are specific to Android Wear; refer to the existing documentation about Connecting to the Network and Cloud Messaging.
We recommend using the following libraries:
The Wearable Data Layer API is available to communicate with a phone app. However, use of this API to connect to a network will be discouraged.
Since Android Wear apps will work independently of phone apps, Android Wear's authentication capabilities will be more powerful; apps will have new ways to authenticate.
Google Keyboard will be standard on Android Wear, allowing for direct text entry. This feature will work as expected with standard EditText widgets. For passwords, the {@code textPassword} attribute will be used.
Android Wear will include the AccountManager, which will be accessible for syncing and storing account data, as it is on an Android phone.
For Android-paired watches (only), a phone securely transfers authentication credentials to a watch app via the Wearable Data Layer API. The credentials can be transferred as messages or data items.
If your watch app needs to determine if your phone app is installed, you can advertise a capability on the phone app and retrieve the capability on the watch. For more information, see the following sections of Sending and Receiving Messages: