I don't konw where is issue, but this code working fine for me
@SuppressLint("NewApi")
public void customNotification(String title, String description, String image, Bitmap bitmap) {
Intent intent = new Intent(mContext,Activity.class);
long when = System.currentTimeMillis();
int icon = getNotificationIcon();
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
RemoteViews simpleContentView = new RemoteViews(getApplicationContext().getPackageName(), R.layout.small_notification);
RemoteViews expandedView = new RemoteViews(getApplicationContext().getPackageName(), R.layout.big_notification);
Notification notification = new Notification(icon, getResources().getString(R.string.app_name), when);
try {
if (notification != null) {
notification.contentView = simpleContentView;
notification.contentIntent = pendingIntent;
if (currentVersionSupportBigNotification()) {
notification.bigContentView = expandedView;
}
notification.contentView.setTextViewText(R.id.txt_title_notification, title);
notification.contentView.setTextViewText(R.id.txt_desc_notification, description);
if (image != null && !image.equals("")) {
try {
notification.contentView.setImageViewBitmap(R.id.img_poster_notification, bitmap);
} catch (Exception e) {
e.printStackTrace();
}
} else {
notification.contentView.setImageViewResource(R.id.img_poster_notification, R.drawable.placeholder_144x214);
}
if (currentVersionSupportBigNotification()) {
notification.bigContentView.setTextViewText(R.id.txt_title_notification, title);
notification.bigContentView.setTextViewText(R.id.txt_desc_notification, description);
if (image != null && !image.equals("")) {
try {
notification.bigContentView.setImageViewBitmap(R.id.img_poster_notification, bitmap);
} catch (Exception e) {
e.printStackTrace();
}
} else {
notification.bigContentView.setImageViewResource(R.id.img_poster_notification, R.drawable.placeholder_144x214);
}
}
notification.flags |= Notification.FLAG_AUTO_CANCEL;
notification.defaults |= Notification.DEFAULT_LIGHTS;
notification.defaults |= Notification.DEFAULT_VIBRATE;//Vibration
notification.defaults |= Notification.DEFAULT_SOUND;
mNotifyManager = (NotificationManager) getSystemService(getApplicationContext().NOTIFICATION_SERVICE);
mNotifyManager.notify(NOTIFICATION_ID, notification);
}
} catch (Exception e) {
e.printStackTrace();
GlobalApp.Log("Notification_exc", "" + e.getMessage());
}
}