0

I want to only display a notification icon, I don't want that notification in the app drawer also. I have an alarm clock app, where I only want to set the icon, but not have something in the drawer, like the default android alarm clock app. My current code is below.

    NotificationCompat.Builder mBuilder =
            new NotificationCompat.Builder(context)
                    .setSmallIcon(R.drawable.jolt_action_bar_logo);
    int mNotificationId = 001;
    // Gets an instance of the NotificationManager service
    NotificationManager mNotifyMgr =
            (NotificationManager) context.getSystemService(context.NOTIFICATION_SERVICE);
    // Builds the notification and issues it.
    mNotifyMgr.notify(mNotificationId, mBuilder.build());

While it creates a notification icon. It also creates a notification in the drawer.

Mark Kuczmarski
  • 173
  • 3
  • 16

1 Answers1

1

It's impossible to do what you are wanting to do. The idea of notification icons is so that the user can get any idea of what notifications that the user has yet to act upon. If a notification icon is displayed, the user expects to see a notification of it in the notification shade.

Also, the alarm clock icon you are referring to that the default alarm clock app puts out isn't a notification icon, rather it is an indicator icon to let you know that something is happening (or going to happen) with your device. Examples of indicator icons include the alarm clock icon, the WiFi connectivity icon, the mobile network icon, the NFC icon on some devices, etc. If your app is a alarm clock app, you could tell the Android system to display the alarm icon, as outlined here.

rakeshdas
  • 2,363
  • 5
  • 20
  • 28