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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Hugo Visser
July 19, 2018
Technology
94
0
Share
Work, Work - WorkManager
Slided from my presentation on WorkManager at the DutchAUG IO Extended Extended meetup.
Hugo Visser
July 19, 2018
More Decks by Hugo Visser
See All by Hugo Visser
LLMs on Small devices [DutchAUG]
hugovisser
1
140
Modern Android dependency injection
hugovisser
1
270
Android dependency injection in 2022
hugovisser
1
210
Open the door!
hugovisser
0
74
Navigating the Navigation Component
hugovisser
1
160
Reactive UIs with Data Binding
hugovisser
2
170
Up close and personal with Nearby (DevFest Trondheim)
hugovisser
0
100
Up close and personal with Nearby
hugovisser
3
510
Room: the blessed object mapper
hugovisser
0
210
Other Decks in Technology
See All in Technology
みんなで作るAWS Tips 100連発 (FinOps編)
schwrzktz
1
300
ネットワーク運用を楽にするAWS DevOps Agent活用法!! / 20260421 Masaki Okuda
shift_evolve
PRO
2
210
Eight Engineering Unit 紹介資料
sansan33
PRO
3
7.3k
Rebirth of Software Craftsmanship in the AI Era
lemiorhan
PRO
4
2k
AIはハッカーを減らすのか、増やすのか?──現役ホワイトハッカーから見るAI時代のリアル【MEGU-Meet】
cscengineer
0
160
#jawsugyokohama 100 LT11, "My AWS Journey 2011-2026 - kwntravel"
shinichirokawano
0
350
「責任あるAIエージェント」こそ自社で開発しよう!
minorun365
9
2k
Revisiting [CLS] and Patch Token Interaction in Vision Transformers
yu4u
0
360
研究開発部メンバーの働き⽅ / Sansan R&D Profile
sansan33
PRO
4
23k
Good Enough Types: Heuristic Type Inference for Ruby
riseshia
1
220
Oracle AI Database@AWS:サービス概要のご紹介
oracle4engineer
PRO
4
2.4k
コードや知識を組み込む / Incorporate Code and Knowledge
ks91
PRO
0
150
Featured
See All Featured
Java REST API Framework Comparison - PWX 2021
mraible
34
9.3k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
450
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.8k
How to Talk to Developers About Accessibility
jct
2
180
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
180
The SEO identity crisis: Don't let AI make you average
varn
0
440
How to train your dragon (web standard)
notwaldorf
97
6.6k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.4k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
170
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