https://developer.android.com/training/wearables/notifications/creating.html#AddWearableFeatures

Creating a Notification for Wearables

  1. Create a Notification with the Notification Builder
  2. Construct Expanded notifications

Expanded notificationa의 사용이유

Expanded notifications provide substantial additional content and actions for each notification. When you specify additional content pages and actions for a notification 

사용자가 expanded notification을 보게되는 경우

  1. notification이 paired된 전화기로 부터 온경우
  2. notification에 

    contentIntent 가 정의 되지 않는 경우 (contentIntent 라는 것은 모든 notification에 기본적으로 들어가며 expanded notification의 경우는 추가하게된다.)

올바른 notificaton 작성 요령

  1. 전화기로 부터 wear기기로 오는 모든 notification은 expanded notification을 이용한다.
  2. 전화기에서 전화기로 전달되는 notification은 되도록이면 expanded를 사용하지 않는다.

Adding additional content to Expanded Notification

To show additional text in your expanded notification, use the BigTextStyle.

To add images in your expanded notification, you can use the BigPictureStyle. If you want to add more than one image in your expanded notification, use the addPage()method along with the BigPictureStyle.

Primary action

The expanded notification will contain one primary action, which is the first action in the notification unless a different action is specified using setContentAction().

Additional actions

To specify additional actions, use addAction() or addActions(). The action drawer of the expanded notification contains all available actions.

Add Notification Actions

In addition to the primary content action defined by setContentIntent(), you can add other actions by passing a PendingIntent to the addAction()method.

추가된 여러개의 action은 전화기에서는 버튼으로 표시되고 wearable기기에서는 content다음에 버튼으로 표기된다. reply action이 추가된경우 wearable에서는 voice input 이 가능하게 만들수도 있다.

image

Adding an Inline Action

Inline action allows users to take actions on a notification from within the notification stream card. On Wear, the inline action appears as an additional button displayed at the bottom of the notification.

image

Add Wearable Specific-features to a Notification

NotificationCompat.WearableExtender 를 사용하여 wearable 기기에 특화된 notification을 만들수 있다.

Specify Wearable-only Actions

wearable 기기에만 특정 actions를 적용하고 싶은 경우는 

NotificationCompat.Builder.addAction()대신에 WearableExtender.addAction()를 사용한다.

Adding voice input as a notification action

(voice input을 받을 수 있는 intent를 보내는 방법)

create an instance ofRemoteInput.Builder that you can add to your notification action.

Add Pre-defined Text Responses

Call setChoices() and pass it a string array.

image

Receiving the voice input as a string

To receive the user’s transcribed message in the activity you declared in the reply action’s intent, callgetResultsFromIntent(), passing in the “Reply” action’s intent. This method returns a Bundle that contains the text response. You can then query the Bundle to obtain the response.

Note: Starting in Android 8.0 (API level 26), you need to create notification channels for each type of notification you want to display