Skip to content

Instantly share code, notes, and snippets.

@degliwe
Created July 6, 2014 15:34
Show Gist options
  • Save degliwe/d515c75b8bd5759134cb to your computer and use it in GitHub Desktop.
Save degliwe/d515c75b8bd5759134cb to your computer and use it in GitHub Desktop.
This is how to display a nice background on Android Wear notification instead of a plain color or a pixelated icon
int notificationId = 001;
// Create a WearableExtender to add functionality for wearables
NotificationCompat.WearableExtender wearableExtender =
new NotificationCompat.WearableExtender()
.setBackground(bigBitmap);
// Build the notification
NotificationCompat.Builder notificationBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_launcher)
.setContentTitle(myTitle)
.setContentText(myText)
.setContentIntent(myContentIntent)
.extend(wearableExtender);
// Get an instance of the NotificationManager service
NotificationManagerCompat notificationManager =
NotificationManagerCompat.from(this);
// Issue the notification with notification manager.
notificationManager.notify(notificationId, notificationBuilder.build());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment