Android: No icon for Notification

I wanted to create a notification without the icon in the status bar (the state that is not expanded). I tried the custom expanded view and set the icon for this view only. But it did not work. When I give 0 as icon to the constructor, the icon disappears but notification also does not appear in the expanded view.

Notification notification = new Notification(0, “”, 0);

I tried a lot of combinations but didn’t come out with a solution. By the way, I know it is working because I saw this feature in some apps. Thanks.

Android Notification Icon

New to Android development. I’m wondering if its possible to programmatically draw an icon to put in the notification bar? What if we want the icon to display some dynamic text for something like batt

Android notification icon in code

When I successfully install an app from android market it show success icon in notification. How can I get it in code ? Ex : Notification notification = new Notification( android.R.drawable.stat_notif

Android Notification Dynamic Icon

Is it possible to overlay a notification icon with some text/int? or is it possible to generate a custom icon on the fly? For example I have the current icon displayed for my notification, I would lik

Android Notification.Builder: show a notification without icon

String ns = Context.NOTIFICATION_SERVICE; NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns); int icon = R.drawable.ic_notification_icon; android.app.Notification.Bu

Customer icon notification:android

Can please add a badge to a notification icon like it appear in this image(in the red cercle) thanks for advance

Android notification icon

I need to make a notification icon. Icon will show just a number. What size do I need to look nice? I am thinking of a similar size as here: https://lh5.ggpht.com/4G8a85pukLYnj0Xu5H23ZjqNNYyTJuIGdTVv

Android: system notification icon

I’m developing an Android application that implements a vpn service. During the lifetime of a VPN connection, a system-managed notification is shown, as is reported on the documentation: http://develo

Android Notification icon on the left

Here’s an odd question: How can I get the styled notification icon in the navigation drawer? Android (on my Nexus 5 at least) adds a little blue background to that icon, apparently. I would like to

Android – Change Notification Icon

I would like to know if its possible to have an different Notificationbar Icon than the Launcher or Application Icon. I would like to display an other icon for my push notifications. Is this possible?

How to remove notification icon from notification bar in android?

I have just started to learn Android app development and get stuck into some serious problem that is, I need to remove a icon (for a specific notification id) from notification bar when some one slide

Answers

You could use a transparent images as the notification icon. but as molnarm already mentioned, the user won’t notify that there is a new notification

QuickSettings did this and as I looked at that code I saw it uses the default constructor of Notification and pushes its icon to the right of the notification bar. I think it still uses space but has no icon.

Some code:

notification = new Notification();
notification.flags |= Notification.FLAG_ONGOING_EVENT;
notification.flags |= Notification.FLAG_NO_CLEAR;
long hiddenTime = Constants.SDK_VERSION >= 9 ? -Long.MAX_VALUE : Long.MAX_VALUE;
notification.when = visible ? System.currentTimeMillis() : hiddenTime; // align
// left (0) / right (max) in status bar

edit: oh sorry I missed an important line of code, in fact he uses a placeholder. But now you have some code šŸ˜‰

notification.icon = visible ? (status == Constants.STATUS_BLACK_ICON ? 
                            R.drawable.ic_logo_black : R.drawable.ic_logo_white)
                            : R.drawable.ic_placeholder;

http://code.google.com/p/quick-settings/source/browse/trunk/quick-settings/src/com/bwx/bequick/receivers/StatusBarIntegrationReceiver.java

Here’s something to experiment with. Put up a notification twice, once with icon=0 and once with a real icon. Try it in one order and then in the opposite order.

I got the effect of no notification in status bar and notification in expanded list when I did something like this, except that one of the two (the one with icon=0) was put up by Service.startForeground(). I don’t have time to experiment more right now.

This is now possible in Android 4.1; the reference implementation of the Jelly Bean status bar will suppress icons for PRIORITY_MIN notifications, although their content will still show in the notification panel.