Sent from my iPhone

On Jul 13, 2013, at 10:54 AM, Matthias Wessendorf <matzew@apache.org> wrote:

Hi,

today I played with Apache Cordova, the PushPlugin, AeroGear.js (Notifier branch) and our UnifiedPush Server.

Setup

These steps from the iOS Tutorial are required for an iOS-Cordova app as well:

  • Apple App ID and SSL Certificate for APNs
  • Apple Provisioning Profile
  • The AeroGear Unified Push Server

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 PushApplication and an iOS Variant :-)

Cordova stuff

PushPlugin

Get the Cordova PushPlugin (there is a downloadable tarball) and extract the tarball to some location.

Cordova App

Creating a Corodva app is simple:

cordova create FolderOfTheApp com.my.id.AppName AppName
cd FolderOfTheApp
cordova platform add ios
cordova plugin add folder_of_PushPlugin-1.3.3

HINT: Make sure your Apple ID matches the above "com.my.id.AppName" value...

  • Install aerogear.js (checkout (and build) the Notifier branch) and jquery.min.js -> I basically copied the files into the "www" folder;

afterwards build the project:

cordova build

Now open the generated Xcode project, and start "hacking".

This all works well. However, I had to do some "hack" to be able to use the registerWithPushServer()function:

var tokenContainer = {};
tokenContainer.channelID = deviceToken;

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.

Also, the "metadata" currently is only able to specify the following values:

  • deviceToken
  • alias
  • category

I am sure we can make it more generic here as well.

So again, without too much work, I got it working:https://twitter.com/mwessendorf/status/356027736780836865

However I had some issues.

PushPlugin:

I had to copy the ObjC bits by hand. See here.



Interesting.  I thought i was able to get it to work with the keynote. I'll have to try again. 


Awesome job btw
AeroGear.js
  • Uncaught TypeError: Cannot read property 'simplePushServerURL' of undefined aerogear.js:955 (anonymous function) aerogear.js:955 (anonymous function)

    • at least in the browser.... However, I could remove it, on the Corodva app .... and the app still seams to work.... So, not sure :-)
  • looks like the Notifier branch requires sockjs Uncaught ReferenceError: SockJS is not defined aerogear.js:942 (anonymous function)

    • But again in the browser...., I could remove that "import" in my Cordova app. So, not sure here too :-)


We fixed this in 1.1.2. Notifier branch probably needs the update still 

The (ugly) code is posted on my GH account.

I guess we could convert this into a more "official" guide/tutorial at some point. This email should give some hints on getting started.

Another question:

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.


I might have some thoughts on this put ill wait until I'm at my computer.  


Feedback welcome!


--
Matthias Wessendorf

blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf
_______________________________________________
aerogear-dev mailing list
aerogear-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/aerogear-dev