【问题标题】:Android license "LICENSED RESPONSE" errorAndroid 许可证“许可响应”错误
【发布时间】:2011-01-18 15:48:47
【问题描述】:

我在测试 LVL 的“LICENSED”响应时遇到问题。我已经在市场网站的编辑配置文件中更改了仪表板中的测试许可证响应。

当我设置为“NOT LICENSED”时,它会提示购买或退出,但如果我设置为LICENSE,在等待“CHECKING LICENSE”进度条后,它不会加载我的主活动页面,检查许可证循环无限,我需要强制关闭该过程。我已经在清单中添加了 licensecheck Java 文件名并包含了意图部分。

以下是我在logcat中捕获的。有人知道发生了什么吗?如何修复我的代码?

I/LICENSE (  312): checkLicense
I/LicenseChecker(  312): Binding to licensing service.
I/ActivityManager(   59): Start proc com.android.vending for service com.android.vending/.licensing.LicensingService: pid=320 uid=10019 gids
={3003}
I/LicenseChecker(  312): Calling checkLicense on service for com.test.apps1
I/ActivityManager(   59): Displayed activity com.test.apps1/.MActivity: 3586 ms (total 3586 ms)
I/LicenseChecker(  312): Start monitoring timeout.
I/ARMAssembler(   59): generated scanline__00000077:03515104_00000000_00000000 [ 33 ipp] (47 ins) at [0x305798:0x305854] in 914005 ns
D/GoogleLoginService(  170): onBind: Intent { act=android.accounts.AccountAuthenticator cmp=com.google.android.gsf/.loginservice.GoogleLogin
Service }
I/LicenseChecker(  312): Received response.
I/LicenseChecker(  312): Clearing timeout.
E/LicenseValidator(  312): CORI APP LICENSED!
W/ServerManagedPolicy(  312): License validity timestamp (VT) missing, caching for a minute
W/ServerManagedPolicy(  312): License retry timestamp (GT) missing, grace period disabled
W/ServerManagedPolicy(  312): Licence retry count (GR) missing, grace period disabled
D/LicenseChecker(  312): Allow
I/ActivityManager(   59): Starting activity: Intent { cmp=com.test.apps1/.MActivity }
I/LICENSE (  312): checkLicense
D/dalvikvm(  312): GC_FOR_MALLOC freed 3870 objects / 267592 bytes in 92ms
I/LicenseChecker(  312): Using cached license response
D/LicenseChecker(  312): Allow
I/ActivityManager(   59): Starting activity: Intent { cmp=com.test.apps1/.MActivity }
I/LICENSE (  312): checkLicense
I/LicenseChecker(  312): Using cached license response
D/LicenseChecker(  312): Allow
I/ActivityManager(   59): Starting activity: Intent { cmp=com.test.apps1/.MActivity }
I/LICENSE (  312): checkLicense
I/LicenseChecker(  312): Using cached license response
D/LicenseChecker(  312): Allow
I/ActivityManager(   59): Starting activity: Intent { cmp=com.test.apps1/.MActivity }
I/LICENSE (  312): checkLicense
I/LicenseChecker(  312): Using cached license response
D/LicenseChecker(  312): Allow
I/ActivityManager(   59): Starting activity: Intent { cmp=com.test.apps1/.MActivity }
I/LICENSE (  312): checkLicense
I/LicenseChecker(  312): Using cached license response
D/LicenseChecker(  312): Allow
I/ActivityManager(   59): Starting activity: Intent { cmp=com.test.apps1/.MActivity }
I/LICENSE (  312): checkLicense
W/ActivityManager(   59): Launch timeout has expired, giving up wake lock!
W/ActivityManager(   59): Activity idle timeout for HistoryRecord{44003148 com.test.apps1/.MActivity}
public void allow() 
{
    Log.d("LicenseChecker","Allow");
    //Log.i("LICENSE", "allow");
    if (isFinishing()) 
    {
        // Don't update UI if Activity is finishing.
        return;
    }
    // Should allow user access.
    displayResult(getString(R.string.allow));

    // Should allow user access.
    startMainActivity();
}

这与缓存响应时间戳有关吗?如果是,我该如何更改和修改它?

W/ServerManagedPolicy(  312): License validity timestamp (VT) missing, caching for a minute
W/ServerManagedPolicy(  312): License retry timestamp (GT) missing, grace period disabled
W/ServerManagedPolicy(  312): Licence retry count (GR) missing, grace period disabled

我需要修改 ServerManagedPolicy 吗?

public boolean allowAccess() {
    long ts = System.currentTimeMillis();
    if (mLastResponse == LicenseResponse.LICENSED) {
        // Check if the LICENSED response occurred within the validity timeout.
        if (ts <= mValidityTimestamp) {
            // Cached LICENSED response is still valid.
            return true;
        }
    } else if (mLastResponse == LicenseResponse.RETRY &&
               ts < mLastResponseTime + MILLIS_PER_MINUTE) {
        // Only allow access if we are within the retry period or we haven't used up our
        // max retries.
        return (ts <= mRetryUntil || mRetryCount <= mMaxRetries);
    }
    return false;
}

另外,我该怎么做?

  1. 当没有license时(谷歌服务器中没有license或者没有缓存的license),则提示disallow并上市。

  2. 当有缓存许可时,允许用户运行应用程序(无论是没有网络或没有网络连接)。

  3. 当谷歌服务器(网络模式)有许可证,但没有缓存许可证时,允许用户运行应用程序。

【问题讨论】:

    标签: java android android-lvl


    【解决方案1】:

    当您将测试响应设置为“正常响应”以外的任何内容时,有关缺少 VT、GT 和 GR 的消息是正常的。您的代码中可能存在逻辑问题。如果您可以发布 startMainActivity() 的代码以及您的 onCreate() 方法(以及他们调用的任何相关方法),这可能会有所帮助。

    【讨论】:

    • 您好 Ted,我终于找出了问题所在,所以我可以在响应设置为 LICENSED 时运行应用程序。但我现在有另一个问题。不确定您是否可以给我一些提示。当我在模拟器中测试时,即使我禁用或启用网络连接似乎也没有问题。它可以在检查许可证后运行。但是当我在android手机上测试时,当我第一次启用网络连接时,许可证检查成功并运行应用程序,然后我禁用网络连接,然后似乎找不到缓存的许可证,并运行 disallow() 代码。跨度>
    • 如果您在手机上使用测试账号,并且在开发者控制台中指定了特定的响应,则不会缓存响应。您是否尝试过将测试响应设置为默认响应时会发生什么?这将具有有效的 VT、GT 和 GR 数据,因此将被缓存。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-09-23
    • 1970-01-01
    • 1970-01-01
    • 2014-12-03
    • 1970-01-01
    • 1970-01-01
    • 2019-09-20
    相关资源
    最近更新 更多