问题描述
我购买了一个名为 WebViewGold 的模板。它确实处理购买,但不消费购买。如何调整此脚本以消费购买?我整个上午都在尝试不同的例子,但我没有运气。是否可以只在 if (!purchase.isAckNowledged()) {
中添加一个消耗函数?
public void handlePurchase(Purchase purchase) {
if (purchase.getPurchaseState() == Purchase.PurchaseState.PURCHASED) {
Toast.makeText(MainActivity.this,"Purchased :)",Toast.LENGTH_SHORT).show();
if (disableAdMob) {
HIDE_ADS_FOR_PURCHASE = true;
AlertManager.purchaseState(getApplicationContext(),true);
mAdView.setVisibility(View.GONE);
mAdView.destroy();
adLayout.removeAllViews();
adLayout.setVisibility(View.GONE);
} else {
HIDE_ADS_FOR_PURCHASE = false;
mAdView.setEnabled(true);
AlertManager.purchaseState(getApplicationContext(),false);
mAdView.setVisibility(View.VISIBLE);
adLayout.setVisibility(View.VISIBLE);
mAdView.loadAd(new AdRequest.Builder().build());
}
webView.loadUrl(successUrl);
successUrl = "";
if (!purchase.isAckNowledged()) {
AckNowledgePurchaseParams ackNowledgePurchaseParams =
AckNowledgePurchaseParams.newBuilder()
.setPurchasetoken(purchase.getPurchasetoken())
.build();
billingClient.ackNowledgePurchase(ackNowledgePurchaseParams,ackNowledgePurchaseResponseListener);
}
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)