java - In-app purchase cause error -
i'm trying make in app purchase in application wrong. made tutorial: http://developer.android.com/training/in-app-billing/purchase-iab-products.html , stackoverflows solutions id didnt , i'm still getting error after run application: java.lang.illegalstateexception: iab helper not set up. can't perform operation: queryinventory
caused response result_billing_unavailable
it's happening after call method mhelper.queryinventoryasync(mgotinventorylistener);
code 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 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 query inventory: " + result); return; } log.d(tag, "query inventory successful."); purchase farmpurchase = inventory.getpurchase(constants.sku_farm); isfarm = (farmpurchase != null); log.d(tag, "user " + (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 missed important?
Comments
Post a Comment