<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jul 15, 2013, at 11:20 AM, Matthias Wessendorf &lt;<a href="mailto:matzew@apache.org">matzew@apache.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jul 15, 2013 at 5:11 PM, Lucas Holmquist <span dir="ltr">&lt;<a href="mailto:lholmqui@redhat.com" target="_blank">lholmqui@redhat.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><div class="im"><div>On Jul 13, 2013, at 10:54 AM, Matthias Wessendorf &lt;<a href="mailto:matzew@apache.org" target="_blank">matzew@apache.org</a>&gt; wrote:</div>
<br></div><div><div class="h5"><blockquote type="cite"><div dir="ltr"><p style="margin-right:0px;margin-bottom:15px;margin-left:0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:15.454545021057129px;line-height:22.727272033691406px;margin-top:0px!important">

Hi,</p><p style="margin:15px 0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:15.454545021057129px;line-height:22.727272033691406px">today I played with Apache Cordova, the&nbsp;<a href="https://github.com/phonegap-build/PushPlugin/tree/1.3.3" style="color:rgb(65,131,196);text-decoration:none" target="_blank">PushPlugin</a>, AeroGear.js (Notifier branch) and our UnifiedPush Server.</p>

<h3 style="margin:1em 0px 15px;padding:0px;font-size:1.5em;font-family:Helvetica,arial,freesans,clean,sans-serif"><a name="13fe2e376c5a634d_setup" href="https://gist.github.com/matzew/1513378b4efb700da46f#setup" style="color:rgb(65,131,196);text-decoration:none;display:block;padding-left:30px" target="_blank"><span></span></a>Setup</h3><p style="margin:15px 0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:15.454545021057129px;line-height:22.727272033691406px">These steps from the&nbsp;<a href="http://aerogear.org/docs/guides/aerogear-push-ios/" style="color:rgb(65,131,196);text-decoration:none" target="_blank">iOS Tutorial</a>&nbsp;are required for an iOS-Cordova app as well:</p>

<ul style="margin:15px 0px;padding:0px 0px 0px 30px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:15.454545021057129px;line-height:22.727272033691406px"><li>Apple App ID and SSL Certificate for APNs</li>

<li>Apple Provisioning Profile</li><li>The AeroGear Unified Push Server</li></ul><p style="margin:15px 0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:15.454545021057129px;line-height:22.727272033691406px">

TL;DR: You need a new App-ID, a SSL-cert and a provisioning profile (for that APP-ID). On the UnifiedPush Server, you need a&nbsp;<code style="font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:normal;margin:0px 2px;padding:0px 5px;border:1px solid rgb(221,221,221);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;white-space:nowrap">PushApplication</code>&nbsp;and an&nbsp;<code style="font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:normal;margin:0px 2px;padding:0px 5px;border:1px solid rgb(221,221,221);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;white-space:nowrap">iOS Variant</code>&nbsp;:-)</p>

<h3 style="margin:1em 0px 15px;padding:0px;font-size:1.5em;font-family:Helvetica,arial,freesans,clean,sans-serif"><a name="13fe2e376c5a634d_cordova-stuff" href="https://gist.github.com/matzew/1513378b4efb700da46f#cordova-stuff" style="color:rgb(65,131,196);text-decoration:none;display:block;padding-left:30px" target="_blank"><span></span></a>Cordova stuff</h3>

<h4 style="margin:1em 0px 15px;padding:0px;font-size:1.2em;font-family:Helvetica,arial,freesans,clean,sans-serif"><a name="13fe2e376c5a634d_pushplugin" href="https://gist.github.com/matzew/1513378b4efb700da46f#pushplugin" style="color:rgb(65,131,196);text-decoration:none;display:block;padding-left:30px" target="_blank"><span></span></a>PushPlugin</h4><p style="margin:15px 0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:15.454545021057129px;line-height:22.727272033691406px">Get the Cordova&nbsp;<a href="https://github.com/phonegap-build/PushPlugin/tree/1.3.3" style="color:rgb(65,131,196);text-decoration:none" target="_blank">PushPlugin</a>&nbsp;(there is a downloadable tarball) and extract the tarball to some location.</p>

<h4 style="margin:1em 0px 15px;padding:0px;font-size:1.2em;font-family:Helvetica,arial,freesans,clean,sans-serif"><a name="13fe2e376c5a634d_cordova-app" href="https://gist.github.com/matzew/1513378b4efb700da46f#cordova-app" style="color:rgb(65,131,196);text-decoration:none;display:block;padding-left:30px" target="_blank"><span></span></a>Cordova App</h4><p style="margin:15px 0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:15.454545021057129px;line-height:22.727272033691406px">Creating a Corodva app is simple:</p><pre style="font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:13px;line-height:19px;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(221,221,221);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px"><code style="font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:normal;margin:0px;padding:0px;border:none;background-color:transparent;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">cordova create FolderOfTheApp com.my.id.AppName AppName
cd FolderOfTheApp
cordova platform add ios
cordova plugin add folder_of_PushPlugin-1.3.3
</code></pre><p style="margin:15px 0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:15.454545021057129px;line-height:22.727272033691406px"><strong>HINT:</strong>&nbsp;Make sure your Apple ID matches the above "com.my.id.AppName" value...</p>

<ul style="margin:15px 0px;padding:0px 0px 0px 30px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:15.454545021057129px;line-height:22.727272033691406px"><li>Install&nbsp;<code style="font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:normal;margin:0px 2px;padding:0px 5px;border:1px solid rgb(221,221,221);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;white-space:nowrap">aerogear.js</code>&nbsp;(checkout (and build) the Notifier branch) and&nbsp;<code style="font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:normal;margin:0px 2px;padding:0px 5px;border:1px solid rgb(221,221,221);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;white-space:nowrap">jquery.min.js</code>&nbsp;-&gt; I basically copied the files into the "www" folder;</li>

</ul><p style="margin:15px 0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:15.454545021057129px;line-height:22.727272033691406px">afterwards build the project:</p><pre style="font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:13px;line-height:19px;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(221,221,221);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px"><code style="font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:normal;margin:0px;padding:0px;border:none;background-color:transparent;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">cordova build
</code></pre><p style="margin:15px 0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:15.454545021057129px;line-height:22.727272033691406px">Now open the generated Xcode project, and start "hacking".</p>

<ul style="margin:15px 0px;padding:0px 0px 0px 30px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:15.454545021057129px;line-height:22.727272033691406px"><li>In the&nbsp;<a href="https://github.com/matzew/UPCordovaPlayings/blob/master/CordovaTest/platforms/ios/www/index.html" style="color:rgb(65,131,196);text-decoration:none" target="_blank"><code style="font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:normal;margin:0px 2px;padding:0px 5px;border:1px solid rgb(221,221,221);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;white-space:nowrap">index.html</code></a>&nbsp;I just linked the "required" JavaScript sources.</li>

<li>The&nbsp;<a href="https://github.com/matzew/UPCordovaPlayings/blob/master/CordovaTest/platforms/ios/www/js/index.js" style="color:rgb(65,131,196);text-decoration:none" target="_blank"><code style="font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:normal;margin:0px 2px;padding:0px 5px;border:1px solid rgb(221,221,221);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;white-space:nowrap">index.JS</code></a>&nbsp;contains some JavaScript, that takes care of:<ul style="margin:0px;padding:0px 0px 0px 30px">

<li><a href="https://github.com/matzew/UPCordovaPlayings/blob/master/CordovaTest/platforms/ios/www/js/index.js#L16" style="color:rgb(65,131,196);text-decoration:none" target="_blank">Trigger the PushPlugin/UnifiedPush setup</a></li>
<li><a href="https://github.com/matzew/UPCordovaPlayings/blob/master/CordovaTest/platforms/ios/www/js/index.js#L53-L61" style="color:rgb(65,131,196);text-decoration:none" target="_blank">Setup of the Cordova PushPlugin</a></li>

<li><a href="https://github.com/matzew/UPCordovaPlayings/blob/master/CordovaTest/platforms/ios/www/js/index.js#L27-L48" style="color:rgb(65,131,196);text-decoration:none" target="_blank">The received (APNs) device-token is "submitted" to the UnifiedPush Server (using AeroGear.js)</a></li>

