If the app is running in the foreground, I can control what the notification shows or does next, because I can use the parameters I sent previously in the message to decide if I show it or not, or  what I'm going to do according to  the data retrieved, before it triggers to the screen. Example:

function onNotification(e) {

      tit =  e.payload.at;
      notif= e.payload.av;
      ent =  e.payload.en;
      url=   e.payload.ul;

    if (e.foreground) {
          if (ent==entID){ // a given condition
            navigator.notification.
confirm(
            notif,
            onConfirmDo,
            tit,
            'OK' 
        );
            function onConfirmDo(button){
                    if(button == "1" && url){
                     openInside(url+'&imei='+imei);
                    }
             }
           
          }
      }
    else {  
            if (e.coldstart) {
                //
            }
            else {
                //
            }
    }
}

Of course in many cases this is not a effective solution, because I should filter the message before she leaves the server. For instance: I want to show a notification to all my customers under 40 y.o. According to this:

http://aerogear.org/docs/specs/aerogear-server-push/

...I can use "alias", "categories", etc., to perform such segmentation; but I don't know how to send / store (?)  that information into the server.

Another issue related to this one: is there some way I have to control over the alert on the notification tray? That is: make it show only if a given criteria is matched?

Thanks

Miguel