<div class="markdown">
<p dir="auto">Matthias,</p>

<p dir="auto">Thanks for the prompt and helpful reply. </p>

<p dir="auto">We had a quick look at the stacking, as expected it seems to be for Android (which is no surprise at all). I am not an expert on iOS (or anything else) but as far as I know, stacking is impossible on iOS. We’re spending more and more time on getting the notifications right, its turned out to be significantly more complicated than we thought and one of the areas where we have two distinct lines of code in our Cordova app. </p>

<p dir="auto">I’ll raise JIRA for our ideas and let people ponder on that. In the last three weeks, we’ve tried four biggish vendors for Push notifications and we’ve had issues with all of them. Amazon, Parse, Urban Airship, OneSignal. Some are money issues (thats always the way), some are incredibly inflexible (Amazon), some don’t handle content-available, some don’t really support Cordova. Its been hardwork and we really, really want UPS to work for us. We’re tired of testing notifications on yet another system :)</p>

<p dir="auto">I’ll put in on github but the code is pretty simple so I’ll put it here as well as we’re not big users off github and it might takes us a while to work it out. We’re rather old-school and like Emacs, Perl and dead simple stuff like that. We’ll try and work it out though</p>

<p dir="auto">Best wisher,</p>

<p dir="auto">Rob</p>

<p dir="auto">This is untested code as-is, we just pulled it straight out the testing file. We know it works in our system but I haven’t tested this simplified version. The github one will be tested though.</p>

<pre><code>#!/usr/bin/perl -w

use strict;
use warnings;
use Net::Curl::Easy qw(/^CURLOPT_.*/);
use JSON;

sub SendAeroGearNotification
{
    my ($url , $username , $password , $config) = @_;
    my $curl = Net::Curl::Easy-&gt;new;
    my $json = JSON-&gt;new();
    my $response_body;

    my $json_string = $json-&gt;encode($config);

    print "json string $json_string\n";

    $curl-&gt;setopt( CURLOPT_URL, $url);
    $curl-&gt;setopt( CURLOPT_SSL_VERIFYHOST , 0);
    $curl-&gt;setopt( CURLOPT_SSL_VERIFYPEER , 0);

    $curl-&gt;setopt( CURLOPT_USERPWD , "$username:$password");
    $curl-&gt;setopt( CURLOPT_HTTPHEADER, ['Content-Type: application/json' ,
                                        'Accept: application/json']);
    $curl-&gt;setopt( CURLOPT_POST , 1);
    $curl-&gt;setopt( CURLOPT_POSTFIELDS , $json_string);

    $curl-&gt;setopt( CURLOPT_WRITEDATA , \$response_body);

    $curl-&gt;perform;
    print "AeroGear Reponse=".Dumper($response_body);
}

    my $notification_config = {
                 variants =&gt; [ “&lt;&lt;VARIANT ID&gt;&gt;“ ] ,
                 alias =&gt; [ “alias1” , “alias2” , “alias3” ] ,
                 ttl =&gt; 600 ,
                 message =&gt; {
                    alert =&gt; $contents ,
                     'content-available' =&gt; JSON::true ,
                     data =&gt; {
                        key1 =&gt; value1 , 
                        key2 =&gt; value2
                     }
                 }
             };

    SendAeroGearNotification("https://&lt;&lt;OPENSHIFT GEAR NAME&gt;&gt;.rhcloud.com/ag-push/rest/sender" ,
                             “&lt;&lt;USERNAME&gt;&gt;“ ,
                             “&lt;&lt;PASSWORD&gt;&gt;” , $notification_config);
</code></pre>

<p dir="auto">On 25 Nov 2015, at 10:07, Matthias Wessendorf wrote:</p>

<blockquote>
<p dir="auto">On Wed, Nov 25, 2015 at 10:14 AM, Rob Willett &lt;<br>
<a href="mailto:rob.aerogear@robertwillett.com">rob.aerogear@robertwillett.com</a>&gt; wrote:</p>

<blockquote>
<p dir="auto">Hi,</p>

<p dir="auto">We’ve got the Unified Push Server working on the OpenShift platform.<br>
No real issues once we’d understood the point of aliases.</p>

<p dir="auto">We can send notifications quite happily and see whats going on. We use<br>
Perl for our backend servers and so we wrote a small Perl interface. If<br>
anybody wants the code for the Perl interface let me know and we’ll<br>
pass it on. We can’t claim a lot of credit for a simple piece of code<br>
:)</p>
</blockquote>

<p dir="auto">sure, I think that would be awesome, if you could publish it on github.<br>
We will promote if for other perl users!</p>

<blockquote>
<p dir="auto">Anyway, one of edge use-cases would be to delete notification or set of<br>
notifications when the app is running but in the background on iOS.</p>

<p dir="auto">We want to do this as the user can receive a high number of<br>
notifications (&gt; 10) when the app is in the background. Notifications<br>
come in groups and provide traffic updates, so a user may get a new<br>
group of 3-4 traffic updates, this new group completely supersedes ANY<br>
previous update. Our data is valuable when fresh and useless when over<br>
10 minutes old.</p>

<p dir="auto">Whilst we can simply ignore old notifications, UX testing has shown the<br>
users don’t like having old notifications sitting round. We know that<br>
the users can delete them individually or delete the lot from the<br>
notification drawer OR can simply bring the app out of the background<br>
BUT they don’t like doing that.</p>

<p dir="auto">So what we want to do is delete old notifications, we were hoping for<br>
the ability to call a JavaScript function with say a parameter to<br>
identify notifications by a group or something, but we could accept<br>
deleting the lot and inserting local notifications instead.</p>

<p dir="auto">We know that we can send content-available and have stuff pulled from a<br>
server in the background. This option is quite difficult for us and has<br>
some complexity identifying when the app is not started up. The simplest<br>
option is delete some or all of the notifications.</p>

<p dir="auto">Does anybody know if this is possible or any other suggestions?</p>
</blockquote>

<p dir="auto">I think that's an interesting idea. Erik Jan recently did an update for<br>
message, on Cordova, to actually stack em:<br>
<a href="https://github.com/aerogear/aerogear-cordova-push/pull/81">https://github.com/aerogear/aerogear-cordova-push/pull/81</a></p>

<p dir="auto">Perhaps we could have a 'delete' feature too. Mind filing a JIRA against:<br>
<a href="https://issues.jboss.org/projects/AGCORDOVA">https://issues.jboss.org/projects/AGCORDOVA</a><br>
(you need to have an account in order create tickets)</p>

<p dir="auto">Cheers!<br>
Matthias</p>
</blockquote>

</div>