简体   繁体   English

Android许可证“ LICENSED RESPONSE”错误

[英]Android license “LICENSED RESPONSE” error

I have problem in testing the "LICENSED" response of LVL. 我在测试LVL的“许可”响应时遇到问题。 I already changed the test license response in dashboard in edit profile in market web site. 我已经在市场网站的编辑配置文件中的仪表板中更改了测试许可证响应。

When I set to "NOT LICENSED", it will prompt to buy or exit, but if I set to LICENSE, after waiting for "CHECKING LICENSE" progress bar, it will not load my main activity page, the check license loops infinitely, and I need to force close the process. 当我设置为“未许可”时,它将提示购买或退出,但是如果我设置为许可,则在等待“检查许可”进度条后,它将不会加载我的主活动页面,支票许可会无限循环,并且我需要强制关闭该过程。 I already added licensecheck Java file name in the manifest and included the intent section. 我已经在清单中添加了licensecheck Java文件名,并包含了intent部分。

The following is what I have captured in logcat. 以下是我在logcat中捕获的内容。 Anyone have an idea what's going on? 任何人都知道发生了什么事吗? How do I fix my code? 如何修复我的代码?

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();
}

Is this related to the cache response timestamp? 这与缓存响应时间戳有关吗? If yes, how can I change and modify it? 如果是,如何更改和修改它?

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

Do I need to modify ServerManagedPolicy? 我是否需要修改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;
}

Also, how can I do the following? 另外,我该怎么做?

  1. When there is no license (either no license in Google server or no cached license), then prompt disallow and go to market. 如果没有许可证(Google服务器中没有许可证或没有缓存的许可证),请提示禁止进入市场。

  2. When there is a cached license, allow user to run apps (no matter if there is no network or no network connection). 当存在缓存的许可证时,允许用户运行应用程序(无论是否没有网络或网络连接)。

  3. When there is a license in Google server (network mode), but no cached license, allow user to run apps. 如果Google服务器中有许可证(网络模式),但没有缓存的许可证,则允许用户运行应用。

The messages about missing VT, GT, and GR are normal when you set the test response to anything other than "Respond normally." 当您将测试响应设置为“正常响应”以外的其他信息时,有关丢失VT,GT和GR的消息是正常的。 There may be a logic problem in your code. 您的代码中可能存在逻辑问题。 It might help if you could post the code for startMainActivity() and also your onCreate() method (and any relevant methods they call). 如果您可以将代码发布给startMainActivity()以及onCreate()方法(以及它们调用的任何相关方法),则可能会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM