Android Question Show icon in notification?

Discussion in 'Android Questions' started by trueboss323, Feb 22, 2015.

  1. trueboss323

    trueboss323 Active Member Licensed User

    Hello,
    Is there a way I can show only the app icon in the notification tray? I don't want to show a notification, but just the app icon itself. Thanks.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Notifications always have a body. If I remember correctly the notification will use some default text if you set all the fields to be empty.
     
  3. trueboss323

    trueboss323 Active Member Licensed User

    I tried setting all the fields to empty, and it showed up empty when I tested it. But how is it possible to set just the app icon, because i've seen other applications setting an icon without showing a notification.
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    I'm not familiar with any way to hide the notification item.
     
  5. trueboss323

    trueboss323 Active Member Licensed User

    Is it possible maybe there is a custom Notification library for it? I do not seem to be able to find one.
     
  6. barx

    barx Well-Known Member Licensed User

    I've never seen a way to do it...

    Show us some Java code example and maybe we can implement it.
     
  7. trueboss323

    trueboss323 Active Member Licensed User

    Well I don't know any Java, but here is some code that I found
    Code:
    //Check the SystemTray is supported
            
    if (!SystemTray.isSupported()) {
                System.out.println(
    "SystemTray is not supported");
                
    return;
            
    }
            final PopupMenu popup = new PopupMenu();
            final TrayIcon trayIcon =
                    new TrayIcon(createImage("images/bulb.gif", "tray icon"));
            final SystemTray tray = SystemTray.getSystemTray();
         
            // Create a pop-up menu components
            MenuItem aboutItem = new MenuItem("About");
            CheckboxMenuItem cb1 = new CheckboxMenuItem("Set auto size");
            CheckboxMenuItem cb2 = new CheckboxMenuItem("Set tooltip");
            Menu displayMenu = new Menu("Display");
            MenuItem errorItem = new MenuItem("Error");
            MenuItem warningItem = new MenuItem("Warning");
            MenuItem infoItem = new MenuItem("Info");
            MenuItem noneItem = new MenuItem("None");
            MenuItem exitItem = new MenuItem("Exit");
         
            //Add components to pop-up menu
            popup.add(aboutItem);
            popup.addSeparator();
            popup.add(cb1);
            popup.add(cb2);
            popup.addSeparator();
            popup.add(displayMenu);
            displayMenu.add(errorItem);
            displayMenu.add(warningItem);
            displayMenu.add(infoItem);
            displayMenu.add(noneItem);
            popup.add(exitItem);
         
            trayIcon.setPopupMenu(popup);
         
            try {
                tray.add(trayIcon);
            } catch (AWTException e) {
                System.out.println("TrayIcon could not be added.");
            }
    In VB you would normally use
    Code:
    NotifyIcon1.Visible = True
     
  8. Erel

    Erel Administrator Staff Member Licensed User

    This code has nothing to do with Android.
     
    NJDude likes this.
  9. trueboss323

    trueboss323 Active Member Licensed User

    Which is why if there is a similar code that could be found for B4A.
     
  10. Erel

    Erel Administrator Staff Member Licensed User

    As I wrote in my previous answer I'm not familiar with any way to create such a notification.
     
    NJDude likes this.
  11. barx

    barx Well-Known Member Licensed User


    There isn't, sorry
     
    NJDude and DonManfred like this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice