I am trying to build custom notification for my app, but I am not able to remove the header information (which includes small icon, app name, time) and the expand icon. Basically I want completely my own design of notification which takes full width and height.
private void createNotification() {
// BEGIN_INCLUDE(notificationCompat)
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, NOTIFICATION_CHANNEL);
Intent i = new Intent(this, MainActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent intent = PendingIntent.getActivity(this, 0, i,
PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
builder.setContentIntent(intent);
builder.setSmallIcon(R.drawable.ic_stat_custom);
builder.setAutoCancel(true);
RemoteViews contentView = new RemoteViews(getPackageName(), R.layout.notification);
// Set text on a TextView in the RemoteViews programmatically.
final String time = DateFormat.getTimeInstance().format(new Date()).toString();
final String text = getResources().getString(R.string.collapsed, time);
contentView.setTextViewText(R.id.textView, text);
builder.setCustomContentView(contentView);
if (Build.VERSION.SDK_INT >= 16) {
// Inflate and set the layout for the expanded notification view
RemoteViews expandedView =
new RemoteViews(getPackageName(), R.layout.notification_expanded);
builder.setCustomBigContentView(expandedView);
}
Notification notification = builder.build();
NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
nm.notify(0, notification);
}
I am getting this as output:
But I want this notification as:
Is there anyway to achieve this?