我在测试LVL的“LICENSED”响应方面遇到了问题。我已经在市场网站的编辑档案中更改了仪表板中的测试许可证响应。
当我设置为“NOT LICENSED”时,它会提示购买或退出,但如果我设置为LICENSE,等待“CHECKING LICENSE”进度条后,它将不会加载我的主活动页面,检查许可证循环无限地,我需要强制关闭这个过程。我已经在清单中添加了licensecheck Java文件名,并包含了intent部分。
以下是我在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;
}
另外,我该怎么做?
如果没有许可证(Google服务器中没有许可证或没有缓存许可证),则提示禁止并进入市场。
当有缓存许可证时,允许用户运行应用程序(无论是否没有网络或没有网络连接)。
如果Google服务器中有许可证(网络模式)但没有缓存许可证,请允许用户运行应用程序。
答案 0 :(得分:1)
当您将测试响应设置为“正常响应”以外的任何其他内容时,有关缺少VT,GT和GR的消息是正常的。您的代码中可能存在逻辑问题。如果您可以发布startMainActivity()的代码以及onCreate()方法(以及他们调用的任何相关方法),这可能会有所帮助。