<div dir="ltr">Hi Rob,<div><br></div><div>I think we talked about this before, but the silent (content-available) notifications are scheduled by iOS, e.g. there are some heuristic involved. And they are coupled to background content fetching, so when your app receives a &#39;content-available&#39; silent notification it has 30 seconds to act and afterwards it has to inform the os of the result. That is what this function is for, then the os can use this information along with how often it&#39;s used to schedule the next invocation. I agree we have a bit sparse documentation [1]. And also what apple writes is a bit sparse [2]. But you must set this result otherwise your app might not get invoked anymore. In the js api there is an enum with possible values that you can use [3]</div><div><br></div><div>[1] <a href="https://aerogear.org/docs/guides/aerogear-cordova/AerogearCordovaPush/#_ios_background_notification">https://aerogear.org/docs/guides/aerogear-cordova/AerogearCordovaPush/#_ios_background_notification</a></div><div>[2] <a href="https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html">https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html</a></div><div>[3] <a href="https://github.com/aerogear/aerogear-cordova-push/blob/master/www/aerogear-push.js#L26-L36">https://github.com/aerogear/aerogear-cordova-push/blob/master/www/aerogear-push.js#L26-L36</a></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 4, 2015 at 8:24 AM, Matthias Wessendorf <span dir="ltr">&lt;<a href="mailto:matzew@apache.org" target="_blank">matzew@apache.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">yeah, I meant the flag. Glad it works for you.<div><br></div><div>I am actually over <span></span>asked on the client setContentAvailable(). </div><div><br></div><div><br></div><div>We have the same in our java sender, but that triggers the flag ;)<div><div class="h5"><br><div><br>On Thursday, 3 December 2015, Rob Willett &lt;<a href="mailto:rob.aerogear@robertwillett.com" target="_blank">rob.aerogear@robertwillett.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Matthia,<br>
<br>
Thanks for this. Are you referring to content-available flag or the<br>
setContentAvailable function?<br>
<br>
We already send silent notifications out to our Android and Apple<br>
devices and the devices handle these correctly.<br>
<br>
Our logic goes that we send a silent notification to the device via UPS,<br>
the device then connects to the server and pulls some data from the<br>
server. If our app is in the foreground, we set a tiny alert in the top<br>
left of the screen telling the user that something is ready for them, if<br>
our app is in the background we set a notification up in the drawer<br>
using a local-notification plugin, if the app is not started then the<br>
fact the app has not pulled data from the server acts as a flag and we<br>
then send down full notifications to the device. The local-notifications<br>
and the ‘full fat’ notifications all work the same way when the user<br>
clicks on them.<br>
<br>
We have all of this is working now without setContentAvailable. Its much<br>
as you outlined below. I have two phones on my desk as we speak, an<br>
Apple and an Android and we are comparing how the notifications look as<br>
we ping different data down to them in different situations. We’re<br>
down to design looks now rather than programming :)<br>
<br>
We’re just trying to work out how setContentAvailable fits into all of<br>
this, because we aren’t using it at all! Should we be?<br>
<br>
Rob<br>
<br>
On 3 Dec 2015, at 18:23, Matthias Wessendorf wrote:<br>
<br>
&gt; Hi,<br>
&gt;<br>
&gt; it&#39;s an iOS feature, that you can use for having the app download<br>
&gt; something<br>
&gt; (or check state on your backend), before the alert is being made<br>
&gt; visible to<br>
&gt; the end-user:<br>
&gt; <a href="https://developer.xamarin.com/guides/ios/application_fundamentals/backgrounding/part_3_ios_backgrounding_techniques/updating_an_application_in_the_background/#Remote_Notifications_iOS_7_and_Greater" target="_blank">https://developer.xamarin.com/guides/ios/application_fundamentals/backgrounding/part_3_ios_backgrounding_techniques/updating_an_application_in_the_background/#Remote_Notifications_iOS_7_and_Greater</a><br>
&gt;<br>
&gt;<br>
&gt; Also (more interesting, I think) you can use it to send a slient<br>
&gt; message to<br>
&gt; the device. E.g. when the app runs (fore/background) the callback is<br>
&gt; invoked. You can use that to check state on your own backend (a 30<br>
&gt; second<br>
&gt; time window, you have for this), and if needed you could use that to,<br>
&gt; for<br>
&gt; instance, issue something local e.g. local notifications (those are<br>
&gt; better<br>
&gt; and more handy for several reasons e.g. better control of the badge<br>
&gt; icon):<br>
&gt; <a href="https://developer.xamarin.com/guides/ios/application_fundamentals/backgrounding/part_3_ios_backgrounding_techniques/updating_an_application_in_the_background/#Silent_Remote_Notifications" target="_blank">https://developer.xamarin.com/guides/ios/application_fundamentals/backgrounding/part_3_ios_backgrounding_techniques/updating_an_application_in_the_background/#Silent_Remote_Notifications</a><br>
&gt;<br>
&gt; HTH,<br>
&gt; Matthias<br>
&gt;<br>
&gt;<br>
&gt; On Thu, Dec 3, 2015 at 7:01 PM, Rob Willett<br>
&gt; &lt;<a>rob.aerogear@robertwillett.com</a>&gt;<br>
&gt; wrote:<br>
&gt;<br>
&gt;&gt; Hi,<br>
&gt;&gt;<br>
&gt;&gt; We now seem to have something approaching a stable and working UPS<br>
&gt;&gt; configuration. (Famous last words!) Thanks to the Aerogear team for<br>
&gt;&gt; helping<br>
&gt;&gt; resolve the background notifications on Android.<br>
&gt;&gt;<br>
&gt;&gt; As we are tidying up, we noticed (ahem) that we had commented out a<br>
&gt;&gt; few<br>
&gt;&gt; lines in our code.<br>
&gt;&gt;<br>
&gt;&gt;  if (event[&#39;content-available&#39;])<br>
&gt;&gt;  {<br>
&gt;&gt;      // Still not clear what to do with this.<br>
&gt;&gt;      // push.setContentAvailable(1);<br>
&gt;&gt;  }<br>
&gt;&gt;<br>
&gt;&gt; We went back to the Aerogear docs and tried to work out what<br>
&gt;&gt; setContentAvailable really does and what should we do with it. The<br>
&gt;&gt; docs for<br>
&gt;&gt; the function call are a little sparse, so we looked at the source<br>
&gt;&gt; code and<br>
&gt;&gt; we’re still no wiser.<br>
&gt;&gt;<br>
&gt;&gt; Is there a better explanation of when we should call<br>
&gt;&gt; setContentAvailable<br>
&gt;&gt; and with which parameter?<br>
&gt;&gt;<br>
&gt;&gt; Just to set the ball rolling we *think* it could mean that when you<br>
&gt;&gt; receive the content-available = 1 flag on iOS, we do a call to get<br>
&gt;&gt; some<br>
&gt;&gt; data from the server ourselves, if the the results of *our* server<br>
&gt;&gt; call<br>
&gt;&gt; indicate that we have received new data, we set the value to<br>
&gt;&gt; setContentAvailable to 1, if our function call to the server has no<br>
&gt;&gt; data,<br>
&gt;&gt; then we set it to zero and if something failed we set it to 2.<br>
&gt;&gt;<br>
&gt;&gt; So what happens if the value is 0, 1 or 2? if its 2, is a new new<br>
&gt;&gt; call<br>
&gt;&gt; made to something, if its 0 or 1 what happens?<br>
&gt;&gt;<br>
&gt;&gt; Apologies if we’ve missed the point of it, but we’re struggling<br>
&gt;&gt; to<br>
&gt;&gt; understand this.<br>
&gt;&gt;<br>
&gt;&gt; Thanks,<br>
&gt;&gt;<br>
&gt;&gt; Rob.<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; Aerogear-users mailing list<br>
&gt;&gt; <a>Aerogear-users@lists.jboss.org</a><br>
&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/aerogear-users" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-users</a><br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Matthias Wessendorf<br>
&gt;<br>
&gt; blog: <a href="http://matthiaswessendorf.wordpress.com/" target="_blank">http://matthiaswessendorf.wordpress.com/</a><br>
&gt; sessions: <a href="http://www.slideshare.net/mwessendorf" target="_blank">http://www.slideshare.net/mwessendorf</a><br>
&gt; twitter: <a href="http://twitter.com/mwessendorf" target="_blank">http://twitter.com/mwessendorf</a><br>
&gt; _______________________________________________<br>
&gt; Aerogear-users mailing list<br>
&gt; <a>Aerogear-users@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/aerogear-users" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-users</a><br>
<br>
_______________________________________________<br>
Aerogear-users mailing list<br>
<a>Aerogear-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/aerogear-users" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-users</a><br>
</blockquote></div></div></div></div><span class="HOEnZb"><font color="#888888"><br><br>-- <br>Sent from Gmail Mobile<br>
</font></span><br>_______________________________________________<br>
Aerogear-users mailing list<br>
<a href="mailto:Aerogear-users@lists.jboss.org">Aerogear-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/aerogear-users" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-users</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Cheers,<div>       Erik Jan</div></div></div>
</div>