title: How to get android native push notification on cordova?
body: <p>The event on application is being triggered when the server send the notification, but I get only the alert with the message on app, not the native notification.</p>
  
  <p>I am using ionic framework with the $cordovaPush plugin. On the server side I am using PushSharp library to call GCM.</p>
  
  <p>This is the code added to app.js on $ionicPlatform.ready</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code> var androidConfig = {
              badge: true,
              sound: true,
              alert: true,
              "senderID": "10xxxxxxxxxx"
          };
  
  $cordovaPush.register(androidConfig).then(function (result) {
    // Success
  }, function (err) {
    // Error
  })
  
  $rootScope.$on('$cordovaPush:notificationReceived', function (event, notification) {
    alert('$cordovaPush:notificationReceived');
    switch (notification.event) {
      case 'registered':
        if (notification.regid.length &gt; 0) {
          alert('registration ID = ' + notification.regid);
        }
        break;
  
      case 'message':
        // this is the actual push notification. its format depends on the data model from the push server
        alert(JSON.stringify(notification));
        break;
  
      case 'error':
        alert('GCM error = ' + notification.msg);
        break;
  
      default:
        alert('An unknown GCM event has occurred');
        break;
    }
  }, false);</code></pre>
  </div>
  </div>
  </p>
  
  <p>This is the code from the server (C# + PushSharp lib)</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var push = new PushBroker();
  //Wire up the events for all the services that the broker registers
  push.OnNotificationSent += NotificationSent;
  push.OnChannelException += ChannelException;
  push.OnServiceException += ServiceException;
  push.OnNotificationFailed += NotificationFailed;
  push.OnDeviceSubscriptionExpired += DeviceSubscriptionExpired;
  push.OnDeviceSubscriptionChanged += DeviceSubscriptionChanged;
  push.OnChannelCreated += ChannelCreated;
  push.OnChannelDestroyed += ChannelDestroyed;
  
  push.RegisterGcmService(new
                          GcmPushChannelSettings("AIxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"));
  
  push.QueueNotification(new GcmNotification().ForDeviceRegistrationId(
    "APAxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
                         .WithJson("{\"alert\":\"Hello World!\",\"badge\":7,\"sound\":\"sound.caf\"}"));</code></pre>
  </div>
  </div>
  </p>