3

I'd like to setup an android wear app that extends push notifications by stacking multiple notifications and then displaying different background images and action on each stacked notification.

http://developer.android.com/training/wearables/notifications/stacks.html

This is how the stacked notifications would look and then cards in the 2nd and 3rd columns would have unique background images.

I can get the background image to show up on a single notification, but when I moved to stacked notifications, they do not show up.

Does anyone know if this is possible at this time?

enter image description here

Example Code..

// Main Notification Object
        NotificationCompat.Builder wearNotificaiton = new NotificationCompat.Builder(this)
                .setDefaults(Notification.DEFAULT_ALL)
                .setSmallIcon(R.drawable.icon)
                .setWhen(System.currentTimeMillis())
                .setTicker(title)
                .setContentTitle(title)
                .setContentText(text);

        wearNotificaiton.setGroup(GROUP_ALARM_KEY);

        // Create second page
        Notification TrendPage =
                new NotificationCompat.Builder(this)
                        .setLargeIcon(trendImage)
                        .setStyle(new NotificationCompat.BigPictureStyle().bigPicture(trendImage))
                        .build();

        // Create third page
        Notification ChartPage =
                new NotificationCompat.Builder(this)
                        .setLargeIcon(trendImage)
                        .setStyle(new NotificationCompat.BigPictureStyle().bigPicture(trendImage))
                        .setContentTitle("test title 1")
                        .build();

        // wearable extender to add 2nd page and extend the main notification
        NotificationCompat.Builder extendedNotification =
                new NotificationCompat.WearableExtender()
                        .addPage(TrendPage)
                        .addPage(ChartPage)
                        .extend(wearNotificaiton)
                        .addAction(alertPageAction);
DavidPostill
  • 7,734
  • 9
  • 41
  • 60
TWilly
  • 4,863
  • 3
  • 43
  • 73

1 Answers1

4

I've just played with this a little bit and I'm afraid that having different backgrounds in one group is simply not possible. It doesn't matter if you have just a group of notifications or group of notifications with pages - there will be only one background for entire stack.
If you will disable the setGroup line everything will work fine with backgrounds - you will have different backgrounds on first page.

BTW. To set a background for particular notification just make use of WearableExtender:

    .extend(new NotificationCompat.WearableExtender().setBackground(trendImage))

instead of applying largeIcon or BigPictureStyle. But this doesn't solve your problem with groups of course.

Maciej Ciemięga
  • 10,125
  • 1
  • 41
  • 48
  • Would this require to build a standalone wear app and then use the grid view pager? This would still be possible through push notifications right? Thanks for your quick response as well! – TWilly Jul 16 '14 at 18:40
  • I've tested it via standard notification framework on Android Wear side and as I said previously - this is not possible with stack notifications AFAIK:( With GridViewPager everything would be possible and you can set different background for different page - it will be your app so you will be able to do whatever you want:) – Maciej Ciemięga Jul 16 '14 at 18:43