在我的Android應用程序之一,我想實現從谷歌的應用內結算清單的一個簡單的搶,但它一直給我的錯誤在谷歌應用內結算,導致異常
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);
請問這個問題給你一些燈光:http:// stackoverflow.com/questions/13943950/in-app-billing-doesnt-work-iab-helper-is-not-set-up? – Raptor