Java Android许可证检查失败太多了,我做错什么了吗?

Java Android许可证检查失败太多了,我做错什么了吗?,java,android,android-lvl,Java,Android,Android Lvl,我有一个使用谷歌授权服务的Android应用程序,我经常收到约5%的新用户的电子邮件,抱怨许可证检查失败。这开始影响我的销售。我到底做错了什么 this.licenseCheckerCallback = new MyLicenseCheckerCallback(); String deviceId = Secure.getString(getContentResolver(), Secure.ANDROID_ID); // Construct the LicenseChecker with

我有一个使用谷歌授权服务的Android应用程序,我经常收到约5%的新用户的电子邮件,抱怨许可证检查失败。这开始影响我的销售。我到底做错了什么

this.licenseCheckerCallback = new MyLicenseCheckerCallback();

String deviceId = Secure.getString(getContentResolver(), Secure.ANDROID_ID);

// Construct the LicenseChecker with a Policy.
this.licenseChecker = new LicenseChecker(
    this, new ServerManagedPolicy(this,
            new AESObfuscator(SALT, getPackageName(), deviceId)), 
            BASE64_PUBLIC_KEY  // Your public licensing key.
    );

this.checkLicense();




private void checkLicense() {
    this.licenseChecker.checkAccess(this.licenseCheckerCallback);
}


private class MyLicenseCheckerCallback implements LicenseCheckerCallback {

    public void allow() {
        // Don't do anything, let the user work in peace.
    }

    public void dontAllow() {
        if (isFinishing()) {
            // Don't update 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.
        // In this example, we show a dialog that takes the user to Market.
        showDialog(DIALOG_NO_LICENSE_ID);
        MyActivity.this.dialogIdCurrentlyShown = DIALOG_NO_LICENSE_ID;
    }

    public void applicationError(ApplicationErrorCode 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.
        MyActivity.this.applicationErrorMessageForDialog = String.format(getString(R.string.application_error), errorCode);
        showDialog(DIALOG_APPLICATION_ERROR_ID);
        MyActivity.this.dialogIdCurrentlyShown = DIALOG_APPLICATION_ERROR_ID;
    }
}

你没有做错什么。我和其他人都有同样的问题。你也无能为力,但仍然:

  • 打开一张谷歌的支持票,告诉他们LVL的性能不理想,正在影响合法用户
  • 在“未授权”对话框中添加“重试”按钮。有时只是暂时的网络故障导致许可证失效
  • 考虑在我们的对话中留下谷歌的支持电子邮件,或者为用户添加其他方式,以将问题传达给其来源
  • 唯一有效的选择可能是:如果响应是永久购买,则在将其存储到缓存中之前,手动增加从许可服务接收的
    GT
    时间戳的值。检查
    GT
    时间戳和
    VT
    时间戳之间的差异-如果时间戳足够大(一周),请在
    GT
    上再加一个月甚至一年。这个想法是,一旦用户通过退款期,您就可以让他/她的许可证在他/她的设备上半永久或完全永久

  • 希望这能有所帮助。

    我还没有找到谷歌支持的电子邮件。你能帮助我吗?我认为这是个好主意。他们不提供支持。然而,他们确实有一个明确的政策,在页面底部阅读。因此,您可以在电子邮件中提供html链接。