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
700
運用から学ぶ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
Deep Linksをはじめよう
ymnder
0
260
Introduction to Wear OS Application Development
ymnder
0
350
CircleCIを使ったAndroidの開発フローの効率化とtips
ymnder
1
1.1k
Introduction to new features of Google Play Billing
ymnder
2
270
What’s new in Google Play Billing v1.2
ymnder
0
670
詳解定期購入
ymnder
7
5.7k
社内向けライブラリを設計・運用する話
ymnder
0
820
What’s new in Google Play Billing
ymnder
2
1.9k
電子の本ができるまで
ymnder
0
460
Other Decks in Programming
See All in Programming
incrementalモデルの理解を深める
ikkimiyazaki
2
640
[スクリプト] Swiftの型推論を学ぼう
omochi
0
120
デザインシステムで Tailwind CSSとCSS in JSに分散投資をしたら良かった話
fsubal
14
3.4k
Honoとhtmx
yusukebe
6
1.2k
Crafting a Own PHP - ウキウキ手作りミニマリストPHP
uzulla
4
1.1k
Deno に Web 標準 API を実装する / Implementing Web Standard API to Deno
petamoriken
0
350
導入から5年が経って見えた Datadog APM 運用の課題
bgpat
2
540
RubyVM を PHP で実装する 〜Hello World を出力するまで〜
memory1994
PRO
1
490
ONE WEDGE_Company_Information
1wedge
0
180
Laravel OpenAPIによる"辛くない"スキーマ駆動開発
kentaroutakeda
2
2.1k
オブジェクト指向は必要なのか / Is object-oriented needed?
kishida
27
19k
Prepare for Jakarta EE 11 - Performance and Developer Productivity
ivargrimstad
0
510
Featured
See All Featured
Making the Leap to Tech Lead
cromwellryan
123
8.4k
Reflections from 52 weeks, 52 projects
jeffersonlam
343
19k
Raft: Consensus for Rubyists
vanstee
130
6.2k
Practical Orchestrator
shlominoach
180
9.7k
What the flash - Photography Introduction
edds
64
11k
Build The Right Thing And Hit Your Dates
maggiecrowley
23
1.9k
Why Our Code Smells
bkeepers
PRO
330
56k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
11
1.4k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
225
51k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
8
8.2k
Teambox: Starting and Learning
jrom
126
8.4k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
355
22k
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