How to display a clear background image in Android Wear notification?

As far as I can decide, there are two ways to set the background image for notification in Android Wear. For recordings begin with:

Bitmap bitmap; Notification.Builder bob = new Notification.Builder(this) .setContentTitle(title) 

... etc. to set up a notification. Also assume that the bitmap was initialized to an image of the appropriate size (although this is another problem).

Method 1:

  bob.setLargeIcon(bitmap); 

This works, but the AFAICT bitmap always blurs against the background of the notification, regardless of its size.

Method 2:

  bob.setStyle(new Notification.BigPictureStyle().bigPicture(bitmap)); 

This clears the bitmap, but has the unpleasant side effect of inserting an extra “page” on the wearable page, blank except for the bitmap. I believe that the thinking here is that you are trying to show the image to the user - but I don't want it, I just need a non-blurred background.

Is there any way to do this?

+7
android wear
source share
1 answer

Use the setBackground(Bitmap) method of WearableExtender instead of setLargeIcon(Bitmap) . It will set the bitmap of the background, which will not be blurry.

 Notification.Builder wearableBuilder = new Notification.Builder(context) ... .extend(new WearableExtender().setBackground(bitmap)); 
+6
source share

All Articles