Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Work, Work - WorkManager
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Hugo Visser
July 19, 2018
Technology
110
0
Share
Work, Work - WorkManager
Slided from my presentation on WorkManager at the DutchAUG IO Extended Extended meetup.
Hugo Visser
July 19, 2018
More Decks by Hugo Visser
See All by Hugo Visser
LLMs on Small devices [DutchAUG]
hugovisser
1
150
Modern Android dependency injection
hugovisser
1
280
Android dependency injection in 2022
hugovisser
1
230
Open the door!
hugovisser
0
79
Navigating the Navigation Component
hugovisser
1
170
Reactive UIs with Data Binding
hugovisser
2
170
Up close and personal with Nearby (DevFest Trondheim)
hugovisser
0
110
Up close and personal with Nearby
hugovisser
3
510
Room: the blessed object mapper
hugovisser
0
220
Other Decks in Technology
See All in Technology
個人AIからチームAIへ:開発における品質と生産性の再設計
moongift
PRO
0
250
AI活用の格差をなくす:チーム全体のAI開発生産性を底上げする方法
moongift
PRO
1
120
まだ道半ば、AI-DLCを歩み始めている話
news_it_enj
2
200
自作エディターをOSSにして分かった、一人に刺さる開発が世界を動かす理由
shinyasaita
1
450
大規模環境でどのように監視を実現する?
yuobayashi
1
260
Amazon CloudFrontにおけるAIボットアクセス制御のポイント
kizawa2020
4
300
Gradle×GitHub_ActionsでCI時間を約50%短縮 ジョブ分割の設計と落とし穴 / Cutting CI Time by ~50% with Gradle and GitHub Actions: Job-Splitting Design and Pitfalls
takatty
0
460
類似画像検索モデルの開発ノウハウ
lycorptech_jp
PRO
4
990
サプライチェーン攻撃への備えについて考えている #湘なんか
stefafafan
3
2.4k
Anthropic AIネイティブ・スタートアップ構築のプレイブック を理解する
nagatsu
0
200
A Harness for Behaviour: how to get AI to generate code that does what we intend, or "TDD in the age of AI"
xpmatteo
0
470
GitHub Copilot CLI の Rubber Duck 機能を使ってコーディングの品質をあげよう #techbaton_findy
stefafafan
2
1.2k
Featured
See All Featured
WCS-LA-2024
lcolladotor
0
600
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
1.1k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4k
Accessibility Awareness
sabderemane
1
130
Designing for Timeless Needs
cassininazir
1
230
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
230
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
580
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
310
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
150
VelocityConf: Rendering Performance Case Studies
addyosmani
333
25k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
260
Rails Girls Zürich Keynote
gr2m
96
14k
Transcript
Work, work - WorkManager Hugo Visser @botteaap
[email protected]
None
None
WorkManager Part of architecture components, JetPack Schedules & execute jobs
“...intended for tasks that require a guarantee that the system will run them even if the app exits…”
Current options AlarmManager JobScheduler GCMNetworkManager FirebaseJobDispatcher
Current options AlarmManager → No system coordination, no constraints, throttled
JobScheduler GCMNetworkManager FirebaseJobDispatcher
Current options AlarmManager → No system coordination, no constraints, no
retries, throttled JobScheduler → API 21+, Coordination, constraints & retries, bugs < API 23 GCMNetworkManager FirebaseJobDispatcher
Current options AlarmManager → No system coordination, no constraints, no
retries, throttled JobScheduler → API 21+, Coordination, constraints & retries, bugs < API 23 GCMNetworkManager → JobSchedulerCompat, but not quite FirebaseJobDispatcher
Current options AlarmManager → No system coordination, no constraints, no
retries, throttled JobScheduler → API 21+, Coordination, constraints & retries, bugs < API 23 GCMNetworkManager → JobSchedulerCompat, but not quite FirebaseJobDispatcher → Pluggable schedulers, default: GCMNetworkManager
WorkManager Schedule jobs using constraints & retries JobScheduler on API
23+ AlarmManager or GCMNetworkManager through FJD < API 23
New features Reduce IPC → if a job is eligible
to run immediately, no need to “schedule” it. Monitor status → LiveData providing job status Unique jobs Tags Output parameters Orchestration of multiple jobs
Orchestration B runs after A D runs after C E
runs after B and D are completed
Unit of work: Worker import androidx.work.Worker class MyWorker: Worker() {
override fun doWork(): Result { // do the hard work return Result.SUCCESS // or Result.FAILURE or Result.RETRY } }
Schedule // work-runtime-ktx gives us a nicer kotlin syntax val
request = OneTimeWorkRequestBuilder<MyWorker>() .setConstraints(Constraints.Builder() .setRequiredNetworkType(NetworkType.CONNECTED) .build()) .build() // as of alpha4 getInstance() can return null! WorkManager.getInstance()!!.enqueue(request)
Monitor val status = WorkManager.getInstance()!!.getStatusById(request.id) status.observe(this, Observer { // WorkStatus
can be null if the task id is invalid or gone it?.let { Log.d(TAG, "Task status: ${it.state}") } })
Next? API still in flux Asynchronous workers Try it out,
file bugs https://issuetracker.google.com https://developer.android.com/topic/libraries/architecture/workmanager
Thanks! @botteaap
[email protected]
speakerdeck.com/hugovisser