title: GCM 8.3 - crash resulting from starting a GcmListenerService on ACTION_BOOT_COMPLETED
body: <p>I've inherited some code that invoked a GcmListenerService on ACTION_BOOT_COMPLETED:</p>
  
  <pre><code>    if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
          context.startService(new Intent(context, NotificationListenerService.class));
      }
  </code></pre>
  
  <p>The purpose of this code was to make sure the GCM listener is initiated when the device boots up.</p>
  
  <p>It has caused the crash described in <a href="https://stackoverflow.com/questions/33692070/gcm-update-7-5-to-8-3-0-fatal-exception">GCM update 7.5 to 8.3.0 fatal exception</a>:</p>
  
  <pre><code>FATAL EXCEPTION: AsyncTask #1
  java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.hashCode()' on a null object reference
  E/AndroidRuntime:     at com.google.android.gms.gcm.GcmListenerService.zzo(Unknown Source)
  E/AndroidRuntime:     at com.google.android.gms.gcm.GcmListenerService.zza(Unknown Source)
  E/AndroidRuntime:     at com.google.android.gms.gcm.GcmListenerService$1.run(Unknown Source)
  E/AndroidRuntime:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
  E/AndroidRuntime:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
  E/AndroidRuntime:     at java.lang.Thread.run(Thread.java:818)
  </code></pre>
  
  <p>After I removed this code, as suggested in the accepted answer, everything works fine on my test device and my GCM listener is started when the device boots up as expected.</p>
  
  <p>The question is whether there is a risk that for devices with a lower OS (I have Marshmallow on my test device) or play services version there might be a problem. If so, are there any possible ways to detect that and for those cases start the service?</p>