AGENT SKILL
android-background-work
Standards for WorkManager and Background Processing. Use when creating Worker classes, scheduling tasks with WorkManager, choosing between WorkManager and Foreground Services, or setting up Hilt in workers. (triggers: **/*Worker.kt, CoroutineWorker, WorkManager, doWork, PeriodicWorkRequest, OneTimeWorkRequest, @HiltWorker)
- License 许可
- MIT
- 最近更新
- 2026-06-24
- Stars
- ★ 67
- Forks
- 24
01 前言 Front Matter
- name
- android-background-work
- description
- Standards for WorkManager and Background Processing. Use when creating Worker classes, scheduling tasks with WorkManager, choosing between WorkManager and Foreground Services, or setting up Hilt in workers. (triggers: **/*Worker.kt, CoroutineWorker, WorkManager, doWork, PeriodicWorkRequest, OneTimeWorkRequest, @HiltWorker)
02 资源文件 3
- 参考文档checklist.md1.3 KB
- 其他customize.toml1.6 KB
- 参考文档sprint-status-template.yaml1.7 KB
03 SKILL.md 正文
Android Background Work Standards
Priority: P1
Implementation Guidelines
WorkManager
- CoroutineWorker: Use for all background tasks.
- Constraints: Be explicit (Require Network, Charging).
- Hilt: Use
@HiltWorkerfor DI integration. Inject dependencies via@AssistedInjectconstructor; bind withHiltWorkerFactoryinWorkManagerconfiguration.
Foreground Services
- Only When Necessary: Use generating visible notifications only for tasks the user is actively aware of (Playback, Calls, Active Navigation). Otherwise use WorkManager.
Anti-Patterns
- No IntentService: Deprecated. Use WorkManager for all background tasks.
- No Short Background Jobs: Use Coroutines in ViewModel scope instead.