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
69
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
110
Modern Android dependency injection
hugovisser
1
250
Android dependency injection in 2022
hugovisser
1
170
Open the door!
hugovisser
0
51
Navigating the Navigation Component
hugovisser
1
130
Reactive UIs with Data Binding
hugovisser
2
150
Up close and personal with Nearby (DevFest Trondheim)
hugovisser
0
74
Up close and personal with Nearby
hugovisser
3
470
Room: the blessed object mapper
hugovisser
0
190
Other Decks in Technology
See All in Technology
オブザーバビリティが広げる AIOps の世界 / The World of AIOps Expanded by Observability
aoto
PRO
0
270
AI時代にPdMとPMMはどう連携すべきか / PdM–PMM-collaboration-in-AI-era
rakus_dev
0
260
ここ一年のCCoEとしてのAWSコスト最適化を振り返る / CCoE AWS Cost Optimization devio2025
masahirokawahara
1
1.3k
Nstockの一人目エンジニアが 3年間かけて向き合ってきた セキュリティのこととこれから〜あれから半年〜
yo41sawada
0
180
退屈なことはDevinにやらせよう〜〜Devin APIを使ったVisual Regression Testの自動追加〜
kawamataryo
4
1.2k
カミナシ社の『ID管理基盤』製品内製 - その意思決定背景と2年間の進化 #AWSUnicornDay / Kaminashi ID - The Big Whys
kaminashi
3
730
「魔法少女まどか☆マギカ Magia Exedra」での負荷試験の実践と学び
gree_tech
PRO
0
450
AWS環境のリソース調査を Claude Code で効率化 / aws investigate with cc devio2025
masahirokawahara
2
1.1k
実践アプリケーション設計 ①データモデルとドメインモデル
recruitengineers
PRO
5
1.5k
BPaaSにおける人と協働する前提のAIエージェント-AWS登壇資料
kentarofujii
0
110
DDD集約とサービスコンテキスト境界との関係性
pandayumi
2
240
進捗
ydah
2
230
Featured
See All Featured
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
229
22k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
GitHub's CSS Performance
jonrohan
1032
460k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.9k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
7
840
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
8
510
Mobile First: as difficult as doing things right
swwweet
224
9.9k
Git: the NoSQL Database
bkeepers
PRO
431
66k
Building Better People: How to give real-time feedback that sticks.
wjessup
368
19k
Large-scale JavaScript Application Architecture
addyosmani
512
110k
Why Our Code Smells
bkeepers
PRO
339
57k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
111
20k
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