use of com.odysee.app.tasks.lbryinc.AndroidPurchaseTask in project odysee-android by OdyseeTeam.
the class HandleBillingPurchase method handleBillingPurchase.
public static void handleBillingPurchase(Purchase purchase, BillingClient billingClient, Context context, View progressView, RewardVerifiedHandler handler) {
String sku = purchase.getSku();
if (MainActivity.SKU_SKIP.equalsIgnoreCase(sku)) {
// send purchase token for verification
if (purchase.getPurchaseState() == Purchase.PurchaseState.PURCHASED) /*&& isSignatureValid(purchase)*/
{
// consume the purchase
String purchaseToken = purchase.getPurchaseToken();
ConsumeParams consumeParams = ConsumeParams.newBuilder().setPurchaseToken(purchaseToken).build();
billingClient.consumeAsync(consumeParams, new ConsumeResponseListener() {
@Override
public void onConsumeResponse(@NonNull BillingResult billingResult, @NonNull String s) {
}
});
// send the purchase token to the backend to complete verification
AndroidPurchaseTask task = new AndroidPurchaseTask(purchaseToken, progressView, context, handler);
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}
}
Aggregations