title: How come a GCM permission isn't granted on Android 6?
body: <h2>Background</h2>
  
  <p>I'm trying to investigate what an app at the office needs to change about its permissions, in order to support Android 6 nicely.</p>
  
  <h2>The problem</h2>
  
  <p>I've found which permission needs confirmation and which isn't, except for one :</p>
  
  <pre><code>&lt;uses-permission android:name=".permission.C2D_MESSAGE"/&gt;
  </code></pre>
  
  <p>It seems that this permission isn't mentioned anywhere that I look for, as one that's not granted automatically and yet I can't find where the user can enable it as a confirmation.</p>
  
  <h2>What I tried</h2>
  
  <p>In order to find which permissions are granted by default and which aren't , I just called this code:</p>
  
  <pre><code>private void checkPermissionsOfApp(String packageName) {
      PackageManager pm = getPackageManager();
      try {
          final ApplicationInfo applicationInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA);
          Log.d("AppLog", "Listing all permissions of app with PackageName: " + applicationInfo.packageName);
          PackageInfo packageInfo = pm.getPackageInfo(applicationInfo.packageName, PackageManager.GET_PERMISSIONS);
          //Get Permissions
          String[] requestedPermissions = packageInfo.requestedPermissions;
          if (requestedPermissions != null) {
              for (String permission : requestedPermissions) {
                  boolean permissionGranted = pm.checkPermission(permission, packageName) == PackageManager.PERMISSION_GRANTED;
                  Log.d("AppLog", "permission:" + permission + " permissionGranted:" + permissionGranted);
              }
          }
      } catch (NameNotFoundException e) {
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>And the call:</p>
  
  <pre><code>checkPermissionsOfApp(getPackageName());
  </code></pre>
  
  <p>Using the above code, it crashes for the problematic permission, but when using ContextCompat.checkSelfPermission it says it's not granted.</p>
  
  <h2>The question</h2>
  
  <p>How could it be?
  How can I grant the app this permission?
  Is it mentioned anywhere? </p>