When executing a task in the doWork() method of a Worker which runs in the background (for example, a worker which runs periodically in the background using PeriodicWorkRequest), should I show an ongoing notification? If so, how do I go about it? Let's say I have something like:
class NoticeWorker(context: Context, params: WorkerParameters)
: Worker(context, params) {
override fun doWork(): Result {
// do some work here
return Result.SUCCESS
}
}
which is then executed with
WorkManager.getInstance().enque(workerObj)