Created
July 6, 2014 15:34
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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