diff --git a/OsmAnd/AndroidManifest.xml b/OsmAnd/AndroidManifest.xml
index 01f760954b..a1c3af7e30 100644
--- a/OsmAnd/AndroidManifest.xml
+++ b/OsmAnd/AndroidManifest.xml
@@ -16,7 +16,6 @@
-
diff --git a/OsmAnd/build-common.gradle b/OsmAnd/build-common.gradle
index 38dce71283..d0dd3dba86 100644
--- a/OsmAnd/build-common.gradle
+++ b/OsmAnd/build-common.gradle
@@ -348,7 +348,7 @@ dependencies {
implementation 'org.immutables:gson:2.5.0'
implementation 'com.vividsolutions:jts-core:1.14.0'
implementation 'com.google.openlocationcode:openlocationcode:1.0.4'
- implementation 'com.android.billingclient:billing:2.0.3'
+ implementation 'com.android.billingclient:billing:3.0.2'
// turn off for now
//implementation 'com.atilika.kuromoji:kuromoji-ipadic:0.9.0'
implementation 'com.squareup.picasso:picasso:2.71828'
diff --git a/OsmAnd/src-google/net/osmand/plus/inapp/InAppPurchaseHelperImpl.java b/OsmAnd/src-google/net/osmand/plus/inapp/InAppPurchaseHelperImpl.java
index d5ff6fcedf..8432742910 100644
--- a/OsmAnd/src-google/net/osmand/plus/inapp/InAppPurchaseHelperImpl.java
+++ b/OsmAnd/src-google/net/osmand/plus/inapp/InAppPurchaseHelperImpl.java
@@ -511,7 +511,7 @@ public class InAppPurchaseHelperImpl extends InAppPurchaseHelper {
String introductoryPrice = skuDetails.getIntroductoryPrice();
String introductoryPricePeriod = skuDetails.getIntroductoryPricePeriod();
- String introductoryPriceCycles = skuDetails.getIntroductoryPriceCycles();
+ int introductoryPriceCycles = skuDetails.getIntroductoryPriceCycles();
long introductoryPriceAmountMicros = skuDetails.getIntroductoryPriceAmountMicros();
if (!Algorithms.isEmpty(introductoryPrice)) {
try {
diff --git a/OsmAnd/src/net/osmand/plus/inapp/InAppPurchases.java b/OsmAnd/src/net/osmand/plus/inapp/InAppPurchases.java
index 7cc9a8fbee..e6ec431187 100644
--- a/OsmAnd/src/net/osmand/plus/inapp/InAppPurchases.java
+++ b/OsmAnd/src/net/osmand/plus/inapp/InAppPurchases.java
@@ -405,16 +405,12 @@ public abstract class InAppPurchases {
String introductoryPrice,
long introductoryPriceAmountMicros,
String introductoryPeriodString,
- String introductoryCycles) throws ParseException {
+ int introductoryCycles) throws ParseException {
this.subscription = subscription;
this.introductoryPrice = introductoryPrice;
this.introductoryPriceAmountMicros = introductoryPriceAmountMicros;
this.introductoryPeriodString = introductoryPeriodString;
- try {
- this.introductoryCycles = Integer.parseInt(introductoryCycles);
- } catch (NumberFormatException e) {
- throw new ParseException("Cannot parse introductoryCycles = " + introductoryCycles, 0);
- }
+ this.introductoryCycles = introductoryCycles;
introductoryPriceValue = introductoryPriceAmountMicros / 1000000d;
introductoryPeriod = Period.parse(introductoryPeriodString);
}
diff --git a/OsmAnd/src/net/osmand/plus/inapp/util/BillingManager.java b/OsmAnd/src/net/osmand/plus/inapp/util/BillingManager.java
index b5b3c654f9..561229d92c 100644
--- a/OsmAnd/src/net/osmand/plus/inapp/util/BillingManager.java
+++ b/OsmAnd/src/net/osmand/plus/inapp/util/BillingManager.java
@@ -135,18 +135,21 @@ public class BillingManager implements PurchasesUpdatedListener {
* Start a purchase flow
*/
public void initiatePurchaseFlow(final Activity activity, final SkuDetails skuDetails) {
- initiatePurchaseFlow(activity, skuDetails, null);
+ initiatePurchaseFlow(activity, skuDetails, null, null);
}
/**
* Start a purchase or subscription replace flow
*/
- public void initiatePurchaseFlow(final Activity activity, final SkuDetails skuDetails, final String oldSku) {
+ public void initiatePurchaseFlow(final Activity activity, final SkuDetails skuDetails, final String oldSku, final String purchaseToken) {
Runnable purchaseFlowRequest = new Runnable() {
@Override
public void run() {
- LOG.debug("Launching in-app purchase flow. Replace old SKU? " + (oldSku != null));
- BillingFlowParams purchaseParams = BillingFlowParams.newBuilder().setSkuDetails(skuDetails).setOldSku(oldSku).build();
+ BillingFlowParams.Builder paramsBuilder = BillingFlowParams.newBuilder().setSkuDetails(skuDetails);
+ if (oldSku != null) {
+ paramsBuilder.setOldSku(oldSku, purchaseToken);
+ }
+ BillingFlowParams purchaseParams = paramsBuilder.build();
mBillingClient.launchBillingFlow(activity, purchaseParams);
}
};