As far as I can work out, there are two ways to set the background image for a notification in Android Wear. For the record, both start with:
Bitmap bitmap;
Notification.Builder bob = new Notification.Builder(this)
.setContentTitle(title)
...and so on to set up the notification. Also assume that bitmap
has been initialized to an appropriately-sized image (though that's another issue).
Method 1:
bob.setLargeIcon(bitmap);
This works, but AFAICT bitmap
is always blurred-out in the background of the notification, regardless of its size.
Method 2:
bob.setStyle(new Notification.BigPictureStyle().bigPicture(bitmap));
This clears up the bitmap, but has the unfortunate side effect of inserting an extra "page" on the wearable, a page that is blank except for the bitmap. I suppose the thinking here is that you're trying to show the image to the user - but I'm not, I just want a non-blurry background.
Is there a way to accomplish this?
Please use setBackground(Bitmap)
method from WearableExtender
instead of setLargeIcon(Bitmap)
. It will set the background bitmap that won't be blurred.
Notification.Builder wearableBuilder = new Notification.Builder(context)
...
.extend(new WearableExtender().setBackground(bitmap));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With