title: WorkManager keep notification after work is done
body: <p>I want to display a notification while a Worker is running in the background. I can do that with something like the code below:</p>
  
  <pre class="lang-kotlin prettyprint-override"><code>override suspend fun doWork(): Result {
      val manager = NotificationManagerCompat.from(applicationContext)
      val channel = "some_channel"
      val id = 15
      val builder = NotificationCompat.Builder(applicationContext, channel)
  
      if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.O)
          manager.createNotificationChannel(NotificationChannel(channel, "DefaultName", NotificationManager.IMPORTANCE_LOW))
  
      builder
          .setOnlyAlertOnce(true)
          .setOngoing(true)
          .setAutoCancel(false)
          .setPriority(NotificationCompat.PRIORITY_HIGH)
          .setSmallIcon(android.R.drawable.ic_dialog_alert)
          .setTicker("Background Task")
          .setContentText("Starting")
          .setProgress(0, 0, true)
  
      setForeground(ForegroundInfo(id, builder.build()))
  
      delay(500)
  
      manager.notify(id, builder.setContentText("Progress A").setProgress(20, 0, false).build())
      for (i in 1..20) {
          delay(100)
          manager.notify(id, builder.setProgress(20, i, false).build())
      }
  
      delay(500)
  
      manager.notify(id, builder.setContentText("Progress B").setProgress(2, 0, false).build())
      delay(1000)
      manager.notify(id, builder.setProgress(2, 1, false).build())
      delay(1000)
      manager.notify(id, builder.setProgress(2, 2, false).build())
  
      delay(1000)
  
      manager.notify(id, builder.setContentText("Done!").setProgress(0, 0, false).build())
  
      delay(500)
  
      return Result.success()
  }
  </code></pre>
  
  <p>But I also want to display the result of the worker in the notification and keep it until the user sees and clears it, yet the notification is always cleared at the end of the work.</p>
  
  <p>How can I keep the notification alive? <code>.setOngoing(true)</code> and <code>.setAutoCancel(false)</code> didn't help.</p>