`private val uniqueWorkName = CountDownWorker::cla...
# random
m
Copy code
private val uniqueWorkName = CountDownWorker::class._java_._simpleName_

@RequiresApi(Build.VERSION_CODES._O_)
fun enqueue(context: Context, force: Boolean = false) {
    val manager = WorkManager.getInstance(context)

    val requestBuilder = _PeriodicWorkRequestBuilder_<CountDownWorker>(30, TimeUnit._MINUTES_).build()

    var workPolicy = ExistingPeriodicWorkPolicy._KEEP_

    // Replace any enqueued work and expedite the request
    if (force) {
        workPolicy = ExistingPeriodicWorkPolicy._UPDATE_
    }

    manager.enqueueUniquePeriodicWork(
        uniqueWorkName,
        workPolicy,
        requestBuilder
    )
}
this is my code snippet, I want to schedule a work which updated the home widget after every 30 minutes. this works fine if the app is running in the foreground but if the app is closed for a long time, the widgets don't update, meaning the work manager doesn't work and it updates the widgets as soon as i open the app. So, can you guys please help me out? what should I do in this case?
s
I assume you will find help in #android
m
I tried, but they marked it as Not Kotlin and said to ask it elsewhere
s
Ok, I see. Yes, you might not find not help here then. You could as on StackOverflow or create a bug report on the Android issue tracker.