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
730
運用から学ぶ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
280
Deep Linksをはじめよう
ymnder
0
360
Introduction to Wear OS Application Development
ymnder
0
490
CircleCIを使ったAndroidの開発フローの効率化とtips
ymnder
1
1.3k
Introduction to new features of Google Play Billing
ymnder
2
290
What’s new in Google Play Billing v1.2
ymnder
0
690
詳解定期購入
ymnder
7
6.2k
社内向けライブラリを設計・運用する話
ymnder
0
1k
What’s new in Google Play Billing
ymnder
2
2.1k
Other Decks in Programming
See All in Programming
Conform を推す - Advocating for Conform
mizoguchicoji
3
690
JavaScriptツール群「UnJS」を5分で一気に駆け巡る!
k1tikurisu
9
1.8k
DROBEの生成AI活用事例 with AWS
ippey
0
130
How mixi2 Uses TiDB for SNS Scalability and Performance
kanmo
37
14k
富山発の個人開発サービスで日本中の学校の業務を改善した話
krpk1900
4
390
2,500万ユーザーを支えるSREチームの6年間のスクラムのカイゼン
honmarkhunt
6
5.3k
仕様変更に耐えるための"今の"DRY原則を考える / Rethinking the "Don't repeat yourself" for resilience to specification changes
mkmk884
0
240
チームリードになって変わったこと
isaka1022
0
200
メンテが命: PHPフレームワークのコンテナ化とアップグレード戦略
shunta27
0
120
密集、ドキュメントのコロケーション with AWS Lambda
satoshi256kbyte
0
190
sappoRo.R #12 初心者セッション
kosugitti
0
250
XStateを用いた堅牢なReact Components設計~複雑なClient Stateをシンプルに~ @React Tokyo ミートアップ #2
kfurusho
1
910
Featured
See All Featured
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
133
33k
Git: the NoSQL Database
bkeepers
PRO
427
64k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
How STYLIGHT went responsive
nonsquared
98
5.4k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
12
960
RailsConf 2023
tenderlove
29
1k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
Large-scale JavaScript Application Architecture
addyosmani
511
110k
Facilitating Awesome Meetings
lara
52
6.2k
Intergalactic Javascript Robots from Outer Space
tanoku
270
27k
GraphQLの誤解/rethinking-graphql
sonatard
68
10k
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