У меня есть этот код, который создает уведомление, мне нужно удалить маленький значок в верхнем левом экране, мне нужно спросить, есть ли какой-либо метод, который предотвращает отображение этого значка при создании уведомлениеandroid как удалить уведомление маленькую иконку из верхнего левого экрана
String ns = Context.NOTIFICATION_SERVICE;
NotificationManager notificationManager =
(NotificationManager) getSystemService(ns);
RemoteViews notificationView = new RemoteViews(getPackageName(),
R.layout.mynotification);
Notification.Builder notification = new Notification.Builder(
getApplicationContext())
.setTicker(tickerText)
.setSmallIcon(R.drawable.ic_launcher)// here how can i make it null or transparent
.setAutoCancel(true)
.setContentIntent(mContentIntent)
.setVibrate(mVibratePattern)
.setContent(notificationView);
//the intent that is started when the notification is clicked (works)
Intent notificationIntent = new Intent(this, MainActivity.class);
PendingIntent pendingNotificationIntent = PendingIntent.getActivity(this, 0,
notificationIntent, 0);
//this is the intent that is supposed to be called when the
//button is clicked
Intent switchIntent = new Intent(this, switchButtonListener.class);
PendingIntent pendingSwitchIntent = PendingIntent.getBroadcast(this, 0,
switchIntent, PendingIntent.FLAG_UPDATE_CURRENT);
notificationView.setOnClickPendingIntent(R.id.closeOnFlash,
pendingSwitchIntent);
notificationView.setOnClickPendingIntent(R.id.appName,
pendingSwitchIntent);
Notification not = notification.build();
not.flags=Notification.FLAG_ONGOING_EVENT;
notificationManager.notify(1, not);
мне нужно оставить уведомление в строке состояния, но без отображения небольшой значок в верхней левой
Вы пытались удалить setSmallIcon (R.drawable.ic_launcher) –
да, тогда все уведомление удаляется! – Amalo