title: Push notifications not showing when app is open pushwoosh - Phonegap
body: <p>I am using Pushwoosh to send notifications in Phonegap however if i am in app the notification doesn't show up both in case of Android and iOS.</p>
  
  <p>How do i resolve this?</p>
  
  <p>I have gone through a few links but haven't been able to figure that out.</p>
  
  <pre><code>   function initPushwoosh()
  {
  
      var pushNotification = window.plugins.pushNotification;
  
      if (device.platform == "Android")
      {
  
          //set push notifications handler
          document.addEventListener('push-notification', function(event) {
              var title = event.notification.title;
              var userData = event.notification.userdata;
  
              if (typeof (userData) != "undefined") {
                  console.warn('user data: ' + JSON.stringify(userData));
              }
  
  
          });
  
          //initialize Pushwoosh with projectid: "GOOGLE_PROJECT_NUMBER", appid : "PUSHWOOSH_APP_ID". This will trigger all pending push notifications on start.
          pushNotification.onDeviceReady({projectid: "", appid: ""});
  
  
          //register for pushes
          pushNotification.registerDevice(
                  function(status) {
                      var pushToken = status;
  
                      localStorage.setItem("deviceid", pushToken);
  
                      console.warn('push token: ' + pushToken);
                  },
                  function(status) {
                      console.warn(JSON.stringify(['failed to register ', status]));
                  }
          );
  
  
  
      }
      else if (device.platform == "iOS")
      {
          //set push notification callback before we initialize the plugin
          document.addEventListener('push-notification', function(event) {
              //get the notification payload
              var notification = event.notification;
              navigator.notification.alert(notification.aps.alert);
  
  
              //clear the app badge
              pushNotification.setApplicationIconBadgeNumber(0);
          });
  
          //initialize the plugin
          pushNotification.onDeviceReady({pw_appid: ""});
  
          //register for pushes
          pushNotification.registerDevice(
                  function(status) {
                      var deviceToken = status['deviceToken'];
                      localStorage.setItem("deviceid", deviceToken);
  
  
  
  
                  },
                  function(status) {
                      console.warn('failed to register : ' + JSON.stringify(status));
  
                  }
          );
  
  
          //reset badges on app start
          pushNotification.setApplicationIconBadgeNumber(0);
      }
  }
  
  
  
  function init()
  {
  
      document.addEventListener("deviceready", initPushwoosh, true);
      // document.addEventListener("backbutton", onBackKeyDown, false);
      // Cordova is ready to be used!
  }
  </code></pre>