Skip to content

Migrate Background Work snippets - #1086

Draft
hamen wants to merge 1 commit into
android:mainfrom
hamen:bg-work
Draft

hamen wants to merge 1 commit into
android:mainfrom
hamen:bg-work

Conversation

@hamen

@hamen hamen commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Adds the Kotlin snippets referenced by the background work documentation pages on developer.android.com to the dedicated :backgroundwork module introduced in #1089.

Snippets added

File Region tags Documentation page
Alarms.kt 9 /develop/background-work/services/alarms
TestingWorkerImpl.kt 8 /develop/background-work/background-tasks/testing/persistent/worker-impl
BgWorkRestrictions.kt 2 /develop/background-work/background-tasks/bg-work-restrictions
ScreenOn.kt 1 /develop/background-work/background-tasks/awake/screen-on

Build changes

  • Declares androidx-work-rxjava2, androidx-work-testing, rxjava2 and hamcrest in gradle/libs.versions.toml and wires them into :backgroundwork alongside the existing AndroidX test artifacts.
  • Adds the activity_main.xml layout referenced by the keep-the-screen-on snippet.

Verification

  • ./gradlew :backgroundwork:compileDebugKotlin passes.
  • ./gradlew :backgroundwork:spotlessCheck passes.
  • All 20 region tags resolve against the corresponding github.code_snippet macros in the paired Piper CL.

Adds the Kotlin snippets referenced by the background work documentation
pages (alarms, background work restrictions, keep the screen on, and
testing worker implementations) to the dedicated :backgroundwork module
introduced in android#1089.

Declares the WorkManager RxJava2, WorkManager testing, RxJava 2, Hamcrest
and AndroidX test dependencies in the version catalog and wires them into
the module.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant