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
Hugo Visser
July 19, 2018
Technology
0
92
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
140
Modern Android dependency injection
hugovisser
1
270
Android dependency injection in 2022
hugovisser
1
210
Open the door!
hugovisser
0
72
Navigating the Navigation Component
hugovisser
1
150
Reactive UIs with Data Binding
hugovisser
2
170
Up close and personal with Nearby (DevFest Trondheim)
hugovisser
0
99
Up close and personal with Nearby
hugovisser
3
510
Room: the blessed object mapper
hugovisser
0
210
Other Decks in Technology
See All in Technology
FastMCP OAuth Proxy with Cognito
hironobuiga
3
220
MCPで決済に楽にする
mu7889yoon
0
160
ハーネスエンジニアリング×AI適応開発
aictokamiya
1
660
AgentCoreとLINEを使った飲食店おすすめアプリを作ってみた
yakumo
2
260
サイボウズ 開発本部採用ピッチ / Cybozu Engineer Recruit
cybozuinsideout
PRO
10
76k
TUNA Camp 2026 京都Stage ヒューリスティックアルゴリズム入門
terryu16
0
610
Astro Islandsの 内部実装を 「日本で一番わかりやすく」 ざっくり解説!
knj
0
310
会社紹介資料 / Sansan Company Profile
sansan33
PRO
16
410k
MIX AUDIO EN BROADCAST
ralpherick
0
120
FlutterでPiP再生を実装した話
s9a17
0
230
OCI技術資料 : 証明書サービス概要
ocise
1
7.1k
OCI技術資料 : ロード・バランサ 概要 - FLB・NLB共通
ocise
4
27k
Featured
See All Featured
Agile that works and the tools we love
rasmusluckow
331
21k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.4k
The Curious Case for Waylosing
cassininazir
0
280
Crafting Experiences
bethany
1
96
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
220
Facilitating Awesome Meetings
lara
57
6.8k
Tell your own story through comics
letsgokoyo
1
870
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
1
490
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
0
250
Unsuck your backbone
ammeep
672
58k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
400
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
500
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