Android 谷歌播放许可证-错误6是什么?
我正在用Google Play许可API测试我的应用程序。应用程序成功绑定到授权服务,但回调返回错误6。我已经检查了LicenseValidator中的错误代码,但这不是其中列出的错误代码之一 有人知道错误6是什么意思吗Android 谷歌播放许可证-错误6是什么?,android,android-lvl,Android,Android Lvl,我正在用Google Play许可API测试我的应用程序。应用程序成功绑定到授权服务,但回调返回错误6。我已经检查了LicenseValidator中的错误代码,但这不是其中列出的错误代码之一 有人知道错误6是什么意思吗 public class MyActivity extends FragmentActivity { private static final String BASE64_PUBLIC_KEY = "ZZZZ"; private static final b
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 this when it's done.
mLicenseCheckerCallback = new YAHLicenseCheckerCallback();
// Construct the LicenseChecker with a policy, obfuscator and 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 do anything if Activity is finishing.
return;
}
// Should allow user access.
}
public void dontAllow(int policyReason) {
Log.d(tag,"License - not allowed");
if (isFinishing()) {
// Don't do anything UI if Activity is finishing.
return;
}
// Should not allow access. In most cases, the app should assume
// the user has access unless it encounters this. If it does,
// the app should inform the user of their unlicensed ways
// and then either shut down the app or limit the user to a
// 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 is finishing.
return;
}
// This is a polite way of saying the developer made a mistake
// while setting up or calling the license checker library.
// Please examine the error code and fix the error.
}
}
@Override
protected void onDestroy()
{
mChecker.onDestroy();
super.onDestroy();
}
}
好的,我已经解决了。
错误6不是来自LicenseValidator,而是来自LicenseChecker,表明缺少权限。
我没有授予应用com.android.vending.CHECK_许可证。
当我这么做的时候,它开始工作了
感谢您的关注,我希望这能帮助犯同样错误的人。错误6到底说了什么?您完全正确,6不是记录在案的返回代码之一。你能告诉我们你在哪里接收和显示这个值的代码,以防有一个小错误吗?@PareshMayani:我面临着同样的问题,它在logcat中说了下面这行。
权限拒绝:从pid=7605访问服务组件信息{com.android.vending/com.google.android.finsky.services.LicensingService},uid=10003需要com.android.vending.CHECK_许可证
您可以接受自己的答案,将其从未应答队列中删除。感谢您分享解决方案。