[Aerogear-users] Unified Push Server - Anyway to delete notifications when in background?

Rob Willett rob.aerogear at robertwillett.com
Wed Nov 25 07:00:49 EST 2015


Thanks for the prompt and helpful reply.

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 

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 :)

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

Best wisher,


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.

#!/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->new;
     my $json = JSON->new();
     my $response_body;

     my $json_string = $json->encode($config);

     print "json string $json_string\n";

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

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

     $curl->setopt( CURLOPT_WRITEDATA , \$response_body);

     print "AeroGear Reponse=".Dumper($response_body);

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

	SendAeroGearNotification("https://<<OPENSHIFT GEAR 
NAME>>.rhcloud.com/ag-push/rest/sender" ,
                              “<<USERNAME>>“ ,
                              “<<PASSWORD>>” , 
On 25 Nov 2015, at 10:07, Matthias Wessendorf wrote:

> On Wed, Nov 25, 2015 at 10:14 AM, Rob Willett <
> rob.aerogear at robertwillett.com> wrote:
>> Hi,
>> We’ve got the Unified Push Server working on the OpenShift 
>> platform.
>> No real issues once we’d understood the point of aliases.
>> We can send notifications quite happily and see whats going on. We 
>> use
>> Perl for our backend servers and so we wrote a small Perl interface. 
>> If
>> anybody wants the code for the Perl interface let me know and we’ll
>> pass it on. We can’t claim a lot of credit for a simple piece of 
>> code
>> :)
> sure, I think that would be awesome, if you could publish it on 
> github.
> We will promote if for other perl users!
>> Anyway, one of edge use-cases would be to delete notification or set 
>> of
>> notifications when the app is running but in the background on iOS.
>> We want to do this as the user can receive a high number of
>> notifications (> 10) when the app is in the background. Notifications
>> come in groups and provide traffic updates, so a user may get a new
>> group of 3-4 traffic updates, this new group completely supersedes 
>> ANY
>> previous update. Our data is valuable when fresh and useless when 
>> over
>> 10 minutes old.
>> Whilst we can simply ignore old notifications, UX testing has shown 
>> the
>> users don’t like having old notifications sitting round. We know 
>> that
>> the users can delete them individually or delete the lot from the
>> notification drawer OR can simply bring the app out of the background
>> BUT they don’t like doing that.
>> So what we want to do is delete old notifications, we were hoping for
>> the ability to call a JavaScript function with say a parameter to
>> identify notifications by a group or something, but we could accept
>> deleting the lot and inserting local notifications instead.
>> We know that we can send content-available and have stuff pulled from 
>> a
>> server in the background. This option is quite difficult for us and 
>> has
>> some complexity identifying when the app is not started up. The 
>> simplest
>> option is delete some or all of the notifications.
>> Does anybody know if this is possible or any other suggestions?
> I think that's an interesting idea. Erik Jan recently did an update 
> for
> message, on Cordova, to actually stack em:
> https://github.com/aerogear/aerogear-cordova-push/pull/81
> Perhaps we could have a 'delete' feature too. Mind filing a JIRA 
> against:
> https://issues.jboss.org/projects/AGCORDOVA
> (you need to have an account in order create tickets)
> Cheers!
> Matthias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/aerogear-users/attachments/20151125/6f5b0067/attachment.html 

More information about the Aerogear-users mailing list