mardi 14 avril 2015

In-app purchase cause error


Vote count:

0




I'm trying to make in app purchase in my application but something is wrong. I made everything from this tutorial: http://ift.tt/1m3EWX0 and from stackoverflows solutions but id didnt help and I'm still getting this error after run application: java.lang.IllegalStateException: IAB helper is not set up. Can't perform operation: queryInventory caused by response RESULT_BILLING_UNAVAILABLE It's happening after call method mHelper.queryInventoryAsync(mGotInventoryListener); This is my code from onCreate in activity:



mHelper = new IabHelper(this, string1 + string2 + string3);
mHelper.enableDebugLogging(true);
mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
public void onIabSetupFinished(IabResult result) {
if (!result.isSuccess()) {
Log.d(TAG, "Problem setting up In-app Billing: " + result);
}
if (mHelper == null) return;
Log.d(TAG, "Setup successful. Querying inventory.");
mHelper.queryInventoryAsync(mGotInventoryListener);
}
});


and variable definition in activity:



IabHelper.QueryInventoryFinishedListener mGotInventoryListener = new IabHelper.QueryInventoryFinishedListener() {
public void onQueryInventoryFinished(IabResult result, Inventory inventory) {
Log.d(TAG, "Query inventory finished.");
if (mHelper == null) return;

if (result.isFailure()) {
Log.e(TAG, "**** TrivialDrive Error: " + "Failed to query inventory: " + result);
return;
}

Log.d(TAG, "Query inventory was successful.");

Purchase farmPurchase = inventory.getPurchase(Constants.SKU_FARM);
isFarm = (farmPurchase != null);
Log.d(TAG, "User is " + (isFarm ? "FARM" : "NOT FARM"));

Purchase birdsPurchase = inventory.getPurchase(Constants.SKU_BIRDS);
isBirds = (birdsPurchase != null);
Log.d(TAG, "User " + (isBirds ? "BIRDS" : "NOT BIRDS"));

Log.d(TAG, "Initial inventory query finished; enabling main UI.");
}
};


Do I missed something important?



asked 43 secs ago







In-app purchase cause error

Aucun commentaire:

Enregistrer un commentaire