[aerogear-dev] Database filtering

Matthias Wessendorf matzew at apache.org
Mon Feb 24 08:20:05 EST 2014


On Mon, Feb 24, 2014 at 2:10 PM, Miguel Lemos <miguel21op at gmail.com> wrote:

>
> 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.
>



Your backend knows:
- the age
- the username

Now, when a device registers use the username as the alias value. Using an
alias on _device registration_ (E.g. username or an email address) is
already part of the Cordova example:
https://github.com/aerogear/aerogear-pushplugin-cordova#sample-example


Now the sending part:
Your sever can do the query "select all usernames under 40 years", where
you get a list of usernames. Use these queried usernames as part of the
SEND, like shown here:
https://github.com/aerogear/aerogear-unifiedpush-server#sender

Or a bit more detailed our message spec:
http://aerogear.org/docs/specs/aerogear-push-messages/





>
> 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?
>


No for apple. if 'alert' is included, the OS displays the message. However,
you should be able to send messages without an alert. Parse the details of
the message and if you like (e.g. some rules are true), notify the user.

-Matthias




>
> Thanks
>
> Miguel
>
>
>
>
> _______________________________________________
> aerogear-dev mailing list
> aerogear-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>



-- 
Matthias Wessendorf

blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/aerogear-dev/attachments/20140224/339542d4/attachment-0001.html 


More information about the aerogear-dev mailing list