Android Wear上的Hangout类列表通知



Hangout使用特定的Notification,当在Android Wear上右滑时显示消息列表。它显示了ListView中的所有消息。

是否使用特定的Notification Style(如InboxStyleBigTextStyle)?会是Wear App吗?(我不这么认为,他们不能通过滑动访问)

他们正在为他们的通知添加页面,允许你为Android Wear设备添加额外的内容。

链接中的示例代码:

// Create builder for the main notification
NotificationCompat.Builder notificationBuilder =
    new NotificationCompat.Builder(this)
    .setSmallIcon(R.drawable.new_message)
    .setContentTitle("Page 1")
    .setContentText("Short message")
    .setContentIntent(viewPendingIntent);
// Create a big text style for the second page
BigTextStyle secondPageStyle = new NotificationCompat.BigTextStyle();
secondPageStyle.setBigContentTitle("Page 2")
           .bigText("A lot of text...");
// Create second page notification
Notification secondPageNotification =
    new NotificationCompat.Builder(this)
    .setStyle(secondPageStyle)
    .build();
// Add second page with wearable extender and extend the main notification
Notification twoPageNotification =
    new WearableExtender()
            .addPage(secondPageNotification)
            .extend(notificationBuilder)
            .build();
// Issue the notification
notificationManager =
    NotificationManagerCompat.from(this);
notificationManager.notify(notificationId, twoPageNotification);

最新更新