Closed ken-brown closed 4 years ago
Updated Step 2: Schedule a WorkRequest with WorkManager to include the Timber log. In progress.
Thank you for reaching out to us. This should be fixed now.
The Timber call is missing from the code snippet at the bottom of the page:
class RefreshDataWorker(appContext: Context, params: WorkerParameters) : CoroutineWorker(appContext, params) {
override suspend fun doWork(): Result { val database = getDatabase(applicationContext) val repository = VideosRepository(database) try { repository.refreshVideos() } catch (e: HttpException) { return Result.retry() } return Result.success() } }
Describe the problem There is a statement purporting that a Logcat statement should be visible, but there is no place in the code that contains a Timber.d() call that emits that statement. The statement that is supposedly emitted in logcat is:
11:31:44 D/DevByteApplication: Periodic Work request for sync is scheduled
But the code does not contain this.In which lesson and step of the codelab can this issue be found? Lesson number Android Kotlin Fundamentals 09.2: WorkManager + step number 8. Task: Add constraints, step Step 2: Run the app and notice the logs, numbered statement 4.
How to reproduce? What are the exact steps to reproduce the problem? Examine the code in DevBytes-starter at the point where this lesson / task/ statement is and observe that no such Timber.d() statement exists.
Versions
Additional information I added this statement
Timber.d("Periodic Work request for sync is scheduled")
before the line:WorkManager.getInstance().enqueueUniquePeriodicWork( RefreshDataWorker.WORK_NAME, ExistingPeriodicWorkPolicy.KEEP, repeatingRequest)
in fun setupRecurringWork in DevByteApplication.kt and it behaves as the text indicatesThe code is out of sequence, as if you examine the code snippet in Step 3: Add more constraints, numbered statement 4 contains
Timber.d("Periodic Work request for sync is scheduled")
for the first time. But at the point Step 2 is being described, this statement is not in the code.codelab: android-kotlin-fundamentals