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
720
運用から学ぶ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
170
Deep Linksをはじめよう
ymnder
0
320
Introduction to Wear OS Application Development
ymnder
0
450
CircleCIを使ったAndroidの開発フローの効率化とtips
ymnder
1
1.2k
Introduction to new features of Google Play Billing
ymnder
2
280
What’s new in Google Play Billing v1.2
ymnder
0
680
詳解定期購入
ymnder
7
6k
社内向けライブラリを設計・運用する話
ymnder
0
950
What’s new in Google Play Billing
ymnder
2
2k
Other Decks in Programming
See All in Programming
GCCのプラグインを作る / I Made a GCC Plugin
shouth
1
150
Kaigi on Rails 2024 - Rails APIモードのためのシンプルで効果的なCSRF対策 / kaigionrails-2024-csrf
corocn
5
3.4k
Pinia Colada が実現するスマートな非同期処理
naokihaba
2
160
AWS IaCの注目アップデート 2024年10月版
konokenj
3
3.1k
Content Security Policy入門 セキュリティ設定と 違反レポートのはじめ方 / Introduction to Content Security Policy Getting Started with Security Configuration and Violation Reporting
uskey512
1
430
Vue SFCのtemplateでTypeScriptの型を活用しよう
tsukkee
3
1.5k
Dev ContainersとGitHub Codespacesの素敵な関係
ymd65536
1
130
ECSのサービス間通信 4つの方法を比較する 〜Canary,Blue/Greenも添えて〜
tkikuc
11
2.3k
GitHub Actionsのキャッシュと手を挙げることの大切さとそれに必要なこと
satoshi256kbyte
5
390
2万ページのSSG運用における工夫と注意点 / Vue Fes Japan 2024
chinen
3
1.3k
Vaporモードを大規模サービスに最速導入して学びを共有する
kazukishimamoto
4
4.3k
生成 AI を活用した toitta 切片分類機能の裏側 / Inside toitta's AI-Based Factoid Clustering
pokutuna
0
580
Featured
See All Featured
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
Art, The Web, and Tiny UX
lynnandtonic
296
20k
Speed Design
sergeychernyshev
24
570
Gamification - CAS2011
davidbonilla
80
5k
Adopting Sorbet at Scale
ufuk
73
9k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
167
49k
A Tale of Four Properties
chriscoyier
156
23k
Building Better People: How to give real-time feedback that sticks.
wjessup
363
19k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
Rails Girls Zürich Keynote
gr2m
93
13k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
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