title: Adobe PhoneGap Build (iOS) and PushWoosh
body: <p>According to the docs at PushWhoosh:</p>
  
  <p><a href="http://www.pushwoosh.com/programming-push-notification/phonegap-build-push-plugin-integration/" rel="nofollow">http://www.pushwoosh.com/programming-push-notification/phonegap-build-push-plugin-integration/</a></p>
  
  <p>I should be able to use Adobe's Build cloud service to build PhoneGap apps. I've followed the instructions in the docs, but can't get my app to register with the PushWhoosh service (i.e.: it's not sending a device token).</p>
  
  <p>I think the issue has to do with the registration of the plugin in <code>config.xml</code>. According to the Adobe Build docs, the only push plugin supported is their "GenericPush", which I've added to my <code>config.xml</code> file like so:</p>
  
  <p> </p>
  
  <p>I've also whitelisted the pushwhoosh.com domain.</p>
  
  <p>In my index.html file, I have the function initPushwhoosh, which gets called when the device is ready:</p>
  
  <pre><code>function initPushwoosh() {
          try {
              var pushNotification;
              pushNotification = window.plugins.pushNotification;
  
              if (device.platform == 'android' || device.platform == 'Android') {
                  pushNotification.register(successHandler, errorHandler, { "senderID": "replace_with_sender_id", "ecb": "onNotificationGCM" });
              }
              else {
                  pushNotification.register(tokenHandler, errorHandler, { "badge": "true", "sound": "true", "alert": "true", "ecb": "onNotificationAPN" });
              }
          }
          catch (err) {
              alert(err.message + "\n\n" + err.name);
          }
  
      }
  </code></pre>
  
  <p>And my tokenHandler function (I'm building for iOS) looks like:</p>
  
  <pre><code>function tokenHandler(result) {
          // Your iOS push server needs to know the token before it can push to this device
          // here is where you might want to send it the token for later use.
          PushWoosh.appCode = "E0313-D27FA";
          PushWoosh.register(result, function (data) {
              alert("PushWoosh register success: " + JSON.stringify(data));
          }, function (errorregistration) {
              alert("Couldn't register with PushWoosh" + errorregistration);
          });
      }
  </code></pre>
  
  <p>Through debugging, it looks like the "pushNotification.register" function never gets called, and the try/catch statement doesn't display any error messages. That function is:</p>
  
  <pre><code>// Call this to register for push notifications. Content of [options] depends on whether we are working with APNS (iOS) or GCM (Android)
  PushNotification.prototype.register = function (successCallback, errorCallback, options) {
  alert("about to register");
  if (errorCallback == null) { errorCallback = function () { } }
  
  if (typeof errorCallback != "function") {
      alert("PushNotification.register failure: failure parameter not a function");
      return;
  }
  
  if (typeof successCallback != "function") {
      alert("PushNotification.register failure: success callback parameter must be a function");
      return;
  }
  
  cordova.exec(successCallback, errorCallback, "GenericPush", "register", [options]);
  </code></pre>
  
  <p>};</p>
  
  <p>My thinking is that it has to do with the plugin declaration (<code>&lt;gap:plugin name="GenericPush" /&gt;</code>) in <code>config.xml</code>; I've tried changing it to (based on some other sample code I found):</p>
  
  <pre><code>&lt;gap:plugin name="PushPlugin"/&gt;
  </code></pre>
  
  <p>But that didn't work either. Note: when I did this, I tried changing:</p>
  
  <pre><code>cordova.exec(successCallback, errorCallback, "GenericPush", "register", [options]);
  </code></pre>
  
  <p>to</p>
  
  <pre><code>cordova.exec(successCallback, errorCallback, "PushPlugin", "register", [options]);
  </code></pre>
  
  <p>The complete code can be found here:</p>
  
  <p><a href="https://github.com/appburnr/PushWhooshTest" rel="nofollow">https://github.com/appburnr/PushWhooshTest</a></p>
  
  <p>I've tripled-checked the my PushWhoosh AppID is correct, but I can never get the app to appear as registered device in my PushWhoosh control panel.</p>
  
  <p>Any ideas?</p>