Set background color for wearing

I want to set the background color for a wearable notification. The only method I have found is setBackground (bitmap background) NotificationCompat.WearableExtender , but this is for bitmaps only. Is it a good idea to create a bitmap rectangle and use it as the background of my notification? Any help would be appreciated.

+3


source to share


1 answer


Use NotificationCompat.Builder, in this you can use setColor and add it to NotificationCompat.WearableExtender with .extend () method. eg:



NotificationCompat.Builder builder = new NotificationCompat.Builder(this); builder.setSmallIcon(R.drawable.ic_launcher); builder.setContentTitle("Title"); builder.setColor(COLOR HERE); NotificationCompat.WearableExtender builderExtended = new NotificationCompat.WearableExtender(); builderExtended.extend(builder); builder.build();

0


source







All Articles