Implement updated library methods
This commit is contained in:
parent
c762e072d2
commit
cfd7dfef6b
5 changed files with 11 additions and 13 deletions
|
@ -16,7 +16,6 @@
|
|||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
<uses-permission android:name="com.android.vending.BILLING" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
|
||||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue