Google today released Android Wear 2.0 Developer Preview 4, which focuses on adding new APIs that help developers build more powerful standalone apps. New features include OAuth API for Android Wear, in-app billing, new APIs for cross-device promotion, and the return of swipe-to-dismiss.
Android Wear 2.0 was revealed at Google’s I/O 2016 developer conference, where the company called it “the most significant update to Android Wear” since the platform launched over two years ago. The final release to users was originally slated for the fall, but it has since been pushed back until early 2017.
First up, the fourth developer preview brings new APIs for OAuth and support for one-click Google Sign-in. OAuth API for Android Wear lets users tap a button on the watch that opens an authentication screen on the phone, letting the watch app authenticate with server-side APIs directly. Google Sign-In takes this a step further, letting the user select which account they want to authenticate with.
In-app billing support has also been added, giving developers another way to monetize their apps and watch faces. Users can authorize purchases on the watch using a 4-digit Google Account PIN.
Cross-device promotion comes in the form of two new APIs: PlayStoreAvailability and RemoteIntent. The former helps users get to the Play Store on a paired device, and the latter lets developers open custom URLs on the phone from the watch, no phone app or data layer required.
The swipe-to-dismiss gesture from Android Wear 1.0 has been reinstated. To support swipe-to-close, Google has made the following changes:
- Activities now automatically support swipe-to-dismiss. Swiping an activity from left to right will result in it being dismissed and the app will navigate down the back stack.
- New Fragment and View support. Developers can wrap the containing views of a Fragment or Views in general in the new SwipeDismissFrameLayout to implement custom actions such as going down the back stack when the user swipes rather than exiting the activity.
- Hardware button now maps to “power” instead of “back” which means it can no longer be intercepted by apps.
Finally, compatible Android Wear apps packaged using the legacy embedded app mechanism can now be delivered to Android Wear 2.0 watches. When a user installs a phone app that also contains an embedded Android Wear app, they will be prompted to install the embedded app via a notification. If they choose not to install it, they can find it in the Play Store on Android Wear under a new “Apps you’ve used” section.