From 9585d813a483e24f586736e815a1256832faf781 Mon Sep 17 00:00:00 2001 From: Alex Dibrivnyi Date: Tue, 11 Aug 2020 22:45:54 +0300 Subject: [PATCH 1/7] Add build flavors to split Amazon and Google SDK --- library/build.gradle | 17 ++++++++++--- .../com/billing}/AmazonBillingListener.kt | 4 +-- .../java/com/billing/BillingService.kt} | 12 ++++++--- .../java/com.billing/BillingService.kt} | 22 +++++++--------- .../java/com.billing}/Security.kt | 3 +-- .../{BillingService.kt => IBillingService.kt} | 2 +- .../eggheadgames/inapppayments/IAPManager.kt | 25 ++++--------------- .../inapppayments/AmazonSkuLimitTest.kt | 10 ++++---- .../inapppayments/BillingTest.java | 14 +++++------ .../inapppayments/TestConstants.java | 0 10 files changed, 51 insertions(+), 58 deletions(-) rename library/src/{main/java/com/billing/amazon => amazon/java/com/billing}/AmazonBillingListener.kt (98%) rename library/src/{main/java/com/billing/amazon/AmazonBillingService.kt => amazon/java/com/billing/BillingService.kt} (79%) rename library/src/{main/java/com/billing/google/GoogleBillingService2.kt => google/java/com.billing/BillingService.kt} (93%) rename library/src/{main/java/com/billing/google => google/java/com.billing}/Security.kt (99%) rename library/src/main/java/com/billing/{BillingService.kt => IBillingService.kt} (99%) rename library/src/{test => testAmazon}/java/com/eggheadgames/inapppayments/AmazonSkuLimitTest.kt (74%) rename library/src/{test => testGoogle}/java/com/eggheadgames/inapppayments/BillingTest.java (84%) rename library/src/{test => testGoogle}/java/com/eggheadgames/inapppayments/TestConstants.java (100%) diff --git a/library/build.gradle b/library/build.gradle index 2a87a90..cba419d 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -23,6 +23,14 @@ android { versionName rootProject.ext.general.versionName } + flavorDimensions "appstore" + productFlavors { + google { + } + amazon { + } + } + lintOptions { warningsAsErrors true // ok disables @@ -32,12 +40,13 @@ android { } dependencies { - implementation "androidx.core:core-ktx:1.2.0" + implementation "androidx.core:core-ktx:1.3.1" + implementation 'androidx.appcompat:appcompat:1.2.0' implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - api files('libs/in-app-purchasing-2.0.76.jar') - api 'androidx.appcompat:appcompat:1.1.0' - api 'com.android.billingclient:billing:2.2.0' + amazonImplementation files('libs/in-app-purchasing-2.0.76.jar') + + googleImplementation 'com.android.billingclient:billing:3.0.0' testImplementation 'junit:junit:4.13' testImplementation 'org.mockito:mockito-core:2.24.0' diff --git a/library/src/main/java/com/billing/amazon/AmazonBillingListener.kt b/library/src/amazon/java/com/billing/AmazonBillingListener.kt similarity index 98% rename from library/src/main/java/com/billing/amazon/AmazonBillingListener.kt rename to library/src/amazon/java/com/billing/AmazonBillingListener.kt index 50c8a0a..096336e 100644 --- a/library/src/main/java/com/billing/amazon/AmazonBillingListener.kt +++ b/library/src/amazon/java/com/billing/AmazonBillingListener.kt @@ -1,11 +1,11 @@ -package com.billing.amazon +package com.billing import android.util.Log import com.amazon.device.iap.PurchasingListener import com.amazon.device.iap.PurchasingService import com.amazon.device.iap.model.* -internal class AmazonBillingListener(private val amazonBillingService: AmazonBillingService) : PurchasingListener { +internal class AmazonBillingListener(private val amazonBillingService: BillingService) : PurchasingListener { var mDebugLog = false diff --git a/library/src/main/java/com/billing/amazon/AmazonBillingService.kt b/library/src/amazon/java/com/billing/BillingService.kt similarity index 79% rename from library/src/main/java/com/billing/amazon/AmazonBillingService.kt rename to library/src/amazon/java/com/billing/BillingService.kt index 87addec..5a036ce 100644 --- a/library/src/main/java/com/billing/amazon/AmazonBillingService.kt +++ b/library/src/amazon/java/com/billing/BillingService.kt @@ -1,13 +1,13 @@ -package com.billing.amazon +package com.billing import android.app.Activity import android.content.Context import android.content.Intent import android.net.Uri import com.amazon.device.iap.PurchasingService -import com.billing.BillingService -class AmazonBillingService(val context: Context, private val iapKeys: List) : BillingService() { +class BillingService(private val context: Context, private val inAppSkuKeys: List, + private val subscriptionSkuKeys: List) : IBillingService() { private var mAmazonBillingListener: AmazonBillingListener? = null @@ -15,7 +15,11 @@ class AmazonBillingService(val context: Context, private val iapKeys: List = ArrayList() + keys.addAll(inAppSkuKeys) + keys.addAll(subscriptionSkuKeys) + + keys.splitMessages(MAX_SKU_LIMIT).forEach { PurchasingService.getProductData(it.toSet()) } diff --git a/library/src/main/java/com/billing/google/GoogleBillingService2.kt b/library/src/google/java/com.billing/BillingService.kt similarity index 93% rename from library/src/main/java/com/billing/google/GoogleBillingService2.kt rename to library/src/google/java/com.billing/BillingService.kt index c0ce741..86ff788 100644 --- a/library/src/main/java/com/billing/google/GoogleBillingService2.kt +++ b/library/src/google/java/com.billing/BillingService.kt @@ -1,4 +1,4 @@ -package com.billing.google +package com.billing import android.app.Activity import android.content.Context @@ -6,10 +6,9 @@ import android.content.Intent import android.net.Uri import android.util.Log import com.android.billingclient.api.* -import com.billing.BillingService -class GoogleBillingService2(val context: Context, private val inAppSkuKeys: List, private val subscriptionSkuKeys: List) - : BillingService(), PurchasesUpdatedListener, BillingClientStateListener, AcknowledgePurchaseResponseListener { +class BillingService(val context: Context, private val inAppSkuKeys: List, private val subscriptionSkuKeys: List) + : IBillingService(), PurchasesUpdatedListener, BillingClientStateListener, AcknowledgePurchaseResponseListener { private lateinit var mBillingClient: BillingClient private var decodedKey: String? = null @@ -71,9 +70,11 @@ class GoogleBillingService2(val context: Context, private val inAppSkuKeys: List private fun launchBillingFlow(activity: Activity, sku: String, type: String) { sku.toSkuDetails(type) { skuDetails -> - val purchaseParams = BillingFlowParams.newBuilder() - .setSkuDetails(skuDetails).build() - mBillingClient.launchBillingFlow(activity, purchaseParams) + if (skuDetails != null) { + val purchaseParams = BillingFlowParams.newBuilder() + .setSkuDetails(skuDetails).build() + mBillingClient.launchBillingFlow(activity, purchaseParams) + } } } @@ -99,12 +100,7 @@ class GoogleBillingService2(val context: Context, private val inAppSkuKeys: List /** * Called by the Billing Library when new purchases are detected. */ - override fun onPurchasesUpdated(billingResult: BillingResult?, purchases: List?) { - if (billingResult == null) { - Log.wtf(TAG, "onSkuDetailsResponse: null BillingResult") - return - } - + override fun onPurchasesUpdated(billingResult: BillingResult, purchases: List?) { val responseCode = billingResult.responseCode val debugMessage = billingResult.debugMessage log("onPurchasesUpdated: responseCode:$responseCode debugMessage: $debugMessage") diff --git a/library/src/main/java/com/billing/google/Security.kt b/library/src/google/java/com.billing/Security.kt similarity index 99% rename from library/src/main/java/com/billing/google/Security.kt rename to library/src/google/java/com.billing/Security.kt index 34e41b3..a75255f 100644 --- a/library/src/main/java/com/billing/google/Security.kt +++ b/library/src/google/java/com.billing/Security.kt @@ -1,5 +1,4 @@ -package com.billing.google - +package com.billing import android.text.TextUtils import android.util.Base64 diff --git a/library/src/main/java/com/billing/BillingService.kt b/library/src/main/java/com/billing/IBillingService.kt similarity index 99% rename from library/src/main/java/com/billing/BillingService.kt rename to library/src/main/java/com/billing/IBillingService.kt index fd49e73..1e66a78 100644 --- a/library/src/main/java/com/billing/BillingService.kt +++ b/library/src/main/java/com/billing/IBillingService.kt @@ -5,7 +5,7 @@ import android.os.Handler import android.os.Looper import androidx.annotation.CallSuper -abstract class BillingService { +abstract class IBillingService { private val purchaseServiceListeners: MutableList = mutableListOf() private val subscriptionServiceListeners: MutableList = mutableListOf() diff --git a/library/src/main/java/com/eggheadgames/inapppayments/IAPManager.kt b/library/src/main/java/com/eggheadgames/inapppayments/IAPManager.kt index fb17261..08d8d8c 100644 --- a/library/src/main/java/com/eggheadgames/inapppayments/IAPManager.kt +++ b/library/src/main/java/com/eggheadgames/inapppayments/IAPManager.kt @@ -4,40 +4,25 @@ import android.annotation.SuppressLint import android.app.Activity import android.content.Context import com.billing.BillingService +import com.billing.IBillingService import com.billing.PurchaseServiceListener import com.billing.SubscriptionServiceListener -import com.billing.amazon.AmazonBillingService -import com.billing.google.GoogleBillingService2 -import java.util.* //Public front-end for IAP functionality. object IAPManager { - const val BUILD_TARGET_GOOGLE = 0 - const val BUILD_TARGET_AMAZON = 1 @SuppressLint("StaticFieldLeak") - private var mBillingService: BillingService? = null + private var mBillingService: IBillingService? = null /** * @param context - application context - * @param buildTarget - IAPManager.BUILD_TARGET_GOOGLE or IAPManager.BUILD_TARGET_AMAZON * @param iapKeys - list of sku for purchases * @param subscriptionKeys - list of sku for subscriptions */ @JvmStatic - fun build(context: Context, buildTarget: Int, iapKeys: List, subscriptionKeys: List = emptyList()) { + fun build(context: Context, iapKeys: List, subscriptionKeys: List = emptyList()) { val contextLocal = context.applicationContext ?: context - - //Build-specific initializations - if (buildTarget == BUILD_TARGET_GOOGLE) { - mBillingService = GoogleBillingService2(contextLocal, iapKeys, subscriptionKeys) - - } else if (buildTarget == BUILD_TARGET_AMAZON) { - val keys: MutableList = ArrayList() - keys.addAll(iapKeys) - keys.addAll(subscriptionKeys) - mBillingService = AmazonBillingService(contextLocal, keys) - } + mBillingService = BillingService(contextLocal, iapKeys, subscriptionKeys) } /** @@ -92,7 +77,7 @@ object IAPManager { } @JvmStatic - fun getBillingService(): BillingService { + fun getBillingService(): IBillingService { return mBillingService ?: let { throw RuntimeException("Call IAPManager.build to initialize billing service") } diff --git a/library/src/test/java/com/eggheadgames/inapppayments/AmazonSkuLimitTest.kt b/library/src/testAmazon/java/com/eggheadgames/inapppayments/AmazonSkuLimitTest.kt similarity index 74% rename from library/src/test/java/com/eggheadgames/inapppayments/AmazonSkuLimitTest.kt rename to library/src/testAmazon/java/com/eggheadgames/inapppayments/AmazonSkuLimitTest.kt index 4abd4b9..c4dbdd2 100644 --- a/library/src/test/java/com/eggheadgames/inapppayments/AmazonSkuLimitTest.kt +++ b/library/src/testAmazon/java/com/eggheadgames/inapppayments/AmazonSkuLimitTest.kt @@ -1,7 +1,7 @@ package com.eggheadgames.inapppayments -import com.billing.amazon.AmazonBillingService -import com.billing.amazon.splitMessages +import com.billing.BillingService +import com.billing.splitMessages import org.junit.Assert import org.junit.Test @@ -14,7 +14,7 @@ class AmazonSkuLimitTest { iapKeys.add("sku_$i") } - val splitMessages = iapKeys.splitMessages(AmazonBillingService.MAX_SKU_LIMIT) + val splitMessages = iapKeys.splitMessages(BillingService.MAX_SKU_LIMIT) Assert.assertEquals(3, splitMessages.size) @@ -30,7 +30,7 @@ class AmazonSkuLimitTest { iapKeys.add("sku_$i") } - val splitMessages = iapKeys.splitMessages(AmazonBillingService.MAX_SKU_LIMIT) + val splitMessages = iapKeys.splitMessages(BillingService.MAX_SKU_LIMIT) Assert.assertEquals(1, splitMessages.size) @@ -42,7 +42,7 @@ class AmazonSkuLimitTest { fun checkSkuListSize_ShouldReturn0() { val iapKeys = mutableListOf() - val splitMessages = iapKeys.splitMessages(AmazonBillingService.MAX_SKU_LIMIT) + val splitMessages = iapKeys.splitMessages(BillingService.MAX_SKU_LIMIT) Assert.assertEquals(0, splitMessages.size) } diff --git a/library/src/test/java/com/eggheadgames/inapppayments/BillingTest.java b/library/src/testGoogle/java/com/eggheadgames/inapppayments/BillingTest.java similarity index 84% rename from library/src/test/java/com/eggheadgames/inapppayments/BillingTest.java rename to library/src/testGoogle/java/com/eggheadgames/inapppayments/BillingTest.java index 1f802d4..6c9c58f 100644 --- a/library/src/test/java/com/eggheadgames/inapppayments/BillingTest.java +++ b/library/src/testGoogle/java/com/eggheadgames/inapppayments/BillingTest.java @@ -23,7 +23,7 @@ public class BillingTest { @Test public void onProductOwnedEvent_eachRegisteredListenerShouldBeTriggered() throws Exception { - IAPManager.build(context, IAPManager.BUILD_TARGET_GOOGLE, new ArrayList(), new ArrayList()); + IAPManager.build(context, new ArrayList(), new ArrayList()); PurchaseServiceListener firstListener = Mockito.spy(PurchaseServiceListener.class); IAPManager.addPurchaseListener(firstListener); @@ -39,7 +39,7 @@ public void onProductOwnedEvent_eachRegisteredListenerShouldBeTriggered() throws @Test public void onProductDetailsFetched_eachRegisteredListenerShouldBeTriggered() { - IAPManager.build(context, IAPManager.BUILD_TARGET_GOOGLE, new ArrayList(), new ArrayList()); + IAPManager.build(context, new ArrayList(), new ArrayList()); PurchaseServiceListener firstListener = Mockito.spy(PurchaseServiceListener.class); IAPManager.addPurchaseListener(firstListener); @@ -59,7 +59,7 @@ public void onProductDetailsFetched_eachRegisteredListenerShouldBeTriggered() { @Test public void onIapManagerInteraction_onlyRegisteredListenersShouldBeTriggered() { - IAPManager.build(context, IAPManager.BUILD_TARGET_GOOGLE, new ArrayList(), new ArrayList()); + IAPManager.build(context, new ArrayList(), new ArrayList()); PurchaseServiceListener firstListener = Mockito.spy(PurchaseServiceListener.class); IAPManager.addPurchaseListener(firstListener); @@ -78,7 +78,7 @@ public void onIapManagerInteraction_onlyRegisteredListenersShouldBeTriggered() { @Test public void onProductPurchase_purchaseCallbackShouldBeTriggered() { - IAPManager.build(context, IAPManager.BUILD_TARGET_GOOGLE, new ArrayList(), new ArrayList()); + IAPManager.build(context, new ArrayList(), new ArrayList()); PurchaseServiceListener listener = Mockito.spy(PurchaseServiceListener.class); IAPManager.addPurchaseListener(listener); @@ -90,7 +90,7 @@ public void onProductPurchase_purchaseCallbackShouldBeTriggered() { @Test public void onProductRestore_restoreCallbackShouldBeTriggered() { - IAPManager.build(context, IAPManager.BUILD_TARGET_GOOGLE, new ArrayList(), new ArrayList()); + IAPManager.build(context, new ArrayList(), new ArrayList()); PurchaseServiceListener listener = Mockito.spy(PurchaseServiceListener.class); IAPManager.addPurchaseListener(listener); @@ -102,7 +102,7 @@ public void onProductRestore_restoreCallbackShouldBeTriggered() { @Test public void onSubscriptionPurchase_purchaseCallbackShouldBeTriggered() { - IAPManager.build(context, IAPManager.BUILD_TARGET_GOOGLE, new ArrayList(), new ArrayList()); + IAPManager.build(context, new ArrayList(), new ArrayList()); SubscriptionServiceListener listener = Mockito.spy(SubscriptionServiceListener.class); IAPManager.addSubscriptionListener(listener); @@ -114,7 +114,7 @@ public void onSubscriptionPurchase_purchaseCallbackShouldBeTriggered() { @Test public void onSubscriptionRestore_restoreCallbackShouldBeTriggered() { - IAPManager.build(context, IAPManager.BUILD_TARGET_GOOGLE, new ArrayList(), new ArrayList()); + IAPManager.build(context, new ArrayList(), new ArrayList()); SubscriptionServiceListener listener = Mockito.spy(SubscriptionServiceListener.class); IAPManager.addSubscriptionListener(listener); diff --git a/library/src/test/java/com/eggheadgames/inapppayments/TestConstants.java b/library/src/testGoogle/java/com/eggheadgames/inapppayments/TestConstants.java similarity index 100% rename from library/src/test/java/com/eggheadgames/inapppayments/TestConstants.java rename to library/src/testGoogle/java/com/eggheadgames/inapppayments/TestConstants.java From 07dd5ccd4777f7db8a70637a2132a7995c505df4 Mon Sep 17 00:00:00 2001 From: Alex Dibrivnyi Date: Wed, 12 Aug 2020 20:36:22 +0300 Subject: [PATCH 2/7] Add defaultPublishConfig to gradle file --- library/build.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/library/build.gradle b/library/build.gradle index cba419d..06cd8c6 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -23,11 +23,15 @@ android { versionName rootProject.ext.general.versionName } + defaultPublishConfig "googleRelease" + flavorDimensions "appstore" productFlavors { google { + dimension "appstore" } amazon { + dimension "appstore" } } From f50ecb90ba0d18f70a1469a226e4b01dfba9b7cf Mon Sep 17 00:00:00 2001 From: Alex Dibrivnyi Date: Wed, 12 Aug 2020 21:14:32 +0300 Subject: [PATCH 3/7] (Test commit) Try artifact config for jitpack flavours fix --- library/build.gradle | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/library/build.gradle b/library/build.gradle index 06cd8c6..6b9169d 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -23,8 +23,6 @@ android { versionName rootProject.ext.general.versionName } - defaultPublishConfig "googleRelease" - flavorDimensions "appstore" productFlavors { google { @@ -73,4 +71,31 @@ staticAnalysis { excludeFilter rootProject.file('library/findbugs_excludes.xml') } +} + +task sourcesJar(type: Jar) { + classifier = 'sources' + from android.sourceSets.main.javaDirectories +} + +artifacts { + archives sourcesJar +} + +if (android.productFlavors.size() > 0) { + android.libraryVariants.all { variant -> + if (variant.name.toLowerCase().contains("debug")) { + return + } + + def bundleTask = tasks["bundle${variant.name.capitalize()}Aar"] + + artifacts { + archives(bundleTask.archivePath) { + classifier variant.flavorName + builtBy bundleTask + name = project.name + } + } + } } \ No newline at end of file From 0a098f6c11ce48b7b3692cd1d4e1acdef2cc5cfc Mon Sep 17 00:00:00 2001 From: Alex Dibrivnyi Date: Wed, 12 Aug 2020 22:48:53 +0300 Subject: [PATCH 4/7] Change billing libraries from implementation to api --- library/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/build.gradle b/library/build.gradle index 6b9169d..0f4158c 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -46,9 +46,9 @@ dependencies { implementation 'androidx.appcompat:appcompat:1.2.0' implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - amazonImplementation files('libs/in-app-purchasing-2.0.76.jar') + amazonApi files('libs/in-app-purchasing-2.0.76.jar') - googleImplementation 'com.android.billingclient:billing:3.0.0' + googleApi 'com.android.billingclient:billing:3.0.0' testImplementation 'junit:junit:4.13' testImplementation 'org.mockito:mockito-core:2.24.0' From e2e98f4146d5d152d5453e4a1be1e8815c6c9514 Mon Sep 17 00:00:00 2001 From: Alex Dibrivnyi Date: Thu, 13 Aug 2020 00:31:49 +0300 Subject: [PATCH 5/7] Add comments to the gradle.build --- library/build.gradle | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/library/build.gradle b/library/build.gradle index 0f4158c..f424a0e 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -73,6 +73,9 @@ staticAnalysis { } } +// the following code is used to force jitpack to build different builds for each flavour. +// If you change it, please make sure that it builds correctly, since billing library is used on the all Eggheadgames apps. +// START JITPACK ARTIFACTS CONFIG task sourcesJar(type: Jar) { classifier = 'sources' from android.sourceSets.main.javaDirectories @@ -98,4 +101,5 @@ if (android.productFlavors.size() > 0) { } } } -} \ No newline at end of file +} +// END JITPACK ARTIFACTS CONFIG \ No newline at end of file From ca6f3e1e402036f38552edadf51eeb7a4643c6c0 Mon Sep 17 00:00:00 2001 From: Michael Mee Date: Thu, 13 Aug 2020 14:17:52 +0800 Subject: [PATCH 6/7] Update README to reflect new configuration of library --- README.md | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 89868d7..500021a 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ A simple wrapper library that provides sample Google and Amazon in-app purchase * actively maintained by [Egghead Games](http://eggheadgames.com) for their cross-platform mobile/tablet apps ([quality brain puzzles with no ads](https://play.google.com/store/apps/dev?id=8905223606155014113)!) * subscriptions for Google Play * subscriptions for Amazon + * `appstore` flavor support in version 3.0 ensures that Amazon library is not included for Google ### Not supported: * receipt validation (either local or server) @@ -46,11 +47,26 @@ allprojects { } ``` -Add a dependency to your application related `build.gradle` +Add an `appstore` flavor to your application related `build.gradle` and the corresponding google and amazon dependencies. ```gradle +android { + flavorDimensions "appstore" + productFlavors { + google { + dimension "appstore" + } + amazon { + dimension "appstore" + } +… +} + dependencies { - compile 'com.github.eggheadgames:android-in-app-payments:' + googleImplementation "com.github.eggheadgames:android-in-app-payments:x.y.z:google@aar" + googleImplementation 'com.android.billingclient:billing:3.0.0' // fixme: not sure why this is not automatic + + amazonImplementation "com.github.eggheadgames:android-in-app-payments:x.y.z:amazon@aar" } ``` @@ -59,7 +75,7 @@ dependencies { The following code snippet initializes the billing module: ```java - IAPManager.build(context, IAPManager.BUILD_TARGET_GOOGLE, skuList /*can be ignored for Google traget*/); + IAPManager.build(context, skuList, ArrayList<>()); IAPManager.addPurchaseListener(new PurchaseServiceListener() { @Override public void onPricesUpdated(Map map) { @@ -81,18 +97,18 @@ The following code snippet initializes the billing module: 1. Setup billing module. ``` -IAPManager.build(Context context, int buildTarget, List skuList) +IAPManager.build(Context context, List skuList, List subscriptionSkuList) ``` -`int buildTarget` can be either `IAPManager.BUILD_TARGET_GOOGLE` or `IAPManager.BUILD_TARGET_AMAZON` -`List skuList` - a list of products to fetch information about (relevant only for `IAPManager.BUILD_TARGET_AMAZON`) +* `List skuList` - a list of products to fetch information about +* `List subscriptionSkuList` - a list of subscription products to fetch information about (or empty if none) 2. Request info about available and owned products ``` IAPManager.init(String rot13LicenseKey) ``` -`String rot13LicenseKey` is relevant only for `IAPManager.BUILD_TARGET_GOOGLE`, and can be ignored for `IAPManager.BUILD_TARGET_AMAZON`. Note that this is the required Google License Key obtained from the app's Google Play console, after applying the [ROT 13 algorithm](https://en.wikipedia.org/wiki/ROT13). +`String rot13LicenseKey` is relevant only for the `google` flavor, and can be ignored for `IAPManager.BUILD_TARGET_AMAZON`. Note that this is the required Google License Key obtained from the app's Google Play console, after applying the [ROT 13 algorithm](https://en.wikipedia.org/wiki/ROT13). You might choose to store the key as ROT-13 in your app to avoid casual decoding of the strings, however, this is not really secure, so you are advised to follow [Google's advice](https://developer.android.com/training/in-app-billing/preparing-iab-app.html) and then ROT-13 the key before passing it to the API: > Security Recommendation: Google highly recommends that you do not hard-code the exact public license key string value as provided by Google Play. Instead, construct the whole public license key string at runtime from substrings or retrieve it from an encrypted store before passing it to the constructor. This approach makes it more difficult for malicious third parties to modify the public license key string in your APK file. From 2bb4b11b1e8407b7c59f88f22ae922e43bd3f145 Mon Sep 17 00:00:00 2001 From: Michael Mee Date: Thu, 13 Aug 2020 14:18:33 +0800 Subject: [PATCH 7/7] Increment major version to 3.0.0 as this is a breaking change --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 21f89cc..b2d1322 100644 --- a/build.gradle +++ b/build.gradle @@ -2,8 +2,8 @@ buildscript { ext.kotlin_version = '1.3.72' ext { app = [ - versionCode: 21, - versionName: "2.1.0" + versionCode: 22, + versionName: "3.0.0" ] general = [