[Aerogear-users] Should the cordova push plugin start the App up if its not started?
rob.aerogear at robertwillett.com
Mon Dec 14 05:58:31 EST 2015
We are aware that the content-available flag is IOS specific. We have
also read ,  along with lots the information we can find on
background notifications for iOS. I will not say we have read everything
as we always find other information buried from Apple :)
If we use Table 1 in
to make sure we have the same terminology.
We can get the iOS Aerogear notification handler to respond to
notifications with content-available = 1 when the app is in the
**background** and the **foreground**. This works very well.
We cannot get the iOS AeroGear notification handler to respond to a
notification coming in with content-available = 1 when the app is
**suspended**. As far as we can see there is no difference in code for
the Aerogear handler to at least wake up and process the event that
comes in. The logic to handle the event once woken up is different as
there are different flags set. We understand the differences to do with
Our understanding is that:
IF the iOS app is suspended AND a notification comes in with
content-available = 1
Wake the app up
Pass control to the app through the function defined as the callback in
push.register(handleNotification , successHandler)
Within the notification handler callback, check to see if the
content-available flags is set AND the event.foreground value set.
Do something for short while such as get stuff from a server
Finish with calling setContentAvailable() with NewData, NoData or
Failed depending on what we have done.
Our code for handling the Aerogear notification is very simple, the
first thing the Handler does is send a tiny HTTP POST call to our REST
server so we can see that the notification handler is being called. Its
easy enough to see the Xcode console output when the app is in the
foreground or background, but more difficult to track what is happening
when the app is starting up. We don’t want to put an alert on the
screen as that changes the behaviour of the app, the same for doing a
beep or a sound to let us know that the app is starting up. So a simple
HTTP POST call to a server with a tiny bit of debugging information is
fine. We can see in the server logs this REST call being made in the
foreground and in the background but not when the app is suspended. We
think we have written the code appropriately but cannot seem to get it
to work (if it is supposed to).
So we would like to be able to call setContentAvailable(NewData) but we
never get the Aerogear handler started to do so. Now we may have missed
something vital but the code is pretty simple and works very well in the
foreground and background, just not when the app is suspended.
So should the AeroGear notification handler be called when the iOS app
is suspended as opposed to just in the background? If the notification
handler should be called, then we’ll keep digging into our code as
it’s a bug with our system. If the Aerogear notification handler is
NOT called when the app is suspended and thats by design then we will
work out a different mechanism. We are still unclear as to what the
Aerogear behaviour should be.
On 14 Dec 2015, at 10:03, Erik Jan de Wit wrote:
> Hi Rob,
> First of all let's be clear that the 'content-available' flag is a iOS
> implementation (part of the background fetch) and that it should start
> app , but this is handled by the OS and there are some heuristics
> involved that is why you have to set the NewData . So you can't be
> certain that it will 100% of the time, will start your app.
> For android we don't have any mechanism atm to enable background
> notifications, although I think we could add it.
> On Mon, Dec 14, 2015 at 9:36 AM, Rob Willett
> <rob.aerogear at robertwillett.com
>> Our focus has been on iOS and I realise that I should have stated
>> in my mail message. Apologies.
>> Currently IOS does not start our app when the iPhone receives an
>> AeroGear notification with content-available = 1 in it AND (the app
>> not been started OR is in the background). Basically we start the iOS
>> app, send a notification to check it works in the foreground. We then
>> swipe up to stop the app, send a new notification down, the new
>> notification is displayed BUT the AeroGear call back to handle the
>> notification is not called. If there is a a magic combination of
>> and content-available flags to make this happen we’d be happy to
>> them in our code but we cannot see anything happening at all. We have
>> not checked Android for this behaviour, as for technical reasons we
>> <cough> I <cough> broke our last Nexus 5 phone on Friday and have not
>> replaced it yet. We’ll have a new one tomorrow.
>> What we have to do at the moment is check to see if the app has
>> the silent notification as it will then make a callback to our
>> if there has been no callback wishing 60 secs, our server sends a
>> notification with an alert in that is displayed by the device. The
>> downside to this method is that we lose the ability to clean out old
>> notifications using the silent notification AND a local cordova
>> Our thinking is that both iOS and Android should start up in the
>> background when they receive a notification with an empty alert AND a
>> content-available = 1 flag AND the app is not running. We could use
>> Apple background-fetch to get 30 secs of processing and then shutdown
>> again. Unclear as to the system on Android.
>> We have also now seen that Apple very aggressively moves Apps from a
>> background state to a suspended state after not very long, which also
>> means that the app doesn’t respond to content-available = 1 flags.
>> haven’t worked out how long this interval is, but its not hours.
>> actually underscores the importance of handling the content-available
>> 1 flag working when apps are suspended or not started.
>> We are really starting to dislike Apples notification implementation.
>> The email address is list specific, we have our own mail servers so
>> easy to simply use specific emails which we can then track. Its easy
>> block as well if they get spammed.
>> On 14 Dec 2015, at 8:15, Erik Jan de Wit wrote:
>>> Hi Rob,
>>> Currently this is how background notifications (content-available)
>>> work on iOS, but on Android the notification doesn't start up the
>>> when the user 'touches' the notification is the app started. I think
>>> could change this behaviour, for instance when you send a
>>> doesn't contain any alert message. I think recently some more users
>>> experimented with how to 'enable' background notifications on
>>> do you think?
>>> p.s. I like your email address
>>> On Fri, Dec 11, 2015 at 6:59 PM, Rob Willett
>>> <rob.aerogear at robertwillett.com
>>>> We’re trying to work out if the Aerogear Cordova push
>>>> *should* start the app if the app is not started. If the app is in
>>>> background than we get the notification but if the app is not
>>>> up we
>>>> don’t *seem* to get anything happening.
>>>> It seems to work OK when the app is in the foreground or
>>>> not when its not started up?
>>>> Should it work when the app is not started on both iOS and Android?
>>>> Aerogear-users mailing list
>>>> Aerogear-users at lists.jboss.org
>>> Erik Jan
>>> Aerogear-users mailing list
>>> Aerogear-users at lists.jboss.org
>> Aerogear-users mailing list
>> Aerogear-users at lists.jboss.org
> Erik Jan
> Aerogear-users mailing list
> Aerogear-users at lists.jboss.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Aerogear-users