|
|
@ -68,8 +68,9 @@ import java.util.Arrays;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
public class ActivityBilling extends ActivityBase
|
|
|
|
public class ActivityBilling extends ActivityBase implements
|
|
|
|
implements /*PurchasesUpdatedListener, BillingClientStateListener,*/ FragmentManager.OnBackStackChangedListener {
|
|
|
|
/* BillingClientStateListener, SkuDetailsResponseListener, PurchasesResponseListener, PurchasesUpdatedListener, */
|
|
|
|
|
|
|
|
FragmentManager.OnBackStackChangedListener {
|
|
|
|
private boolean standalone = false;
|
|
|
|
private boolean standalone = false;
|
|
|
|
private int backoff = 4; // seconds
|
|
|
|
private int backoff = 4; // seconds
|
|
|
|
//private BillingClient billingClient = null;
|
|
|
|
//private BillingClient billingClient = null;
|
|
|
@ -354,16 +355,15 @@ public class ActivityBilling extends ActivityBase
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void queryPurchases() {
|
|
|
|
private void queryPurchases() {
|
|
|
|
billingClient.queryPurchasesAsync(BillingClient.SkuType.INAPP, new PurchasesResponseListener() {
|
|
|
|
billingClient.queryPurchasesAsync(BillingClient.SkuType.INAPP, this);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onQueryPurchasesResponse(@NonNull BillingResult result, @NonNull List<Purchase> list) {
|
|
|
|
public void onQueryPurchasesResponse(@NonNull BillingResult result, @NonNull List<Purchase> list) {
|
|
|
|
if (result.getResponseCode() == BillingClient.BillingResponseCode.OK)
|
|
|
|
if (result.getResponseCode() == BillingClient.BillingResponseCode.OK)
|
|
|
|
checkPurchases(list);
|
|
|
|
checkPurchases(list);
|
|
|
|
else
|
|
|
|
else
|
|
|
|
reportError(result, "IAB query purchases");
|
|
|
|
reportError(result, "IAB query purchases");
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
interface IBillingListener {
|
|
|
|
interface IBillingListener {
|
|
|
@ -479,8 +479,9 @@ public class ActivityBilling extends ActivityBase
|
|
|
|
SkuDetailsParams.Builder builder = SkuDetailsParams.newBuilder();
|
|
|
|
SkuDetailsParams.Builder builder = SkuDetailsParams.newBuilder();
|
|
|
|
builder.setSkusList(query);
|
|
|
|
builder.setSkusList(query);
|
|
|
|
builder.setType(BillingClient.SkuType.INAPP);
|
|
|
|
builder.setType(BillingClient.SkuType.INAPP);
|
|
|
|
billingClient.querySkuDetailsAsync(builder.build(),
|
|
|
|
billingClient.querySkuDetailsAsync(builder.build(), this);
|
|
|
|
new SkuDetailsResponseListener() {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onSkuDetailsResponse(@NonNull BillingResult result, List<SkuDetails> skuDetailsList) {
|
|
|
|
public void onSkuDetailsResponse(@NonNull BillingResult result, List<SkuDetails> skuDetailsList) {
|
|
|
|
if (result.getResponseCode() == BillingClient.BillingResponseCode.OK) {
|
|
|
|
if (result.getResponseCode() == BillingClient.BillingResponseCode.OK) {
|
|
|
@ -492,8 +493,6 @@ public class ActivityBilling extends ActivityBase
|
|
|
|
} else
|
|
|
|
} else
|
|
|
|
reportError(result, "IAB query SKUs");
|
|
|
|
reportError(result, "IAB query SKUs");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void consumePurchase(final Purchase purchase) {
|
|
|
|
private void consumePurchase(final Purchase purchase) {
|
|
|
|
for (String sku : purchase.getSkus()) {
|
|
|
|
for (String sku : purchase.getSkus()) {
|
|
|
|