This lesson teaches you to
Newer version of Wear OS by Google updates the visual style and interaction paradigm of notifications making it much easier for users to read and interact with notifications from your app.
Not all features of Wear 1.0 are available in the current version, even though the methods to set them are in the support library class NotificationCompat.Builder. The section below explains how you can design your Wear app notifications to be compatible with the newer version of Wear OS.
Ensure Notification Compatibility
Figure 1. Comparison of the same notification in Wear 1.x and 2.0.
To ensure the best compatibility, follow this process when you implement a notification:
- Dark background color: If you have notifications that are bridged to wearables, you need to be careful with regards to using color for the notifications. Since a bridged notification needs to support both light (Wear1.x) and dark (Wear 2.0) backgrounds, it is unlikely that any colors will work well on both. DisplayIntent notifications render with both light and dark backgrounds as well, and need to be checked for the same reason. We recommended that you don't set color for bridged notifications. When Wear apps post local notifications, you can work around this by checking the API level of the device they're running on and using an appropriate color for Wear 1.x and a different color for Wear 2.0.
- Updated horizontal swipe gesture on a notification: To dismiss a notification in Wear 2.0, the user swipes horizontally in either direction. So if your notification instructs the user to swipe left or right, you must update the text of your notification.
- Expanded notifications: To provide more information without
requiring users to open your app on their phone, Wear 2.0 supports
So if you are currently using the
addPage()method to provide additional text in your notification, you must update the code to use
BigTextStylein your expanded notification.