Android Wear Specific Notification

前端 未结 5 2027
醉话见心
醉话见心 2021-02-13 23:21

The WearableNotifications.Builder setLocalOnly method can be used for displaying a notification on a phone only, and not mirror it to a Wear device.

Is th

5条回答
  •  闹比i
    闹比i (楼主)
    2021-02-13 23:28

    There is no way to specify an entire notification should not be displayed locally. However, the final notification extensions API (released 6/25), there is a way to specify actions which should only appear on a wearable.

    To do this, add the actions wrapped in a WearableExtender:

    NotificationCompat.Builder builder = new NotificationCompat.Builder();
    builder.extend(new NotificationCompat.WearableExtender()
        .addAction(new NotificationCompat.Action(
            R.drawable.reply, "Reply", pendingIntent)));
    

提交回复
热议问题