Share
Embed
What’s new in Google Play Billing
potatotips#52 @FOLIO 2018/06/21
https://potatotips.connpass.com/event/88164/
ymnder
June 21, 2018
Transcript
27 slides
-
ࠓͷ͓ॻ͖ • ࠓ͢͜ͱ • What’s new in Play Store App
• What’s new in Play Billing Library • ࠓ͞ͳ͍͜ͱ • What’s new in Play Console • What’s new in Play Billing API • What’s new in Play Billing Test • Getting started with Play Billing Library 2 -
ᶃWhat’s new in Play Store App • ཧը໘ͷมߋ • Discover
New • Manage • Backup FOP • ΞϓϦͱͷ࿈ܞ • Deep Link • ղੳͷڧԽ • Cancel Survey 3 -
ᶃཧը໘ͷมߋ • ఆظߪೖใ • ܖϓϥϯ • ܖͷߋ৽ • ࢧ͍ใ •
ࢧ͍ํ๏ͷߋ৽ • ༧උͷࢧ͍ํ๏ • ref: Account Hold • ղͱ࠶։ • RTDN • http://g.co/play/billing-rtdn 6 -
ᶃΞϓϦͱͷ࿈ܞ: Deep Link • https://play.google.com/store/account/subscriptions? sku=XXX&package=YYY • ࠓ·ͰΞϓϦ͔Βཧը໘Λ։͚ͳ͔ͬͨ • ಋઢ͕ඇৗʹ͔Γʹ͍͘
• ࣗͷΞϓϦͷఆظߪೖͷཧը໘ʹભҠՄೳ • ࢧΤϥʔͷमਖ਼ղͳͲ 7 -
ᶄWhat’s new in Play Billing Library: v1.1 • Play Billing
Library is updated: 2018/5/7 • ᶃBillingFlowParamsʹproration mode͕ࢦఆͰ͖ΔΑ ͏ʹͳͬͨ • ᶄlaunchBillingFlow()Λߦͬͨͱ͖ʹcallbackʹࣦഊ࣌ Ϩεϙϯε͕͞ΕΔΑ͏ʹͳͬͨ 9 -
ᶄproration mode: ൺྫ • ఆظߪೖͷΞοϓάϨʔυʗμϯάϨʔυΛߦ͏ • skuIdΛ৽͍͠ʹஔ͖͑Δ • replaceSkusProrationModeΛ͏ •
ैདྷͷreplaceSkusProrationαϙʔτ͞Εͳ͘ͳͬͨ 10 -
ᶄproration mode 11 val flowParams = BillingFlowParams.newBuilder() .setSku(skuId) .setType(billingType) .setOldSku(oldSkus)
.setReplaceSkusProrationMode(replaceSkusProrationMode) .build() public Builder setReplaceSkusProrationMode(@ProrationMode int replaceSkusProrationMode) { this.mReplaceSkusProrationMode = replaceSkusProrationMode; return this; } public Builder setReplaceSkusProration(boolean bReplaceSkusProration) { mParams.mNotReplaceSkusProration = !bReplaceSkusProration; return this; } ☓ -
ᶄproration mode: v1.1 12 /** * Specifies the mode of
proration during subscription upgrade/downgrade. This value will only * be effective if oldSkus is set. * * <p> If you set this to NO_PRORATION, the user does not receive credit or charge, and the * recurrence date does not change. * * <p>If you set this to PRORATE_BY_TIME, Google Play swaps out the old SKUs and credits the * user with the unused value of their subscription time on a pro-rated basis. Google Play * applies this credit to the new subscription, and does not begin billing the user for the new * subscription until after the credit is used up. * * <p>If you set this to PRORATE_BY_PRICE, Google Play swaps out the old SKUs and keeps the * recurrence date not changed. User will be charged for the price differences to cover the * time till next recurrence date. * * <p>Optional: * * <ul> * <li>To buy in-app item * <li>To create a new subscription * <li>To replace an old subscription * </ul> */ public Builder setReplaceSkusProrationMode(@ProrationMode int replaceSkusProrationMode) { this.mReplaceSkusProrationMode = replaceSkusProrationMode; return this; } -
ᶄproration mode: v1.0 13 /** * Specify an optional flag
indicating whether the user should be credited for any unused * subscription time on the SKUs they are upgrading or downgrading. * * <p>If you set this field to false, the user does not receive credit for any unused * subscription time and the recurrence date does not change. Otherwise, Google Play swaps out * the old SKUs and credits the user with the unused value of their subscription time on a * pro-rated basis. Google Play applies this credit to the new subscription, and does not begin * billing the user for the new subscription until after the credit is used up. * * <p>Optional: * * <ul> * <li>To buy in-app item * <li>To create a new subscription * <li>To replace an old subscription * </ul> */ public Builder setReplaceSkusProration(boolean bReplaceSkusProration) { mParams.mNotReplaceSkusProration = !bReplaceSkusProration; return this; } -
ᶄproration mode: from document • IMMEDIATE_WITH_TIME_PRORATION: default • IDͷஔ͖͑ͪʹ༗ޮʹͳ৽͍͠༗ޮظݶൺྫ ͯ͠ܭࢉ͞ΕɺϢʔβʔʹٻ͞ΕΔ
• IMMEDIATE_AND_CHARGE_PRORATED_PRICE • IDͷஔ͖͑ͪʹ༗ޮʹͳΓɺٻαΠΫϧಉ͡ ··ͰɺΓͷظؒͷྉ͕ۚ՝ۚ͞ΕΔʢupgrade onlyʣ • IMMEDIATE_WITHOUT_PRORATION • IDͷஔ͖͑ͪʹ༗ޮʹͳΓɺٻαΠΫϧಉ͡ ··Ͱɺ࣍ͷٻαΠΫϧ࣌ʹ৽͍͠Ձ͕֨ద༻͞ΕΔ 14 -
ᶄproration mode • IMMEDIATE_WITH_TIME_PRORATION 16 4/1 5/1 A B 4/15
{ $1(15days) { $1(10days) 4/26 $3 طʹࢧͬͨΛॆ -
ᶄproration mode • IMMEDIATE_AND_CHARGE_PRORATED_PRICE 17 4/1 5/1 A B 4/15
{ $1(15days) { $1.5(15days) ࠩͷ+$0.5Λٻ $3 -
ᶄproration mode • IMMEDIATE_WITHOUT_PRORATION 18 4/1 5/1 A B 4/15
{ $2(15days) Ճٻͳ͘Ҡߦ $3 -
ᶄproration mode • IMMEDIATE_WITH_TIME_PRORATION • ׂΓܭࢉΛߦ͍ͷΫϨδοτΛॆ͢Δ • ΫϨδοτΛ͍ͬͨΒ࣍ͷఆظߪೖΛ։࢝͢Δ • ৽͍͠ߪೖαΠΫϧͱͳΔ
• IMMEDIATE_AND_CHARGE_PRORATED_PRICE • ఆظߪೖ͢Δͷʹ͍͘Β͔͔Δ͔ܭࢉ͢Δ • ࠓͷΫϨδοτͱൺֱ͠Γͳֹ͍ΛՃٻ͢Δ • ߪೖαΠΫϧಉ͡ • IMMEDIATE_WITHOUT_PRORATION • Ճٻ͠ͳ͍ • ߪೖαΠΫϧಉ͡ 19 -
ᶄlaunchBillingFlow calls listener on fail • launchBillingFlow()Λߦͬͨͱ͖ʹcallbackʹࣦഊ࣌ Ϩεϙϯε͕͞ΕΔΑ͏ʹͳͬͨ • ࠓ·Ͱޭ͔࣌͠listener͕ݺΕͳ͔ͬͨ
22 public interface PurchasesUpdatedListener { void onPurchasesUpdated(@BillingResponse int responseCode, @Nullable List<Purchase> purchases); } -
ᶄlaunchBillingFlow: v1.0 23 @Override public int launchBillingFlow(Activity activity, BillingFlowParams params)
{ if (!isReady()) { return BillingResponse.SERVICE_DISCONNECTED; } @SkuType String skuType = params.getSkuType(); String newSku = params.getSku(); // Checking for mandatory params fields if (newSku == null) { BillingHelper.logWarn(TAG, "Please fix the input params. SKU can't be null."); return BillingResponse.DEVELOPER_ERROR; } … } -
ᶄlaunchBillingFlow: v1.1 24 private int broadcastFailureAndReturnBillingResponse(@BillingResponse int responseCode) { mBroadcastManager.getListener().onPurchasesUpdated(responseCode,
/* List<Purchase>= */null); return responseCode; } @Override public int launchBillingFlow(Activity activity, BillingFlowParams params) { if (!isReady()) { return broadcastFailureAndReturnBillingResponse(BillingResponse.SERVICE_DISCONNECTED); } @SkuType String skuType = params.getSkuType(); String newSku = params.getSku(); // Checking for mandatory params fields if (newSku == null) { BillingHelper.logWarn(TAG, "Please fix the input params. SKU can't be null."); return broadcastFailureAndReturnBillingResponse(BillingResponse.DEVELOPER_ERROR); } … } -
Note • Grow and optimize your subscriptions with new Google
Play features • https://youtu.be/x1AYelepG6o • Code samples: library is v1.0 • https://github.com/googlesamples/android-play- billing/tree/master/ClassyTaxi/android/ClassyTaxi 25 -
whoami • twitter:@ymnd, github:@ymnder • Application Engineer • Android ܦిࢠ൛ΞϓϦ
• Android ࢴ໘ϏϡʔΞʔΞϓϦ • ܦిࢠͷຊʢిࢠ൛ʣ͜͜ʹ͋Γ·͢ • https://goo.gl/7Qd6Dh • ٕज़ϒϩάʹԣॻ͖ͷهࣄΛܝࡌͯ͋͠Γ·͢ • https://hack.nikkei.com/blog 26