Posted by Hoi Lam, Android Wear
Developer Advocate
At Google I/O 2016, we launched the Android
Wear 2.0 Developer Preview, which gives developers early access to the next
major release of Android Wear. Since I/O, feedback from the developer community
has helped us identify bugs and shape our product direction. Thank you!
Today, we are releasing the second developer preview with new functionalities
and bug fixes. Prior to the consumer release, we plan to release additional
updates, so please send us your
feedback early and often. Please keep in mind that this preview is a work in
progress, and is not yet intended for daily use.
What’s new?
- Platform API 24 - We have incremented the Android Platform
API version number to 24 to match Nougat. You can now update your Android Wear
2.0 Preview project’scompileSdkVersion
to API 24, and we recommend
that you also updatetargetSdkVersion
to API 24. - Wearable Drawers Enhancements - We launched the href="https://developer.android.com/wear/preview/features/ui-nav-actions.html?utm_campaign=android wear_launch_preview2_071216&utm_source=anddev&utm_medium=blog">wearable
drawers as part of the Android Wear 2.0 Preview 1, along with UX guidelines
on how to best integrate the href="https://www.google.com/design/spec-wear/components/navigation-drawer.html">navigation
drawer and href="https://www.google.com/design/spec-wear/components/action-drawer.html">action
drawer in your Android Wear app. In Preview 2, we have added additional
support for wearable drawer peeking, to make it easier for users to access these
drawers as they scroll. Other UI improvements include automatic peek view and
navigation drawer closure and showing the first action inWearableActionDrawer
’s peek view. For developers that want to make
custom wearable drawers, we’ve addedpeek_view
anddrawer_content
attributes toWearableDrawerView
. And
finally, navigation drawer contents can now be updated by callinghref="https://developer.android.com/reference/android/widget/ArrayAdapter.html?utm_campaign=android wear_launch_preview2_071216&utm_source=anddev&utm_medium=blog#notifyDataSetChanged()">notifyDataSetChanged
. - Wrist Gestures: Since last year, users have been able to
scroll through the notification stream via href="https://support.google.com/androidwear/answer/6312406?hl=en">wrist
gestures. We have now opened this system to developers to use within their
applications. This helps improve single hand usage, for when your users need
their other hand to hold onto their shopping or their kids. See the code sample
below to get started with gestures in your app:
public class MainActivity extends Activity {
...
@Override /* KeyEvent.Callback */
public boolean onKeyDown(int keyCode, KeyEvent event) {
switch (keyCode) {
case KeyEvent.KEYCODE_NAVIGATE_NEXT:
Log.d(TAG, "Next");
break;
case KeyEvent.KEYCODE_NAVIGATE_PREVIOUS:
Log.d(TAG, "Previous");
break;
}
// If you did not handle, then let it be handled by the next possible element as deemed by
// Activity.
return super.onKeyDown(keyCode, event);
}
}
Get started and give us feedback!
The Android Wear 2.0 Developer Preview includes an updated SDK with tools and
system images for testing on the official Android emulator, the href="https://store.google.com/product/lg_watch_urbane_2nd_edition_lte">LG Watch
Urbane 2nd Edition LTE, and the href="https://store.google.com/product/huawei_watch">Huawei Watch.
To get started, follow these steps:
- Take a video tour
of the Android Wear 2.0 developer preview - Update to Android Studio v2.1.1 or later
- Visit the Android Wear 2.0 Developer
Preview site for downloads and documentation - Get the emulator system images through the SDK Manager or href="https://developer.android.com/wear/preview/downloads.html?utm_campaign=android wear_launch_preview2_071216&utm_source=anddev&utm_medium=blog">download the
device system images from the developer preview downloads page - Test your app with your supported device or emulator
- Give us feedback
We will update this developer preview over the next few months based on your
feedback. The sooner we hear from you, the more we can include in the final
release, so don't be shy!