title: GCM push notifications not working if the app is closed in some devices
body: <p>I've followed Google's GCM <a href="https://developers.google.com/cloud-messaging/android/client">setup guide</a> and their <a href="https://github.com/googlesamples/google-services/tree/master/android/gcm/app/src/main/java/gcm/play/android/samples/com/gcmquickstart">example on Github</a> to create an app that receives notifications.</p>
  
  <p>When does it work:</p>
  
  <ul>
  <li>App opened (all devices)</li>
  <li>App in background (all devices)</li>
  <li>App closed (all except one)</li>
  </ul>
  
  <p>The phone that is not working:</p>
  
  <ul>
  <li>Huawei P8 lite</li>
  <li>Android 5.1</li>
  <li>Google Play Services 8.3.01</li>
  </ul>
  
  <p>This phone works fine, it can receive WhatsApp messages or any other kind even if the user kills the app.</p>
  
  <p>I am afraid this could happen in many other devices I haven't test. So I want to show off some code in order to see if there are any problems.</p>
  
  <p>Here my <code>AndroidManifest.xml</code>:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.presentation" &gt;
  
      &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
      &lt;!-- Keeps the processor from sleeping when a message is received. --&gt;
      &lt;uses-permission android:name="android.permission.WAKE_LOCK" /&gt;
      &lt;!-- This app has permission to register and receive data message. --&gt;
      &lt;uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /&gt;
  
      &lt;permission
          android:name="com.example.presentation.permission.C2D_MESSAGE"
          android:protectionLevel="signature" /&gt;
      &lt;uses-permission android:name="com.example.presentation.permission.C2D_MESSAGE" /&gt;
  
      &lt;application
          android:name=".AndroidApplication"
          android:allowBackup="true"
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/AppTheme" &gt;
  
          &lt;receiver
              android:name="com.google.android.gms.gcm.GcmReceiver"
              android:exported="true"
              android:permission="com.google.android.c2dm.permission.SEND" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="com.google.android.c2dm.intent.RECEIVE" /&gt;
                  &lt;category android:name="com.example.presentation" /&gt;
                  &lt;!-- If you want to support pre-4.4 KitKat devices. --&gt;
                  &lt;action android:name="com.google.android.c2dm.intent.REGISTRATION" /&gt;
              &lt;/intent-filter&gt;
          &lt;/receiver&gt;
          &lt;service android:name="com.example.data.gcm.RegistrationIntentService"
              android:exported="false" /&gt;
          &lt;service
              android:name="com.example.data.gcm.MyGcmListenerService"
              android:exported="false" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="com.google.android.c2dm.intent.RECEIVE" /&gt;
              &lt;/intent-filter&gt;
          &lt;/service&gt;
          &lt;service
              android:name="com.example.data.gcm.MyInstanceIDListenerService"
              android:exported="false"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="com.google.android.gms.iid.InstanceID"/&gt;
              &lt;/intent-filter&gt;
          &lt;/service&gt;
  
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>Added this dependency in the project-level <code>build.gradle</code>:</p>
  
  <pre><code>buildscript {
    repositories {
      jcenter()
    }
    dependencies {
      classpath 'com.android.tools.build:gradle:1.3.0'
      classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
      classpath 'com.google.gms:google-services:1.4.0-beta3'
    }
  }
  </code></pre>
  
  <p>Added this dependency in the app-level <code>build.gradle</code>:</p>
  
  <pre><code>compile "com.google.android.gms:play-services-gcm:8.1.0"
  </code></pre>
  
  <p>And the Java classes are the same of the <a href="https://github.com/googlesamples/google-services/tree/master/android/gcm/app/src/main/java/gcm/play/android/samples/com/gcmquickstart">Github example</a>.</p>
  
  <p>Why is this device not working when the user closes the app but it works in all other devices I have tested?</p>