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
68
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
47
Navigating the Navigation Component
hugovisser
1
130
Reactive UIs with Data Binding
hugovisser
2
140
Up close and personal with Nearby (DevFest Trondheim)
hugovisser
0
69
Up close and personal with Nearby
hugovisser
3
460
Room: the blessed object mapper
hugovisser
0
190
Other Decks in Technology
See All in Technology
あなたの声を届けよう! 女性エンジニア登壇の意義とアウトプット実践ガイド #wttjp / Call for Your Voice
kondoyuko
4
450
Claude Code Actionを使ったコード品質改善の取り組み
potix2
PRO
6
2.3k
Fabric + Databricks 2025.6 の最新情報ピックアップ
ryomaru0825
1
140
20250625 Snowflake Summit 2025活用事例 レポート / Nowcast Snowflake Summit 2025 Case Study Report
kkuv
1
310
データプラットフォーム技術におけるメダリオンアーキテクチャという考え方/DataPlatformWithMedallionArchitecture
smdmts
5
630
TechLION vol.41~MySQLユーザ会のほうから来ました / techlion41_mysql
sakaik
0
180
エンジニア向け技術スタック情報
kauche
1
260
Amazon ECS & AWS Fargate 運用アーキテクチャ2025 / Amazon ECS and AWS Fargate Ops Architecture 2025
iselegant
16
5.5k
“社内”だけで完結していた私が、AWS Community Builder になるまで
nagisa53
1
390
AWS Summit Japan 2025 Community Stage - App workflow automation by AWS Step Functions
matsuihidetoshi
1
260
フィンテック養成勉強会#54
finengine
0
180
強化されたAmazon Location Serviceによる新機能と開発者体験
dayjournal
2
210
Featured
See All Featured
Into the Great Unknown - MozCon
thekraken
39
1.9k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
124
52k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
44
2.4k
Designing for Performance
lara
609
69k
The World Runs on Bad Software
bkeepers
PRO
69
11k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
7
700
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
31
1.2k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
Scaling GitHub
holman
459
140k
Intergalactic Javascript Robots from Outer Space
tanoku
271
27k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
657
60k
Site-Speed That Sticks
csswizardry
10
660
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