title: How to determine if an app is running on Android M (Developer Preview)
body: <p>Note: this question was asked for the Android M developer preview, not the official Android 6.0.</p>
  
  <p>android.os.Build.VERSION.SDK_INT returns 22 on Android M (22 is the api level for LOLLIPOP_MR1). How are we supposed to check whether the app runs on Android M? I had something like this in mind but that obviously doesn't work:</p>
  
  <pre><code>public boolean isAndroidMOrHigher() {
      return android.os.Build.VERSION.SDK_INT &gt;= android.os.Build.VERSION_CODES.MNC;
  }
  </code></pre>
  
  <p>Why do I need this? E.g. to check whether I need to request permissions because with Android M there's a new permission model.</p>
  
  <p>I could do this:</p>
  
  <pre><code>public boolean isAndroidMOrHigher() {
      return "M".equalsIgnoreCase(Build.VERSION.RELEASE);
  }
  </code></pre>
  
  <p>But that seems to be a hack IMO.</p>
  
  <p>There are really two questions:</p>
  
  <ul>
  <li>What's the cleanest way to do this?</li>
  <li>Is this a bug or is this supposed to be like that?</li>
  </ul>