开发者

Android license "LICENSED RESPONSE" error

I have problem in testing the "LICENSED" response of LVL. I alread开发者_运维知识库y 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.

The following is what I have captured in 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?

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.

  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.


The messages about missing VT, GT, and GR are normal when you set the test response to anything other than "Respond normally." 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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