I have generated a local notification by this following code.
Notification notification = new Notification.Builder(context)
.setAutoCancel(true)
.setContentTitle("title")
.setContentText("message")
.setWhen(System.currentTimeMillis())
.setSmallIcon(getNotificationIcon())
.build();
private static int getNotificationIcon() {
boolean useWhiteIcon = (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP);
return useWhiteIcon ? R.drawable.icon_loli : R.drawable.ic_launcher;
}
where icon icon_loli is 16*16 white icon. still for the api version below 21, it works very fine but on lollipop & above it will show a notification as in image below