我正在尝试将我的应用程序发布3个小时,但我无法让许可证检查工作。
在我的onCreate
方法中,我得到了这段代码:
// Try to use more data here. ANDROID_ID is a single point of attack.
String deviceId = Secure.getString(getContentResolver(), Secure.ANDROID_ID);
String pckName = getPackageName();
// Library calls this when it's done.
mLicenseCheckerCallback = new MyLicenseCheckerCallback();
// Construct the LicenseChecker with a policy.
mChecker = new LicenseChecker(this, new ServerManagedPolicy(this, new AESObfuscator(
SALT, pckName, deviceId)), BASE64_PUBLIC_KEY);
mChecker.checkAccess(mLicenseCheckerCallback);
回调看起来像这样
private class MyLicenseCheckerCallback implements LicenseCheckerCallback {
public void allow(int policyReason) {
if (isFinishing())
return; // Don't update UI if Activity is finishing.
// Should allow user access.
Main.isLicensed = true;
}
public void dontAllow(int policyReason) {
if (isFinishing())
return; // Don't update UI if Activity is finishing.
Main.isLicensed = false;
}
public void applicationError(int errorCode) {
if (isFinishing())
return; // Don't update UI if Activity is finishing.
Main.isLicensed = false;
}
}
只调用dontAllow方法。响应代码是291。
在logcat中,我收到“错误联系许可服务器”。
有任何想法吗?
代码对我来说很好看。但我现在有类似的问题。你是否 ...
让我知道,如果解决了问题。
谢谢你的祝福
在处理扩展文件时我也遇到了这个问题,除了更新扩展文件和清单版本#之外,我的应用程序没有任何变化。
我的应用程序终于找到并下载新的扩展文件花了一个多小时。直到那时,它只是一直给出随机错误,如“错误联系许可服务器”,然后它会说它下载了文件(但字节大小为1字节,所以它没有),文件验证将失败,等等
正如乔达在评论中所说,谷歌有时候会很慢。等几个小时再试一次。做克里斯汀在她的回答中列出的步骤也可以提供帮助,但可能只是需要等待更长时间。
它的网络问题。请用高速互联网进行测试。