Reputation: 181
Here's the code I'm using to show a notification.
notification = new Notification.Builder(context).setContentIntent(contentIntentTwo)
.setContentTitle("App name").setSmallIcon(R.drawable.ic_launcher).setLargeIcon(notificationLargeIconBitmap).getNotification();
The notification and notification icon show in the pull down notification drawer, but not in the status bar in lollipop.
Here's what it looks like in lollipop :
This happens only on lollipop.
Upvotes: 4
Views: 4162
Reputation: 1986
for pre-lollipop version, you can still using drawable image. But for lollipop and later, you need transparent background image to be used for notification icon (png preferred). As i know that lollipop version or later will convert any non-transparent color into white color for notification icon for its simplicity and "complexion reduction" idea to reach material design.
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context)
.setContentTitle(title)
.setContentText(body)
.setPriority(2)
.setContentIntent(pendingIntent);
mBuilder.setAutoCancel(true);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
mBuilder.setSmallIcon(R.mipmap.ic_launcher_transparant);
}else{
mBuilder.setSmallIcon(R.mipmap.ic_launcher);
}
Upvotes: 0
Reputation: 20221
Lollipop changes all non-transparent pixels to white.
http://developer.android.com/about/versions/android-5.0-changes.html#BehaviorNotifications
Upvotes: 2