android - Google Play License - what is error 6? -
i testing app google play license api. app binds licensing service, callback gives error 6. i've checked error codes in licensevalidator , not 1 of error codes listed there.
does know error 6 means?
public class myactivity extends fragmentactivity { private static final string base64_public_key = "zzzz"; private static final byte[] salt = new byte[] { xxxx }; private licensecheckercallback mlicensecheckercallback; private licensechecker mchecker; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); string deviceid = secure.getstring(getcontentresolver(), secure.android_id); // library calls when it's done. mlicensecheckercallback = new yahlicensecheckercallback(); // construct licensechecker policy, obfuscator , public key mchecker = new licensechecker(this, new servermanagedpolicy(this, new aesobfuscator(salt, getpackagename(), deviceid)), base64_public_key); mchecker.checkaccess(mlicensecheckercallback); } private class yahlicensecheckercallback implements licensecheckercallback { public void allow(int policyreason) { log.d(tag,"license - allowed"); if (isfinishing()) { // don't if activity finishing. return; } // should allow user access. } public void dontallow(int policyreason) { log.d(tag,"license - not allowed"); if (isfinishing()) { // don't ui if activity finishing. return; } // should not allow access. in cases, app should assume // user has access unless encounters this. if does, // app should inform user of unlicensed ways // , either shut down app or limit user // restricted set of features. } public void applicationerror(int errorcode) { log.d(tag,"license - application error code "+errorcode); if (isfinishing()) { // don't update ui if activity finishing. return; } // polite way of saying developer made mistake // while setting or calling license checker library. // please examine error code , fix error. } } @override protected void ondestroy() { mchecker.ondestroy(); super.ondestroy(); } }
ok, i've solved it. error 6 isn't coming licencevalidator, it's coming licensechecker , indicates permission missing. hadn't given app com.android.vending.check_license permission. when did, started working.
thanks interest , hope helps makes same mistake.
Comments
Post a Comment