I try to find this one in this forum and I found a couple but no one worked for me. I just need to hide it in the notification panel where appears next to the large icon but if I hide it, it also dissapears from the notification bar.
Is there any way to show only the large icon as is happening in the first and fourth notifications?
This is the code that I am using:
mNotificationManager = (NotificationManager)
this.getSystemService(Context.NOTIFICATION_SERVICE);
Intent intent;
Notification.Builder mBuilder =
new Notification.Builder(this)
.setSmallIcon(R.mipmap.small_icon).setTicker(getApplicationContext().getResources().getString(R.string.app_name))
.setLargeIcon(largeIcon)
.setAutoCancel(true)
.setVibrate(new long[]{1000, 1000, 1000, 1000, 1000})
.setLights(Color.GREEN, 1000, 1000)
.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION))
.setContentTitle(extras.getString("title"))
.setStyle(new Notification.BigTextStyle().bigText(extras.getString("message")))
.setContentText(extras.getString("message"));
edit.putString(Config.FRAGMENT, extras.getString("fragment"));
edit.commit();
intent = new Intent(this, NavigationActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
intent, 0);
mBuilder.setContentIntent(contentIntent);
mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
You can make it invisible after building the notification :
int smallIconId = context.getResources().getIdentifier("right_icon", "id", android.R.class.getPackage().getName());
if (smallIconId != 0) {
notification.contentView.setViewVisibility(smallIconId, View.INVISIBLE);
notification.bigContentView.setViewVisibility(smallIconId, View.INVISIBLE);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With