Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/guillemroca/agent-skills-android/android-background-worknpx skills add GuillemRoca/agent-skills-android --skill android-background-workgit clone --depth 1 https://github.com/GuillemRoca/agent-skills-androidWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/guillemroca/agent-skills-android/android-background-work)<a href="https://agentmods.dev/skills/guillemroca/agent-skills-android/android-background-work"><img src="https://agentmods.dev/badge/skills/guillemroca/agent-skills-android/android-background-work.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00054 | $0.01736 |
| Opus 5 | $0.00027 | $0.00868 |
| Sonnet 5 | $0.00011 | $0.00347 |
| Haiku 4.5 | $0.00005 | $0.00174 |
Grade A, and why
android-background-work scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 163 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Android Background Work
Overview
Background execution on Android is a negotiation with the OS, not a right. Doze, App Standby buckets, foreground-service type enforcement, and exact-alarm policy all exist to kill battery-hungry work — code that ignores them runs fine on the developer's charging Pixel and silently never runs in the field. This skill picks the correct primitive for each job and makes background work observable and testable.
When to Use
- Syncing data, uploading files, or refreshing content off-screen
- Scheduling periodic or deferred jobs
- Long-running user-initiated tasks (export, media processing)
- Anything currently "solved" with
GlobalScope.launchor a rawService
Skip when: The work only matters while the screen is visible — use viewModelScope/lifecycleScope and let it cancel with the UI.
Core Process
Step 1: Pick the Right Primitive
- Decision table — default to WorkManager:
| Need | Primitive |
|---|---|
| Deferrable, guaranteed (sync, upload) | WorkManager OneTimeWorkRequest |
| Periodic (≥15 min interval) | WorkManager PeriodicWorkRequest |
| User-visible ongoing task (playback, navigation, recording) | Foreground service with a declared type |
| User-facing alarm/reminder at an exact time | AlarmManager.setExactAndAllowWhileIdle + SCHEDULE_EXACT_ALARM/USE_EXACT_ALARM |
| Work only while UI is alive | Coroutine scope tied to the lifecycle — not background work |
Choosing a foreground service for deferrable work, or exact alarms for "roughly hourly", fails Play review and drains battery.
Step 2: WorkManager Done Right
- Constraints and backoff instead of retry loops:
val syncRequest = OneTimeWorkRequestBuilder<SyncWorker>()
.setConstraints(
Constraints.Builder()
.setRequiredNetworkType(NetworkType.CONNECTED)
.setRequiresBatteryNotLow(true)
.build()
)
.setBackoffCriteria(BackoffPolicy.EXPONENTIAL, 30, TimeUnit.SECONDS)
.build()
// Unique work: a second "sync now" tap must not enqueue a second sync
WorkManager.getInstance(context).enqueueUniqueWork(
"sync", ExistingWorkPolicy.KEEP, syncRequest
)
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 5d ago First seen · 163 lines · 54 tokens per session scan A 6abb2e23fdb5
android-background-work is a skill published in the GitHub repository GuillemRoca/agent-skills-android (2 stars, last pushed 2mo ago), licensed MIT. It adds 54 tokens to every session and 1,736 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
imagegen-frontend-mobile
Elite mobile app image-generation skill for creating premium, app-native screen concepts and flows. Designed for iOS, Android, and cross-platform mobile products. Prioritizes clean hierarchy, comfortably readable text, strong multi-screen consistency, controlled color palettes, non-generic creative direction, textured…
sleek-design-mobile-apps
Use when the user wants to design a mobile app, create screens, build UI, or interact with their Sleek projects. Covers high-level requests ("design an app that does X") and specific ones ("list my projects", "create a new project", "screenshot that screen").
healthkit
Read, write, and query Apple Health data using HealthKit. Covers HKHealthStore authorization, sample queries, statistics queries, statistics collection queries for charts, saving HKQuantitySample data, background delivery, workout sessions with HKWorkoutSession and HKLiveWorkoutBuilder, HKUnit, and…
liquid-glass-design
Patterns for implementing Apple's Liquid Glass — a dynamic material that blurs content behind it, reflects color and light from surrounding content, and reacts to touch and pointer interactions. Covers SwiftUI, UIKit, and WidgetKit integration.
swiftui-patterns
SwiftUI architecture patterns, state management with @Observable, view composition, navigation, performance optimization, and modern iOS/macOS UI best practices.
foundation-models-on-device
Apple FoundationModels framework for on-device LLM — text generation, guided generation with @Generable, tool calling, and snapshot streaming in iOS 26+.