title: Firebase Messaging Service Not Working On Older Android
body: <p>Recently I`ve migrated GCM to FCM and after some struggle, I've managed to make everything work with the help of this great community.</p>
  
  <p>Now when I tested notifications on older version of Android ( Nougat) it doesn't work, app just crash, I've found out that its something related to versions as older ones doesn't support channel managers.</p>
  
  <p>I've found few solutions on StackOverflow but I haven't find a suitable one for my problem so I was hoping someone could toss me a hint or solution.</p>
  
  <p>I appreciate all the answers and help.</p>
  
  <pre><code>public class MessagingService extends FirebaseMessagingService {
  
  private static final String TAG = "FCM Message";
  
  public MessagingService() {
      super();
  }
  
  
  
  @TargetApi(Build.VERSION_CODES.O)
  @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
  @Override
  public void onMessageReceived(RemoteMessage remoteMessage) {
      super.onMessageReceived(remoteMessage);
  
      String message = remoteMessage.getData().get("team");
  
  
  
      Intent intent=new Intent(getApplicationContext(),MainActivity.class);
      String CHANNEL_ID="channel";
      Uri defaultSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
      NotificationChannel notificationChannel=new NotificationChannel(CHANNEL_ID,"channel",NotificationManager.IMPORTANCE_HIGH);
      PendingIntent pendingIntent=PendingIntent.getActivity(getApplicationContext(),1,intent,0);
      Notification notification=new Notification.Builder(getApplicationContext(),CHANNEL_ID)
              .setContentText(message)
              //  .setContentTitle(title)
              .setSound(defaultSound)
              .setContentIntent(pendingIntent)
              .setChannelId(CHANNEL_ID)
              .setSmallIcon(android.R.drawable.sym_action_chat)
              .setWhen(System.currentTimeMillis())
              .setPriority(Notification.PRIORITY_MAX)
              .build();
  
      NotificationManager notificationManager=(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
      notificationManager.createNotificationChannel(notificationChannel);
      notificationManager.notify(1,notification);
  }
  </code></pre>
  
  <p>}</p>