title: Notification for foreground service class error
body: <p>I am trying to start a foreground service in my app. I was informed that there needs to be a notification whenever a service is started for api level 28 and above. Below is the code I used within onstartcommand of my service class</p>
  
  <pre><code>Intent notif=new Intent(this,MyService.class);
  
  PendingIntent  pendingIntent=PendingIntent.getActivity(this,0,notif,0);
    Notification notification=new NotificationCompat.Builder(this)
      .setSmallIcon(R.mipmap.ic_launcher_round)
      .setContentText("w")
      .setContentTitle("jj")
      .setContentIntent(pendingIntent).build(); 
   startForeground(200,notification);
  </code></pre>
  
  <p>When I do this I receive error </p>
  
  <blockquote>
    <p>Bad notification for startForeground: java.lang.RuntimeException: invalid channel for service notification: Notification(channel=My channel pri=0 contentView=null</p>
  </blockquote>
  
  <p>I have seen posts relating to this such as 
  <a href="https://stackoverflow.com/questions/51587863/bad-notification-for-start-foreground-invalid-channel-for-service-notification">Bad notification for start Foreground, Invalid channel for service notification:</a> but they all contain a checking for android version 26 and above. What is the best way to handle this error given my min sdk version is 16 and maximum sdk version is 28. This is the first time I am working with services and notifications </p>
  
  <p>This my first time working with services and notifications.  </p>