【发布时间】:2013-07-30 10:51:10
【问题描述】:
在我的一个 Android 应用程序中,我正在尝试从 Google 的应用内计费中简单地抓取库存,但它总是在
行出现错误mHelper.queryInventoryAsync(mGotInventoryListener);
带有消息
IabHelper 未设置。无法执行操作:queryInventory
这是所有 IabHelper 代码。
mHelper = new IabHelper(this, base64EncodedPublicKey);
mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
public void onIabSetupFinished(IabResult result) {
if (!result.isSuccess()) {
// Oh noes, there was a problem.
Log.d(TAG, "Problem setting up In-app Billing: " + result);
}
// Hooray, IAB is fully set up!
}
});
//check to see if ads have been removed(bought)
IabHelper.QueryInventoryFinishedListener mGotInventoryListener
= new IabHelper.QueryInventoryFinishedListener() {
public void onQueryInventoryFinished(IabResult result,
Inventory inventory) {
if (result.isFailure()) {
// handle error here
}
else {
// does the user have the premium upgrade?
if(inventory.hasPurchase(REMOVE_ADS)) removeAdsPurchased = true;
// update UI accordingly
}
}
};
mHelper.queryInventoryAsync(mGotInventoryListener);
【问题讨论】:
-
这个问题有没有启发你:stackoverflow.com/questions/13943950/… ?
标签: eclipse google-play in-app-billing