<li><a href="https://github.com/matzew/UPCordovaPlayings/blob/master/CordovaTest/platforms/ios/www/js/index.js#L2-L4" style="color:rgb(65,131,196);text-decoration:none" target="_blank">Handling iOS/APNs notifications</a></li>
</ul></li></ul><p style="margin:15px 0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:15.454545021057129px;line-height:22.727272033691406px">This all works well. However, I had to do some "hack" to be able to use the&nbsp;<code style="font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:normal;margin:0px 2px;padding:0px 5px;border:1px solid rgb(221,221,221);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;white-space:nowrap">registerWithPushServer()</code>function:</p>

<pre style="font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:13px;line-height:19px;margin-top:15px;margin-bottom:15px;background-color:rgb(248,248,248);border:1px solid rgb(221,221,221);overflow:auto;padding:6px 10px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px"><code style="font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:normal;margin:0px;padding:0px;border:none;background-color:transparent;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">var tokenContainer = {};
tokenContainer.channelID = deviceToken;
</code></pre><p style="margin:15px 0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:15.454545021057129px;line-height:22.727272033691406px">That is because the JS does expect the token/channelID as the above ".channelID". I am sure that can be made a bit more flexible.</p><p style="margin:15px 0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:15.454545021057129px;line-height:22.727272033691406px">Also, the "metadata" currently is only able to specify the following values:</p>

<ul style="margin:15px 0px;padding:0px 0px 0px 30px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:15.454545021057129px;line-height:22.727272033691406px"><li>deviceToken</li><li>alias</li>
<li>category</li></ul><p style="margin:15px 0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:15.454545021057129px;line-height:22.727272033691406px">I am sure we can make it more generic here as well.</p><p style="margin:15px 0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:15.454545021057129px;line-height:22.727272033691406px">So again, without too much work, I got it working:<a href="https://twitter.com/mwessendorf/status/356027736780836865" style="color:rgb(65,131,196);text-decoration:none" target="_blank">https://twitter.com/mwessendorf/status/356027736780836865</a></p><p style="margin:15px 0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:15.454545021057129px;line-height:22.727272033691406px">However I had some issues.</p><h5 style="margin:1em 0px 15px;padding:0px;font-size:1em;font-family:Helvetica,arial,freesans,clean,sans-serif;line-height:22.727272033691406px">

<a name="13fe2e376c5a634d_pushplugin-1" href="https://gist.github.com/matzew/1513378b4efb700da46f#pushplugin-1" style="color:rgb(65,131,196);text-decoration:none;display:block;padding-left:30px" target="_blank"><span></span></a>PushPlugin:</h5><p style="margin:15px 0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:15.454545021057129px;line-height:22.727272033691406px">I had to copy the ObjC bits by hand. See&nbsp;<a href="https://github.com/phonegap-build/PushPlugin/issues/34" style="color:rgb(65,131,196);text-decoration:none" target="_blank">here</a>.</p>

<h5 style="margin:1em 0px 15px;padding:0px;font-size:1em;font-family:Helvetica,arial,freesans,clean,sans-serif;line-height:22.727272033691406px"><a name="13fe2e376c5a634d_aerogearjs" href="https://gist.github.com/matzew/1513378b4efb700da46f#aerogearjs" style="color:rgb(65,131,196);text-decoration:none;display:block;padding-left:30px" target="_blank"><span></span></a>AeroGear.js</h5>

<ul style="margin:15px 0px;padding:0px 0px 0px 30px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:15.454545021057129px;line-height:22.727272033691406px"><li><p style="margin:15px 0px">Uncaught TypeError: Cannot read property 'simplePushServerURL' of undefined aerogear.js:955 (anonymous function) aerogear.js:955 (anonymous function)</p>

<ul style="margin:0px;padding:0px 0px 0px 30px"><li>at least in the browser.... However, I could remove it, on the Corodva app .... and the app still seams to work.... So, not sure :-)</li></ul></li><li><p style="margin:15px 0px">

