Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Work, Work - WorkManager
Search
Hugo Visser
July 19, 2018
Technology
0
75
Work, Work - WorkManager
Slided from my presentation on WorkManager at the DutchAUG IO Extended Extended meetup.
Hugo Visser
July 19, 2018
Tweet
Share
More Decks by Hugo Visser
See All by Hugo Visser
LLMs on Small devices [DutchAUG]
hugovisser
1
120
Modern Android dependency injection
hugovisser
1
260
Android dependency injection in 2022
hugovisser
1
180
Open the door!
hugovisser
0
58
Navigating the Navigation Component
hugovisser
1
140
Reactive UIs with Data Binding
hugovisser
2
150
Up close and personal with Nearby (DevFest Trondheim)
hugovisser
0
86
Up close and personal with Nearby
hugovisser
3
490
Room: the blessed object mapper
hugovisser
0
200
Other Decks in Technology
See All in Technology
ActiveJobUpdates
igaiga
1
140
まだ間に合う! Agentic AI on AWSの現在地をやさしく一挙おさらい
minorun365
11
470
GitHub Copilotを使いこなす 実例に学ぶAIコーディング活用術
74th
3
3.4k
日本Rubyの会: これまでとこれから
snoozer05
PRO
3
100
AI 駆動開発勉強会 フロントエンド支部 #1 w/あずもば
1ftseabass
PRO
0
400
LLM-Readyなデータ基盤を高速に構築するためのアジャイルデータモデリングの実例
kashira
0
270
MLflowダイエット大作戦
lycorptech_jp
PRO
1
140
業務のトイルをバスターせよ 〜AI時代の生存戦略〜
staka121
PRO
2
220
AI-DLCを現場にインストールしてみた:プロトタイプ開発で分かったこと・やめたこと
recruitengineers
PRO
2
160
AWS re:Invent 2025~初参加の成果と学び~
kubomasataka
0
120
今年のデータ・ML系アップデートと気になるアプデのご紹介
nayuts
1
500
「図面」から「法則」へ 〜メタ視点で読み解く現代のソフトウェアアーキテクチャ〜
scova0731
0
340
Featured
See All Featured
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
How to train your dragon (web standard)
notwaldorf
97
6.4k
Learning to Love Humans: Emotional Interface Design
aarron
274
41k
Imperfection Machines: The Place of Print at Facebook
scottboms
269
13k
A better future with KSS
kneath
240
18k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.2k
4 Signs Your Business is Dying
shpigford
186
22k
Building a Scalable Design System with Sketch
lauravandoore
463
34k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
132
19k
Statistics for Hackers
jakevdp
799
230k
BBQ
matthewcrist
89
9.9k
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