title: How to catch only visible notification? android
body: <p>a have a small problem. Because, when I run a NotificationListenerService in background and method onNotificationPosted() give me a lot of notifications, but I need only this what see a user on the bar.</p>
  <p>But, when somebody send me a message on Messenger, my service shows me a few notifications, and the same for sms end other apps.
  But I need only one, this with content for user.
  I tryed this:</p>
  <pre><code>@Override
  public void onNotificationPosted(StatusBarNotification sbn) {
      int flag = sbn.getNotification().flags;
      flag = flag &amp; 0x00000001;
  
      if (flag == 1) {
          //Do something
      }
  }
  </code></pre>
  <p>And it works with app e.g Messenger, sms - I get only visible notification, but gmail not. I dont know why.</p>
  <p>Somebody know how to get only visible notyfication for user ?</p>
  <p>Please help</p>