Skip to content

Instantly share code, notes, and snippets.

@magdamiu
Created July 4, 2019 19:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save magdamiu/497d032696ca2f2e75fc94a236cdeeec to your computer and use it in GitHub Desktop.
Save magdamiu/497d032696ca2f2e75fc94a236cdeeec to your computer and use it in GitHub Desktop.
Input and output data for a task
val userIdData = Data.Builder()
.putInt(DATA_USER_ID, userId)
.build()
val syncOnlyOnce = OneTimeWorkRequestBuilder<SyncWorker>()
.setInputData(userIdData)
.build()
val userIdInput = inputData.getInt(Constants.DATA_USER_ID, 0)
// ktx
val outputData = workDataOf(Constants.DATA_SENT to isDataSent)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment