Wednesday, 9 May 2018

Wear OS by Google: AoG support and new enhanced battery saver mode






Posted by Hoi Lam, Lead Developer Advocate, Wear OS by Google





At Google I/O, we launched the Wear OS by Google developer preview 2. This update added support for Actions on Google (AoG) and more power-related enhancements including a new battery saver mode.


This developer preview includes updated Android Emulator images and a downloadable system image for the Huawei Watch 2 Bluetooth or Huawei Watch 2 Classic Bluetooth. This preview release is intended for developers only and not for daily or consumer use. Therefore, the preview release is only available via manual download and flash. Please refer to the release notes for known issues before downloading and flashing your device.



Support for Actions on Google


We have revamped the Google Assistant on Wear OS to support features such as visual cards, follow-on suggestion chips, and text-to-speech. For developers, we added support for Actions on Google to Wear OS and existing Actions will work on Wear OS out of the box. Be sure to observe best practices for Actions on Google to get the best results such as short concise dialog and adopting to both visual and vocal feedback. This feature does not depend on Android P and is being rolled out to all Wear 2.0 users.



Enhanced battery saver mode


In this Android P developer preview, we are launching an enhanced battery saver mode. While the watch is in this mode, the watch shows a power-efficient watch face and turns off a set of services including radios, the touch screen, and tilt to wake. Users can get the time by pressing the side button. A long press allows the user to switch back to a fully-operational mode and perform tasks such as paying with NFC or replying to a message. Developers should assume that their apps, watch faces, and complication data providers are not available in enhanced battery saver mode.



Update on power saving features


We received much feedback on the power saving features in the last developer preview. As a result, we have updates on two features:



  • Roll back of Wi-Fi off when BT is disconnected: To improve power consumption, the last developer preview would not connect to Wi-Fi when disconnected from Bluetooth. After listening carefully to user and developer feedback, we decided to roll back this change.

  • Limited background activity and foreground service: A number of health and fitness developers have said their apps require background monitoring of the user's motion and other vitals throughout the day. The developers said their apps cannot perform background monitoring if background services are unable to set alarms and jobs. For these types of exceptional use cases, we recommend that the apps use foreground services to anchor alarms and jobs. For other use-cases, developer should look at both foreground service as well as limiting jobs and alarms to while the watch is on charger. We are still fine tuning this feature, your feedback and use-cases will be most helpful in helping us get this right.



Smart Reply for bridged notifications


Smart Reply has been enabled for bridged notifications from the user's smartphone for some time. With the latest developer preview, we are introducing simplified Chinese support for our users in China. This feature is powered by an on-device model using TensorFlow Lite and the model is optimized for low-memory, low-power devices.


To use this feature, developers should set setAllowGeneratedReplies of the reply action to true. Here's a sample code snippet with the important part highlighted in bold:






NotificationCompat.Action action =
new NotificationCompat.Action.Builder(R.drawable.ic_reply_white_24dp,
replyLabel, replyPendingIntent)
.addRemoteInput(remoteInput)
.setAllowGeneratedReplies(true) // <--- true to enable smart replies
// Wear OS requires a hint to display the reply action inline.
.extend(new NotificationCompat.Action.WearableExtender()
.setHintDisplayActionInline(true))
.build();

In addition, for messaging apps, we recommend that developers use MessagingStyle notifications. This can give the algorithm a more structured data set on which to base its recommendations.




Please give us your feedback


We expect to provide more updates to this preview before the final production release. Please submit any bugs you find via the Wear OS by Google issue tracker. The earlier you submit them, the higher the likelihood that we can include the fixes in the final release.





No comments:

Post a Comment