Retry ack purchase

pull/168/head
M66B 5 years ago
parent d36225c002
commit 0db54919e8

@ -384,7 +384,7 @@ public class ActivityBilling extends ActivityBase implements PurchasesUpdatedLis
editor.putBoolean("pro", true); editor.putBoolean("pro", true);
editor.putLong(getSkuPro() + ".cached", new Date().getTime()); editor.putLong(getSkuPro() + ".cached", new Date().getTime());
} else } else
acknowledgePurchase(purchase); acknowledgePurchase(purchase, 0);
} }
} else { } else {
@ -442,7 +442,7 @@ public class ActivityBilling extends ActivityBase implements PurchasesUpdatedLis
}); });
} }
private void acknowledgePurchase(final Purchase purchase) { private void acknowledgePurchase(final Purchase purchase, int retry) {
Log.i("IAB acknowledging purchase SKU=" + purchase.getSku()); Log.i("IAB acknowledging purchase SKU=" + purchase.getSku());
AcknowledgePurchaseParams params = AcknowledgePurchaseParams params =
AcknowledgePurchaseParams.newBuilder() AcknowledgePurchaseParams.newBuilder()
@ -462,8 +462,17 @@ public class ActivityBilling extends ActivityBase implements PurchasesUpdatedLis
listener.onPurchased(purchase.getSku()); listener.onPurchased(purchase.getSku());
WidgetUnified.update(ActivityBilling.this); WidgetUnified.update(ActivityBilling.this);
} else } else {
reportError(result, "IAB acknowledged SKU=" + purchase.getSku()); if (retry < 3) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
acknowledgePurchase(purchase, retry + 1);
}
}, (retry + 1) * 10 * 1000L);
} else
reportError(result, "IAB acknowledged SKU=" + purchase.getSku());
}
} }
}); });
} }

Loading…
Cancel
Save