I have used this code
private void sendNotification() {
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
Intent intent = new Intent(this, LoginActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
int randomNumber = (int) System.currentTimeMillis();
PendingIntent pendingIntent = PendingIntent.getActivity(this, randomNumber, intent,
PendingIntent.FLAG_ONE_SHOT);
Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.BigPictureStyle nbs = new android.support.v7.app.NotificationCompat.BigPictureStyle();
nbs.setSummaryText("Big Message").bigPicture(BitmapFactory.decodeResource(getResources(),R.drawable.general_push)).setBigContentTitle("Big Title");
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
.setContentTitle("Small Title")
.setStyle(nbs)
.setContentText("Small Message")
.setAutoCancel(true)
.setSound(defaultSoundUri)
.setContentIntent(pendingIntent);
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
notificationBuilder.setSmallIcon(R.drawable.notif_trans);
}else{
notificationBuilder.setSmallIcon(R.drawable.notif_logo);
}
NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(randomNumber, notificationBuilder.build());
}
In my lollipop device I tested icon is coming but it is in white color only, somebody told that have to add setColorFilter I don't know how to set to app icon,I am directly setting smallIcon with drawable ID, where I have to set setColorFilter? Please help me. Some body has given this code
if (entry.targetSdk >= Build.VERSION_CODES.LOLLIPOP) {
entry.icon.setColorFilter(mContext.getResources().getColor(android.R.color.white));
} else {
entry.icon.setColorFilter(null);
},
in this what is entry.icon how we will get and how to set that to the small icon