looks like the Notifier branch requires sockjs Uncaught ReferenceError: SockJS is not defined aerogear.js:942 (anonymous function)</p><ul style="margin:0px;padding:0px 0px 0px 30px"><li>But again in the browser...., I could remove that "import" in my Cordova app. So, not sure here too :-)</li>

</ul></li></ul><p style="margin:15px 0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:15.454545021057129px;line-height:22.727272033691406px">The (ugly) code is posted on my&nbsp;<a href="https://github.com/matzew/UPCordovaPlayings" style="color:rgb(65,131,196);text-decoration:none" target="_blank">GH account</a>.</p><p style="margin:15px 0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:15.454545021057129px;line-height:22.727272033691406px">I guess we could convert this into a more "official" guide/tutorial at some point. This email should give some hints on getting started.</p><p style="margin:15px 0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:15.454545021057129px;line-height:22.727272033691406px">Another question:</p><p style="margin:15px 0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:15.454545021057129px;line-height:22.727272033691406px">

Perhaps we want to fork the PushPlugin and stick our AeroGear.js bits in there? So that all is ready ? I am not sure, just some idea.</p><div><br></div></div></blockquote></div></div>So This plugin is actually part of phone gap build, &nbsp;Which means people can get it easy. &nbsp;but at the same time, &nbsp;these types of plugins aren't as fast to upgrade</div>
<div><br></div><div>They include an example ruby "push server" in the example code. &nbsp;</div></div></blockquote><div><br></div><div>Ah :-) So, if there are other plugins, let me know :) I just picked that one for my tests</div></div></div></div></blockquote><div><br></div><div>i've only used that one and thats because you told me about it &nbsp;;)</div><br><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">
<div><br></div><div><br></div><div>&nbsp;</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><br></div><div><br></div><div>I'm not sure how others feel about it, &nbsp;but i can be convinced of forking a copy, &nbsp;and then adding in our stuff, &nbsp;as well as adding a "FFOS" version that we could maybe contribute back upstream. &nbsp;</div>
</div></blockquote><div><br></div><div><br></div><div>I am also fine with (for now) just having "instructions", that should pretty much do the trick - at least I was also able to use it that way. (Android try-out will follow "soon")</div>
<div>&nbsp;</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><br></div><div>In one of the Phone Gap Day workshops, they are going to be talking about push notifications. so i'll report back.</div>
</div></blockquote><div><br></div><div>sweet! I am happy to hear more on what you've learned / heard there.</div><div><br></div><div>Thanks for the feedback, Luke!</div><div><br></div><div>-M</div><div>&nbsp;</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div><br><blockquote type="cite"><div class="im"><div dir="ltr"><p style="margin:15px 0px;font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:15.454545021057129px;line-height:22.727272033691406px">

Feedback welcome!</p><div><br></div>-- <br>Matthias Wessendorf <br><br>blog: <a href="http://matthiaswessendorf.wordpress.com/" target="_blank">http://matthiaswessendorf.wordpress.com/</a><br>sessions: <a href="http://www.slideshare.net/mwessendorf" target="_blank">http://www.slideshare.net/mwessendorf</a><br>

twitter: <a href="http://twitter.com/mwessendorf" target="_blank">http://twitter.com/mwessendorf</a>
</div></div><div class="im">
_______________________________________________<br>aerogear-dev mailing list<br><a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">aerogear-dev@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a></div>
</blockquote></div><br></div><br>_______________________________________________<br>
aerogear-dev mailing list<br>
<a href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Matthias Wessendorf <br>
<br>blog: <a href="http://matthiaswessendorf.wordpress.com/" target="_blank">http://matthiaswessendorf.wordpress.com/</a><br>sessions: <a href="http://www.slideshare.net/mwessendorf" target="_blank">http://www.slideshare.net/mwessendorf</a><br>
twitter: <a href="http://twitter.com/mwessendorf" target="_blank">http://twitter.com/mwessendorf</a>
</div></div>
_______________________________________________<br>aerogear-dev mailing list<br><a href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a><br>https://lists.jboss.org/mailman/listinfo/aerogear-dev</blockquote></div><br></body></html>