title: Push notifications using Google Firebase with Phonegap
body: <p>I am trying to make a simple test app for testing push notifications.</p>
  
  <p>I have installed the plugin "phonegap-plugin-push" (<a href="https://github.com/phonegap/phonegap-plugin-push" rel="nofollow noreferrer">https://github.com/phonegap/phonegap-plugin-push</a>), and followed all the installation instructions.</p>
  
  <p>I receive an registration id ondeviceready, and when I use the php script to send a notification to that id it returns a success response from the google api, however no notification is appearing on the mobile device.</p>
  
  <p>Any suggestions on what could be wrong?</p>
  
  <p><strong>index.html</strong></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;Push demo&lt;/title&gt;
      &lt;script type="text/javascript" src="cordova.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;
          document.addEventListener("deviceready", onDeviceReady, false);
  
          function onDeviceReady() {
              var push = PushNotification.init({ "android": {"senderID": "my sender id"}});
              push.on('registration', function(data) {
                  console.log(data.registrationId);
              });
  
              push.on('notification', function(data) {
                  console.log(data.title + " Message: " + data.message);
              });
  
              push.on('error', function(e) {
                  console.log(e);
              });
          }
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;h1&gt;Push Notification Example&lt;/h1&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>pushTest.php</strong></p>
  
  <pre><code>&lt;?php
  
  define('API_ACCESS_KEY', 'secret key here');
  
  $registrationIds = array(
      'long device id here'
  );
  
  $msg = array(
      'message' =&gt; 'Test msg',
      'title' =&gt; 'Test title',
      'subtitle' =&gt; 'Test subtitle',
      'vibrate' =&gt; 1,
      'sound' =&gt; 1
  );
  
  $fields = array(
      'registration_ids' =&gt; $registrationIds,
      'data' =&gt; $msg
  );
  
  $headers = array(
      'Authorization: key=' . API_ACCESS_KEY,
      'Content-Type:application/json'
  );
  
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, 'https://android.googleapis.com/gcm/send');
  curl_setopt($ch, CURLOPT_POST, true);
  curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
  
  $result = curl_exec($ch);
  curl_close($ch);
  
  echo $result;
  
  ?&gt;
  </code></pre>
  
  <p><strong>PHP response</strong></p>
  
  <pre><code>{"multicast_id":xxxxxx,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"0:xxxxxxxxxx"}]}
  </code></pre>