title: How set Firebase notification ChannelID in Android O?
body: <p>For API level 26 we have to set a channel id as a reference. I learned how to do it without a channelID and below there is my firebase messaging set-up code. But now for the new Android api 26 level</p>
  
  <pre><code>NotificationCompat.Builder(this);
  </code></pre>
  
  <p>This doesn't work and I should add a reference to channelID as</p>
  
  <pre><code>NotificationCompat.Builder(this, channelID);
  </code></pre>
  
  <p>But I don't know how to do it.
  Can you help me to understand how to create a channel ID for Firebase cloud messaging?</p>
  
  <p><strong>AndroidManifest.xml</strong></p>
  
  <pre><code>    &lt;service android:name=".MyFirebaseInstanceIdService"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="com.google.firebase.INSTANCE_ID_EVENT"&gt;&lt;/action&gt;
          &lt;/intent-filter&gt;
      &lt;/service&gt;
  
      &lt;service android:name=".MyFirebaseMessagingService"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="com.google.firebase.MESSAGING_EVENT"&gt;&lt;/action&gt;
          &lt;/intent-filter&gt;
      &lt;/service&gt;
  </code></pre>
  
  <p><strong>MyFirebaseInstanceIdService Java Class:</strong></p>
  
  <pre><code>import android.util.Log;
  import com.google.firebase.iid.FirebaseInstanceId;
  import com.google.firebase.iid.FirebaseInstanceIdService;
  
  public class MyFirebaseInstanceIdService extends FirebaseInstanceIdService {
  
      private static final String REG_TOKEN = "REG_TOKEN";
  
      @Override
      public void onTokenRefresh() {
          String recent_token = FirebaseInstanceId.getInstance().getToken();
          Log.d(REG_TOKEN, recent_token);
      }
  }
  </code></pre>
  
  <p><strong>MyFirebaseMessagingService Java Class</strong></p>
  
  <pre><code>import android.app.Notification;
  import android.app.NotificationManager;
  import android.app.PendingIntent;
  import android.content.Context;
  import android.content.Intent;
  import android.support.v4.app.NotificationCompat;
  
  import com.google.firebase.messaging.FirebaseMessagingService;
  import com.google.firebase.messaging.RemoteMessage;
  
  public class MyFirebaseMessagingService extends FirebaseMessagingService {
  
      @Override
      public void onMessageReceived(RemoteMessage remoteMessage) {
  
          Intent intent = new Intent(this, MainActivity.class);
          intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
          PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_ONE_SHOT);
  
          // Here I will set up a channel ID as "CH_ID_1" but I do not know how to do this.
          NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, "CH_ID_1");
          //****************************************************
  
          notificationBuilder.setContentTitle("FCM NOTIFICATION");
          notificationBuilder.setContentText(remoteMessage.getNotification().getBody());
          notificationBuilder.setAutoCancel(true);
          notificationBuilder.setSmallIcon(R.mipmap.ic_launcher);
          notificationBuilder.setContentIntent(pendingIntent);
          NotificationManager notificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
          notificationManager.notify(0, notificationBuilder.build());
  
      }
  }
  </code></pre>
  
  <p><strong>Gradle - Dependencies</strong></p>
  
  <pre><code>dependencies {
      implementation fileTree(include: ['*.jar'], dir: 'libs')
      implementation 'com.android.support:appcompat-v7:26.1.0'
      implementation 'com.android.support.constraint:constraint-layout:1.1.0'
      implementation 'com.android.support:design:26.1.0'
      testImplementation 'junit:junit:4.12'
      androidTestImplementation 'com.android.support.test:runner:1.0.2'
      androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
      implementation 'com.google.firebase:firebase-core:16.0.0'
      implementation 'com.google.firebase:firebase-messaging:17.0.0'
  }
  apply plugin: 'com.google.gms.google-services'
  </code></pre>