title: Do not receive GCM message while android device being connected to WIFI
body: <h2>Background</h2>
  
  <p>I am working on an Android app which uses Google Cloud Messaging (new GCM-API, not deprecated C2DM) for sending send-to-sync messages to all registered devices. </p>
  
  <p>Since I used the official documentation my client implementation works almost exactly the same way like Google´s example. As a server I use a simple PHP script running on localhost whose only task is to send send-to-sync messages to GCM.</p>
  
  <h2>The Issue</h2>
  
  <p>Everything works fine as long as my devices are connected to the internet through cellular networks like UMTS (server sends notfication to GCM > GCM pushes notifcation to device as soon as it is online > notification is displayed on device).</p>
  
  <p>But when the device is connected to the WIFI no GCM messages will be received anymore (although Google sends a "success"-reply to my PHP server). Due to the following <a href="https://stackoverflow.com/a/24365592/3863059">answer</a> I have already checked if my router blocks some ports but it does not.</p>
  
  <blockquote>
    <p>I had same problem of receiving push messages, even though GCM server replies "Success", because of wifi privacy. When I used my company wifi, I coudn't receive message in mobile, since they were blocked GCM server port.</p>
  </blockquote>
  
  <p>Interestingly enough my implementation already has been working with WIFI...  </p>
  
  <p><em><strong>Google´s reply when sending GCM message from PHP:</strong></em></p>
  
  <pre><code>{
      "multicast_id":4677038582377051331,
      "success":1,
      "failure":0,
      "canonical_ids":0,
      "results":[{"message_id":"0:1406364179145476%6ce83c64d7d6c7e2"}]
  }
  </code></pre>
  
  <p><br/></p>
  
  <h2>Very crazy finding:</h2>
  
  <p>The issue solved itself when I called the PHP script which sends my GCM messages from the smartphone and since that everything works fine.</p>
  
  <h2>HINT</h2>
  
  <p>Meanwhile this "new" GCM-API is deprecated either!
  I am using the <a href="https://developers.google.com/cloud-messaging/" rel="nofollow noreferrer">latest GCM-API</a> (published in summer 2015) now. Since upgrading I have never faced this issue again. The new API, including <a href="https://developers.google.com/instance-id/" rel="nofollow noreferrer">InstanceId-API</a> is very recommendable from my point of view, as far as I see it is a more stable than old GCM.</p>