I am trying to use a colorful image with transparent background as a notification icon.
This works fine in older Android versions but when I tested it on Marshmallow (Android 6.0), it turns white. I tried to find the solution on Google and tried them but with no success.
Here is my code:
NotificationManager notificationManager = (NotificationManager)
context.getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new Notification(icon, message, when);
String title = context.getString(R.string.app_name);
Intent notificationIntent = new Intent(context, Activity_Notification.class);
notificationIntent.putExtra("MSG", message);
if (notificationIntent != null) {
int number = createRandomInteger();
notificationIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP |
Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent intent;
intent = PendingIntent.getActivity(context, number,
notificationIntent, Intent.FLAG_ACTIVITY_CLEAR_TOP |
Intent.FLAG_ACTIVITY_NEW_TASK);
notification.setLatestEventInfo(context, title, message, intent);
notification.flags |= Notification.FLAG_AUTO_CANCEL;
notification.defaults |= Notification.DEFAULT_SOUND;
notification.defaults |= Notification.DEFAULT_VIBRATE;
notificationManager.notify(number, notification);
}
Please help me to get rid of this problem.