android - IAB setup never completes -
i've searched around hours trying figure out. here's have done far. (note: i'm developing in android studio)
- generated signed apk , uploaded developer console
- made in-app product , activated it
- added billing permission manifest
- extensively combed stack try , find similar problems.
basically in logcat see iabhelper starts setup, never completes @ time. (the listener never gets callback)
private static final string tag = "preference activity"; private static final string sku_pro = "desk.clock.pro.license"; static final int rc_request = 10001; iabhelper mhelper; private boolean mispremium; private arraylist<preference> prosettings; iinappbillingservice mservice; public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); addpreferencesfromresource(r.xml.preferences); bindservice(new intent("com.android.vending.billing.inappbillingservice.bind"), mserviceconn, context.bind_auto_create); prosettings = new arraylist<preference>(); actionbar b = getactionbar(); b.setdisplayhomeasupenabled(true); colorlistener(); texturelistener(); bgcolorlistener(); onpresetlistener(); gradlistener(); string base64key = "[my key dev console]"; bindservice(new intent("com.android.vending.billing.inappbillingservice.bind"), mserviceconn, context.bind_auto_create); mhelper = new iabhelper(this, base64key); mhelper.enabledebuglogging(true); log.d(tag, "starting setup"); mhelper.startsetup(new iabhelper.oniabsetupfinishedlistener() { public void oniabsetupfinished(iabresult result) { if (!result.issuccess()) { // oh noes, there problem. log.d(tag, "problem setting in-app billing: " + result); } log.d(tag, "setting success"); log.d(tag, "querying inventory"); mhelper.queryinventoryasync(mgotinventorylistener); log.d(tag, "queried"); } }); iabhelper.queryinventoryfinishedlistener mgotinventorylistener = new iabhelper.queryinventoryfinishedlistener() { public void onqueryinventoryfinished(iabresult result, inventory inventory) { if (result.isfailure()) { // handle error here mispremium = false; disableproandrevertsettings(); } else { // user have premium upgrade? mispremium = inventory.haspurchase(sku_pro); if(mispremium) { enableprosettings(); }else { disableproandrevertsettings(); } } } }; serviceconnection mserviceconn = new serviceconnection() { @override public void onservicedisconnected(componentname name) { mservice = null; } @override public void onserviceconnected(componentname name, ibinder service) { mservice = iinappbillingservice.stub.asinterface(service); } }; //rest of activity
i line in logcat never after 10-06 15:46:44.485 20787-20787/com.ssa.digitaldeskclock d/iabhelper﹕ starting in-app billing setup.
problem fixed obtaining new version of of util classes iab v3 sample. added new files util directory , went flawlessly. can else out there. see link source https://code.google.com/p/marketbilling/source/browse/v3/src/com/example/android/trivialdrivesample/util/iabhelper.java?r=5f6b7abfd0534acd5bfc7c14436f4500c99e0358
Comments
Post a Comment