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
76
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
260
Android dependency injection in 2022
hugovisser
1
190
Open the door!
hugovisser
0
60
Navigating the Navigation Component
hugovisser
1
140
Reactive UIs with Data Binding
hugovisser
2
160
Up close and personal with Nearby (DevFest Trondheim)
hugovisser
0
89
Up close and personal with Nearby
hugovisser
3
500
Room: the blessed object mapper
hugovisser
0
200
Other Decks in Technology
See All in Technology
[Neurogica] 採用ポジション/ Recruitment Position
neurogica
1
140
AWSインフルエンサーへの道 / load of AWS Influencer
whisaiyo
0
240
Amazon Quick Suite で始める手軽な AI エージェント
shimy
2
2.1k
Redshift認可、アップデートでどう変わった?
handy
1
110
普段使ってるClaude Skillsの紹介(by Notebooklm)
zerebom
8
2.5k
Amazon Bedrock Knowledge Bases × メタデータ活用で実現する検証可能な RAG 設計
tomoaki25
6
2.6k
MySQLのSpatial(GIS)機能をもっと充実させたい ~ MyNA望年会2025LT
sakaik
0
160
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
9.9k
ペアーズにおけるAIエージェント 基盤とText to SQLツールの紹介
hisamouna
2
1.9k
Microsoft Agent Frameworkの可観測性
tomokusaba
1
120
半年で、AIゼロ知識から AI中心開発組織の変革担当に至るまで
rfdnxbro
0
160
MariaDB Connector/C のcaching_sha2_passwordプラグインの仕様について
boro1234
0
1.1k
Featured
See All Featured
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
250
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
0
79
WENDY [Excerpt]
tessaabrams
9
35k
How to make the Groovebox
asonas
2
1.9k
Building an army of robots
kneath
306
46k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.3k
Between Models and Reality
mayunak
0
150
30 Presentation Tips
portentint
PRO
1
180
Fashionably flexible responsive web design (full day workshop)
malarkey
408
66k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.3k
The Limits of Empathy - UXLibs8
cassininazir
1
200
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