0
我正在關注谷歌示例以在我的應用程序中設置應用程序結算。我已成功整合到應用程序結算API中。但是,當我打電話consumeAsync();
的Android工作室表示無法解析方法consumeAsync 無法使用項目 - 無法解析consumeAsync
mHelper = new IabHelper(this, base64EncodedPublicKey);
mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
public void onIabSetupFinished(IabResult result) {
if (!result.isSuccess()) {
// Oh no, there was a problem.
Log.d("BillingAPI", "Problem setting up In-app Billing: " + result);
} else {
IabHelper.QueryInventoryFinishedListener
mQueryFinishedListener = new IabHelper.QueryInventoryFinishedListener() {
public void onQueryInventoryFinished(IabResult result, Inventory inventory) {
if (result.isFailure()) {
// handle error
return;
} else {
boolean isPurchased = inventory.hasPurchase(REMOVE_ADS);
Log.d("Is this app owned?", isPurchased + "");
IabHelper.OnConsumeFinishedListener mConsumeFinishedListener = new IabHelper.OnConsumeFinishedListener() {
@Override
public void onConsumeFinished(Purchase purchase, IabResult result) {
if (result.isSuccess()) {
// Purchase consumed.
} else {
// Purchase not consumed.
}
}
};
if (isPurchased) {
mHelper.consumeAsync(isPurchased, mConsumeFinishedListener);
}
}
}
};