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
72
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
56
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
82
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
SRE視点で振り返るメルカリのアーキテクチャ変遷と普遍的な考え
foostan
2
2.1k
新しい風。SolidFlutterで実現するシンプルな状態管理
zozotech
PRO
0
140
AWS re:Invent 2025 で頻出の 生成 AI サービスをおさらい
komakichi
3
240
グローバルなコンパウンド戦略を支えるモジュラーモノリスとドメイン駆動設計
kawauso
3
9.6k
レガシーで硬直したテーブル設計から変更容易で柔軟なテーブル設計にする
red_frasco
4
610
Sansan Engineering Unit 紹介資料
sansan33
PRO
1
3.2k
pmconf 2025 大阪「生成AI時代に未来を切り開くためのプロダクト戦略:圧倒的生産性を実現するためのプロダクトサイクロン」 / The Product Cyclone for Outstanding Productivity
yamamuteki
3
2.8k
改竄して学ぶコンテナサプライチェーンセキュリティ ~コンテナイメージの完全性を目指して~/tampering-container-supplychain-security
mochizuki875
1
400
事業状況で変化する最適解。進化し続ける開発組織とアーキテクチャ
caddi_eng
1
8k
"なるべくスケジューリングしない" を実現する "PreferNoSchedule" taint
superbrothers
0
110
小規模チームによる衛星管制システムの開発とスケーラビリティの実現
sankichi92
0
150
プロダクト負債と歩む持続可能なサービスを育てるための挑戦
sansantech
PRO
1
1k
Featured
See All Featured
Unsuck your backbone
ammeep
671
58k
GraphQLとの向き合い方2022年版
quramy
49
14k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.8k
Producing Creativity
orderedlist
PRO
348
40k
Learning to Love Humans: Emotional Interface Design
aarron
274
41k
Facilitating Awesome Meetings
lara
57
6.6k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
9.8k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.5k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Large-scale JavaScript Application Architecture
addyosmani
514
110k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
285
14k
Rails Girls Zürich Keynote
gr2m
95
14k
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