title: Cordova PushNotification issue
body: <p>I'm trying to implement some notification on y cordova based project using AngularJS as FO.</p>
  
  <p>What i did : </p>
  
  <p>0/ register an id on GCM</p>
  
  <p>1/ installed the plugin <a href="https://github.com/phonegap-build/PushPlugin.git" rel="nofollow">https://github.com/phonegap-build/PushPlugin.git</a></p>
  
  <p>2/ included last version of cordova.js in my index.html</p>
  
  <p>code : </p>
  
  <pre><code>&lt;html ng-app="baclyApp"&gt;
      &lt;head&gt;
  &lt;meta name="format-detection" content="telephone=no"&gt;
          &lt;meta name="msapplication-tap-highlight" content="no"&gt;
          &lt;meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width"&gt;
          &lt;link rel="stylesheet" type="text/css" href="css/bootstrap.css"&gt;
          &lt;link rel="stylesheet" type="text/css" href="css/style.css"&gt;
          &lt;link rel="stylesheet" type="text/css" href="css/angular-growl.min.css"&gt;
  
          &lt;title&gt;Bacly Mobile&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
             &lt;div class="navbar navbar-default navbar-fixed-top" role="navigation" id='nav1' ng-controller="navCtrl"&gt;
                 &lt;div class="container-fluid"&gt;
                       &lt;div class=""&gt;
                          &lt;ul class="nav navbar-nav navbar-left"&gt;
                              &lt;li&gt;
                                  &lt;a class="navbar-brand" ui-sref="home"&gt;
                                      Bacly Mobile
                                  &lt;/a&gt;
                              &lt;/li&gt;
                          &lt;/ul&gt;
                       &lt;/div&gt;   
                       &lt;div class="collapse navbar-collapse"&gt;
                            &lt;ul class="nav navbar-nav navbar-right"&gt;
                              &lt;li&gt;&lt;a ng-click="init1()"&gt;&lt;span class="glyphicon glyphicon-refresh"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
                              &lt;li&gt;&lt;a ui-sref="login"&gt;&lt;span class="glyphicon glyphicon-user"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
  
                            &lt;/ul&gt;
                      &lt;/div&gt;&lt;!-- /.navbar-collapse --&gt;
                  &lt;/div&gt;        
              &lt;/div&gt;
              &lt;div class="navbar navbar-default navbar-static-top"&gt;
                  &lt;div class='container'&gt;
                    &lt;ul class="nav nav-justified"&gt;
                          &lt;li&gt;&lt;a ui-sref="home"&gt;&lt;span class="glyphicon glyphicon-home"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a ui-sref="tournois"&gt;&lt;span class="glyphicon glyphicon-calendar"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a ui-sref="defi"&gt;&lt;span class="glyphicon glyphicon-sort"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a ui-sref="pointage"&gt;&lt;span class="glyphicon glyphicon-pencil"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
  
                      &lt;/ul&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;div class='container-fluid' id="maincontainer"&gt;
              &lt;div class"col-xs-12 col-sd-12 col-md-12 col-ld-12 container" ui-view="main"&gt;   
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div growl&gt;&lt;/div&gt;
          &lt;div id="deviceready" class="blink"&gt;
              &lt;p class="event listening"&gt;Connecting to Device&lt;/p&gt;
              &lt;p class="event received"&gt;Device is Ready&lt;/p&gt;
          &lt;/div&gt;        
          &lt;script src="js/angular.js"&gt;&lt;/script&gt;
          &lt;script src="js/underscore.js"&gt;&lt;/script&gt;
          &lt;script src="js/angular-ui-bootstrap-test.js"&gt;&lt;/script&gt;
          &lt;script src="js/angular-ui-router.js"&gt;&lt;/script&gt;
          &lt;script src="js/angular-cookies.js"&gt;&lt;/script&gt;
          &lt;script src="js/angular-growl.min.js"&gt;&lt;/script&gt;
          &lt;script src="js/filters.js"&gt;&lt;/script&gt;   
          &lt;script src="js/xml2json.js"&gt;&lt;/script&gt;
          &lt;script src="js/utf8_encode.js"&gt;&lt;/script&gt;
          &lt;script src="js/moment.js"&gt;&lt;/script&gt;
          &lt;script src="js/cordova.js"&gt;&lt;/script&gt;
          &lt;script src="js/baclym.js"&gt;&lt;/script&gt;
  
  
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>3/ in my main script at the top, i implement an event listener for device ready.</p>
  
  <p>Code (beginning of baclym.js): </p>
  
  <pre><code>document.addEventListener("deviceready", function() {
  
  
      var pushNotification = window.plugins.pushNotification;
          console.log(pushNotification);
          pushNotification.register(successHandler, errorHandler,{"senderID":"59581338115","ecb":"app.onNotificationGCM"});
  
      function successHandler (result) {
              alert('Callback Success! Result = '+result)}
  
      function errorHandler (error) {
              alert(error);
          }
      function onNotificationGCM (e) {
                    switch( e.event )
                    {
                        case 'registered':
                            if ( e.regid.length &gt; 0 )
                            {
                                console.log("Regid " + e.regid);
                                alert('registration id = '+e.regid);
                            }
                        break;
  
                        case 'message':
                          // this is the actual push notification. its format depends on the data model from the push server
                          alert('message = '+e.message+' msgcnt = '+e.msgcnt);
                        break;
  
                        case 'error':
                          alert('GCM error = '+e.msg);
                        break;
  
                        default:
                          alert('An unknown GCM event has occurred');
                          break;
                    }
                }
  
  
  }, false);
  </code></pre>
  
  <p>4/ I run it on my device (s4 mini, android 4.4.2)</p>
  
  <p>use chrome inspect devices to debug it : </p>
  
  <p>i dont get any alert message nor console messages</p>
  
  <p>I eventually got an error message in cordova.js but i guess this is not linked </p>
  
  <p>Uncaught ReferenceError: require is not defined cordova.js:29</p>
  
  <p>I should get at least a console.log about getting into document.addEventListener, but nothing.</p>
  
  <p>Thx for your advice.</p>