0

I've noticed that Weather Timeline (for instance) displays notifications with two lines in both peek and ambient. I would like to replicate this for my requirements, but I'm not able to do so. I've tried InboxStyle and BigTextStyle to no avail. The icon position is also different, making it possible to display more of the title.

Is this possible somehow, or is it because Weather Timeline is a "wear app"?

wear_notify

        NotificationCompat.Builder notificationBuilder =
            new NotificationCompat.Builder(this)
                    .setSmallIcon(R.drawable.ic_launcher)
                    .setContentTitle("TestTitle")
                    .setContentText("TestContextTextLoremIpsum");
Kjell-Bear
  • 759
  • 1
  • 5
  • 12

1 Answers1

0

The notification card may cover a significant portion of the screen, depending on the system UI style. Your watch face should adapt to these situations by ensuring that users can still tell the time while the notification card is present.

You need to determine the free space above the peek card so you can adapt your watch face, use WatchFaceService.Engine.getPeekCardPosition() method. This provide about its location when it's peeking at the bottom and allowing the watch face to be exposed.

Watch faces should not interfere with system UI elements, as described in Accommodate System UI Elements. If your watch face has a light background or shows information near the bottom of the screen, you may have to configure the size of notification cards or enable background protection.

@Override
public void onCreate(SurfaceHolder holder) {
super.onCreate(holder);

// configure the system UI
setWatchFaceStyle(new WatchFaceStyle.Builder(AnalogWatchFaceService.this)
.setCardPeekMode(WatchFaceStyle.PEEK_MODE_SHORT)
.setBackgroundVisibility(WatchFaceStyle
.BACKGROUND_VISIBILITY_INTERRUPTIVE)
.setShowSystemUiTime(false)
.build());
...
}

The code snippet above configures peeking cards to be a single line tall, the background of a peeking card to show only briefly and only for interruptive notifications, and the system time not to be shown.

Android Enthusiast
  • 4,826
  • 2
  • 15
  • 30