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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Hugo Visser
July 19, 2018
Technology
0
86
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
130
Modern Android dependency injection
hugovisser
1
270
Android dependency injection in 2022
hugovisser
1
200
Open the door!
hugovisser
0
69
Navigating the Navigation Component
hugovisser
1
150
Reactive UIs with Data Binding
hugovisser
2
160
Up close and personal with Nearby (DevFest Trondheim)
hugovisser
0
94
Up close and personal with Nearby
hugovisser
3
500
Room: the blessed object mapper
hugovisser
0
210
Other Decks in Technology
See All in Technology
xDS を活用したサービスディスカバリーで実現するブランチ別 QA 環境の構築手法
knwoop
1
110
Claude Code for NOT Programming
kawaguti
PRO
1
130
AzureでのIaC - Bicep? Terraform? それ早く言ってよ会議
torumakabe
1
680
チーム開発の基礎_研究を事業につなげるために
cyberagentdevelopers
PRO
1
510
個人的3D Gaussian Splattingニュースをご紹介 / sharing 3d gaussian splatting news
drumath2237
0
180
[CV勉強会@関東 World Model 読み会] Orbis: Overcoming Challenges of Long-Horizon Prediction in Driving World Models (Mousakhan+, NeurIPS 2025)
abemii
0
170
コンテナセキュリティの最新事情 ~ 2026年版 ~
kyohmizu
8
2.9k
Open Table Formatにおけるストレージ抽象化の比較
lycorptech_jp
PRO
0
140
Oracle Database@AWS:サービス概要のご紹介
oracle4engineer
PRO
3
1.4k
サイボウズ 開発本部採用ピッチ / Cybozu Engineer Recruit
cybozuinsideout
PRO
10
74k
React 19時代のコンポーネント設計ベストプラクティス
uhyo
4
1.2k
なぜ令和の今ゲームボーイを触るのか
kimkim0106
0
110
Featured
See All Featured
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
1
300
The World Runs on Bad Software
bkeepers
PRO
72
12k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
65
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
60
42k
The Limits of Empathy - UXLibs8
cassininazir
1
230
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
359
30k
Documentation Writing (for coders)
carmenintech
77
5.3k
BBQ
matthewcrist
89
10k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.6k
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
77
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
55k
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