联系许可服务器

时间:2012-12-17 15:22:43

标签: java android android-lvl

我正在尝试将我的应用发布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中,我收到“错误联系许可服务器。”

  • 该应用程序已升级到开发者控制台。

  • 正确复制了公钥(没有任何空格)。

  • 手机(三星Galaxy S2与Android 4.0.4股票)上网

有什么想法吗?

3 个答案:

答案 0 :(得分:4)

代码对我来说很好看。但我现在有类似的问题。你有没有......

  • 重新启动网络连接
  • 重新启动了手机
  • 清除Google Play商店的数据(设置 - > apps - > google play store)
  • 清除Google Play服务的数据
  • 使用您的发布商/测试帐户登录您的设备google play商店

让我知道,如果解决了问题。

由于 祝福

答案 1 :(得分:0)

在处理扩展文件时我也遇到了这个问题,除了更新扩展文件和清单版本#之外,我的应用程序没有任何变化。

我的应用程序终于找到并下载新的扩展文件花了一个多小时。直到那时,它只是一直给出随机错误,如“错误联系许可服务器”,然后它会说它下载了文件(但字节大小为1字节,所以它没有),文件验证将失败,等。

正如Joda在评论中所说,谷歌有时候会很慢。等几个小时再试一次。按照Christine在她的回答中列出的步骤也可以提供帮助,但可能只需要等待更长时间。

答案 2 :(得分:-2)

其互联网问题。 请用高速互联网进行测试。