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
運用から学ぶPlay Billing Library
Search
ymnder
April 10, 2019
Programming
2
740
運用から学ぶPlay Billing Library
In-tamachi Billing Night, 2019/04/10 20:00-20:10
https://billing-night.connpass.com/event/125510/
ymnder
April 10, 2019
Tweet
Share
More Decks by ymnder
See All by ymnder
What’s new in Google Play's billing system
ymnder
1
330
Deep Linksをはじめよう
ymnder
0
390
Introduction to Wear OS Application Development
ymnder
0
520
CircleCIを使ったAndroidの開発フローの効率化とtips
ymnder
1
1.3k
Introduction to new features of Google Play Billing
ymnder
2
310
What’s new in Google Play Billing v1.2
ymnder
0
710
詳解定期購入
ymnder
7
6.3k
社内向けライブラリを設計・運用する話
ymnder
0
1.1k
What’s new in Google Play Billing
ymnder
2
2.1k
Other Decks in Programming
See All in Programming
Blueskyのプラグインを作ってみた
hakkadaikon
1
290
AIにコードを生成するコードを作らせて、再現性を担保しよう! / Let AI generate code to ensure reproducibility
yamachu
7
6.1k
Perlで痩せる
yuukis
1
660
Cursor Meetup Tokyo ゲノミクスとCursor: 進化と制約のあいだ
koido
1
320
技術的負債と戦略的に戦わざるを得ない場合のオブザーバビリティ活用術 / Leveraging Observability When Strategically Dealing with Technical Debt
yoshiyoshifujii
0
160
Building an Application with TDD, DDD and Hexagonal Architecture - Isn't it a bit too much?
mufrid
0
370
List Unfolding - 'unfold' as the Computational Dual of 'fold', and how 'unfold' relates to 'iterate'"
philipschwarz
PRO
0
140
ソフトウェア品質特性、意識してますか?AIの真の力を引き出す活用事例 / ai-and-software-quality
minodriven
19
6.7k
FastMCPでMCPサーバー/クライアントを構築してみる
ttnyt8701
2
100
Javaに鉄道指向プログラミング (Railway Oriented Pro gramming) のエッセンスを取り入れる/Bringing the Essence of Railway-Oriented Programming to Java
cocet33000
1
130
型安全なDrag and Dropの設計を考える
yudppp
5
660
技術懸念に立ち向かい 法改正を穏便に乗り切った話
pop_cashew
0
830
Featured
See All Featured
Building Applications with DynamoDB
mza
95
6.4k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
331
21k
VelocityConf: Rendering Performance Case Studies
addyosmani
329
24k
The Cost Of JavaScript in 2023
addyosmani
49
8.1k
Making Projects Easy
brettharned
116
6.2k
Done Done
chrislema
184
16k
How GitHub (no longer) Works
holman
314
140k
Testing 201, or: Great Expectations
jmmastey
42
7.5k
The World Runs on Bad Software
bkeepers
PRO
68
11k
A designer walks into a library…
pauljervisheath
205
24k
Art, The Web, and Tiny UX
lynnandtonic
298
21k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
180
53k
Transcript
Play Billing Library In-tamachi Billing Night, 2019/04/10 20:00-20:10
whoami twitter:@ymnd, github:@ymnder Application Engineer Android Android [ -02] Nikkei
Development Book VOL 2 [ -08] hifumi https://riconken.bitbucket.io/hifumi/ 2
Otemachi.swift#3 iOS App by ikai https://nikkei.connpass.com/event/123343/ 3
Today s menu 4
None
: Google Play Billing Library Google Play Store In-app Billing
API wrap 6
: startConnection isReady querySkuDetailsAsync 7
: startConnection querySkuDetailsAsync launchBilling ow PurchasesUpdatedListener 8
: 9 SFNPUF MPDBM SFQPTJUPSZ VTFDBTF QSFTFOUFS WJFX
: Remote Local Repository interface RxJava Single Completable Remote BillingClient
DroidKaigi 2019 10
Repository 11 class PlayBillingRepositoryImpl @Inject constructor( private val remote: RemotePlayBilling
) : PlayBillingRepository { override fun startSubscription(activity: Activity, skuId: String): Observable<PurchaseResponse> { return remote.connect() .flatMapObservable { remote.querySkuDetailsAsync(skuId).flatMapObservable { response -> remote.launchBillingFlow(activity, response.skuDetailsList.first()) .flatMapObservable { remote.observePurchasesUpdated() .flatMap { if (it.result != BillingClient.BillingResponse.OK) { return@flatMap Observable.error<PurchasesUpdatedResponse>(…) } return@flatMap Observable.just(it) } //… } } } } }
Repository 12 class PlayBillingRepositoryImpl @Inject constructor( private val remote: RemotePlayBilling
) : PlayBillingRepository { override fun startSubscription(activity: Activity, skuId: String): Observable<PurchaseResponse> { return remote.connect() .flatMapObservable { remote.querySkuDetailsAsync(skuId).flatMapObservable { response -> remote.launchBillingFlow(activity, response.skuDetailsList.first()) .flatMapObservable { remote.observePurchasesUpdated() .flatMap { if (it.result != BillingClient.BillingResponse.OK) { return@flatMap Observable.error<PurchasesUpdatedResponse>(…) } return@flatMap Observable.just(it) } //… } } } } }
13 billing.startSubscription(this@BillingActivity, skuId) .subscribe({ //ߪೖॲཧ͕ޭͨ͠ }, { //ߪೖॲཧ͕ࣦഊͨ͠ Toast.makeText(this@BillingActivity, it.message,
Toast.LENGTH_SHORT).show() })
:BillingActivity Activity 14
: 15
None
BillingClient BillingClient 17
18
19
BillingClient API queryPurchaseHistoryAsync 20
queryPurchaseHistoryAsync ID 1 21
22
BillingClient API Purchases.subscriptions API 23
Google Play Billing Library Purchases.subscriptions API Real-time developer noti cations
24
Nikkei Development Book VOL 2 Android / iOS ✕ /
[ -02] https://techbookfest.org/event/tbf06/circle/40320001 25
Subscription :)
https://speakerdeck.com/ymnder/xiang-jie-ding-qi-gou-ru What's new in Google Play Billing v1.0 -> v1.1
https://speakerdeck.com/ymnder/whats-new-in-google-play-billing What's new in Google Play Billing v1.2 v1.1 -> v1.2 https://speakerdeck.com/ymnder/whats-new-in-google-play-billing-v1-dot-2 27