Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
いまさらWorkManager
Search
Yoshihiro WADA
January 28, 2019
Programming
1k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
いまさらWorkManager
2019/1/28に開催されたPotatotips #58にて発表した資料です
Yoshihiro WADA
January 28, 2019
More Decks by Yoshihiro WADA
See All by Yoshihiro WADA
AndroidデバイスにFTPサーバを建立する
e10dokup
0
1.7k
Gradleの実行環境設定を見直す
e10dokup
0
1.4k
Firebase App Distributionのテストアプリ配信を試しやすくする
e10dokup
1
760
アプリに署名する 〜GitHub ActionsでのCIも見据えて〜
e10dokup
0
1.4k
Profileable buildでより正確なパフォーマンスを掴む
e10dokup
0
820
[DroidKaigi 2021] メディアアクセス古今東西 / Now and Future of Media Access
e10dokup
0
4.1k
今更「dp」を考える / Let's think about "dp" now
e10dokup
0
6k
1から学ぶAndroidアプリデバッグ - アプリの動作を追いかけよう / Learn Android application debugging from the scratch - track apps' behaviors
e10dokup
10
3.7k
Guide to background processingを読んでみる / Reading "Guide to background processing"
e10dokup
0
330
Other Decks in Programming
See All in Programming
APNsからLive Activityを開始する話
yumnumm
0
170
なぜCTOを降りてFDEを選んだのか?〜なぜプロダクト企業がFDEで顧客の現場に踏み込むのか〜
gonta
1
230
No More NoSuchMethodError
exoego
1
110
設計次第でAIコードの読む量は減らせる / designing-for-code-reading
minodriven
35
17k
dotNET_vulnclicker_intro.pdf
deka_morita
0
150
個人開発者よ、Honoを使え(おじさんver)
tanahiro2010
2
270
AmebaブログはKMPから卒業します
kmars0605
0
210
コードレビューのボトルネックを"する側"と"される側"の両面から解消する
yub0n
2
1.6k
GemmaをJevのように使ってみる / Use Gemma like Jev
kishida
5
820
Long Living Tokens, Die, Die, Die! (or: The One Ring is Banned in Modern)
sylph01
0
350
FactoryBotをやめればRSpecは速くなるのか?
yuta_onishi_97
0
970
Domain-Driven Transformation
hschwentner
2
2.3k
Featured
See All Featured
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Darren the Foodie - Storyboard
khoart
PRO
4
4k
WCS-LA-2024
lcolladotor
0
900
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
2
370
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
2.9k
Discover your Explorer Soul
emna__ayadi
2
1.3k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.6k
Navigating Weather and Climate Data
rabernat
0
560
Statistics for Hackers
jakevdp
799
230k
Fashionably flexible responsive web design (full day workshop)
malarkey
409
67k
brightonSEO & MeasureFest 2025 - Winning Strategies for Black Friday CRO & PPC - Christian Goodrich
cargoodrich
3
870
Unsuck your backbone
ammeep
672
58k
Transcript
WorkManager Yoshihiro Wada a.k.a. @e10dokup 2019/1/28 at Potatotips #58
a.k.a. e10dokup CyberAgent Inc. Ameba
None
2018/12/23 - 1.0.0-beta01 2019/1/15 1.0.0-beta02 2018/12/12 - 1.0.0-alpha13 Breaking Change
Codelabs WorkManager
Android Jetpack compileSdkVersion 28 API Play Services JobScheduler/AlermManager/ FirebaseJobDispatcher etc
WorkManager
Worker WorkManager WorkRequest Worker Request WorkManager Request WorkManager WorkManager WorkRequest
extends Worker doWork() Worker.Result.success() / failure() Worker class MyWorker( context:
Context, params: WorkerParameters ) : Worker(context, params) { override fun doWork(): Worker.Result { // Կ͔͠Βͷॲཧ return Worker.Result.success() } }
Worker Data build setInputData set Worker getInputData WorkRequest // WorkerʹΛ༩͑Δ
val data = Data.Builder().putString("KEY", "VALUE").build() OneTimeWorkRequest.Builder(MyWorker::class.java) .setInputData(data) .build() // WorkerͰΛऔΓग़͢ getInputData().getString("KEY")
OneTimeWorkRequest Worker Request PeriodicWorkRequest Worker Request WorkRequest
WorkManager#enqueue WorkRequest workManager = WorkManager.getInstance() val data = Data.Builder().putString("KEY", "VALUE").build()
val request = OneTimeWorkRequest.Builder(MyWorker::class.java) .setInputData(data) .build() workManager.enqueue(request)
WorkManager#beginWith Continuation then Work Continuation#enqueue Work // AWorker -> BWorker
-> CWorkerͷॱʹ࣮ߦ͞Ε͍ͯ͘WorkContinuation val continuation = workManager.beginWith(OneTimeWorkRequest.from(AWorker::class.java)) continuation.then(OneTimeWorkRequest.from(BWorker::class.java)) continuation.then(OneTimeWorkRequest.from(CWorker::class.java)) continuation.enqueue()
WorkManager#beginUniqueWork ExistingWorkPolicy REPLACE - KEEP - APPEND - Work -
var continuation = workManager.beginUniqueWork( "unique_work_id", ExistingWorkPolicy.REPLACE, OneTimeWorkRequest.from(AWorker::class.java) )
WorkRequest Constraint Work // ͕ॆిதͰ͋Δ੍ΛՃ͑Δ val constraints = Constraints.Builder() .setRequiresCharging(true)
.build() continuation = continuation.then( OneTimeWorkRequest.Builder(AWorker::class.java) .setConstraints(constraints) .build() )
NetWorkType - BatteryNotLow - Charging - StorageNotLow - DeviceIdle -
API23 Doze Idle Work
WorkRequest tag set WorkStatus uniqueId Continuation LiveData RxJava2 -> RxWorker
1.0.0-alpha12 Codelabs 2-3