title: Android NotificationChannel compatability with older API
body: <p>I'm new to android development and Java, and I'm slightly confused about the handling of backwards compatibility when using classes that have been introduced in the latest versions. </p>
  
  <p>I've checked out the android support library and see the various <code>XXXCompat</code> classes available. For the ones I've looked at they appear to pretty much branch on <code>VERSION.SDK_INT</code> and call a new api or an old api.</p>
  
  <p>I am using a support library (<code>com.android.support:support-v4:27.1.1</code>) version that is targeted for a newer api than my targetSdkVersion (<code>25</code>). I was under the impression this was the intended use case? to be able to write code with newer api's but have it work when targeting older sdk.</p>
  
  <p>If so, how is this possible? For instance <code>ContextCompat</code> is has the following for <code>startForegroundService</code></p>
  
  <pre><code>public static void startForegroundService(@NonNull Context context, 
  @NonNull Intent intent) {
      if (VERSION.SDK_INT &gt;= 26) {
          context.startForegroundService(intent);
      } else {
          context.startService(intent);
      }
  }
  </code></pre>
  
  <p>However in the version I am targeting the Context doesn't have the method <code>startForegroundService</code>. If paste this if block into my code, it fails to compile with <code>java: cannot find symbol ...</code>.</p>
  
  <p>I can only assume that even if you compiled against a newer api (such that it could resolve the symbols), if those symbols don't exist at runtime, as long a they are not called it is not a problem?</p>
  
  <p>So this is fine for api calls that are abstracted by the <code>XXXCompat</code> classes, but when using new classes like <code>NotificationChannel</code>. I can only import this if upping my <code>targetSdkVersion</code> to > 26. So assuming I do this, then this class is available. All uses of it that I have seen do </p>
  
  <pre><code>if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.O)
  {
     NotificationChannel channel = ...
  }
  </code></pre>
  
  <p>Does this mean that at runtime, for lower <code>Build.VERSION.SDK_INT</code> the symbol <code>NotificationChannel</code> will not exist? and if I attempted to instantiate this class it on a lower android version, it would crash?</p>